aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bits/errno.h13
-rw-r--r--csu/errno-loc.c2
-rw-r--r--csu/errno.c4
-rw-r--r--include/errno.h6
-rw-r--r--stdlib/errno.h12
-rw-r--r--sysdeps/mach/hurd/bits/errno.h459
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c3
-rw-r--r--sysdeps/mach/hurd/errno-loc.c2
-rw-r--r--sysdeps/mach/hurd/errno.c1
-rw-r--r--sysdeps/mach/hurd/errnos.awk107
10 files changed, 175 insertions, 434 deletions
diff --git a/bits/errno.h b/bits/errno.h
index 1118071..48b0834 100644
--- a/bits/errno.h
+++ b/bits/errno.h
@@ -37,14 +37,13 @@
expand to "integer constant expressions with type int, positive
values, and suitable for use in #if directives". Moreover, all of
their names must begin with a capital E, followed immediately by
- either another capital letter, or a digit. It is OK to define
- macros that are not error constants, but only in the implementation
- namespace.
+ either another capital letter, or a digit.
errno.h is sometimes included from assembly language. Therefore,
- when __ASSEMBLER__ is defined, bits/errno.h may only define macros;
- it may not make any other kind of C declaration or definition.
- Also, the error constants should, if at all possible, expand to
- simple decimal or hexadecimal numbers. */
+ bits/errno.h may only define macros; it may not make any other kind
+ of C declaration or definition. Also, the error constants should,
+ if at all possible, expand to simple decimal or hexadecimal
+ numbers. It is OK to define macros that are not error constants,
+ but only in the implementation namespace. */
#endif /* bits/errno.h. */
diff --git a/csu/errno-loc.c b/csu/errno-loc.c
index ddc4e14..3f3e8f0 100644
--- a/csu/errno-loc.c
+++ b/csu/errno-loc.c
@@ -20,7 +20,7 @@
#include <errno.h>
#include <tls.h>
-int *
+__error_t *
__errno_location (void)
{
return &errno;
diff --git a/csu/errno.c b/csu/errno.c
index 8b2e348..ae5b976 100644
--- a/csu/errno.c
+++ b/csu/errno.c
@@ -28,8 +28,8 @@ int rtld_errno attribute_hidden;
#else
-__thread int errno;
-extern __thread int __libc_errno __attribute__ ((alias ("errno")))
+__thread __error_t errno;
+extern __thread __error_t __libc_errno __attribute__ ((alias ("errno")))
attribute_hidden;
#endif
diff --git a/include/errno.h b/include/errno.h
index 3c3d228..da034bd 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -18,7 +18,7 @@
# undef errno
# define errno rtld_errno
-extern int rtld_errno attribute_hidden;
+extern __error_t rtld_errno attribute_hidden;
# elif IS_IN_LIB
@@ -30,13 +30,13 @@ extern int rtld_errno attribute_hidden;
# else
# define errno errno /* For #ifndef errno tests. */
# endif
-extern __thread int errno attribute_tls_model_ie;
+extern __thread __error_t errno attribute_tls_model_ie;
# endif /* IS_IN_LIB */
# define __set_errno(val) (errno = (val))
-extern int *__errno_location (void) __THROW __attribute_const__
+extern __error_t *__errno_location (void) __THROW __attribute_const__
# if RTLD_PRIVATE_ERRNO
attribute_hidden
# endif
diff --git a/stdlib/errno.h b/stdlib/errno.h
index fe08365..c5ba522 100644
--- a/stdlib/errno.h
+++ b/stdlib/errno.h
@@ -33,8 +33,12 @@
__BEGIN_DECLS
+/* This type cues the GDB pretty-printer for errno (errno-printer.py)
+ to show a symbolic name for the error. */
+typedef int __error_t;
+
/* The error code set by various library functions. */
-extern int *__errno_location (void) __THROW __attribute_const__;
+extern __error_t *__errno_location (void) __THROW __attribute_const__;
# define errno (*__errno_location ())
# ifdef __USE_GNU
@@ -45,11 +49,11 @@ extern int *__errno_location (void) __THROW __attribute_const__;
extern char *program_invocation_name;
extern char *program_invocation_short_name;
-/* bits/errno.h may have defined this type. If it didn't, provide a
- fallback definition. */
+/* User namespace version of __error_t. This is used to make the return
+ values of certain GNU extension functions more self-documenting. */
# ifndef __error_t_defined
# define __error_t_defined 1
-typedef int error_t;
+typedef __error_t error_t;
# endif
# endif /* __USE_GNU */
diff --git a/sysdeps/mach/hurd/bits/errno.h b/sysdeps/mach/hurd/bits/errno.h
index f0a11af..655d9c8 100644
--- a/sysdeps/mach/hurd/bits/errno.h
+++ b/sysdeps/mach/hurd/bits/errno.h
@@ -13,323 +13,110 @@
# error "Never include <bits/errno.h> directly; use <errno.h> instead."
#endif
-#ifndef __ASSEMBLER__
-
-enum __error_t_codes
-{
- /* The value zero always means success and it is perfectly fine
- for code to use 0 explicitly (or implicitly, e.g. via Boolean
- coercion.) Having an enum entry for zero both makes the
- debugger print the name for error_t-typed zero values, and
- prevents the compiler from issuing warnings about 'case 0:'
- in a switch on an error_t-typed value. */
- ESUCCESS = 0,
-
- /* The Hurd uses Mach error system 0x10, subsystem 0. */
- EPERM = 0x40000001, /* Operation not permitted */
- ENOENT = 0x40000002, /* No such file or directory */
- ESRCH = 0x40000003, /* No such process */
- EINTR = 0x40000004, /* Interrupted system call */
- EIO = 0x40000005, /* Input/output error */
- ENXIO = 0x40000006, /* No such device or address */
- E2BIG = 0x40000007, /* Argument list too long */
- ENOEXEC = 0x40000008, /* Exec format error */
- EBADF = 0x40000009, /* Bad file descriptor */
- ECHILD = 0x4000000a, /* No child processes */
- EDEADLK = 0x4000000b, /* Resource deadlock avoided */
- ENOMEM = 0x4000000c, /* Cannot allocate memory */
- EACCES = 0x4000000d, /* Permission denied */
- EFAULT = 0x4000000e, /* Bad address */
- ENOTBLK = 0x4000000f, /* Block device required */
- EBUSY = 0x40000010, /* Device or resource busy */
- EEXIST = 0x40000011, /* File exists */
- EXDEV = 0x40000012, /* Invalid cross-device link */
- ENODEV = 0x40000013, /* No such device */
- ENOTDIR = 0x40000014, /* Not a directory */
- EISDIR = 0x40000015, /* Is a directory */
- EINVAL = 0x40000016, /* Invalid argument */
- EMFILE = 0x40000018, /* Too many open files */
- ENFILE = 0x40000017, /* Too many open files in system */
- ENOTTY = 0x40000019, /* Inappropriate ioctl for device */
- ETXTBSY = 0x4000001a, /* Text file busy */
- EFBIG = 0x4000001b, /* File too large */
- ENOSPC = 0x4000001c, /* No space left on device */
- ESPIPE = 0x4000001d, /* Illegal seek */
- EROFS = 0x4000001e, /* Read-only file system */
- EMLINK = 0x4000001f, /* Too many links */
- EPIPE = 0x40000020, /* Broken pipe */
- EDOM = 0x40000021, /* Numerical argument out of domain */
- ERANGE = 0x40000022, /* Numerical result out of range */
- EAGAIN = 0x40000023, /* Resource temporarily unavailable */
- EINPROGRESS = 0x40000024, /* Operation now in progress */
- EALREADY = 0x40000025, /* Operation already in progress */
- ENOTSOCK = 0x40000026, /* Socket operation on non-socket */
- EMSGSIZE = 0x40000028, /* Message too long */
- EPROTOTYPE = 0x40000029, /* Protocol wrong type for socket */
- ENOPROTOOPT = 0x4000002a, /* Protocol not available */
- EPROTONOSUPPORT = 0x4000002b, /* Protocol not supported */
- ESOCKTNOSUPPORT = 0x4000002c, /* Socket type not supported */
- EOPNOTSUPP = 0x4000002d, /* Operation not supported */
- EPFNOSUPPORT = 0x4000002e, /* Protocol family not supported */
- EAFNOSUPPORT = 0x4000002f, /* Address family not supported by protocol */
- EADDRINUSE = 0x40000030, /* Address already in use */
- EADDRNOTAVAIL = 0x40000031, /* Cannot assign requested address */
- ENETDOWN = 0x40000032, /* Network is down */
- ENETUNREACH = 0x40000033, /* Network is unreachable */
- ENETRESET = 0x40000034, /* Network dropped connection on reset */
- ECONNABORTED = 0x40000035, /* Software caused connection abort */
- ECONNRESET = 0x40000036, /* Connection reset by peer */
- ENOBUFS = 0x40000037, /* No buffer space available */
- EISCONN = 0x40000038, /* Transport endpoint is already connected */
- ENOTCONN = 0x40000039, /* Transport endpoint is not connected */
- EDESTADDRREQ = 0x40000027, /* Destination address required */
- ESHUTDOWN = 0x4000003a, /* Cannot send after transport endpoint shutdown */
- ETOOMANYREFS = 0x4000003b, /* Too many references: cannot splice */
- ETIMEDOUT = 0x4000003c, /* Connection timed out */
- ECONNREFUSED = 0x4000003d, /* Connection refused */
- ELOOP = 0x4000003e, /* Too many levels of symbolic links */
- ENAMETOOLONG = 0x4000003f, /* File name too long */
- EHOSTDOWN = 0x40000040, /* Host is down */
- EHOSTUNREACH = 0x40000041, /* No route to host */
- ENOTEMPTY = 0x40000042, /* Directory not empty */
- EPROCLIM = 0x40000043, /* Too many processes */
- EUSERS = 0x40000044, /* Too many users */
- EDQUOT = 0x40000045, /* Disk quota exceeded */
- ESTALE = 0x40000046, /* Stale file handle */
- EREMOTE = 0x40000047, /* Object is remote */
- EBADRPC = 0x40000048, /* RPC struct is bad */
- ERPCMISMATCH = 0x40000049, /* RPC version wrong */
- EPROGUNAVAIL = 0x4000004a, /* RPC program not available */
- EPROGMISMATCH = 0x4000004b, /* RPC program version wrong */
- EPROCUNAVAIL = 0x4000004c, /* RPC bad procedure for program */
- ENOLCK = 0x4000004d, /* No locks available */
- EFTYPE = 0x4000004f, /* Inappropriate file type or format */
- EAUTH = 0x40000050, /* Authentication error */
- ENEEDAUTH = 0x40000051, /* Need authenticator */
- ENOSYS = 0x4000004e, /* Function not implemented */
- ENOTSUP = 0x40000076, /* Not supported */
- EILSEQ = 0x4000006a, /* Invalid or incomplete multibyte or wide character */
- EBACKGROUND = 0x40000064, /* Inappropriate operation for background process */
- EDIED = 0x40000065, /* Translator died */
- ED = 0x40000066, /* ? */
- EGREGIOUS = 0x40000067, /* You really blew it this time */
- EIEIO = 0x40000068, /* Computer bought the farm */
- EGRATUITOUS = 0x40000069, /* Gratuitous error */
- EBADMSG = 0x4000006b, /* Bad message */
- EIDRM = 0x4000006c, /* Identifier removed */
- EMULTIHOP = 0x4000006d, /* Multihop attempted */
- ENODATA = 0x4000006e, /* No data available */
- ENOLINK = 0x4000006f, /* Link has been severed */
- ENOMSG = 0x40000070, /* No message of desired type */
- ENOSR = 0x40000071, /* Out of streams resources */
- ENOSTR = 0x40000072, /* Device not a stream */
- EOVERFLOW = 0x40000073, /* Value too large for defined data type */
- EPROTO = 0x40000074, /* Protocol error */
- ETIME = 0x40000075, /* Timer expired */
- ECANCELED = 0x40000077, /* Operation canceled */
-
-/* Errors from <mach/message.h>. */
- EMACH_SEND_IN_PROGRESS = 0x10000001,
- EMACH_SEND_INVALID_DATA = 0x10000002,
- EMACH_SEND_INVALID_DEST = 0x10000003,
- EMACH_SEND_TIMED_OUT = 0x10000004,
- EMACH_SEND_WILL_NOTIFY = 0x10000005,
- EMACH_SEND_NOTIFY_IN_PROGRESS = 0x10000006,
- EMACH_SEND_INTERRUPTED = 0x10000007,
- EMACH_SEND_MSG_TOO_SMALL = 0x10000008,
- EMACH_SEND_INVALID_REPLY = 0x10000009,
- EMACH_SEND_INVALID_RIGHT = 0x1000000a,
- EMACH_SEND_INVALID_NOTIFY = 0x1000000b,
- EMACH_SEND_INVALID_MEMORY = 0x1000000c,
- EMACH_SEND_NO_BUFFER = 0x1000000d,
- EMACH_SEND_NO_NOTIFY = 0x1000000e,
- EMACH_SEND_INVALID_TYPE = 0x1000000f,
- EMACH_SEND_INVALID_HEADER = 0x10000010,
- EMACH_RCV_IN_PROGRESS = 0x10004001,
- EMACH_RCV_INVALID_NAME = 0x10004002,
- EMACH_RCV_TIMED_OUT = 0x10004003,
- EMACH_RCV_TOO_LARGE = 0x10004004,
- EMACH_RCV_INTERRUPTED = 0x10004005,
- EMACH_RCV_PORT_CHANGED = 0x10004006,
- EMACH_RCV_INVALID_NOTIFY = 0x10004007,
- EMACH_RCV_INVALID_DATA = 0x10004008,
- EMACH_RCV_PORT_DIED = 0x10004009,
- EMACH_RCV_IN_SET = 0x1000400a,
- EMACH_RCV_HEADER_ERROR = 0x1000400b,
- EMACH_RCV_BODY_ERROR = 0x1000400c,
-
-/* Errors from <mach/kern_return.h>. */
- EKERN_INVALID_ADDRESS = 1,
- EKERN_PROTECTION_FAILURE = 2,
- EKERN_NO_SPACE = 3,
- EKERN_INVALID_ARGUMENT = 4,
- EKERN_FAILURE = 5,
- EKERN_RESOURCE_SHORTAGE = 6,
- EKERN_NOT_RECEIVER = 7,
- EKERN_NO_ACCESS = 8,
- EKERN_MEMORY_FAILURE = 9,
- EKERN_MEMORY_ERROR = 10,
- EKERN_NOT_IN_SET = 12,
- EKERN_NAME_EXISTS = 13,
- EKERN_ABORTED = 14,
- EKERN_INVALID_NAME = 15,
- EKERN_INVALID_TASK = 16,
- EKERN_INVALID_RIGHT = 17,
- EKERN_INVALID_VALUE = 18,
- EKERN_UREFS_OVERFLOW = 19,
- EKERN_INVALID_CAPABILITY = 20,
- EKERN_RIGHT_EXISTS = 21,
- EKERN_INVALID_HOST = 22,
- EKERN_MEMORY_PRESENT = 23,
- EKERN_WRITE_PROTECTION_FAILURE = 24,
- EKERN_TERMINATED = 26,
- EKERN_TIMEDOUT = 27,
- EKERN_INTERRUPTED = 28,
-
-/* Errors from <mach/mig_errors.h>. */
- EMIG_TYPE_ERROR = -300, /* client type check failure */
- EMIG_REPLY_MISMATCH = -301, /* wrong reply message ID */
- EMIG_REMOTE_ERROR = -302, /* server detected error */
- EMIG_BAD_ID = -303, /* bad request message ID */
- EMIG_BAD_ARGUMENTS = -304, /* server type check failure */
- EMIG_NO_REPLY = -305, /* no reply should be sent */
- EMIG_EXCEPTION = -306, /* server raised exception */
- EMIG_ARRAY_TOO_LARGE = -307, /* array not large enough */
- EMIG_SERVER_DIED = -308, /* server died */
- EMIG_DESTROY_REQUEST = -309, /* destroy request with no reply */
-
-/* Errors from <device/device_types.h>. */
- ED_IO_ERROR = 2500, /* hardware IO error */
- ED_WOULD_BLOCK = 2501, /* would block, but D_NOWAIT set */
- ED_NO_SUCH_DEVICE = 2502, /* no such device */
- ED_ALREADY_OPEN = 2503, /* exclusive-use device already open */
- ED_DEVICE_DOWN = 2504, /* device has been shut down */
- ED_INVALID_OPERATION = 2505, /* bad operation for device */
- ED_INVALID_RECNUM = 2506, /* invalid record (block) number */
- ED_INVALID_SIZE = 2507, /* invalid IO size */
- ED_NO_MEMORY = 2508, /* memory allocation failure */
- ED_READ_ONLY = 2509, /* device cannot be written to */
-
- /* Because the C standard requires that errno have type 'int',
- this enumeration must be a signed type. */
- __FORCE_ERROR_T_CODES_SIGNED = -1
-};
-
-/* User-visible type of error codes. It is ok to use 'int' or
- 'kern_return_t' for these, but with 'error_t' the debugger prints
- symbolic values. */
-# if !defined __error_t_defined && defined __USE_GNU
-# define __error_t_defined 1
-typedef enum __error_t_codes error_t;
-# endif
-
-#endif /* not __ASSEMBLER__ */
-
-/* The C standard requires that all of the E-constants be
- defined as macros. */
-
-#define EPERM 0x40000001
-#define ENOENT 0x40000002
-#define ESRCH 0x40000003
-#define EINTR 0x40000004
-#define EIO 0x40000005
-#define ENXIO 0x40000006
-#define E2BIG 0x40000007
-#define ENOEXEC 0x40000008
-#define EBADF 0x40000009
-#define ECHILD 0x4000000a
-#define EDEADLK 0x4000000b
-#define ENOMEM 0x4000000c
-#define EACCES 0x4000000d
-#define EFAULT 0x4000000e
-#define ENOTBLK 0x4000000f
-#define EBUSY 0x40000010
-#define EEXIST 0x40000011
-#define EXDEV 0x40000012
-#define ENODEV 0x40000013
-#define ENOTDIR 0x40000014
-#define EISDIR 0x40000015
-#define EINVAL 0x40000016
-#define EMFILE 0x40000018
-#define ENFILE 0x40000017
-#define ENOTTY 0x40000019
-#define ETXTBSY 0x4000001a
-#define EFBIG 0x4000001b
-#define ENOSPC 0x4000001c
-#define ESPIPE 0x4000001d
-#define EROFS 0x4000001e
-#define EMLINK 0x4000001f
-#define EPIPE 0x40000020
-#define EDOM 0x40000021
-#define ERANGE 0x40000022
-#define EAGAIN 0x40000023
+/* The Hurd uses Mach error system 0x10, subsystem 0. */
+
+#define EPERM 0x40000001 /* Operation not permitted */
+#define ENOENT 0x40000002 /* No such file or directory */
+#define ESRCH 0x40000003 /* No such process */
+#define EINTR 0x40000004 /* Interrupted system call */
+#define EIO 0x40000005 /* Input/output error */
+#define ENXIO 0x40000006 /* No such device or address */
+#define E2BIG 0x40000007 /* Argument list too long */
+#define ENOEXEC 0x40000008 /* Exec format error */
+#define EBADF 0x40000009 /* Bad file descriptor */
+#define ECHILD 0x4000000a /* No child processes */
+#define EDEADLK 0x4000000b /* Resource deadlock avoided */
+#define ENOMEM 0x4000000c /* Cannot allocate memory */
+#define EACCES 0x4000000d /* Permission denied */
+#define EFAULT 0x4000000e /* Bad address */
+#define ENOTBLK 0x4000000f /* Block device required */
+#define EBUSY 0x40000010 /* Device or resource busy */
+#define EEXIST 0x40000011 /* File exists */
+#define EXDEV 0x40000012 /* Invalid cross-device link */
+#define ENODEV 0x40000013 /* No such device */
+#define ENOTDIR 0x40000014 /* Not a directory */
+#define EISDIR 0x40000015 /* Is a directory */
+#define EINVAL 0x40000016 /* Invalid argument */
+#define EMFILE 0x40000018 /* Too many open files */
+#define ENFILE 0x40000017 /* Too many open files in system */
+#define ENOTTY 0x40000019 /* Inappropriate ioctl for device */
+#define ETXTBSY 0x4000001a /* Text file busy */
+#define EFBIG 0x4000001b /* File too large */
+#define ENOSPC 0x4000001c /* No space left on device */
+#define ESPIPE 0x4000001d /* Illegal seek */
+#define EROFS 0x4000001e /* Read-only file system */
+#define EMLINK 0x4000001f /* Too many links */
+#define EPIPE 0x40000020 /* Broken pipe */
+#define EDOM 0x40000021 /* Numerical argument out of domain */
+#define ERANGE 0x40000022 /* Numerical result out of range */
+#define EAGAIN 0x40000023 /* Resource temporarily unavailable */
#define EWOULDBLOCK EAGAIN
-#define EINPROGRESS 0x40000024
-#define EALREADY 0x40000025
-#define ENOTSOCK 0x40000026
-#define EMSGSIZE 0x40000028
-#define EPROTOTYPE 0x40000029
-#define ENOPROTOOPT 0x4000002a
-#define EPROTONOSUPPORT 0x4000002b
-#define ESOCKTNOSUPPORT 0x4000002c
-#define EOPNOTSUPP 0x4000002d
-#define EPFNOSUPPORT 0x4000002e
-#define EAFNOSUPPORT 0x4000002f
-#define EADDRINUSE 0x40000030
-#define EADDRNOTAVAIL 0x40000031
-#define ENETDOWN 0x40000032
-#define ENETUNREACH 0x40000033
-#define ENETRESET 0x40000034
-#define ECONNABORTED 0x40000035
-#define ECONNRESET 0x40000036
-#define ENOBUFS 0x40000037
-#define EISCONN 0x40000038
-#define ENOTCONN 0x40000039
-#define EDESTADDRREQ 0x40000027
-#define ESHUTDOWN 0x4000003a
-#define ETOOMANYREFS 0x4000003b
-#define ETIMEDOUT 0x4000003c
-#define ECONNREFUSED 0x4000003d
-#define ELOOP 0x4000003e
-#define ENAMETOOLONG 0x4000003f
-#define EHOSTDOWN 0x40000040
-#define EHOSTUNREACH 0x40000041
-#define ENOTEMPTY 0x40000042
-#define EPROCLIM 0x40000043
-#define EUSERS 0x40000044
-#define EDQUOT 0x40000045
-#define ESTALE 0x40000046
-#define EREMOTE 0x40000047
-#define EBADRPC 0x40000048
-#define ERPCMISMATCH 0x40000049
-#define EPROGUNAVAIL 0x4000004a
-#define EPROGMISMATCH 0x4000004b
-#define EPROCUNAVAIL 0x4000004c
-#define ENOLCK 0x4000004d
-#define EFTYPE 0x4000004f
-#define EAUTH 0x40000050
-#define ENEEDAUTH 0x40000051
-#define ENOSYS 0x4000004e
-#define ENOTSUP 0x40000076
-#define EILSEQ 0x4000006a
-#define EBACKGROUND 0x40000064
-#define EDIED 0x40000065
-#define ED 0x40000066
-#define EGREGIOUS 0x40000067
-#define EIEIO 0x40000068
-#define EGRATUITOUS 0x40000069
-#define EBADMSG 0x4000006b
-#define EIDRM 0x4000006c
-#define EMULTIHOP 0x4000006d
-#define ENODATA 0x4000006e
-#define ENOLINK 0x4000006f
-#define ENOMSG 0x40000070
-#define ENOSR 0x40000071
-#define ENOSTR 0x40000072
-#define EOVERFLOW 0x40000073
-#define EPROTO 0x40000074
-#define ETIME 0x40000075
-#define ECANCELED 0x40000077
+#define EINPROGRESS 0x40000024 /* Operation now in progress */
+#define EALREADY 0x40000025 /* Operation already in progress */
+#define ENOTSOCK 0x40000026 /* Socket operation on non-socket */
+#define EMSGSIZE 0x40000028 /* Message too long */
+#define EPROTOTYPE 0x40000029 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 0x4000002a /* Protocol not available */
+#define EPROTONOSUPPORT 0x4000002b /* Protocol not supported */
+#define ESOCKTNOSUPPORT 0x4000002c /* Socket type not supported */
+#define EOPNOTSUPP 0x4000002d /* Operation not supported */
+#define EPFNOSUPPORT 0x4000002e /* Protocol family not supported */
+#define EAFNOSUPPORT 0x4000002f /* Address family not supported by protocol */
+#define EADDRINUSE 0x40000030 /* Address already in use */
+#define EADDRNOTAVAIL 0x40000031 /* Cannot assign requested address */
+#define ENETDOWN 0x40000032 /* Network is down */
+#define ENETUNREACH 0x40000033 /* Network is unreachable */
+#define ENETRESET 0x40000034 /* Network dropped connection on reset */
+#define ECONNABORTED 0x40000035 /* Software caused connection abort */
+#define ECONNRESET 0x40000036 /* Connection reset by peer */
+#define ENOBUFS 0x40000037 /* No buffer space available */
+#define EISCONN 0x40000038 /* Transport endpoint is already connected */
+#define ENOTCONN 0x40000039 /* Transport endpoint is not connected */
+#define EDESTADDRREQ 0x40000027 /* Destination address required */
+#define ESHUTDOWN 0x4000003a /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 0x4000003b /* Too many references: cannot splice */
+#define ETIMEDOUT 0x4000003c /* Connection timed out */
+#define ECONNREFUSED 0x4000003d /* Connection refused */
+#define ELOOP 0x4000003e /* Too many levels of symbolic links */
+#define ENAMETOOLONG 0x4000003f /* File name too long */
+#define EHOSTDOWN 0x40000040 /* Host is down */
+#define EHOSTUNREACH 0x40000041 /* No route to host */
+#define ENOTEMPTY 0x40000042 /* Directory not empty */
+#define EPROCLIM 0x40000043 /* Too many processes */
+#define EUSERS 0x40000044 /* Too many users */
+#define EDQUOT 0x40000045 /* Disk quota exceeded */
+#define ESTALE 0x40000046 /* Stale file handle */
+#define EREMOTE 0x40000047 /* Object is remote */
+#define EBADRPC 0x40000048 /* RPC struct is bad */
+#define ERPCMISMATCH 0x40000049 /* RPC version wrong */
+#define EPROGUNAVAIL 0x4000004a /* RPC program not available */
+#define EPROGMISMATCH 0x4000004b /* RPC program version wrong */
+#define EPROCUNAVAIL 0x4000004c /* RPC bad procedure for program */
+#define ENOLCK 0x4000004d /* No locks available */
+#define EFTYPE 0x4000004f /* Inappropriate file type or format */
+#define EAUTH 0x40000050 /* Authentication error */
+#define ENEEDAUTH 0x40000051 /* Need authenticator */
+#define ENOSYS 0x4000004e /* Function not implemented */
+#define ENOTSUP 0x40000076 /* Not supported */
+#define EILSEQ 0x4000006a /* Invalid or incomplete multibyte or wide character */
+#define EBACKGROUND 0x40000064 /* Inappropriate operation for background process */
+#define EDIED 0x40000065 /* Translator died */
+#define ED 0x40000066 /* ? */
+#define EGREGIOUS 0x40000067 /* You really blew it this time */
+#define EIEIO 0x40000068 /* Computer bought the farm */
+#define EGRATUITOUS 0x40000069 /* Gratuitous error */
+#define EBADMSG 0x4000006b /* Bad message */
+#define EIDRM 0x4000006c /* Identifier removed */
+#define EMULTIHOP 0x4000006d /* Multihop attempted */
+#define ENODATA 0x4000006e /* No data available */
+#define ENOLINK 0x4000006f /* Link has been severed */
+#define ENOMSG 0x40000070 /* No message of desired type */
+#define ENOSR 0x40000071 /* Out of streams resources */
+#define ENOSTR 0x40000072 /* Device not a stream */
+#define EOVERFLOW 0x40000073 /* Value too large for defined data type */
+#define EPROTO 0x40000074 /* Protocol error */
+#define ETIME 0x40000075 /* Timer expired */
+#define ECANCELED 0x40000077 /* Operation canceled */
/* Errors from <mach/message.h>. */
#define EMACH_SEND_IN_PROGRESS 0x10000001
@@ -390,28 +177,28 @@ typedef enum __error_t_codes error_t;
#define EKERN_INTERRUPTED 28
/* Errors from <mach/mig_errors.h>. */
-#define EMIG_TYPE_ERROR -300
-#define EMIG_REPLY_MISMATCH -301
-#define EMIG_REMOTE_ERROR -302
-#define EMIG_BAD_ID -303
-#define EMIG_BAD_ARGUMENTS -304
-#define EMIG_NO_REPLY -305
-#define EMIG_EXCEPTION -306
-#define EMIG_ARRAY_TOO_LARGE -307
-#define EMIG_SERVER_DIED -308
-#define EMIG_DESTROY_REQUEST -309
+#define EMIG_TYPE_ERROR -300 /* client type check failure */
+#define EMIG_REPLY_MISMATCH -301 /* wrong reply message ID */
+#define EMIG_REMOTE_ERROR -302 /* server detected error */
+#define EMIG_BAD_ID -303 /* bad request message ID */
+#define EMIG_BAD_ARGUMENTS -304 /* server type check failure */
+#define EMIG_NO_REPLY -305 /* no reply should be sent */
+#define EMIG_EXCEPTION -306 /* server raised exception */
+#define EMIG_ARRAY_TOO_LARGE -307 /* array not large enough */
+#define EMIG_SERVER_DIED -308 /* server died */
+#define EMIG_DESTROY_REQUEST -309 /* destroy request with no reply */
/* Errors from <device/device_types.h>. */
-#define ED_IO_ERROR 2500
-#define ED_WOULD_BLOCK 2501
-#define ED_NO_SUCH_DEVICE 2502
-#define ED_ALREADY_OPEN 2503
-#define ED_DEVICE_DOWN 2504
-#define ED_INVALID_OPERATION 2505
-#define ED_INVALID_RECNUM 2506
-#define ED_INVALID_SIZE 2507
-#define ED_NO_MEMORY 2508
-#define ED_READ_ONLY 2509
+#define ED_IO_ERROR 2500 /* hardware IO error */
+#define ED_WOULD_BLOCK 2501 /* would block, but D_NOWAIT set */
+#define ED_NO_SUCH_DEVICE 2502 /* no such device */
+#define ED_ALREADY_OPEN 2503 /* exclusive-use device already open */
+#define ED_DEVICE_DOWN 2504 /* device has been shut down */
+#define ED_INVALID_OPERATION 2505 /* bad operation for device */
+#define ED_INVALID_RECNUM 2506 /* invalid record (block) number */
+#define ED_INVALID_SIZE 2507 /* invalid IO size */
+#define ED_NO_MEMORY 2508 /* memory allocation failure */
+#define ED_READ_ONLY 2509 /* device cannot be written to */
#define _HURD_ERRNOS 120
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 4f274b4..94be85e 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -23,6 +23,7 @@
#include <hurd.h>
#include <link.h>
#include <unistd.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/mman.h>
@@ -69,7 +70,7 @@ struct hurd_startup_data *_dl_hurd_data;
/* This is used only within ld.so, via dl-minimal.c's __errno_location. */
#undef errno
-int errno attribute_hidden;
+__error_t errno attribute_hidden;
/* Defining these variables here avoids the inclusion of hurdsig.c. */
unsigned long int __hurd_sigthread_stack_base;
diff --git a/sysdeps/mach/hurd/errno-loc.c b/sysdeps/mach/hurd/errno-loc.c
index 039c9fc..0a9eae1 100644
--- a/sysdeps/mach/hurd/errno-loc.c
+++ b/sysdeps/mach/hurd/errno-loc.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include <hurd/threadvar.h>
-int *
+__error_t *
__errno_location (void)
{
return (int *) __hurd_threadvar_location (_HURD_THREADVAR_ERRNO);
diff --git a/sysdeps/mach/hurd/errno.c b/sysdeps/mach/hurd/errno.c
deleted file mode 100644
index a29091b..0000000
--- a/sysdeps/mach/hurd/errno.c
+++ /dev/null
@@ -1 +0,0 @@
-/* No definition of `errno' variable on the Hurd. */
diff --git a/sysdeps/mach/hurd/errnos.awk b/sysdeps/mach/hurd/errnos.awk
index 1fdca40..c5d33b5 100644
--- a/sysdeps/mach/hurd/errnos.awk
+++ b/sysdeps/mach/hurd/errnos.awk
@@ -15,31 +15,18 @@
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
-# errno.texinfo contains lines like:
-# @errno{ENOSYS, 123, Function not implemented}
+# Generate bits/errno.h from errnos.texi and a number of Mach headers.
+# This script must be kept in sync with stdlib/make-errno-constants.awk
+# and hurd-add-errno-constants.awk.
BEGIN {
- print "/* This file generated by errnos.awk from";
- for (i = 1; i < ARGC; i++)
- {
- arg = ARGV[i];
- sub(/.*(manual|include)\//, "", arg)
- print " " arg;
- }
- print " Do not edit this file; edit errnos.awk and regenerate it. */";
- print "";
- print "#ifndef _BITS_ERRNO_H";
- print "#define _BITS_ERRNO_H 1";
- print "";
- print "#if !defined _ERRNO_H";
- print "# error \"Never include <bits/errno.h> directly; use <errno.h> instead.\"";
- print "#endif";
-
- maxerrno = 0;
- maxerrlen = 0;
- in_mach_errors = "";
- seq = 0;
- }
+ maxerrno = 0;
+ maxerrlen = 0;
+ in_mach_errors = "";
+ in_mig_errors = 0;
+ in_device_errors = 0;
+ seq = 0;
+}
/^@errno\{/ \
{
@@ -147,73 +134,37 @@ in_device_errors && $1 == "#endif" \
in_device_errors = 0;
}
-function print_errno_enum(maxseq)
-{
- print "";
- print "#ifndef __ASSEMBLER__";
- print "";
- print "enum __error_t_codes";
- print "{";
- print " /* The value zero always means success and it is perfectly fine";
- print " for code to use 0 explicitly (or implicitly, e.g. via Boolean";
- print " coercion.) Having an enum entry for zero both makes the";
- print " debugger print the name for error_t-typed zero values, and";
- print " prevents the compiler from issuing warnings about 'case 0:'";
- print " in a switch on an error_t-typed value. */";
- printf(" %-*s = 0,\n", maxerrlen, "ESUCCESS");
-
- print "";
- print " /* The Hurd uses Mach error system 0x10, subsystem 0. */";
- for (i = 0; i < maxseq; i++)
+END {
+ print "/* This file generated by errnos.awk from";
+ for (i = 1; i < ARGC; i++)
{
- if (i in annot)
- print annot[i];
- else if (i in etexts && etexts[i] != "")
- printf(" %-*s = %s,\t/* %s */\n",
- maxerrlen, econsts[i], errnos[i], etexts[i]);
- else if (errnos[i] != "EAGAIN")
- printf(" %-*s = %s,\n", maxerrlen, econsts[i], errnos[i]);
+ arg = ARGV[i];
+ sub(/.*(manual|include)\//, "", arg)
+ print " " arg;
}
-
- print "";
- print " /* Because the C standard requires that errno have type 'int',"
- print " this enumeration must be a signed type. */";
- print " __FORCE_ERROR_T_CODES_SIGNED = -1";
- print "};";
+ print " Do not edit this file; edit errnos.awk and regenerate it. */";
print "";
- print "/* User-visible type of error codes. It is ok to use 'int' or";
- print " 'kern_return_t' for these, but with 'error_t' the debugger prints";
- print " symbolic values. */";
- print "# if !defined __error_t_defined && defined __USE_GNU";
- print "# define __error_t_defined 1";
- print "typedef enum __error_t_codes error_t;"
- print "# endif";
+ print "#ifndef _BITS_ERRNO_H";
+ print "#define _BITS_ERRNO_H 1";
print "";
- print "#endif /* not __ASSEMBLER__ */";
-}
-
-function print_errno_defines(maxseq)
-{
+ print "#if !defined _ERRNO_H";
+ print "# error \"Never include <bits/errno.h> directly; use <errno.h> instead.\"";
+ print "#endif";
print "";
- print "/* The C standard requires that all of the E-constants be"
- print " defined as macros. */"
+ print "/* The Hurd uses Mach error system 0x10, subsystem 0. */";
print "";
- for (i = 0; i < maxseq; i++)
+ for (i = 0; i < seq; i++)
{
if (i in annot)
print annot[i];
+ else if (i in etexts && etexts[i] != "")
+ printf("#define %-*s %s\t/* %s */\n",
+ maxerrlen, econsts[i], errnos[i], etexts[i]);
else
printf("#define %-*s %s\n", maxerrlen, econsts[i], errnos[i]);
}
print "";
printf("#define _HURD_ERRNOS %d\n", maxerrno+1);
+ print "";
+ print "#endif /* bits/errno.h. */";
}
-
-END \
- {
- print_errno_enum(seq);
- print_errno_defines(seq);
-
- print "";
- print "#endif /* bits/errno.h. */";
- }