sysctlh.inc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. {
  2. }
  3. {$PACKRECORDS C}
  4. {
  5. Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
  6. @APPLE_LICENSE_HEADER_START@
  7. The contents of this file constitute Original Code as defined in and
  8. are subject to the Apple Public Source License Version 1.1 (the
  9. "License"). You may not use this file except in compliance with the
  10. License. Please obtain a copy of the License at
  11. http://www.apple.com/publicsource and read it before using this file.
  12. This Original Code and all software distributed under the License are
  13. distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14. EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15. INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
  17. License for the specific language governing rights and limitations
  18. under the License.
  19. @APPLE_LICENSE_HEADER_END@
  20. }
  21. { Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved }
  22. {
  23. Copyright (c) 1989, 1993
  24. The Regents of the University of California. All rights reserved.
  25. This code is derived from software contributed to Berkeley by
  26. Mike Karels at Berkeley Software Design, Inc.
  27. Redistribution and use in source and binary forms, with or without
  28. modification, are permitted provided that the following conditions
  29. are met:
  30. 1. Redistributions of source code must retain the above copyright
  31. notice, this list of conditions and the following disclaimer.
  32. 2. Redistributions in binary form must reproduce the above copyright
  33. notice, this list of conditions and the following disclaimer in the
  34. documentation and/or other materials provided with the distribution.
  35. 3. All advertising materials mentioning features or use of this software
  36. must display the following acknowledgement:
  37. This product includes software developed by the University of
  38. California, Berkeley and its contributors.
  39. 4. Neither the name of the University nor the names of its contributors
  40. may be used to endorse or promote products derived from this software
  41. without specific prior written permission.
  42. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  43. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  44. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  45. ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  46. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  47. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  48. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  49. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  50. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  51. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  52. SUCH DAMAGE.
  53. @(#)sysctl.h 8.1 (Berkeley) 6/2/93
  54. }
  55. {
  56. These are for the eproc structure defined below.
  57. }
  58. {
  59. Definitions for sysctl call. The sysctl call uses a hierarchical name
  60. for objects that can be examined or modified. The name is expressed as
  61. a sequence of integers. Like a file path name, the meaning of each
  62. component depends on its place in the hierarchy. The top-level and kern
  63. identifiers are defined here, and other identifiers are defined in the
  64. respective subsystem header files.
  65. }
  66. { largest number of components supported }
  67. const
  68. CTL_MAXNAME = 12;
  69. {
  70. Each subsystem defined by sysctl defines a list of variables
  71. for that subsystem. Each name is either a node with further
  72. levels defined below it, or it is a leaf of some particular
  73. type given below. Each sysctl level defines a set of name/type
  74. pairs to be used by sysctl(1) in manipulating the subsystem.
  75. }
  76. { subsystem name }
  77. { type of name }
  78. type
  79. ctlname = record
  80. ctl_name : ^char;
  81. ctl_type : longint;
  82. end;
  83. { Mask for the type }
  84. const
  85. CTLTYPE = $f;
  86. { name is a node }
  87. CTLTYPE_NODE = 1;
  88. { name describes an integer }
  89. CTLTYPE_INT = 2;
  90. { name describes a string }
  91. CTLTYPE_STRING = 3;
  92. { name describes a 64-bit number }
  93. CTLTYPE_QUAD = 4;
  94. { name describes a structure }
  95. CTLTYPE_OPAQUE = 5;
  96. { name describes a structure }
  97. CTLTYPE_STRUCT = CTLTYPE_OPAQUE;
  98. { Allow reads of variable }
  99. CTLFLAG_RD = $80000000;
  100. { Allow writes to the variable }
  101. CTLFLAG_WR = $40000000;
  102. CTLFLAG_RW = CTLFLAG_RD or CTLFLAG_WR;
  103. { XXX Don't Lock }
  104. CTLFLAG_NOLOCK = $20000000;
  105. { All users can set this var }
  106. CTLFLAG_ANYBODY = $10000000;
  107. { Permit set only if securelevel<=0 }
  108. CTLFLAG_SECURE = $08000000;
  109. { deprecated variable, do not display }
  110. CTLFLAG_MASKED = $04000000;
  111. { do not auto-register }
  112. CTLFLAG_NOAUTO = $02000000;
  113. { valid inside the kernel }
  114. CTLFLAG_KERN = $01000000;
  115. {
  116. USE THIS instead of a hardwired number from the categories below
  117. to get dynamically assigned sysctl entries using the linker-set
  118. technology. This is the way nearly all new sysctl variables should
  119. be implemented.
  120. e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
  121. }
  122. OID_AUTO = -(1);
  123. {
  124. Top-level identifiers
  125. }
  126. { unused }
  127. CTL_UNSPEC = 0;
  128. { "high kernel": proc, limits }
  129. CTL_KERN = 1;
  130. { virtual memory }
  131. CTL_VM = 2;
  132. { file system, mount type is next }
  133. CTL_VFS = 3;
  134. { network, see socket.h }
  135. CTL_NET = 4;
  136. { debugging parameters }
  137. CTL_DEBUG = 5;
  138. { generic cpu/io }
  139. CTL_HW = 6;
  140. { machine dependent }
  141. CTL_MACHDEP = 7;
  142. { user-level }
  143. CTL_USER = 8;
  144. { number of valid top-level ids }
  145. CTL_MAXID = 9;
  146. {
  147. CTL_KERN identifiers
  148. }
  149. { string: system version }
  150. KERN_OSTYPE = 1;
  151. { string: system release }
  152. KERN_OSRELEASE = 2;
  153. { int: system revision }
  154. KERN_OSREV = 3;
  155. { string: compile time info }
  156. KERN_VERSION = 4;
  157. { int: max vnodes }
  158. KERN_MAXVNODES = 5;
  159. { int: max processes }
  160. KERN_MAXPROC = 6;
  161. { int: max open files }
  162. KERN_MAXFILES = 7;
  163. { int: max arguments to exec }
  164. KERN_ARGMAX = 8;
  165. { int: system security level }
  166. KERN_SECURELVL = 9;
  167. { string: hostname }
  168. KERN_HOSTNAME = 10;
  169. { int: host identifier }
  170. KERN_HOSTID = 11;
  171. { struct: struct clockrate }
  172. KERN_CLOCKRATE = 12;
  173. { struct: vnode structures }
  174. KERN_VNODE = 13;
  175. { struct: process entries }
  176. KERN_PROC = 14;
  177. { struct: file entries }
  178. KERN_FILE = 15;
  179. { node: kernel profiling info }
  180. KERN_PROF = 16;
  181. { int: POSIX.1 version }
  182. KERN_POSIX1 = 17;
  183. { int: # of supplemental group ids }
  184. KERN_NGROUPS = 18;
  185. { int: is job control available }
  186. KERN_JOB_CONTROL = 19;
  187. { int: saved set-user/group-ID }
  188. KERN_SAVED_IDS = 20;
  189. { struct: time kernel was booted }
  190. KERN_BOOTTIME = 21;
  191. { string: YP domain name }
  192. KERN_NISDOMAINNAME = 22;
  193. KERN_DOMAINNAME = KERN_NISDOMAINNAME;
  194. { int: number of partitions/disk }
  195. KERN_MAXPARTITIONS = 23;
  196. { int: kernel trace points }
  197. KERN_KDEBUG = 24;
  198. { int: update process sleep time }
  199. KERN_UPDATEINTERVAL = 25;
  200. { int: OS release date }
  201. KERN_OSRELDATE = 26;
  202. { node: NTP PLL control }
  203. KERN_NTP_PLL = 27;
  204. { string: name of booted kernel }
  205. KERN_BOOTFILE = 28;
  206. { int: max open files per proc }
  207. KERN_MAXFILESPERPROC = 29;
  208. { int: max processes per uid }
  209. KERN_MAXPROCPERUID = 30;
  210. { dev_t: device to dump on }
  211. KERN_DUMPDEV = 31;
  212. { node: anything related to IPC }
  213. KERN_IPC = 32;
  214. { unused }
  215. KERN_DUMMY = 33;
  216. { int: address of PS_STRINGS }
  217. KERN_PS_STRINGS = 34;
  218. { int: address of USRSTACK }
  219. KERN_USRSTACK = 35;
  220. { int: do we log sigexit procs? }
  221. KERN_LOGSIGEXIT = 36;
  222. { string: kernel symbol filename }
  223. KERN_SYMFILE = 37;
  224. KERN_PROCARGS = 38;
  225. { node: pc sampling }
  226. KERN_PCSAMPLES = 39;
  227. { int: are we netbooted? 1=yes,0=no }
  228. KERN_NETBOOT = 40;
  229. { node: panic UI information }
  230. KERN_PANICINFO = 41;
  231. { node: panic UI information }
  232. KERN_SYSV = 42;
  233. { xxx }
  234. KERN_AFFINITY = 43;
  235. { xxx }
  236. KERN_CLASSIC = 44;
  237. { xxx }
  238. KERN_CLASSICHANDLER = 45;
  239. { int: max aio requests }
  240. KERN_AIOMAX = 46;
  241. { int: max aio requests per process }
  242. KERN_AIOPROCMAX = 47;
  243. { int: max aio worker threads }
  244. KERN_AIOTHREADS = 48;
  245. { __APPLE_API_UNSTABLE }
  246. { number of valid kern ids }
  247. const
  248. KERN_MAXID = 50;
  249. { KERN_KDEBUG types }
  250. KERN_KDEFLAGS = 1;
  251. KERN_KDDFLAGS = 2;
  252. KERN_KDENABLE = 3;
  253. KERN_KDSETBUF = 4;
  254. KERN_KDGETBUF = 5;
  255. KERN_KDSETUP = 6;
  256. KERN_KDREMOVE = 7;
  257. KERN_KDSETREG = 8;
  258. KERN_KDGETREG = 9;
  259. KERN_KDREADTR = 10;
  260. KERN_KDPIDTR = 11;
  261. KERN_KDTHRMAP = 12;
  262. { Don't use 13 as it is overloaded with KERN_VNODE }
  263. KERN_KDPIDEX = 14;
  264. KERN_KDSETRTCDEC = 15;
  265. KERN_KDGETENTROPY = 16;
  266. { KERN_PCSAMPLES types }
  267. KERN_PCDISABLE = 1;
  268. KERN_PCSETBUF = 2;
  269. KERN_PCGETBUF = 3;
  270. KERN_PCSETUP = 4;
  271. KERN_PCREMOVE = 5;
  272. KERN_PCREADBUF = 6;
  273. KERN_PCSETREG = 7;
  274. KERN_PCCOMM = 8;
  275. { KERN_PANICINFO types }
  276. { quad: panic UI image size limit }
  277. KERN_PANICINFO_MAXSIZE = 1;
  278. { string: path to the panic UI (16 bit) }
  279. KERN_PANICINFO_IMAGE16 = 2;
  280. { string: path to the panic UI (32 bit) }
  281. KERN_PANICINFO_IMAGE32 = 3;
  282. {
  283. KERN_SYSV identifiers
  284. }
  285. { int: max shared memory segment size (bytes) }
  286. KSYSV_SHMMAX = 1;
  287. { int: min shared memory segment size (bytes) }
  288. KSYSV_SHMMIN = 2;
  289. { int: max number of shared memory identifiers }
  290. KSYSV_SHMMNI = 3;
  291. { int: max shared memory segments per process }
  292. KSYSV_SHMSEG = 4;
  293. { int: max amount of shared memory (pages) }
  294. KSYSV_SHMALL = 5;
  295. { int: max num of semaphore identifiers }
  296. KSYSV_SEMMNI = 6;
  297. { int: max num of semaphores in system }
  298. KSYSV_SEMMNS = 7;
  299. { int: max num of undo structures in system }
  300. KSYSV_SEMMNU = 8;
  301. { int: max num of semaphores per id }
  302. KSYSV_SEMMSL = 9;
  303. { int: max num of undo entries per process }
  304. KSYSV_SEMUNE = 10;
  305. error1 = 1;
  306. {
  307. KERN_PROC subtypes
  308. }
  309. { everything }
  310. KERN_PROC_ALL = 0;
  311. { by process id }
  312. KERN_PROC_PID = 1;
  313. { by process group id }
  314. KERN_PROC_PGRP = 2;
  315. { by session of pid }
  316. KERN_PROC_SESSION = 3;
  317. { by controlling tty }
  318. KERN_PROC_TTY = 4;
  319. { by effective uid }
  320. KERN_PROC_UID = 5;
  321. { by real uid }
  322. KERN_PROC_RUID = 6;
  323. {
  324. KERN_PROC subtype ops return arrays of augmented proc structures:
  325. }
  326. {
  327. KERN_IPC identifiers
  328. }
  329. { int: max size of a socket buffer }
  330. const
  331. KIPC_MAXSOCKBUF = 1;
  332. { int: wastage factor in sockbuf }
  333. KIPC_SOCKBUF_WASTE = 2;
  334. { int: max length of connection q }
  335. KIPC_SOMAXCONN = 3;
  336. { int: max length of link header }
  337. KIPC_MAX_LINKHDR = 4;
  338. { int: max length of network header }
  339. KIPC_MAX_PROTOHDR = 5;
  340. { int: max total length of headers }
  341. KIPC_MAX_HDR = 6;
  342. { int: max length of data? }
  343. KIPC_MAX_DATALEN = 7;
  344. { struct: mbuf usage statistics }
  345. KIPC_MBSTAT = 8;
  346. { int: maximum mbuf clusters }
  347. KIPC_NMBCLUSTERS = 9;
  348. {
  349. CTL_VM identifiers
  350. }
  351. { struct vmmeter }
  352. VM_METER = 1;
  353. { struct loadavg }
  354. VM_LOADAVG = 2;
  355. { Note: "3" was skipped sometime ago and should probably remain unused
  356. to avoid any new entry from being accepted by older kernels...}
  357. { struct loadavg with mach factor }
  358. VM_MACHFACTOR = 4;
  359. { total swap usage }
  360. VM_SWAPUSAGE = 5;
  361. { number of valid vm ids }
  362. VM_MAXID = 6;
  363. {
  364. CTL_HW identifiers
  365. }
  366. { string: machine class }
  367. HW_MACHINE = 1;
  368. { string: specific machine model }
  369. HW_MODEL = 2;
  370. { int: number of cpus }
  371. HW_NCPU = 3;
  372. { int: machine byte order }
  373. HW_BYTEORDER = 4;
  374. { int: total memory }
  375. HW_PHYSMEM = 5;
  376. { int: non-kernel memory }
  377. HW_USERMEM = 6;
  378. { int: software page size }
  379. HW_PAGESIZE = 7;
  380. { strings: disk drive names }
  381. HW_DISKNAMES = 8;
  382. { struct: diskstats[] }
  383. HW_DISKSTATS = 9;
  384. { int: 0 for Legacy, else NewWorld }
  385. HW_EPOCH = 10;
  386. { int: has HW floating point? }
  387. HW_FLOATINGPT = 11;
  388. { string: machine architecture }
  389. HW_MACHINE_ARCH = 12;
  390. { int: has HW vector unit? }
  391. HW_VECTORUNIT = 13;
  392. { int: Bus Frequency }
  393. HW_BUS_FREQ = 14;
  394. { int: CPU Frequency }
  395. HW_CPU_FREQ = 15;
  396. { int: Cache Line Size in Bytes }
  397. HW_CACHELINE = 16;
  398. { int: L1 I Cache Size in Bytes }
  399. HW_L1ICACHESIZE = 17;
  400. { int: L1 D Cache Size in Bytes }
  401. HW_L1DCACHESIZE = 18;
  402. { int: L2 Cache Settings }
  403. HW_L2SETTINGS = 19;
  404. { int: L2 Cache Size in Bytes }
  405. HW_L2CACHESIZE = 20;
  406. { int: L3 Cache Settings }
  407. HW_L3SETTINGS = 21;
  408. { int: L3 Cache Size in Bytes }
  409. HW_L3CACHESIZE = 22;
  410. { int: Bus Frequency }
  411. HW_TB_FREQ = 23;
  412. { uint64_t: physical ram size }
  413. HW_MEMSIZE = 24;
  414. { int: number of available CPUs }
  415. HW_AVAILCPU = 25;
  416. { number of valid hw ids }
  417. HW_MAXID = 26;
  418. {
  419. These are the support HW selectors for sysctlbyname. Parameters that are byte count or frequencies are 64 bit numbers.
  420. All other parameters are 32 bit numbers.
  421. hw.memsize - The number of bytes of physical memory in the system.
  422. hw.ncpu - The number maximum number of processor that could be available this boot.
  423. Use this value for sizing of static per processor arrays; i.e. processor load statistics.
  424. hw.activecpu - The number of cpus currently available for executing threads.
  425. Use this number to determine the number threads to create in SMP aware applications.
  426. This number can change when power management modes are changed.
  427. hw.tbfrequency - This gives the time base frequency used by the OS and is the basis of all timing services.
  428. In general is is better to use mach's or higher level timing services, but this value
  429. is needed to convert the PPC Time Base registers to real time.
  430. hw.cpufrequency - These values provide the current, min and max cpu frequency. The min and max are for
  431. hw.cpufrequency_max - all power management modes. The current frequency is the max frequency in the current mode.
  432. hw.cpufrequency_min - All frequencies are in Hz.
  433. hw.busfrequency - These values provide the current, min and max bus frequency. The min and max are for
  434. hw.busfrequency_max - all power management modes. The current frequency is the max frequency in the current mode.
  435. hw.busfrequency_min - All frequencies are in Hz.
  436. hw.cputype - These values provide the mach-o cpu type and subtype. A complete list is in <mach/machine.h>
  437. hw.cpusubtype - These values should be used to determine what processor family the running cpu is from so that
  438. the best binary can be chosen, or the best dynamic code generated. They should not be used
  439. to determine if a given processor feature is available.
  440. hw.byteorder - Gives the byte order of the processor. 4321 for big endian, 1234 for little.
  441. hw.pagesize - Gives the size in bytes of the pages used by the processor and VM system.
  442. hw.cachelinesize - Gives the size in bytes of the processor's cache lines.
  443. This value should be use to control the strides of loops that use cache control instructions
  444. like dcbz, dcbt or dcbst.
  445. hw.l1dcachesize - These values provide the size in bytes of the L1, L2 and L3 caches. If a cache is not present
  446. hw.l1icachesize - then the selector will return and error.
  447. hw.l2cachesize -
  448. hw.l3cachesize -
  449. These are the selectors for optional processor features. Selectors that return errors are not support on the system.
  450. Supported features will return 1 if they are recommended or 0 if they are supported but are not expected to help performance.
  451. Future versions of these selectors may return larger values as necessary so it is best to test for non zero.
  452. hw.optional.floatingpoint - Floating Point Instructions
  453. hw.optional.altivec - AltiVec Instructions
  454. hw.optional.graphicsops - Graphics Operations
  455. hw.optional.64bitops - 64-bit Instructions
  456. hw.optional.fsqrt - HW Floating Point Square Root Instruction
  457. hw.optional.stfiwx - Store Floating Point as Integer Word Indexed Instructions
  458. hw.optional.dcba - Data Cache Block Allocate Instruction
  459. hw.optional.datastreams - Data Streams Instructions
  460. hw.optional.dcbtstreams - Data Cache Block Touch Steams Instruction Form
  461. }
  462. {
  463. CTL_USER definitions
  464. }
  465. { string: _CS_PATH }
  466. { int: BC_BASE_MAX }
  467. USER_BC_BASE_MAX = 2;
  468. { int: BC_DIM_MAX }
  469. USER_BC_DIM_MAX = 3;
  470. { int: BC_SCALE_MAX }
  471. USER_BC_SCALE_MAX = 4;
  472. { int: BC_STRING_MAX }
  473. USER_BC_STRING_MAX = 5;
  474. { int: COLL_WEIGHTS_MAX }
  475. USER_COLL_WEIGHTS_MAX = 6;
  476. { int: EXPR_NEST_MAX }
  477. USER_EXPR_NEST_MAX = 7;
  478. { int: LINE_MAX }
  479. USER_LINE_MAX = 8;
  480. { int: RE_DUP_MAX }
  481. USER_RE_DUP_MAX = 9;
  482. { int: POSIX2_VERSION }
  483. USER_POSIX2_VERSION = 10;
  484. { int: POSIX2_C_BIND }
  485. USER_POSIX2_C_BIND = 11;
  486. { int: POSIX2_C_DEV }
  487. USER_POSIX2_C_DEV = 12;
  488. { int: POSIX2_CHAR_TERM }
  489. USER_POSIX2_CHAR_TERM = 13;
  490. { int: POSIX2_FORT_DEV }
  491. USER_POSIX2_FORT_DEV = 14;
  492. { int: POSIX2_FORT_RUN }
  493. USER_POSIX2_FORT_RUN = 15;
  494. { int: POSIX2_LOCALEDEF }
  495. USER_POSIX2_LOCALEDEF = 16;
  496. { int: POSIX2_SW_DEV }
  497. USER_POSIX2_SW_DEV = 17;
  498. { int: POSIX2_UPE }
  499. USER_POSIX2_UPE = 18;
  500. { int: POSIX2_STREAM_MAX }
  501. USER_STREAM_MAX = 19;
  502. { int: POSIX2_TZNAME_MAX }
  503. USER_TZNAME_MAX = 20;
  504. { number of valid user ids }
  505. USER_MAXID = 21;