procps/procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff
2012-06-04 14:22:08 +00:00

47 lines
1.1 KiB
Diff

--- sysctl.8
+++ sysctl.8 2012-06-04 10:27:39.048010081 +0000
@@ -79,6 +79,8 @@ Print value without new line.
\fB\-\-system\fR
Load settings from all system configuration files.
.br
+/boot/sysctl.conf-<kernelversion>
+.br
/run/sysctl.d/*.conf
.br
/etc/sysctl.d/*.conf
--- sysctl.c
+++ sysctl.c 2012-06-04 10:29:12.944010410 +0000
@@ -39,6 +39,7 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/utsname.h>
#include <unistd.h>
#include "c.h"
@@ -569,6 +570,7 @@ static int sortpairs(const void *A, cons
static int PreloadSystem(void)
{
unsigned di, i;
+ struct utsname uts;
const char *dirs[] = {
"/run/sysctl.d",
"/etc/sysctl.d",
@@ -631,6 +633,16 @@ static int PreloadSystem(void)
}
qsort(cfgs, ncfgs, sizeof(struct cfg *), sortpairs);
+ if (uname(&uts) == 0) {
+ char buf[PATH_MAX];
+ snprintf(buf, sizeof(buf), "/boot/sysctl.conf-%s", uts.release);
+ if (access(buf, R_OK) == 0) {
+ if (!Quiet)
+ printf("* Applying %s ...\n", buf);
+ Preload(buf);
+ }
+ }
+
for (i = 0; i < ncfgs; ++i) {
if (!Quiet)
printf(_("* Applying %s ...\n"), cfgs[i]->value);