version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
SYSCTL |
|
|
2 |
!!!SYSCTL |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
EXAMPLE |
|
|
7 |
RETURN VALUE |
|
|
8 |
ERRORS |
|
|
9 |
CONFORMING TO |
|
|
10 |
BUGS |
|
|
11 |
SEE ALSO |
|
|
12 |
---- |
|
|
13 |
!!NAME |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
sysctl - read/write system parameters |
|
|
17 |
!!SYNOPSIS |
|
|
18 |
|
|
|
19 |
|
|
|
20 |
__#include __ |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
__#include __ |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
__#include __ |
|
|
27 |
|
|
|
28 |
|
|
|
29 |
___syscall1(int, _sysctl, struct __sysctl_args *, |
|
|
30 |
args);__ |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
__int _sysctl(struct __sysctl_args |
|
|
34 |
*__''args''__);__ |
|
|
35 |
!!DESCRIPTION |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
The ___sysctl__ call reads and/or writes kernel |
|
|
39 |
parameters. For example, the hostname, or the maximum number |
|
|
40 |
of open files. The argument has the form |
|
|
41 |
|
|
|
42 |
|
|
|
43 |
struct __sysctl_args { |
|
|
44 |
int *name; /* integer vector describing variable */ |
|
|
45 |
int nlen; /* length of this vector */ |
|
|
46 |
void *oldval; /* 0 or address where to store old value */ |
|
|
47 |
size_t *oldlenp; /* available room for old value, |
|
|
48 |
overwritten by actual size of old value */ |
|
|
49 |
void *newval; /* 0 or address of new value */ |
|
|
50 |
size_t newlen; /* size of new value */ |
|
|
51 |
}; |
|
|
52 |
This call does a search in a tree structure, possibly resembling a directory tree under __/proc/sys__, and if the requested item is found calls some appropriate routine to read or modify the value. |
|
|
53 |
!!EXAMPLE |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
#include |
|
|
57 |
!!RETURN VALUE |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
Upon successful completion, ___sysctl__ returns 0. |
|
|
61 |
Otherwise, a value of -1 is returned and ''errno'' is set |
|
|
62 |
to indicate the error. |
|
|
63 |
!!ERRORS |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
__ENOTDIR__ |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
''name'' was not found. |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
__EPERM__ |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
No search permission for one of the encountered |
|
|
76 |
`directories', or no read permission where ''oldval'' was |
|
|
77 |
nonzero, or no write permission where ''newval'' was |
|
|
78 |
nonzero. |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
__EFAULT__ |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
The invocation asked for the previous value by setting |
|
|
85 |
''oldval'' non-NULL, but allowed zero room in |
|
|
86 |
''oldlenp''. |
|
|
87 |
!!CONFORMING TO |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
This call is Linux-specific, and should not be used in |
|
|
91 |
programs intended to be portable. A __sysctl__ call has |
|
|
92 |
been present in Linux since version 1.3.57. It originated in |
|
|
93 |
4.4BSD. Only Linux has the ''/proc/sys'' mirror, and the |
|
|
94 |
object naming schemes differ between Linux and BSD 4.4, but |
|
|
95 |
the declaration of the sysctl(2) function is the same |
|
|
96 |
in both. |
|
|
97 |
!!BUGS |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
The object names vary between kernel versions. THIS MAKES |
|
|
101 |
THIS SYSTEM CALL WORTHLESS FOR APPLICATIONS. Use the |
|
|
102 |
''/proc/sys'' interface instead. |
|
|
103 |
Not all available objects are properly documented. |
|
|
104 |
It is not yet possible to change operating system by writing |
|
|
105 |
to ''/proc/sys/kernel/ostype''. |
|
|
106 |
!!SEE ALSO |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
proc(5) |
|
|
110 |
---- |