xref: /minix/minix/include/minix/sysctl.h (revision fb4fbf7a)
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 
32 /*
33  * These identifiers, under MINIX_TEST, are used by test87 to test the MIB
34  * service.
35  */
36 #define TEST_INT	0
37 #define TEST_BOOL	1
38 #define TEST_QUAD	2
39 #define TEST_STRING	3
40 #define TEST_STRUCT	4
41 #define TEST_PRIVATE	5
42 #define TEST_ANYWRITE	6
43 #define TEST_DYNAMIC	7
44 #define TEST_SECRET	8
45 #define TEST_PERM	9
46 #define TEST_DESTROY1	10
47 #define TEST_DESTROY2	11
48 
49 #define SECRET_VALUE	0
50 
51 /* Identifiers for subnodes of MINIX_MIB. */
52 #define MIB_NODES	1
53 #define MIB_OBJECTS	2
54 
55 /* Identifiers for subnodes of MINIX_PROC. */
56 #define PROC_LIST	1
57 #define PROC_DATA	2
58 
59 /* Structure used for PROC_LIST.  Not part of the ABI.  Used by ProcFS only. */
60 struct minix_proc_list {
61 	uint32_t mpl_flags;		/* process flags (MPLF_) */
62 	pid_t mpl_pid;			/* process PID */
63 	uid_t mpl_uid;			/* effective user ID */
64 	gid_t mpl_gid;			/* effective group ID */
65 };
66 #define MPLF_IN_USE	0x01		/* process slot is in use */
67 #define MPLF_ZOMBIE	0x02		/* process is a zombie */
68 
69 /* Structure used for PROC_DATA.  Not part of the ABI.  Used by ProcFS only. */
70 struct minix_proc_data {
71 	endpoint_t mpd_endpoint;	/* process endpoint */
72 	uint32_t mpd_flags;		/* procses flags (MPDF_) */
73 	endpoint_t mpd_blocked_on;	/* blocked on other process, or NONE */
74 	uint32_t mpd_priority;		/* current process priority */
75 	uint32_t mpd_user_time;		/* user time, in clock ticks */
76 	uint32_t mpd_sys_time;		/* system time, in clock ticks */
77 	uint64_t mpd_cycles;		/* cycles spent by the process */
78 	uint64_t mpd_kipc_cycles;	/* cycles spent on kernel IPC */
79 	uint64_t mpd_kcall_cycles;	/* cycles spent on kernel calls */
80 	uint32_t mpd_nice;		/* nice value */
81 	char mpd_name[16];		/* short process name */
82 };
83 #define MPDF_SYSTEM	0x01		/* process is a system service */
84 #define MPDF_ZOMBIE	0x02		/* process is a zombie */
85 #define MPDF_RUNNABLE	0x04		/* process is runnable */
86 #define MPDF_STOPPED	0x08		/* process is stopped */
87 
88 /*
89  * Expose sysctl(2) to system services (ProcFS in particular), so as to avoid
90  * including the CTL_USER subtree handling of sysctl(3) as well.
91  */
92 int __sysctl(const int *, unsigned int, void *, size_t *, const void *,
93 	size_t);
94 
95 #endif /* !_MINIX_SYSCTL_H */
96