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…
Tag: posix
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…
how to implement POSIX threads ( pthread.h ) on fedora 9
I need to use pthreads but it seems that I do not have it in my fedora and I cannot found how to install it. Thanks Answer Fedora 9 uses Linux Kernel version 2.6 and this version is fully compatible with libc 2.3.2. This libc contains the pthread.h header. Check this implementation example. And compile with:
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: …
What could cause “bad file descriptor” in multithreaded environment?
This question is somehow similar to Bad file descriptor but it’s not the same at all. I know this is “bad question” (“too localized” maybe), but I can’t figure it out and I’m now out of any ideas. Introduction I have a manager thread, that starts 75 other threads. Eac…
Is wget or similar programs always available on POSIX systems?
Is there an HTTP client like wget/lynx/GET that is distributed by default in POSIX or *nix operating systems that could be used for maximum portability? I know most systems have wget or lynx installed, but I seem to remember installing some Ubuntu server systems using default settings and they had neither wge…
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 …