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

📄 const.h

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

02900	/* Copyright (C) 1997 by Prentice-Hall, Inc.  Permission is hereby granted
02901	 * to redistribute the binary and source programs of this system for
02902	 * educational or research purposes.  For other use, written permission from
02903	 * Prentice-Hall is required.  
02904	 */
02905	
02906	#define EXTERN        extern    /* used in *.h files */
02907	#define PRIVATE       static    /* PRIVATE x limits the scope of x */
02908	#define PUBLIC                  /* PUBLIC is the opposite of PRIVATE */
02909	#define FORWARD       static    /* some compilers require this to be 'static'*/
02910	
02911	#define TRUE               1    /* used for turning integers into Booleans */
02912	#define FALSE              0    /* used for turning integers into Booleans */
02913	
02914	#define HZ                60    /* clock freq (software settable on IBM-PC) */
02915	#define BLOCK_SIZE      1024    /* # bytes in a disk block */
02916	#define SUPER_USER (uid_t) 0    /* uid_t of superuser */
02917	
02918	#define MAJOR              8    /* major device = (dev>>MAJOR) & 0377 */
02919	#define MINOR              0    /* minor device = (dev>>MINOR) & 0377 */
02920	
02921	#define NULL     ((void *)0)    /* null pointer */
02922	#define CPVEC_NR          16    /* max # of entries in a SYS_VCOPY request */
02923	#define NR_IOREQS       MIN(NR_BUFS, 64)
02924	                                /* maximum number of entries in an iorequest */
02925	
02926	#define NR_SEGS            3    /* # segments per process */
02927	#define T                  0    /* proc[i].mem_map[T] is for text */
02928	#define D                  1    /* proc[i].mem_map[D] is for data */
02929	#define S                  2    /* proc[i].mem_map[S] is for stack */
02930	
02931	/* Process numbers of some important processes. */
02932	#define MM_PROC_NR         0    /* process number of memory manager */
02933	#define FS_PROC_NR         1    /* process number of file system */
02934	#define INET_PROC_NR       2    /* process number of the TCP/IP server */
02935	#define INIT_PROC_NR    (INET_PROC_NR + ENABLE_NETWORKING)
02936	                                /* init -- the process that goes multiuser */
02937	#define LOW_USER        (INET_PROC_NR + ENABLE_NETWORKING)
02938	                                /* first user not part of operating system */
02939	
02940	/* Miscellaneous */
02941	#define BYTE            0377    /* mask for 8 bits */
02942	#define READING            0    /* copy data to user */
02943	#define WRITING            1    /* copy data from user */
02944	#define NO_NUM        0x8000    /* used as numerical argument to panic() */
02945	#define NIL_PTR   (char *) 0    /* generally useful expression */
02946	#define HAVE_SCATTERED_IO  1    /* scattered I/O is now standard */
02947	
02948	/* Macros. */
02949	#define MAX(a, b)   ((a) > (b) ? (a) : (b))
02950	#define MIN(a, b)   ((a) < (b) ? (a) : (b))
02951	
02952	/* Number of tasks. */
02953	#define NR_TASKS        (9 + ENABLE_WINI + ENABLE_SCSI + ENABLE_CDROM \
02954	                        + ENABLE_NETWORKING + 2 * ENABLE_AUDIO)
02955	
02956	/* Memory is allocated in clicks. */
02957	#if (CHIP == INTEL)
02958	#define CLICK_SIZE       256    /* unit in which memory is allocated */
02959	#define CLICK_SHIFT        8    /* log2 of CLICK_SIZE */
02960	#endif
02961	
02962	#if (CHIP == SPARC) || (CHIP == M68000)
02963	#define CLICK_SIZE      4096    /* unit in which memory is alocated */
02964	#define CLICK_SHIFT       12    /* 2log of CLICK_SIZE */
02965	#endif
02966	
02967	#define click_to_round_k(n) \
02968	        ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
02969	#if CLICK_SIZE < 1024
02970	#define k_to_click(n) ((n) * (1024 / CLICK_SIZE))
02971	#else
02972	#define k_to_click(n) ((n) / (CLICK_SIZE / 1024))
02973	#endif
02974	
02975	#define ABS             -999    /* this process means absolute memory */
02976	
02977	/* Flag bits for i_mode in the inode. */
02978	#define I_TYPE          0170000 /* this field gives inode type */
02979	#define I_REGULAR       0100000 /* regular file, not dir or special */
02980	#define I_BLOCK_SPECIAL 0060000 /* block special file */
02981	#define I_DIRECTORY     0040000 /* file is a directory */
02982	#define I_CHAR_SPECIAL  0020000 /* character special file */
02983	#define I_NAMED_PIPE    0010000 /* named pipe (FIFO) */
02984	#define I_SET_UID_BIT   0004000 /* set effective uid_t on exec */
02985	#define I_SET_GID_BIT   0002000 /* set effective gid_t on exec */
02986	#define ALL_MODES       0006777 /* all bits for user, group and others */
02987	#define RWX_MODES       0000777 /* mode bits for RWX only */
02988	#define R_BIT           0000004 /* Rwx protection bit */
02989	#define W_BIT           0000002 /* rWx protection bit */
02990	#define X_BIT           0000001 /* rwX protection bit */
02991	#define I_NOT_ALLOC     0000000 /* this inode is free */
02992	
02993	/* Some limits. */
02994	#define MAX_BLOCK_NR  ((block_t) 077777777)     /* largest block number */
02995	#define HIGHEST_ZONE   ((zone_t) 077777777)     /* largest zone number */
02996	#define MAX_INODE_NR      ((ino_t) 0177777)     /* largest inode number */
02997	#define MAX_FILE_POS ((off_t) 037777777777)     /* largest legal file offset */
02998	
02999	#define NO_BLOCK              ((block_t) 0)     /* absence of a block number */
03000	#define NO_ENTRY                ((ino_t) 0)     /* absence of a dir entry */
03001	#define NO_ZONE                ((zone_t) 0)     /* absence of a zone number */
03002	#define NO_DEV                  ((dev_t) 0)     /* absence of a device numb */

⌨️ 快捷键说明

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