source: trunk/minix/include/minix/const.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 5.1 KB
Line 
1
2#ifndef CHIP
3#error CHIP is not defined
4#endif
5
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'*/
10
11#define TRUE 1 /* used for turning integers into Booleans */
12#define FALSE 0 /* used for turning integers into Booleans */
13
14#define HZ 60 /* clock freq (software settable on IBM-PC) */
15
16#define SUPER_USER (uid_t) 0 /* uid_t of superuser */
17
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 NR_IOREQS MIN(NR_BUFS, 64)
22 /* maximum number of entries in an iorequest */
23
24/* Message passing constants. */
25#define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
26#define NIL_MESS ((message *) 0) /* null pointer */
27
28/* Memory related constants. */
29#define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
30#define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
31
32#define LOCAL_SEG 0x0000 /* flags indicating local memory segment */
33#define NR_LOCAL_SEGS 3 /* # local segments per process (fixed) */
34#define T 0 /* proc[i].mem_map[T] is for text */
35#define D 1 /* proc[i].mem_map[D] is for data */
36#define S 2 /* proc[i].mem_map[S] is for stack */
37
38#define REMOTE_SEG 0x0100 /* flags indicating remote memory segment */
39#define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
40
41#define BIOS_SEG 0x0200 /* flags indicating BIOS memory segment */
42#define NR_BIOS_SEGS 3 /* # BIOS memory regions (variable) */
43
44#define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
45
46/* Labels used to disable code sections for different reasons. */
47#define DEAD_CODE 0 /* unused code in normal configuration */
48#define FUTURE_CODE 0 /* new code to be activated + tested later */
49#define TEMP_CODE 1 /* active code to be removed later */
50
51/* Process name length in the PM process table, including '\0'. */
52#define PROC_NAME_LEN 16
53
54/* Miscellaneous */
55#define BYTE 0377 /* mask for 8 bits */
56#define READING 0 /* copy data to user */
57#define WRITING 1 /* copy data from user */
58#define NO_NUM 0x8000 /* used as numerical argument to panic() */
59#define NIL_PTR (char *) 0 /* generally useful expression */
60#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
61
62/* Macros. */
63#define MAX(a, b) ((a) > (b) ? (a) : (b))
64#define MIN(a, b) ((a) < (b) ? (a) : (b))
65
66/* Memory is allocated in clicks. */
67#if (CHIP == INTEL)
68#define CLICK_SIZE 4096 /* unit in which memory is allocated */
69#define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
70#endif
71
72#if (CHIP == SPARC) || (CHIP == M68000)
73#define CLICK_SIZE 4096 /* unit in which memory is allocated */
74#define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
75#endif
76
77/* Click to byte conversions (and vice versa). */
78#define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
79#define HCLICK_SIZE 16 /* hardware segment conversion magic */
80#if CLICK_SIZE >= HCLICK_SIZE
81#define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
82#else
83#define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
84#endif
85#define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
86#define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
87
88#define ABS -999 /* this process means absolute memory */
89
90/* Flag bits for i_mode in the inode. */
91#define I_TYPE 0170000 /* this field gives inode type */
92#define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
93#define I_REGULAR 0100000 /* regular file, not dir or special */
94#define I_BLOCK_SPECIAL 0060000 /* block special file */
95#define I_DIRECTORY 0040000 /* file is a directory */
96#define I_CHAR_SPECIAL 0020000 /* character special file */
97#define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
98#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
99#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
100#define ALL_MODES 0006777 /* all bits for user, group and others */
101#define RWX_MODES 0000777 /* mode bits for RWX only */
102#define R_BIT 0000004 /* Rwx protection bit */
103#define W_BIT 0000002 /* rWx protection bit */
104#define X_BIT 0000001 /* rwX protection bit */
105#define I_NOT_ALLOC 0000000 /* this inode is free */
106
107/* Some limits. */
108#define MAX_BLOCK_NR ((block_t) 077777777) /* largest block number */
109#define HIGHEST_ZONE ((zone_t) 077777777) /* largest zone number */
110#define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
111#define MAX_FILE_POS ((off_t) 037777777777) /* largest legal file offset */
112
113#define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
114
115#define NO_BLOCK ((block_t) 0) /* absence of a block number */
116#define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
117#define NO_ZONE ((zone_t) 0) /* absence of a zone number */
118#define NO_DEV ((dev_t) 0) /* absence of a device numb */
Note: See TracBrowser for help on using the repository browser.