aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-13 14:57:48 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-13 14:57:48 +0200
commit26885c50919a81b28868ea133ece004c0a1ec491 (patch)
treebf17fbdf6a8a1c65c5a59d12460f0824c8bb42eb /doc
parentm info (diff)
downloadslibc-26885c50919a81b28868ea133ece004c0a1ec491.tar.gz
slibc-26885c50919a81b28868ea133ece004c0a1ec491.tar.bz2
slibc-26885c50919a81b28868ea133ece004c0a1ec491.tar.xz
info: errno
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--doc/info/chap/error-reporting.texinfo53
-rw-r--r--doc/info/slibc.texinfo2
2 files changed, 55 insertions, 0 deletions
diff --git a/doc/info/chap/error-reporting.texinfo b/doc/info/chap/error-reporting.texinfo
new file mode 100644
index 0000000..08571cd
--- /dev/null
+++ b/doc/info/chap/error-reporting.texinfo
@@ -0,0 +1,53 @@
+@node Error reporting
+@chapter Error reporting
+
+Many functions, especially those involving
+system calls, detect and report exceptional
+conditions, including error conditions and
+interruptions. Exception conditions must often
+be checked and handled, often by retrying,
+doing something else, or reporting the error
+to the user and exit.
+
+Unless otherwise specified, exceptional
+conditions are reporting using the facilities
+described in this chapter.
+
+
+@menu
+* Error checking:: Checking whether an exception condition occurred.
+@end menu
+
+
+
+@node Error checking
+@section Error checking
+
+@cpindex Checking for errors
+@cpindex Errors checking
+@cpindex Exception checking
+Most functions return a sentinel value when an
+exceptional condition occurs, typically a negative
+value (actually @code{-1}), a constant such as
+@code{EOF}, or @code{NULL}. This return value only
+tells you that an exeception condition has occurred.
+
+@hfindex errno.h
+@lvindex errno
+By including the header file @file{<errno.h>}, the
+modifiable lvalue @code{errno} is made available.
+@sc{ISO}@tie{}C specifies that @code{errno} is not
+necessarily a variable, but rather just an modifiable
+lvalue. In fact, must @code{libc}:s, including
+@code{slibc} defines it as a macro that calls a
+function and uses the unary @code{*}-operator on the
+return.
+
+@code{errno} is often thought of as a variable
+declared as @code{int errno}, or @code{volatile int errno}.
+But the value is thread-local, and is thus more
+like @code{_Thread_local volatile int errno}. Because
+of this, the @code{errno} is defined as a macro that
+calls a function. Otherwise, it would not be implementable
+without @sc{ISO}@tie{}C11.
+
diff --git a/doc/info/slibc.texinfo b/doc/info/slibc.texinfo
index 8a57a2f..c13924e 100644
--- a/doc/info/slibc.texinfo
+++ b/doc/info/slibc.texinfo
@@ -292,6 +292,7 @@ Stockholm C Standard Library.
@menu
* Introduction:: Introduction to @command{slibc} and this manual.
* Language facilities:: C language facilities provided by the library.
+* Error reporting:: Detecting, reporting, and printing errors.
* Free Software Needs Free Documentation:: Why free documentation is important.
* GNU General Public License:: Copying and sharing @command{slibc}.
@@ -312,6 +313,7 @@ Stockholm C Standard Library.
@include chap/introduction.texinfo
@include chap/language-facilities.texinfo
+@include chap/error-reporting.texinfo