xref: /minix3/minix/include/minix/sysctl.h (revision ef8d499e2d2af900e9b2ab297171d7b088652482)
1 #ifndef _MINIX_SYSCTL_H
2 #define _MINIX_SYSCTL_H
3 
4 /* MINIX3-specific sysctl(2) extensions. */
5 
6 #include <sys/sysctl.h>
7 #include <minix/endpoint.h>
8 
9 /* Special values. */
10 #define SYSCTL_NODE_FN	((sysctlfn)0x1)		/* node is function-driven */
11 
12 /*
13  * The top-level MINIX3 identifier is quite a bit beyond the last top-level
14  * identifier in use by NetBSD, because NetBSD may add more later, and we do
15  * not want conflicts: this definition is part of the MINIX3 ABI.
16  */
17 #define CTL_MINIX	32
18 
19 #if CTL_MAXID > CTL_MINIX
20 #error "CTL_MAXID has grown too large!"
21 #endif
22 
23 /*
24  * The identifiers below follow the standard sysctl naming scheme, which means
25  * care should be taken not to introduce clashes with other definitions
26  * elsewhere.  On the upside, not many places need to include this header file.
27  */
28 #define MINIX_TEST	0
29 #define MINIX_MIB	1
30 #define MINIX_PROC	2
31 #define MINIX_LWIP	3
32 
33 /*
34  * These identifiers, under MINIX_TEST, are used by test87 to test the MIB
35  * service.
36  */
37 #define TEST_INT	0
38 #define TEST_BOOL	1
39 #define TEST_QUAD	2
40 #define TEST_STRING	3
41 #define TEST_STRUCT	4
42 #define TEST_PRIVATE	5
43 #define TEST_ANYWRITE	6
44 #define TEST_DYNAMIC	7
45 #define TEST_SECRET	8
46 #define TEST_PERM	9
47 #define TEST_DESTROY1	10
48 #define TEST_DESTROY2	11
49 
50 #define SECRET_VALUE	0
51 
52 /* Identifiers for subnodes of MINIX_MIB. */
53 #define MIB_NODES	1
54 #define MIB_OBJECTS	2
55 #define MIB_REMOTES	3
56 
57 /* Identifiers for subnodes of MINIX_PROC. */
58 #define PROC_LIST	1
59 #define PROC_DATA	2
60 
61 /* Structure used for PROC_LIST.  Not part of the ABI.  Used by ProcFS only. */
62 struct minix_proc_list {
63 	uint32_t mpl_flags;		/* process flags (MPLF_) */
64 	pid_t mpl_pid;			/* process PID */
65 	uid_t mpl_uid;			/* effective user ID */
66 	gid_t mpl_gid;			/* effective group ID */
67 };
68 #define MPLF_IN_USE	0x01		/* process slot is in use */
69 #define MPLF_ZOMBIE	0x02		/* process is a zombie */
70 
71 /* Structure used for PROC_DATA.  Not part of the ABI.  Used by ProcFS only. */
72 struct minix_proc_data {
73 	endpoint_t mpd_endpoint;	/* process endpoint */
74 	uint32_t mpd_flags;		/* procses flags (MPDF_) */
75 	endpoint_t mpd_blocked_on;	/* blocked on other process, or NONE */
76 	uint32_t mpd_priority;		/* current process priority */
77 	uint32_t mpd_user_time;		/* user time, in clock ticks */
78 	uint32_t mpd_sys_time;		/* system time, in clock ticks */
79 	uint64_t mpd_cycles;		/* cycles spent by the process */
80 	uint64_t mpd_kipc_cycles;	/* cycles spent on kernel IPC */
81 	uint64_t mpd_kcall_cycles;	/* cycles spent on kernel calls */
82 	uint32_t mpd_nice;		/* nice value */
83 	char mpd_name[16];		/* short process name */
84 };
85 #define MPDF_SYSTEM	0x01		/* process is a system service */
86 #define MPDF_ZOMBIE	0x02		/* process is a zombie */
87 #define MPDF_RUNNABLE	0x04		/* process is runnable */
88 #define MPDF_STOPPED	0x08		/* process is stopped */
89 
90 /*
91  * Expose sysctl(2) to system services (ProcFS in particular), so as to avoid
92  * including the CTL_USER subtree handling of sysctl(3) as well.
93  */
94 int __sysctl(const int *, unsigned int, void *, size_t *, const void *,
95 	size_t);
96 
97 #endif /* !_MINIX_SYSCTL_H */
98