aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/procps/procps-3.2.8/60_linux_version_init.patch
blob: 203ccb3347b0227c9f0537b8c671c34c521c49f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
## 60_linux_init.dpatch by  <david.sugar@canonical.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix Linux version detection which relied on elf loader side-effect.
## DP: This patch also depends on 40_gnu-kbsd-version, which modified
## DP: init_Linux_version().

@DPATCH@

Upstream-Status: inappropriate [upstream unmaintained]
---
 proc/sysinfo.c |    1 +
 proc/version.c |    5 +++--
 proc/version.h |    1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

Index: procps-3.2.8/proc/sysinfo.c
===================================================================
--- procps-3.2.8.orig/proc/sysinfo.c
+++ procps-3.2.8/proc/sysinfo.c
@@ -212,6 +212,7 @@ static int check_for_privs(void){
 static void init_libproc(void) __attribute__((constructor));
 static void init_libproc(void){
   have_privs = check_for_privs();
+  init_Linux_version(); // make sure we have version before continuing...
   // ought to count CPUs in /proc/stat instead of relying
   // on glibc, which foolishly tries to parse /proc/cpuinfo
   //
Index: procps-3.2.8/proc/version.c
===================================================================
--- procps-3.2.8.orig/proc/version.c
+++ procps-3.2.8/proc/version.c
@@ -33,8 +33,7 @@ void display_version(void) {
 
 int linux_version_code;
 
-static void init_Linux_version(void) __attribute__((constructor));
-static void init_Linux_version(void) {
+void init_Linux_version(void) {
     int x = 0, y = 0, z = 0;	/* cleared in case sscanf() < 2 */
     FILE *fp;
     char buf[256];
Index: procps-3.2.8/proc/version.h
===================================================================
--- procps-3.2.8.orig/proc/version.h
+++ procps-3.2.8/proc/version.h
@@ -14,6 +14,7 @@
 
 EXTERN_C_BEGIN
 
+extern void init_Linux_version(void);	/* initialize linux version */
 extern void display_version(void);	/* display suite version */
 extern const char procps_version[];		/* global buf for suite version */