What is the basic difference between NPTL and POSIX threads? How have these two evolved? Answer POSIX threads (pthread) is not an implementation, it is a API specification (a standard, on paper, in english) of several functions whose name starts with pthread_ and which are defined in <pthread.h> header. POSIX is also a set of specifications. NPTL is now inside
Tag: posix
How can I obtain a case sensitive path on Linux without directory iteration?
Given a mounted cifs file system /network/cifs which is case insensitive, how do I obtain the case sensitive path using C? For example, the fs has a file /network/cfis/Adena/t.txt. Given /network/cfis/AdEnA/T.txt (which properly resolves), I want /network/cfis/Adena/t.txt. I know one way to do it is to recursively iterate over the path, match them in all lower case, and get the
How to open serial port in linux without changing any pin?
Posix requires changing RTS pin on port opening. I want a way to avoid it. Answer Having the same problem, I’d give it a try by patching the ftdi_sio kernel driver. You just need to uncomment a small piece of code in ftdi_dtr_rts() like this: and the RTS handshake line is not longer changed upon open() call. Note, that the
How to obtain total available disk space in Posix systems?
I’m writing a cross-platform application, and I need the total available disk space. For posix systems (Linux and Macos) I’m using statvfs. I created this C++ method: Unfortunately I’m getting quite strange values I can’t understand. For instance: f_blocks = 73242188 f_bsize = 1048576 f_bfree = 50393643 … Are those values in bits, bytes or anything else? I read here
How do you get info for an arbitrary time zone in Linux / POSIX?
Ideally, what I’d like to be able to do is take the name of a time zone and call a function to ask for its corresponding time zone info (offset from UTC, DST offset, dates for DST switch, etc.) in Linux. However, I can’t find any way to do this. The information exists in /usr/share/zoneinfo/ in the various binary files
How can I convert a file pointer ( FILE* fp ) to a file descriptor (int fd)?
I have a FILE *, returned by a call to fopen(). I need to get a file descriptor from it, to make calls like fsync(fd) on it. What’s the function to get a file descriptor from a file pointer? Answer The proper function is int fileno(FILE *stream). It can be found in <stdio.h>, and is a POSIX standard but not
C++ wrapper for posix and linux specific functions [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 5 years ago. Improve this question Do you know about any good library wrapping posix and linux
Get directory path by fd
I’ve run into the need to be able refer to a directory by path given its file descriptor in Linux. The path doesn’t have to be canonical, it just has to be functional so that I can pass it to other functions. So, taking the same parameters as passed to a function like fstatat(), I need to be able to
Is it possible to unlisten on a socket?
Is it possible to unlisten on a socket after you have called listen(fd, backlog)? Edit: My mistake for not making myself clear. I’d like to be able to temporarily unlisten on the socket. Calling close() will leave the socket in the M2LS state and prevent me from reopening it (or worse, some nefarious program could bind to that socket) Temporarily