Commit Graph

60 Commits

Author SHA1 Message Date
Julian Seward
6b9ba9848a Fix various problems with new thread start / stop / detach stuff.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@327
2002-05-28 11:00:01 +00:00
Julian Seward
fbd9d9f778 DO NOT UPDATE! COMPILES BUT DOESN'T WORK.
Major overhaul to the way thread startup and exit is done.  Removes some
ugly gunk in the scheduler, and adds support for thread detaching and
cancellation.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@326
2002-05-28 01:36:45 +00:00
Julian Seward
dbd505a061 Support for POSIX reader-writer locks (preliminary).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@325
2002-05-27 13:00:05 +00:00
Julian Seward
ba1fae8ba5 Comment out debug printing.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@323
2002-05-24 02:12:52 +00:00
Julian Seward
09846794fc More minor fixes to make OpenOffice 1.0 work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@321
2002-05-24 02:11:32 +00:00
Julian Seward
aad98221b9 Make accept() be nonblocking.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@313
2002-05-23 13:13:12 +00:00
Julian Seward
cce8a3ebd3 Implement pthread_yield.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@308
2002-05-22 13:17:31 +00:00
Julian Seward
8d2d128371 Don't mask libc's vfork / __vfork:
$ nm /lib/libc-2.2.4.so | grep vfork
   000b4220 T __vfork
   000b4220 W vfork

There's no __libc_vfork, so there's nothing we can do here.
Just don't supply our own version.

Not at all sure if this is correct.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@303
2002-05-21 00:51:21 +00:00
Julian Seward
53c56fd4d1 Implement semaphore functions.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@295
2002-05-19 00:13:34 +00:00
Julian Seward
2560fc9e47 Cancellation wrappers for pread/pwrite (Philip Martin).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@287
2002-05-18 10:56:27 +00:00
Julian Seward
a57b808f60 Cancellation wrapper for __pwrite64 (Adam Zell(?))
Be more paranoid in pthread_attr_setstacksize


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@285
2002-05-18 10:43:22 +00:00
Julian Seward
a1b75f8383 Cancellation wrapper for pread64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@283
2002-05-16 23:39:10 +00:00
Julian Seward
f3067ffa5d Minimal impl of pthread_attr_setstacksize.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@279
2002-05-16 20:51:15 +00:00
Julian Seward
9360e0621c Cancellation wrapper for sendmsg(), wierd wrapper for raise().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@278
2002-05-16 16:57:25 +00:00
Julian Seward
30199fec47 In accordance with "build one to throw away, you will anyway (tm)",
throw away the old signals simulation and more or less start again
from scratch.  vg_signals.c is nearly a complete rewrite.  In fact
this is now the third generation of the signals simulation.

The purpose of this is to properly support signals in threads -- a
nightmare combination.  pthread_sigmask, pthread_kill and sigwait
are now alledged to work as POSIX requires.

In the process, throw away confusing and conceptually muddled old
implementation and replace with something which is more verbose but
conceptually cleaner, simpler and easier to argue is correct.

* When the client does sigaction/sigprocmask et al, the resulting
  changes are stored verbatim in SCSS -- the Static Client Signal State.
  So SCSS is the state the client believes the kernel is in.

* Every time SCSS changes, we recalculate the state the kernel
  *should* be in so that our signal simulation works.  This is the
  SKSS -- Static Kernel Signal State.  The kernel state is then
  updated accordingly.  By diffing the new and old SKSSs, the
  number of real system calls made is minimised.

* The dynamic state of the client's signals is stored in DCSS
  -- Dynamic Client Signal State.  This just records which signals
  are pending for which threads.

The big advantage of this scheme over the previous is that the SCSS ->
SKSS mapping is made explicit and gathered all in one place, rather
than spread out in a confusing way and done implicitly.  That makes it
all lot easier to decide if the mapping, which is really the heart of
the signals simulation, is correct or not.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@271
2002-05-15 21:13:39 +00:00
Julian Seward
0ba6f33e4f Add support for pthread_sigmask() and sigwait(). All absolutely
horrible, especially the latter.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@266
2002-05-13 00:16:03 +00:00
Julian Seward
9945834acc Hook libpthread.so's .init section to start up Valgrind too.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@262
2002-05-10 23:20:58 +00:00
Julian Seward
46111c06e3 Kernel 2.4 / glibc 2.2.X build fixes for recent startup changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@259
2002-05-10 22:31:40 +00:00
Julian Seward
67b0b0e404 Modify the startup mechanism so that any call into valgrind's libpthread.so
will start up valgrind if it is not already running.  This more or less
sidesteps the problem that sometimes valgrind.so isn't init'd first by
the dynamic linker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@257
2002-05-10 21:03:56 +00:00
Julian Seward
8b15df18c2 Change _pthread_cleanup_push and _pthread_cleanup_pop into no-ops
rather than aborts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@237
2002-05-08 14:08:22 +00:00
Julian Seward
9518212384 Do __pthread_initialize.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@236
2002-05-08 02:01:14 +00:00
Julian Seward
15f93fef49 Fix from Lionel Ulmer to not have an infinite loop/stack overflow
with sigaction on glibc 2.1.3.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@214
2002-05-04 19:49:21 +00:00
Julian Seward
be21872520 Various cleanups following earlier exit fixes. Also add boilerplate
copyright notices.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@204
2002-05-03 20:43:10 +00:00
Julian Seward
b0d319d98a Fix typo to do with rwlock aliasing.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@177
2002-05-01 00:03:16 +00:00
Julian Seward
a3c231031a Make pthread_mutexattr_setkind_np be an alias of__pthread_mutexattr_settype.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@172
2002-04-30 10:20:10 +00:00
Julian Seward
feaee3ac3a Fix really stupid error in computation of timeout point in nonblocking
poll().  After this change, Mozilla-0.9.2.1 and Galeon 0.11.3 finally
behave reasonably on my box.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@165
2002-04-29 12:20:34 +00:00
Julian Seward
acf082b7d7 Allow apparently invalid keys in libc_internal_tsd_{get,set}. This
allows koffice-1.2beta1 to work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@158
2002-04-27 01:35:38 +00:00
Julian Seward
c082a81f8f Fix more stuff broken by recent exported-symbol hackery.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@156
2002-04-26 21:01:13 +00:00
Julian Seward
205ec6efd2 Finish first pass of the symbols cleanup. Only versioned symbols remain
to do.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@155
2002-04-26 14:31:40 +00:00
Julian Seward
66b4d0b7ca Mess around with aliases to make the exported T/D/W syms look like those
of the real libpthread.so.  This is a Good Thing, despite the fact it
temporarily breaks some threaded programs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@153
2002-04-26 13:25:00 +00:00
Julian Seward
edf9ed279b Fix many holes and bugs in an attempt to get my libpthread.so to export
the same set of symbols as the real one, which I now realise is crucial
for it to work at all.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@151
2002-04-26 03:28:18 +00:00
Julian Seward
a70e548ee7 Fix various bugs getting in the way of licq starting up.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@150
2002-04-26 00:27:53 +00:00
Julian Seward
c107508a0f Try and give at least some minimal binding for all functions exported
by the real libpthread.so.  In the process fix a bunch of stuff, including
adding thread-specific h_errno and resolver state storage.  This fixes
licq crashing at startup.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@149
2002-04-25 20:17:29 +00:00
Julian Seward
6f9fc98a96 Jiggle timing delays yet again.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@148
2002-04-25 01:33:50 +00:00
Julian Seward
3b6da6b7a3 Wrappers for open64/lseek64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@137
2002-04-24 20:29:58 +00:00
Julian Seward
8060ad5525 Add wait() wrapper.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@134
2002-04-24 19:26:47 +00:00
Julian Seward
6fde2066d9 Add a simplistic implementation of pthread_once().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@132
2002-04-24 19:21:39 +00:00
Julian Seward
9247bfce1f Add wrapper for system().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@130
2002-04-24 13:28:15 +00:00
Julian Seward
8c5467fdb1 Add wrapper for sendto().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@125
2002-04-24 02:28:34 +00:00
Julian Seward
26934d5615 More glibc-2.1.X compiler fixes (Lionel Ulmer).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@123
2002-04-24 02:20:20 +00:00
Julian Seward
418902218c Various upgrades, with the effect that mozilla now runs, although
it has tremendous performance problems.

* Implement pthread_key_{create,delete} and pthread_{set,get}specific.

* Implement pthread_cond_timedwait.  A nuisance.

* New timer infrastructure, based on the RDTSC instruction.  This
  allows fast, accurate time measurement without swamping the host with
  gettimeofday() syscalls.

There's something definitely screwy about the scheduler, making opera
run slowly and mozilla run unbelievably slowly.  To be investigated.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@119
2002-04-23 16:52:51 +00:00
Julian Seward
cee0398714 Compilation fixes for glibc-2.1.X systems. (Lionel Ulmer).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@117
2002-04-22 12:45:25 +00:00
Julian Seward
6fb071300e Make the GDB-attach stuff thread-aware, and work (at least partially)
when running multithreaded.  Can still cause crashes (assertion failures)
when GDB exits.  I think it that's due to my use of libc's system()
call; should roll my own.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@111
2002-04-21 13:05:34 +00:00
Julian Seward
871ccd90b4 Add a nonblocking poll() -- same trick as nonblocking select().
Add pthread_cond_destroy().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@110
2002-04-21 12:19:41 +00:00
Julian Seward
d8b60ad050 Minor tweaks to the nonblocking select() implementation.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@108
2002-04-21 01:08:26 +00:00
Julian Seward
51ab497158 Add pthread_mutex_trylock, and add various other hacks to try and make
Mozilla work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@107
2002-04-21 00:13:57 +00:00
Julian Seward
03b823c2a6 Add pthread_condattr_destroy.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@104
2002-04-20 13:59:33 +00:00
Julian Seward
e39f3f644a Add fairly complete, and apparently working, support for condition
variables.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@102
2002-04-20 13:53:23 +00:00
Julian Seward
1f17043004 Continue trying to extract myself from the pthread_mutex_* swamp.
Fall back to a compromise position, which makes my mutex implementation
initialiser- and structure-compatible with LinuxThreads, and ditto the
upcoming condition var implementation.  In particular this means that
((ThreadId)0) is an invalid thread ID, so vg_threads[0] is never used,
and vg_threads[1] specially denotes the "main" thread.

Remove the scheme of having a linked list of threads waiting on
each mutex.  It is too difficult to get the right semantics for
when a signal is delivered to a thread blocked in pthread_mutex_lock().
Instead, use the old scheme of each thread stating with its .waited_on_mx
field, which mutex it is waiting for.  This makes pthread_mutex_unlock()
less efficient, but at least it all works.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@100
2002-04-19 14:40:57 +00:00
Julian Seward
3d7ec5ac90 Simply and rationalise pthread_mutex implementation, in preparation
for implementation of condition variables.

* Use the native pthread_mutex_t directly; we no longer have our own
  VgMutex type nor a fixed array of them.

* Give ThreadState a new field q_next :: ThreadId, used to make a
  linked list of threads waiting on a mutex, or condition variable.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@99
2002-04-18 22:38:41 +00:00