Module Name: src Committed By: joerg Date: Thu Dec 9 21:27:32 UTC 2010
Modified Files: src/lib/libc/gen: errlist.c Log Message: Wrap sys_errlist constants in a macro to make it easier to extract the strings reliably with sed/awk. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/errlist.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/gen/errlist.c diff -u src/lib/libc/gen/errlist.c:1.17 src/lib/libc/gen/errlist.c:1.18 --- src/lib/libc/gen/errlist.c:1.17 Tue Oct 31 00:38:07 2006 +++ src/lib/libc/gen/errlist.c Thu Dec 9 21:27:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: errlist.c,v 1.17 2006/10/31 00:38:07 cbiere Exp $ */ +/* $NetBSD: errlist.c,v 1.18 2010/12/09 21:27:31 joerg Exp $ */ /* * Copyright (c) 1982, 1985, 1993 @@ -34,147 +34,158 @@ #if 0 static char sccsid[] = "@(#)errlst.c 8.2 (Berkeley) 11/16/93"; #else -__RCSID("$NetBSD: errlist.c,v 1.17 2006/10/31 00:38:07 cbiere Exp $"); +__RCSID("$NetBSD: errlist.c,v 1.18 2010/12/09 21:27:31 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ #include <errno.h> +#define EL(x) x + static const char *const errlist[] = { - "Undefined error: 0", /* 0 - ENOERROR */ - "Operation not permitted", /* 1 - EPERM */ - "No such file or directory", /* 2 - ENOENT */ - "No such process", /* 3 - ESRCH */ - "Interrupted system call", /* 4 - EINTR */ - "Input/output error", /* 5 - EIO */ - "Device not configured", /* 6 - ENXIO */ - "Argument list too long", /* 7 - E2BIG */ - "Exec format error", /* 8 - ENOEXEC */ - "Bad file descriptor", /* 9 - EBADF */ - "No child processes", /* 10 - ECHILD */ - "Resource deadlock avoided", /* 11 - EDEADLK */ - "Cannot allocate memory", /* 12 - ENOMEM */ - "Permission denied", /* 13 - EACCES */ - "Bad address", /* 14 - EFAULT */ - "Block device required", /* 15 - ENOTBLK */ - "Device busy", /* 16 - EBUSY */ - "File exists", /* 17 - EEXIST */ - "Cross-device link", /* 18 - EXDEV */ - "Operation not supported by device", /* 19 - ENODEV */ - "Not a directory", /* 20 - ENOTDIR */ - "Is a directory", /* 21 - EISDIR */ - "Invalid argument", /* 22 - EINVAL */ - "Too many open files in system", /* 23 - ENFILE */ - "Too many open files", /* 24 - EMFILE */ - "Inappropriate ioctl for device", /* 25 - ENOTTY */ - "Text file busy", /* 26 - ETXTBSY */ - "File too large", /* 27 - EFBIG */ - "No space left on device", /* 28 - ENOSPC */ - "Illegal seek", /* 29 - ESPIPE */ - "Read-only file system", /* 30 - EROFS */ - "Too many links", /* 31 - EMLINK */ - "Broken pipe", /* 32 - EPIPE */ + EL(("Undefined error: 0")), /* 0 - ENOERROR */ + EL(("Operation not permitted")), /* 1 - EPERM */ + EL(("No such file or directory")), /* 2 - ENOENT */ + EL(("No such process")), /* 3 - ESRCH */ + EL(("Interrupted system call")), /* 4 - EINTR */ + EL(("Input/output error")), /* 5 - EIO */ + EL(("Device not configured")), /* 6 - ENXIO */ + EL(("Argument list too long")), /* 7 - E2BIG */ + EL(("Exec format error")), /* 8 - ENOEXEC */ + EL(("Bad file descriptor")), /* 9 - EBADF */ + EL(("No child processes")), /* 10 - ECHILD */ + EL(("Resource deadlock avoided")), /* 11 - EDEADLK */ + EL(("Cannot allocate memory")), /* 12 - ENOMEM */ + EL(("Permission denied")), /* 13 - EACCES */ + EL(("Bad address")), /* 14 - EFAULT */ + EL(("Block device required")), /* 15 - ENOTBLK */ + EL(("Device busy")), /* 16 - EBUSY */ + EL(("File exists")), /* 17 - EEXIST */ + EL(("Cross-device link")), /* 18 - EXDEV */ + /* 19 - ENODEV */ + EL(("Operation not supported by device")), + EL(("Not a directory")), /* 20 - ENOTDIR */ + EL(("Is a directory")), /* 21 - EISDIR */ + EL(("Invalid argument")), /* 22 - EINVAL */ + EL(("Too many open files in system")), /* 23 - ENFILE */ + EL(("Too many open files")), /* 24 - EMFILE */ + EL(("Inappropriate ioctl for device")), /* 25 - ENOTTY */ + EL(("Text file busy")), /* 26 - ETXTBSY */ + EL(("File too large")), /* 27 - EFBIG */ + EL(("No space left on device")), /* 28 - ENOSPC */ + EL(("Illegal seek")), /* 29 - ESPIPE */ + EL(("Read-only file system")), /* 30 - EROFS */ + EL(("Too many links")), /* 31 - EMLINK */ + EL(("Broken pipe")), /* 32 - EPIPE */ /* math software */ - "Numerical argument out of domain", /* 33 - EDOM */ - "Result too large or too small", /* 34 - ERANGE */ + /* 33 - EDOM */ + EL(("Numerical argument out of domain")), + EL(("Result too large or too small")), /* 34 - ERANGE */ /* non-blocking and interrupt i/o */ - "Resource temporarily unavailable", /* 35 - EAGAIN */ + /* 35 - EAGAIN */ + EL(("Resource temporarily unavailable")), /* 35 - EWOULDBLOCK */ - "Operation now in progress", /* 36 - EINPROGRESS */ - "Operation already in progress", /* 37 - EALREADY */ + EL(("Operation now in progress")), /* 36 - EINPROGRESS */ + EL(("Operation already in progress")), /* 37 - EALREADY */ /* ipc/network software -- argument errors */ - "Socket operation on non-socket", /* 38 - ENOTSOCK */ - "Destination address required", /* 39 - EDESTADDRREQ */ - "Message too long", /* 40 - EMSGSIZE */ - "Protocol wrong type for socket", /* 41 - EPROTOTYPE */ - "Protocol option not available", /* 42 - ENOPROTOOPT */ - "Protocol not supported", /* 43 - EPROTONOSUPPORT */ - "Socket type not supported", /* 44 - ESOCKTNOSUPPORT */ - "Operation not supported", /* 45 - EOPNOTSUPP */ - "Protocol family not supported", /* 46 - EPFNOSUPPORT */ + EL(("Socket operation on non-socket")), /* 38 - ENOTSOCK */ + EL(("Destination address required")), /* 39 - EDESTADDRREQ */ + EL(("Message too long")), /* 40 - EMSGSIZE */ + EL(("Protocol wrong type for socket")), /* 41 - EPROTOTYPE */ + EL(("Protocol option not available")), /* 42 - ENOPROTOOPT */ + EL(("Protocol not supported")), /* 43 - EPROTONOSUPPORT */ + EL(("Socket type not supported")), /* 44 - ESOCKTNOSUPPORT */ + EL(("Operation not supported")), /* 45 - EOPNOTSUPP */ + EL(("Protocol family not supported")), /* 46 - EPFNOSUPPORT */ /* 47 - EAFNOSUPPORT */ - "Address family not supported by protocol family", - "Address already in use", /* 48 - EADDRINUSE */ - "Can't assign requested address", /* 49 - EADDRNOTAVAIL */ + EL(("Address family not supported by protocol family")), + EL(("Address already in use")), /* 48 - EADDRINUSE */ + EL(("Can't assign requested address")), /* 49 - EADDRNOTAVAIL */ /* ipc/network software -- operational errors */ - "Network is down", /* 50 - ENETDOWN */ - "Network is unreachable", /* 51 - ENETUNREACH */ - "Network dropped connection on reset", /* 52 - ENETRESET */ - "Software caused connection abort", /* 53 - ECONNABORTED */ - "Connection reset by peer", /* 54 - ECONNRESET */ - "No buffer space available", /* 55 - ENOBUFS */ - "Socket is already connected", /* 56 - EISCONN */ - "Socket is not connected", /* 57 - ENOTCONN */ - "Can't send after socket shutdown", /* 58 - ESHUTDOWN */ - "Too many references: can't splice", /* 59 - ETOOMANYREFS */ - "Operation timed out", /* 60 - ETIMEDOUT */ - "Connection refused", /* 61 - ECONNREFUSED */ - - "Too many levels of symbolic links", /* 62 - ELOOP */ - "File name too long", /* 63 - ENAMETOOLONG */ + EL(("Network is down")), /* 50 - ENETDOWN */ + EL(("Network is unreachable")), /* 51 - ENETUNREACH */ + /* 52 - ENETRESET */ + EL(("Network dropped connection on reset")), + /* 53 - ECONNABORTED */ + EL(("Software caused connection abort")), + EL(("Connection reset by peer")), /* 54 - ECONNRESET */ + EL(("No buffer space available")), /* 55 - ENOBUFS */ + EL(("Socket is already connected")), /* 56 - EISCONN */ + EL(("Socket is not connected")), /* 57 - ENOTCONN */ + /* 58 - ESHUTDOWN */ + EL(("Can't send after socket shutdown")), + /* 59 - ETOOMANYREFS */ + EL(("Too many references: can't splice")), + EL(("Operation timed out")), /* 60 - ETIMEDOUT */ + EL(("Connection refused")), /* 61 - ECONNREFUSED */ + /* 62 - ELOOP */ + EL(("Too many levels of symbolic links")), + EL(("File name too long")), /* 63 - ENAMETOOLONG */ /* should be rearranged */ - "Host is down", /* 64 - EHOSTDOWN */ - "No route to host", /* 65 - EHOSTUNREACH */ - "Directory not empty", /* 66 - ENOTEMPTY */ + EL(("Host is down")), /* 64 - EHOSTDOWN */ + EL(("No route to host")), /* 65 - EHOSTUNREACH */ + EL(("Directory not empty")), /* 66 - ENOTEMPTY */ /* quotas & mush */ - "Too many processes", /* 67 - EPROCLIM */ - "Too many users", /* 68 - EUSERS */ - "Disc quota exceeded", /* 69 - EDQUOT */ + EL(("Too many processes")), /* 67 - EPROCLIM */ + EL(("Too many users")), /* 68 - EUSERS */ + EL(("Disc quota exceeded")), /* 69 - EDQUOT */ /* Network File System */ - "Stale NFS file handle", /* 70 - ESTALE */ - "Too many levels of remote in path", /* 71 - EREMOTE */ - "RPC struct is bad", /* 72 - EBADRPC */ - "RPC version wrong", /* 73 - ERPCMISMATCH */ - "RPC prog. not avail", /* 74 - EPROGUNAVAIL */ - "Program version wrong", /* 75 - EPROGMISMATCH */ - "Bad procedure for program", /* 76 - EPROCUNAVAIL */ - - "No locks available", /* 77 - ENOLCK */ - "Function not implemented", /* 78 - ENOSYS */ - - "Inappropriate file type or format", /* 79 - EFTYPE */ - "Authentication error", /* 80 - EAUTH */ - "Need authenticator", /* 81 - ENEEDAUTH */ + EL(("Stale NFS file handle")), /* 70 - ESTALE */ + EL(("Too many levels of remote in path")),/* 71 - EREMOTE */ + EL(("RPC struct is bad")), /* 72 - EBADRPC */ + EL(("RPC version wrong")), /* 73 - ERPCMISMATCH */ + EL(("RPC prog. not avail")), /* 74 - EPROGUNAVAIL */ + EL(("Program version wrong")), /* 75 - EPROGMISMATCH */ + EL(("Bad procedure for program")), /* 76 - EPROCUNAVAIL */ + + EL(("No locks available")), /* 77 - ENOLCK */ + EL(("Function not implemented")), /* 78 - ENOSYS */ + /* 79 - EFTYPE */ + EL(("Inappropriate file type or format")), + EL(("Authentication error")), /* 80 - EAUTH */ + EL(("Need authenticator")), /* 81 - ENEEDAUTH */ /* SystemV IPC */ - "Identifier removed", /* 82 - EIDRM */ - "No message of desired type", /* 83 - ENOMSG */ + EL(("Identifier removed")), /* 82 - EIDRM */ + EL(("No message of desired type")), /* 83 - ENOMSG */ /* 84 - EOVERFLOW */ - "Value too large to be stored in data type", + EL(("Value too large to be stored in data type")), /* Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995 */ - "Illegal byte sequence", /* 85 - EILSEQ */ + EL(("Illegal byte sequence")), /* 85 - EILSEQ */ /* Base, Realtime, Threads or Thread Priority Scheduling option errors */ - "Not supported", /* 86 - ENOTSUP */ + EL(("Not supported")), /* 86 - ENOTSUP */ /* Realtime option errors */ - "Operation Canceled", /* 87 - ECANCELED */ + EL(("Operation Canceled")), /* 87 - ECANCELED */ /* Realtime, XSI STREAMS option errors */ - "Bad or Corrupt message", /* 88 - EBADMSG */ + EL(("Bad or Corrupt message")), /* 88 - EBADMSG */ /* XSI STREAMS option errors */ - "No message available", /* 89 - ENODATA */ - "No STREAM resources", /* 90 - ENOSR */ - "Not a STREAM", /* 91 - ENOSTR */ - "STREAM ioctl timeout", /* 92 - ETIME */ + EL(("No message available")), /* 89 - ENODATA */ + EL(("No STREAM resources")), /* 90 - ENOSR */ + EL(("Not a STREAM")), /* 91 - ENOSTR */ + EL(("STREAM ioctl timeout")), /* 92 - ETIME */ /* File system extended attribute errors */ - "Attribute not found", /* 93 - ENOATTR */ + EL(("Attribute not found")), /* 93 - ENOATTR */ - "Multihop attempted", /* 94 - EMULTIHOP */ - "Link has been severed", /* 95 - ENOLINK */ - "Protocol error" /* 96 - EPROTO */ + EL(("Multihop attempted")), /* 94 - EMULTIHOP */ + EL(("Link has been severed")), /* 95 - ENOLINK */ + EL(("Protocol error")), /* 96 - EPROTO */ }; +#undef EL + const int sys_nerr = sizeof(errlist) / sizeof(errlist[0]); const char * const *sys_errlist = errlist;