Commit Graph

352 Commits

Author SHA1 Message Date
Tom Hughes
2d43007ce1 Add SIOCGSTAMPNS support. Fixes #188530.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9502
2009-03-31 10:36:58 +00:00
Nicholas Nethercote
2001629c3f Updated copyright years.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344
2009-03-10 22:02:09 +00:00
Nicholas Nethercote
70150c5884 Use "status" as the argname for 'exit' and 'exit_group'.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9311
2009-03-03 05:39:23 +00:00
Nicholas Nethercote
da695aa41a atoll() is a terrible function -- you can't do any error checking with it.
Some of our option processing code uses it.  This means that eg.
'--log-fd=9xxx' logs to fd 9, and '--log-fd=blahblahblah' logs to 0 (because
atoll() returns 0 if the string doesn't contain a number!)

It turns out that most of our option processing uses VG_(strtoll*) instead
of VG_(atoll).  The reason that not all of it does is that the
option-processing macros are underpowered -- they currently work well if you
just want to assign the value to a variable, eg:

        VG_BOOL_CLO(arg, "--heap",   clo_heap)
   else VG_BOOL_CLO(arg, "--stacks", clo_stacks)

   else VG_NUM_CLO(arg, "--heap-admin", clo_heap_admin)
   else VG_NUM_CLO(arg, "--depth",      clo_depth)

(This works because they are actually an if-statement, but it looks odd.)

VG_NUM_CLO uses VG_(stroll10).  But if you want to do any checking or
processing, you can't use those macros, leading to code like this:

      else if (VG_CLO_STREQN(9,  arg, "--log-fd=")) {
         log_to            = VgLogTo_Fd;
         VG_(clo_log_name) = NULL;
         tmp_log_fd        = (Int)VG_(atoll)(&arg[9]);
      }

So this commit:
- Improves the *_CLO_* macros so that they can be used in all circumstances.
  They're now just expressions (albeit ones with side-effects, setting the
  named variable appropriately).  Thus they can be used as if-conditions,
  and any post-checking or processing can occur in the then-statement.  And
  malformed numeric arguments (eg. --log-fd=foo) aren't accepted.  This also
  means you don't have to specify the lengths of any option strings anywhere
  (eg.  the 9 in the --log-fd example above).  The use of a wrong number
  caused at least one bug, in Massif.
- Updates all places where the macros were used.
- Updates Helgrind to use the *_CLO_* macros (it didn't use them).
- Updates Callgrind to use the *_CLO_* macros (it didn't use them), except
  for the more esoteric option names (those with numbers in the option
  name).  This allowed getUInt() and getUWord() to be removed.
- Improves the cache option parsing in Cachegrind and Callgrind -- now uses
  VG_(strtoll10)(), detects overflow, and is shorter.
- Uses INT instead of NUM in the macro names, to distinguish better vs. the
  DBL macro.
- Removes VG_(atoll*) and the few remaining uses -- they're wretched
  functions and VG_(strtoll*) should be used instead.
- Adds the VG_STREQN macro.
- Changes VG_BINT_CLO and VG_BHEX_CLO to abort if the given value is outside
  the range -- the current silent truncation is likely to cause confusion as
  much as anything.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9255
2009-02-25 01:01:05 +00:00
Nicholas Nethercote
5aac956e64 Remove a number of unused parameters, found with -Wunused-parameter.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9248
2009-02-24 03:07:37 +00:00
Nicholas Nethercote
87b5e49494 Merge a large chunk of r8949 (the part that moved fcntl and ioctl wrappers
out of syswrap-generic into syswrap-linux) from the DARWIN branch.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9219
2009-02-22 23:00:30 +00:00
Nicholas Nethercote
68b5487a3a Make fcntl and fcntl64 wrappers more consistent.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9217
2009-02-22 22:23:09 +00:00
Nicholas Nethercote
3bfae3eec1 Merged r9185 (fix up getsockopt mess) from the DARWIN branch, minus the
Darwin-specific parts.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9186
2009-02-17 00:23:30 +00:00
Julian Seward
f3523a4a0e Some minor format string fixes for gcc-3.3.3 (SuSE 9.1). Not sure why
later gccs don't complain about these.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9019
2009-01-22 12:24:26 +00:00
Nicholas Nethercote
5ad1dd61f9 Introduce a new type, PtrdiffT. Replace lots of uses of OffT (all those
that are memory offsets) with PtrdiffT;  OffT should only be used for file
sizes and offsets.

Change Off64T from a ULong to a Long, as it should be.  Replace some uses
of ULong in the address space manager with Off64T to match.

Also add a comment explaining the meanings of the basic types like Addr,
OffT, SizeT, etc.

Also fix the prototype for VG_(pread) -- the last arg is an OffT, not an
Int.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8959
2009-01-15 21:29:24 +00:00
Tom Hughes
7e17bfc956 The SG_GET_TIMEOUT ioctl doesn't write to memory - it returns the
timeout via it's return value.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8958
2009-01-15 08:49:09 +00:00
Tom Hughes
9b5365f10d The SG_GET_VERSION_NUM ioctl writes to memory rather than reading it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8957
2009-01-15 08:48:14 +00:00
Tom Hughes
f1ac1fd992 Add signalfd4 support.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8930
2009-01-09 16:42:51 +00:00
Tom Hughes
2ebda825b1 Add support ioprio_get and wire up ioprio_set on all platforms.
Fixes bug #177819.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8826
2008-12-15 08:58:29 +00:00
Julian Seward
05e92e79d9 Fix format string warning in PRE(sys_eventfd2).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8817
2008-12-12 08:08:58 +00:00
Tom Hughes
4d4d4c10fe Add support for eventfd2 (and wire up pipe2 on PPC platforms).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8815
2008-12-10 09:28:56 +00:00
Julian Seward
2ebd38040f Handle sys_lookup_dcookie on amd64-linux (Andrew Haley). Also take
the opportunity to move the handlers from syswrap-generic.c (which
they certainly aren't) to syswrap-linux.c.  Fixes #175044.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8769
2008-11-16 21:40:54 +00:00
Julian Seward
70e5fbdf04 Fix debug printing of fd in mmap system calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8764
2008-11-13 13:14:00 +00:00
Julian Seward
2a5db7f788 Support sys_stime on x86-linux. Fixes #159285.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8736
2008-11-06 23:11:42 +00:00
Julian Seward
e3cccbaf9a Fix integer-pointer comparisons in new spu_ wrappers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8735
2008-11-06 09:22:50 +00:00
Julian Seward
3a2fbbfafd Add ioctl wrappers for Linux wireless extensions version 22.
Patch from Gwenael Lambrouin.  Fixes #159452.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8734
2008-11-05 16:59:55 +00:00
Julian Seward
af77aae9cd Support sys_spu_run and sys_spu_create on ppc32-linux. Patch by
Kenneth Skovhede.  Fixes #167288.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8731
2008-11-05 11:36:59 +00:00
Julian Seward
f4bffe6909 Support sys_pipe2 on {amd64,x86}-linux. Also, update syscall numbers
for all supported Linuxes to those in linux-2.6.28-rc3.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8730
2008-11-05 11:20:59 +00:00
Julian Seward
1c03211b43 Enable sys_quotactl on amd64-linux. Possible fixes #173177.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8720
2008-10-30 13:12:50 +00:00
Julian Seward
57c7455121 Ensure the root thread's stack is suitably mapped before doing a
client syscall.  Believed to fix #156404.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8712
2008-10-27 01:23:04 +00:00
Julian Seward
fbdd00b6e0 gcc-4.4.0 (snapshot) started complaining about buf.sem_nsems being
uninitialised in get_sem_count().  This makes it quiet.  I am not sure
whether get_sem_count() was correct or not without it (probably was
OK).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8697
2008-10-23 09:46:59 +00:00
Nicholas Nethercote
0cf8a14c70 - Reinstate the 'atfork' from 2.4.0, which was more powerful, and expose it to
tools.
- Factor out 'execv' from 'system' and expose it to tools.

Partly based on a patch from Robert O'Callahan.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8669
2008-10-13 04:19:15 +00:00
Julian Seward
335992d8fc Merge all remaining changes from branches/PTRCHECK. These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621
2008-09-18 18:12:50 +00:00
Bart Van Assche
86ff87c102 Enabled capget and capset system calls for amd64, ppc32 and ppc64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8554
2008-08-27 17:41:56 +00:00
Julian Seward
832a3d400b Tidy up the wrappers for pread64 and pwrite64, and make these two
syscalls available on ppc64-linux.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8519
2008-08-07 20:29:55 +00:00
Julian Seward
8204098c5e * handle sys_getprocs64 on ppc32-aix5
* handle sys_uname properly on ppc{32,64}-aix5



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8451
2008-07-22 10:01:25 +00:00
Julian Seward
7874b34ffb Format string fixes for ppc{32,64}-aix5.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8444
2008-07-18 18:23:24 +00:00
Bart Van Assche
783f123bab Enabled support for the sched_setparam() system call on the amd64, ppc32 and ppc64 platforms (was already enabled on x86).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8405
2008-07-09 07:39:09 +00:00
Bart Van Assche
8e96150945 Merged FORMATCHECK branch (r8368) to trunk.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8369
2008-07-07 06:49:24 +00:00
Bart Van Assche
bd28f145d5 Moved support for Linux-specific system call sys_init_module from generic to Linux wrappers. Added wrapper for sys_delete_module system call.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8266
2008-06-21 16:28:24 +00:00
Bart Van Assche
e3ebca1d59 Enabled support for the init_module() system call on amd64. Should fix #164476.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8263
2008-06-20 10:41:12 +00:00
Julian Seward
1fb920eeb5 Add '*flags |= SfMayBlock' to PRE(sys_sync_file_range).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8177
2008-06-04 06:49:56 +00:00
Julian Seward
b2651c395b More fiddling with the sys_signalfd wrapper.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8147
2008-05-29 12:56:08 +00:00
Bart Van Assche
7fbbba6ae4 Make sure the debug information is read before a tool is notified about an mmap() system call.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8142
2008-05-29 08:52:44 +00:00
Julian Seward
178fbd72d3 Tidy up timerfd wrapper stuff a bit:
* make linux_kernel_2_6_22 return Bool

* linux_kernel_2_6_22: don't assert if /proc/sys/kernel/osrelease
  can't be opened

* PRE(sys_timerfd_create), PRE(sys_signalfd):
  use %ld for Word arguments, and use house types



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8138
2008-05-28 11:06:08 +00:00
Bart Van Assche
0f6897cc6c Removed the superfluous casts that were introduced in r8132.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8136
2008-05-28 07:09:54 +00:00
Bart Van Assche
dcf69a8cb2 sys_timerfd() and sys_signalfd() wrappers now interpret their first argument consistently as signed instead of unsigned. Fixes #162663.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8132
2008-05-26 17:16:08 +00:00
Bart Van Assche
4938c1f0ba Added support for the fadvise64() system call on ppc64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8130
2008-05-25 18:09:11 +00:00
Bart Van Assche
df3037fdc9 Removed superfluous #include directive.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8124
2008-05-25 16:01:03 +00:00
Bart Van Assche
7d072b3b4a Enabled timerfd() and timerfd_create() support for ppc32 and ppc64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8051
2008-05-12 18:16:14 +00:00
Julian Seward
a617a26b86 POST(sys_poll): mark the revents field even when RES==0. Fixes #158425.
(Dave Goodell)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8049
2008-05-12 15:46:34 +00:00
Julian Seward
22e711d457 Fix wrappers for sys_futimesat and sys_utimensat. (Dan Kegel)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8047
2008-05-12 14:29:23 +00:00
Julian Seward
3c25a48a0c Temporarily work around compilation failures caused by non-definition
of __NR_timerfd, pending proper resolution.  See
http://bugs.kde.org/show_bug.cgi?id=160907



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7983
2008-05-01 21:22:38 +00:00
Julian Seward
4cae5c3ed5 Merge branches/OTRACK_BY_INSTRUMENTATION into the trunk. This adds
support to Memcheck for tracking the origin of uninitialised values,
if you use the --track-origins=yes flag.

This currently causes some Memcheck regression tests to fail, because
they now print an extra line of advisory text in their output.  This
will be fixed.

The core-tool interface is slightly changed.  The version number for
the interface needs to be incremented.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7982
2008-05-01 20:24:26 +00:00
Bart Van Assche
bcb85a68fb Make sure the test for kernel version 2.6.22 will work correctly for the future kernel versions 2.6.220 .. 2.6.229.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7971
2008-05-01 12:35:48 +00:00