Questions tagged [posix]

POSIX (Portable Operating System Interface) is a set of standards defining programming APIs, a command interpreter, and common utilities for Unix-like operating systems.

POSIX (an acronym for "Portable Operating System Interface") is a family of standards that specifies the behaviour of Unix-like operating systems.

These standards define:

  • A standard operating system interface and environment
  • A programming API for the C programming language
  • The behavior of a command interpreter (or "shell")
  • The behavior of common utility programs invocable from the shell

The POSIX standards are developed by the Austin Common Standards Revision Group, a joint technical working group led by representatives from IEEE PASC, ISO/IEC JTC 1/SC 22, and The Open Group.

The current set of POSIX standards is available online.

POSIX is a trademark of the IEEE.

5973 questions
3
votes
1 answer

In a client-server program, is it possible for the server to write multiple lines to the client, using the write() function?

For example, if the client asks the server for the biggest and the smallest size of a particular object, the server would need to reply to the client's request with both variables. Is it possible to send two strings from the server for the client to…
Prinks
  • 33
  • 3
3
votes
1 answer

Can i give mapped memory to malloc?

Say I have a big block of mapped memory I finished using. It came from mmaping anonymous memory or using MAP_PRIVATE. I could munmap it, then have malloc mmap again the next time I make a big enough allocation. Could I instead give the memory to…
Filipp
  • 1,843
  • 12
  • 26
3
votes
3 answers

How to portability use "${@:2}"?

On Allow for ${@:2} syntax in variable assignment they say I should not use "${@:2}" because it breaks things across different shells, and I should use "${*:2}" instead. But using "${*:2}" instead of "${@:2}" is nonsense because doing "${@:2}" is…
Evandro Coan
  • 8,560
  • 11
  • 83
  • 144
3
votes
2 answers

Can this function be compliant with two versions of POSIX?

This is the synopsis for strspn: #include size_t strspn(const char *s1, const char *s2); This is the description and return value for POSIX.1-2001: The strspn() function shall compute the length (in bytes) of the maximum initial…
S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
3
votes
1 answer

Why can't get data from tail -f?

In my program I'm redirecting output of child process to pipe and in parent getting this result and doing something (this is not important). But my program doesn't work when I'm using tail -f test.txt command and doesn't recieve any data during tail…
Mihran Hovsepyan
  • 10,810
  • 14
  • 61
  • 111
3
votes
1 answer

errno 11 [EAGAIN] from read(2)

I have some code that reads the serial port on my pinguin box. Code is like: while ( 1 ) if ( select( handle + 1, &h, NULL, NULL, &tm ) > 0 ) { if( read( handle, &msg, 1 ) > 0 ) { ... tips and trixes } if (…
Morten The Dane
  • 31
  • 1
  • 1
  • 4
3
votes
2 answers

implicit declaration of function ‘gmtime_r’

What do I need to do to make gcc include the declaration of gmtime_r(3) from time.h? Looking at /usr/include/time.h, gmtime_r and localtime_r are inside #ifdef __USE_POSIX. Do I need to do something to turn __USE_POSIX on, like a command-line…
iter
  • 4,171
  • 8
  • 35
  • 59
3
votes
1 answer

How does one test if a file is LOCKED and/or read-only without opening?

Is there a portable (std::filesystem) method of testing if a file is "locked" or has "read-only" permissions? MacOS Finder, for example, has a "Locked" setting, which is DIFFERENT than the standard POSIX "permissions". I need to test if a file can…
SMGreenfield
  • 1,680
  • 19
  • 35
3
votes
0 answers

In Linux/POSIX API, can we treat a file as binary or text?

In the standard C library, we can treat a file as binary or text, by fopen() with or without b type argument. In Linux/POSIX API, can we treat a file as binary or text, by some way? Does open() not provide similar type argument?
user10082400
3
votes
2 answers

Open file, create if not exists, determine whether created

I would like to write code that does the following: 1) Open a file (for writing), creating the file if it doesn't exist. 2) Ensure the file exists while running some other code (by holding the file open). 3) Close the file, and delete the file if it…
Drew
  • 12,578
  • 11
  • 58
  • 98
3
votes
3 answers

Using C, how can I know when a file is created?

I'm making a program in C for linux that scans a directory every x seconds during a time period for modifications, but I'm having trouble finding out when a file or directory is created. Here are a few options I considered: Using the stat struct,…
Mr eskimo
  • 41
  • 1
3
votes
1 answer

Boost: How to print/convert posix_time::ptime in milliseconds from Epoch?

I am having trouble converting posix_time::ptime to a timestamp represented by time_t or posix_time::milliseconds, or any other appropriate type which can be easily printed (from Epoch). I actually need just to print the timestamp represented by the…
eold
  • 5,972
  • 11
  • 56
  • 75
3
votes
2 answers

Relationship between Alnum and IsAlphabetic character classes in Java RegEx patterns

Looking at the Javadoc for java.util.regex.Pattern \p{Alnum} An alphanumeric character:[\p{IsAlphabetic}\p{IsDigit}] it appears that every character that matches \p{IsAlphabetic} should also match \p{Alnum} However, it does not seem to be the…
toniedzwiedz
  • 17,895
  • 9
  • 86
  • 131
3
votes
2 answers

What does posix_spawn return code 14 "Bad Address" mean?

I'm spawning a child process from my application: QString strFullPath(strModulesPath + strModule.toString()); QByteArray baFullPath(strFullPath.toLatin1()) ,baSeconds((QString::number(lngSeconds)) …
SPlatten
  • 5,334
  • 11
  • 57
  • 128
3
votes
2 answers

Program not exiting after using POSIX timers

Consider the following program: #define _POSIX_C_SOURCE 200809L #include #include #include void timerfunc(union sigval val) { } int main() { struct sigevent sev = { .sigev_notify = SIGEV_THREAD, …
R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
1 2 3
99
100