Commit Graph

126 Commits

Author SHA1 Message Date
Julian Seward
ecee893b06 Improve threaded handling of errno:
- Change various incorrect direct references to errno into
  *(__errno_location()).

- In __errno_location and __h_errno_location, treat the tid==1 case
  (root thread) specially, as with __res_state().

This seems to fix a bug in threaded handling of errno on R H 9 and SuSE8.2,
and almost makes OpenOffice work again on R H 9.

MERGE TO STABLE, if it doesn't break anything.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1625
2003-05-09 23:40:34 +00:00
Julian Seward
e455ba148d Fix interception of pthread_atfork with glibc-2.3.2.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1587
2003-05-04 12:35:54 +00:00
Nicholas Nethercote
90ef0ac1d6 Moved the CLIENT_tstCALL[0123] requests out of valgrind.h into vg_skin.h,
because there was no point exposing them to clients, as they don't know the
ThreadState type.

Also, removed the LOGMESSAGE request type, replaced it with calls to
VG_(message) via the generic VALGRIND_NON_SIMD_CALL2.

In fact, almost every single pthread client request could be removed in this
same way.  That would result in less code, which would be nice... yeah, real
nice.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1584
2003-05-02 17:53:54 +00:00
Julian Seward
76ffe12471 Add possibly-bogus implementations for __libc_current_sigrtmin,
__libc_current_sigrtmax and __libc_allocate_rtsig.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1561
2003-04-26 21:19:53 +00:00
Julian Seward
4efd705c4b Fix threading problems on glibc-2.3.2 or later. Note this is *not*
NPTL support.

The behaviour of weak vs strong symbols seems to have changed in
glibc-2.3.2.  This caused problems in coregrind/vg_intercept.c,
wherein strong symbols in vg_libpthread.c were intended to
override weak symbols in vg_intercept.c, in order to give alternative
thread-safe implementations of some functions, poll(), select(), etc.

The change involves moving the nonblocking implementations of poll, etc
into vg_intercept.c, renaming them to (eg)  VGR_(poll), and routing
all calls to poll to VGR_(poll) [dually for other such fns].  This
means even single-threaded programs now use these functions, but
that doesn't strike me as harmful.

MERGE TO STABLE, if it doesn't break anything


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1559
2003-04-26 20:11:15 +00:00
Nicholas Nethercote
ac7027c441 Updated copyright notices for 2003. Only 4 months late.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1526
2003-04-15 14:58:06 +00:00
Julian Seward
f340c1b180 Duh. Make the system buildable again following recent commit
of include/valgrind.h rev 1.10.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1459
2003-03-15 20:03:33 +00:00
Julian Seward
096df69efa Fix comment bug.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1429
2003-02-23 03:40:03 +00:00
Julian Seward
4a70193610 Make poll() return (errno==EINTR) if the poll is interrupted by a signal.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1428
2003-02-23 03:37:58 +00:00
Julian Seward
1ae9a3b631 Apply the following:
The veneers for msgrcv in vg_intercept.c and vg_libpthread.c are not
returning the number of bytes read correctly - they always return zero
for any non-error case, which causes programs using msgrcv to behave
somewhat non-optimally when running under valgrind ;-)

Attached is a patch against 1.9.3 which fixes this.

Tom

--
Tom Hughes (thh@cyberscience.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1424
2003-02-23 03:00:29 +00:00
Julian Seward
18722f68c7 Implement pthread_getconcurrency, in the same way as LinuxThreads does it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1393
2002-12-26 12:16:11 +00:00
Julian Seward
1c1de878a1 Implement (nop, but that's OK according to POSIX) pthread_set_concurrency.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1355
2002-12-08 23:51:32 +00:00
Julian Seward
a3feec4235 Implement (as a nop) pthread_rwlockattr_destroy.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1354
2002-12-08 23:42:17 +00:00
Julian Seward
9545356102 Merge patch (bug fix) from Jeremy F:
59-fix-readv-writev

Fix error returns for readv and writev (and select).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1342
2002-12-01 10:25:53 +00:00
Julian Seward
ae37920280 Comment out unused function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1338
2002-11-30 14:04:45 +00:00
Julian Seward
f7a957606f Merge patch from Jeremy F:
46-fix-writeable_or_erring-proto

Prototype fix for wait_for_fd_to_be_writable_or_erring(). (bugfix for
43-nonblock-readwritev)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1337
2002-11-30 14:02:53 +00:00
Julian Seward
2d855ea5e1 Merge patch from JeremyF:
43-nonblock-readwritev

Nonblocking readv/writev.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1319
2002-11-16 11:04:18 +00:00
Julian Seward
088086b221 Merge patch from JeremyF:
23-intercept-select-poll

Do the intercept thing for select and poll.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1298
2002-11-13 22:00:20 +00:00
Julian Seward
0cefc40a95 Merge patch from JeremyF:
22-mutex-destroy-unlock:

It seems that glibc assumes in its internal use of pthreads that
destroying a lock implicity unlocks it. This patch handles this case
so that lock ownership tracking is accurate.

Also handles the case of the dyanmic linker wanting to do locking
before Valgrind has started up. vg_libpthread now implements toy
lock/unlock functions to keep it happy and leave the locks in a
sensible state. Implements some untested code to handle the case where
a lock is taken before Valgrind is running but released afterwards.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1297
2002-11-13 21:57:52 +00:00
Julian Seward
eb3e1ed766 Merge patch from JeremyF:
03a-open-nonblock
  Implement open of FIFOs for threaded programs, so that everything
  doesn't block when we try to open a FIFO file in a non-blocking way.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1296
2002-11-13 21:51:10 +00:00
Julian Seward
93de9055b6 Add a new client request, VG_USERREQ__LOGMESSAGE, and use this to route
all commentary from our libpthread.so through to the valgrind core and
hence to the selected logging sink.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1274
2002-11-03 13:41:41 +00:00
Julian Seward
6452d39430 Merge patch from Jeremy Fitzhardinge:
18-recv-nonblock
  Make recv() nonblocking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1266
2002-10-23 21:55:01 +00:00
Julian Seward
af9e404d3e Merge patch from Jeremy Fitzhardinge:
16-function-intercept
  Implement a more reliable for vg_libpthread to intercept libc
  calls. Since the only reliable way of making sure that our code
  defines the symbol is by making sure that valgrind.so itself does it,
  this patch adds a new file, vg_intercept.so, which defines those
  symbols. They are then passed off to a weak local function if
  libpthread isn't present, or to the libpthread version if it is.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1265
2002-10-23 21:53:49 +00:00
Julian Seward
7845210b4f Merge patch from Jeremy Fitzhardinge:
02-sysv-msg
  Support for threaded programs using msgsnd/msgrcv.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1264
2002-10-23 21:49:33 +00:00
Julian Seward
8f7a43395a merge rev 1.90.2.12:
Put __pthread_getspecific_addr inside ifdefs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1242
2002-10-20 16:25:55 +00:00
Julian Seward
488524613b merge rev 1.90.2.11:
Create __ versions of the select and poll symbols, so that all
references are caught (Jeremy Fitzhardinge)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1241
2002-10-20 16:24:04 +00:00
Julian Seward
4a133a6408 merge revs
vg_libpthread.c       1.90.2.10
   vg_libpthread_unimp.c 1.30.2.5

Implement (sort-of) pthread_attr_{set,get}guardsize.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1240
2002-10-20 16:22:57 +00:00
Julian Seward
695aaac7c1 merge revs
vg_libpthread.c 1.90.2.9
   vg_libpthread_unimp.c 1.30.2.4

Add sem_timedwait().  From Scott Smith <sls@cs.unt.edu>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1238
2002-10-16 19:45:06 +00:00
Julian Seward
99c3bf9dbb Finish off support for Red Hat 8 thread-specific-data. Unfortunately
the appearance of libc_internal_tsd_address requires a redesign, since
the existing scheme doesn't make it sensible to take the address of a
specific-data value.

New scheme is that the ThreadState structure carries not the table of
specifics, but merely a pointer to such.  This is allocated from the
client-side library, thus residing in client-visible memory and so
addresses can validlyh be taken.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1208
2002-10-12 16:42:35 +00:00
Julian Seward
a3d1803851 Initial stuff to make it work on Red Hat 8:
- autoconf stuff for detecting glibc-2.3

- vg_libpthread_unimp.c: hack for __pthread_clock_[gs]ettime

- vg_libpthread.c: initialise thread's default locale by calling
  __uselocale(LC_GLOBAL_LOCALE) at the right time.  Gruesome.
  Also need to do this for new other threads - not yet done.

- cleanups -- don't use write() to write messages when bombing out,
  instead go direct to the syscalls.  Avoids nasty circularities
  with glibc initialisations.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1207
2002-10-07 23:56:55 +00:00
Nicholas Nethercote
089e7e3bcb Updated file descriptions in the copyright notices to reflect the core/skin
split.  Each skin now has its own two-line description.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1166
2002-10-02 13:26:35 +00:00
Julian Seward
dcb3d7e32c update the libc_tsd stuff for R H limbo (glibc HEAD actually) and
clean it up a bit


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1160
2002-10-02 09:41:49 +00:00
Julian Seward
6f356bc8db This glibc (2.2.90 ?) seems to need another thread-specific key.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1151
2002-10-01 02:09:39 +00:00
Julian Seward
469c9e167b Placate gcc-3.2, which rather alarmingly complains that ...
vg_libpthread.c:1550: warning: weak declaration of `write' after
   first use results in unspecified behavior


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1149
2002-10-01 00:25:04 +00:00
Nicholas Nethercote
afebe61b37 Files updated, added and removed in order to turn the ERASER branch into HEAD
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1086
2002-09-23 09:36:25 +00:00
Julian Seward
fbaff8e524 Simulate resolver-specific state as per the real libpthread.so, wherein
the root thread (tid 1) always uses _res as exported from libc.so as its
state.  This fixes the name lookup problems in KAtlantik.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@551
2002-08-06 09:02:53 +00:00
Julian Seward
44766a20ca Compile fixes for Red Hat Limbo (7.3.92).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@522
2002-07-24 09:41:52 +00:00
Julian Seward
66d6958565 Copy pthread_rwlockattr_setpshared verbatim from LinuxThreads.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@498
2002-07-13 12:58:44 +00:00
Julian Seward
ac5e011028 Finally get around to implementing pthread_atfork.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@473
2002-06-28 01:46:26 +00:00
Julian Seward
827b3d2565 select() and poll(): change order of events in main timing loop
so that very short selects/polls don't just cause a timeout with
no real test.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@466
2002-06-26 00:47:17 +00:00
Julian Seward
52f9eb2462 wait_for_fd_to_be_readable_or_erring: return immediately if fd is
nonblocking anyway.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@465
2002-06-26 00:13:36 +00:00
Julian Seward
7bcbe59c1f Fix subtle bug in the interaction between pthread_create and thread_wrapper,
exposed by scheduling changes caused by commit vg_scheduler.c rev 1.70.
We cannot simply pass the __attr pointer to the child, since it could
point to stuff on the parent's stack, which might not exist by the time
the child looked at it.  Prior to scheduler.c rev 1.70 the child would
have been scheduled as soon as created, so the access was made before the
parent could clear the stuff from its stack.  From rev 1.70 and after
the parent continues after creating the child, causing invalid stack
accesses when the child finally runs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@455
2002-06-20 10:25:37 +00:00
Julian Seward
c489fb0318 Make recv block only the calling thread, not the entire process.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@451
2002-06-20 07:58:33 +00:00
Julian Seward
2bdcd29d63 Implement pause().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@442
2002-06-19 10:17:40 +00:00
Julian Seward
b05ceff761 Do pthread_rwlockattr_init.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@440
2002-06-18 09:24:34 +00:00
Julian Seward
7351752815 Do siglongjmp, although without running cleanup handlers in the section
of stack which it skips over.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@438
2002-06-18 09:07:54 +00:00
Julian Seward
f34cee7b2f Add pthread_attr_setschedpolicy / pthread_attr_getschedpolicy.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@431
2002-06-17 12:19:44 +00:00
Julian Seward
3244f2ca64 Make recvfrom() block only the calling thread, not the whole system
( same trick as used for accept() ).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@415
2002-06-13 17:29:53 +00:00
Julian Seward
e6f8b8949a Cancellation wrapper for recvmsg.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@392
2002-06-06 08:33:54 +00:00
Julian Seward
37a139e555 When a thread in a nanosleep() wait is interrupted by a non-restartable
signal, cause the nanoslep to return with EINTR.  Then, in the user-space
nonblocking select() implementation, notice this and correspondingly return
with EINTR.  This appears to fix the MySQL hang-at-exit problem.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@391
2002-06-06 01:27:39 +00:00