PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/include/minix/const.h

http://www.minix3.org/
C Header | 180 lines | 113 code | 35 blank | 32 comment | 1 complexity | d4afdcc428f8791541861104b4fe550a MD5 | raw file
Possible License(s): MIT, WTFPL, AGPL-1.0, BSD-3-Clause, GPL-3.0, LGPL-2.0, JSON, 0BSD
  1. #ifndef _MINIX_CONST_H
  2. #define _MINIX_CONST_H
  3. #include <machine/archconst.h>
  4. /* The UNUSED annotation tells the compiler or lint not to complain
  5. * about an unused variable or function parameter.
  6. *
  7. * A number of different annotations are used, depending on the
  8. * compiler or checker that is looking at the code.
  9. *
  10. * Note that some variants rename the parameter, so if you use
  11. * the parameter after all, you'll get a complaint about a missing
  12. * variable.
  13. *
  14. * You use it like this:
  15. *
  16. * void foo(int UNUSED(x)){}
  17. */
  18. #ifndef UNUSED
  19. #if defined _lint
  20. # define UNUSED(v) /*lint -e(715,818)*/ v
  21. #elif defined(__GNUC__)
  22. # define UNUSED(v) UNUSED_ ## v __attribute((unused))
  23. #elif defined __LCLINT__
  24. # define UNUSED(v) /*@unused@*/ v
  25. #else
  26. # define UNUSED(v) _UNUSED_ ## v
  27. #endif
  28. #endif
  29. #define EXTERN extern /* used in *.h files */
  30. #define TRUE 1 /* used for turning integers into Booleans */
  31. #define FALSE 0 /* used for turning integers into Booleans */
  32. #define SUPER_USER ((uid_t) 0) /* uid_t of superuser */
  33. #include <sys/null.h> /* NULL Pointer */
  34. #define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY request */
  35. #define MAPVEC_NR 64 /* max # of entries in a SYS_VUMAP request */
  36. #define NR_IOREQS 64 /* maximum number of entries in an iorequest */
  37. #define VUA_READ 0x01 /* for SYS_VUMAP: read access */
  38. #define VUA_WRITE 0x02 /* for SYS_VUMAP: write access */
  39. /* Message passing constants. */
  40. #define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
  41. /* Memory related constants. */
  42. #define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
  43. #define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
  44. #define D_OBSOLETE 1 /* proc[i].mem_map[D] is for data */
  45. #define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
  46. #define LOCAL_VM_SEG 0x1000 /* same as LOCAL_SEG, but with vm lookup */
  47. #define MEM_GRANT 3
  48. #define VIR_ADDR 1
  49. #define VM_D (LOCAL_VM_SEG | VIR_ADDR)
  50. #define VM_GRANT (LOCAL_VM_SEG | MEM_GRANT)
  51. /* Labels used to disable code sections for different reasons. */
  52. #define DEAD_CODE 0 /* unused code in normal configuration */
  53. #define FUTURE_CODE 0 /* new code to be activated + tested later */
  54. #define TEMP_CODE 1 /* active code to be removed later */
  55. /* Miscellaneous */
  56. #define BYTE 0377 /* mask for 8 bits */
  57. #define READING 0 /* copy data to user */
  58. #define WRITING 1 /* copy data from user */
  59. #define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
  60. /* Memory is allocated in clicks. */
  61. #if defined(__i386__) || defined(__arm__)
  62. #define CLICK_SIZE 4096 /* unit in which memory is allocated */
  63. #define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
  64. #else
  65. #error Unsupported arch
  66. #endif
  67. /* Click alignment macros. */
  68. #define CLICK_FLOOR(n) (((vir_bytes)(n) / CLICK_SIZE) * CLICK_SIZE)
  69. #define CLICK_CEIL(n) CLICK_FLOOR((vir_bytes)(n) + CLICK_SIZE-1)
  70. /* Sizes of memory tables. The boot monitor distinguishes three memory areas,
  71. * namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
  72. * for DOS MINIX.
  73. */
  74. #define NR_MEMS 16
  75. /* Click to byte conversions (and vice versa). */
  76. #define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
  77. #define HCLICK_SIZE 16 /* hardware segment conversion magic */
  78. #if CLICK_SIZE >= HCLICK_SIZE
  79. #define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
  80. #else
  81. #define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
  82. #endif
  83. #define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
  84. #define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
  85. #define CLICK2ABS(v) ((v) << CLICK_SHIFT)
  86. #define ABS2CLICK(a) ((a) >> CLICK_SHIFT)
  87. #define ABS -999 /* this process means absolute memory */
  88. /* Flag bits for i_mode in the inode. */
  89. #define I_TYPE 0170000 /* this field gives inode type */
  90. #define I_UNIX_SOCKET 0140000 /* unix domain socket */
  91. #define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
  92. #define I_REGULAR 0100000 /* regular file, not dir or special */
  93. #define I_BLOCK_SPECIAL 0060000 /* block special file */
  94. #define I_DIRECTORY 0040000 /* file is a directory */
  95. #define I_CHAR_SPECIAL 0020000 /* character special file */
  96. #define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
  97. #define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
  98. #define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
  99. #define I_SET_STCKY_BIT 0001000 /* sticky bit */
  100. #define ALL_MODES 0007777 /* 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. /* Some limits. */
  107. #define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
  108. #define MAX_FILE_POS ((off_t) 0x7FFFFFFF) /* largest legal file offset */
  109. #define UMAX_FILE_POS ((unsigned) 0x7FFFFFFF) /* largest legal file offset */
  110. #define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
  111. #define NO_BLOCK ((block_t) 0) /* absence of a block number */
  112. #define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
  113. #define NO_ZONE ((zone_t) 0) /* absence of a zone number */
  114. #define NO_DEV ((dev_t) 0) /* absence of a device numb */
  115. #define NO_LINK ((nlink_t) 0) /* absence of incoming links */
  116. #define INVAL_UID ((uid_t) -1) /* invalid uid value */
  117. #define INVAL_GID ((gid_t) -1) /* invalid gid value */
  118. #define SERVARNAME "cttyline"
  119. #define SERBAUDVARNAME "cttybaud"
  120. /* Bits for s_flags in the privilege structure. */
  121. #define PREEMPTIBLE 0x002 /* kernel tasks are not preemptible */
  122. #define BILLABLE 0x004 /* some processes are not billable */
  123. #define DYN_PRIV_ID 0x008 /* privilege id assigned dynamically */
  124. #define SYS_PROC 0x010 /* system processes have own priv structure */
  125. #define CHECK_IO_PORT 0x020 /* check if I/O request is allowed */
  126. #define CHECK_IRQ 0x040 /* check if IRQ can be used */
  127. #define CHECK_MEM 0x080 /* check if (VM) mem map request is allowed */
  128. #define ROOT_SYS_PROC 0x100 /* this is a root system process instance */
  129. #define VM_SYS_PROC 0x200 /* this is a vm system process instance */
  130. #define LU_SYS_PROC 0x400 /* this is a live updated sys proc instance */
  131. #define RST_SYS_PROC 0x800 /* this is a restarted sys proc instance */
  132. /* Bits for device driver flags managed by RS and VFS. */
  133. #define DRV_FORCED 0x01 /* driver is mapped even if not alive yet */
  134. /* Values for the "verbose" boot monitor variable */
  135. #define VERBOSEBOOT_QUIET 0
  136. #define VERBOSEBOOT_BASIC 1
  137. #define VERBOSEBOOT_EXTRA 2
  138. #define VERBOSEBOOT_MAX 3
  139. #define VERBOSEBOOTVARNAME "verbose"
  140. /* magic value to put in struct proc entries for sanity checks. */
  141. #define PMAGIC 0xC0FFEE1
  142. /* MINIX_KERNFLAGS flags */
  143. #define MKF_I386_INTEL_SYSENTER (1L << 0) /* SYSENTER available and supported */
  144. #define MKF_I386_AMD_SYSCALL (1L << 1) /* SYSCALL available and supported */
  145. #endif /* _MINIX_CONST_H */