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
162
votes
4 answers

How can I catch a ctrl-c event?

How do I catch a Ctrl+C event in C++?
Scott
  • 5,135
  • 12
  • 57
  • 74
155
votes
6 answers

What is the proper #include for the function 'sleep()'?

I am using the Big Nerd Ranch book Objective-C Programming, and it starts out by having us write in C in the first few chapters. In one of my programs it has me create, I use the sleep function. In the book it told me to put #include
trludt
  • 1,801
  • 2
  • 13
  • 15
152
votes
6 answers

How does SIGINT relate to the other termination signals such as SIGTERM, SIGQUIT and SIGKILL?

On POSIX systems, termination signals usually have the following order (according to many MAN pages and the POSIX Spec): SIGTERM - politely ask a process to terminate. It shall terminate gracefully, cleaning up all resources (files, sockets, child…
Mecki
  • 125,244
  • 33
  • 244
  • 253
151
votes
22 answers

CRON job to run on the last day of the month

I need to create a CRON job that will run on the last day of every month. I will create it using cPanel. Any help is appreciated. Thanks
Utku Dalmaz
  • 9,780
  • 28
  • 90
  • 130
146
votes
5 answers

Writing programs to cope with I/O errors causing lost writes on Linux

TL;DR: If the Linux kernel loses a buffered I/O write, is there any way for the application to find out? I know you have to fsync() the file (and its parent directory) for durability. The question is if the kernel loses dirty buffers that are…
Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
130
votes
4 answers

Is file append atomic in UNIX?

In general, what can we take for granted when we append to a file in UNIX from multiple processes? Is it possible to lose data (one process overwriting the other's changes)? Is it possible for data to get mangled? (For example, each process is…
Lajos Nagy
  • 9,075
  • 11
  • 44
  • 55
113
votes
9 answers

Converting year and month ("yyyy-mm" format) to a date?

I have a dataset that looks like this: Month count 2009-01 12 2009-02 310 2009-03 2379 2009-04 234 2009-05 14 2009-08 1 2009-09 34 2009-10 2386 I want to plot the data (months as x values and counts as y values). Since there are gaps in…
R_User
  • 10,682
  • 25
  • 79
  • 120
112
votes
15 answers

What is the purpose of fork()?

In many programs and man pages of Linux, I have seen code using fork(). Why do we need to use fork() and what is its purpose?
kar
112
votes
8 answers

How to construct a c++ fstream from a POSIX file descriptor?

I'm basically looking for a C++ version of fdopen(). I did a bit of research on this and it is one of those things that seems like it should be easy, but turns out to be very complicated. Am I missing something in this belief (i.e. it really is…
BD at Rivenhill
  • 12,395
  • 10
  • 46
  • 49
112
votes
2 answers

What is SEGV_MAPERR?

What is SEGV_MAPERR, why does it always come up with SIGSEGV?
Geek
  • 23,089
  • 20
  • 71
  • 85
110
votes
8 answers

How to get the current time in milliseconds from C in Linux?

How do I get the current time on Linux in milliseconds?
LLL
  • 1,273
  • 3
  • 10
  • 8
109
votes
5 answers

Is snprintf() ALWAYS null terminating?

Is snprintf always null terminating the destination buffer? In other words, is this sufficient: char dst[10]; snprintf(dst, sizeof (dst), "blah %s", somestr); or do you have to do like this, if somestr is long enough? char dst[10]; somestr[sizeof…
Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
102
votes
5 answers

Why does SIGPIPE exist?

From my understanding, SIGPIPE can only occur as the result of a write(), which can (and does) return -1 and set errno to EPIPE... So why do we have the extra overhead of a signal? Every time I work with pipes I ignore SIGPIPE and have never felt…
Shea Levy
  • 5,237
  • 3
  • 31
  • 42
101
votes
4 answers

What is the status of POSIX asynchronous I/O (AIO)?

There are pages scattered around the web that describe POSIX AIO facilities in varying amounts of detail. None of them are terribly recent. It's not clear what, exactly, they're describing. For example, the "official" (?) web site for Linux…
Glyph
  • 31,152
  • 11
  • 87
  • 129
100
votes
4 answers

System V IPC vs POSIX IPC

What are the differences between System V IPC and POSIX IPC ? Why do we have two standards ? How to decide which IPC functions to use ?
Meghasyam
  • 1,021
  • 2
  • 9
  • 7