summaryrefslogtreecommitdiffstats
path: root/system/nvidia-legacy390-driver/nvidia-installer-removed-sysctl-h.patch
diff options
context:
space:
mode:
Diffstat (limited to 'system/nvidia-legacy390-driver/nvidia-installer-removed-sysctl-h.patch')
-rw-r--r--system/nvidia-legacy390-driver/nvidia-installer-removed-sysctl-h.patch72
1 files changed, 47 insertions, 25 deletions
diff --git a/system/nvidia-legacy390-driver/nvidia-installer-removed-sysctl-h.patch b/system/nvidia-legacy390-driver/nvidia-installer-removed-sysctl-h.patch
index 7b230fcb11..df61dfa85d 100644
--- a/system/nvidia-legacy390-driver/nvidia-installer-removed-sysctl-h.patch
+++ b/system/nvidia-legacy390-driver/nvidia-installer-removed-sysctl-h.patch
@@ -1,36 +1,58 @@
-diff -Naur nvidia-installer-460.67.orig/kernel.c nvidia-installer-460.67/kernel.c
---- nvidia-installer-460.67.orig/kernel.c 2021-03-10 19:24:00.000000000 -0500
-+++ nvidia-installer-460.67/kernel.c 2021-04-16 17:59:48.828574898 -0400
-@@ -23,7 +23,10 @@
+diff -Nur nvidia-installer-390.143.orig/kernel.c nvidia-installer-390.143/kernel.c
+--- nvidia-installer-390.143.orig/kernel.c 2021-03-12 02:29:56.000000000 -0500
++++ nvidia-installer-390.143/kernel.c 2021-06-23 11:15:12.813980616 -0400
+@@ -23,7 +23,6 @@
#include <sys/utsname.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/sysctl.h>
-+#include <gnu/libc-version.h>
-+#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 30
-+ #include <sys/sysctl.h>
-+#endif
#include <ctype.h>
#include <stdlib.h>
#include <dirent.h>
-@@ -1076,7 +1079,8 @@
- }
+@@ -1055,9 +1050,9 @@
+ #define PRINTK_LOGLEVEL_KERN_ALERT 1
- if (!loglevel_set) {
-- /*
-+#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 30
-+ /*
- * Explicitly initialize the value of len, even though it looks like the
- * syscall should do that, since in practice it doesn't always actually
- * set the value of the pointed-to length parameter.
-@@ -1090,6 +1094,10 @@
- loglevel_set = TRUE;
- }
- }
-+#else /* sys/sysctl.h has been removed from glibc 2.32 and later */
-+ if (!old_level)
-+ loglevel_set = TRUE;
-+#endif
+ /*
+- * Attempt to set the printk loglevel, first using the /proc/sys interface,
+- * and falling back to the deprecated sysctl if that fails. Pass the previous
+- * loglevel back to the caller and return TRUE on success, or FALSE on failure.
++ * Attempt to set the printk loglevel using the /proc/sys interface.
++ * Pass the previous loglevel back to the caller and return TRUE on success,
++ * or FALSE on failure.
+ */
+ static int set_loglevel(int level, int *old_level)
+ {
+@@ -1067,6 +1062,9 @@
+ fp = fopen("/proc/sys/kernel/printk", "r+");
+ if (fp) {
+ if (!old_level || fscanf(fp, "%d ", old_level) == 1) {
++ /* Use a dynamic buffer for the string: the kernel does not range
++ * check the loglevel, so the value reported by the procfs file
++ * may have an unknown number of digits. */
+ char *strlevel = nvasprintf("%d", level);
+
+ fseek(fp, 0, SEEK_SET);
+@@ -1079,23 +1077,6 @@
+ fclose(fp);
}
+- if (!loglevel_set) {
+- /*
+- * Explicitly initialize the value of len, even though it looks like the
+- * syscall should do that, since in practice it doesn't always actually
+- * set the value of the pointed-to length parameter.
+- */
+- size_t len = sizeof(int);
+- int name[] = { CTL_KERN, KERN_PRINTK };
+-
+- if (!old_level ||
+- sysctl(name, ARRAY_LEN(name), old_level, &len, NULL, 0) == 0) {
+- if (sysctl(name, ARRAY_LEN(name), NULL, 0, &level, len) == 0) {
+- loglevel_set = TRUE;
+- }
+- }
+- }
+-
return loglevel_set;
+ }
+