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