Questions tagged [posix]
15 questions
13
votes
2 answers
Proper way of handling EINTR in libraries
What is the recommended etiquette when it comes to EINTR in libraries?
I'm currently writing a function that does some file system tasks with the POSIX API, but a lot of the calls I use can potentially return EINTR. Additionally, the function can…

Rufflewind
- 2,217
- 1
- 15
- 19
10
votes
2 answers
Why do programmers define programming models to replace C/POSIX for parallelism?
Providers of new computer architectures regularly try
to introduce new programming models, e.g. recently
CUDA/OpenCL for GPGPUs, and displace C/POSIX as the
control interface to platform parallelism. (Poss & Koening, AM3: Towards a hardware…

Mehdi Haghgoo
- 237
- 1
- 5
4
votes
1 answer
Simple solution for calling a function only on one thread, queuing waiting calls?
Let’s assume there is a function EventHandler that is called on multiple threads at different points in time.
EventHandler has to call SomeOtherFunction, but these calls shall only happen on one thread at a time.
That means: If a call to…

Martin
- 466
- 5
- 12
3
votes
0 answers
Origin of the strftime %c format field order in POSIX locale
In standard POSIX locale strftime(buf, size, "%c", time) will format the date and time in an order that has confused me a number of times because it has month and day precede the time, but year follow at the end. Example (from ccpreference): Sun Oct…

MvG
- 382
- 1
- 6
2
votes
2 answers
algorithm for shell language interpreter to find if a char is between quotes
Assume we have a string s (a C char *) that is a program in a language L. I want to parse L and know the following from the specification
The following characters must be quoted if they are to represent
themselves:
| & ; < > ( ) $ ` \ "…

Niklas Rosencrantz
- 8,008
- 17
- 56
- 95
2
votes
3 answers
long (or bizarre) file paths
I know that (on Linux at least, with native file systems like Ext3) file paths can in theory be quite long, and PATH_MAX is often (but not always) as big as 4096 (see this; and this explains it could be longer or runtime defined!).
However, file…

Basile Starynkevitch
- 32,434
- 6
- 84
- 125
2
votes
1 answer
Ensuring reliability of cross-compilation
Provided that my code is fully standards compliant with no undefined behaviour, how can I best assure that it will be possible to cross-compile my software for any architecture?
I had some ideas, but I don't if it's wise or possible to implement…

Janus Troelsen
- 279
- 2
- 16
1
vote
1 answer
What is the advantage of POSIX queue or just normal data structure queue?
I'm programming with the embedded device running Linux, where memory is less, I just have 64MB flash only. I planned to use queues for the thread communication.
In which I came across with using POSIX queue or just use the simple queue.
Actually,…

danglingpointer
- 137
- 8
1
vote
2 answers
Can packet sizes be relied upon in TCP/IP, at least for the first read() call on a connection?
Assume you have a client application which is known to connect to a given IP, and send a fixed size message (of size X = ~dozen bytes) upon connection, and wait for a reply.
If you're writing a server, can you guarantee that the first (non-EAGAIN)…

Bwmat
- 769
- 1
- 6
- 14
0
votes
1 answer
Help architect a timer-based scheduler
I am writing a timer-based scheduler to accomplish the task of informing a certain process of what to do and when.
The Idea:
Inform an X process of certain requests to perform at timed-intervals. So if the X process needs to perform an action every…

xyf
- 109
- 4
0
votes
2 answers
copying of memory vs pointer to memory in real time systems
While working in a multi-threaded environment, then data sharing seems to be a good option to pass data between threads.
While working with real time systems it is apparently advisable to go with memory optimization.
So, in my scenario, I have one…

Nishant Bijani A
- 11
- 1
0
votes
1 answer
Using syscalls to read files - is this bad?
I have some (presumably stable) legacy C code that uses POSIX system calls to read binary files. It's nothing more than creat(), read(), and write(). The program doesn't sit close to the metal at all (it loads string data into memory), so it seems…

William
- 213
- 2
- 7
-1
votes
3 answers
Is it possible to solve this synchronization problem using mutex and conditional variables?
I am trying to solve this synchronization problem in C to practice for my lectures of Operating Systems where we use POSIX and Linux. I've been trying for days to find an approach to this problem with no luck, and I can't seem to find similar…

78dtat78da
- 1
- 1
-1
votes
1 answer
Creating a "lite" version of shared library on Linux/POSIX in addition to full version
I have a large shared library, a collection of functions created from numerous .a files into libeverything.so. The code for the .a files is obviously compiled with -fPIC. I also have libeverything.a which contains a GROUP ( part1.a part2.a part3.a…

juhist
- 2,579
- 10
- 14
-2
votes
1 answer
For loop and recursion for a new shell in C
I code a new shell in C, that could be done in several ways: Flex/bison, finite state machine, abstract syntax tree or just a tokenizer in C. Now I've written a for-loop that changes the condition of the increment and I wonder if that is the same…

Niklas Rosencrantz
- 8,008
- 17
- 56
- 95