Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
x/sys/unix: Sysctl doesn't supporting writing values #8757
Hello, This is not really reporting defects but more like a feature request. In syscall package, or go.sys package, Sysctl is defined as: func Sysctl(name string) (value string, err error) It provides a way to read values through sysctl, but makes it impossible to write/update values. Internally, it uses "sysctl" defined in each particular OS / ARCH. For example, (from zsyscall_freebsd_amd64.go): func sysctl(mib _C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) It would be nice if it can be exported in some way because this is essentially the same interface as defined in BSD systems. e.g. https://www.freebsd.org/cgi/man.cgi?sysctl(3) int sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, const void *newp, size_t newlen); int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, const void *newp, size_t newlen); Can we provide a similar set of functions in go.sys that provides full sysctl support (both read / write)? If go.sys is not frozen yet, maybe it's a good idea to use the function names used in most BSD systems, in which case current Sysctl will need to be renamed to, e.g., SysctlRead.