minix/include/errno.h

129 lines
6.8 KiB
C
Raw Normal View History

2005-04-21 16:53:53 +02:00
/* The <errno.h> header defines the numbers of the various errors that can
* occur during program execution. They are visible to user programs and
* should be small positive integers. However, they are also used within
* MINIX, where they must be negative. For example, the READ system call is
* executed internally by calling do_read(). This function returns either a
* (negative) error number or a (positive) number of bytes actually read.
*
* To solve the problem of having the error numbers be negative inside the
* the system and positive outside, the following mechanism is used. All the
* definitions are are the form:
*
* #define EPERM (_SIGN 1)
*
* If the macro _SYSTEM is defined, then _SIGN is set to "-", otherwise it is
* set to "". Thus when compiling the operating system, the macro _SYSTEM
* will be defined, setting EPERM to (- 1), whereas when when this
* file is included in an ordinary user program, EPERM has the value ( 1).
*/
#ifndef _ERRNO_H /* check if <errno.h> is already included */
#define _ERRNO_H /* it is not included; note that fact */
/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
#ifdef _SYSTEM
# define _SIGN -
# define OK 0
#else
# define _SIGN
#endif
extern int errno; /* place where the error numbers go */
/* Here are the numerical values of the error numbers. */
#define _NERROR 70 /* number of errors */
#define EGENERIC (_SIGN 99) /* generic error */
#define EPERM (_SIGN 1) /* operation not permitted */
#define ENOENT (_SIGN 2) /* no such file or directory */
#define ESRCH (_SIGN 3) /* no such process */
#define EINTR (_SIGN 4) /* interrupted function call */
#define EIO (_SIGN 5) /* input/output error */
#define ENXIO (_SIGN 6) /* no such device or address */
#define E2BIG (_SIGN 7) /* arg list too long */
#define ENOEXEC (_SIGN 8) /* exec format error */
#define EBADF (_SIGN 9) /* bad file descriptor */
#define ECHILD (_SIGN 10) /* no child process */
#define EAGAIN (_SIGN 11) /* resource temporarily unavailable */
#define ENOMEM (_SIGN 12) /* not enough space */
#define EACCES (_SIGN 13) /* permission denied */
#define EFAULT (_SIGN 14) /* bad address */
#define ENOTBLK (_SIGN 15) /* Extension: not a block special file */
#define EBUSY (_SIGN 16) /* resource busy */
#define EEXIST (_SIGN 17) /* file exists */
#define EXDEV (_SIGN 18) /* improper link */
#define ENODEV (_SIGN 19) /* no such device */
#define ENOTDIR (_SIGN 20) /* not a directory */
#define EISDIR (_SIGN 21) /* is a directory */
#define EINVAL (_SIGN 22) /* invalid argument */
#define ENFILE (_SIGN 23) /* too many open files in system */
#define EMFILE (_SIGN 24) /* too many open files */
#define ENOTTY (_SIGN 25) /* inappropriate I/O control operation */
#define ETXTBSY (_SIGN 26) /* no longer used */
#define EFBIG (_SIGN 27) /* file too large */
#define ENOSPC (_SIGN 28) /* no space left on device */
#define ESPIPE (_SIGN 29) /* invalid seek */
#define EROFS (_SIGN 30) /* read-only file system */
#define EMLINK (_SIGN 31) /* too many links */
#define EPIPE (_SIGN 32) /* broken pipe */
#define EDOM (_SIGN 33) /* domain error (from ANSI C std) */
#define ERANGE (_SIGN 34) /* result too large (from ANSI C std) */
#define EDEADLK (_SIGN 35) /* resource deadlock avoided */
#define ENAMETOOLONG (_SIGN 36) /* file name too long */
#define ENOLCK (_SIGN 37) /* no locks available */
#define ENOSYS (_SIGN 38) /* function not implemented */
#define ENOTEMPTY (_SIGN 39) /* directory not empty */
#define ELOOP (_SIGN 40) /* too many levels of symlinks detected */
New RS and new signal handling for system processes. UPDATING INFO: 20100317: /usr/src/etc/system.conf updated to ignore default kernel calls: copy it (or merge it) to /etc/system.conf. The hello driver (/dev/hello) added to the distribution: # cd /usr/src/commands/scripts && make clean install # cd /dev && MAKEDEV hello KERNEL CHANGES: - Generic signal handling support. The kernel no longer assumes PM as a signal manager for every process. The signal manager of a given process can now be specified in its privilege slot. When a signal has to be delivered, the kernel performs the lookup and forwards the signal to the appropriate signal manager. PM is the default signal manager for user processes, RS is the default signal manager for system processes. To enable ptrace()ing for system processes, it is sufficient to change the default signal manager to PM. This will temporarily disable crash recovery, though. - sys_exit() is now split into sys_exit() (i.e. exit() for system processes, which generates a self-termination signal), and sys_clear() (i.e. used by PM to ask the kernel to clear a process slot when a process exits). - Added a new kernel call (i.e. sys_update()) to swap two process slots and implement live update. PM CHANGES: - Posix signal handling is no longer allowed for system processes. System signals are split into two fixed categories: termination and non-termination signals. When a non-termination signaled is processed, PM transforms the signal into an IPC message and delivers the message to the system process. When a termination signal is processed, PM terminates the process. - PM no longer assumes itself as the signal manager for system processes. It now makes sure that every system signal goes through the kernel before being actually processes. The kernel will then dispatch the signal to the appropriate signal manager which may or may not be PM. SYSLIB CHANGES: - Simplified SEF init and LU callbacks. - Added additional predefined SEF callbacks to debug crash recovery and live update. - Fixed a temporary ack in the SEF init protocol. SEF init reply is now completely synchronous. - Added SEF signal event type to provide a uniform interface for system processes to deal with signals. A sef_cb_signal_handler() callback is available for system processes to handle every received signal. A sef_cb_signal_manager() callback is used by signal managers to process system signals on behalf of the kernel. - Fixed a few bugs with memory mapping and DS. VM CHANGES: - Page faults and memory requests coming from the kernel are now implemented using signals. - Added a new VM call to swap two process slots and implement live update. - The call is used by RS at update time and in turn invokes the kernel call sys_update(). RS CHANGES: - RS has been reworked with a better functional decomposition. - Better kernel call masks. com.h now defines the set of very basic kernel calls every system service is allowed to use. This makes system.conf simpler and easier to maintain. In addition, this guarantees a higher level of isolation for system libraries that use one or more kernel calls internally (e.g. printf). - RS is the default signal manager for system processes. By default, RS intercepts every signal delivered to every system process. This makes crash recovery possible before bringing PM and friends in the loop. - RS now supports fast rollback when something goes wrong while initializing the new version during a live update. - Live update is now implemented by keeping the two versions side-by-side and swapping the process slots when the old version is ready to update. - Crash recovery is now implemented by keeping the two versions side-by-side and cleaning up the old version only when the recovery process is complete. DS CHANGES: - Fixed a bug when the process doing ds_publish() or ds_delete() is not known by DS. - Fixed the completely broken support for strings. String publishing is now implemented in the system library and simply wraps publishing of memory ranges. Ideally, we should adopt a similar approach for other data types as well. - Test suite fixed. DRIVER CHANGES: - The hello driver has been added to the Minix distribution to demonstrate basic live update and crash recovery functionalities. - Other drivers have been adapted to conform the new SEF interface.
2010-03-17 02:15:29 +01:00
#define ERESTART (_SIGN 41) /* service restarted */
#define EIDRM (_SIGN 43) /* Identifier removed */
#define EILSEQ (_SIGN 44) /* illegal byte sequence */
2005-04-21 16:53:53 +02:00
/* The following errors relate to networking. */
#define EPACKSIZE (_SIGN 50) /* invalid packet size for some protocol */
#define ENOBUFS (_SIGN 51) /* not enough buffers left */
2005-04-21 16:53:53 +02:00
#define EBADIOCTL (_SIGN 52) /* illegal ioctl for device */
#define EBADMODE (_SIGN 53) /* badmode in ioctl */
2009-08-18 11:26:51 +02:00
#define EWOULDBLOCK (_SIGN 54) /* call would block on nonblocking socket */
#define ENETUNREACH (_SIGN 55) /* network unreachable */
#define EHOSTUNREACH (_SIGN 56) /* host unreachable */
2009-08-18 11:26:51 +02:00
#define EISCONN (_SIGN 57) /* already connected */
2005-04-21 16:53:53 +02:00
#define EADDRINUSE (_SIGN 58) /* address in use */
#define ECONNREFUSED (_SIGN 59) /* connection refused */
#define ECONNRESET (_SIGN 60) /* connection reset */
#define ETIMEDOUT (_SIGN 61) /* connection timed out */
#define EURG (_SIGN 62) /* urgent data present */
#define ENOURG (_SIGN 63) /* no urgent data present */
#define ENOTCONN (_SIGN 64) /* no connection (yet or anymore) */
#define ESHUTDOWN (_SIGN 65) /* a write call to a shutdown connection */
#define ENOCONN (_SIGN 66) /* no such connection */
#define EAFNOSUPPORT (_SIGN 67) /* address family not supported */
2005-07-27 13:43:28 +02:00
#define EPROTONOSUPPORT (_SIGN 68) /* protocol not supported by AF */
#define EPROTOTYPE (_SIGN 69) /* Protocol wrong type for socket */
#define EINPROGRESS (_SIGN 70) /* Operation now in progress */
#define EADDRNOTAVAIL (_SIGN 71) /* Can't assign requested address */
2005-07-27 13:43:28 +02:00
#define EALREADY (_SIGN 72) /* Connection already in progress */
#define EMSGSIZE (_SIGN 73) /* Message too long */
#define ENOTSOCK (_SIGN 74) /* Socket operation on non-socket */
#define ENOPROTOOPT (_SIGN 75) /* Protocol not available */
#define EOPNOTSUPP (_SIGN 76) /* Operation not supported */
2010-01-20 17:36:48 +01:00
#define ENOTSUP EOPNOTSUPP /* Not supported */
#define ENETDOWN (_SIGN 77) /* network is down */
2005-04-21 16:53:53 +02:00
/* The following are not POSIX errors, but they can still happen.
* All of these are generated by the kernel and relate to message passing.
*/
#define ELOCKED (_SIGN 101) /* can't send message due to deadlock */
#define EBADCALL (_SIGN 102) /* illegal system call number */
#define ECALLDENIED (_SIGN 104) /* no permission for system call */
2005-10-05 11:52:54 +02:00
#define EDEADSRCDST (_SIGN 105) /* source or destination is not alive */
2005-04-21 16:53:53 +02:00
#define ENOTREADY (_SIGN 106) /* source or destination is not ready */
#define EBADREQUEST (_SIGN 107) /* destination cannot handle request */
#define ETRAPDENIED (_SIGN 110) /* IPC trap not allowed */
2005-04-21 16:53:53 +02:00
#define EDONTREPLY (_SIGN 201) /* pseudo-code: don't send a reply */
2010-06-24 09:37:26 +02:00
/* The following are non-POSIX server responses */
#define EBADEPT (_SIGN 301) /* specified endpoint is bad */
#define EDEADEPT (_SIGN 302) /* specified endpoint is not alive */
2005-04-21 16:53:53 +02:00
#endif /* _ERRNO_H */