1 /**
2   * D header file for FreeBSD 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.freebsd.sys.sysctl;
9 
10 version (FreeBSD):
11 extern (C):
12 nothrow:
13 @nogc:
14 
15 // Top-level identifiers
16 enum
17 {
18     CTL_SYSCTL   = 0,
19     CTL_KERN     = 1,
20     CTL_VM       = 2,
21     CTL_VFS      = 3,
22     CTL_NET      = 4,
23     CTL_DEBUG    = 5,
24     CTL_HW       = 6,
25     CTL_MACHDEP  = 7,
26     CTL_USER     = 8,
27     CTL_P1003_1B = 9,
28 }
29 
30 // CTL_SYSCTL identifiers
31 enum
32 {
33     CTL_SYSCTL_DEBUG    = 0,
34     CTL_SYSCTL_NAME     = 1,
35     CTL_SYSCTL_NEXT     = 2,
36     CTL_SYSCTL_NAME2OID = 3,
37     CTL_SYSCTL_OIDFMT   = 4,
38     CTL_SYSCTL_OIDDESCR = 5,
39     CTL_SYSCTL_OIDLABEL = 6,
40 }
41 
42 // CTL_KERN identifiers
43 enum
44 {
45     KERN_OSTYPE          = 1,
46     KERN_OSRELEASE       = 2,
47     KERN_OSREV           = 3,
48     KERN_VERSION         = 4,
49     KERN_MAXVNODES       = 5,
50     KERN_MAXPROC         = 6,
51     KERN_MAXFILES        = 7,
52     KERN_ARGMAX          = 8,
53     KERN_SECURELVL       = 9,
54     KERN_HOSTNAME        = 10,
55     KERN_HOSTID          = 11,
56     KERN_CLOCKRATE       = 12,
57     KERN_VNODE           = 13,
58     KERN_PROC            = 14,
59     KERN_FILE            = 15,
60     KERN_PROF            = 16,
61     KERN_POSIX1          = 17,
62     KERN_NGROUPS         = 18,
63     KERN_JOB_CONTROL     = 19,
64     KERN_SAVED_IDS       = 20,
65     KERN_BOOTTIME        = 21,
66     KERN_NISDOMAINNAME   = 22,
67     KERN_UPDATEINTERVAL  = 23,
68     KERN_OSRELDATE       = 24,
69     KERN_NTP_PLL         = 25,
70     KERN_BOOTFILE        = 26,
71     KERN_MAXFILESPERPROC = 27,
72     KERN_MAXPROCPERUID   = 28,
73     KERN_DUMPDEV         = 29,
74     KERN_IPC             = 30,
75     KERN_DUMMY           = 31,
76     KERN_PS_STRINGS      = 32,
77     KERN_USRSTACK        = 33,
78     KERN_LOGSIGEXIT      = 34,
79     KERN_IOV_MAX         = 35,
80     KERN_HOSTUUID        = 36,
81     KERN_ARND            = 37,
82     KERN_MAXPHYS         = 38,
83 }
84 
85 // KERN_PROC subtypes
86 enum
87 {
88     KERN_PROC_ALL        = 0,
89     KERN_PROC_PID        = 1,
90     KERN_PROC_PGRP       = 2,
91     KERN_PROC_SESSION    = 3,
92     KERN_PROC_TTY        = 4,
93     KERN_PROC_UID        = 5,
94     KERN_PROC_RUID       = 6,
95     KERN_PROC_ARGS       = 7,
96     KERN_PROC_PROC       = 8,
97     KERN_PROC_SV_NAME    = 9,
98     KERN_PROC_RGID       = 10,
99     KERN_PROC_GID        = 11,
100     KERN_PROC_PATHNAME   = 12,
101     KERN_PROC_OVMMAP     = 13,
102     KERN_PROC_OFILEDESC  = 14,
103     KERN_PROC_KSTACK     = 15,
104     KERN_PROC_INC_THREAD = 0x10,
105     KERN_PROC_VMMAP      = 32,
106     KERN_PROC_FILEDESC   = 33,
107     KERN_PROC_GROUPS     = 34,
108     KERN_PROC_ENV        = 35,
109     KERN_PROC_AUXV       = 36,
110     KERN_PROC_RLIMIT     = 37,
111     KERN_PROC_PS_STRINGS = 38,
112     KERN_PROC_UMASK      = 39,
113     KERN_PROC_OSREL      = 40,
114     KERN_PROC_SIGTRAMP   = 41,
115     KERN_PROC_CWD        = 42,
116     KERN_PROC_NFDS       = 43,
117 }
118 
119 // KERN_IPC identifiers
120 enum
121 {
122     KIPC_MAXSOCKBUF        = 1,
123     KIPC_SOCKBUF_WASTE     = 2,
124     KIPC_SOMAXCONN         = 3,
125     KIPC_MAX_LINKHDR       = 4,
126     KIPC_MAX_PROTOHDR      = 5,
127     KIPC_MAX_HDR           = 6,
128     KIPC_MAX_DATALEN       = 7,
129 }
130 
131 // CTL_HW identifiers
132 enum
133 {
134     HW_MACHINE      = 1,
135     HW_MODEL        = 2,
136     HW_NCPU         = 3,
137     HW_BYTEORDER    = 4,
138     HW_PHYSMEM      = 5,
139     HW_USERMEM      = 6,
140     HW_PAGESIZE     = 7,
141     HW_DISKNAMES    = 8,
142     HW_DISKSTATS    = 9,
143     HW_FLOATINGPT   = 10,
144     HW_MACHINE_ARCH = 11,
145     HW_REALMEM      = 12,
146 }
147 
148 // CTL_USER identifiers
149 enum
150 {
151     USER_CS_PATH           = 1,
152     USER_BC_BASE_MAX       = 2,
153     USER_BC_DIM_MAX        = 3,
154     USER_BC_SCALE_MAX      = 4,
155     USER_BC_STRING_MAX     = 5,
156     USER_COLL_WEIGHTS_MAX  = 6,
157     USER_EXPR_NEST_MAX     = 7,
158     USER_LINE_MAX          = 8,
159     USER_RE_DUP_MAX        = 9,
160     USER_POSIX2_VERSION    = 10,
161     USER_POSIX2_C_BIND     = 11,
162     USER_POSIX2_C_DEV      = 12,
163     USER_POSIX2_CHAR_TERM  = 13,
164     USER_POSIX2_FORT_DEV   = 14,
165     USER_POSIX2_FORT_RUN   = 15,
166     USER_POSIX2_LOCALEDEF  = 16,
167     USER_POSIX2_SW_DEV     = 17,
168     USER_POSIX2_UPE        = 18,
169     USER_STREAM_MAX        = 19,
170     USER_TZNAME_MAX        = 20,
171 }
172 
173 // POSIX 1003.1B definitions
174 enum
175 {
176     CTL_P1003_1B_ASYNCHRONOUS_IO       = 1,
177     CTL_P1003_1B_MAPPED_FILES          = 2,
178     CTL_P1003_1B_MEMLOCK               = 3,
179     CTL_P1003_1B_MEMLOCK_RANGE         = 4,
180     CTL_P1003_1B_MEMORY_PROTECTION     = 5,
181     CTL_P1003_1B_MESSAGE_PASSING       = 6,
182     CTL_P1003_1B_PRIORITIZED_IO        = 7,
183     CTL_P1003_1B_PRIORITY_SCHEDULING   = 8,
184     CTL_P1003_1B_REALTIME_SIGNALS      = 9,
185     CTL_P1003_1B_SEMAPHORES            = 10,
186     CTL_P1003_1B_FSYNC                 = 11,
187     CTL_P1003_1B_SHARED_MEMORY_OBJECTS = 12,
188     CTL_P1003_1B_SYNCHRONIZED_IO       = 13,
189     CTL_P1003_1B_TIMERS                = 14,
190     CTL_P1003_1B_AIO_LISTIO_MAX        = 15,
191     CTL_P1003_1B_AIO_MAX               = 16,
192     CTL_P1003_1B_AIO_PRIO_DELTA_MAX    = 17,
193     CTL_P1003_1B_DELAYTIMER_MAX        = 18,
194     CTL_P1003_1B_UNUSED19              = 19,
195     CTL_P1003_1B_PAGESIZE              = 20,
196     CTL_P1003_1B_RTSIG_MAX             = 21,
197     CTL_P1003_1B_SEM_NSEMS_MAX         = 22,
198     CTL_P1003_1B_UNUSED23              = 23,
199     CTL_P1003_1B_SIGQUEUE_MAX          = 24,
200     CTL_P1003_1B_TIMER_MAX             = 25,
201     CTL_P1003_1B_MAXID                 = 26,
202 }
203 
204 ///
205 int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp,
206            const void* newp, size_t newlen);
207 ///
208 int sysctlbyname(const char* name, void* oldp, size_t* oldlenp,
209                  const void* newp, size_t newlen);
210 ///
211 int sysctlnametomib(const char* name, int* mibp, size_t* sizep);