diff options
author | Florian Weimer <fweimer@redhat.com> | 2020-04-15 17:17:32 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2020-04-15 17:17:32 +0200 |
commit | 076f09afbac1aa57756faa7a8feadb7936a724e4 (patch) | |
tree | 403647ecb96c88decbd178be4999cc5caf097b21 /manual | |
parent | c4d4419433f1b2c9c4d54ee6da2b0d2a30e3fda8 (diff) | |
download | glibc-076f09afbac1aa57756faa7a8feadb7936a724e4.tar glibc-076f09afbac1aa57756faa7a8feadb7936a724e4.tar.gz glibc-076f09afbac1aa57756faa7a8feadb7936a724e4.tar.bz2 glibc-076f09afbac1aa57756faa7a8feadb7936a724e4.zip |
Linux: Remove <sys/sysctl.h> and the sysctl function
Linux 5.5 remove the system call in commit
61a47c1ad3a4dc6882f01ebdc88138ac62d0df03 ("Linux: Remove
<sys/sysctl.h>"). Therefore, the compat function is just a stub that
sets ENOSYS.
Due to SHLIB_COMPAT, new ports will not add the sysctl function anymore
automatically.
x32 already lacks the sysctl function, so an empty sysctl.c file is
used to suppress it. Otherwise, a new compat symbol would be added.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'manual')
-rw-r--r-- | manual/sysinfo.texi | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/manual/sysinfo.texi b/manual/sysinfo.texi index 4beee0129b..4ca4555443 100644 --- a/manual/sysinfo.texi +++ b/manual/sysinfo.texi @@ -14,7 +14,6 @@ can make changes. * Platform Type:: Determining operating system and basic machine type * Filesystem Handling:: Controlling/querying mounts -* System Parameters:: Getting and setting various system parameters @end menu To get information on parameters of the system that are built into the @@ -1107,146 +1106,3 @@ to zeroes. It is more widely available than @code{umount2} but since it lacks the possibility to forcefully unmount a filesystem is deprecated when @code{umount2} is also available. @end deftypefun - - - -@node System Parameters -@section System Parameters - -This section describes the @code{sysctl} function, which gets and sets -a variety of system parameters. - -The symbols used in this section are declared in the file @file{sys/sysctl.h}. - -@deftypefun int sysctl (int *@var{names}, int @var{nlen}, void *@var{oldval}, size_t *@var{oldlenp}, void *@var{newval}, size_t @var{newlen}) -@standards{BSD, sys/sysctl.h} -@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} -@c Direct syscall, Linux only. - -@code{sysctl} gets or sets a specified system parameter. There are so -many of these parameters that it is not practical to list them all here, -but here are some examples: - -@itemize @bullet -@item network domain name -@item paging parameters -@item network Address Resolution Protocol timeout time -@item maximum number of files that may be open -@item root filesystem device -@item when kernel was built -@end itemize - -The set of available parameters depends on the kernel configuration and -can change while the system is running, particularly when you load and -unload loadable kernel modules. - -The system parameters with which @code{sysctl} is concerned are arranged -in a hierarchical structure like a hierarchical filesystem. To identify -a particular parameter, you specify a path through the structure in a -way analogous to specifying the pathname of a file. Each component of -the path is specified by an integer and each of these integers has a -macro defined for it by @file{sys/sysctl.h}. @var{names} is the path, in -the form of an array of integers. Each component of the path is one -element of the array, in order. @var{nlen} is the number of components -in the path. - -For example, the first component of the path for all the paging -parameters is the value @code{CTL_VM}. For the free page thresholds, the -second component of the path is @code{VM_FREEPG}. So to get the free -page threshold values, make @var{names} an array containing the two -elements @code{CTL_VM} and @code{VM_FREEPG} and make @var{nlen} = 2. - - -The format of the value of a parameter depends on the parameter. -Sometimes it is an integer; sometimes it is an ASCII string; sometimes -it is an elaborate structure. In the case of the free page thresholds -used in the example above, the parameter value is a structure containing -several integers. - -In any case, you identify a place to return the parameter's value with -@var{oldval} and specify the amount of storage available at that -location as *@var{oldlenp}. *@var{oldlenp} does double duty because it -is also the output location that contains the actual length of the -returned value. - -If you don't want the parameter value returned, specify a null pointer -for @var{oldval}. - -To set the parameter, specify the address and length of the new value -as @var{newval} and @var{newlen}. If you don't want to set the parameter, -specify a null pointer as @var{newval}. - -If you get and set a parameter in the same @code{sysctl} call, the value -returned is the value of the parameter before it was set. - -Each system parameter has a set of permissions similar to the -permissions for a file (including the permissions on directories in its -path) that determine whether you may get or set it. For the purposes of -these permissions, every parameter is considered to be owned by the -superuser and Group 0 so processes with that effective uid or gid may -have more access to system parameters. Unlike with files, the superuser -does not invariably have full permission to all system parameters, because -some of them are designed not to be changed ever. - - -@code{sysctl} returns a zero return value if it succeeds. Otherwise, it -returns @code{-1} and sets @code{errno} appropriately. Besides the -failures that apply to all system calls, the following are the -@code{errno} codes for all possible failures: - -@table @code -@item EPERM -The process is not permitted to access one of the components of the -path of the system parameter or is not permitted to access the system parameter -itself in the way (read or write) that it requested. -@c There is some indication in the Linux 2.2 code that the code is trying to -@c return EACCES here, but the EACCES value never actually makes it to the -@c user. -@item ENOTDIR -There is no system parameter corresponding to @var{name}. -@item EFAULT -@var{oldval} is not null, which means the process wanted to read the parameter, -but *@var{oldlenp} is zero, so there is no place to return it. -@item EINVAL -@itemize @bullet -@item -The process attempted to set a system parameter to a value that is not valid -for that parameter. -@item -The space provided for the return of the system parameter is not the right -size for that parameter. -@end itemize -@item ENOMEM -This value may be returned instead of the more correct @code{EINVAL} in some -cases where the space provided for the return of the system parameter is too -small. - -@end table - -@end deftypefun - -If you have a Linux kernel with the @code{proc} filesystem, you can get -and set most of the same parameters by reading and writing to files in -the @code{sys} directory of the @code{proc} filesystem. In the @code{sys} -directory, the directory structure represents the hierarchical structure -of the parameters. E.g. you can display the free page thresholds with -@smallexample -cat /proc/sys/vm/freepages -@end smallexample -@c In Linux, the sysctl() and /proc instances of the parameter are created -@c together. The proc filesystem accesses the same data structure as -@c sysctl(), which has special fields in it for /proc. But it is still -@c possible to create a sysctl-only parameter. - -Some more traditional and more widely available, though less general, -@glibcadj{} functions for getting and setting some of the same system -parameters are: - -@itemize @bullet -@item -@code{getdomainname}, @code{setdomainname} -@item -@code{gethostname}, @code{sethostname} (@xref{Host Identification}.) -@item -@code{uname} (@xref{Platform Type}.) -@end itemize |