opendir change: refinement
[minix.git] / servers / procfs / const.h
blob18ad75dc3613431877112c8730eeef996ac11388
1 #ifndef _PROCFS_CONST_H
2 #define _PROCFS_CONST_H
4 /* The minimum number of inodes depends on a number of factors:
5 * - Each statically created inode (e.g., /proc/hz) needs an inode. As of
6 * writing, this requires about a dozen inodes.
7 * - Deleted inodes that are still in use by VFS must be retained. For deleted
8 * directories, all their containing directories up to the root must be
9 * retained as well (to allow the user to "cd .." out). VTreeFS already takes
10 * care of this. In the case of ProcFS, only PID-based directories can be
11 * deleted; no other directories are dynamically created. These directories
12 * currently do not contain subdirectories, either. Hence, for deleted open
13 * inodes, we need to reserve at most NR_VNODES inodes in the worst case.
14 * - In order for getdents to be able to return all PID-based directories,
15 * inodes must not be recycled while generating the list of these PID-based
16 * directories. In the worst case, this means (NR_TASKS + NR_PROCS) extra
17 * inodes.
18 * The sum of these is the bare minimum for correct operation in all possible
19 * circumstances. In practice, not all open files will be deleted files in
20 * ProcFS, and not all process slots will be in use either, so the average use
21 * will be a lot less. However, setting the value too low allows for a
22 * potential denial-of-service attack by a non-root user.
24 * For the moment, we simply set this value to something reasonable.
26 #define NR_INODES ((NR_TASKS + NR_PROCS) * 4)
28 /* Various file modes. */
29 #define REG_ALL_MODE (S_IFREG | 0444) /* world-readable regular */
30 #define DIR_ALL_MODE (S_IFDIR | 0555) /* world-accessible directory */
31 #define LNK_ALL_MODE (S_IFLNK | 0777) /* symbolic link */
33 #endif /* _PROCFS_CONST_H */