OSERROR(3C) OSERROR(3C) NAME oserror, setoserror, goserror - get/set system error C SYNOPSIS #include <errno.h> int oserror(void); int setoserror(const int err); int goserror(void); DESCRIPTION Most system calls and many system library functions set a global error value errno when they encounter an error. For single threaded applications a global is sufficient. For multi-threaded applications a global error value loses much of its meaning, since multiple threads may be updating the same value at the same time. When a process turns multi-threaded (by calling sproc(2)) a per-thread location to store the error value is created. sproc(2) and intro(2) have more information on error handling. These routines provide access to the error values. oserror returns the value in the global error location for single threaded applications and returns the value in the per-thread error location for multi-threaded applications. This is equivalent to compiling the application with the feature test macro _SGI_MP_SOURCE defined and simply referencing errno. setoserror sets both the global error location and the per-thread error location for the calling thread. This is primarily used by library routines. goserror always returns the value in the global error location. Possible errors are listed in errno.h. RETURN VALUE oserror, goserror, and setoserror return the current system error. SEE ALSO intro(2), sproc(2), perror(3C). Page 1