KLONG
This commit is contained in:
parent
256e1f767c
commit
ebc5354699
10
proc/ksym.c
10
proc/ksym.c
@ -105,7 +105,7 @@
|
||||
|
||||
typedef struct symb {
|
||||
const char *name;
|
||||
unsigned long addr;
|
||||
unsigned KLONG addr;
|
||||
} symb;
|
||||
|
||||
static const symb fail = { "?", 0 };
|
||||
@ -185,7 +185,7 @@ static void chop_version(char *arg){
|
||||
|
||||
/***********************************/
|
||||
|
||||
static const symb *search(unsigned long address, symb *idx, unsigned count){
|
||||
static const symb *search(unsigned KLONG address, symb *idx, unsigned count){
|
||||
unsigned left;
|
||||
unsigned mid;
|
||||
unsigned right;
|
||||
@ -289,7 +289,7 @@ bypass:
|
||||
char *saved;
|
||||
if(!*endp) return 1;
|
||||
saved = endp;
|
||||
ksyms_index[ksyms_count].addr = strtoul(endp, &endp, 16);
|
||||
ksyms_index[ksyms_count].addr = STRTOUKL(endp, &endp, 16);
|
||||
if(endp==saved || *endp != ' ') goto bad_parse;
|
||||
endp++;
|
||||
ksyms_index[ksyms_count].name = endp;
|
||||
@ -392,7 +392,7 @@ good_match:;
|
||||
}
|
||||
return 1; /* success */
|
||||
}
|
||||
sysmap_index[sysmap_count].addr = strtoul(endp, &endp, 16);
|
||||
sysmap_index[sysmap_count].addr = STRTOUKL(endp, &endp, 16);
|
||||
if(*endp != ' ') goto bad_parse;
|
||||
endp++;
|
||||
if(!strchr(SYMBOL_TYPE_CHARS, *endp)) goto bad_parse;
|
||||
@ -561,7 +561,7 @@ const char * read_wchan_file(unsigned pid){
|
||||
#define MAX_OFFSET (0x1000*sizeof(long)) /* past this is generally junk */
|
||||
|
||||
/* return pointer to temporary static buffer with function name */
|
||||
const char * wchan(unsigned long address, unsigned pid) {
|
||||
const char * wchan(unsigned KLONG address, unsigned pid) {
|
||||
const symb *mod_symb;
|
||||
const symb *map_symb;
|
||||
const symb *good_symb;
|
||||
|
@ -9,6 +9,31 @@
|
||||
#define EXTERN_C_END
|
||||
#endif
|
||||
|
||||
// Some ports make the mistake of running a 32-bit userspace
|
||||
// on a 64-bit kernel. Shame on them. It's not at all OK to
|
||||
// make everything "long long", since that causes unneeded
|
||||
// slowness on 32-bit hardware.
|
||||
//
|
||||
// SPARC: 32-bit kernel is an ex-penguin, so use "long long".
|
||||
//
|
||||
// MIPS: Used for embedded systems and obsolete hardware.
|
||||
// Oh, there's a 64-bit version? SGI is headed toward IA-64,
|
||||
// so don't worry about 64-bit MIPS.
|
||||
//
|
||||
// PowerPC: Big ugly problem! Macs are popular. :-/
|
||||
//
|
||||
// Unknown: HP-PA-RISC, zSeries, and x86-64
|
||||
//
|
||||
#if defined(__sparc__) // || defined(__mips__) || defined(__powerpc__)
|
||||
#define KLONG long long // not typedef; want "unsigned KLONG" to work
|
||||
#define KLF "L"
|
||||
#define STRTOUKL strtoull
|
||||
#else
|
||||
#define KLONG long
|
||||
#define KLF "l"
|
||||
#define STRTOUKL strtoul
|
||||
#endif
|
||||
|
||||
#if !defined(restrict) && __STDC_VERSION__ < 199901
|
||||
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 92 // maybe 92 or 95 ?
|
||||
#define restrict __restrict__
|
||||
|
@ -200,9 +200,9 @@ static void stat2proc(const char* S, proc_t *restrict P) {
|
||||
"%Lu " /* start_time */
|
||||
"%lu "
|
||||
"%ld "
|
||||
"%lu %lu %lu %lu %lu %lu "
|
||||
"%lu %"KLF"u %"KLF"u %"KLF"u %"KLF"u %"KLF"u "
|
||||
"%*s %*s %*s %*s " /* discard, no RT signals & Linux 2.1 used hex */
|
||||
"%lu %lu %lu "
|
||||
"%"KLF"u %lu %lu "
|
||||
"%d %d "
|
||||
"%lu %lu",
|
||||
&P->state,
|
||||
|
@ -102,7 +102,8 @@ typedef struct proc_t {
|
||||
cmin_flt, /* cumulative min_flt of process and child processes */
|
||||
cmaj_flt, /* cumulative maj_flt of process and child processes */
|
||||
nswap, /* ? */
|
||||
cnswap, /* cumulative nswap ? */
|
||||
cnswap; /* cumulative nswap ? */
|
||||
unsigned KLONG
|
||||
start_code, /* address of beginning of code segment */
|
||||
end_code, /* address of end of code segment */
|
||||
start_stack, /* address of the bottom of stack for the process */
|
||||
|
Loading…
Reference in New Issue
Block a user