source: branches/minix3-book/include/minix/const.h@ 4

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

Importazione sorgenti libro

File size: 5.4 KB
Line 
1/* Copyright (C) 2001 by Prentice-Hall, Inc. See the copyright notice in
2 * the file /usr/src/LICENSE.
3 */
4
5#ifndef CHIP
6#error CHIP is not defined
7#endif
8
9#define EXTERN extern /* used in *.h files */
10#define PRIVATE static /* PRIVATE x limits the scope of x */
11#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
12#define FORWARD static /* some compilers require this to be 'static'*/
13
14#define TRUE 1 /* used for turning integers into Booleans */
15#define FALSE 0 /* used for turning integers into Booleans */
16
17#define HZ 60 /* clock freq (software settable on IBM-PC) */
18
19#define SUPER_USER (uid_t) 0 /* uid_t of superuser */
20
21/* Devices. */
22#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
23#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
24
25#define NULL ((void *)0) /* null pointer */
26#define CPVEC_NR 16 /* max # of entries in a SYS_VCOPY request */
27#define CPVVEC_NR 64 /* max # of entries in a SYS_VCOPY request */
28#define NR_IOREQS MIN(NR_BUFS, 64)
29 /* maximum number of entries in an iorequest */
30
31/* Message passing constants. */
32#define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
33#define NIL_MESS ((message *) 0) /* null pointer */
34
35/* Memory related constants. */
36#define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
37#define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
38
39#define LOCAL_SEG 0x0000 /* flags indicating local memory segment */
40#define NR_LOCAL_SEGS 3 /* # local segments per process (fixed) */
41#define T 0 /* proc[i].mem_map[T] is for text */
42#define D 1 /* proc[i].mem_map[D] is for data */
43#define S 2 /* proc[i].mem_map[S] is for stack */
44
45#define REMOTE_SEG 0x0100 /* flags indicating remote memory segment */
46#define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
47
48#define BIOS_SEG 0x0200 /* flags indicating BIOS memory segment */
49#define NR_BIOS_SEGS 3 /* # BIOS memory regions (variable) */
50
51#define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
52
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 */
57
58/* Process name length in the PM process table, including '\0'. */
59#define PROC_NAME_LEN 16
60
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 */
68
69/* Macros. */
70#define MAX(a, b) ((a) > (b) ? (a) : (b))
71#define MIN(a, b) ((a) < (b) ? (a) : (b))
72
73/* Memory is allocated in clicks. */
74#if (CHIP == INTEL)
75#define CLICK_SIZE 1024 /* unit in which memory is allocated */
76#define CLICK_SHIFT 10 /* log2 of CLICK_SIZE */
77#endif
78
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
83
84/* Click to byte conversions (and vice versa). */
85#define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
86#define HCLICK_SIZE 16 /* hardware segment conversion magic */
87#if CLICK_SIZE >= HCLICK_SIZE
88#define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
89#else
90#define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
91#endif
92#define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
93#define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
94
95#define ABS -999 /* this process means absolute memory */
96
97/* Flag bits for i_mode in the inode. */
98#define I_TYPE 0170000 /* this field gives inode type */
99#define I_REGULAR 0100000 /* regular file, not dir or special */
100#define I_BLOCK_SPECIAL 0060000 /* block special file */
101#define I_DIRECTORY 0040000 /* file is a directory */
102#define I_CHAR_SPECIAL 0020000 /* character special file */
103#define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
104#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
105#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
106#define ALL_MODES 0006777 /* all bits for user, group and others */
107#define RWX_MODES 0000777 /* mode bits for RWX only */
108#define R_BIT 0000004 /* Rwx protection bit */
109#define W_BIT 0000002 /* rWx protection bit */
110#define X_BIT 0000001 /* rwX protection bit */
111#define I_NOT_ALLOC 0000000 /* this inode is free */
112
113/* Flag used only in flags argument of dev_open. */
114#define RO_BIT 0200000 /* Open device readonly; fail if writable. */
115
116/* Some limits. */
117#define MAX_BLOCK_NR ((block_t) 077777777) /* largest block number */
118#define HIGHEST_ZONE ((zone_t) 077777777) /* largest zone number */
119#define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
120#define MAX_FILE_POS ((off_t) 037777777777) /* largest legal file offset */
121
122#define NO_BLOCK ((block_t) 0) /* absence of a block number */
123#define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
124#define NO_ZONE ((zone_t) 0) /* absence of a zone number */
125#define NO_DEV ((dev_t) 0) /* absence of a device numb */
Note: See TracBrowser for help on using the repository browser.