From e092b7a18dc47fbe173963ae3f15850695838b96 Mon Sep 17 00:00:00 2001 From: albert <> Date: Wed, 22 Jan 2003 08:31:50 +0000 Subject: [PATCH] better --info --- proc/procps.h | 21 +++++++++++-------- ps/global.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 10 deletions(-) diff --git a/proc/procps.h b/proc/procps.h index aefb1d94..605144f5 100644 --- a/proc/procps.h +++ b/proc/procps.h @@ -50,18 +50,23 @@ #define OBSOLETE #endif -// available when? // Tells gcc that function is library-internal; // so no need to do dynamic linking at run-time. -#if __GNUC__ > 2 // FIXME: total random guess that's sure to be wrong -#define VISIBILITY_HIDDEN visibility("hidden") +// This might work with slightly older compilers too. +#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 1 ) || __GNUC__ > 3 +#define HIDDEN __attribute__((visibility("hidden"))) #else -#define VISIBILITY_HIDDEN +#define HIDDEN +#endif + +// Like HIDDEN, but for an alias that gets created. +// In gcc-3.2 there is an alias+hidden conflict. +// Many will have patched this bug, but oh well. +#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 2 ) || __GNUC__ > 3 +#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x),visibility("hidden"))) +#else +#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x))) #endif -// mark function for internal use -#define HIDDEN __attribute__((VISIBILITY_HIDDEN)) -// given foo, create a foo_direct for internal use -#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x),VISIBILITY_HIDDEN)) // since gcc-2.5 #define NORETURN __attribute__((__noreturn__)) diff --git a/ps/global.c b/ps/global.c index ffe5ec99..edd4cf9a 100644 --- a/ps/global.c +++ b/ps/global.c @@ -348,6 +348,51 @@ void reset_global(void){ wchan_is_number = 0; } +static const char archdefs[] = +#ifdef __alpha__ +" alpha" +#endif +#ifdef __arm__ +" arm" +#endif +#ifdef __hppa__ +" hppa" +#endif +#ifdef __i386__ +" i386" +#endif +#ifdef __ia64__ +" ia64" +#endif +#ifdef __mc68000__ +" mc68000" +#endif +#ifdef __mips64__ +" mips64" +#endif +#ifdef __mips__ +" mips" +#endif +#ifdef __powerpc__ +" powerpc" +#endif +#ifdef __sh3__ +" sh3" +#endif +#ifdef __sh__ +" sh" +#endif +#ifdef __sparc__ +" sparc" +#endif +#ifdef __sparc_v9__ +" sparc_v9" +#endif +#ifdef __x86_64__ +" x86_64" +#endif +""; + /*********** spew variables ***********/ void self_info(void){ fprintf(stderr, @@ -379,8 +424,8 @@ void self_info(void){ LINUX_VERSION_PATCH(linux_version_code) ); /* __libc_print_version(); */ /* how can we get the run-time version? */ - fprintf(stderr, "Compiled with: libc %d, internal version %d.%d\n\n", - __GNU_LIBRARY__, __GLIBC__, __GLIBC_MINOR__ + fprintf(stderr, "Compiled with: glibc %d.%d, gcc %d.%d\n\n", + __GLIBC__, __GLIBC_MINOR__, __GNUC__, __GNUC_MINOR__ ); fprintf(stderr, @@ -399,6 +444,13 @@ void self_info(void){ (int)(PAGE_SIZE), (int)(page_size) ); + fprintf(stderr, + "sizeof(proc_t)=%d sizeof(long)=%d sizeof(KLONG)=%d\n", + (int)sizeof(proc_t), (int)sizeof(long), (int)sizeof(KLONG) + ); + + fprintf(stderr, "archdefs:%s\n", archdefs); + open_psdb(namelist_file); fprintf(stderr,"namelist_file=\"%s\"\n",namelist_file?namelist_file:""); }