fp might be NULL.
[minix.git] / include / minix / const.h
blobe4ec34f18fb6a86c6cf7cf5f02f6d52da58cabb0
2 #ifndef CHIP
3 #error CHIP is not defined
4 #endif
6 #define EXTERN extern /* used in *.h files */
7 #define PRIVATE static /* PRIVATE x limits the scope of x */
8 #define PUBLIC /* PUBLIC is the opposite of PRIVATE */
9 #define FORWARD static /* some compilers require this to be 'static'*/
11 #define TRUE 1 /* used for turning integers into Booleans */
12 #define FALSE 0 /* used for turning integers into Booleans */
14 #define DEFAULT_HZ 60 /* clock freq (software settable on IBM-PC) */
16 #define SUPER_USER (uid_t) 0 /* uid_t of superuser */
18 #define NULL ((void *)0) /* null pointer */
19 #define CPVEC_NR 16 /* max # of entries in a SYS_VCOPY request */
20 #define CPVVEC_NR 64 /* max # of entries in a SYS_VCOPY request */
21 #define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
22 #define NR_IOREQS 64
23 /* maximum number of entries in an iorequest */
25 /* Message passing constants. */
26 #define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
27 #define NIL_MESS ((message *) 0) /* null pointer */
29 /* Memory related constants. */
30 #define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
31 #define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
33 #define LOCAL_SEG 0x0000 /* flags indicating local memory segment */
34 #define NR_LOCAL_SEGS 3 /* # local segments per process (fixed) */
35 #define T 0 /* proc[i].mem_map[T] is for text */
36 #define D 1 /* proc[i].mem_map[D] is for data */
37 #define S 2 /* proc[i].mem_map[S] is for stack */
39 #define REMOTE_SEG 0x0100 /* flags indicating remote memory segment */
40 #define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
42 #define BIOS_SEG 0x0200 /* flags indicating BIOS memory segment */
43 #define NR_BIOS_SEGS 3 /* # BIOS memory regions (variable) */
45 #define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
47 #define LOCAL_VM_SEG 0x1000 /* same as LOCAL_SEG, but with vm lookup */
48 #define VM_D (LOCAL_VM_SEG | D)
49 #define VM_T (LOCAL_VM_SEG | T)
50 #define MEM_GRANT 3
51 #define VM_GRANT (LOCAL_VM_SEG | MEM_GRANT)
53 /* Labels used to disable code sections for different reasons. */
54 #define DEAD_CODE 0 /* unused code in normal configuration */
55 #define FUTURE_CODE 0 /* new code to be activated + tested later */
56 #define TEMP_CODE 1 /* active code to be removed later */
58 /* Process name length in the PM process table, including '\0'. */
59 #define PROC_NAME_LEN 16
61 /* Miscellaneous */
62 #define BYTE 0377 /* mask for 8 bits */
63 #define READING 0 /* copy data to user */
64 #define WRITING 1 /* copy data from user */
65 #define NO_NUM 0x8000 /* used as numerical argument to panic() */
66 #define NIL_PTR (char *) 0 /* generally useful expression */
67 #define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
69 /* Macros. */
70 #define MAX(a, b) ((a) > (b) ? (a) : (b))
71 #define MIN(a, b) ((a) < (b) ? (a) : (b))
73 /* Memory is allocated in clicks. */
74 #if (CHIP == INTEL)
75 #define CLICK_SIZE 4096 /* unit in which memory is allocated */
76 #define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
77 #endif
79 #if (CHIP == SPARC) || (CHIP == M68000)
80 #define CLICK_SIZE 4096 /* unit in which memory is allocated */
81 #define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
82 #endif
84 /* Sizes of memory tables. The boot monitor distinguishes three memory areas,
85 * namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
86 * for DOS MINIX.
88 #define NR_MEMS 8
91 /* Click to byte conversions (and vice versa). */
92 #define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
93 #define HCLICK_SIZE 16 /* hardware segment conversion magic */
94 #if CLICK_SIZE >= HCLICK_SIZE
95 #define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
96 #else
97 #define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
98 #endif
99 #define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
100 #define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
102 #define ABS -999 /* this process means absolute memory */
104 /* Flag bits for i_mode in the inode. */
105 #define I_TYPE 0170000 /* this field gives inode type */
106 #define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
107 #define I_REGULAR 0100000 /* regular file, not dir or special */
108 #define I_BLOCK_SPECIAL 0060000 /* block special file */
109 #define I_DIRECTORY 0040000 /* file is a directory */
110 #define I_CHAR_SPECIAL 0020000 /* character special file */
111 #define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
112 #define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
113 #define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
114 #define ALL_MODES 0006777 /* all bits for user, group and others */
115 #define RWX_MODES 0000777 /* mode bits for RWX only */
116 #define R_BIT 0000004 /* Rwx protection bit */
117 #define W_BIT 0000002 /* rWx protection bit */
118 #define X_BIT 0000001 /* rwX protection bit */
119 #define I_NOT_ALLOC 0000000 /* this inode is free */
121 /* Some limits. */
122 #define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
123 #define MAX_FILE_POS ((off_t) 0x7FFFFFFF) /* largest legal file offset */
125 #define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
127 #define NO_BLOCK ((block_t) 0) /* absence of a block number */
128 #define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
129 #define NO_ZONE ((zone_t) 0) /* absence of a zone number */
130 #define NO_DEV ((dev_t) 0) /* absence of a device numb */
132 #define SERVARNAME "cttyline"
134 /* Bits for the system property flags in boot image processes. */
135 #define PREEMPTIBLE 0x02 /* kernel tasks are not preemptible */
136 #define BILLABLE 0x04 /* some processes are not billable */
138 #define SYS_PROC 0x10 /* system processes have own priv structure */
139 #define CHECK_IO_PORT 0x20 /* check if I/O request is allowed */
140 #define CHECK_IRQ 0x40 /* check if IRQ can be used */
141 #define CHECK_MEM 0x80 /* check if (VM) mem map request is allowed */
142 #define PROC_FULLVM 0x100 /* VM sets and manages full pagetable */