The New errno Value

If you've been a veteran of UNIX C/C++ code for some time, then you've probably noticed some changes in the declaration of the variable errno over the years. Modern UNIX platforms have undergone some changes in order to support threads.

While threads are a welcome addition to the UNIX platform, they have required a number of internal changes to the underlying C libraries and the way in which the errno variable is defined. A thread is a separate flow of instructions within one memory environment (all threads share one memory address space). Consequently, the traditional single global integer value of errno no longer suffices, since function calls in one thread would alter the errno values being referenced in another thread. ...

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.