const.h

Go to the documentation of this file.
00001 
00002 #ifndef CHIP
00003 #error CHIP is not defined
00004 #endif
00005 
00006 #define EXTERN        extern    /* used in *.h files */
00007 #define PRIVATE       static    /* PRIVATE x limits the scope of x */
00008 #define PUBLIC                  /* PUBLIC is the opposite of PRIVATE */
00009 #define FORWARD       static    /* some compilers require this to be 'static'*/
00010 
00011 #define TRUE               1    /* used for turning integers into Booleans */
00012 #define FALSE              0    /* used for turning integers into Booleans */
00013 
00014 #define HZ                60    /* clock freq (software settable on IBM-PC) */
00015 
00016 #define SUPER_USER (uid_t) 0    /* uid_t of superuser */
00017 
00018 #define NULL     ((void *)0)    /* null pointer */
00019 #define CPVEC_NR          16    /* max # of entries in a SYS_VCOPY request */
00020 #define CPVVEC_NR         64    /* max # of entries in a SYS_VCOPY request */
00021 #define NR_IOREQS       MIN(NR_BUFS, 64)
00022                                 /* maximum number of entries in an iorequest */
00023 
00024 /* Message passing constants. */
00025 #define MESS_SIZE (sizeof(message))     /* might need usizeof from FS here */
00026 #define NIL_MESS ((message *) 0)        /* null pointer */
00027 
00028 /* Memory related constants. */
00029 #define SEGMENT_TYPE  0xFF00    /* bit mask to get segment type */
00030 #define SEGMENT_INDEX 0x00FF    /* bit mask to get segment index */
00031 
00032 #define LOCAL_SEG     0x0000    /* flags indicating local memory segment */
00033 #define NR_LOCAL_SEGS      3    /* # local segments per process (fixed) */
00034 #define T                  0    /* proc[i].mem_map[T] is for text */
00035 #define D                  1    /* proc[i].mem_map[D] is for data */
00036 #define S                  2    /* proc[i].mem_map[S] is for stack */
00037 
00038 #define REMOTE_SEG    0x0100    /* flags indicating remote memory segment */
00039 #define NR_REMOTE_SEGS     3    /* # remote memory regions (variable) */
00040 
00041 #define BIOS_SEG      0x0200    /* flags indicating BIOS memory segment */
00042 #define NR_BIOS_SEGS       3    /* # BIOS memory regions (variable) */
00043 
00044 #define PHYS_SEG      0x0400    /* flag indicating entire physical memory */
00045 
00046 /* Labels used to disable code sections for different reasons. */
00047 #define DEAD_CODE          0    /* unused code in normal configuration */
00048 #define FUTURE_CODE        0    /* new code to be activated + tested later */
00049 #define TEMP_CODE          1    /* active code to be removed later */
00050 
00051 /* Process name length in the PM process table, including '\0'. */
00052 #define PROC_NAME_LEN   16
00053 
00054 /* Miscellaneous */
00055 #define BYTE            0377    /* mask for 8 bits */
00056 #define READING            0    /* copy data to user */
00057 #define WRITING            1    /* copy data from user */
00058 #define NO_NUM        0x8000    /* used as numerical argument to panic() */
00059 #define NIL_PTR   (char *) 0    /* generally useful expression */
00060 #define HAVE_SCATTERED_IO  1    /* scattered I/O is now standard */
00061 
00062 /* Macros. */
00063 #define MAX(a, b)   ((a) > (b) ? (a) : (b))
00064 #define MIN(a, b)   ((a) < (b) ? (a) : (b))
00065 
00066 /* Memory is allocated in clicks. */
00067 #if (CHIP == INTEL)
00068 #define CLICK_SIZE      4096    /* unit in which memory is allocated */
00069 #define CLICK_SHIFT       12    /* log2 of CLICK_SIZE */
00070 #endif
00071 
00072 #if (CHIP == SPARC) || (CHIP == M68000)
00073 #define CLICK_SIZE      4096    /* unit in which memory is allocated */
00074 #define CLICK_SHIFT       12    /* log2 of CLICK_SIZE */
00075 #endif
00076 
00077 /* Click to byte conversions (and vice versa). */
00078 #define HCLICK_SHIFT       4    /* log2 of HCLICK_SIZE */
00079 #define HCLICK_SIZE       16    /* hardware segment conversion magic */
00080 #if CLICK_SIZE >= HCLICK_SIZE
00081 #define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
00082 #else
00083 #define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
00084 #endif
00085 #define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
00086 #define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
00087 
00088 #define ABS             -999    /* this process means absolute memory */
00089 
00090 /* Flag bits for i_mode in the inode. */
00091 #define I_TYPE          0170000 /* this field gives inode type */
00092 #define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
00093 #define I_REGULAR       0100000 /* regular file, not dir or special */
00094 #define I_BLOCK_SPECIAL 0060000 /* block special file */
00095 #define I_DIRECTORY     0040000 /* file is a directory */
00096 #define I_CHAR_SPECIAL  0020000 /* character special file */
00097 #define I_NAMED_PIPE    0010000 /* named pipe (FIFO) */
00098 #define I_SET_UID_BIT   0004000 /* set effective uid_t on exec */
00099 #define I_SET_GID_BIT   0002000 /* set effective gid_t on exec */
00100 #define ALL_MODES       0006777 /* all bits for user, group and others */
00101 #define RWX_MODES       0000777 /* mode bits for RWX only */
00102 #define R_BIT           0000004 /* Rwx protection bit */
00103 #define W_BIT           0000002 /* rWx protection bit */
00104 #define X_BIT           0000001 /* rwX protection bit */
00105 #define I_NOT_ALLOC     0000000 /* this inode is free */
00106 
00107 /* Some limits. */
00108 #define MAX_BLOCK_NR  ((block_t) 077777777)     /* largest block number */
00109 #define HIGHEST_ZONE   ((zone_t) 077777777)     /* largest zone number */
00110 #define MAX_INODE_NR ((ino_t) 037777777777)     /* largest inode number */
00111 #define MAX_FILE_POS ((off_t) 037777777777)     /* largest legal file offset */
00112 
00113 #define MAX_SYM_LOOPS   8       /* how many symbolic links are recursed */
00114 
00115 #define NO_BLOCK              ((block_t) 0)     /* absence of a block number */
00116 #define NO_ENTRY                ((ino_t) 0)     /* absence of a dir entry */
00117 #define NO_ZONE                ((zone_t) 0)     /* absence of a zone number */
00118 #define NO_DEV                  ((dev_t) 0)     /* absence of a device numb */

Generated on Fri Apr 14 22:56:42 2006 for minix by  doxygen 1.4.6