Commit Graph

89 Commits

Author SHA1 Message Date
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
Julian Seward
a487ef1ce7 A new kind of error: PThread errors. Used to report detected misuse in
the pthread_* API.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@379
2002-06-04 22:54:20 +00:00
Julian Seward
91ccd289f4 - report the size requested size in pthread_attr_setstacksize() when
the size is bigger then the hardcoded value in valgrind.  This
   makes it easier to find out which value to use for
   VG_PTHREAD_STACK_SIZE.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@378
2002-06-04 20:59:16 +00:00
Julian Seward
c5b0a61b28 Inch towards JVM (Sun, 1.4.0) working.
- Thread stack size = 1 Meg
- Alias for __pthread_kill_other_threads_np
Now at least valgrind doesn't crash/assert.  Still doesn't work tho.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@373
2002-06-04 08:38:04 +00:00
Julian Seward
0e398fc844 Make my_assert_fail static.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@370
2002-06-03 23:13:47 +00:00
Julian Seward
9d03544310 Feature tests for [whether sched_param has a sched_priority member]
and [whether nfds_t is defined].


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@366
2002-06-03 13:27:15 +00:00
Julian Seward
6ed97dcc25 Clean up assertion stuff for the vg_libpthread.c
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@363
2002-06-03 01:25:54 +00:00
Julian Seward
a75be28f6f Failed attempt to make JDK 1.4.0 work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@361
2002-06-03 00:58:18 +00:00
Julian Seward
501f08d781 Do pthread_atter_{set,get}scope.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@360
2002-06-02 09:29:31 +00:00
Julian Seward
bf9c8be609 Remove old rwlock implementation and replace with home-grown one.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@346
2002-06-01 14:14:19 +00:00
Julian Seward
89ff2f0b24 Implement __pthread_kill_other_threads_np properly. It does seem to
be needed after all.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@342
2002-05-30 00:40:03 +00:00
Julian Seward
38fce3d542 Make __pthread_kill_other_threads_np be UNIMPLEMENTED. If it turns out
to be needed, I'll fix it properly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@335
2002-05-29 20:22:17 +00:00
Julian Seward
320e2adc3f pthread_cond_timedwait: be robust to timeout points in the past
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@334
2002-05-29 20:13:53 +00:00
Julian Seward
0943acb8fd As per POSIX, nuke all threads other than me
- just before __NR_exec()
- just after __NR_fork() when I am the child
This makes OpenOffice 1.0 not have mutex-related assertion failures


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@333
2002-05-29 19:26:32 +00:00
Julian Seward
d253821d62 Check for pending cancellation requests at syscalls which POSIX
defines to be cancellation points.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@331
2002-05-29 01:21:19 +00:00
Julian Seward
6471fc14ca When a thread exits, run the destructors for the thread's specific data.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@330
2002-05-29 01:06:47 +00:00
Julian Seward
951c703b58 Implement thread cleanup stacks.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@329
2002-05-29 00:10:20 +00:00
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