1 .\" Copyright (c) 1994 Michael Haardt (michael@moria.de), 1994-06-04
2 .\" Copyright (c) 1995 Michael Haardt
3 .\" (michael@cantor.informatik.rwth-aachen.de), 1995-03-16
4 .\" Copyright (c) 1996 Andries Brouwer (aeb@cwi.nl), 1996-01-13
6 .\" This is free documentation; you can redistribute it and/or
7 .\" modify it under the terms of the GNU General Public License as
8 .\" published by the Free Software Foundation; either version 2 of
9 .\" the License, or (at your option) any later version.
11 .\" The GNU General Public License's references to "object code"
12 .\" and "executables" are to be interpreted as the output of any
13 .\" document formatting or typesetting system, including
14 .\" intermediate and printed output.
16 .\" This manual is distributed in the hope that it will be useful,
17 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 .\" GNU General Public License for more details.
21 .\" You should have received a copy of the GNU General Public
22 .\" License along with this manual; if not, write to the Free
23 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
26 .\" 1996-01-13 aeb: merged in some text contributed by Melvin Smith
27 .\" (msmith@falcon.mercer.peachnet.edu) and various other changes.
28 .\" Modified 1996-05-16 by Martin Schulze (joey@infodrom.north.de)
30 .TH PERROR 3 2012-04-17 "" "Linux Programmer's Manual"
32 perror \- print a system error message
36 .BI "void perror(const char *" s );
40 .BI "const char *" sys_errlist [];
47 Feature Test Macro Requirements for glibc (see
48 .BR feature_test_macros (7)):
57 produces a message on the standard error output, describing the last
58 error encountered during a call to a system or library function.
63 is not a null byte (\(aq\\0\(aq)) the argument string
65 is printed, followed by a colon and a blank.
66 Then the message and a new-line.
68 To be of most use, the argument string should include the name
69 of the function that incurred the error.
70 The error number is taken from
73 which is set when errors occur but not
74 cleared when successful calls are made.
80 can be used to obtain the error message without the newline.
81 The largest message number provided in the table is
83 Be careful when directly accessing this list because new error values
84 may not have been added to
88 is nowadays deprecated.
91 When a system call fails, it usually returns \-1 and sets the
94 to a value describing what went wrong.
95 (These values can be found in
97 Many library functions do likewise.
100 serves to translate this error code into human-readable form.
103 is undefined after a successful library call:
104 this call may well change this variable, even though it succeeds,
105 for example because it internally used some other library function that failed.
106 Thus, if a failing call is not immediately followed by a call to
118 conform to C89, C99, 4.3BSD, POSIX.1-2001.
129 are defined by glibc, but in
131 .\" and only when _BSD_SOURCE is defined.
134 .\" is defined, the symbols