Start documenting libc.
Bug: N/A
Test: N/A
Change-Id: I17345cb72a5ffc3af1688cf5874589cfb1e1fea0
diff --git a/libc/include/err.h b/libc/include/err.h
index a64d01d..e91dac9 100644
--- a/libc/include/err.h
+++ b/libc/include/err.h
@@ -1,6 +1,3 @@
-/* $OpenBSD: err.h,v 1.10 2006/01/06 18:53:04 millert Exp $ */
-/* $NetBSD: err.h,v 1.11 1994/10/26 00:55:52 cgd Exp $ */
-
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -32,8 +29,12 @@
* @(#)err.h 8.1 (Berkeley) 6/2/93
*/
-#ifndef _ERR_H_
-#define _ERR_H_
+#pragma once
+
+/**
+ * @file err.h
+ * @brief BSD error reporting functions. See `<error.h>` for the GNU equivalent.
+ */
#include <stdarg.h>
#include <sys/cdefs.h>
@@ -41,15 +42,76 @@
__BEGIN_DECLS
+/**
+ * [err(3)](http://man7.org/linux/man-pages/man3/err.3.html) outputs the program name,
+ * the printf()-like formatted message, and the result of strerror() if `errno` is non-zero.
+ *
+ * Calls exit() with `__status`.
+ *
+ * New code should consider error() in `<error.h>`.
+ */
__noreturn void err(int __status, const char* __fmt, ...) __printflike(2, 3);
+
+/**
+ * [verr(3)](http://man7.org/linux/man-pages/man3/verr.3.html) outputs the program name,
+ * the vprintf()-like formatted message, and the result of strerror() if `errno` is non-zero.
+ *
+ * Calls exit() with `__status`.
+ *
+ * New code should consider error() in `<error.h>`.
+ */
__noreturn void verr(int __status, const char* __fmt, va_list __args) __printflike(2, 0);
+
+/**
+ * [errx(3)](http://man7.org/linux/man-pages/man3/errx.3.html) outputs the program name, and
+ * the printf()-like formatted message.
+ *
+ * Calls exit() with `__status`.
+ *
+ * New code should consider error() in `<error.h>`.
+ */
__noreturn void errx(int __status, const char* __fmt, ...) __printflike(2, 3);
+
+/**
+ * [verrx(3)](http://man7.org/linux/man-pages/man3/err.3.html) outputs the program name, and
+ * the vprintf()-like formatted message.
+ *
+ * Calls exit() with `__status`.
+ *
+ * New code should consider error() in `<error.h>`.
+ */
__noreturn void verrx(int __status, const char* __fmt, va_list __args) __printflike(2, 0);
+
+/**
+ * [warn(3)](http://man7.org/linux/man-pages/man3/warn.3.html) outputs the program name,
+ * the printf()-like formatted message, and the result of strerror() if `errno` is non-zero.
+ *
+ * New code should consider error() in `<error.h>`.
+ */
void warn(const char* __fmt, ...) __printflike(1, 2);
+
+/**
+ * [vwarn(3)](http://man7.org/linux/man-pages/man3/vwarn.3.html) outputs the program name,
+ * the vprintf()-like formatted message, and the result of strerror() if `errno` is non-zero.
+ *
+ * New code should consider error() in `<error.h>`.
+ */
void vwarn(const char* __fmt, va_list __args) __printflike(1, 0);
+
+/**
+ * [warnx(3)](http://man7.org/linux/man-pages/man3/warnx.3.html) outputs the program name, and
+ * the printf()-like formatted message.
+ *
+ * New code should consider error() in `<error.h>`.
+ */
void warnx(const char* __fmt, ...) __printflike(1, 2);
+
+/**
+ * [vwarnx(3)](http://man7.org/linux/man-pages/man3/warn.3.html) outputs the program name, and
+ * the vprintf()-like formatted message.
+ *
+ * New code should consider error() in `<error.h>`.
+ */
void vwarnx(const char* __fmt, va_list __args) __printflike(1, 0);
__END_DECLS
-
-#endif /* !_ERR_H_ */