From 0bb4ebb47e05fb3b57f0d405be5e9186971ad339 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Wed, 15 Aug 2012 00:40:43 +0100 Subject: [PATCH] Documentation for errno.h and errno --- man/errno.3 | 66 +++++++++++++++++++++++++++++ man/errno.h.3 | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 man/errno.3 create mode 100644 man/errno.h.3 diff --git a/man/errno.3 b/man/errno.3 new file mode 100644 index 0000000..da54640 --- /dev/null +++ b/man/errno.3 @@ -0,0 +1,66 @@ +.\" This file is part of the Public Domain C Library (PDCLib). +.\" Permission is granted to use, modify, and / or redistribute at will. +.\" +.Dd +.Dt ERRNO 3 +.Os + +.Sh NAME +.Nm errno +.Nd library error result + +.Sh SYNOPSIS +.In errno.h +.Pp +.Sy #define errno +.\" +.Sh DESCRIPTION +The header +.In errno.h +defines the name +.Va errno +to refer to an object of thread local storage duration. It is undefined whether +or not +.Va errno +refers to a preprocessor symbol or not. +.\" +.Pp +At program startup, the runtime shall initialize +.Va errno +to contain the value zero (the initial value in other threads is undefined). It +is guaranteed that no function provided by the C standard library shall set the +value of +.Va errno +to zero; therefore, for functions which do not have a unique return value for +indicating error, it is possible to determine whether an error occured by +setting +.Va errno +to zero before the call, then after the call seeing if an error value has been +stored into +.Va errno. +.Pp +.Bf Sy +Note that it is valid for any function which is not described as explicitly +setting +.Va errno +to set it to a non-zero value. Checking for a non-zero value is only valid with +functions which are defined to modify +.Va errno . +.Ef +.\" +.Pp +In some historical versions of the POSIX standard, the prescribed method of +using errno was to define +.Va extern int errno . +This is no longer supported by the POSIX or C standards, and will not work on +the majority of implementations, including this one. + +.Sh SEE ALSO +.Xr errno.h 3 +.Xr abort 3 +.Xr assert 3 +\" +.Sh STANDARDS +Conforming to +.St -isoC-90 , +.St -isoC-99 . \ No newline at end of file diff --git a/man/errno.h.3 b/man/errno.h.3 new file mode 100644 index 0000000..a754d80 --- /dev/null +++ b/man/errno.h.3 @@ -0,0 +1,114 @@ +.\" This file is part of the Public Domain C Library (PDCLib). +.\" Permission is granted to use, modify, and / or redistribute at will. +.\" +.Dd +.Dt ERRNO.H 3 +.Os +.\" +.Sh NAME +.Nm errno.h +.Nd error results +.\" +.Sh SYNOPSIS +.In errno.h +.\" +.Sh DESCRIPTION +The header defines the value +.Dv errno +to be an lvalue of thread-local storage duration. +.\" +.Pp +From the ISO C standard, the following error code constants are defined: +.Bl -tag -compact +.It ERANGE +indicating a value is out of range +.It EDOM +indicating that a value is outside the domain of the current function +.It EILSEQ +indicating an invalid character sequence +.El +.\" +.Pp +From the ISO C++ 2011 standard, the following error code constants are defined: +.Bl -tag -compact +.It E2BIG +.It ECONNRESET +.It EISCONN +.It ENOENT +.It ENOTRECOVERABLE +.It EROFS +.It EACCES +.It EDEADLK +.It EISDIR +.It ENOEXEC +.It ENOTSOCK +.It ESPIPE +.It EADDRINUSE +.It EDESTADDRREQ +.It ELOOP +.It ENOLCK +.It ENOTSUP +.It ESRCH +.It EADDRNOTAVAIL +.It EMFILE +.It ENOLINK +.It ENOTTY +.It ETIME +.It EAFNOSUPPORT +.It EEXIST +.It EMLINK +.It ENOMEM +.It ENXIO +.It ETIMEDOUT +.It EAGAIN +.It EFAULT +.It EMSGSIZE +.It ENOMSG +.It EOPNOTSUPP +.It ETXTBSY +.It EALREADY +.It EFBIG +.It ENAMETOOLONG +.It ENOPROTOOPT +.It EOVERFLOW +.It EWOULDBLOCK +(which may have the same value as +.Ev EAGAIN ) +.It EBADF +.It EHOSTUNREACH +.It ENETDOWN +.It ENOSPC +.It EOWNERDEAD +.It EXDEV +.It EBADMSG +.It EIDRM +.It ENETRESET +.It ENOSR +.It EPERM +.It EBUSY +.It ENETUNREACH +.It ENOSTR +.It EPIPE +.It ECANCELED +.It EINPROGRESS +.It ENFILE +.It ENOSYS +.It EPROTO +.It ECHILD +.It EINTR +.It ENOBUFS +.It ENOTCONN +.It EPROTONOSUPPORT +.It ECONNABORTED +.It EINVAL +.It ENODATA +.It ENOTDIR +.It EPROTOTYPE +.El +.Sh SEE ALSO +.Xr errno 3 +.Sh STANDARDS +Conforming to +.St -isoC-90 , +.St -isoC-99 , +ISO/IEC 14882:2011 "ISO C++ 11" \ No newline at end of file -- 2.40.0