xref: /minix/minix/include/minix/sysctl.h (revision 045e0ed3)
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 #define MIB_REMOTES	3
55 
56 /* Identifiers for subnodes of MINIX_PROC. */
57 #define PROC_LIST	1
58 #define PROC_DATA	2
59 
60 /* Structure used for PROC_LIST.  Not part of the ABI.  Used by ProcFS only. */
61 struct minix_proc_list {
62 	uint32_t mpl_flags;		/* process flags (MPLF_) */
63 	pid_t mpl_pid;			/* process PID */
64 	uid_t mpl_uid;			/* effective user ID */
65 	gid_t mpl_gid;			/* effective group ID */
66 };
67 #define MPLF_IN_USE	0x01		/* process slot is in use */
68 #define MPLF_ZOMBIE	0x02		/* process is a zombie */
69 
70 /* Structure used for PROC_DATA.  Not part of the ABI.  Used by ProcFS only. */
71 struct minix_proc_data {
72 	endpoint_t mpd_endpoint;	/* process endpoint */
73 	uint32_t mpd_flags;		/* procses flags (MPDF_) */
74 	endpoint_t mpd_blocked_on;	/* blocked on other process, or NONE */
75 	uint32_t mpd_priority;		/* current process priority */
76 	uint32_t mpd_user_time;		/* user time, in clock ticks */
77 	uint32_t mpd_sys_time;		/* system time, in clock ticks */
78 	uint64_t mpd_cycles;		/* cycles spent by the process */
79 	uint64_t mpd_kipc_cycles;	/* cycles spent on kernel IPC */
80 	uint64_t mpd_kcall_cycles;	/* cycles spent on kernel calls */
81 	uint32_t mpd_nice;		/* nice value */
82 	char mpd_name[16];		/* short process name */
83 };
84 #define MPDF_SYSTEM	0x01		/* process is a system service */
85 #define MPDF_ZOMBIE	0x02		/* process is a zombie */
86 #define MPDF_RUNNABLE	0x04		/* process is runnable */
87 #define MPDF_STOPPED	0x08		/* process is stopped */
88 
89 /*
90  * Expose sysctl(2) to system services (ProcFS in particular), so as to avoid
91  * including the CTL_USER subtree handling of sysctl(3) as well.
92  */
93 int __sysctl(const int *, unsigned int, void *, size_t *, const void *,
94 	size_t);
95 
96 #endif /* !_MINIX_SYSCTL_H */
97