From d69c1d7983b3c3583b27b3eb5cac085c8fc119f1 Mon Sep 17 00:00:00 2001 From: David Reid Date: Thu, 11 Jul 2002 20:39:30 +0000 Subject: [PATCH] Move errno.h to it's correct place Adjust Errors.h to use errno.h for the posix error codes add first stab at limits.h, albeit not using the gcc headers at present for intel. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@88 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/support/Errors.h | 80 ++------------------ headers/{private/kernel => posix}/errno.h | 15 ++-- headers/posix/limits.h | 90 +++++++++++++++++++++++ headers/private/net/protocols.h | 48 ++++++++++++ 4 files changed, 148 insertions(+), 85 deletions(-) rename headers/{private/kernel => posix}/errno.h (88%) mode change 100755 => 100644 create mode 100644 headers/posix/limits.h create mode 100644 headers/private/net/protocols.h diff --git a/headers/os/support/Errors.h b/headers/os/support/Errors.h index 7091343bfa..7b57ee2508 100644 --- a/headers/os/support/Errors.h +++ b/headers/os/support/Errors.h @@ -1,6 +1,9 @@ #ifndef _ERRORS_H #define _ERRORS_H +/* POSIX error codes are now all contained within errno.h */ + +#include #include /*-------------------------------------------------------------*/ @@ -14,7 +17,7 @@ #define B_TRANSLATION_ERROR_BASE B_GENERAL_ERROR_BASE + 0x4800 #define B_MIDI_ERROR_BASE B_GENERAL_ERROR_BASE + 0x5000 #define B_STORAGE_ERROR_BASE B_GENERAL_ERROR_BASE + 0x6000 -#define B_POSIX_ERROR_BASE B_GENERAL_ERROR_BASE + 0x7000 +//#define B_POSIX_ERROR_BASE B_GENERAL_ERROR_BASE + 0x7000 #define B_MAIL_ERROR_BASE B_GENERAL_ERROR_BASE + 0x8000 #define B_PRINT_ERROR_BASE B_GENERAL_ERROR_BASE + 0x9000 #define B_DEVICE_ERROR_BASE B_GENERAL_ERROR_BASE + 0xa000 @@ -24,6 +27,7 @@ #define B_ERRORS_END (B_GENERAL_ERROR_BASE + 0xffff) + /*-------------------------------------------------------------*/ /*----- General Errors ----------------------------------------*/ enum { @@ -119,80 +123,6 @@ enum { B_PARTITION_TOO_SMALL }; - -/*-------------------------------------------------------------*/ -/*----- POSIX Errors ------------------------------------------*/ -#define E2BIG (B_POSIX_ERROR_BASE + 1) -#define ECHILD (B_POSIX_ERROR_BASE + 2) -#define EDEADLK (B_POSIX_ERROR_BASE + 3) -#define EFBIG (B_POSIX_ERROR_BASE + 4) -#define EMLINK (B_POSIX_ERROR_BASE + 5) -#define ENFILE (B_POSIX_ERROR_BASE + 6) -#define ENODEV (B_POSIX_ERROR_BASE + 7) -#define ENOLCK (B_POSIX_ERROR_BASE + 8) -#define ENOSYS (B_POSIX_ERROR_BASE + 9) -#define ENOTTY (B_POSIX_ERROR_BASE + 10) -#define ENXIO (B_POSIX_ERROR_BASE + 11) -#define ESPIPE (B_POSIX_ERROR_BASE + 12) -#define ESRCH (B_POSIX_ERROR_BASE + 13) -#define EFPOS (B_POSIX_ERROR_BASE + 14) -#define ESIGPARM (B_POSIX_ERROR_BASE + 15) -#define EDOM (B_POSIX_ERROR_BASE + 16) -#define ERANGE (B_POSIX_ERROR_BASE + 17) -#define EPROTOTYPE (B_POSIX_ERROR_BASE + 18) -#define EPROTONOSUPPORT (B_POSIX_ERROR_BASE + 19) -#define EPFNOSUPPORT (B_POSIX_ERROR_BASE + 20) -#define EAFNOSUPPORT (B_POSIX_ERROR_BASE + 21) -#define EADDRINUSE (B_POSIX_ERROR_BASE + 22) -#define EADDRNOTAVAIL (B_POSIX_ERROR_BASE + 23) -#define ENETDOWN (B_POSIX_ERROR_BASE + 24) -#define ENETUNREACH (B_POSIX_ERROR_BASE + 25) -#define ENETRESET (B_POSIX_ERROR_BASE + 26) -#define ECONNABORTED (B_POSIX_ERROR_BASE + 27) -#define ECONNRESET (B_POSIX_ERROR_BASE + 28) -#define EISCONN (B_POSIX_ERROR_BASE + 29) -#define ENOTCONN (B_POSIX_ERROR_BASE + 30) -#define ESHUTDOWN (B_POSIX_ERROR_BASE + 31) -#define ECONNREFUSED (B_POSIX_ERROR_BASE + 32) -#define EHOSTUNREACH (B_POSIX_ERROR_BASE + 33) -#define ENOPROTOOPT (B_POSIX_ERROR_BASE + 34) -#define ENOBUFS (B_POSIX_ERROR_BASE + 35) -#define EINPROGRESS (B_POSIX_ERROR_BASE + 36) -#define EALREADY (B_POSIX_ERROR_BASE + 37) -#define EILSEQ (B_POSIX_ERROR_BASE + 38) -#define ENOMSG (B_POSIX_ERROR_BASE + 39) -#define ESTALE (B_POSIX_ERROR_BASE + 40) -#define EOVERFLOW (B_POSIX_ERROR_BASE + 41) -#define EMSGSIZE (B_POSIX_ERROR_BASE + 42) -#define EOPNOTSUPP (B_POSIX_ERROR_BASE + 43) -#define ENOTSOCK (B_POSIX_ERROR_BASE + 44) - -#define ENOMEM B_NO_MEMORY -#define EACCES B_PERMISSION_DENIED -#define EINTR B_INTERRUPTED -#define EIO B_IO_ERROR -#define EBUSY B_BUSY -#define EFAULT B_BAD_ADDRESS -#define ETIMEDOUT B_TIMED_OUT -#define EAGAIN B_WOULD_BLOCK /* SysV compatibility */ -#define EWOULDBLOCK B_WOULD_BLOCK /* BSD compatibility */ -#define EBADF B_FILE_ERROR -#define EEXIST B_FILE_EXISTS -#define EINVAL B_BAD_VALUE -#define ENAMETOOLONG B_NAME_TOO_LONG -#define ENOENT B_ENTRY_NOT_FOUND -#define EPERM B_NOT_ALLOWED -#define ENOTDIR B_NOT_A_DIRECTORY -#define EISDIR B_IS_A_DIRECTORY -#define ENOTEMPTY B_DIRECTORY_NOT_EMPTY -#define ENOSPC B_DEVICE_FULL -#define EROFS B_READ_ONLY_DEVICE -#define EMFILE B_NO_MORE_FDS -#define EXDEV B_CROSS_DEVICE_LINK -#define ELOOP B_LINK_LIMIT -#define ENOEXEC B_NOT_AN_EXECUTABLE -#define EPIPE B_BUSTED_PIPE - /*-------------------------------------------------------------*/ /*----- Media Kit Errors --------------------------------------*/ enum { diff --git a/headers/private/kernel/errno.h b/headers/posix/errno.h old mode 100755 new mode 100644 similarity index 88% rename from headers/private/kernel/errno.h rename to headers/posix/errno.h index 351557a8a5..890e570f27 --- a/headers/private/kernel/errno.h +++ b/headers/posix/errno.h @@ -13,14 +13,7 @@ extern "C" { #endif -/* XXX - this really belongs in limits.h, but as we don't have one - * yet it's here so we can build. - * XXX - move me! - */ -/* Minimum's */ -#ifndef LONG_MIN -#define LONG_MIN (-2147483647L-1) -#endif +#include /* XXX - Fix this once TLS works */ extern int errno; @@ -32,7 +25,7 @@ extern int errno; /* The basic error codes that don't have a B_ equivalent * - * NB when adding codes make sure that the Be Errors.h didn't + * NB when adding codes make sure that support/Errors.h didn't * define a value or it needs to go in the bottom section and * have an identical value assigned. * NB new values just go on the bottom. @@ -99,7 +92,8 @@ enum { EPROTO, EPROTOOPT, ETIME, - EFTYPE + EFTYPE, /* +60 */ + ETOOMANYREFS }; /* @@ -140,6 +134,7 @@ enum { EPIPE }; +/* An odd ball! */ #define ENOEXEC LONG_MIN + 0x1302 #ifdef __cplusplus diff --git a/headers/posix/limits.h b/headers/posix/limits.h new file mode 100644 index 0000000000..ebab8d0a44 --- /dev/null +++ b/headers/posix/limits.h @@ -0,0 +1,90 @@ +#ifndef _LIMITS_H_ +#define _LIMITS_H_ + +#include /* for DBL_DIG, FLT_DIG, etc */ + +/* XXX - commented out until we have GCC headers as this stops us + * building + * For now we'll just use the values given for non-intel platforms. + */ + +/* _GCC_LIMITS_H_ is defined by GCC's internal limits.h to avoid + * collisions with any defines in this file. + */ +/* +#if __INTEL__ +# ifndef _GCC_LIMITS_H_ +# include_next +# endif +#else +*/ +#define CHAR_BIT (8) + +#define SCHAR_MIN (-127-1) +#define SCHAR_MAX (127) + +#define UCHAR_MAX (255U) + +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX + +#define MB_LEN_MAX (1) + +#define SHRT_MIN (-32767-1) +#define SHRT_MAX (32767) + +#define USHRT_MAX (65535U) + +#define LONG_MIN (-2147483647L-1) +#define LONG_MAX (2147483647L) + +#define ULONG_MAX (4294967295U) + +#define INT_MIN LONG_MIN +#define INT_MAX LONG_MAX +#define UINT_MAX ULONG_MAX + +//#endif /* else not INTEL */ + +#define LONGLONG_MIN (-9223372036854775807LL - 1) /* these are Be specific */ +#define LONGLONG_MAX (9223372036854775807LL) +#define ULONGLONG_MAX (0xffffffffffffffffULL) + +/* These are various BeOS implementation limits */ + +#define ARG_MAX (32768) +#define ATEXIT_MAX (32) /* XXXdbg */ +#define CHILD_MAX (1024) +#define IOV_MAX (256) /* really there is no limit */ +#define FILESIZEBITS (64) +#define LINK_MAX (1) +#define LOGIN_NAME_MAX (32) /* XXXdbg */ +#define MAX_CANON (255) +#define MAX_INPUT (255) +#define NAME_MAX (256) +#define NGROUPS_MAX (32) +#define OPEN_MAX (128) +#define PATH_MAX (1024) +#define PIPE_MAX (512) +#define SSIZE_MAX (2147483647L) +#define TTY_NAME_MAX (256) +#define TZNAME_MAX (32) +#define SYMLINKS_MAX (16) + +#define _POSIX_ARG_MAX (32768) +#define _POSIX_CHILD_MAX (1024) +#define _POSIX_LINK_MAX (1) +#define _POSIX_LOGIN_NAME_MAX (9) /* XXXdbg */ +#define _POSIX_MAX_CANON (255) +#define _POSIX_MAX_INPUT (255) +#define _POSIX_NAME_MAX (255) +#define _POSIX_NGROUPS_MAX (0) +#define _POSIX_OPEN_MAX (128) +#define _POSIX_PATH_MAX (1024) +#define _POSIX_PIPE_BUF (512) +#define _POSIX_SSIZE_MAX (2147483647L) +#define _POSIX_STREAM_MAX (8) +#define _POSIX_TTY_NAME_MAX (256) +#define _POSIX_TZNAME_MAX (3) + +#endif /* _LIMITS_H_ */ diff --git a/headers/private/net/protocols.h b/headers/private/net/protocols.h new file mode 100644 index 0000000000..a2fff62fc7 --- /dev/null +++ b/headers/private/net/protocols.h @@ -0,0 +1,48 @@ +/* protocols.h + * The various protocols we're likely to come across as + * they're identified in the type fields of packets... + */ + +#include "netinet/in.h" + +#ifndef OBOS_PROTOCOLS_H +#define OBOS_PROTOCOLS_H + +/* define some protocol numbers unique to ethernet */ +enum { + ETHER_IPV4 = 0x0800, + ETHER_ARP = 0x0806, + ETHER_RARP = 0x8035, + ETHER_ATALK = 0x809b, /* Appletalk */ + ETHER_SNMP = 0x814c, /* SNMP */ + ETHER_IPV6 = 0x86dd, /* IPv6 */ + ETHER_PPPOE_DISC = 0x8863, /* PPPoE Discovery */ + ETHER_PPPOE_SESS = 0x8864 /* PPPoE Session */ +}; + +/* these are used when assigning slots in the protocol table, so they + * should tie in with IP numbers wherever possible, with other + * protocols fitting in. + * These are used in the module definitions. + */ +enum { + NS_IPV4 = IPPROTO_IP, + NS_ICMP = IPPROTO_ICMP, + NS_IGMP = IPPROTO_IGMP, + NS_TCP = IPPROTO_TCP, + NS_UDP = IPPROTO_UDP, + NS_ETHER=200, + NS_IPV6, + NS_ATALK, + NS_ARP, + NS_RARP, + NS_PPPOE, + NS_SERIAL, + NS_LOOP, + NS_SOCKET, + NS_ROUTE +}; + + +#endif /* OBOS_PROTOCOLS_H */ +