From: Denys Vlasenko Date: Mon, 26 Jan 2009 19:09:35 +0000 (+0000) Subject: * process.c (printwaitn): Add comment about wait4() pid expansion. X-Git-Tag: v4.5.19~91 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=59432dbb333959618b5afdb9a7513d1ab0289a14;p=strace * process.c (printwaitn): Add comment about wait4() pid expansion. Use #ifdef ALPHA instead of LINUX_64BIT, it was misleading (by implying "any 64-bit platform"). * defs.h: Remove now-unused LINUX_64BIT define. * resource.c (sys_osf_getrusage): Fix indentation. --- diff --git a/ChangeLog b/ChangeLog index ef043410..e6caa1b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ 2009-01-26 Denys Vlasenko - * process.c (internal_clone): fix fallout from tcb table expansion + * process.c (printwaitn): Add comment about wait4() pid expansion. + Use #ifdef ALPHA instead of LINUX_64BIT, it was misleading + (by implying "any 64-bit platform"). + * defs.h: Remove now-unused LINUX_64BIT define. + * resource.c (sys_osf_getrusage): Fix indentation. + +2009-01-26 Denys Vlasenko + + * process.c (internal_clone): Fix fallout from tcb table expansion simplification. Due to overlooked else, I forgot to group fork_tcb(tcp) and alloctcb(pid) in a block. diff --git a/defs.h b/defs.h index ce9b12fc..3e2cd9a3 100644 --- a/defs.h +++ b/defs.h @@ -96,9 +96,6 @@ # if defined(SPARC) || defined(SPARC64) # define LINUXSPARC # endif -# if defined(ALPHA) -# define LINUX_64BIT -# endif # if defined(X86_64) # define LINUX_X86_64 # endif diff --git a/process.c b/process.c index 1b356bd1..23e44f6d 100644 --- a/process.c +++ b/process.c @@ -1971,10 +1971,7 @@ int status; } static int -printwaitn(tcp, n, bitness) -struct tcb *tcp; -int n; -int bitness; +printwaitn(struct tcb *tcp, int n, int bitness) { int status; int exited = 0; @@ -1982,6 +1979,14 @@ int bitness; if (entering(tcp)) { /* * Sign-extend a 32-bit value when that's what it is. + * + * NB: On Linux, kernel-side pid_t is typedef'ed to int + * on all arches; also, glibc-2.8 truncates wait3 and wait4 + * pid argument to int on 64bit arches, producing, + * for example, wait4(4294967295, ...) instead of -1 + * in strace. + * Therefore, maybe it makes sense to *unconditionally* + * widen int to long here... */ long pid = tcp->u_arg[0]; if (personality_wordsize[current_personality] < sizeof pid) @@ -2007,7 +2012,7 @@ int bitness; tprintf("NULL"); #ifdef LINUX else if (tcp->u_rval > 0) { -#ifdef LINUX_64BIT +#ifdef ALPHA if (bitness) printrusage32(tcp, tcp->u_arg[3]); else diff --git a/resource.c b/resource.c index f4839fc7..7607a7e1 100644 --- a/resource.c +++ b/resource.c @@ -357,13 +357,13 @@ int sys_osf_getrusage(tcp) struct tcb *tcp; { - if (entering(tcp)) { - printxval(usagewho, tcp->u_arg[0], "RUSAGE_???"); - tprintf(", "); - } - else - printrusage32(tcp, tcp->u_arg[1]); - return 0; + if (entering(tcp)) { + printxval(usagewho, tcp->u_arg[0], "RUSAGE_???"); + tprintf(", "); + } + else + printrusage32(tcp, tcp->u_arg[1]); + return 0; } #endif /* ALPHA */