收藏 分享(赏)

Minix源代码.pdf

上传人:HR专家 文档编号:6298411 上传时间:2019-04-05 格式:PDF 页数:392 大小:827.76KB
下载 相关 举报
Minix源代码.pdf_第1页
第1页 / 共392页
Minix源代码.pdf_第2页
第2页 / 共392页
Minix源代码.pdf_第3页
第3页 / 共392页
Minix源代码.pdf_第4页
第4页 / 共392页
Minix源代码.pdf_第5页
第5页 / 共392页
点击查看更多>>
资源描述

1、MINIX SOURCE CODE File: include/ansi.h 501+include/ansi.h+00000 /* The header attempts to decide whether the compiler has enough00001 * conformance to Standard C for Minix to take advantage of. If so, the00002 * symbol _ANSI is defined (as 31459). Otherwise _ANSI is not defined00003 * here, but it m

2、ay be defined by applications that want to bend the rules.00004 * The magic number in the definition is to inhibit unnecessary bending00005 * of the rules. (For consistency with the new #ifdef _ANSI“ tests in00006 * the headers, _ANSI should really be defined as nothing, but that would00007 * breakm

3、any library routines that use “#if _ANSI“.)0000800009 * If _ANSI ends up being defined, a macro00010 *00011 * _PROTOTYPE(function, params)00012 *00013 * is defined. This macro expands in different ways, generating either00014 * ANSI Standard C prototypes or old-style K limit not enforced */001530015

4、4 #define NGROUPS_MAX 0 /* supplemental group IDs not available */00155 #define ARG_MAX 16384 /* # bytes of args + environ for exec() */00156 #define CHILD_MAX _NO_LIMIT /* MINIX does not limit children */00157 #define OPEN_MAX 20 /* # open files a process may have */00158 #define LINK_MAX SHRT_MAX

5、/* # links a file may have */00159 #define MAX_CANON 255 /* size of the canonical input queue */00160 #define MAX_INPUT 255 /* size of the type-ahead buffer */00161 #define NAME_MAX DIRSIZ /* # chars in a file name */00162 #define PATH_MAX 255 /* # chars in a path name */00163 #define PIPE_BUF 7168

6、/* # bytes in atomic write to a pipe */00164 #define STREAM_MAX 20 /* must be the same as FOPEN_MAX in stdio.h */00165 #define TZNAME_MAX 3 /* maximum bytes in a time zone name is 3 */00166 #define SSIZE_MAX 32767 /* max defined byte count for read() */0016700168 #endif /* _POSIX_SOURCE */0016900170

7、 #endif /* _LIMITS_H */+include/errno.h+00200 /* The header defines the numbers of the various errors that can00201 * occur during program execution. They are visible to user programs and00202 * should be small positive integers. However, they are also used within00203 * MINIX, where they must be ne

8、gative. For example, the READ system call is00204 * executed internally by calling do_read(). This function returns either a00205 * (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 the00208 * the

9、system and positive outside, the following mechanism is used. All the00209 * 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 is00214 * set to “. Thus when compiling the operating system, the mac

10、ro _SYSTEM00215 * will be defined, setting EPERM to (- 1), whereas when when this00216 * file is included in an ordinary user program, EPERM has the value ( 1).00217 */0021800219 #ifndef _ERRNO_H /* checkif is already included */504 File: include/errno.h MINIX SOURCE CODE00220 #define _ERRNO_H /* it

11、 is not included; note that fact */0022100222 /* Now define _SIGN as “ or “-“ depending on _SYSTEM. */00223 #ifdef _SYSTEM00224 # define _SIGN -00225 # define OK 000226 #else00227 # define _SIGN00228 #endif0022900230 extern int errno; /* place where the error numbers go */0023100232 /* Here are the

12、numerical values of the error numbers. */00233 #define _NERROR 70 /* number of errors */0023400235 #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) /*

13、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 */

14、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 #defin

15、e EFAULT (_SIGN 14) /* bad address */00250 #define ENOTBLK (_SIGN 15) /* Extension: not a blockspecial 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

16、 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

17、#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

18、 (_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 (

19、_SIGN 35) /* resource deadlockavoided */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 */0027500276 /* The fo

20、llowing 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 */MINIX SOURCE CODE File: include/errno.h 50500280 #def

21、ine 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 EADDRINU

22、SE (_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

23、) /* 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 #define EAFNOSUPPORT (_SIGN 67) /* address family not suppo

24、rted */00295 #define EPROTONOSUPPORT (_SIGN 68) /* protocol not supported by AF */00296 #define EPROTOTYPE (_SIGN 69) /* Protocol wrong type for socket */00297 #define EINPROGRESS (_SIGN 70) /* Operation now in progress */00298 #define EADDRNOTAVAIL (_SIGN 71) /* Cant assign requested address */0029

25、9 #define EALREADY (_SIGN 72) /* Connection already in progress */00300 #define EMSGSIZE (_SIGN 73) /* Message too long */0030100302 /* The following are not POSIX errors, but they can still happen.00303 * All of these are generated by the kernel and relate to message passing.00304 */00305 #define E

26、LOCKED (_SIGN 101) /* cant send message due to deadlock*/00306 #define EBADCALL (_SIGN 102) /* illegal system call number */00307 #define EBADSRCDST (_SIGN 103) /* bad source or destination process */00308 #define ECALLDENIED (_SIGN 104) /* no permission for system call */00309 #define EDEADDST (_SI

27、GN 105) /* send destination is not alive */00310 #define ENOTREADY (_SIGN 106) /* source or destination is not ready */00311 #define EBADREQUEST (_SIGN 107) /* destination cannot handle request */00312 #define EDONTREPLY (_SIGN 201) /* pseudo-code: dont send a reply */0031300314 #endif /* _ERRNO_H *

28、/+include/unistd.h+00400 /* The header contains a few miscellaneous manifest constants. */0040100402 #ifndef _UNISTD_H00403 #define _UNISTD_H0040400405 #ifndef _TYPES_H00406 #include 00407 #endif0040800409 /* Values used by access(). POSIX Table 2-8. */00410 #define F_OK 0 /* test if file exists */0

29、0411 #define X_OK 1 /* test if file is executable */00412 #define W_OK 2 /* test if file is writable */00413 #define R_OK 4 /* test if file is readable */0041400415 /* Values used for whence in lseek(fd, offset, whence). POSIX Table 2-9. */00416 #define SEEK_SET 0 /* offset is absolute */00417 #defi

30、ne SEEK_CUR 1 /* offset is relative to current position */00418 #define SEEK_END 2 /* offset is relative to end of file */00419506 File: include/unistd.h MINIX SOURCE CODE00420 /* This value is required by POSIX Table 2-10. */00421 #define _POSIX_VERSION 199009L /* which standard is being conformed

31、to */0042200423 /* These three definitions are required by POSIX Sec. 8.2.1.2. */00424 #define STDIN_FILENO 0 /* file descriptor for stdin */00425 #define STDOUT_FILENO 1 /* file descriptor for stdout */00426 #define STDERR_FILENO 2 /* file descriptor for stderr */0042700428 #ifdef _MINIX00429 /* Ho

32、w to exit the system or stop a server process. */00430 #define RBT_HALT 000431 #define RBT_REBOOT 100432 #define RBT_PANIC 2 /* a server panics */00433 #define RBT_MONITOR 3 /* let the monitor do this */00434 #define RBT_RESET 4 /* hard reset the system */00435 #endif0043600437 /* What system info t

33、o retrieve with sysgetinfo(). */00438 #define SI_KINFO 0 /* get kernel info via PM */00439 #define SI_PROC_ADDR 1 /* address of process table */00440 #define SI_PROC_TAB 2 /* copy of entire process table */00441 #define SI_DMAP_TAB 3 /* get device driver mappings */0044200443 /* NULL must be defined

34、 in according to POSIX Sec. 2.7.1. */00444 #define NULL (void *)0)0044500446 /* The following relate to configurable system variables. POSIX Table 4-2. */00447 #define _SC_ARG_MAX 100448 #define _SC_CHILD_MAX 200449 #define _SC_CLOCKS_PER_SEC 300450 #define _SC_CLK_TCK 300451 #define _SC_NGROUPS_MAX

35、 400452 #define _SC_OPEN_MAX 500453 #define _SC_JOB_CONTROL 600454 #define _SC_SAVED_IDS 700455 #define _SC_VERSION 800456 #define _SC_STREAM_MAX 900457 #define _SC_TZNAME_MAX 100045800459 /* The following relate to configurable pathname variables. POSIX Table 5-2. */00460 #define _PC_LINK_MAX 1 /*

36、linkcount */00461 #define _PC_MAX_CANON 2 /* size of the canonical input queue */00462 #define _PC_MAX_INPUT 3 /* type-ahead buffer size */00463 #define _PC_NAME_MAX 4 /* file name size */00464 #define _PC_PATH_MAX 5 /* pathname size */00465 #define _PC_PIPE_BUF 6 /* pipe size */00466 #define _PC_NO

37、_TRUNC 7 /* treatment of long name components */00467 #define _PC_VDISABLE 8 /* tty disable */00468 #define _PC_CHOWN_RESTRICTED 9 /* chown restricted or not */0046900470 /* POSIX defines several options that may be implemented or not, at the00471 * implementers whim. This implementer has made the f

38、ollowing choices:00472 *00473 * _POSIX_JOB_CONTROL not defined: no job control00474 * _POSIX_SAVED_IDS not defined: no saved uid/gid00475 * _POSIX_NO_TRUNC defined as -1: long path names are truncated00476 * _POSIX_CHOWN_RESTRICTED defined: you cant give away files00477 * _POSIX_VDISABLE defined: tt

39、y functions can be disabled00478 */00479 #define _POSIX_NO_TRUNC (-1)MINIX SOURCE CODE File: include/unistd.h 50700480 #define _POSIX_CHOWN_RESTRICTED 10048100482 /* Function Prototypes. */00483 _PROTOTYPE( void _exit, (int _status) );00484 _PROTOTYPE( int access, (const char *_path, int _amode) );0

40、0485 _PROTOTYPE( unsigned int alarm, (unsigned int _seconds) );00486 _PROTOTYPE( int chdir, (const char *_path) );00487 _PROTOTYPE( int fchdir, (int fd) );00488 _PROTOTYPE( int chown, (const char *_path, _mnx_Uid_t _owner, _mnx_Gid_t _group) );00489 _PROTOTYPE( int close, (int _fd) );00490 _PROTOTYP

41、E( char *ctermid, (char *_s) );00491 _PROTOTYPE( char *cuserid, (char *_s) );00492 _PROTOTYPE( int dup, (int _fd) );00493 _PROTOTYPE( int dup2, (int _fd, int _fd2) );00494 _PROTOTYPE( int execl, (const char *_path, const char *_arg, .) );00495 _PROTOTYPE( int execle, (const char *_path, const char *

42、_arg, .) );00496 _PROTOTYPE( int execlp, (const char *_file, const char *arg, .) );00497 _PROTOTYPE( int execv, (const char *_path, char *const _argv) );00498 _PROTOTYPE( int execve, (const char *_path, char *const _argv,00499 char *const _envp) );00500 _PROTOTYPE( int execvp, (const char *_file, ch

43、ar *const _argv) );00501 _PROTOTYPE( pid_t fork, (void) );00502 _PROTOTYPE( long fpathconf, (int _fd, int _name) );00503 _PROTOTYPE( char *getcwd, (char *_buf, size_t _size) );00504 _PROTOTYPE( gid_t getegid, (void) );00505 _PROTOTYPE( uid_t geteuid, (void) );00506 _PROTOTYPE( gid_t getgid, (void) )

44、;00507 _PROTOTYPE( int getgroups, (int _gidsetsize, gid_t _grouplist) );00508 _PROTOTYPE( char *getlogin, (void) );00509 _PROTOTYPE( pid_t getpgrp, (void) );00510 _PROTOTYPE( pid_t getpid, (void) );00511 _PROTOTYPE( pid_t getppid, (void) );00512 _PROTOTYPE( uid_t getuid, (void) );00513 _PROTOTYPE( i

45、nt isatty, (int _fd) );00514 _PROTOTYPE( int link, (const char *_existing, const char *_new) );00515 _PROTOTYPE( off_t lseek, (int _fd, off_t _offset, int _whence) );00516 _PROTOTYPE( long pathconf, (const char *_path, int _name) );00517 _PROTOTYPE( int pause, (void) );00518 _PROTOTYPE( int pipe, (i

46、nt _fildes2) );00519 _PROTOTYPE( ssize_t read, (int _fd, void *_buf, size_t _n) );00520 _PROTOTYPE( int rmdir, (const char *_path) );00521 _PROTOTYPE( int setgid, (_mnx_Gid_t _gid) );00522 _PROTOTYPE( int setpgid, (pid_t _pid, pid_t _pgid) );00523 _PROTOTYPE( pid_t setsid, (void) );00524 _PROTOTYPE(

47、 int setuid, (_mnx_Uid_t _uid) );00525 _PROTOTYPE( unsigned int sleep, (unsigned int _seconds) );00526 _PROTOTYPE( long sysconf, (int _name) );00527 _PROTOTYPE( pid_t tcgetpgrp, (int _fd) );00528 _PROTOTYPE( int tcsetpgrp, (int _fd, pid_t _pgrp_id) );00529 _PROTOTYPE( char *ttyname, (int _fd) );0053

48、0 _PROTOTYPE( int unlink, (const char *_path) );00531 _PROTOTYPE( ssize_t write, (int _fd, const void *_buf, size_t _n) );0053200533 /* Open Group Base Specifications Issue 6 (not complete) */00534 _PROTOTYPE( int symlink, (const char *path1, const char *path2) );00535 _PROTOTYPE( int getopt, (int _argc, char *_argv, char *_opts) );00536 extern char *optarg;00537 extern int optind, opterr, optopt;0053

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报