The sysctl is a Unix interface used to modify variables that the kernel uses to determine behavior. There are two ways to work with sysctl: by directly reading and modifying files in /proc/sys and by using the sysctl program supplied with most distributions. The regedit interface is the closest parallel for Windows.
Questions tagged [sysctl]
174 questions
4
votes
3 answers
Is there a way to change max number of threads can be created on OS X 10.6 by JVM?
According to this stackoverflow post, there is a limit on Mac OS X 10.6 for how many threads can be created by JVM or any application. The limit can be displayed by running following command in terminal:
sysctl kern.num_threads
and
sysctl…

Jifeng Zhang
- 5,037
- 4
- 30
- 43
4
votes
1 answer
Nginx and sysctl configuration - Performance setting
Nginx is acting as a reverse proxy for adserver, receiving 20k requests per minute. Response happens within 100ms from the adserver to the nginx
Running on a Virtual Machine with configuration as
128GB RAM
4 vCPU
100GB HDD
Considering above, what…

Tahseen
- 1,027
- 1
- 12
- 32
4
votes
0 answers
Netmask returned in rt_msghdr2 in invalid format
I want to parse the routes returned by the kernel when invoking the sysctl function with the arguments: { CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_DUMP2, 0 }.
After doing that I get several routing messages, in all of them I have found the issue: the…

Santiago Alessandri
- 6,630
- 30
- 46
4
votes
1 answer
Why is "echo l > /proc/sysrq-trigger" call trace output always similar?
According to the official kernel.org documentation echo l > /proc/sysrq-trigger is supposed to give me the current call trace of all CPUs. But when I do this a couple of times and look into dmesg after that the call traces look completely similar.…

JohnnyFromBF
- 9,873
- 10
- 45
- 59
4
votes
2 answers
Dynamically adding entries to sysctl
Consider this code:
int procmon_state = 0;
static struct ctl_table_header *procmon_table_header;
static ctl_table state_table[] = {
{
.procname = "state", .mode = 0666,
.proc_handler = &proc_dointvec_minmax,
.data =…

alexandernst
- 14,352
- 22
- 97
- 197
3
votes
2 answers
Find out MAC address on Linux&FreeBSD in C
I am trying to find out MAC address and I managed to create working solution using sysctl in Linux, problem is, that this solution is not working on FreeBSD version I am developing on. Is there any way I can find out mac address in C other than…

Blackie123
- 1,271
- 4
- 16
- 22
3
votes
1 answer
"Invalid argument" error for sysctl vm.drop_caches key in Ubuntu 11.10 (kernel 3.0.0-12)
I have the following shell script that I've been using in previous versions of Ubuntu (<= 11.04) to clear memory cache and it has worked fine:
sudo sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0
I have a new clean…

wahalulu
- 1,447
- 2
- 17
- 23
3
votes
1 answer
centos issue with docker sysctl changes specific to net.ipv4.tcp_timestamps
The goal is to launch the container with specific tcp_timestamps and tcp_sack flags.
This command is working as expected on ubuntu (22.05) and fedora (36) hosts.
docker run --privileged --rm -dt --name ubuntu -p 8080:80 ubuntu /bin/bash -c "sysctl…

json ilika
- 31
- 4
3
votes
1 answer
set net.ipv4.tcp_timestamps=0 in Pod
I would like to set net.ipv4.tcp_timestamps=0 in Pods of my k8s cluster, However it gives me error:
sysctl: cannot stat /proc/sys/net/ipv4/tcp_timestamps: No such file or directory"
Same issue with container directly created with docker run…

James Pei
- 151
- 2
- 11
3
votes
0 answers
Find PID of process using a TCP port programmatically on macOS
Currently I am coding a monitoring tool for macOS. Currently stuck on a problem where I am unable to get the PID of the process who is using the specific port.
for example: Assume a process say a chat server running hosted on port 9999 is currently…

Prasanna
- 93
- 10
3
votes
1 answer
usrsctp send buffer does not free itself
We're working with a C++ webrtc data channels library and in our test application, upon sending a few small packets that would totally amount to about 256kB, the usrsctp_sendv() call returns -1 (with errno as EWOULDBLOCK/EAGAIN which means "Resource…

Irfan
- 1,758
- 3
- 24
- 32
3
votes
2 answers
What are the units of UDP buffers, and where are docs for sysctl params?
I'm running x86_64 RedHat 5.3 (kernel 2.6.18) and looking specifically at net.core.rmem_max from sysctl -a in the context of trying to set UDP buffers. The receiver application misses packets sometimes, but I think the buffer is already plenty…

limalave
- 91
- 1
- 2
- 3
3
votes
1 answer
How to increase openfiles per process limit on FreeBSD 10.1?
I have issue about openfiles limit per process on FreeBSD 10.1-RELEASE. To prove it, I make python script to generate dummy files and opened those files. Script available in
Generator: https://gist.github.com/juniorh/ef9273911dee551f1048
Loader:…

Rizal Muhammad Nur
- 71
- 5
3
votes
1 answer
How to get running process list in iOS 9?
iOS 9 之前,获取正在运行的进程列表的方法是使用sysctl这个方法
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL ,0};
size_t miblen = 4;
size_t size;
int st = sysctl(mib, miblen, NULL, &size, NULL, 0);
struct kinfo_proc * process = NULL;
struct kinfo_proc * newprocess =…

worker
- 69
- 1
- 3
3
votes
2 answers
Is sysctl call on iOS to get background process list a private call?
My app is made available in App Store and hence cannot use private api's.
Would like to know that whether the call to sysctl to get the list of background process is a private api call?
Below is the code snipper to get the list of running process.…

Marimuthu
- 437
- 4
- 14