]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Allow core dumps on 32 bit architectures to go over 2Gb in size. BZ#277610.
authorTom Hughes <tom@compton.nu>
Wed, 13 Jul 2011 09:02:14 +0000 (09:02 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 13 Jul 2011 09:02:14 +0000 (09:02 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11893

coregrind/m_coredump/coredump-elf.c
coregrind/m_libcfile.c
include/pub_tool_libcfile.h

index 9ed88e37a389affcad0636a7184b6d66ff14a830..caf0e8aa1626c3b357aed40ed020bc796363d9c3 100644 (file)
@@ -520,6 +520,7 @@ void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, UInt max_size)
    vg_assert(buf);
 
    for(;;) {
+      Int oflags = VKI_O_CREAT|VKI_O_WRONLY|VKI_O_EXCL|VKI_O_TRUNC;
       SysRes sres;
 
       if (seq == 0)
@@ -530,9 +531,11 @@ void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, UInt max_size)
                      basename, coreext, VG_(getpid)(), seq);
       seq++;
 
-      sres = VG_(open)(buf,                       
-                       VKI_O_CREAT|VKI_O_WRONLY|VKI_O_EXCL|VKI_O_TRUNC, 
-                       VKI_S_IRUSR|VKI_S_IWUSR);
+#     if defined(VKI_O_LARGEFILE)
+      oflags |= VKI_O_LARGEFILE;
+#     endif
+
+      sres = VG_(open)(buf, oflags, VKI_S_IRUSR|VKI_S_IWUSR);
       if (!sr_isError(sres)) {
          core_fd = sr_Res(sres);
         break;
index 2f3306a955d664bb46aeb4b5e6c2adf77862f253..7d40e8039d2d4ed6c42e0a8cc413650ae8780804 100644 (file)
@@ -210,18 +210,27 @@ Int VG_(pipe) ( Int fd[2] )
 #  endif
 }
 
-OffT VG_(lseek) ( Int fd, OffT offset, Int whence )
+Off64T VG_(lseek) ( Int fd, Off64T offset, Int whence )
 {
 #  if defined(VGO_linux) || defined(VGP_amd64_darwin)
+#  if defined(__NR__llseek)
+   Off64T result;
+   SysRes res = VG_(do_syscall5)(__NR__llseek, fd,
+                                 offset >> 32, offset & 0xffffffff,
+                                 &result, whence);
+   return sr_isError(res) ? (-1) : result;
+#  else
    SysRes res = VG_(do_syscall3)(__NR_lseek, fd, offset, whence);
-   vg_assert(sizeof(OffT) == sizeof(Word));
+   vg_assert(sizeof(Off64T) == sizeof(Word));
+   return sr_isError(res) ? (-1) : sr_Res(res);
+#  endif
 #  elif defined(VGP_x86_darwin)
    SysRes res = VG_(do_syscall4)(__NR_lseek, fd, 
                                  offset & 0xffffffff, offset >> 32, whence);
+   return sr_isError(res) ? (-1) : sr_Res(res);
 #  else
 #    error "Unknown plat"
 #  endif
-   return sr_isError(res) ? (-1) : sr_Res(res);
    /* if you change the error-reporting conventions of this, also
       change VG_(pread) and all other usage points. */
 }
index 4b63a53747b96a9990227e4e1d83de5419643dd2..8a1766600cbcef582d56410c0a96c52494a1e037 100644 (file)
@@ -77,7 +77,7 @@ extern void   VG_(close)  ( Int fd );
 extern Int    VG_(read)   ( Int fd, void* buf, Int count);
 extern Int    VG_(write)  ( Int fd, const void* buf, Int count);
 extern Int    VG_(pipe)   ( Int fd[2] );
-extern OffT   VG_(lseek)  ( Int fd, OffT offset, Int whence );
+extern Off64T VG_(lseek)  ( Int fd, Off64T offset, Int whence );
 
 extern SysRes VG_(stat)   ( const Char* file_name, struct vg_stat* buf );
 extern Int    VG_(fstat)  ( Int   fd,        struct vg_stat* buf );