summaryrefslogtreecommitdiff
path: root/lib/libc/hidden/errno.h
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-09-06 20:26:21 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-09-06 20:26:21 +0000
commitc6bf97d16a542c52641d770845f80d8ec64ac35a (patch)
treeed721a3e95fc1990f483b41d7d802c744f00b604 /lib/libc/hidden/errno.h
parentbacd9b916ff9a0a46a5789e4cba77f57eb617158 (diff)
Fix aliasing of sys_errlist, sys_nerr, sys_siglist, and sys_signame
to eliminate duplicate copies of the tables and get direct access internally ok kettenis@ deraadt@
Diffstat (limited to 'lib/libc/hidden/errno.h')
-rw-r--r--lib/libc/hidden/errno.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/libc/hidden/errno.h b/lib/libc/hidden/errno.h
new file mode 100644
index 00000000000..ee18c32f089
--- /dev/null
+++ b/lib/libc/hidden/errno.h
@@ -0,0 +1,35 @@
+/* $OpenBSD: errno.h,v 1.1 2015/09/06 20:26:20 guenther Exp $ */
+/*
+ * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _LIBC_ERRNO_H_
+#define _LIBC_ERRNO_H_
+
+/* we want the const-correct declarations inside libc */
+#define __SYS_ERRLIST
+
+#include_next <errno.h>
+#include "namespace.h"
+
+extern const int sys_nerr;
+extern const char *const sys_errlist[];
+
+extern PROTO_NORMAL(sys_nerr);
+extern PROTO_NORMAL(sys_errlist);
+
+/*PROTO_OVERRIDABLE(__errno);*/
+
+#endif /* _LIBC_ERRNO_H_ */