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
29
votes
2 answers

Why does the library linker flag sometimes have to go at the end using GCC?

I'm writing a small C program that uses librt. I'm quite surprised that the program won't compile if I place the link flag at the start instead of at the end: At the moment, to compile the program I do: gcc -o prog prog.c -lrt -std=gnu99 If I were…
theprole
  • 2,274
  • 23
  • 25
29
votes
5 answers

Find out if a command exists on POSIX system

I want to be able to tell if a command exists on any POSIX system from a shell script. On Linux, I can do the following: if which ; then ...snip... fi However, Solaris and MacOS which do not give an exit failure code when the command…
singpolyma
  • 10,999
  • 5
  • 47
  • 71
29
votes
4 answers

What are the advantages of pwrite and pread over fwrite and fread?

What are the advantages of pwrite and pread over fwrite and fread?
Invictus
  • 2,653
  • 8
  • 31
  • 50
29
votes
3 answers

UDP-Broadcast on all interfaces

On a Linux system with a wired and a wireless interface (e.g. 192.168.1.x and 192.168.2.x subnets) I want to send a UDP broadcast that goes out via ALL available interfaces (i.e. both through the wired and the wireless interface). Currently I…
Steven
29
votes
3 answers

Why do backslashes prevent alias expansion?

In the first part of my question I will provide some background info as a service to the community. The second part contains the actual question. Part I Assume I've created the following alias: alias ls='ls -r' I know how to temporarily unalias…
Alexandros Gezerlis
  • 2,221
  • 16
  • 21
29
votes
7 answers

How to be notified of file/directory change in C/C++, ideally using POSIX

The subject says it all - normally easy and cross platform way is to poll, intelligently. But every OS has some means to notify without polling. Is it possible in a reasonably cross platform way? (I only really care about Windows and Linux, but I…
Michael Neale
  • 19,248
  • 19
  • 77
  • 109
29
votes
8 answers

kubectl: get specific value from a secret in plaintext

I want to get the value of a specific field of a secret in a shell script. From the kubectl get secret documentation, it seems the standard way to get a secret returns the whole thing, in a specified format, with the values base64 encoded. So, to…
davnicwil
  • 28,487
  • 16
  • 107
  • 123
29
votes
2 answers

Dockerfile: how to set env variable from file contents

I want to set an environment variable in my Dockerfile. I've got a .env file that looks like this: FOO=bar. Inside my Dockerfile, I've got a command that parses the contents of that file and assigns it to FOO. RUN 'export FOO=$(echo "$(cut -d'='…
Ben Downey
  • 2,575
  • 4
  • 37
  • 57
29
votes
4 answers

Default field separator for awk

Is the default separator only space for awk?
Lin Ma
  • 9,739
  • 32
  • 105
  • 175
29
votes
1 answer

What does ECONNRESET mean in the context of an AF_LOCAL socket?

I understand that for TCP sockets ECONNRESET has got something to do with RST packets. But I've seen ECONNRESET errors for AF_LOCAL sockets too, on read() and write() calls. What does this mean? How is ECONNRESET different from read() returning 0 or…
Hongli
  • 18,682
  • 15
  • 79
  • 107
29
votes
4 answers

What's the practical limit on the size of single packet transmitted over domain socket?

Let us assume that there is a Unix domain socket created for a typical server-client program. The client sends a 10GB buffer over the socket and it is consumed by the server in the meanwhile. Does OS (Linux/BSD) split the 10GB buffer into many…
user972946
28
votes
7 answers

Forcing a spurious-wake up in Java

This question is not about, whether spurious wakeups actually happen, because this was already discussed in full length here: Do spurious wakeups in Java actually happen? Therefore this is also not about, why I do have to put a loop around my wait…
Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
28
votes
3 answers

Expanding Environment variable in string using python

I have a string containing an environment variable, e.g. my_path = '$HOME/dir/dir2' I want parse the string, looking up the variable and replacing it in the string: print "HOME =",os.environ['HOME'] my_expanded_path = parse_string(my_path) print…
Conor
  • 1,028
  • 1
  • 8
  • 15
28
votes
3 answers

Which is better for local IPC, POSIX message queues (mqueues) or Unix domain (local) sockets?

Is it better to use POSIX message queues or Unix domain sockets for local IPC communication? I have worked with Unix sockets between machines (not domain) and I remember that making and breaking the connection would cause sockets to linger awhile…
John Rocha
  • 1,656
  • 3
  • 19
  • 30
28
votes
12 answers

Alternative way to obtain argc and argv of a process

I'm looking for alternative ways to obtain the command line parameters argc and argv provided to a process without having direct access to the variables passed into main(). I want to make a class that is independent of main() so that argc and argv…
user1095108
  • 14,119
  • 9
  • 58
  • 116