5 #error CHIP is not defined
8 /* The UNUSED annotation tells the compiler or lint not to complain
9 * about an unused variable or function parameter.
11 * A number of different annotations are used, depending on the
12 * compiler or checker that is looking at the code.
14 * Note that some variants rename the parameter, so if you use
15 * the parameter after all, you'll get a complaint about a missing
18 * You use it like this:
20 * void foo(int UNUSED(x)){}
25 # define UNUSED(v) UNUSED_ ## v __attribute((unused))
27 # define UNUSED(v) /*lint -e(715)*/ v
28 #elif defined __LCLINT__
29 # define UNUSED(v) /*@unused@*/ v
31 # define UNUSED(v) _UNUSED_ ## v
35 #define EXTERN extern /* used in *.h files */
36 #define PRIVATE static /* PRIVATE x limits the scope of x */
37 #define PUBLIC /* PUBLIC is the opposite of PRIVATE */
38 #define FORWARD static /* some compilers require this to be 'static'*/
40 #define TRUE 1 /* used for turning integers into Booleans */
41 #define FALSE 0 /* used for turning integers into Booleans */
43 #define DEFAULT_HZ 60 /* clock freq (software settable on IBM-PC) */
45 #define SUPER_USER ((uid_t) 0) /* uid_t of superuser */
47 #define NULL ((void *)0) /* null pointer */
48 #define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
50 /* maximum number of entries in an iorequest */
52 /* Message passing constants. */
53 #define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
54 #define NIL_MESS ((message *) 0) /* null pointer */
56 /* Memory related constants. */
57 #define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
58 #define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
60 #define LOCAL_SEG 0x0000 /* flags indicating local memory segment */
61 #define NR_LOCAL_SEGS 3 /* # local segments per process (fixed) */
62 #define T 0 /* proc[i].mem_map[T] is for text */
63 #define D 1 /* proc[i].mem_map[D] is for data */
64 #define S 2 /* proc[i].mem_map[S] is for stack */
66 #define REMOTE_SEG 0x0100 /* flags indicating remote memory segment */
67 #define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
69 #define BIOS_SEG 0x0200 /* flags indicating BIOS memory segment */
70 #define NR_BIOS_SEGS 3 /* # BIOS memory regions (variable) */
72 #define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
74 #define LOCAL_VM_SEG 0x1000 /* same as LOCAL_SEG, but with vm lookup */
75 #define VM_D (LOCAL_VM_SEG | D)
76 #define VM_T (LOCAL_VM_SEG | T)
78 #define VM_GRANT (LOCAL_VM_SEG | MEM_GRANT)
80 /* Labels used to disable code sections for different reasons. */
81 #define DEAD_CODE 0 /* unused code in normal configuration */
82 #define FUTURE_CODE 0 /* new code to be activated + tested later */
83 #define TEMP_CODE 1 /* active code to be removed later */
85 /* Process name length in the PM process table, including '\0'. */
86 #define PROC_NAME_LEN 16
89 #define BYTE 0377 /* mask for 8 bits */
90 #define READING 0 /* copy data to user */
91 #define WRITING 1 /* copy data from user */
92 #define NIL_PTR (char *) 0 /* generally useful expression */
93 #define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
96 #define MAX(a, b) ((a) > (b) ? (a) : (b))
97 #define MIN(a, b) ((a) < (b) ? (a) : (b))
99 /* Memory is allocated in clicks. */
101 #define CLICK_SIZE 4096 /* unit in which memory is allocated */
102 #define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
105 #if (CHIP == SPARC) || (CHIP == M68000)
106 #define CLICK_SIZE 4096 /* unit in which memory is allocated */
107 #define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
110 /* Click alignment macros. */
111 #define CLICK_FLOOR(n) (((vir_bytes)(n) / CLICK_SIZE) * CLICK_SIZE)
112 #define CLICK_CEIL(n) CLICK_FLOOR((vir_bytes)(n) + CLICK_SIZE-1)
114 /* Sizes of memory tables. The boot monitor distinguishes three memory areas,
115 * namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
121 /* Click to byte conversions (and vice versa). */
122 #define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
123 #define HCLICK_SIZE 16 /* hardware segment conversion magic */
124 #if CLICK_SIZE >= HCLICK_SIZE
125 #define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
127 #define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
129 #define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
130 #define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
132 #define ABS -999 /* this process means absolute memory */
134 /* Flag bits for i_mode in the inode. */
135 #define I_TYPE 0170000 /* this field gives inode type */
136 #define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
137 #define I_REGULAR 0100000 /* regular file, not dir or special */
138 #define I_BLOCK_SPECIAL 0060000 /* block special file */
139 #define I_DIRECTORY 0040000 /* file is a directory */
140 #define I_CHAR_SPECIAL 0020000 /* character special file */
141 #define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
142 #define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
143 #define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
144 #define I_SET_STCKY_BIT 0001000 /* sticky bit */
145 #define ALL_MODES 0007777 /* all bits for user, group and others */
146 #define RWX_MODES 0000777 /* mode bits for RWX only */
147 #define R_BIT 0000004 /* Rwx protection bit */
148 #define W_BIT 0000002 /* rWx protection bit */
149 #define X_BIT 0000001 /* rwX protection bit */
150 #define I_NOT_ALLOC 0000000 /* this inode is free */
153 #define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
154 #define MAX_FILE_POS ((off_t) 0x7FFFFFFF) /* largest legal file offset */
156 #define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
158 #define NO_BLOCK ((block_t) 0) /* absence of a block number */
159 #define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
160 #define NO_ZONE ((zone_t) 0) /* absence of a zone number */
161 #define NO_DEV ((dev_t) 0) /* absence of a device numb */
163 #define SERVARNAME "cttyline"
165 /* Bits for the system property flags in boot image processes. */
166 #define PROC_FULLVM 0x100 /* VM sets and manages full pagetable */
168 /* Bits for s_flags in the privilege structure. */
169 #define PREEMPTIBLE 0x02 /* kernel tasks are not preemptible */
170 #define BILLABLE 0x04 /* some processes are not billable */
171 #define DYN_PRIV_ID 0x08 /* privilege id assigned dynamically */
173 #define SYS_PROC 0x10 /* system processes have own priv structure */
174 #define CHECK_IO_PORT 0x20 /* check if I/O request is allowed */
175 #define CHECK_IRQ 0x40 /* check if IRQ can be used */
176 #define CHECK_MEM 0x80 /* check if (VM) mem map request is allowed */
178 /* Bits for device driver flags managed by RS and VFS. */
179 #define DRV_FORCED 0x01 /* driver is mapped even if not alive yet */
181 /* Values for the "verbose" boot monitor variable */
182 #define VERBOSEBOOT_QUIET 0
183 #define VERBOSEBOOT_BASIC 1
184 #define VERBOSEBOOT_MAX 2
185 #define VERBOSEBOOTVARNAME "verbose"
187 #endif /* _MINIX_CONST_H */