procps/procps-3.2.8-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff
Cristian Rodríguez a082bb1e4a Accepting request 71353 from home:lnussel:branches:Base:System
- load sysctls earlier (bnc#664550)
- move distro defaults to /lib/sysctl.d to avoid .rpmnew files
- enable IPv6 privacy by default (bnc#678066)

I've sent the --system and --pattern path upstream but they weren't accepted
yet. So this is tentative but we need the /lib/sysctl.d feature to be able to
provide distro defaults in a sane way.

OBS-URL: https://build.opensuse.org/request/show/71353
OBS-URL: https://build.opensuse.org/package/show/Base:System/procps?expand=0&rev=46
2011-05-28 20:50:18 +00:00

47 lines
1.2 KiB
Diff

From 40c2bfe16c9a9e9562c686afa9d6b7f754a5c8d9 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
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 <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/utsname.h>
#include <dirent.h>
#include <string.h>
#include <errno.h>
@@ -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