use the -newos toolchain even if -elf is present.
[newos.git] / include / errno.h
bloba3707dfe69981bb7d34fc1d5c74261f3bfcf5384
1 /*
2 ** Copyright 2002, Travis Geiselbrecht. All rights reserved.
3 ** Copyright 2002, Manuel J. Petit. All rights reserved.
4 ** Distributed under the terms of the NewOS License.
5 */
7 #ifndef _newos__errno__hh_
8 #define _newos__errno__hh_
10 #include <newos/errors.h>
12 #ifdef __cplusplus
13 namespace std
14 {extern "C" {
15 #endif
19 * this will change when we get TLS working
21 #if _KERNEL
22 #define __WITH_ERRNO 0
23 #else
24 #define __WITH_ERRNO 1
25 #endif
27 #if __WITH_ERRNO
28 extern int errno;
29 #endif
31 /* mapping posix errors to system errors */
32 #define EPERM ERR_PERMISSION_DENIED
33 #define ENOENT ERR_NOT_FOUND
34 //#define ESRCH
35 //#define EINTR
36 #define EIO ERR_IO_ERROR
37 //#define ENXIO
38 #define E2BIG ERR_TOO_BIG
39 //#define ENOEXEC
40 #define EBADF ERR_INVALID_HANDLE
41 //#define ECHILD
42 //#define EDEADLK
43 #define ENOMEM ERR_NO_MEMORY
44 #define EACCES ERR_PERMISSION_DENIED
45 //#define EFAULT
46 //#define EBUSY
47 #define EEXIST ERR_VFS_ALREADY_EXISTS
48 //#define EXDEV
49 #define ENODEV ERR_VFS_WRONG_STREAM_TYPE
50 #define ENOTDIR ERR_VFS_NOT_DIR
51 //#define EISDIR
52 #define EINVAL ERR_INVALID_ARGS
53 #define ENFILE ERR_NO_MORE_HANDLES
54 #define EMFILE ERR_NO_MORE_HANDLES
55 //#define ENOTTY
56 //#define EFBIG
57 //#define ENOSPC
58 #define EROFS ERR_VFS_READONLY_FS
59 //#define EMLINK
60 #define EPIPE ERR_PIPE_WIDOW
62 //#define EDOM
63 #define ERANGE ERR_OUT_OF_RANGE
65 //#define EAGAIN
66 //#define EWOULDBLOCK
67 //#define EINPROGRESS
68 //#define EALREADY
70 /* network stuff */
71 //#define ENOTSOCK
72 //#define EDESTADDRREQ
73 //#define EMSGSIZE
74 //#define EPROTOTYPE
75 //#define ENOPROTOOPT
76 //#define EPROTONOSUPPORT
77 //#define ESOCKTNOSUPPORT
78 //#define EOPNOTSUPP
79 //#define ENOTSUP
80 //#define EPFNOSUPPORT
81 //#define EAFNOSUPPORT
82 //#define EADDRINUSE
83 //#define EADDRNOTAVAIL
86 #ifdef __cplusplus
87 }} /* "C" */
88 #endif
91 #endif
93 #if defined(__cplusplus) && !defined(_NEWOS_NO_LIBC_COMPAT)
94 using ::std::errno;
95 #endif