Line
Link Here
|
|
Having one constructor depend on another means if the order is reversed |
|
Having one constructor depend on another means if the order is reversed |
1 |
you get a different result. Patched based on idea by Tom Evans. |
1 |
you get a different result. Patched based on idea by Tom Evans. |
2 |
-- a/proc/sysinfo.c |
2 |
++ b/proc/sysinfo.c |
Lines 213-218
Link Here
|
213 |
static void init_libproc(void) __attribute__((constructor)); |
213 |
static void init_libproc(void) __attribute__((constructor)); |
214 |
static void init_libproc(void){ |
214 |
static void init_libproc(void){ |
215 |
have_privs = check_for_privs(); |
215 |
have_privs = check_for_privs(); |
|
|
216 |
init_Linux_version(); /* Must be called before we check code */ |
216 |
// ought to count CPUs in /proc/stat instead of relying |
217 |
// ought to count CPUs in /proc/stat instead of relying |
217 |
// on glibc, which foolishly tries to parse /proc/cpuinfo |
218 |
// on glibc, which foolishly tries to parse /proc/cpuinfo |
218 |
// |
219 |
// |
219 |
-- a/proc/version.c |
220 |
++ b/proc/version.c |
Lines 33-40
Link Here
|
33 |
|
33 |
|
34 |
int linux_version_code; |
34 |
int linux_version_code; |
35 |
|
35 |
|
36 |
static void init_Linux_version(void) __attribute__((constructor)); |
36 |
void init_Linux_version(void) { |
37 |
static void init_Linux_version(void) { |
|
|
38 |
int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */ |
37 |
int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */ |
39 |
FILE *fp; |
38 |
FILE *fp; |
40 |
char buf[256]; |
39 |
char buf[256]; |
41 |
-- a/proc/version.h |
40 |
++ b/proc/version.h |
Lines 14-19
Link Here
|
14 |
|
14 |
|
15 |
EXTERN_C_BEGIN |
15 |
EXTERN_C_BEGIN |
16 |
|
16 |
|
|
|
17 |
void init_Linux_version(void); /* Get Linux version */ |
17 |
extern void display_version(void); /* display suite version */ |
18 |
extern void display_version(void); /* display suite version */ |
18 |
extern const char procps_version[]; /* global buf for suite version */ |
19 |
extern const char procps_version[]; /* global buf for suite version */ |
19 |
|
20 |
|