From: Tom Hughes Date: Wed, 25 Nov 2009 11:51:05 +0000 (+0000) Subject: Add support for fallocate system call on 32 bit (x86/ppc32) linux X-Git-Tag: svn/VALGRIND_3_6_0~460 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d4c124ebbaeecefadd7ae625acc83538f879de1;p=thirdparty%2Fvalgrind.git Add support for fallocate system call on 32 bit (x86/ppc32) linux systems based on patch from Dodji Seketeli. Part fix for #215973. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10953 --- diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 6416701610..b71e777546 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -1177,14 +1177,24 @@ POST(sys_eventfd2) } } -// 64-bit version. PRE(sys_fallocate) { *flags |= SfMayBlock; +#if VG_WORDSIZE == 4 + PRINT("sys_fallocate ( %ld, %ld, %lld, %lld )", + ARG1, ARG2, MERGE64(ARG3,ARG4), MERGE64(ARG5,ARG6)); + PRE_REG_READ6(long, "fallocate", + int, fd, int, mode, + unsigned, MERGE64_FIRST(offset), unsigned, MERGE64_SECOND(offset), + unsigned, MERGE64_FIRST(len), unsigned, MERGE64_SECOND(len)); +#elif VG_WORDSIZE == 8 PRINT("sys_fallocate ( %ld, %ld, %lld, %lld )", ARG1, ARG2, (Long)ARG3, (Long)ARG4); PRE_REG_READ4(long, "fallocate", int, fd, int, mode, vki_loff_t, offset, vki_loff_t, len); +#else +# error Unexpected word size +#endif if (!ML_(fd_allowed)(ARG1, "fallocate", tid, False)) SET_STATUS_Failure( VKI_EBADF ); } diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 3e67540d7d..d0b2f9b706 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1858,7 +1858,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { LINXY(__NR_timerfd_create, sys_timerfd_create), // 306 LINX_(__NR_eventfd, sys_eventfd), // 307 LINX_(__NR_sync_file_range2, sys_sync_file_range2), // 308 -// LINX_(__NR_fallocate, sys_fallocate), // 309 + LINX_(__NR_fallocate, sys_fallocate), // 309 // LINXY(__NR_subpage_prot, sys_ni_syscall), // 310 LINXY(__NR_timerfd_settime, sys_timerfd_settime), // 311 LINXY(__NR_timerfd_gettime, sys_timerfd_gettime), // 312 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 2a72174a80..1f91b50409 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -2244,7 +2244,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { LINXY(__NR_signalfd, sys_signalfd), // 321 LINXY(__NR_timerfd_create, sys_timerfd_create), // 322 LINX_(__NR_eventfd, sys_eventfd), // 323 - //LINX_(__NR_fallocate, sys_fallocate), // 324 + LINX_(__NR_fallocate, sys_fallocate), // 324 LINXY(__NR_timerfd_settime, sys_timerfd_settime), // 325 LINXY(__NR_timerfd_gettime, sys_timerfd_gettime), // 326