1 /**
2   * D header file for DragonFlyBSD 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.dragonflybsd.sys.sysctl;
9 
10 version (DragonFlyBSD):
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     CTL_LWKT     = 10,
29     CTL_MAXID    = 11,
30 }
31 
32 // CTL_SYSCTL identifiers
33 enum
34 {
35     CTL_SYSCTL_DEBUG    = 0,
36     CTL_SYSCTL_NAME     = 1,
37     CTL_SYSCTL_NEXT     = 2,
38     CTL_SYSCTL_NAME2OID = 3,
39     CTL_SYSCTL_OIDFMT   = 4,
40     CTL_SYSCTL_OIDDESCR = 5,
41 }
42 
43 // CTL_KERN identifiers
44 enum
45 {
46     KERN_OSTYPE            = 1,
47     KERN_OSRELEASE         = 2,
48     KERN_OSREV             = 3,
49     KERN_VERSION           = 4,
50     KERN_MAXVNODES         = 5,
51     KERN_MAXPROC           = 6,
52     KERN_MAXFILES          = 7,
53     KERN_ARGMAX            = 8,
54     KERN_SECURELVL         = 9,
55     KERN_HOSTNAME          = 10,
56     KERN_HOSTID            = 11,
57     KERN_CLOCKRATE         = 12,
58     KERN_VNODE             = 13,
59     KERN_PROC              = 14,
60     KERN_FILE              = 15,
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_MAXPOSIXLOCKSPERUID = 36,
81     KERN_MAXID             = 37,
82 }
83 
84 // KERN_PROC subtypes
85 enum
86 {
87     KERN_PROC_ALL      = 0,
88     KERN_PROC_PID      = 1,
89     KERN_PROC_PGRP     = 2,
90     KERN_PROC_SESSION  = 3,
91     KERN_PROC_TTY      = 4,
92     KERN_PROC_UID      = 5,
93     KERN_PROC_RUID     = 6,
94     KERN_PROC_ARGS     = 7,
95     KERN_PROC_CWD      = 8,
96     KERN_PROC_PATHNAME = 9,
97     KERN_PROC_SIGTRAMP = 10,
98     KERN_PROC_FLAGMASK = 0x10,
99     KERN_PROC_FLAG_LWP = 0x10,
100 }
101 
102 // KERN_IPC identifiers
103 enum
104 {
105     KIPC_MAXSOCKBUF    = 1,
106     KIPC_SOCKBUF_WASTE = 2,
107     KIPC_SOMAXCONN     = 3,
108     KIPC_MAX_LINKHDR   = 4,
109     KIPC_MAX_PROTOHDR  = 5,
110     KIPC_MAX_HDR       = 6,
111     KIPC_MAX_DATALEN   = 7,
112     KIPC_MBSTAT        = 8,
113     KIPC_NMBCLUSTERS   = 9,
114 }
115 
116 // CTL_HW identifiers
117 enum
118 {
119     HW_MACHINE      = 1,
120     HW_MODEL        = 2,
121     HW_NCPU         = 3,
122     HW_BYTEORDER    = 4,
123     HW_PHYSMEM      = 5,
124     HW_USERMEM      = 6,
125     HW_PAGESIZE     = 7,
126     HW_DISKNAMES    = 8,
127     HW_DISKSTATS    = 9,
128     HW_FLOATINGPT   = 10,
129     HW_MACHINE_ARCH = 11,
130     HW_MACHINE_PLATFORM = 12,
131     HW_SENSORS      = 13,
132     HW_MAXID        = 14,
133 }
134 
135 // CTL_USER definitions
136 enum
137 {
138     USER_CS_PATH          = 1,
139     USER_BC_BASE_MAX      = 2,
140     USER_BC_DIM_MAX       = 3,
141     USER_BC_SCALE_MAX     = 4,
142     USER_BC_STRING_MAX    = 5,
143     USER_COLL_WEIGHTS_MAX = 6,
144     USER_EXPR_NEST_MAX    = 7,
145     USER_LINE_MAX         = 8,
146     USER_RE_DUP_MAX       = 9,
147     USER_POSIX2_VERSION   = 10,
148     USER_POSIX2_C_BIND    = 11,
149     USER_POSIX2_C_DEV     = 12,
150     USER_POSIX2_CHAR_TERM = 13,
151     USER_POSIX2_FORT_DEV  = 14,
152     USER_POSIX2_FORT_RUN  = 15,
153     USER_POSIX2_LOCALEDEF = 16,
154     USER_POSIX2_SW_DEV    = 17,
155     USER_POSIX2_UPE       = 18,
156     USER_STREAM_MAX       = 19,
157     USER_TZNAME_MAX       = 20,
158     USER_MAXID            = 21,
159 }
160 
161 // POSIX 1003.1B definitions
162 enum
163 {
164     CTL_P1003_1B_ASYNCHRONOUS_IO       = 1,
165     CTL_P1003_1B_MAPPED_FILES          = 2,
166     CTL_P1003_1B_MEMLOCK               = 3,
167     CTL_P1003_1B_MEMLOCK_RANGE         = 4,
168     CTL_P1003_1B_MEMORY_PROTECTION     = 5,
169     CTL_P1003_1B_MESSAGE_PASSING       = 6,
170     CTL_P1003_1B_PRIORITIZED_IO        = 7,
171     CTL_P1003_1B_PRIORITY_SCHEDULING   = 8,
172     CTL_P1003_1B_REALTIME_SIGNALS      = 9,
173     CTL_P1003_1B_SEMAPHORES            = 10,
174     CTL_P1003_1B_FSYNC                 = 11,
175     CTL_P1003_1B_SHARED_MEMORY_OBJECTS = 12,
176     CTL_P1003_1B_SYNCHRONIZED_IO       = 13,
177     CTL_P1003_1B_TIMERS                = 14,
178     CTL_P1003_1B_AIO_LISTIO_MAX        = 15,
179     CTL_P1003_1B_AIO_MAX               = 16,
180     CTL_P1003_1B_AIO_PRIO_DELTA_MAX    = 17,
181     CTL_P1003_1B_DELAYTIMER_MAX        = 18,
182     CTL_P1003_1B_UNUSED19              = 19,
183     CTL_P1003_1B_PAGESIZE              = 20,
184     CTL_P1003_1B_RTSIG_MAX             = 21,
185     CTL_P1003_1B_SEM_NSEMS_MAX         = 22,
186     CTL_P1003_1B_UNUSED23              = 23,
187     CTL_P1003_1B_SIGQUEUE_MAX          = 24,
188     CTL_P1003_1B_TIMER_MAX             = 25,
189     CTL_P1003_1B_MAXID                 = 26,
190 }
191 
192 ///
193 int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp,
194            const void* newp, size_t newlen);
195 ///
196 int sysctlbyname(const char* name, void* oldp, size_t* oldlenp,
197                  const void* newp, size_t newlen);
198 ///
199 int sysctlnametomib(const char* name, int* mibp, size_t* sizep);