Raymond Toy pushed to branch issue-365-add-strerror-with-generated-unix-errno at cmucl / cmucl
Commits:
-
2f9a0e54
by Raymond Toy at 2025-02-10T07:28:15-08:00
-
5e784f72
by Raymond Toy at 2025-02-10T07:29:56-08:00
4 changed files:
Changes:
| ... | ... | @@ -159,7 +159,8 @@ case `uname -s` in |
| 159 | 159 | ;;
|
| 160 | 160 | esac
|
| 161 | 161 | |
| 162 | -awk -f bin/create-errno.awk ${ERRNO_FILES} > src/code/unix-errno.lisp
|
|
| 162 | +#awk -f bin/create-errno.awk ${ERRNO_FILES} > src/code/unix-errno.lisp
|
|
| 163 | +bin/create-errno.sh ${ERRNO_FILES} > src/code/unix-errno.lisp
|
|
| 163 | 164 | |
| 164 | 165 | BUILDWORLD="$TOOLDIR/build-world.sh"
|
| 165 | 166 | BUILD_POT="yes"
|
| 1 | -BEGIN {
|
|
| 2 | - print ";;; -*- Package: UNIX -*-\n\
|
|
| 3 | -;;;\n\
|
|
| 4 | -;;; **********************************************************************\n\
|
|
| 5 | -;;; This code was written as part of the CMU Common Lisp project at\n\
|
|
| 6 | -;;; Carnegie Mellon University, and has been placed in the public domain.\n\
|
|
| 7 | -;;;\n\
|
|
| 8 | -(ext:file-comment\n\
|
|
| 9 | - \"$Header: src/code/unix-errno.lisp $\")\n\
|
|
| 10 | -;;;\n\
|
|
| 11 | -;;; **********************************************************************\n\
|
|
| 12 | -;;;\n\
|
|
| 13 | -;;; This file contains the UNIX low-level support, just enough to run\n\
|
|
| 14 | -;;; CMUCL.\n\
|
|
| 15 | -;;;\n\
|
|
| 16 | -(in-package \"UNIX\")\n\
|
|
| 17 | -(intl:textdomain \"cmucl-unix\")\n\
|
|
| 18 | -\n\
|
|
| 19 | -;;;; Errno stuff.\n\
|
|
| 20 | -(eval-when (compile eval)\n\
|
|
| 21 | -\n\
|
|
| 22 | -(defparameter *compiler-unix-errors* nil)\n\
|
|
| 23 | -\n\
|
|
| 24 | -(defmacro def-unix-error (name number &optional description)\n\
|
|
| 25 | - \"Define a constant named Name corresponding to the Unix errno value\n\
|
|
| 26 | - Number. A description of the errno is optional in Description.\"\n\
|
|
| 27 | - `(progn\n\
|
|
| 28 | - (eval-when (compile eval)\n\
|
|
| 29 | - (push (cons ,number ,description) *compiler-unix-errors*))\n\
|
|
| 30 | - (defconstant ,name ,number ,description)\n\
|
|
| 31 | - (export ',name)))\n\
|
|
| 32 | -\n\
|
|
| 33 | -(defmacro emit-unix-errors ()\n\
|
|
| 34 | - (let* ((max (apply #'max (mapcar #'car *compiler-unix-errors*)))\n\
|
|
| 35 | - (array (make-array (1+ max) :initial-element nil)))\n\
|
|
| 36 | - (dolist (error *compiler-unix-errors*)\n\
|
|
| 37 | - (setf (svref array (car error)) (cdr error)))\n\
|
|
| 38 | - `(progn\n\
|
|
| 39 | - (defvar *unix-errors* ',array)\n\
|
|
| 40 | - (declaim (simple-vector *unix-errors*)))))\n\
|
|
| 41 | -\n\
|
|
| 42 | -) ;eval-when\n\
|
|
| 43 | -\n\
|
|
| 44 | -;;; \n\
|
|
| 45 | -;;; From <errno.h>\n\
|
|
| 46 | -;;; \n\
|
|
| 47 | -(def-unix-error ESUCCESS 0 _N\"Successful\")\n\
|
|
| 48 | -#-linux\n\
|
|
| 49 | -(progn\n\
|
|
| 50 | -(def-unix-error EPERM 1 _N\"Operation not permitted\")\n\
|
|
| 51 | -(def-unix-error ENOENT 2 _N\"No such file or directory\")\n\
|
|
| 52 | -(def-unix-error ESRCH 3 _N\"No such process\")\n\
|
|
| 53 | -(def-unix-error EINTR 4 _N\"Interrupted system call\")\n\
|
|
| 54 | -(def-unix-error EIO 5 _N\"I/O error\")\n\
|
|
| 55 | -(def-unix-error ENXIO 6 _N\"Device not configured\")\n\
|
|
| 56 | -(def-unix-error E2BIG 7 _N\"Arg list too long\")\n\
|
|
| 57 | -(def-unix-error ENOEXEC 8 _N\"Exec format error\")\n\
|
|
| 58 | -(def-unix-error EBADF 9 _N\"Bad file descriptor\")\n\
|
|
| 59 | -(def-unix-error ECHILD 10 _N\"No child process\")\n\
|
|
| 60 | -)\n\
|
|
| 61 | -#+bsd(def-unix-error EDEADLK 11 _N\"Resource deadlock avoided\")\n\
|
|
| 62 | -#-bsd(def-unix-error EAGAIN 11 #-linux _N\"No more processes\" #+linux _N\"Try again\")\n\
|
|
| 63 | -#-linux\n\
|
|
| 64 | -(progn\n\
|
|
| 65 | -(def-unix-error ENOMEM 12 _N\"Out of memory\")\n\
|
|
| 66 | -(def-unix-error EACCES 13 _N\"Permission denied\")\n\
|
|
| 67 | -(def-unix-error EFAULT 14 _N\"Bad address\")\n\
|
|
| 68 | -(def-unix-error ENOTBLK 15 _N\"Block device required\")\n\
|
|
| 69 | -(def-unix-error EBUSY 16 _N\"Device or resource busy\")\n\
|
|
| 70 | -(def-unix-error EEXIST 17 _N\"File exists\")\n\
|
|
| 71 | -(def-unix-error EXDEV 18 _N\"Cross-device link\")\n\
|
|
| 72 | -(def-unix-error ENODEV 19 _N\"No such device\")\n\
|
|
| 73 | -(def-unix-error ENOTDIR 20 _N\"Not a director\")\n\
|
|
| 74 | -(def-unix-error EISDIR 21 _N\"Is a directory\")\n\
|
|
| 75 | -(def-unix-error EINVAL 22 _N\"Invalid argument\")\n\
|
|
| 76 | -(def-unix-error ENFILE 23 _N\"File table overflow\")\n\
|
|
| 77 | -(def-unix-error EMFILE 24 _N\"Too many open files\")\n\
|
|
| 78 | -(def-unix-error ENOTTY 25 _N\"Inappropriate ioctl for device\")\n\
|
|
| 79 | -(def-unix-error ETXTBSY 26 _N\"Text file busy\")\n\
|
|
| 80 | -(def-unix-error EFBIG 27 _N\"File too large\")\n\
|
|
| 81 | -(def-unix-error ENOSPC 28 _N\"No space left on device\")\n\
|
|
| 82 | -(def-unix-error ESPIPE 29 _N\"Illegal seek\")\n\
|
|
| 83 | -(def-unix-error EROFS 30 _N\"Read-only file system\")\n\
|
|
| 84 | -(def-unix-error EMLINK 31 _N\"Too many links\")\n\
|
|
| 85 | -(def-unix-error EPIPE 32 _N\"Broken pipe\")\n\
|
|
| 86 | -;;; \n\
|
|
| 87 | -;;; Math\n\
|
|
| 88 | -(def-unix-error EDOM 33 _N\"Numerical argument out of domain\")\n\
|
|
| 89 | -(def-unix-error ERANGE 34 #-linux _N\"Result too large\" #+linux _N\"Math result not representable\")\n\
|
|
| 90 | -)\n\
|
|
| 91 | -;;; \n\
|
|
| 92 | -#-(or linux svr4)\n\
|
|
| 93 | -(progn\n\
|
|
| 94 | -;;; non-blocking and interrupt i/o\n\
|
|
| 95 | -(def-unix-error EWOULDBLOCK 35 _N\"Operation would block\")\n\
|
|
| 96 | -#-bsd(def-unix-error EDEADLK 35 _N\"Operation would block\") ; Ditto\n\
|
|
| 97 | -#+bsd(def-unix-error EAGAIN 35 _N\"Resource temporarily unavailable\")\n\
|
|
| 98 | -(def-unix-error EINPROGRESS 36 _N\"Operation now in progress\")\n\
|
|
| 99 | -(def-unix-error EALREADY 37 _N\"Operation already in progress\")\n\
|
|
| 100 | -;;;\n\
|
|
| 101 | -;;; ipc/network software\n\
|
|
| 102 | -(def-unix-error ENOTSOCK 38 _N\"Socket operation on non-socket\")\n\
|
|
| 103 | -(def-unix-error EDESTADDRREQ 39 _N\"Destination address required\")\n\
|
|
| 104 | -(def-unix-error EMSGSIZE 40 _N\"Message too long\")\n\
|
|
| 105 | -(def-unix-error EPROTOTYPE 41 _N\"Protocol wrong type for socket\")\n\
|
|
| 106 | -(def-unix-error ENOPROTOOPT 42 _N\"Protocol not available\")\n\
|
|
| 107 | -(def-unix-error EPROTONOSUPPORT 43 _N\"Protocol not supported\")\n\
|
|
| 108 | -(def-unix-error ESOCKTNOSUPPORT 44 _N\"Socket type not supported\")\n\
|
|
| 109 | -(def-unix-error EOPNOTSUPP 45 _N\"Operation not supported on socket\")\n\
|
|
| 110 | -(def-unix-error EPFNOSUPPORT 46 _N\"Protocol family not supported\")\n\
|
|
| 111 | -(def-unix-error EAFNOSUPPORT 47 _N\"Address family not supported by protocol family\")\n\
|
|
| 112 | -(def-unix-error EADDRINUSE 48 _N\"Address already in use\")\n\
|
|
| 113 | -(def-unix-error EADDRNOTAVAIL 49 _N\"Can't assign requested address\")\n\
|
|
| 114 | -;;;\n\
|
|
| 115 | -;;; operational errors\n\
|
|
| 116 | -(def-unix-error ENETDOWN 50 _N\"Network is down\")\n\
|
|
| 117 | -(def-unix-error ENETUNREACH 51 _N\"Network is unreachable\")\n\
|
|
| 118 | -(def-unix-error ENETRESET 52 _N\"Network dropped connection on reset\")\n\
|
|
| 119 | -(def-unix-error ECONNABORTED 53 _N\"Software caused connection abort\")\n\
|
|
| 120 | -(def-unix-error ECONNRESET 54 _N\"Connection reset by peer\")\n\
|
|
| 121 | -(def-unix-error ENOBUFS 55 _N\"No buffer space available\")\n\
|
|
| 122 | -(def-unix-error EISCONN 56 _N\"Socket is already connected\")\n\
|
|
| 123 | -(def-unix-error ENOTCONN 57 _N\"Socket is not connected\")\n\
|
|
| 124 | -(def-unix-error ESHUTDOWN 58 _N\"Can't send after socket shutdown\")\n\
|
|
| 125 | -(def-unix-error ETOOMANYREFS 59 _N\"Too many references: can't splice\")\n\
|
|
| 126 | -(def-unix-error ETIMEDOUT 60 _N\"Connection timed out\")\n\
|
|
| 127 | -(def-unix-error ECONNREFUSED 61 _N\"Connection refused\")\n\
|
|
| 128 | -;;; \n\
|
|
| 129 | -(def-unix-error ELOOP 62 _N\"Too many levels of symbolic links\")\n\
|
|
| 130 | -(def-unix-error ENAMETOOLONG 63 _N\"File name too long\")\n\
|
|
| 131 | -;;; \n\
|
|
| 132 | -(def-unix-error EHOSTDOWN 64 _N\"Host is down\")\n\
|
|
| 133 | -(def-unix-error EHOSTUNREACH 65 _N\"No route to host\")\n\
|
|
| 134 | -(def-unix-error ENOTEMPTY 66 _N\"Directory not empty\")\n\
|
|
| 135 | -;;; \n\
|
|
| 136 | -;;; quotas & resource \n\
|
|
| 137 | -(def-unix-error EPROCLIM 67 _N\"Too many processes\")\n\
|
|
| 138 | -(def-unix-error EUSERS 68 _N\"Too many users\")\n\
|
|
| 139 | -(def-unix-error EDQUOT 69 _N\"Disc quota exceeded\")\n\
|
|
| 140 | -;;;\n\
|
|
| 141 | -;;; CMU RFS\n\
|
|
| 142 | -(def-unix-error ELOCAL 126 _N\"namei should continue locally\")\n\
|
|
| 143 | -(def-unix-error EREMOTE 127 _N\"namei was handled remotely\")\n\
|
|
| 144 | -;;;\n\
|
|
| 145 | -;;; VICE\n\
|
|
| 146 | -(def-unix-error EVICEERR 70 _N\"Remote file system error _N\")\n\
|
|
| 147 | -(def-unix-error EVICEOP 71 _N\"syscall was handled by Vice\")\n\
|
|
| 148 | -)\n\
|
|
| 149 | -#+svr4\n\
|
|
| 150 | -(progn\n\
|
|
| 151 | -(def-unix-error ENOMSG 35 _N\"No message of desired type\")\n\
|
|
| 152 | -(def-unix-error EIDRM 36 _N\"Identifier removed\")\n\
|
|
| 153 | -(def-unix-error ECHRNG 37 _N\"Channel number out of range\")\n\
|
|
| 154 | -(def-unix-error EL2NSYNC 38 _N\"Level 2 not synchronized\")\n\
|
|
| 155 | -(def-unix-error EL3HLT 39 _N\"Level 3 halted\")\n\
|
|
| 156 | -(def-unix-error EL3RST 40 _N\"Level 3 reset\")\n\
|
|
| 157 | -(def-unix-error ELNRNG 41 _N\"Link number out of range\")\n\
|
|
| 158 | -(def-unix-error EUNATCH 42 _N\"Protocol driver not attached\")\n\
|
|
| 159 | -(def-unix-error ENOCSI 43 _N\"No CSI structure available\")\n\
|
|
| 160 | -(def-unix-error EL2HLT 44 _N\"Level 2 halted\")\n\
|
|
| 161 | -(def-unix-error EDEADLK 45 _N\"Deadlock situation detected/avoided\")\n\
|
|
| 162 | -(def-unix-error ENOLCK 46 _N\"No record locks available\")\n\
|
|
| 163 | -(def-unix-error ECANCELED 47 _N\"Error 47\")\n\
|
|
| 164 | -(def-unix-error ENOTSUP 48 _N\"Error 48\")\n\
|
|
| 165 | -(def-unix-error EBADE 50 _N\"Bad exchange descriptor\")\n\
|
|
| 166 | -(def-unix-error EBADR 51 _N\"Bad request descriptor\")\n\
|
|
| 167 | -(def-unix-error EXFULL 52 _N\"Message tables full\")\n\
|
|
| 168 | -(def-unix-error ENOANO 53 _N\"Anode table overflow\")\n\
|
|
| 169 | -(def-unix-error EBADRQC 54 _N\"Bad request code\")\n\
|
|
| 170 | -(def-unix-error EBADSLT 55 _N\"Invalid slot\")\n\
|
|
| 171 | -(def-unix-error EDEADLOCK 56 _N\"File locking deadlock\")\n\
|
|
| 172 | -(def-unix-error EBFONT 57 _N\"Bad font file format\")\n\
|
|
| 173 | -(def-unix-error ENOSTR 60 _N\"Not a stream device\")\n\
|
|
| 174 | -(def-unix-error ENODATA 61 _N\"No data available\")\n\
|
|
| 175 | -(def-unix-error ETIME 62 _N\"Timer expired\")\n\
|
|
| 176 | -(def-unix-error ENOSR 63 _N\"Out of stream resources\")\n\
|
|
| 177 | -(def-unix-error ENONET 64 _N\"Machine is not on the network\")\n\
|
|
| 178 | -(def-unix-error ENOPKG 65 _N\"Package not installed\")\n\
|
|
| 179 | -(def-unix-error EREMOTE 66 _N\"Object is remote\")\n\
|
|
| 180 | -(def-unix-error ENOLINK 67 _N\"Link has been severed\")\n\
|
|
| 181 | -(def-unix-error EADV 68 _N\"Advertise error\")\n\
|
|
| 182 | -(def-unix-error ESRMNT 69 _N\"Srmount error\")\n\
|
|
| 183 | -(def-unix-error ECOMM 70 _N\"Communication error on send\")\n\
|
|
| 184 | -(def-unix-error EPROTO 71 _N\"Protocol error\")\n\
|
|
| 185 | -(def-unix-error EMULTIHOP 74 _N\"Multihop attempted\")\n\
|
|
| 186 | -(def-unix-error EBADMSG 77 _N\"Not a data message\")\n\
|
|
| 187 | -(def-unix-error ENAMETOOLONG 78 _N\"File name too long\")\n\
|
|
| 188 | -(def-unix-error EOVERFLOW 79 _N\"Value too large for defined data type\")\n\
|
|
| 189 | -(def-unix-error ENOTUNIQ 80 _N\"Name not unique on network\")\n\
|
|
| 190 | -(def-unix-error EBADFD 81 _N\"File descriptor in bad state\")\n\
|
|
| 191 | -(def-unix-error EREMCHG 82 _N\"Remote address changed\")\n\
|
|
| 192 | -(def-unix-error ELIBACC 83 _N\"Can not access a needed shared library\")\n\
|
|
| 193 | -(def-unix-error ELIBBAD 84 _N\"Accessing a corrupted shared library\")\n\
|
|
| 194 | -(def-unix-error ELIBSCN 85 _N\".lib section in a.out corrupted\")\n\
|
|
| 195 | -(def-unix-error ELIBMAX 86 _N\"Attempting to link in more shared libraries than system limit\")\n\
|
|
| 196 | -(def-unix-error ELIBEXEC 87 _N\"Can not exec a shared library directly\")\n\
|
|
| 197 | -(def-unix-error EILSEQ 88 _N\"Error 88\")\n\
|
|
| 198 | -(def-unix-error ENOSYS 89 _N\"Operation not applicable\")\n\
|
|
| 199 | -(def-unix-error ELOOP 90 _N\"Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS\")\n\
|
|
| 200 | -(def-unix-error ERESTART 91 _N\"Error 91\")\n\
|
|
| 201 | -(def-unix-error ESTRPIPE 92 _N\"Error 92\")\n\
|
|
| 202 | -(def-unix-error ENOTEMPTY 93 _N\"Directory not empty\")\n\
|
|
| 203 | -(def-unix-error EUSERS 94 _N\"Too many users\")\n\
|
|
| 204 | -(def-unix-error ENOTSOCK 95 _N\"Socket operation on non-socket\")\n\
|
|
| 205 | -(def-unix-error EDESTADDRREQ 96 _N\"Destination address required\")\n\
|
|
| 206 | -(def-unix-error EMSGSIZE 97 _N\"Message too long\")\n\
|
|
| 207 | -(def-unix-error EPROTOTYPE 98 _N\"Protocol wrong type for socket\")\n\
|
|
| 208 | -(def-unix-error ENOPROTOOPT 99 _N\"Option not supported by protocol\")\n\
|
|
| 209 | -(def-unix-error EPROTONOSUPPORT 120 _N\"Protocol not supported\")\n\
|
|
| 210 | -(def-unix-error ESOCKTNOSUPPORT 121 _N\"Socket type not supported\")\n\
|
|
| 211 | -(def-unix-error EOPNOTSUPP 122 _N\"Operation not supported on transport endpoint\")\n\
|
|
| 212 | -(def-unix-error EPFNOSUPPORT 123 _N\"Protocol family not supported\")\n\
|
|
| 213 | -(def-unix-error EAFNOSUPPORT 124 _N\"Address family not supported by protocol family\")\n\
|
|
| 214 | -(def-unix-error EADDRINUSE 125 _N\"Address already in use\")\n\
|
|
| 215 | -(def-unix-error EADDRNOTAVAIL 126 _N\"Cannot assign requested address\")\n\
|
|
| 216 | -(def-unix-error ENETDOWN 127 _N\"Network is down\")\n\
|
|
| 217 | -(def-unix-error ENETUNREACH 128 _N\"Network is unreachable\")\n\
|
|
| 218 | -(def-unix-error ENETRESET 129 _N\"Network dropped connection because of reset\")\n\
|
|
| 219 | -(def-unix-error ECONNABORTED 130 _N\"Software caused connection abort\")\n\
|
|
| 220 | -(def-unix-error ECONNRESET 131 _N\"Connection reset by peer\")\n\
|
|
| 221 | -(def-unix-error ENOBUFS 132 _N\"No buffer space available\")\n\
|
|
| 222 | -(def-unix-error EISCONN 133 _N\"Transport endpoint is already connected\")\n\
|
|
| 223 | -(def-unix-error ENOTCONN 134 _N\"Transport endpoint is not connected\")\n\
|
|
| 224 | -(def-unix-error ESHUTDOWN 143 _N\"Cannot send after socket shutdown\")\n\
|
|
| 225 | -(def-unix-error ETOOMANYREFS 144 _N\"Too many references: cannot splice\")\n\
|
|
| 226 | -(def-unix-error ETIMEDOUT 145 _N\"Connection timed out\")\n\
|
|
| 227 | -(def-unix-error ECONNREFUSED 146 _N\"Connection refused\")\n\
|
|
| 228 | -(def-unix-error EHOSTDOWN 147 _N\"Host is down\")\n\
|
|
| 229 | -(def-unix-error EHOSTUNREACH 148 _N\"No route to host\")\n\
|
|
| 230 | -(def-unix-error EWOULDBLOCK 11 _N\"Resource temporarily unavailable\")\n\
|
|
| 231 | -(def-unix-error EALREADY 149 _N\"Operation already in progress\")\n\
|
|
| 232 | -(def-unix-error EINPROGRESS 150 _N\"Operation now in progress\")\n\
|
|
| 233 | -(def-unix-error ESTALE 151 _N\"Stale NFS file handle\")\n\
|
|
| 234 | -)\n\
|
|
| 235 | -";
|
|
| 236 | -}
|
|
| 237 | - |
|
| 238 | -/^#define[ \t]+(E[A-Z0-9]+)[ \t]+([A-Z0-9]+).*$/ {
|
|
| 239 | - printf "(def-unix-error %s %s)\n", $2, $3;
|
|
| 240 | -}
|
|
| 241 | - |
|
| 242 | -END {
|
|
| 243 | - print "\n\n;;;\n\
|
|
| 244 | -;;; And now for something completely different ...\n\
|
|
| 245 | -(emit-unix-errors)\n\
|
|
| 246 | -"
|
|
| 247 | -}
|
|
| 248 | - |
| 1 | +#! /bin/sh
|
|
| 2 | + |
|
| 3 | +# Generates the contents of the file code/unix-errno.lisp. The args
|
|
| 4 | +# to this script, if supplied, must be a list of files containing the
|
|
| 5 | +# definitions of all the Unix errno values.
|
|
| 6 | +#
|
|
| 7 | + |
|
| 8 | +# The header was copied from code/unix.lisp. This includes all the
|
|
| 9 | +# support code for DEF-UNIX-ERROR and for all OSes that don't use the
|
|
| 10 | +# awk script to create the DEF-UNIX-ERROR forms.
|
|
| 11 | +#
|
|
| 12 | +cat <<EOF
|
|
| 13 | +;;; -*- Package: UNIX -*-
|
|
| 14 | +;;;
|
|
| 15 | +;;; **********************************************************************
|
|
| 16 | +;;; This code was written as part of the CMU Common Lisp project at
|
|
| 17 | +;;; Carnegie Mellon University, and has been placed in the public domain.
|
|
| 18 | +;;;
|
|
| 19 | +(ext:file-comment
|
|
| 20 | + "$Header: src/code/unix-errno.lisp $")
|
|
| 21 | +;;;
|
|
| 22 | +;;; **********************************************************************
|
|
| 23 | +;;;
|
|
| 24 | +;;; This file contains the UNIX low-level support, just enough to run
|
|
| 25 | +;;; CMUCL.
|
|
| 26 | +;;;
|
|
| 27 | +(in-package "UNIX")
|
|
| 28 | +(intl:textdomain "cmucl-unix")
|
|
| 29 | + |
|
| 30 | +;;;; Errno stuff.
|
|
| 31 | +(eval-when (compile eval)
|
|
| 32 | + |
|
| 33 | +(defparameter *compiler-unix-errors* nil)
|
|
| 34 | + |
|
| 35 | +(defmacro def-unix-error (name number &optional description)
|
|
| 36 | + "Define a constant named Name corresponding to the Unix errno value
|
|
| 37 | + Number. A description of the errno is optional in Description."
|
|
| 38 | + \`(progn
|
|
| 39 | + (eval-when (compile eval)
|
|
| 40 | + (push (cons ,number ,description) *compiler-unix-errors*))
|
|
| 41 | + (defconstant ,name ,number ,description)
|
|
| 42 | + (export ',name)))
|
|
| 43 | + |
|
| 44 | +(defmacro emit-unix-errors ()
|
|
| 45 | + (let* ((max (apply #'max (mapcar #'car *compiler-unix-errors*)))
|
|
| 46 | + (array (make-array (1+ max) :initial-element nil)))
|
|
| 47 | + (dolist (error *compiler-unix-errors*)
|
|
| 48 | + (setf (svref array (car error)) (cdr error)))
|
|
| 49 | + \`(progn
|
|
| 50 | + (defvar *unix-errors* ',array)
|
|
| 51 | + (declaim (simple-vector *unix-errors*)))))
|
|
| 52 | + |
|
| 53 | +) ;eval-when
|
|
| 54 | + |
|
| 55 | +;;;
|
|
| 56 | +;;; From <errno.h>
|
|
| 57 | +;;;
|
|
| 58 | +(def-unix-error ESUCCESS 0 _N"Successful")
|
|
| 59 | +#-linux
|
|
| 60 | +(progn
|
|
| 61 | +(def-unix-error EPERM 1 _N"Operation not permitted")
|
|
| 62 | +(def-unix-error ENOENT 2 _N"No such file or directory")
|
|
| 63 | +(def-unix-error ESRCH 3 _N"No such process")
|
|
| 64 | +(def-unix-error EINTR 4 _N"Interrupted system call")
|
|
| 65 | +(def-unix-error EIO 5 _N"I/O error")
|
|
| 66 | +(def-unix-error ENXIO 6 _N"Device not configured")
|
|
| 67 | +(def-unix-error E2BIG 7 _N"Arg list too long")
|
|
| 68 | +(def-unix-error ENOEXEC 8 _N"Exec format error")
|
|
| 69 | +(def-unix-error EBADF 9 _N"Bad file descriptor")
|
|
| 70 | +(def-unix-error ECHILD 10 _N"No child process")
|
|
| 71 | +)
|
|
| 72 | +#+bsd(def-unix-error EDEADLK 11 _N"Resource deadlock avoided")
|
|
| 73 | +#-(or bsd linux) (def-unix-error EAGAIN 11 #-linux _N"No more processes" #+linux _N"Try again")
|
|
| 74 | +#-linux
|
|
| 75 | +(progn
|
|
| 76 | +(def-unix-error ENOMEM 12 _N"Out of memory")
|
|
| 77 | +(def-unix-error EACCES 13 _N"Permission denied")
|
|
| 78 | +(def-unix-error EFAULT 14 _N"Bad address")
|
|
| 79 | +(def-unix-error ENOTBLK 15 _N"Block device required")
|
|
| 80 | +(def-unix-error EBUSY 16 _N"Device or resource busy")
|
|
| 81 | +(def-unix-error EEXIST 17 _N"File exists")
|
|
| 82 | +(def-unix-error EXDEV 18 _N"Cross-device link")
|
|
| 83 | +(def-unix-error ENODEV 19 _N"No such device")
|
|
| 84 | +(def-unix-error ENOTDIR 20 _N"Not a director")
|
|
| 85 | +(def-unix-error EISDIR 21 _N"Is a directory")
|
|
| 86 | +(def-unix-error EINVAL 22 _N"Invalid argument")
|
|
| 87 | +(def-unix-error ENFILE 23 _N"File table overflow")
|
|
| 88 | +(def-unix-error EMFILE 24 _N"Too many open files")
|
|
| 89 | +(def-unix-error ENOTTY 25 _N"Inappropriate ioctl for device")
|
|
| 90 | +(def-unix-error ETXTBSY 26 _N"Text file busy")
|
|
| 91 | +(def-unix-error EFBIG 27 _N"File too large")
|
|
| 92 | +(def-unix-error ENOSPC 28 _N"No space left on device")
|
|
| 93 | +(def-unix-error ESPIPE 29 _N"Illegal seek")
|
|
| 94 | +(def-unix-error EROFS 30 _N"Read-only file system")
|
|
| 95 | +(def-unix-error EMLINK 31 _N"Too many links")
|
|
| 96 | +(def-unix-error EPIPE 32 _N"Broken pipe")
|
|
| 97 | +;;;
|
|
| 98 | +;;; Math
|
|
| 99 | +(def-unix-error EDOM 33 _N"Numerical argument out of domain")
|
|
| 100 | +(def-unix-error ERANGE 34 #-linux _N"Result too large" #+linux _N"Math result not representable")
|
|
| 101 | +)
|
|
| 102 | +;;;
|
|
| 103 | +#-(or linux svr4)
|
|
| 104 | +(progn
|
|
| 105 | +;;; non-blocking and interrupt i/o
|
|
| 106 | +(def-unix-error EWOULDBLOCK 35 _N"Operation would block")
|
|
| 107 | +#-bsd(def-unix-error EDEADLK 35 _N"Operation would block") ; Ditto
|
|
| 108 | +#+bsd(def-unix-error EAGAIN 35 _N"Resource temporarily unavailable")
|
|
| 109 | +(def-unix-error EINPROGRESS 36 _N"Operation now in progress")
|
|
| 110 | +(def-unix-error EALREADY 37 _N"Operation already in progress")
|
|
| 111 | +;;;
|
|
| 112 | +;;; ipc/network software
|
|
| 113 | +(def-unix-error ENOTSOCK 38 _N"Socket operation on non-socket")
|
|
| 114 | +(def-unix-error EDESTADDRREQ 39 _N"Destination address required")
|
|
| 115 | +(def-unix-error EMSGSIZE 40 _N"Message too long")
|
|
| 116 | +(def-unix-error EPROTOTYPE 41 _N"Protocol wrong type for socket")
|
|
| 117 | +(def-unix-error ENOPROTOOPT 42 _N"Protocol not available")
|
|
| 118 | +(def-unix-error EPROTONOSUPPORT 43 _N"Protocol not supported")
|
|
| 119 | +(def-unix-error ESOCKTNOSUPPORT 44 _N"Socket type not supported")
|
|
| 120 | +(def-unix-error EOPNOTSUPP 45 _N"Operation not supported on socket")
|
|
| 121 | +(def-unix-error EPFNOSUPPORT 46 _N"Protocol family not supported")
|
|
| 122 | +(def-unix-error EAFNOSUPPORT 47 _N"Address family not supported by protocol family")
|
|
| 123 | +(def-unix-error EADDRINUSE 48 _N"Address already in use")
|
|
| 124 | +(def-unix-error EADDRNOTAVAIL 49 _N"Can't assign requested address")
|
|
| 125 | +;;;
|
|
| 126 | +;;; operational errors
|
|
| 127 | +(def-unix-error ENETDOWN 50 _N"Network is down")
|
|
| 128 | +(def-unix-error ENETUNREACH 51 _N"Network is unreachable")
|
|
| 129 | +(def-unix-error ENETRESET 52 _N"Network dropped connection on reset")
|
|
| 130 | +(def-unix-error ECONNABORTED 53 _N"Software caused connection abort")
|
|
| 131 | +(def-unix-error ECONNRESET 54 _N"Connection reset by peer")
|
|
| 132 | +(def-unix-error ENOBUFS 55 _N"No buffer space available")
|
|
| 133 | +(def-unix-error EISCONN 56 _N"Socket is already connected")
|
|
| 134 | +(def-unix-error ENOTCONN 57 _N"Socket is not connected")
|
|
| 135 | +(def-unix-error ESHUTDOWN 58 _N"Can't send after socket shutdown")
|
|
| 136 | +(def-unix-error ETOOMANYREFS 59 _N"Too many references: can't splice")
|
|
| 137 | +(def-unix-error ETIMEDOUT 60 _N"Connection timed out")
|
|
| 138 | +(def-unix-error ECONNREFUSED 61 _N"Connection refused")
|
|
| 139 | +;;;
|
|
| 140 | +(def-unix-error ELOOP 62 _N"Too many levels of symbolic links")
|
|
| 141 | +(def-unix-error ENAMETOOLONG 63 _N"File name too long")
|
|
| 142 | +;;;
|
|
| 143 | +(def-unix-error EHOSTDOWN 64 _N"Host is down")
|
|
| 144 | +(def-unix-error EHOSTUNREACH 65 _N"No route to host")
|
|
| 145 | +(def-unix-error ENOTEMPTY 66 _N"Directory not empty")
|
|
| 146 | +;;;
|
|
| 147 | +;;; quotas & resource
|
|
| 148 | +(def-unix-error EPROCLIM 67 _N"Too many processes")
|
|
| 149 | +(def-unix-error EUSERS 68 _N"Too many users")
|
|
| 150 | +(def-unix-error EDQUOT 69 _N"Disc quota exceeded")
|
|
| 151 | +;;;
|
|
| 152 | +;;; CMU RFS
|
|
| 153 | +(def-unix-error ELOCAL 126 _N"namei should continue locally")
|
|
| 154 | +(def-unix-error EREMOTE 127 _N"namei was handled remotely")
|
|
| 155 | +;;;
|
|
| 156 | +;;; VICE
|
|
| 157 | +(def-unix-error EVICEERR 70 _N"Remote file system error _N")
|
|
| 158 | +(def-unix-error EVICEOP 71 _N"syscall was handled by Vice")
|
|
| 159 | +)
|
|
| 160 | +#+svr4
|
|
| 161 | +(progn
|
|
| 162 | +(def-unix-error ENOMSG 35 _N"No message of desired type")
|
|
| 163 | +(def-unix-error EIDRM 36 _N"Identifier removed")
|
|
| 164 | +(def-unix-error ECHRNG 37 _N"Channel number out of range")
|
|
| 165 | +(def-unix-error EL2NSYNC 38 _N"Level 2 not synchronized")
|
|
| 166 | +(def-unix-error EL3HLT 39 _N"Level 3 halted")
|
|
| 167 | +(def-unix-error EL3RST 40 _N"Level 3 reset")
|
|
| 168 | +(def-unix-error ELNRNG 41 _N"Link number out of range")
|
|
| 169 | +(def-unix-error EUNATCH 42 _N"Protocol driver not attached")
|
|
| 170 | +(def-unix-error ENOCSI 43 _N"No CSI structure available")
|
|
| 171 | +(def-unix-error EL2HLT 44 _N"Level 2 halted")
|
|
| 172 | +(def-unix-error EDEADLK 45 _N"Deadlock situation detected/avoided")
|
|
| 173 | +(def-unix-error ENOLCK 46 _N"No record locks available")
|
|
| 174 | +(def-unix-error ECANCELED 47 _N"Error 47")
|
|
| 175 | +(def-unix-error ENOTSUP 48 _N"Error 48")
|
|
| 176 | +(def-unix-error EBADE 50 _N"Bad exchange descriptor")
|
|
| 177 | +(def-unix-error EBADR 51 _N"Bad request descriptor")
|
|
| 178 | +(def-unix-error EXFULL 52 _N"Message tables full")
|
|
| 179 | +(def-unix-error ENOANO 53 _N"Anode table overflow")
|
|
| 180 | +(def-unix-error EBADRQC 54 _N"Bad request code")
|
|
| 181 | +(def-unix-error EBADSLT 55 _N"Invalid slot")
|
|
| 182 | +(def-unix-error EDEADLOCK 56 _N"File locking deadlock")
|
|
| 183 | +(def-unix-error EBFONT 57 _N"Bad font file format")
|
|
| 184 | +(def-unix-error ENOSTR 60 _N"Not a stream device")
|
|
| 185 | +(def-unix-error ENODATA 61 _N"No data available")
|
|
| 186 | +(def-unix-error ETIME 62 _N"Timer expired")
|
|
| 187 | +(def-unix-error ENOSR 63 _N"Out of stream resources")
|
|
| 188 | +(def-unix-error ENONET 64 _N"Machine is not on the network")
|
|
| 189 | +(def-unix-error ENOPKG 65 _N"Package not installed")
|
|
| 190 | +(def-unix-error EREMOTE 66 _N"Object is remote")
|
|
| 191 | +(def-unix-error ENOLINK 67 _N"Link has been severed")
|
|
| 192 | +(def-unix-error EADV 68 _N"Advertise error")
|
|
| 193 | +(def-unix-error ESRMNT 69 _N"Srmount error")
|
|
| 194 | +(def-unix-error ECOMM 70 _N"Communication error on send")
|
|
| 195 | +(def-unix-error EPROTO 71 _N"Protocol error")
|
|
| 196 | +(def-unix-error EMULTIHOP 74 _N"Multihop attempted")
|
|
| 197 | +(def-unix-error EBADMSG 77 _N"Not a data message")
|
|
| 198 | +(def-unix-error ENAMETOOLONG 78 _N"File name too long")
|
|
| 199 | +(def-unix-error EOVERFLOW 79 _N"Value too large for defined data type")
|
|
| 200 | +(def-unix-error ENOTUNIQ 80 _N"Name not unique on network")
|
|
| 201 | +(def-unix-error EBADFD 81 _N"File descriptor in bad state")
|
|
| 202 | +(def-unix-error EREMCHG 82 _N"Remote address changed")
|
|
| 203 | +(def-unix-error ELIBACC 83 _N"Can not access a needed shared library")
|
|
| 204 | +(def-unix-error ELIBBAD 84 _N"Accessing a corrupted shared library")
|
|
| 205 | +(def-unix-error ELIBSCN 85 _N".lib section in a.out corrupted")
|
|
| 206 | +(def-unix-error ELIBMAX 86 _N"Attempting to link in more shared libraries than system limit")
|
|
| 207 | +(def-unix-error ELIBEXEC 87 _N"Can not exec a shared library directly")
|
|
| 208 | +(def-unix-error EILSEQ 88 _N"Error 88")
|
|
| 209 | +(def-unix-error ENOSYS 89 _N"Operation not applicable")
|
|
| 210 | +(def-unix-error ELOOP 90 _N"Number of symbolic links encountered during path name traversal exceeds MAXSYMLINKS")
|
|
| 211 | +(def-unix-error ERESTART 91 _N"Error 91")
|
|
| 212 | +(def-unix-error ESTRPIPE 92 _N"Error 92")
|
|
| 213 | +(def-unix-error ENOTEMPTY 93 _N"Directory not empty")
|
|
| 214 | +(def-unix-error EUSERS 94 _N"Too many users")
|
|
| 215 | +(def-unix-error ENOTSOCK 95 _N"Socket operation on non-socket")
|
|
| 216 | +(def-unix-error EDESTADDRREQ 96 _N"Destination address required")
|
|
| 217 | +(def-unix-error EMSGSIZE 97 _N"Message too long")
|
|
| 218 | +(def-unix-error EPROTOTYPE 98 _N"Protocol wrong type for socket")
|
|
| 219 | +(def-unix-error ENOPROTOOPT 99 _N"Option not supported by protocol")
|
|
| 220 | +(def-unix-error EPROTONOSUPPORT 120 _N"Protocol not supported")
|
|
| 221 | +(def-unix-error ESOCKTNOSUPPORT 121 _N"Socket type not supported")
|
|
| 222 | +(def-unix-error EOPNOTSUPP 122 _N"Operation not supported on transport endpoint")
|
|
| 223 | +(def-unix-error EPFNOSUPPORT 123 _N"Protocol family not supported")
|
|
| 224 | +(def-unix-error EAFNOSUPPORT 124 _N"Address family not supported by protocol family")
|
|
| 225 | +(def-unix-error EADDRINUSE 125 _N"Address already in use")
|
|
| 226 | +(def-unix-error EADDRNOTAVAIL 126 _N"Cannot assign requested address")
|
|
| 227 | +(def-unix-error ENETDOWN 127 _N"Network is down")
|
|
| 228 | +(def-unix-error ENETUNREACH 128 _N"Network is unreachable")
|
|
| 229 | +(def-unix-error ENETRESET 129 _N"Network dropped connection because of reset")
|
|
| 230 | +(def-unix-error ECONNABORTED 130 _N"Software caused connection abort")
|
|
| 231 | +(def-unix-error ECONNRESET 131 _N"Connection reset by peer")
|
|
| 232 | +(def-unix-error ENOBUFS 132 _N"No buffer space available")
|
|
| 233 | +(def-unix-error EISCONN 133 _N"Transport endpoint is already connected")
|
|
| 234 | +(def-unix-error ENOTCONN 134 _N"Transport endpoint is not connected")
|
|
| 235 | +(def-unix-error ESHUTDOWN 143 _N"Cannot send after socket shutdown")
|
|
| 236 | +(def-unix-error ETOOMANYREFS 144 _N"Too many references: cannot splice")
|
|
| 237 | +(def-unix-error ETIMEDOUT 145 _N"Connection timed out")
|
|
| 238 | +(def-unix-error ECONNREFUSED 146 _N"Connection refused")
|
|
| 239 | +(def-unix-error EHOSTDOWN 147 _N"Host is down")
|
|
| 240 | +(def-unix-error EHOSTUNREACH 148 _N"No route to host")
|
|
| 241 | +(def-unix-error EWOULDBLOCK 11 _N"Resource temporarily unavailable")
|
|
| 242 | +(def-unix-error EALREADY 149 _N"Operation already in progress")
|
|
| 243 | +(def-unix-error EINPROGRESS 150 _N"Operation now in progress")
|
|
| 244 | +(def-unix-error ESTALE 151 _N"Stale NFS file handle")
|
|
| 245 | +)
|
|
| 246 | + |
|
| 247 | +;;; Auto-generated forms, if any.
|
|
| 248 | +EOF
|
|
| 249 | + |
|
| 250 | +# Create appropriate DEF-UNIX-ERROR forms by reading header files
|
|
| 251 | +# containing the C definitions.
|
|
| 252 | +awk '/^#define[ \t]+(E[A-Z0-9]+)[ \t]+([A-Z0-9]+).*$/ {
|
|
| 253 | + printf "(def-unix-error %s %s)\n", $2, $3;
|
|
| 254 | +}' "$@"
|
|
| 255 | + |
|
| 256 | +# The tail was also copied from code/unix.lisp. It's needed to tell
|
|
| 257 | +# Lisp about the errno values.
|
|
| 258 | +cat <<EOF
|
|
| 259 | +;;; End auto-generated forms, if any.
|
|
| 260 | + |
|
| 261 | +;;;
|
|
| 262 | +;;; And now for something completely different ...
|
|
| 263 | +(emit-unix-errors)
|
|
| 264 | +EOF |
| ... | ... | @@ -90,7 +90,8 @@ case `uname -s` in |
| 90 | 90 | ;;
|
| 91 | 91 | esac
|
| 92 | 92 | |
| 93 | -awk -f bin/create-errno.awk ${ERRNO_FILES} > src/code/unix-errno.lisp
|
|
| 93 | +#awk -f bin/create-errno.awk ${ERRNO_FILES} > src/code/unix-errno.lisp
|
|
| 94 | +bin/create-errno.sh ${ERRNO_FILES} > src/code/unix-errno.lisp
|
|
| 94 | 95 | |
| 95 | 96 | echo cross boot = $CROSSBOOT
|
| 96 | 97 | $LISP "$@" -noinit -nositeinit <<EOF
|