2 .\" Copyright (c) 1994 Michael Haardt (michael@moria.de), 1994-06-04
3 .\" Copyright (c) 1995 Michael Haardt
4 .\" (michael@cantor.informatik.rwth-aachen.de), 1995-03-16
5 .\" Copyright (c) 1996 Andries Brouwer (aeb@cwi.nl), 1996-01-13
7 .\" SPDX-License-Identifier: GPL-2.0-or-later
9 .\" 1996-01-13 aeb: merged in some text contributed by Melvin Smith
10 .\" (msmith@falcon.mercer.peachnet.edu) and various other changes.
11 .\" Modified 1996-05-16 by Martin Schulze (joey@infodrom.north.de)
13 .TH perror 3 (date) "Linux man-pages (unreleased)"
15 perror \- print a system error message
18 .RI ( libc ", " \-lc )
23 .BI "void perror(const char *" s );
27 .BI "int " errno "; \fR/* Not really declared this way; see errno(3) */"
29 .BI "[[deprecated]] const char *const " sys_errlist [];
30 .BI "[[deprecated]] int " sys_nerr ;
34 Feature Test Macro Requirements for glibc (see
35 .BR feature_test_macros (7)):
41 From glibc 2.19 to glibc 2.31:
43 glibc 2.19 and earlier:
49 function produces a message on standard error describing the last
50 error encountered during a call to a system or library function.
56 is not a null byte (\[aq]\e0\[aq])), the argument string
58 is printed, followed by a colon and a blank.
59 Then an error message corresponding to the current value of
63 To be of most use, the argument string should include the name
64 of the function that incurred the error.
68 which can be indexed by
70 can be used to obtain the error message without the newline.
71 The largest message number provided in the table is
73 Be careful when directly accessing this list, because new error values
74 may not have been added to
78 is nowadays deprecated; use
82 When a system call fails, it usually returns \-1 and sets the
85 to a value describing what went wrong.
86 (These values can be found in
88 Many library functions do likewise.
91 serves to translate this error code into human-readable form.
94 is undefined after a successful system call or library function call:
95 this call may well change this variable, even though it succeeds,
96 for example because it internally used some other library function that failed.
97 Thus, if a failing call is not immediately followed by a call to
103 For an explanation of the terms used in this section, see
111 Interface Attribute Value
114 T} Thread safety MT-Safe race:stderr
135 POSIX.1-2001, C89, 4.3BSD.
140 Removed in glibc 2.32.