没有合适的资源?快使用搜索试试~ 我知道了~
Minix代码讲解 PDF
3星 · 超过75%的资源 需积分: 7 16 下载量 70 浏览量
2010-07-11
22:22:09
上传
评论
收藏 644KB PDF 举报
温馨提示
Minix代码讲解 PDF版本的,里面是全部代码带有注视
资源推荐
资源详情
资源评论
MINIX SOURCE CODE File: include/ansi.h 1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/ansi.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00000 /* The <ansi.h> header attempts to decide whether the compiler has enough
00001 * conformance to Standard C for Minix to take advantage of. If so, the
00002 * symbol _ANSI is defined (as 31415). Otherwise _ANSI is not defined
00003 * here, but it may be defined by applications that want to bend the rules.
00004 * The magic number in the definition is to inhibit unnecessary bending
00005 * of the rules. (For consistency with the new ’#ifdef _ANSI" tests in
00006 * the headers, _ANSI should really be defined as nothing, but that would
00007 * break many library routines that use "#if _ANSI".)
00008
00009 * If _ANSI ends up being defined, a macro
00010 *
00011 * _PROTOTYPE(function, params)
00012 *
00013 * is defined. This macro expands in different ways, generating either
00014 * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie)
00015 * prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc
00016 * in such a way that they are portable over both ANSI and K&R compilers.
00017 * The appropriate macros are defined here.
00018 */
00019
00020 #ifndef _ANSI_H
00021 #define _ANSI_H
00022
00023 #if __STDC__ == 1
00024 #define _ANSI 31459 /* compiler claims full ANSI conformance */
00025 #endif
00026
00027 #ifdef __GNUC__
00028 #define _ANSI 31459 /* gcc conforms enough even in non-ANSI mode */
00029 #endif
00030
00031 #ifdef _ANSI
00032
00033 /* Keep everything for ANSI prototypes. */
00034 #define _PROTOTYPE(function, params) function params
00035 #define _ARGS(params) params
00036
00037 #define _VOIDSTAR void *
00038 #define _VOID void
00039 #define _CONST const
00040 #define _VOLATILE volatile
00041 #define _SIZET size_t
00042
00043 #else
00044
00045 /* Throw away the parameters for K&R prototypes. */
00046 #define _PROTOTYPE(function, params) function()
00047 #define _ARGS(params) ()
00048
00049 #define _VOIDSTAR void *
00050 #define _VOID void
00051 #define _CONST
00052 #define _VOLATILE
00053 #define _SIZET int
00054
2 File: include/ansi.h MINIX SOURCE CODE
00055 #endif /* _ANSI */
00056
00057 #endif /* ANSI_H */
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/limits.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00100 /* The <limits.h> header defines some basic sizes, both of the language types
00101 * (e.g., the number of bits in an integer), and of the operating system (e.g.
00102 * the number of characters in a file name.
00103 */
00104
00105 #ifndef _LIMITS_H
00106 #define _LIMITS_H
00107
00108 /* Definitions about chars (8 bits in MINIX, and signed). */
00109 #define CHAR_BIT 8 /* # bits in a char */
00110 #define CHAR_MIN -128 /* minimum value of a char */
00111 #define CHAR_MAX 127 /* maximum value of a char */
00112 #define SCHAR_MIN -128 /* minimum value of a signed char */
00113 #define SCHAR_MAX 127 /* maximum value of a signed char */
00114 #define UCHAR_MAX 255 /* maximum value of an unsigned char */
00115 #define MB_LEN_MAX 1 /* maximum length of a multibyte char */
00116
00117 /* Definitions about shorts (16 bits in MINIX). */
00118 #define SHRT_MIN (-32767-1) /* minimum value of a short */
00119 #define SHRT_MAX 32767 /* maximum value of a short */
00120 #define USHRT_MAX 0xFFFF /* maximum value of unsigned short */
00121
00122 /* _EM_WSIZE is a compiler-generated symbol giving the word size in bytes. */
00123 #if _EM_WSIZE == 2
00124 #define INT_MIN (-32767-1) /* minimum value of a 16-bit int */
00125 #define INT_MAX 32767 /* maximum value of a 16-bit int */
00126 #define UINT_MAX 0xFFFF /* maximum value of an unsigned 16-bit int */
00127 #endif
00128
00129 #if _EM_WSIZE == 4
00130 #define INT_MIN (-2147483647-1) /* minimum value of a 32-bit int */
00131 #define INT_MAX 2147483647 /* maximum value of a 32-bit int */
00132 #define UINT_MAX 0xFFFFFFFF /* maximum value of an unsigned 32-bit int */
00133 #endif
00134
00135 /*Definitions about longs (32 bits in MINIX). */
00136 #define LONG_MIN (-2147483647L-1)/* minimum value of a long */
00137 #define LONG_MAX 2147483647L /* maximum value of a long */
00138 #define ULONG_MAX 0xFFFFFFFFL /* maximum value of an unsigned long */
00139
00140 /* Minimum sizes required by the POSIX P1003.1 standard (Table 2-3). */
00141 #ifdef _POSIX_SOURCE /* these are only visible for POSIX */
00142 #define _POSIX_ARG_MAX 4096 /* exec() may have 4K worth of args */
00143 #define _POSIX_CHILD_MAX 6 /* a process may have 6 children */
00144 #define _POSIX_LINK_MAX 8 /* a file may have 8 links */
00145 #define _POSIX_MAX_CANON 255 /* size of the canonical input queue */
00146 #define _POSIX_MAX_INPUT 255 /* you can type 255 chars ahead */
00147 #define _POSIX_NAME_MAX 14 /* a file name may have 14 chars */
00148 #define _POSIX_NGROUPS_MAX 0 /* supplementary group IDs are optional */
00149 #define _POSIX_OPEN_MAX 16 /* a process may have 16 files open */
MINIX SOURCE CODE File: include/limits.h 3
00150 #define _POSIX_PATH_MAX 255 /* a pathname may contain 255 chars */
00151 #define _POSIX_PIPE_BUF 512 /* pipes writes of 512 bytes must be atomic */
00152 #define _POSIX_STREAM_MAX 8 /* at least 8 FILEs can be open at once */
00153 #define _POSIX_TZNAME_MAX 3 /* time zone names can be at least 3 chars */
00154 #define _POSIX_SSIZE_MAX 32767 /* read() must support 32767 byte reads */
00155
00156 /* Values actually implemented by MINIX (Tables 2-4, 2-5, 2-6, and 2-7). */
00157 /* Some of these old names had better be defined when not POSIX. */
00158 #define _NO_LIMIT 100 /* arbitrary number; limit not enforced */
00159
00160 #define NGROUPS_MAX 0 /* supplemental group IDs not available */
00161 #if _EM_WSIZE > 2
00162 #define ARG_MAX 16384 /* # bytes of args + environ for exec() */
00163 #else
00164 #define ARG_MAX 4096 /* args + environ on small machines */
00165 #endif
00166 #define CHILD_MAX _NO_LIMIT /* MINIX does not limit children */
00167 #define OPEN_MAX 20 /* # open files a process may have */
00168 #define LINK_MAX 127 /* # links a file may have */
00169 #define MAX_CANON 255 /* size of the canonical input queue */
00170 #define MAX_INPUT 255 /* size of the type-ahead buffer */
00171 #define NAME_MAX 14 /* # chars in a file name */
00172 #define PATH_MAX 255 /* # chars in a path name */
00173 #define PIPE_BUF 7168 /* # bytes in atomic write to a pipe */
00174 #define STREAM_MAX 20 /* must be the same as FOPEN_MAX in stdio.h */
00175 #define TZNAME_MAX 3 /* maximum bytes in a time zone name is 3 */
00176 #define SSIZE_MAX 32767 /* max defined byte count for read() */
00177
00178 #endif /* _POSIX_SOURCE */
00179
00180 #endif /* _LIMITS_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 */
4 File: include/errno.h MINIX SOURCE CODE
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 */
MINIX SOURCE CODE File: include/errno.h 5
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 */
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/unistd.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00400 /* The <unistd.h> header contains a few miscellaneous manifest constants. */
00401
00402 #ifndef _UNISTD_H
00403 #define _UNISTD_H
00404
00405 /* POSIX requires size_t and ssize_t in <unistd.h> and elsewhere. */
00406 #ifndef _SIZE_T
00407 #define _SIZE_T
00408 typedef unsigned int size_t;
00409 #endif
00410
00411 #ifndef _SSIZE_T
00412 #define _SSIZE_T
00413 typedef int ssize_t;
00414 #endif
剩余380页未读,继续阅读
资源评论
- adaphalc2012-06-19纯英文版的,连注释也是。
hxllonglong0505
- 粉丝: 1
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 路由与交换技术-第13讲.pptx
- 路由与交换技术-第11讲.pptx
- 路由与交换技术-第14讲.pptx
- 2006-2022年各省农民专业合作社数量数据.xlsx
- SXU-操作系统实验报告
- 价值500元的个人分发源码 带安卓系统+自动识别苹果系统
- 基于springboot的大学生就业服务平台源码(java毕业设计完整源码).zip
- 负荷需求响应模型 基于Logistic函数 采用matlab编程,考虑电价激励下的乐观响应和悲观响应,利用负荷需求响应模型得到峰转平、平转谷的实际负荷转移率,从而得到基于Logistic函数的负荷转移
- 在win32汇编环境中,在对话框里生成richedit控件
- java上传资源-CSDN博客.html上传资源-CSDN博客.html上传资源-CSDN博客.html
- HTML5实现喜庆的新年快乐网页源码.zip
- 永磁同步电机反步(backstepping)控制 1.采用非线性控制策略反步控制法,实现永磁同步电机系统的完全解耦,相比PI控制减少了系统调节参数,抗负载扰动能力明显提高; 2.提供算法对应的参考文献
- 个人存档记录,energy transportation论文实现代码,基于matlab platemo平台
- 基于springboot的电子招投标系统源码(java毕业设计完整源码).zip
- 搭建私域流量十大注意要点
- 基于springboot的高校食堂移动预约点餐系统源码(java毕业设计完整源码).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功