1 /**
2   * D header file for OpenBSD sys/sysctl.h
3   *
4   * Copyright: Copyright © 2021, The D Language Foundation
5   * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6   * Authors: Iain Buclaw
7   */
8 module core.sys.openbsd.sys.sysctl;
9 
10 version (OpenBSD):
11 extern (C):
12 nothrow:
13 @nogc:
14 
15 // Top-level identifiers
16 enum
17 {
18     CTL_UNSPEC  = 0,
19     CTL_KERN    = 1,
20     CTL_VM      = 2,
21     CTL_FS      = 3,
22     CTL_NET     = 4,
23     CTL_DEBUG   = 5,
24     CTL_HW      = 6,
25     CTL_MACHDEP = 7,
26     CTL_DDB     = 9,
27     CTL_VFS     = 10,
28     CTL_MAXID   = 11,
29 }
30 
31 // CTL_KERN identifiers
32 enum
33 {
34     KERN_OSTYPE         = 1,
35     KERN_OSRELEASE      = 2,
36     KERN_OSREV          = 3,
37     KERN_VERSION        = 4,
38     KERN_MAXVNODES      = 5,
39     KERN_MAXPROC        = 6,
40     KERN_MAXFILES       = 7,
41     KERN_ARGMAX         = 8,
42     KERN_SECURELVL      = 9,
43     KERN_HOSTNAME       = 10,
44     KERN_HOSTID         = 11,
45     KERN_CLOCKRATE      = 12,
46     KERN_PROF           = 16,
47     KERN_POSIX1         = 17,
48     KERN_NGROUPS        = 18,
49     KERN_JOB_CONTROL    = 19,
50     KERN_SAVED_IDS      = 20,
51     KERN_BOOTTIME       = 21,
52     KERN_DOMAINNAME     = 22,
53     KERN_MAXPARTITIONS  = 23,
54     KERN_RAWPARTITION   = 24,
55     KERN_MAXTHREAD      = 25,
56     KERN_NTHREADS       = 26,
57     KERN_OSVERSION      = 27,
58     KERN_SOMAXCONN      = 28,
59     KERN_SOMINCONN      = 29,
60     KERN_NOSUIDCOREDUMP = 32,
61     KERN_FSYNC          = 33,
62     KERN_SYSVMSG        = 34,
63     KERN_SYSVSEM        = 35,
64     KERN_SYSVSHM        = 36,
65     KERN_MSGBUFSIZE     = 38,
66     KERN_MALLOCSTATS    = 39,
67     KERN_CPTIME         = 40,
68     KERN_NCHSTATS       = 41,
69     KERN_FORKSTAT       = 42,
70     KERN_NSELCOLL       = 43,
71     KERN_TTY            = 44,
72     KERN_CCPU           = 45,
73     KERN_FSCALE         = 46,
74     KERN_NPROCS         = 47,
75     KERN_MSGBUF         = 48,
76     KERN_POOL           = 49,
77     KERN_STACKGAPRANDOM = 50,
78     KERN_SYSVIPC_INFO   = 51,
79     KERN_ALLOWKMEM      = 52,
80     KERN_WITNESSWATCH   = 53,
81     KERN_SPLASSERT      = 54,
82     KERN_PROC_ARGS      = 55,
83     KERN_NFILES         = 56,
84     KERN_TTYCOUNT       = 57,
85     KERN_NUMVNODES      = 58,
86     KERN_MBSTAT         = 59,
87     KERN_WITNESS        = 60,
88     KERN_SEMINFO        = 61,
89     KERN_SHMINFO        = 62,
90     KERN_INTRCNT        = 63,
91     KERN_WATCHDOG       = 64,
92     KERN_ALLOWDT        = 65,
93     KERN_PROC           = 66,
94     KERN_MAXCLUSTERS    = 67,
95     KERN_EVCOUNT        = 68,
96     KERN_TIMECOUNTER    = 69,
97     KERN_MAXLOCKSPERUID = 70,
98     KERN_CPTIME2        = 71,
99     KERN_CACHEPCT       = 72,
100     KERN_FILE           = 73,
101     KERN_WXABORT        = 74,
102     KERN_CONSDEV        = 75,
103     KERN_NETLIVELOCKS   = 76,
104     KERN_POOL_DEBUG     = 77,
105     KERN_PROC_CWD       = 78,
106     KERN_PROC_NOBROADCASTKILL = 79,
107     KERN_PROC_VMMAP     = 80,
108     KERN_GLOBAL_PTRACE  = 81,
109     KERN_CONSBUFSIZE    = 82,
110     KERN_CONSBUF        = 83,
111     KERN_AUDIO          = 84,
112     KERN_CPUSTATS       = 85,
113     KERN_PFSTATUS       = 86,
114     KERN_TIMEOUT_STATS  = 87,
115     KERN_UTC_OFFSET     = 88,
116     KERN_MAXID          = 89,
117 }
118 
119 // KERN_PROC subtypes
120 enum
121 {
122     KERN_PROC_ALL          = 0,
123     KERN_PROC_PID          = 1,
124     KERN_PROC_PGRP         = 2,
125     KERN_PROC_SESSION      = 3,
126     KERN_PROC_TTY          = 4,
127     KERN_PROC_UID          = 5,
128     KERN_PROC_RUID         = 6,
129     KERN_PROC_KTHREAD      = 7,
130     KERN_PROC_SHOW_THREADS = 0x40000000,
131 }
132 
133 // KERN_SYSVIPC_INFO subtypes
134 enum
135 {
136     KERN_SYSVIPC_MSG_INFO = 1,
137     KERN_SYSVIPC_SEM_INFO = 2,
138     KERN_SYSVIPC_SHM_INFO = 3,
139 }
140 
141 // KERN_PROC_ARGS subtypes
142 enum
143 {
144     KERN_PROC_ARGV  = 1,
145     KERN_PROC_NARGV = 2,
146     KERN_PROC_ENV   = 3,
147     KERN_PROC_NENV  = 4,
148 }
149 
150 // KERN_AUDIO subtypes
151 enum
152 {
153     KERN_AUDIO_RECORD = 1,
154     KERN_AUDIO_MAXID  = 2,
155 }
156 
157 // KERN_WITNESS
158 enum
159 {
160     KERN_WITNESS_WATCH     = 1,
161     KERN_WITNESS_LOCKTRACE = 2,
162     KERN_WITNESS_MAXID     = 3,
163 }
164 
165 // KERN_FILE
166 enum
167 {
168     KERN_FILE_BYFILE = 1,
169     KERN_FILE_BYPID  = 2,
170     KERN_FILE_BYUID  = 3,
171     KERN_FILESLOP    = 10,
172 
173     KERN_FILE_TEXT   = -1,
174     KERN_FILE_CDIR   = -2,
175     KERN_FILE_RDIR   = -3,
176     KERN_FILE_TRACE  = -4,
177 }
178 
179 // KERN_INTRCNT
180 enum
181 {
182     KERN_INTRCNT_NUM    = 1,
183     KERN_INTRCNT_CNT    = 2,
184     KERN_INTRCNT_NAME   = 3,
185     KERN_INTRCNT_VECTOR = 4,
186     KERN_INTRCNT_MAXID  = 5,
187 }
188 
189 // KERN_WATCHDOG
190 enum
191 {
192     KERN_WATCHDOG_PERIOD = 1,
193     KERN_WATCHDOG_AUTO   = 2,
194     KERN_WATCHDOG_MAXID  = 3,
195 }
196 
197 // KERN_TIMECOUNTER
198 enum
199 {
200     KERN_TIMECOUNTER_TICK             = 1,
201     KERN_TIMECOUNTER_TIMESTEPWARNINGS = 2,
202     KERN_TIMECOUNTER_HARDWARE         = 3,
203     KERN_TIMECOUNTER_CHOICE           = 4,
204     KERN_TIMECOUNTER_MAXID            = 5,
205 }
206 
207 // CTL_FS identifiers
208 enum
209 {
210     FS_POSIX        = 1,
211     FS_MAXID        = 2,
212 }
213 
214 // CTL_FS_POSIX identifiers
215 enum
216 {
217     FS_POSIX_SETUID = 1,
218     FS_POSIX_MAXID  = 2,
219 }
220 
221 // CTL_HW identifiers
222 enum
223 {
224     HW_MACHINE        = 1,
225     HW_MODEL          = 2,
226     HW_NCPU           = 3,
227     HW_BYTEORDER      = 4,
228     HW_PHYSMEM        = 5,
229     HW_USERMEM        = 6,
230     HW_PAGESIZE       = 7,
231     HW_DISKNAMES      = 8,
232     HW_DISKSTATS      = 9,
233     HW_DISKCOUNT      = 10,
234     HW_SENSORS        = 11,
235     HW_CPUSPEED       = 12,
236     HW_SETPERF        = 13,
237     HW_VENDOR         = 14,
238     HW_PRODUCT        = 15,
239     HW_VERSION        = 16,
240     HW_SERIALNO       = 17,
241     HW_UUID           = 18,
242     HW_PHYSMEM64      = 19,
243     HW_USERMEM64      = 20,
244     HW_NCPUFOUND      = 21,
245     HW_ALLOWPOWERDOWN = 22,
246     HW_PERFPOLICY     = 23,
247     HW_SMT            = 24,
248     HW_NCPUONLINE     = 25,
249     HW_MAXID          = 26,
250 }
251 
252 ///
253 int sysctl(const int*, uint, void*, size_t*, void*, size_t);