Why does sysctl not write under /sys

Posted by Alexander Todorov on Wed 13 May 2015

Recently I've been looking into fixing tilde and Fn keys mapping for MacBook Air and thought I could use sysctl to permanently set the desired values. Unfortunately this is not possible. sysctl can only write under /proc/sys and this is hard-coded in the source:

static const char PROC_PATH[] = "/proc/sys/";

IMO this is relatively easy to patch and allow sysctl to read/write values under /sys. The only open question I see is backward compatibility - maybe adding new parameter (e.g. --sysfs) or adding extended sytax e.g. if variable name starts with / then treat it as absolute path.

I've asked sysctl maintainers on the procps mailing list but so far got no answer.

Is anyone else interested in this? How do you set parameter values under /sys then ?

NOTE: for my particular purposes I could have used config files under /etc/modprobe.d/ or a startup script (I used that) instead.

Comments !