Skip to content

Tag: posix

Safe global state for signal handling

I am toying around with Rust and various UNIX libraries. A use-case that I have right now is that I want to react to POSIX signals. To keep things reasonable I want to create an abstraction over the signal handling so that the rest of my program doesn’t have to worry about them as much. Let’s call…

what is the difference between uio.h and io.h?

Sometimes I see compiler complaining about this line with fatal error: sys/io.h: No such file or directory If I simply change it to It will magically work. Can someone explain to me the difference? Why do some OSes have one but not the other? Edit: This issue happens on a Linux, not just OS X. Answer Generall…

What is the epoch of CLOCK_TAI?

Since Linux kernel version 3.10, the function clock_gettime() now accept CLOCK_TAI. I didn’t manage to find a detailed description of this clock. What is its epoch ? EDIT 1: Just compared the output of CLOCK_REALTIME and CLOCK_TAI on my Linux 3.19 OS and it returns the exact same value (1442582497) !? I…

Executing an external program when forking is not advisable

I have this a big server software that can hog 4-8GB of memory. This makes fork-exec cumbersome, as the fork itself can take significant time, plus the default behavior seems to be that fork will fail unless there is enough memory for a copy of the entire resident memory. Since this is starting to show as the…

I read more than I write in file

I have a file, partitioned in fixed sized blocks. I am copying a test_file.txt into the 3rd block of the file. I read and copied 18 bytes. Then I am trying to copy from the file that very same .txt file I just imported to a newly created .txt, but I am writing 256 bytes to the new file. Moreover,

Physical disk block size on POSIX using C/C++

I’m working on a high performance I/O program and I’m trying to find the best way to determine the _physical_ (and not the _logical_) byte size of a device’s disk blocks with C++. My research so far has led me to the following code snippet: The man pages says the following about st_blksize: …

How to kill all processes with a given partial name? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …