Skip to content

Conversation

@ghaerr
Copy link
Owner

@ghaerr ghaerr commented May 8, 2024

Adds new lightweight sysctl(int op, char *name, int *value) system call and
sysctl [-a] [option_name[=value]] utility. syscall -a lists all available options and their values.

These enhancements are for some upcoming functionality that allows for turning on and off various options at runtime, such as malloc debugging information, TCP/IP options, etc. The combination allows for both querying a human-readable option "name" value and and its associated (currently numeric only) value. The sysctl command is also scriptable, for easy test integration. The combination allows for application programs to query and set information, which previously required special techniques.

The planned usage might be something like sysctl malloc.debug=1 to turn on level 1 malloc debug output, for instance, or communicating with a running ktcp by using sysctl net.debug=3, etc. The option names are just string values defined in the kernel and associated with an int variable.

The current list of options are:

# sysctl -a
kern.debug=1       # ^P kernel debug messages on/off
kern.strace=0      # kernel strace=1, kstack=2 with CONFIG_TRACE=y
kern.console=1024  # console device (e.g. 0x440 for /dev/ttyS0)
malloc.debug=0     # not yet implemented
net.debug=0        # not yet implemented

Ideas for future options are welcomed.

@ghaerr ghaerr merged commit 3c9b431 into master May 8, 2024
@ghaerr ghaerr deleted the sysctl branch May 8, 2024 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants