xref: /aosp_15_r20/bionic/libc/include/err.h (revision 8d67ca893c1523eb926b9080dbe4e2ffd2a27ba1)
1*8d67ca89SAndroid Build Coastguard Worker /*-
2*8d67ca89SAndroid Build Coastguard Worker  * Copyright (c) 1993
3*8d67ca89SAndroid Build Coastguard Worker  *	The Regents of the University of California.  All rights reserved.
4*8d67ca89SAndroid Build Coastguard Worker  *
5*8d67ca89SAndroid Build Coastguard Worker  * Redistribution and use in source and binary forms, with or without
6*8d67ca89SAndroid Build Coastguard Worker  * modification, are permitted provided that the following conditions
7*8d67ca89SAndroid Build Coastguard Worker  * are met:
8*8d67ca89SAndroid Build Coastguard Worker  * 1. Redistributions of source code must retain the above copyright
9*8d67ca89SAndroid Build Coastguard Worker  *    notice, this list of conditions and the following disclaimer.
10*8d67ca89SAndroid Build Coastguard Worker  * 2. Redistributions in binary form must reproduce the above copyright
11*8d67ca89SAndroid Build Coastguard Worker  *    notice, this list of conditions and the following disclaimer in the
12*8d67ca89SAndroid Build Coastguard Worker  *    documentation and/or other materials provided with the distribution.
13*8d67ca89SAndroid Build Coastguard Worker  * 3. Neither the name of the University nor the names of its contributors
14*8d67ca89SAndroid Build Coastguard Worker  *    may be used to endorse or promote products derived from this software
15*8d67ca89SAndroid Build Coastguard Worker  *    without specific prior written permission.
16*8d67ca89SAndroid Build Coastguard Worker  *
17*8d67ca89SAndroid Build Coastguard Worker  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18*8d67ca89SAndroid Build Coastguard Worker  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*8d67ca89SAndroid Build Coastguard Worker  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*8d67ca89SAndroid Build Coastguard Worker  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21*8d67ca89SAndroid Build Coastguard Worker  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*8d67ca89SAndroid Build Coastguard Worker  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*8d67ca89SAndroid Build Coastguard Worker  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*8d67ca89SAndroid Build Coastguard Worker  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*8d67ca89SAndroid Build Coastguard Worker  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*8d67ca89SAndroid Build Coastguard Worker  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*8d67ca89SAndroid Build Coastguard Worker  * SUCH DAMAGE.
28*8d67ca89SAndroid Build Coastguard Worker  *
29*8d67ca89SAndroid Build Coastguard Worker  *	@(#)err.h	8.1 (Berkeley) 6/2/93
30*8d67ca89SAndroid Build Coastguard Worker  */
31*8d67ca89SAndroid Build Coastguard Worker 
32*8d67ca89SAndroid Build Coastguard Worker #pragma once
33*8d67ca89SAndroid Build Coastguard Worker 
34*8d67ca89SAndroid Build Coastguard Worker /**
35*8d67ca89SAndroid Build Coastguard Worker  * @file err.h
36*8d67ca89SAndroid Build Coastguard Worker  * @brief BSD error reporting functions. See `<error.h>` for the GNU equivalent.
37*8d67ca89SAndroid Build Coastguard Worker  */
38*8d67ca89SAndroid Build Coastguard Worker 
39*8d67ca89SAndroid Build Coastguard Worker #include <sys/cdefs.h>
40*8d67ca89SAndroid Build Coastguard Worker 
41*8d67ca89SAndroid Build Coastguard Worker #include <stdarg.h>
42*8d67ca89SAndroid Build Coastguard Worker #include <sys/types.h>
43*8d67ca89SAndroid Build Coastguard Worker 
44*8d67ca89SAndroid Build Coastguard Worker __BEGIN_DECLS
45*8d67ca89SAndroid Build Coastguard Worker 
46*8d67ca89SAndroid Build Coastguard Worker /**
47*8d67ca89SAndroid Build Coastguard Worker  * [err(3)](https://man7.org/linux/man-pages/man3/err.3.html) outputs the program name,
48*8d67ca89SAndroid Build Coastguard Worker  * the printf()-like formatted message, and the result of strerror() if `errno` is non-zero.
49*8d67ca89SAndroid Build Coastguard Worker  *
50*8d67ca89SAndroid Build Coastguard Worker  * Calls exit() with `__status`.
51*8d67ca89SAndroid Build Coastguard Worker  *
52*8d67ca89SAndroid Build Coastguard Worker  * New code should consider error() in `<error.h>`.
53*8d67ca89SAndroid Build Coastguard Worker  */
54*8d67ca89SAndroid Build Coastguard Worker __noreturn void err(int __status, const char* _Nullable __fmt, ...) __printflike(2, 3);
55*8d67ca89SAndroid Build Coastguard Worker 
56*8d67ca89SAndroid Build Coastguard Worker /**
57*8d67ca89SAndroid Build Coastguard Worker  * [verr(3)](https://man7.org/linux/man-pages/man3/verr.3.html) outputs the program name,
58*8d67ca89SAndroid Build Coastguard Worker  * the vprintf()-like formatted message, and the result of strerror() if `errno` is non-zero.
59*8d67ca89SAndroid Build Coastguard Worker  *
60*8d67ca89SAndroid Build Coastguard Worker  * Calls exit() with `__status`.
61*8d67ca89SAndroid Build Coastguard Worker  *
62*8d67ca89SAndroid Build Coastguard Worker  * New code should consider error() in `<error.h>`.
63*8d67ca89SAndroid Build Coastguard Worker  */
64*8d67ca89SAndroid Build Coastguard Worker __noreturn void verr(int __status, const char* _Nullable __fmt, va_list __args) __printflike(2, 0);
65*8d67ca89SAndroid Build Coastguard Worker 
66*8d67ca89SAndroid Build Coastguard Worker /**
67*8d67ca89SAndroid Build Coastguard Worker  * [errx(3)](https://man7.org/linux/man-pages/man3/errx.3.html) outputs the program name, and
68*8d67ca89SAndroid Build Coastguard Worker  * the printf()-like formatted message.
69*8d67ca89SAndroid Build Coastguard Worker  *
70*8d67ca89SAndroid Build Coastguard Worker  * Calls exit() with `__status`.
71*8d67ca89SAndroid Build Coastguard Worker  *
72*8d67ca89SAndroid Build Coastguard Worker  * New code should consider error() in `<error.h>`.
73*8d67ca89SAndroid Build Coastguard Worker  */
74*8d67ca89SAndroid Build Coastguard Worker __noreturn void errx(int __status, const char* _Nullable __fmt, ...) __printflike(2, 3);
75*8d67ca89SAndroid Build Coastguard Worker 
76*8d67ca89SAndroid Build Coastguard Worker /**
77*8d67ca89SAndroid Build Coastguard Worker  * [verrx(3)](https://man7.org/linux/man-pages/man3/err.3.html) outputs the program name, and
78*8d67ca89SAndroid Build Coastguard Worker  * the vprintf()-like formatted message.
79*8d67ca89SAndroid Build Coastguard Worker  *
80*8d67ca89SAndroid Build Coastguard Worker  * Calls exit() with `__status`.
81*8d67ca89SAndroid Build Coastguard Worker  *
82*8d67ca89SAndroid Build Coastguard Worker  * New code should consider error() in `<error.h>`.
83*8d67ca89SAndroid Build Coastguard Worker  */
84*8d67ca89SAndroid Build Coastguard Worker __noreturn void verrx(int __status, const char* _Nullable __fmt, va_list __args) __printflike(2, 0);
85*8d67ca89SAndroid Build Coastguard Worker 
86*8d67ca89SAndroid Build Coastguard Worker /**
87*8d67ca89SAndroid Build Coastguard Worker  * [warn(3)](https://man7.org/linux/man-pages/man3/warn.3.html) outputs the program name,
88*8d67ca89SAndroid Build Coastguard Worker  * the printf()-like formatted message, and the result of strerror() if `errno` is non-zero.
89*8d67ca89SAndroid Build Coastguard Worker  *
90*8d67ca89SAndroid Build Coastguard Worker  * New code should consider error() in `<error.h>`.
91*8d67ca89SAndroid Build Coastguard Worker  */
92*8d67ca89SAndroid Build Coastguard Worker void warn(const char* _Nullable __fmt, ...) __printflike(1, 2);
93*8d67ca89SAndroid Build Coastguard Worker 
94*8d67ca89SAndroid Build Coastguard Worker /**
95*8d67ca89SAndroid Build Coastguard Worker  * [vwarn(3)](https://man7.org/linux/man-pages/man3/vwarn.3.html) outputs the program name,
96*8d67ca89SAndroid Build Coastguard Worker  * the vprintf()-like formatted message, and the result of strerror() if `errno` is non-zero.
97*8d67ca89SAndroid Build Coastguard Worker  *
98*8d67ca89SAndroid Build Coastguard Worker  * New code should consider error() in `<error.h>`.
99*8d67ca89SAndroid Build Coastguard Worker  */
100*8d67ca89SAndroid Build Coastguard Worker void vwarn(const char* _Nullable __fmt, va_list __args) __printflike(1, 0);
101*8d67ca89SAndroid Build Coastguard Worker 
102*8d67ca89SAndroid Build Coastguard Worker /**
103*8d67ca89SAndroid Build Coastguard Worker  * [warnx(3)](https://man7.org/linux/man-pages/man3/warnx.3.html) outputs the program name, and
104*8d67ca89SAndroid Build Coastguard Worker  * the printf()-like formatted message.
105*8d67ca89SAndroid Build Coastguard Worker  *
106*8d67ca89SAndroid Build Coastguard Worker  * New code should consider error() in `<error.h>`.
107*8d67ca89SAndroid Build Coastguard Worker  */
108*8d67ca89SAndroid Build Coastguard Worker void warnx(const char* _Nullable __fmt, ...) __printflike(1, 2);
109*8d67ca89SAndroid Build Coastguard Worker 
110*8d67ca89SAndroid Build Coastguard Worker /**
111*8d67ca89SAndroid Build Coastguard Worker  * [vwarnx(3)](https://man7.org/linux/man-pages/man3/warn.3.html) outputs the program name, and
112*8d67ca89SAndroid Build Coastguard Worker  * the vprintf()-like formatted message.
113*8d67ca89SAndroid Build Coastguard Worker  *
114*8d67ca89SAndroid Build Coastguard Worker  * New code should consider error() in `<error.h>`.
115*8d67ca89SAndroid Build Coastguard Worker  */
116*8d67ca89SAndroid Build Coastguard Worker void vwarnx(const char* _Nullable __fmt, va_list __args) __printflike(1, 0);
117*8d67ca89SAndroid Build Coastguard Worker 
118*8d67ca89SAndroid Build Coastguard Worker __END_DECLS
119