summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-10-09 08:04:24 +0000
committerpeter <peter@FreeBSD.org>2002-10-09 08:04:24 +0000
commit08cbf20fd9f8f5239febe5e6b68729c649425242 (patch)
treef2dfbf7797a6e31643daa510071fd3f269a210ad
parentaee6c2c5057052d6177f7c726ca706f020095b94 (diff)
downloadFreeBSD-src-08cbf20fd9f8f5239febe5e6b68729c649425242.zip
FreeBSD-src-08cbf20fd9f8f5239febe5e6b68729c649425242.tar.gz
Drop almost 3k from /bin/sync by moving errno to a seperate file
to avoid all syscalls pulling in sys_errlst[]. Noted by: bde
-rw-r--r--lib/libc/gen/Makefile.inc2
-rw-r--r--lib/libc/gen/errlst.c1
-rw-r--r--lib/libc/gen/errno.c30
3 files changed, 31 insertions, 2 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 4364ab7..55e5ce3 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -8,7 +8,7 @@ SRCS+= __xuname.c _pthread_stubs.c _rand48.c _spinlock_stub.c _thread_init.c \
alarm.c arc4random.c assert.c basename.c \
clock.c closedir.c confstr.c \
crypt.c ctermid.c daemon.c devname.c dirname.c disklabel.c \
- dlfcn.c dlfunc.c drand48.c erand48.c err.c errlst.c \
+ dlfcn.c dlfunc.c drand48.c erand48.c err.c errlst.c errno.c \
exec.c fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c fts.c \
getbootfile.c getbsize.c \
getcap.c getcwd.c getdomainname.c getgrent.c getgrouplist.c \
diff --git a/lib/libc/gen/errlst.c b/lib/libc/gen/errlst.c
index 374f316..b871a1e 100644
--- a/lib/libc/gen/errlst.c
+++ b/lib/libc/gen/errlst.c
@@ -150,5 +150,4 @@ const char *const sys_errlist[] = {
/* General */
"Programming error", /* 88 - EDOOFUS */
};
-int errno;
const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);
diff --git a/lib/libc/gen/errno.c b/lib/libc/gen/errno.c
new file mode 100644
index 0000000..02e0351
--- /dev/null
+++ b/lib/libc/gen/errno.c
@@ -0,0 +1,30 @@
+/*-
+ * Copyright (c) 2002 Peter Wemm <peter@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+int errno;
OpenPOWER on IntegriCloud