File procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff of Package procps

---
 man/sysctl.8 |    2 ++
 src/sysctl.c |   12 ++++++++++++
 2 files changed, 14 insertions(+)

--- man/sysctl.8
+++ man/sysctl.8	2024-09-24 07:44:00.717403660 +0000
@@ -123,6 +123,7 @@ Display version information and exit.
 .TS
 Li.
 /proc/sys
+/boot/sysctl.conf\-\fR<kernelversion>\fP
 /etc/sysctl.d/\fR*\fP.conf
 /run/sysctl.d/\fR*\fP.conf
 /usr/local/lib/sysctl.d/\fR*\fP.conf
@@ -140,6 +141,7 @@ file of the same name in subsequent dire
 .P
 .TS
 Li.
+/boot/sysctl.conf\-\fR<kernelversion>\fP
 /etc/sysctl.d/\fR*\fP.conf
 /run/sysctl.d/\fR*\fP.conf
 /usr/local/lib/sysctl.d/\fR*\fP.conf
--- src/sysctl.c
+++ src/sysctl.c	2024-09-24 07:41:02.012637471 +0000
@@ -46,6 +46,7 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/utsname.h>
 #include <unistd.h>
 #include <ctype.h>
 
@@ -831,6 +832,7 @@ static int sortpairs(const void *A, cons
 static int PreloadSystem(SettingList *setlist)
 {
 	unsigned di, i;
+	struct utsname uts;
 	const char *dirs[] = {
 		"/etc/sysctl.d",
 		"/run/sysctl.d",
@@ -895,6 +897,16 @@ static int PreloadSystem(SettingList *se
 	}
 	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(setlist, buf);
+		}
+	}
+
 	for (i = 0; i < ncfgs; ++i) {
 		if (!Quiet)
 			printf(_("* Applying %s ...\n"), cfgs[i]->value);
openSUSE Build Service is sponsored by