sys_sysctl  [kernel/sysctl.c]


Reads and/or writes kernel parameters. For example, the hostname, or the maximum number of open files.

Arguments

eax 149
ebx Pointer to a __sysctl_args structure:
struc __sysctl_args
{
name     rd 1
nlen     rd 1
oldval   rd 1
oldlenp  rd 1
newval   rd 1
newlen   rd 1
__unused rd 4
}

__sysctl_args members:

name
Pointer to a value describing the intended operation. Usually it's two dwords with first being the control group descriptor CTL_* and second is appropriate member descriptor. Refer to /include/linux/sysctl.h for a description of available values.
nlen
Length of the value pointed by name.
oldval
Pointer to an address where old variable will be stored. It may be 0.
oldlenp
Size of the buffer pointed by oldval. oldenp will be overwritten by the actual size of the variable upon completion.
newval
Pointer to an address containing the new value. It may be 0.
newlen
Size of the new value pointed by newval.
__unused
Unused.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EFAULT The invocation asked for the previous value by setting __sysctl_args.oldval non-NULL, but allowed zero room in __sysctl_args.oldlenp.
-ENOTDIR __sysctl_args.name was not found.
-EPERM No search permission for one of the encountered `directories', or no read permission where __sysctl_args.oldval was non-zero, or no write permission where __sysctl_args.newval was non-zero.

Remarks

The object names may vary between kernel versions. Use the /proc/sys interface instead.
It is not yet possible to change operating system by writing to /proc/sys/kernel/ostype.

See /samples/basic/sysctl.asm for an example.

Compatibility

n/a