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
This commit is contained in:
David Reid
2002-07-11 20:39:30 +00:00
parent 25f901aec9
commit d69c1d7983
4 changed files with 148 additions and 85 deletions
+144
View File
@@ -0,0 +1,144 @@
/*
* errno.h
*
* POSIX style error codes.
* Be values used where required to keep compatibility.
*/
#ifndef _POSIX_ERRNO_H
#define _POSIX_ERRNO_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <limits.h>
/* XXX - Fix this once TLS works */
extern int errno;
/* We're defining values based on the values that Be used, hence
* the starting point at + 0x7000
*/
#define POSIX_ERROR_START LONG_MIN + 0x7000
/* The basic error codes that don't have a B_ equivalent
*
* 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.
*/
enum {
E2BIG = POSIX_ERROR_START + 1,
ECHILD,
EDEADLK,
EFBIG,
EMLINK,
ENFILE,
ENODEV,
ENOLCK,
ENOSYS,
ENOTTY, /* +10 */
ENXIO,
ESPIPE,
ESRCH,
EFPOS,
ESIGPARM,
EDOM,
ERANGE,
EPROTOTYPE,
EPROTONOSUPPORT,
EPFNOSUPPORT, /* +20 */
EAFNOSUPPORT,
EADDRINUSE,
EADDRNOTAVAIL,
ENETDOWN,
ENETUNREACH,
ENETRESET,
ECONNABORTED,
ECONNRESET,
EISCONN,
ENOTCONN, /* +30 */
ESHUTDOWN,
ECONNREFUSED,
EHOSTUNREACH,
ENOPROTOOPT,
ENOBUFS,
EINPROGRESS,
EALREADY,
EILSEQ,
ENOMSG,
ESTALE, /* +40 */
EOVERFLOW,
EMSGSIZE,
EOPNOTSUPP,
ENOTSOCK,
/* These are additional to the Be ones */
EBADMSG,
ECANCELLED,
EDESTADDRREQ,
EDQUOT,
EHOSTDOWN,
EIDRM, /* +50 */
EISDIR,
EMULTIHOP,
ENODATA,
ENOLINK,
ENOSR,
ENOSTR,
EPROTO,
EPROTOOPT,
ETIME,
EFTYPE, /* +60 */
ETOOMANYREFS
};
/*
* Errors with Be equivalents
*/
/* TODO: add comments showing what the equivalent Be errors are... */
/* NB - These have strange values to be the same as the Be values... */
/* General errors */
enum {
ENOMEM = LONG_MIN,
EIO,
EACCES,
EINVAL = LONG_MIN + 5,
ETIMEDOUT = LONG_MIN + 9,
EINTR,
EWOULDBLOCK,
EAGAIN = EWOULDBLOCK,
EBUSY = LONG_MIN + 14,
EPERM
};
/* Storage kit/File system errors */
enum {
EBADF = LONG_MIN + 0x6000,
EEXIST = EBADF + 2,
ENOENT,
ENAMETOOLONG,
ENOTDIR,
ENOTEMPTY,
ENOSPC,
EROFS,
EMFILE,
EXDEV,
ELOOP,
EPIPE
};
/* An odd ball! */
#define ENOEXEC LONG_MIN + 0x1302
#ifdef __cplusplus
} /* "C" */
#endif
#endif /* _POSIX_ERRNO_H */
+90
View File
@@ -0,0 +1,90 @@
#ifndef _LIMITS_H_
#define _LIMITS_H_
#include <float.h> /* 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 <limits.h>
# 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_ */