Obey the gods of source compatability. Progress is evil. (apparently)

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@136 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
David Reid
2002-07-12 14:57:37 +00:00
parent 49dc88277f
commit afe886fc48
2 changed files with 94 additions and 142 deletions
+90 -15
View File
@@ -1,15 +1,18 @@
/******************************************************************************
/
/ File: Errors.h
/
/ Description: Error code constants.
/
/ Copyright 1993-98, Be Incorporated
/
******************************************************************************/
#ifndef _ERRORS_H
#define _ERRORS_H
/* This file contains error codes as defined by BeOS R5.
*
* There are 2 other files that contain error codes,
* codes starting E are found in posix/errno.h
* codes starting with ERR_ are kernel only and found in
* private/kernel/kerrors.h
*/
#include <errno.h>
#include <limits.h>
/*-------------------------------------------------------------*/
/*----- Error baselines ---------------------------------------*/
@@ -18,11 +21,11 @@
#define B_OS_ERROR_BASE B_GENERAL_ERROR_BASE + 0x1000
#define B_APP_ERROR_BASE B_GENERAL_ERROR_BASE + 0x2000
#define B_INTERFACE_ERROR_BASE B_GENERAL_ERROR_BASE + 0x3000
#define B_MEDIA_ERROR_BASE B_GENERAL_ERROR_BASE + 0x4000
#define B_TRANSLATION_ERROR_BASE B_GENERAL_ERROR_BASE + 0x4800
#define B_MEDIA_ERROR_BASE B_GENERAL_ERROR_BASE + 0x4000 /* - 0x41ff */
#define B_TRANSLATION_ERROR_BASE B_GENERAL_ERROR_BASE + 0x4800 /* - 0x48ff */
#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
@@ -32,7 +35,6 @@
#define B_ERRORS_END (B_GENERAL_ERROR_BASE + 0xffff)
/*-------------------------------------------------------------*/
/*----- General Errors ----------------------------------------*/
enum {
@@ -52,7 +54,6 @@ enum {
B_NO_INIT,
B_BUSY,
B_NOT_ALLOWED,
B_BAD_DATA,
B_ERROR = -1,
B_OK = 0,
@@ -128,6 +129,80 @@ 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 {
@@ -190,4 +265,4 @@ enum
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _ERRORS_H */
#endif /* _DERRORS_H */
+4 -127
View File
@@ -1,12 +1,5 @@
/*
* errno.h
*
* POSIX style error codes.
* Be values used where required to keep compatibility.
*
* Errors beginning with B_ can be found in os/support/Errors.h
* those starting with ERR_ are kernel only and are found in
* private/kernel/kerrors.h
*/
#ifndef _POSIX_ERRNO_H
@@ -17,130 +10,14 @@ extern "C"
{
#endif
#include <limits.h>
#include <Errors.h>
#define ENOERR 0
#define EOK ENOERR /* some code assumes EOK exists */
/* 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 = EBADF + 10,
EXDEV,
ELOOP,
EPIPE
};
/* An odd ball! */
#define ENOEXEC LONG_MIN + 0x1302
#ifdef __cplusplus
} /* "C" */
#endif