Skip to content
Advertisement

Tag: c++

How atomic the fork() syscall actually is?

Assuming check_if_pid_exists(pid) returns true when a process with such a pid exists (but possibly hasn’t been running yet) or false when there is no process with such pid, is there any chance in parent code for a race condition when the fork() returned the child pid, however the kernel hasn’t had a chance to initialize the data structures so that

Cannot get memory allocated from `flex_array_alloc` when requesting a relatively big size in linux kernel

I’m doing some linux kernel development. And I’m going to allocate some memory space with something like: ptr = flex_array_alloc(size=136B, num=1<<16, GFP_KERNEL) And ptr turns out to be NULL every time I try. What’s more, when I change the size to 20B or num to 256,there’s nothing wrong and the memory can be obtained. So I want to know if

Unsigned long into char array

Here is an example of my code : My question is, why does this last memcpy works ? i would expect to put CRYPTO and not &CRYPTO in arguments… For me, CRYPTO is the value i want so 0xe8ba8fa3 and &CRYPTO the address. And for me, CRYPTO is not a pointer, so why i need to use memcpy with &CRYPTO

How do the clock function works in operating systems?

I don’t understand how clock function works within an operating system. First the documentation for clock function in www.cplusplus.com is: As far as I understand, the clock function must access directly some register within the CPU that is a counter for CPU cycles. How is this possible? I mean, any register of 32 bits would overflow very soon if it

How to create a navigation menu in dotnet application?

I have created a console application which have a menu that allow me to navigate between the menu items. I handle the navigation logic in this method: here the full class. Now on windows all works well, but when I run this application on my linux with systemd I get: Unhandled Exception: System.InvalidOperationException: Cannot read key when either application does

How to reproduce the accept error in Linux

I’m learning Unix Network Programming Volume 1, I want to reproduce the accept error for RST in Linux. server: call socket(), bind(), listen(), and sleep(10) client: call socket(), connect(), setsockopt() of LINGER, close() and return server: call accept() I think that the 3rd steps will get an error like ECONNABORTED, but not. Do I want to know why? I will

Advertisement