2011-08-26 14:17:54 +02:00
|
|
|
From 16c356dc827152883b1e0d5c5f195eeff6f85daf Mon Sep 17 00:00:00 2001
|
2011-05-28 22:50:18 +02:00
|
|
|
From: Ludwig Nussel <ludwig.nussel@suse.de>
|
|
|
|
Date: Tue, 17 May 2011 16:35:18 +0200
|
2011-08-26 14:15:37 +02:00
|
|
|
Subject: [PATCH 3/3] read sysctls also from /boot/sysctl.conf-$kernelversion
|
2011-05-28 22:50:18 +02:00
|
|
|
|
|
|
|
---
|
2011-08-26 14:17:54 +02:00
|
|
|
sysctl.c | 12 ++++++++++++
|
|
|
|
1 files changed, 12 insertions(+), 0 deletions(-)
|
2011-05-28 22:50:18 +02:00
|
|
|
|
|
|
|
diff --git a/sysctl.c b/sysctl.c
|
2011-08-26 14:17:54 +02:00
|
|
|
index 1867777..a38a81c 100644
|
2011-05-28 22:50:18 +02:00
|
|
|
--- 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>
|
2011-08-26 14:15:37 +02:00
|
|
|
@@ -510,6 +511,7 @@ static int sortpairs(const void* A, const void* B)
|
2011-05-28 22:50:18 +02:00
|
|
|
|
|
|
|
static int PreloadSystem(void) {
|
2011-08-26 14:15:37 +02:00
|
|
|
unsigned di, i;
|
2011-05-28 22:50:18 +02:00
|
|
|
+ struct utsname uts;
|
|
|
|
const char* dirs[] = {
|
2011-08-26 14:15:37 +02:00
|
|
|
"/run/sysctl.d",
|
2011-05-28 22:50:18 +02:00
|
|
|
"/etc/sysctl.d",
|
2011-08-26 14:17:54 +02:00
|
|
|
@@ -556,6 +558,16 @@ static int PreloadSystem(void) {
|
2011-08-26 14:15:37 +02:00
|
|
|
|
|
|
|
qsort(cfgs, ncfgs, sizeof(struct cfg*), sortpairs);
|
|
|
|
|
2011-05-28 22:50:18 +02:00
|
|
|
+ if (uname(&uts) == 0) {
|
2011-08-26 14:17:54 +02:00
|
|
|
+ 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);
|
|
|
|
+ }
|
2011-05-28 22:50:18 +02:00
|
|
|
+ }
|
2011-08-26 14:15:37 +02:00
|
|
|
+
|
|
|
|
for (i = 0; i < ncfgs; ++i) {
|
|
|
|
if (!Quiet)
|
|
|
|
printf("* Applying %s ...\n", cfgs[i]->value);
|
2011-05-28 22:50:18 +02:00
|
|
|
--
|
|
|
|
1.7.3.4
|
|
|
|
|