diff --git a/commands/syslogd/syslogd.c b/commands/syslogd/syslogd.c index 1156aea1f..44927a46b 100644 --- a/commands/syslogd/syslogd.c +++ b/commands/syslogd/syslogd.c @@ -377,11 +377,7 @@ void logerror(char *type) if (errno == 0) sprintf(buf, "%s %s", ProgName, type); - else if (errno >= _NERROR) - sprintf(buf, "%s %s - error %d", ProgName, type, errno); - - else - sprintf(buf, "%s %s - %s", ProgName, type, strerror(errno)); + sprintf(buf, "%s %s - %s", ProgName, type, strerror(errno)); errno = 0; dprintf("%s\n", buf); diff --git a/lib/libminc/Makefile b/lib/libminc/Makefile index aac2f2644..a20f5ef67 100644 --- a/lib/libminc/Makefile +++ b/lib/libminc/Makefile @@ -73,9 +73,9 @@ CPPFLAGS.${i}+= -I${LIBCSRCDIR}/stdlib -I${LIBCSRCDIR}/include .endfor # Import from gen -errlist.c: ${LIBCSRCDIR}/gen/errlist-minix.awk \ +errlist.c: ${LIBCSRCDIR}/gen/errlist.awk \ ${MINIXSRCDIR}/nbsd_include/sys/errno.h - ${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET} + cat ${MINIXSRCDIR}/nbsd_include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${LIBCSRCDIR}/gen/errlist.awk > ${.TARGET} .for i in assert.c _errno.c errno.c _env.c errlist.c \ execle.c getprogname.c sleep.c time.c \ diff --git a/lib/libminc/errlist.c b/lib/libminc/errlist.c deleted file mode 100644 index be77fba91..000000000 --- a/lib/libminc/errlist.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Automatically generated file; do not edit */ -#include -__RCSID("$NetBSD: errlist.awk,v 1.4 2010/12/16 22:52:32 joerg Exp $"); -#include -static const char *const errlist[] = { - [0] = "Undefined error: 0", /* 0 - ENOERROR */ - [99] = "generic error", /* 99 - EGENERIC */ - [1] = "operation not permitted", /* 1 - EPERM */ - [2] = "no such file or directory", /* 2 - ENOENT */ - [3] = "no such process", /* 3 - ESRCH */ - [4] = "interrupted function call", /* 4 - EINTR */ - [5] = "input/output error", /* 5 - EIO */ - [6] = "no such device or address", /* 6 - ENXIO */ - [7] = "arg list too long", /* 7 - E2BIG */ - [8] = "exec format error", /* 8 - ENOEXEC */ - [9] = "bad file descriptor", /* 9 - EBADF */ - [10] = "no child process", /* 10 - ECHILD */ - [11] = "resource temporarily unavailable", /* 11 - EAGAIN */ - [12] = "not enough space", /* 12 - ENOMEM */ - [13] = "permission denied", /* 13 - EACCES */ - [14] = "bad address", /* 14 - EFAULT */ - [15] = "Extension: not a block special file", /* 15 - ENOTBLK */ - [16] = "resource busy", /* 16 - EBUSY */ - [17] = "file exists", /* 17 - EEXIST */ - [18] = "improper link", /* 18 - EXDEV */ - [19] = "no such device", /* 19 - ENODEV */ - [20] = "not a directory", /* 20 - ENOTDIR */ - [21] = "is a directory", /* 21 - EISDIR */ - [22] = "invalid argument", /* 22 - EINVAL */ - [23] = "too many open files in system", /* 23 - ENFILE */ - [24] = "too many open files", /* 24 - EMFILE */ - [25] = "inappropriate I/O control operation", /* 25 - ENOTTY */ - [26] = "no longer used", /* 26 - ETXTBSY */ - [27] = "file too large", /* 27 - EFBIG */ - [28] = "no space left on device", /* 28 - ENOSPC */ - [29] = "invalid seek", /* 29 - ESPIPE */ - [30] = "read-only file system", /* 30 - EROFS */ - [31] = "too many links", /* 31 - EMLINK */ - [32] = "broken pipe", /* 32 - EPIPE */ - [33] = "domain error (from ANSI C std )", /* 33 - EDOM */ - [34] = "result too large (from ANSI C std )", /* 34 - ERANGE */ - [35] = "resource deadlock avoided", /* 35 - EDEADLK */ - [36] = "file name too long", /* 36 - ENAMETOOLONG */ - [37] = "no locks available", /* 37 - ENOLCK */ - [38] = "function not implemented", /* 38 - ENOSYS */ - [39] = "directory not empty", /* 39 - ENOTEMPTY */ - [40] = "too many levels of symlinks detected", /* 40 - ELOOP */ - [41] = "service restarted", /* 41 - ERESTART */ - [43] = "Identifier removed", /* 43 - EIDRM */ - [44] = "illegal byte sequence", /* 44 - EILSEQ */ - [45] = "No message of desired type", /* 45 - ENOMSG */ - [46] = "Value too large to be stored in data type",/* 46 - EOVERFLOW */ - [50] = "invalid packet size for some protocol",/* 50 - EPACKSIZE */ - [51] = "not enough buffers left", /* 51 - ENOBUFS */ - [52] = "illegal ioctl for device", /* 52 - EBADIOCTL */ - [53] = "badmode in ioctl", /* 53 - EBADMODE */ - [54] = "call would block on nonblocking socket",/* 54 - EWOULDBLOCK */ - [55] = "network unreachable", /* 55 - ENETUNREACH */ - [56] = "host unreachable", /* 56 - EHOSTUNREACH */ - [57] = "already connected", /* 57 - EISCONN */ - [58] = "address in use", /* 58 - EADDRINUSE */ - [59] = "connection refused", /* 59 - ECONNREFUSED */ - [60] = "connection reset", /* 60 - ECONNRESET */ - [61] = "connection timed out", /* 61 - ETIMEDOUT */ - [62] = "urgent data present", /* 62 - EURG */ - [63] = "no urgent data present", /* 63 - ENOURG */ - [64] = "no connection (yet or anymore )", /* 64 - ENOTCONN */ - [65] = "a write call to a shutdown connection",/* 65 - ESHUTDOWN */ - [66] = "no such connection", /* 66 - ENOCONN */ - [67] = "address family not supported", /* 67 - EAFNOSUPPORT */ - [68] = "protocol not supported by AF", /* 68 - EPROTONOSUPPORT */ - [69] = "Protocol wrong type for socket", /* 69 - EPROTOTYPE */ - [70] = "Operation now in progress", /* 70 - EINPROGRESS */ - [71] = "Can't assign requested address", /* 71 - EADDRNOTAVAIL */ - [72] = "Connection already in progress", /* 72 - EALREADY */ - [73] = "Message too long", /* 73 - EMSGSIZE */ - [74] = "Socket operation on non-socket", /* 74 - ENOTSOCK */ - [75] = "Protocol not available", /* 75 - ENOPROTOOPT */ - [76] = "Operation not supported", /* 76 - EOPNOTSUPP */ - [77] = "network is down", /* 77 - ENETDOWN */ - [78] = "Protocol family not supported", /* 78 - EPFNOSUPPORT */ - [79] = "Destination address required", /* 79 - EDESTADDRREQ */ - [80] = "Host is down", /* 80 - EHOSTDOWN */ - [81] = "Network dropped connection on reset", /* 81 - ENETRESET */ - [82] = "Socket type not supported", /* 82 - ESOCKTNOSUPPORT */ - [83] = "Software caused connection abort", /* 83 - ECONNABORTED */ - [84] = "Too many references: can't splice", /* 84 - ETOOMANYREFS */ - [101] = "can't send message due to deadlock", /* 101 - ELOCKED */ - [102] = "illegal system call number", /* 102 - EBADCALL */ - [103] = "bad source or destination process", /* 103 - EBADSRCDST */ - [104] = "no permission for system call", /* 104 - ECALLDENIED */ - [105] = "source or destination is not alive", /* 105 - EDEADSRCDST */ - [106] = "source or destination is not ready", /* 106 - ENOTREADY */ - [107] = "destination cannot handle request", /* 107 - EBADREQUEST */ - [110] = "IPC trap not allowed", /* 110 - ETRAPDENIED */ - [201] = "pseudo-code: don't send a reply", /* 201 - EDONTREPLY */ - [150] = "Inappropriate file type or format", /* 150 - EFTYPE */ - [151] = "Authentication error", /* 151 - EAUTH */ - [152] = "Need authenticator", /* 152 - ENEEDAUTH */ - [153] = "Operation canceled", /* 153 - ECANCELED */ - [160] = "Stale NFS file handle", /* 160 - ESTALE */ - [161] = "Too many levels of remote in path", /* 161 - EREMOTE */ - [162] = "RPC struct is bad", /* 162 - EBADRPC */ - [163] = "RPC version wrong", /* 163 - ERPCMISMATCH */ - [164] = "RPC prog. not avail", /* 164 - EPROGUNAVAIL */ - [165] = "Program version wrong", /* 165 - EPROGMISMATCH */ - [166] = "Bad procedure for program", /* 166 - EPROCUNAVAIL */ - [170] = "Bad or Corrupt message", /* 170 - EBADMSG */ - [175] = "Too many processes", /* 175 - EPROCLIM */ - [176] = "Too many users", /* 176 - EUSERS */ - [177] = "Disc quota exceeded", /* 177 - EDQUOT */ - [180] = "Multihop attempted ", /* 180 - EMULTIHOP */ - [181] = "Link has been severed", /* 181 - ENOLINK */ - [182] = "Protocol error", /* 182 - EPROTO */ - [185] = "Attribute not found", /* 185 - ENOATTR */ - [190] = "No message available", /* 190 - ENODATA */ - [191] = "No STREAM resources", /* 191 - ENOSR */ - [192] = "Not a STREAM", /* 192 - ENOSTR */ - [193] = "STREAM ioctl timeout", /* 193 - ETIME */ - [301] = "specified endpoint is bad", /* 301 - EBADEPT */ - [302] = "specified endpoint is not alive", /* 302 - EDEADEPT */ -}; - -const int sys_nerr = sizeof(errlist) / sizeof(errlist[0]); -const char * const *sys_errlist = errlist; diff --git a/lib/nbsd_libc/gen/Makefile.inc b/lib/nbsd_libc/gen/Makefile.inc index 497052ad3..99e64064d 100644 --- a/lib/nbsd_libc/gen/Makefile.inc +++ b/lib/nbsd_libc/gen/Makefile.inc @@ -213,8 +213,8 @@ CPPFLAGS.tolower_.c+= -I${LIBCDIR}/locale CPPFLAGS.toupper_.c+= -I${LIBCDIR}/locale .if defined(__MINIX) -errlist.c: errlist-minix.awk ${MINIXSRCDIR}/nbsd_include/sys/errno.h - ${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET} +errlist.c: errlist.awk ${MINIXSRCDIR}/nbsd_include/sys/errno.h + cat ${MINIXSRCDIR}/nbsd_include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${MINIXSRCDIR}/lib/nbsd_libc/gen/errlist.awk > ${.TARGET} .else errlist.c: errlist.awk ${NETBSDSRCDIR}/sys/sys/errno.h ${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET} diff --git a/lib/nbsd_libc/gen/errlist-minix.awk b/lib/nbsd_libc/gen/errlist-minix.awk deleted file mode 100644 index afa7f92b1..000000000 --- a/lib/nbsd_libc/gen/errlist-minix.awk +++ /dev/null @@ -1,118 +0,0 @@ -#! /usr/bin/awk -f -# $NetBSD: errlist.awk,v 1.4 2010/12/16 22:52:32 joerg Exp $ -# -# Copyright (c) 2010 The NetBSD Foundation, Inc. -# All rights reserved. -# -# This code is derived from software contributed to The NetBSD Foundation -# by Christos Zoulas. -# -# 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. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by the NetBSD -# Foundation, Inc. and its contributors. -# 4. Neither the name of The NetBSD Foundation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. -# -function tabs(desc) { - l = length(desc) + 3; - if (concat) - l++ - if (l < 16) - return "\t\t\t\t"; - else if (l < 24) - return "\t\t\t"; - else if (l < 32) - return "\t\t"; - else if (l < 40) - return "\t"; - else - return ""; -} -function perror(name, number, desc) -{ - if (!concat) { - printf("\t[%d] = \"%s\",%s/* %d - %s */\n", number, desc, tabs(desc), number, name); - } else { - offsets[number] = offset; - offset += length(desc) + 1; - printf("\t[%d] = \"%s\\0\"%s/* %d - %s */\n", number, desc, tabs(desc), number, name); - } -} -BEGIN { - printf("/* Automatically generated file; do not edit */\n"); - printf("#include \n"); - printf("__RCSID(\"$NetBSD: errlist.awk,v 1.4 2010/12/16 22:52:32 joerg Exp $\");\n"); - printf("#include \n"); - if (!concat) { - printf("static const char *const errlist[] = {\n"); - } else { - printf("static const char concat_errlist[] = {\n"); - offset = 0; - } - perror("ENOERROR", 0, "Undefined error: 0"); - errno = 1; - last = 0; -} -/^#define/ { - if ( last ) next; - - name = $2; - if (name == "ELAST") { - last = 1; - next; - } - number = $4; - if (number < 0 || number == "EAGAIN") - next; - desc = $0; - i1 = index(desc, "/*") + 3; - l = length(desc); - desc = substr(desc, i1, l - i1 - 2); -# if (number != errno) { -# printf("error number mismatch %d != %d\n", number, errno) > "/dev/stderr"; -# exit(1); -# } - perror(name, number, desc); - errno=number; -} -END { - printf("};\n\n"); - if (!concat) { - printf("const int sys_nerr = sizeof(errlist) / sizeof(errlist[0]);\n"); - printf("const char * const *sys_errlist = errlist;\n"); - } else { - printf("static const int concat_nerr = %d;\n", errno); - printf("static const unsigned short concat_offset[] = {\n"); - offsets[errno++] = offset; - for (j = 0; j < errno; j++) { - printf("\t%d,\n", offsets[j]); - } - printf("};\n"); - if (offset > 65535) { - printf("Total errlist size doesn't fit into 16bit\n") > "/dev/stderr"; - exit(1); - } - } -} diff --git a/lib/nbsd_libc/gen/errlist.awk b/lib/nbsd_libc/gen/errlist.awk index 81c43fc3c..a31ecab4e 100644 --- a/lib/nbsd_libc/gen/errlist.awk +++ b/lib/nbsd_libc/gen/errlist.awk @@ -85,10 +85,14 @@ BEGIN { i1 = index(desc, "/*") + 3; l = length(desc); desc = substr(desc, i1, l - i1 - 2); - if (number != errno) { - printf("error number mismatch %d != %d\n", number, errno) > "/dev/stderr"; + if (number < errno) { + printf("%s\n error number mismatch %d != %d\n", $0, number, errno) > "/dev/stderr"; exit(1); } + while(errno < number) { + perror("UNDEFINED", errno, "Undefined error: " errno); + errno++; + } perror(name, number, desc); errno++; } diff --git a/lib/nbsd_libc/minix-port.patch b/lib/nbsd_libc/minix-port.patch index 9ea5ac0ad..70d3642ea 100644 --- a/lib/nbsd_libc/minix-port.patch +++ b/lib/nbsd_libc/minix-port.patch @@ -469,8 +469,8 @@ diff -ru nbsdsrc/src/lib/libc/gen/Makefile.inc lib/nbsd_libc/gen/Makefile.inc CPPFLAGS.toupper_.c+= -I${LIBCDIR}/locale +.if defined(__MINIX) -+errlist.c: errlist-minix.awk ${MINIXSRCDIR}/nbsd_include/sys/errno.h -+ ${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET} ++errlist.c: errlist.awk ${MINIXSRCDIR}/nbsd_include/sys/errno.h ++ cat ${MINIXSRCDIR}/nbsd_include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${MINIXSRCDIR}/lib/nbsd_libc/gen/errlist.awk > ${.TARGET} +.else errlist.c: errlist.awk ${NETBSDSRCDIR}/sys/sys/errno.h ${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET} @@ -574,6 +574,25 @@ diff -ru nbsdsrc/src/lib/libc/gen/closedir.c lib/nbsd_libc/gen/closedir.c #include "namespace.h" #include "reentrant.h" #include "extern.h" +diff -ru nbsdsrc/src/lib/libc/gen/errlist.awk lib/nbsd_libc/gen/errlist.awk +--- nbsdsrc/src/lib/libc/gen/errlist.awk ++++ lib/nbsd_libc/gen/errlist.awk +@@ -85,9 +85,13 @@ + i1 = index(desc, "/*") + 3; + l = length(desc); + desc = substr(desc, i1, l - i1 - 2); +- if (number != errno) { +- printf("error number mismatch %d != %d\n", number, errno) > "/dev/stderr"; ++ if (number < errno) { ++ printf("%s\n error number mismatch %d != %d\n", $0, number, errno) > "/dev/stderr"; + exit(1); ++ } ++ while(errno < number) { ++ perror("UNDEFINED", errno, "Undefined error: " errno); ++ errno++; + } + perror(name, number, desc); + errno++; diff -ru nbsdsrc/src/lib/libc/gen/execl.c lib/nbsd_libc/gen/execl.c --- nbsdsrc/src/lib/libc/gen/execl.c +++ lib/nbsd_libc/gen/execl.c diff --git a/nbsd_include/sys/errno.h b/nbsd_include/sys/errno.h index 2655772f6..b1b5d6a49 100644 --- a/nbsd_include/sys/errno.h +++ b/nbsd_include/sys/errno.h @@ -30,7 +30,6 @@ -#define EGENERIC (_SIGN 99 ) /* generic error */ #define EPERM (_SIGN 1 ) /* operation not permitted */ #define ENOENT (_SIGN 2 ) /* no such file or directory */ #define ESRCH (_SIGN 3 ) /* no such process */ @@ -105,7 +104,7 @@ #define ENOTSOCK (_SIGN 74 ) /* Socket operation on non-socket */ #define ENOPROTOOPT (_SIGN 75 ) /* Protocol not available */ #define EOPNOTSUPP (_SIGN 76 ) /* Operation not supported */ -#define ENOTSUP EOPNOTSUPP /* Not supported */ +#define ENOTSUP ( EOPNOTSUPP ) /* Not supported */ #define ENETDOWN (_SIGN 77 ) /* network is down */ #define EPFNOSUPPORT (_SIGN 78 ) /* Protocol family not supported */ #define EDESTADDRREQ (_SIGN 79 ) /* Destination address required */ @@ -115,6 +114,8 @@ #define ECONNABORTED (_SIGN 83 ) /* Software caused connection abort */ #define ETOOMANYREFS (_SIGN 84 ) /* Too many references: can't splice */ +#define EGENERIC (_SIGN 99 ) /* generic error */ + /* The following are not POSIX errors, but they can still happen. * All of these are generated by the kernel and relate to message passing. */ @@ -126,7 +127,6 @@ #define ENOTREADY (_SIGN 106 ) /* source or destination is not ready */ #define EBADREQUEST (_SIGN 107 ) /* destination cannot handle request */ #define ETRAPDENIED (_SIGN 110 ) /* IPC trap not allowed */ -#define EDONTREPLY (_SIGN 201 ) /* pseudo-code: don't send a reply */ /* The following errors are NetBSD errors. */ #define EFTYPE (_SIGN 150 ) /* Inappropriate file type or format */ @@ -166,20 +166,11 @@ #define ENOSTR (_SIGN 192 ) /* Not a STREAM */ #define ETIME (_SIGN 193 ) /* STREAM ioctl timeout */ +#define EDONTREPLY (_SIGN 201 ) /* pseudo-code: don't send a reply */ + /* The following are non-POSIX server responses */ #define EBADEPT (_SIGN 301 ) /* specified endpoint is bad */ #define EDEADEPT (_SIGN 302 ) /* specified endpoint is not alive */ +#define EBADCPU (_SIGN 303 ) /* requested CPU does not work */ -/* This define is put before EBADCPU to instruct errlist-minix.awk to - stop creating the errlist array here. '1000' infact is definitely - too large for an error number to be included in a fixed array, as - this would need ~700 empty array entries. */ -#define ELAST EBADCPU /* Must equal largest errno */ - -#define EBADCPU (_SIGN 1000 ) /* requested CPU does not work */ - - - -/* Here are the numerical values of the error numbers. */ -#define _NERROR 1000 /* number of errors */ #endif /* _ERRNO_H */