📄 sysctl.h
字号:
/* $OpenBSD: sysctl.h,v 1.28 1999/06/29 23:52:00 provos Exp $ *//* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ *//* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Mike Karels at Berkeley Software Design, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)sysctl.h 8.2 (Berkeley) 3/30/95 */#ifndef _SYS_SYSCTL_H_#define _SYS_SYSCTL_H_/* * These are for the eproc structure defined below. */#ifndef _KERNEL#include <sys/time.h>#include <sys/ucred.h>#include <sys/proc.h>#endif#include <vm/vm.h>/* * Definitions for sysctl call. The sysctl call uses a hierarchical name * for objects that can be examined or modified. The name is expressed as * a sequence of integers. Like a file path name, the meaning of each * component depends on its place in the hierarchy. The top-level and kern * identifiers are defined here, and other identifiers are defined in the * respective subsystem header files. */#define CTL_MAXNAME 12 /* largest number of components supported *//* * Each subsystem defined by sysctl defines a list of variables * for that subsystem. Each name is either a node with further * levels defined below it, or it is a leaf of some particular * type given below. Each sysctl level defines a set of name/type * pairs to be used by sysctl(1) in manipulating the subsystem. */struct ctlname { char *ctl_name; /* subsystem name */ int ctl_type; /* type of name */};#define CTLTYPE_NODE 1 /* name is a node */#define CTLTYPE_INT 2 /* name describes an integer */#define CTLTYPE_STRING 3 /* name describes a string */#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */#define CTLTYPE_STRUCT 5 /* name describes a structure *//* * Top-level identifiers */#define CTL_UNSPEC 0 /* unused */#define CTL_KERN 1 /* "high kernel": proc, limits */#define CTL_VM 2 /* virtual memory */#define CTL_FS 3 /* file system, mount type is next */#define CTL_NET 4 /* network, see socket.h */#define CTL_DEBUG 5 /* debugging parameters */#define CTL_HW 6 /* generic cpu/io */#define CTL_MACHDEP 7 /* machine dependent */#define CTL_USER 8 /* user-level */#define CTL_DDB 9 /* DDB user interface, see db_var.h */#define CTL_VFS 10 /* VFS sysctl's */#define CTL_MAXID 11 /* number of valid top-level ids */#define CTL_NAMES { \ { 0, 0 }, \ { "kern", CTLTYPE_NODE }, \ { "vm", CTLTYPE_NODE }, \ { "fs", CTLTYPE_NODE }, \ { "net", CTLTYPE_NODE }, \ { "debug", CTLTYPE_NODE }, \ { "hw", CTLTYPE_NODE }, \ { "machdep", CTLTYPE_NODE }, \ { "user", CTLTYPE_NODE }, \ { "ddb", CTLTYPE_NODE }, \ { "vfs", CTLTYPE_NODE }, \}/* * CTL_KERN identifiers */#define KERN_OSTYPE 1 /* string: system version */#define KERN_OSRELEASE 2 /* string: system release */#define KERN_OSREV 3 /* int: system revision */#define KERN_VERSION 4 /* string: compile time info */#define KERN_MAXVNODES 5 /* int: max vnodes */#define KERN_MAXPROC 6 /* int: max processes */#define KERN_MAXFILES 7 /* int: max open files */#define KERN_ARGMAX 8 /* int: max arguments to exec */#define KERN_SECURELVL 9 /* int: system security level */#define KERN_HOSTNAME 10 /* string: hostname */#define KERN_HOSTID 11 /* int: host identifier */#define KERN_CLOCKRATE 12 /* struct: struct clockrate */#define KERN_VNODE 13 /* struct: vnode structures */#define KERN_PROC 14 /* struct: process entries */#define KERN_FILE 15 /* struct: file entries */#define KERN_PROF 16 /* node: kernel profiling info */#define KERN_POSIX1 17 /* int: POSIX.1 version */#define KERN_NGROUPS 18 /* int: # of supplemental group ids */#define KERN_JOB_CONTROL 19 /* int: is job control available */#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */#define KERN_BOOTTIME 21 /* struct: time kernel was booted */#define KERN_DOMAINNAME 22 /* string: (YP) domainname */#define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */#define KERN_RAWPARTITION 24 /* int: raw partition number */#define KERN_NTPTIME 25 /* struct: extended-precision time */#define KERN_TIMEX 26 /* struct: ntp timekeeping state */#define KERN_OSVERSION 27 /* string: kernel build version */#define KERN_SOMAXCONN 28 /* int: listen queue maximum */#define KERN_SOMINCONN 29 /* int: half-open controllable param */#define KERN_USERMOUNT 30 /* int: users may mount filesystems */#define KERN_RND 31 /* struct: rnd(4) statistics */#define KERN_NOSUIDCOREDUMP 32 /* int: no setuid coredumps ever */ #define KERN_FSYNC 33 /* int: file synchronization support */#define KERN_SYSVMSG 34 /* int: SysV message queue suppoprt */#define KERN_SYSVSEM 35 /* int: SysV semaphore support */#define KERN_SYSVSHM 36 /* int: SysV shared memory support */#define KERN_ARND 37 /* int: random integer from arc4rnd */#define KERN_MAXID 38 /* number of valid kern ids */#define CTL_KERN_NAMES { \ { 0, 0 }, \ { "ostype", CTLTYPE_STRING }, \ { "osrelease", CTLTYPE_STRING }, \ { "osrevision", CTLTYPE_INT }, \ { "version", CTLTYPE_STRING }, \ { "maxvnodes", CTLTYPE_INT }, \ { "maxproc", CTLTYPE_INT }, \ { "maxfiles", CTLTYPE_INT }, \ { "argmax", CTLTYPE_INT }, \ { "securelevel", CTLTYPE_INT }, \ { "hostname", CTLTYPE_STRING }, \ { "hostid", CTLTYPE_INT }, \ { "clockrate", CTLTYPE_STRUCT }, \ { "vnode", CTLTYPE_STRUCT }, \ { "proc", CTLTYPE_STRUCT }, \ { "file", CTLTYPE_STRUCT }, \ { "profiling", CTLTYPE_NODE }, \ { "posix1version", CTLTYPE_INT }, \ { "ngroups", CTLTYPE_INT }, \ { "job_control", CTLTYPE_INT }, \ { "saved_ids", CTLTYPE_INT }, \ { "boottime", CTLTYPE_STRUCT }, \ { "domainname", CTLTYPE_STRING }, \ { "maxpartitions", CTLTYPE_INT }, \ { "rawpartition", CTLTYPE_INT }, \ { "ntptime", CTLTYPE_STRUCT }, \ { "timex", CTLTYPE_STRUCT }, \ { "osversion", CTLTYPE_STRING }, \ { "somaxconn", CTLTYPE_INT }, \ { "sominconn", CTLTYPE_INT }, \ { "usermount", CTLTYPE_INT }, \ { "random", CTLTYPE_STRUCT }, \ { "nosuidcoredump", CTLTYPE_INT }, \ { "fsync", CTLTYPE_INT }, \ { "sysvmsg", CTLTYPE_INT }, \ { "sysvsem", CTLTYPE_INT }, \ { "sysvshm", CTLTYPE_INT }, \ { "arandom", CTLTYPE_INT }, \}/* * KERN_PROC subtypes */#define KERN_PROC_ALL 0 /* everything */#define KERN_PROC_PID 1 /* by process id */#define KERN_PROC_PGRP 2 /* by process group id */#define KERN_PROC_SESSION 3 /* by session of pid */#define KERN_PROC_TTY 4 /* by controlling tty */#define KERN_PROC_UID 5 /* by effective uid */#define KERN_PROC_RUID 6 /* by real uid */#ifdef NOTUSED_BY_PMON/* * KERN_PROC subtype ops return arrays of augmented proc structures: */struct kinfo_proc { struct proc kp_proc; /* proc structure */ struct eproc { struct proc *e_paddr; /* address of proc */ struct session *e_sess; /* session pointer */ struct pcred e_pcred; /* process credentials */ struct ucred e_ucred; /* current credentials */ struct vmspace e_vm; /* address space */ pid_t e_ppid; /* parent process id */ pid_t e_pgid; /* process group id */ short e_jobc; /* job control counter */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -