include/linux/sysctl.h
17715 /*
17716 * sysctl.h: General linux system control interface
17717 *
17718 * Begun 24 March 1995, Stephen Tweedie
17719 *
17720 ********************************************************
17721 ********************************************************
17722 **
17723 ** WARNING:
17724 ** The values in this file are exported to user space
17725 ** via the sysctl() binary interface. Do *NOT* change
17726 ** the numbering of any existing values here, and do
17727 ** not change any numbers within any one set of values.
17728 ** If you have to redefine an existing interface, use a
17729 ** new number for it. The kernel will then return
17730 ** ENOTDIR to any application using the old binary
17731 ** interface.
17732 **
17733 ** --sct
17734 **
17735 ********************************************************
17736 *******************************************************/
17737
17738 #include <linux/lists.h>
17739
17740 #ifndef _LINUX_SYSCTL_H
17741 #define _LINUX_SYSCTL_H
17742
17743 #define CTL_MAXNAME 10
17744
17745 struct __sysctl_args {
17746 int *name;
17747 int nlen;
17748 void *oldval;
17749 size_t *oldlenp;
17750 void *newval;
17751 size_t newlen;
17752 unsigned long __unused[4];
17753 };
17754
17755 /* Define sysctl names first */
17756
17757 /* Top-level names: */
17758
17759 /* For internal pattern-matching use only: */
17760 #ifdef __KERNEL__
17761 #define CTL_ANY -1 /* Matches any name */
17762 #define CTL_NONE 0
17763 #endif
17764
17765 enum
17766 {
17767 CTL_KERN=1, /* General kernel info and control */
17768 CTL_VM=2, /* VM management */
17769 CTL_NET=3, /* Networking */
17770 CTL_PROC=4, /* Process info */
17771 CTL_FS=5, /* Filesystems */
17772 CTL_DEBUG=6, /* Debugging */
17773 CTL_DEV=7 /* Devices */
17774 };
17775
17776
17777 /* CTL_KERN names: */
17778 enum
17779 {
17780 /* string: system version */
17781 KERN_OSTYPE=1,
17782 /* string: system release */
17783 KERN_OSRELEASE=2,
17784 /* int: system revision */
17785 KERN_OSREV=3,
17786 /* string: compile time info */
17787 KERN_VERSION=4,
17788 /* struct: maximum rights mask */
17789 KERN_SECUREMASK=5,
17790 /* table: profiling information */
17791 KERN_PROF=6,
17792 KERN_NODENAME=7,
17793 KERN_DOMAINNAME=8,
17794
17795 /* int: system security level */
17796 KERN_SECURELVL=14,
17797 /* int: panic timeout */
17798 KERN_PANIC=15,
17799 /* real root device to mount after initrd */
17800 KERN_REALROOTDEV=16,
17801
17802 /* path to Java(tm) interpreter */
17803 KERN_JAVA_INTERPRETER=19,
17804 /* path to Java(tm) appletviewer */
17805 KERN_JAVA_APPLETVIEWER=20,
17806 /* reboot command on Sparc */
17807 KERN_SPARC_REBOOT=21,
17808 /* int: allow ctl-alt-del to reboot */
17809 KERN_CTLALTDEL=22,
17810 /* struct: control printk logging parameters */
17811 KERN_PRINTK=23,
17812 /* Name translation */
17813 KERN_NAMETRANS=24,
17814 /* turn htab reclaimation on/off on PPC */
17815 KERN_PPC_HTABRECLAIM=25,
17816 /* turn idle page zeroing on/off on PPC */
17817 KERN_PPC_ZEROPAGED=26,
17818 /* use nap mode for power saving */
17819 KERN_PPC_POWERSAVE_NAP=27,
17820 KERN_MODPROBE=28,
17821 KERN_SG_BIG_BUFF=29,
17822 /* BSD process accounting parameters */
17823 KERN_ACCT=30,
17824 /* l2cr register on PPC */
17825 KERN_PPC_L2CR=31,
17826
17827 /* Number of rt sigs queued */
17828 KERN_RTSIGNR=32,
17829 /* Max queuable */
17830 KERN_RTSIGMAX=33,
17831
17832 /* int: Maximum shared memory segment */
17833 KERN_SHMMAX=34,
17834 /* int: Maximum size of a messege */
17835 KERN_MSGMAX=35,
17836 /* int: Maximum message queue size */
17837 KERN_MSGMNB=36,
17838 /* int: Maximum system message pool size */
17839 KERN_MSGPOOL=37
17840 };
17841
17842
17843 /* CTL_VM names: */
17844 enum
17845 {
17846 /* struct: Set vm swapping control */
17847 VM_SWAPCTL=1,
17848 /* int: Background pageout interval */
17849 VM_SWAPOUT=2,
17850 /* struct: Set free page thresholds */
17851 VM_FREEPG=3,
17852 /* struct: Control buffer cache flushing */
17853 VM_BDFLUSH=4,
17854 /* Turn off the virtual memory safety limit */
17855 VM_OVERCOMMIT_MEMORY=5,
17856 /* struct: Set buffer memory thresholds */
17857 VM_BUFFERMEM=6,
17858 /* struct: Set cache memory thresholds */
17859 VM_PAGECACHE=7,
17860 /* struct: Control kswapd behaviour */
17861 VM_PAGERDAEMON=8,
17862 /* struct: Set page table cache parameters */
17863 VM_PGT_CACHE=9,
17864 /* int: set number of pages to swap together */
17865 VM_PAGE_CLUSTER=10
17866 };
17867
17868
17869 /* CTL_NET names: */
17870 enum
17871 {
17872 NET_CORE=1,
17873 NET_ETHER=2,
17874 NET_802=3,
17875 NET_UNIX=4,
17876 NET_IPV4=5,
17877 NET_IPX=6,
17878 NET_ATALK=7,
17879 NET_NETROM=8,
17880 NET_AX25=9,
17881 NET_BRIDGE=10,
17882 NET_ROSE=11,
17883 NET_IPV6=12,
17884 NET_X25=13,
17885 NET_TR=14,
17886 NET_DECNET=15
17887 };
17888
17889
17890 /* /proc/sys/net/core */
17891 enum
17892 {
17893 NET_CORE_WMEM_MAX=1,
17894 NET_CORE_RMEM_MAX=2,
17895 NET_CORE_WMEM_DEFAULT=3,
17896 NET_CORE_RMEM_DEFAULT=4,
17897 /* was NET_CORE_DESTROY_DELAY */
17898 NET_CORE_MAX_BACKLOG=6,
17899 NET_CORE_FASTROUTE=7,
17900 NET_CORE_MSG_COST=8,
17901 NET_CORE_MSG_BURST=9,
17902 NET_CORE_OPTMEM_MAX=10
17903 };
17904
17905 /* /proc/sys/net/ethernet */
17906
17907 /* /proc/sys/net/802 */
17908
17909 /* /proc/sys/net/unix */
17910
17911 enum
17912 {
17913 NET_UNIX_DESTROY_DELAY=1,
17914 NET_UNIX_DELETE_DELAY=2,
17915 NET_UNIX_MAX_DGRAM_QLEN=3,
17916 };
17917
17918 /* /proc/sys/net/ipv4 */
17919 enum
17920 {
17921 /* v2.0 compatibile variables */
17922 NET_IPV4_FORWARD=8,
17923 NET_IPV4_DYNADDR=9,
17924
17925 NET_IPV4_CONF=16,
17926 NET_IPV4_NEIGH=17,
17927 NET_IPV4_ROUTE=18,
17928 NET_IPV4_FIB_HASH=19,
17929
17930 NET_IPV4_TCP_TIMESTAMPS=33,
17931 NET_IPV4_TCP_WINDOW_SCALING=34,
17932 NET_IPV4_TCP_SACK=35,
17933 NET_IPV4_TCP_RETRANS_COLLAPSE=36,
17934 NET_IPV4_DEFAULT_TTL=37,
17935 NET_IPV4_AUTOCONFIG=38,
17936 NET_IPV4_NO_PMTU_DISC=39,
17937 NET_IPV4_TCP_SYN_RETRIES=40,
17938 NET_IPV4_IPFRAG_HIGH_THRESH=41,
17939 NET_IPV4_IPFRAG_LOW_THRESH=42,
17940 NET_IPV4_IPFRAG_TIME=43,
17941 NET_IPV4_TCP_MAX_KA_PROBES=44,
17942 NET_IPV4_TCP_KEEPALIVE_TIME=45,
17943 NET_IPV4_TCP_KEEPALIVE_PROBES=46,
17944 NET_IPV4_TCP_RETRIES1=47,
17945 NET_IPV4_TCP_RETRIES2=48,
17946 NET_IPV4_TCP_FIN_TIMEOUT=49,
17947 NET_IPV4_IP_MASQ_DEBUG=50,
17948 NET_TCP_SYNCOOKIES=51,
17949 NET_TCP_STDURG=52,
17950 NET_TCP_RFC1337=53,
17951 NET_TCP_SYN_TAILDROP=54,
17952 NET_TCP_MAX_SYN_BACKLOG=55,
17953 NET_IPV4_LOCAL_PORT_RANGE=56,
17954 NET_IPV4_ICMP_ECHO_IGNORE_ALL=57,
17955 NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58,
17956 NET_IPV4_ICMP_SOURCEQUENCH_RATE=59,
17957 NET_IPV4_ICMP_DESTUNREACH_RATE=60,
17958 NET_IPV4_ICMP_TIMEEXCEED_RATE=61,
17959 NET_IPV4_ICMP_PARAMPROB_RATE=62,
17960 NET_IPV4_ICMP_ECHOREPLY_RATE=63,
17961 NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64,
17962 NET_IPV4_IGMP_MAX_MEMBERSHIPS=65
17963 };
17964
17965 enum {
17966 NET_IPV4_ROUTE_FLUSH=1,
17967 NET_IPV4_ROUTE_MIN_DELAY=2,
17968 NET_IPV4_ROUTE_MAX_DELAY=3,
17969 NET_IPV4_ROUTE_GC_THRESH=4,
17970 NET_IPV4_ROUTE_MAX_SIZE=5,
17971 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
17972 NET_IPV4_ROUTE_GC_TIMEOUT=7,
17973 NET_IPV4_ROUTE_GC_INTERVAL=8,
17974 NET_IPV4_ROUTE_REDIRECT_LOAD=9,
17975 NET_IPV4_ROUTE_REDIRECT_NUMBER=10,
17976 NET_IPV4_ROUTE_REDIRECT_SILENCE=11,
17977 NET_IPV4_ROUTE_ERROR_COST=12,
17978 NET_IPV4_ROUTE_ERROR_BURST=13,
17979 NET_IPV4_ROUTE_GC_ELASTICITY=14,
17980 NET_IPV4_ROUTE_MTU_EXPIRES=15
17981 };
17982
17983 enum
17984 {
17985 NET_PROTO_CONF_ALL=-2,
17986 NET_PROTO_CONF_DEFAULT=-3
17987
17988 /* And device ifindices ... */
17989 };
17990
17991 enum
17992 {
17993 NET_IPV4_CONF_FORWARDING=1,
17994 NET_IPV4_CONF_MC_FORWARDING=2,
17995 NET_IPV4_CONF_PROXY_ARP=3,
17996 NET_IPV4_CONF_ACCEPT_REDIRECTS=4,
17997 NET_IPV4_CONF_SECURE_REDIRECTS=5,
17998 NET_IPV4_CONF_SEND_REDIRECTS=6,
17999 NET_IPV4_CONF_SHARED_MEDIA=7,
18000 NET_IPV4_CONF_RP_FILTER=8,
18001 NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9,
18002 NET_IPV4_CONF_BOOTP_RELAY=10,
18003 NET_IPV4_CONF_LOG_MARTIANS=11
18004 };
18005
18006 /* /proc/sys/net/ipv6 */
18007 enum {
18008 NET_IPV6_CONF=16,
18009 NET_IPV6_NEIGH=17,
18010 NET_IPV6_ROUTE=18
18011 };
18012
18013 enum {
18014 NET_IPV6_ROUTE_FLUSH=1,
18015 NET_IPV6_ROUTE_GC_THRESH=2,
18016 NET_IPV6_ROUTE_MAX_SIZE=3,
18017 NET_IPV6_ROUTE_GC_MIN_INTERVAL=4,
18018 NET_IPV6_ROUTE_GC_TIMEOUT=5,
18019 NET_IPV6_ROUTE_GC_INTERVAL=6,
18020 NET_IPV6_ROUTE_GC_ELASTICITY=7,
18021 NET_IPV6_ROUTE_MTU_EXPIRES=8
18022 };
18023
18024 enum {
18025 NET_IPV6_FORWARDING=1,
18026 NET_IPV6_HOP_LIMIT=2,
18027 NET_IPV6_MTU=3,
18028 NET_IPV6_ACCEPT_RA=4,
18029 NET_IPV6_ACCEPT_REDIRECTS=5,
18030 NET_IPV6_AUTOCONF=6,
18031 NET_IPV6_DAD_TRANSMITS=7,
18032 NET_IPV6_RTR_SOLICITS=8,
18033 NET_IPV6_RTR_SOLICIT_INTERVAL=9,
18034 NET_IPV6_RTR_SOLICIT_DELAY=10
18035 };
18036
18037 /* /proc/sys/net/<protocol>/neigh/<dev> */
18038 enum {
18039 NET_NEIGH_MCAST_SOLICIT=1,
18040 NET_NEIGH_UCAST_SOLICIT=2,
18041 NET_NEIGH_APP_SOLICIT=3,
18042 NET_NEIGH_RETRANS_TIME=4,
18043 NET_NEIGH_REACHABLE_TIME=5,
18044 NET_NEIGH_DELAY_PROBE_TIME=6,
18045 NET_NEIGH_GC_STALE_TIME=7,
18046 NET_NEIGH_UNRES_QLEN=8,
18047 NET_NEIGH_PROXY_QLEN=9,
18048 NET_NEIGH_ANYCAST_DELAY=10,
18049 NET_NEIGH_PROXY_DELAY=11,
18050 NET_NEIGH_LOCKTIME=12,
18051 NET_NEIGH_GC_INTERVAL=13,
18052 NET_NEIGH_GC_THRESH1=14,
18053 NET_NEIGH_GC_THRESH2=15,
18054 NET_NEIGH_GC_THRESH3=16
18055 };
18056
18057 /* /proc/sys/net/ipx */
18058
18059
18060 /* /proc/sys/net/appletalk */
18061 enum {
18062 NET_ATALK_AARP_EXPIRY_TIME=1,
18063 NET_ATALK_AARP_TICK_TIME=2,
18064 NET_ATALK_AARP_RETRANSMIT_LIMIT=3,
18065 NET_ATALK_AARP_RESOLVE_TIME=4
18066 };
18067
18068
18069 /* /proc/sys/net/netrom */
18070 enum {
18071 NET_NETROM_DEFAULT_PATH_QUALITY=1,
18072 NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2,
18073 NET_NETROM_NETWORK_TTL_INITIALISER=3,
18074 NET_NETROM_TRANSPORT_TIMEOUT=4,
18075 NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5,
18076 NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6,
18077 NET_NETROM_TRANSPORT_BUSY_DELAY=7,
18078 NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8,
18079 NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9,
18080 NET_NETROM_ROUTING_CONTROL=10,
18081 NET_NETROM_LINK_FAILS_COUNT=11
18082 };
18083
18084 /* /proc/sys/net/ax25 */
18085 enum {
18086 NET_AX25_IP_DEFAULT_MODE=1,
18087 NET_AX25_DEFAULT_MODE=2,
18088 NET_AX25_BACKOFF_TYPE=3,
18089 NET_AX25_CONNECT_MODE=4,
18090 NET_AX25_STANDARD_WINDOW=5,
18091 NET_AX25_EXTENDED_WINDOW=6,
18092 NET_AX25_T1_TIMEOUT=7,
18093 NET_AX25_T2_TIMEOUT=8,
18094 NET_AX25_T3_TIMEOUT=9,
18095 NET_AX25_IDLE_TIMEOUT=10,
18096 NET_AX25_N2=11,
18097 NET_AX25_PACLEN=12,
18098 NET_AX25_PROTOCOL=13,
18099 NET_AX25_DAMA_SLAVE_TIMEOUT=14
18100 };
18101
18102 /* /proc/sys/net/rose */
18103 enum {
18104 NET_ROSE_RESTART_REQUEST_TIMEOUT=1,
18105 NET_ROSE_CALL_REQUEST_TIMEOUT=2,
18106 NET_ROSE_RESET_REQUEST_TIMEOUT=3,
18107 NET_ROSE_CLEAR_REQUEST_TIMEOUT=4,
18108 NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5,
18109 NET_ROSE_ROUTING_CONTROL=6,
18110 NET_ROSE_LINK_FAIL_TIMEOUT=7,
18111 NET_ROSE_MAX_VCS=8,
18112 NET_ROSE_WINDOW_SIZE=9,
18113 NET_ROSE_NO_ACTIVITY_TIMEOUT=10
18114 };
18115
18116 /* /proc/sys/net/x25 */
18117 enum {
18118 NET_X25_RESTART_REQUEST_TIMEOUT=1,
18119 NET_X25_CALL_REQUEST_TIMEOUT=2,
18120 NET_X25_RESET_REQUEST_TIMEOUT=3,
18121 NET_X25_CLEAR_REQUEST_TIMEOUT=4,
18122 NET_X25_ACK_HOLD_BACK_TIMEOUT=5
18123 };
18124
18125 /* /proc/sys/net/token-ring */
18126 enum
18127 {
18128 NET_TR_RIF_TIMEOUT=1
18129 };
18130
18131 /* /proc/sys/net/decnet */
18132 enum {
18133 NET_DECNET_DEF_T3_BROADCAST=1,
18134 NET_DECNET_DEF_T3_POINTTOPOINT=2,
18135 NET_DECNET_DEF_T1=3,
18136 NET_DECNET_DEF_BCT1=4,
18137 NET_DECNET_CACHETIMEOUT=5,
18138 NET_DECNET_DEBUG_LEVEL=6
18139 };
18140
18141 /* CTL_PROC names: */
18142
18143 /* CTL_FS names: */
18144 enum
18145 {
18146 /* int:current number of allocated inodes */
18147 FS_NRINODE=1,
18148 FS_STATINODE=2,
18149 /* int:max number of inodes that can be allocated */
18150 FS_MAXINODE=3,
18151 /* int:current number of allocated dquots */
18152 FS_NRDQUOT=4,
18153 /* int:max number of dquots that can be allocated */
18154 FS_MAXDQUOT=5,
18155 /* int:current number of allocated filedescriptors */
18156 FS_NRFILE=6,
18157 /* int:max #of filedescriptors that can be allocated */
18158 FS_MAXFILE=7,
18159 FS_DENTRY=8,
18160 /* int:current number of allocated super_blocks */
18161 FS_NRSUPER=9,
18162 /* int:max # of super_blocks that can be allocated */
18163 FS_MAXSUPER=10
18164 };
18165
18166 /* CTL_DEBUG names: */
18167
18168 /* CTL_DEV names: */
18169 enum {
18170 DEV_CDROM=1,
18171 DEV_HWMON=2
18172 };
18173
18174 /* /proc/sys/dev/cdrom */
18175 enum {
18176 DEV_CDROM_INFO=1
18177 };
18178
18179 #ifdef __KERNEL__
18180
18181 extern asmlinkage int sys_sysctl(struct __sysctl_args *);
18182 extern void sysctl_init(void);
18183
18184 typedef struct ctl_table ctl_table;
18185
18186 typedef int ctl_handler(ctl_table *table,
18187 int *name, int nlen,
18188 void *oldval, size_t *oldlenp,
18189 void *newval, size_t newlen,
18190 void **context);
18191
18192 typedef int proc_handler(ctl_table *ctl, int write,
18193 struct file * filp, void *buffer, size_t *lenp);
18194
18195 extern int proc_dostring(ctl_table *, int, struct file *,
18196 void *, size_t *);
18197 extern int proc_dointvec(ctl_table *, int, struct file *,
18198 void *, size_t *);
18199 extern int proc_dointvec_minmax(ctl_table *, int,
18200 struct file *, void *, size_t *);
18201 extern int proc_dointvec_jiffies(ctl_table *, int,
18202 struct file *, void *, size_t *);
18203
18204 extern int do_sysctl (int *name, int nlen,
18205 void *oldval, size_t *oldlenp,
18206 void *newval, size_t newlen);
18207
18208 extern int do_sysctl_strategy (ctl_table *table,
18209 int *name, int nlen,
18210 void *oldval, size_t *oldlenp,
18211 void *newval, size_t newlen,
18212 void ** context);
18213
18214 extern ctl_handler sysctl_string;
18215 extern ctl_handler sysctl_intvec;
18216
18217 extern int do_string (
18218 void *oldval, size_t *oldlenp,
18219 void *newval, size_t newlen,
18220 int rdwr, char *data, size_t max);
18221 extern int do_int (
18222 void *oldval, size_t *oldlenp,
18223 void *newval, size_t newlen,
18224 int rdwr, int *data);
18225 extern int do_struct (
18226 void *oldval, size_t *oldlenp,
18227 void *newval, size_t newlen,
18228 int rdwr, void *data, size_t len);
18229
18230
18231 /* Register a set of sysctl names by calling
18232 * register_sysctl_table with an initialised array of
18233 * ctl_table's. An entry with zero ctl_name terminates
18234 * the table. table->de will be set up by the
18235 * registration and need not be initialised in advance.
18236 *
18237 * sysctl names can be mirrored automatically under
18238 * /proc/sys. The procname supplied controls /proc
18239 * naming.
18240 *
18241 * The table's mode will be honoured both for
18242 * sys_sysctl(2) and proc-fs access.
18243 *
18244 * Leaf nodes in the sysctl tree will be represented by a
18245 * single file under /proc; non-leaf nodes will be
18246 * represented by directories. A null procname disables
18247 * /proc mirroring at this node.
18248 *
18249 * sysctl(2) can automatically manage read and write
18250 * requests through the sysctl table. The data and
18251 * maxlen fields of the ctl_table struct enable minimal
18252 * validation of the values being written to be
18253 * performed, and the mode field allows minimal
18254 * authentication.
18255 *
18256 * More sophisticated management can be enabled by the
18257 * provision of a strategy routine with the table entry.
18258 * This will be called before any automatic read or write
18259 * of the data is performed.
18260 *
18261 * The strategy routine may return:
18262 * <0: Error occurred (error is passed to user process)
18263 * 0: OK - proceed with automatic read or write.
18264 * >0: OK - read or write has been done by the strategy
18265 * routine, so return immediately.
18266 *
18267 * There must be a proc_handler routine for any terminal
18268 * nodes mirrored under /proc/sys (non-terminals are
18269 * handled by a built-in directory handler). Several
18270 * default handlers are available to cover common cases.
18271 */
18272
18273 /* A sysctl table is an array of struct ctl_table: */
18274 struct ctl_table
18275 {
18276 int ctl_name; /* Binary ID */
18277 const char *procname; /* Text ID for /proc/sys, or 0 */
18278 void *data;
18279 int maxlen;
18280 mode_t mode;
18281 ctl_table *child;
18282 proc_handler *proc_handler; /* CB for text formatting*/
18283 ctl_handler *strategy; /* CB fn for all r/w */
18284 struct proc_dir_entry *de; /* /proc control block */
18285 void *extra1;
18286 void *extra2;
18287 };
18288
18289 /* struct ctl_table_header is used to maintain dynamic
18290 * lists of ctl_table trees. */
18291 struct ctl_table_header
18292 {
18293 ctl_table *ctl_table;
18294 DLNODE(struct ctl_table_header) ctl_entry;
18295 };
18296
18297 struct ctl_table_header * register_sysctl_table(
18298 ctl_table * table, int insert_at_head);
18299 void unregister_sysctl_table(
18300 struct ctl_table_header * table);
18301
18302 #else /* __KERNEL__ */
18303
18304 #endif /* __KERNEL__ */
18305
18306 #endif /* _LINUX_SYSCTL_H */
Сайт управляется системой
uCoz