From 40c2bfe16c9a9e9562c686afa9d6b7f754a5c8d9 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Tue, 17 May 2011 16:35:18 +0200 Subject: [PATCH procps 3/3] read sysctls also from /boot/sysctl.conf-$kernelversion --- sysctl.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/sysctl.c b/sysctl.c index b68170b..6967ca8 100644 --- a/sysctl.c +++ b/sysctl.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -497,12 +498,21 @@ static int Preload(const char *restrict const filename) { static int PreloadSystem(void) { unsigned i; + struct utsname uts; const char* dirs[] = { "/lib/sysctl.d", "/usr/lib/sysctl.d", "/usr/local/lib/sysctl.d", "/etc/sysctl.d", }; + if (uname(&uts) == 0) { + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "/boot/sysctl.conf-%s", uts.release); + if (access(buf, R_OK) == 0) { + printf("* Applying %s ...\n", buf); + Preload(buf); + } + } for (i=0; i < sizeof(dirs)/sizeof(dirs[0]); ++i) { struct dirent* de; DIR* dp = opendir(dirs[i]); -- 1.7.3.4