|
From: Dirk M. <mu...@kd...> - 2003-11-27 02:17:16
|
CVS commit by mueller:
test for PARENT_SETTID support in clone() of the kernel instead
of testing for presence of NPTL by assuming that sys_futex is only
implemented when its a NPTL patched kernel.
M +0 -2 vg_include.h 1.157
M +0 -9 vg_main.c 1.126
M +20 -21 vg_proxylwp.c 1.6
--- valgrind/coregrind/vg_include.h #1.156:1.157
@@ -244,6 +244,4 @@ extern Char* VG_(clo_weird_hacks);
signals. */
extern Int VG_(clo_signal_polltime);
-/* Assume we're running on a plain 2.4 kernel */
-extern Bool VG_(clo_assume_24);
/* Low latency syscalls and signals */
--- valgrind/coregrind/vg_main.c #1.125:1.126
@@ -570,7 +570,4 @@ static Bool VG_(clo_wait_for_gdb) =
Int VG_(clo_signal_polltime) = 50;
-/* If true, assume we're running on a plain 2.4 kernel */
-Bool VG_(clo_assume_24) = False;
-
/* These flags reduce thread wakeup latency on syscall completion and
signal delivery, respectively. The downside is possible unfairness. */
@@ -678,5 +675,4 @@ static void usage ( void )
" --lowlat-syscalls=no|yes improve wake-up latency when a thread's\n"
" syscall completes [no]\n"
-" --assume-2.4=no|yes assume we're running on a 2.4 kernel [no]\n"
"\n"
" %s tool user options:\n";
@@ -1126,9 +1122,4 @@ static void process_cmd_line_options ( v
else if (VG_CLO_STREQ(argv[i], "--lowlat-syscalls=no"))
VG_(clo_lowlat_syscalls) = False;
-
- else if (VG_CLO_STREQ(argv[i], "--assume-2.4=yes"))
- VG_(clo_assume_24) = True;
- else if (VG_CLO_STREQ(argv[i], "--assume-2.4=no"))
- VG_(clo_assume_24) = False;
else if (VG_CLO_STREQN(13, argv[i], "--stop-after="))
--- valgrind/coregrind/vg_proxylwp.c #1.5:1.6
@@ -883,5 +883,5 @@ static Int do_futex(void *addr, Int op,
#define VKI_FUTEX_REQUEUE 3
-static Int have_futex = -1; /* -1 -> unknown */
+static Int have_settid = -1; /* -1 -> unknown */
/*
@@ -895,19 +895,15 @@ static Int proxy_clone(ProxyLWP *proxy)
Int ret;
- if (VG_(clo_assume_24))
- have_futex = 0;
-
- if (have_futex == -1)
- have_futex = do_futex(NULL, VKI_FUTEX_WAKE, 0, NULL, NULL) != -VKI_ENOSYS;
-
- if (have_futex) {
+ if (have_settid != 0) {
ret = VG_(clone)(proxylwp,
LWP_stack(proxy),
VKI_CLONE_FS | VKI_CLONE_FILES | VKI_CLONE_VM |
- VKI_CLONE_SIGHAND | VKI_CLONE_THREAD |
- VKI_CLONE_PARENT_SETTID |
- VKI_CLONE_CHILD_CLEARTID | VKI_CLONE_DETACHED,
+ VKI_CLONE_SIGHAND | VKI_CLONE_THREAD /*|
+ VKI_CLONE_PARENT_SETTID
+ VKI_CLONE_CHILD_CLEARTID | VKI_CLONE_DETACHED*/,
proxy, &proxy->lwp, &proxy->lwp);
- } else {
+ if ( have_settid < 0 && !proxy->lwp ) {
+ have_settid = 0;
+ proxy->lwp = ret;
VG_(do_signal_routing) = True; /* XXX True, it seems kernels
which have futex also have
@@ -915,5 +911,6 @@ static Int proxy_clone(ProxyLWP *proxy)
it would be nice to test it
directly. */
-
+ }
+ } else {
ret = VG_(clone)(proxylwp,
LWP_stack(proxy),
@@ -932,12 +929,12 @@ static Bool proxy_wait(ProxyLWP *proxy,
Bool ret = False;
- if (have_futex == -1)
+ if (have_settid == -1)
return False;
- if (have_futex) {
+ if (have_settid) {
if (block) {
Int lwp = proxy->lwp;
- while(proxy->lwp != 0)
+ if(proxy->lwp != 0)
do_futex(&proxy->lwp, VKI_FUTEX_WAIT, lwp, NULL, NULL);
@@ -985,4 +982,6 @@ void VG_(proxy_create)(ThreadId tid)
proxy->tid = tid;
proxy->tst = tst;
+ proxy->exitcode = 0;
+ proxy->lwp = 0;
proxy->siginfo.si_signo = 0;
proxy->frommain = VG_(safe_fd)(p[0]);
@@ -1313,5 +1312,5 @@ void VG_(proxy_sanity)(void)
ThreadState *tst = &VG_(threads)[tid];
ProxyLWP *px;
- Int status;
+ Int status = 0;
Int ret;
|