On Wed, Aug 12, 2009 at 11:22 PM, Bram De Wachter<[email protected]> wrote:
>
> It all seems to boil down to VG_(pread) (or more specifically VG_(lseek))
> not working correctly on my system. Here is the relevant portion of strace:

Here is the code for VG_(pread).  The comment at the top seems very relevant:

/* DDD: Note this moves (or at least, is believed to move) the file pointer
   on Linux and AIX5 but doesn't on Darwin.  This inconsistency should
   be fixed.  (In other words, why isn't the Linux/AIX5 version implemented in
   terms of pread()?) */
SysRes VG_(pread) ( Int fd, void* buf, Int count, OffT offset )
{
   SysRes res;
#  if defined(VGO_linux) || defined(VGO_aix5)
   /* Linux, AIX5 */
   OffT off = VG_(lseek)( fd, offset, VKI_SEEK_SET);
   if (off < 0)
      return VG_(mk_SysRes_Error)( VKI_EINVAL );
   res = VG_(do_syscall3)(__NR_read, fd, (UWord)buf, count );
   return res;
#  elif defined(VGP_amd64_darwin)
   res = VG_(do_syscall4)(__NR_pread_nocancel, fd, (UWord)buf, count, offset);
   return res;
#  elif defined(VGP_x86_darwin)
   /* ppc32-darwin is the same, but with the args inverted */
   res = VG_(do_syscall5)(__NR_pread_nocancel, fd, (UWord)buf, count,
                          offset & 0xffffffff, offset >> 32);
   return res;
#  else
#    error "Unknown platform"
#  endif
}


I don't know why the linux/aix5 version uses VG_(lseek) then
__NR_read, it seems like it should just use __NR_pread64 directly,
similar to the Darwin versions.  Can you try changing it to do that
and report back whether it fixes the problem?

Nick

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to