⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errno.h

📁 一个简单的操作系统minix的核心代码
💻 H
字号:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				include/errno.h	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00200	/* The <errno.h> header defines the numbers of the various errors that can
00201	 * occur during program execution.  They are visible to user programs and 
00202	 * should be small positive integers.  However, they are also used within 
00203	 * MINIX, where they must be negative.  For example, the READ system call is 
00204	 * executed internally by calling do_read().  This function returns either a 
00205	 * (negative) error number or a (positive) number of bytes actually read.
00206	 *
00207	 * To solve the problem of having the error numbers be negative inside the
00208	 * the system and positive outside, the following mechanism is used.  All the
00209	 * definitions are are the form:
00210	 *
00211	 *      #define EPERM           (_SIGN 1)
00212	 *
00213	 * If the macro _SYSTEM is defined, then  _SIGN is set to "-", otherwise it is
00214	 * set to "".  Thus when compiling the operating system, the  macro _SYSTEM
00215	 * will be defined, setting EPERM to (- 1), whereas when when this
00216	 * file is included in an ordinary user program, EPERM has the value ( 1).
00217	 */
00218	
00219	#ifndef _ERRNO_H                /* check if <errno.h> is already included */
00220	#define _ERRNO_H                /* it is not included; note that fact */
00221	
00222	/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
00223	#ifdef _SYSTEM
00224	#   define _SIGN         -
00225	#   define OK            0
00226	#else
00227	#   define _SIGN         
00228	#endif
00229	
00230	extern int errno;                 /* place where the error numbers go */
00231	
00232	/* Here are the numerical values of the error numbers. */
00233	#define _NERROR               70  /* number of errors */  
00234	
00235	#define EGENERIC      (_SIGN 99)  /* generic error */
00236	#define EPERM         (_SIGN  1)  /* operation not permitted */
00237	#define ENOENT        (_SIGN  2)  /* no such file or directory */
00238	#define ESRCH         (_SIGN  3)  /* no such process */
00239	#define EINTR         (_SIGN  4)  /* interrupted function call */
00240	#define EIO           (_SIGN  5)  /* input/output error */
00241	#define ENXIO         (_SIGN  6)  /* no such device or address */
00242	#define E2BIG         (_SIGN  7)  /* arg list too long */
00243	#define ENOEXEC       (_SIGN  8)  /* exec format error */
00244	#define EBADF         (_SIGN  9)  /* bad file descriptor */
00245	#define ECHILD        (_SIGN 10)  /* no child process */
00246	#define EAGAIN        (_SIGN 11)  /* resource temporarily unavailable */
00247	#define ENOMEM        (_SIGN 12)  /* not enough space */
00248	#define EACCES        (_SIGN 13)  /* permission denied */
00249	#define EFAULT        (_SIGN 14)  /* bad address */
00250	#define ENOTBLK       (_SIGN 15)  /* Extension: not a block special file */
00251	#define EBUSY         (_SIGN 16)  /* resource busy */
00252	#define EEXIST        (_SIGN 17)  /* file exists */
00253	#define EXDEV         (_SIGN 18)  /* improper link */
00254	#define ENODEV        (_SIGN 19)  /* no such device */
00255	#define ENOTDIR       (_SIGN 20)  /* not a directory */
00256	#define EISDIR        (_SIGN 21)  /* is a directory */
00257	#define EINVAL        (_SIGN 22)  /* invalid argument */
00258	#define ENFILE        (_SIGN 23)  /* too many open files in system */
00259	#define EMFILE        (_SIGN 24)  /* too many open files */
00260	#define ENOTTY        (_SIGN 25)  /* inappropriate I/O control operation */
00261	#define ETXTBSY       (_SIGN 26)  /* no longer used */
00262	#define EFBIG         (_SIGN 27)  /* file too large */
00263	#define ENOSPC        (_SIGN 28)  /* no space left on device */
00264	#define ESPIPE        (_SIGN 29)  /* invalid seek */
00265	#define EROFS         (_SIGN 30)  /* read-only file system */
00266	#define EMLINK        (_SIGN 31)  /* too many links */
00267	#define EPIPE         (_SIGN 32)  /* broken pipe */
00268	#define EDOM          (_SIGN 33)  /* domain error       (from ANSI C std) */
00269	#define ERANGE        (_SIGN 34)  /* result too large   (from ANSI C std) */
00270	#define EDEADLK       (_SIGN 35)  /* resource deadlock avoided */
00271	#define ENAMETOOLONG  (_SIGN 36)  /* file name too long */
00272	#define ENOLCK        (_SIGN 37)  /* no locks available */
00273	#define ENOSYS        (_SIGN 38)  /* function not implemented */
00274	#define ENOTEMPTY     (_SIGN 39)  /* directory not empty */
00275	
00276	/* The following errors relate to networking. */
00277	#define EPACKSIZE     (_SIGN 50)  /* invalid packet size for some protocol */
00278	#define EOUTOFBUFS    (_SIGN 51)  /* not enough buffers left */
00279	#define EBADIOCTL     (_SIGN 52)  /* illegal ioctl for device */
00280	#define EBADMODE      (_SIGN 53)  /* badmode in ioctl */
00281	#define EWOULDBLOCK   (_SIGN 54)
00282	#define EBADDEST      (_SIGN 55)  /* not a valid destination address */
00283	#define EDSTNOTRCH    (_SIGN 56)  /* destination not reachable */
00284	#define EISCONN       (_SIGN 57)  /* all ready connected */
00285	#define EADDRINUSE    (_SIGN 58)  /* address in use */
00286	#define ECONNREFUSED  (_SIGN 59)  /* connection refused */
00287	#define ECONNRESET    (_SIGN 60)  /* connection reset */
00288	#define ETIMEDOUT     (_SIGN 61)  /* connection timed out */
00289	#define EURG          (_SIGN 62)  /* urgent data present */
00290	#define ENOURG        (_SIGN 63)  /* no urgent data present */
00291	#define ENOTCONN      (_SIGN 64)  /* no connection (yet or anymore) */
00292	#define ESHUTDOWN     (_SIGN 65)  /* a write call to a shutdown connection */
00293	#define ENOCONN       (_SIGN 66)  /* no such connection */
00294	
00295	/* The following are not POSIX errors, but they can still happen. */
00296	#define ELOCKED      (_SIGN 101)  /* can't send message */
00297	#define EBADCALL     (_SIGN 102)  /* error on send/receive */
00298	
00299	/* The following error codes are generated by the kernel itself. */
00300	#ifdef _SYSTEM
00301	#define E_BAD_DEST     -1001    /* destination address illegal */
00302	#define E_BAD_SRC      -1002    /* source address illegal */
00303	#define E_TRY_AGAIN    -1003    /* can't send-- tables full */
00304	#define E_OVERRUN      -1004    /* interrupt for task that is not waiting */
00305	#define E_BAD_BUF      -1005    /* message buf outside caller's addr space */
00306	#define E_TASK         -1006    /* can't send to task */
00307	#define E_NO_MESSAGE   -1007    /* RECEIVE failed: no message present */
00308	#define E_NO_PERM      -1008    /* ordinary users can't send to tasks */
00309	#define E_BAD_FCN      -1009    /* only valid fcns are SEND, RECEIVE, BOTH */
00310	#define E_BAD_ADDR     -1010    /* bad address given to utility routine */
00311	#define E_BAD_PROC     -1011    /* bad proc number given to utility */
00312	#endif /* _SYSTEM */
00313	
00314	#endif /* _ERRNO_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -