On Wednesday 01 May 2013 21:27:15 Dmitry V. Levin wrote:
> On Wed, May 01, 2013 at 08:36:22PM -0400, Mike Frysinger wrote:
> > in writing a small testcase for stat64, i also poked some other funcs and
> > they fail too:
> > 
> > $ cat test.c
> > #define _GNU_SOURCE
> > #define _FILE_OFFSET_BITS 64
> > #define _LARGEFILE_SOURCE
> > #define _LARGEFILE64_SOURCE
> > 
> > #include <fcntl.h>
> > #include <stdio.h>
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > #include <unistd.h>
> > int main(int argc, char *argv[]) {
> >         struct stat st;
> >         truncate(argv[1], (unsigned long long)10 * 1024 * 1024 * 1024);
> >         ftruncate(-1, (unsigned long long)10 * 1024 * 1024 * 1024);
> >         stat(argv[1], &st);
> >         printf("%llu\n", (unsigned long long)st.st_size);
> >         readahead(-1, st.st_size, 1);
> >         return 0;
> > }
> > 
> > $ gcc test.c -m32 -o a.out32 -Wall
> > $ ./strace  -v ./a.out32 f
> > ...
> > [ Process PID=3083 runs in 32 bit mode. ]
> > ...
> > truncate64("f", 2147483648)             = 0
> > ftruncate64(-1, 2147483648)             = -1 EBADF (Bad file descriptor)
> > readahead(-1, 4289292220, 2)            = -1 EBADF (Bad file descriptor)
> > ...
> > 
> > but if i use strace compiled for x86_64 (64bit), it decodes fine.
> 
> This patch should fix readahead and other cases where printllval is used
> for decoding.

yep, this fixes it for me

> I'm not sure about a proper fix for truncate64/ftruncate64,
> maybe removing odd redirections from linux/x32/syscallent1.h would be
> enough?

that seems to do the trick -- i386 & x32 both decode correctly now.  
considering there's no other case i can think of where these funcs would get 
used, i'm not sure why they're there.  truncate64/ftruncate64 in glibc/x32 are 
aliases to truncate/ftruncate since the syscall is 64bit.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to