]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
- Renamed the client request VG_USERREQ__GET_THREAD_SELF into
authorBart Van Assche <bvanassche@acm.org>
Tue, 1 Jul 2008 08:48:56 +0000 (08:48 +0000)
committerBart Van Assche <bvanassche@acm.org>
Tue, 1 Jul 2008 08:48:56 +0000 (08:48 +0000)
  VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID.
- Added a new client request, namely VG_USERREQ__DRD_GET_DRD_THREAD_ID.
- Merged the header file priv_drd_clientreq.h into drd_clientreq.h.
- Removed #include "../drd.h" from the regression tests that do not
  perform client requests.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8324

18 files changed:
exp-drd/Makefile.am
exp-drd/drd.h
exp-drd/drd_barrier.c
exp-drd/drd_clientreq.c
exp-drd/drd_clientreq.h
exp-drd/drd_main.c
exp-drd/drd_mutex.c
exp-drd/drd_rwlock.c
exp-drd/drd_semaphore.c
exp-drd/priv_drd_clientreq.h [deleted file]
exp-drd/tests/fp_race.c
exp-drd/tests/omp_prime.c
exp-drd/tests/pth_cond_race.c
exp-drd/tests/pth_detached.c
exp-drd/tests/pth_detached_sem.c
exp-drd/tests/rwlock_race.c
exp-drd/tests/sem_as_mutex.c
exp-drd/tests/sigalrm.c

index 16199f4043da65f5d5b8e07947c0c5c3f5068423..4555f8c02996c081f5514df992c87f4607b65a7d 100644 (file)
@@ -120,7 +120,6 @@ noinst_HEADERS =        \
   drd_thread.h          \
   drd_track.h           \
   drd_vc.h              \
-  priv_drd_clientreq.h  \
   pub_drd_bitmap.h
 
 exp_drd_x86_linux_SOURCES        = $(DRD_SOURCES_COMMON)
index d3be7bd2e6fae472c9901334a6c8686e1053f358..b8fdc4e39b134af191b5c5686c614786ab3203d5 100644 (file)
 enum
 {
   /* Ask the core the thread ID assigned by Valgrind. */
-  VG_USERREQ__GET_THREAD_SELF = VG_USERREQ_TOOL_BASE('D','R'),
+  VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID = VG_USERREQ_TOOL_BASE('D','R'),
+  /* args: none. */
+  /* Ask the core the thread ID assigned by DRD. */
+  VG_USERREQ__DRD_GET_DRD_THREAD_ID,
   /* args: none. */
 
   /* To tell the drd tool to suppress data race detection on the specified */
@@ -103,11 +106,21 @@ enum
 };
 
 
+static __inline__
+int vg_get_valgrind_threadid(void)
+{
+  int res;
+  VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID,
+                             0, 0, 0, 0, 0);
+  return res;
+}
+
 static __inline__
 int vg_get_drd_threadid(void)
 {
   int res;
-  VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__GET_THREAD_SELF, 0,0,0,0,0);
+  VALGRIND_DO_CLIENT_REQUEST(res, 0, VG_USERREQ__DRD_GET_DRD_THREAD_ID,
+                             0, 0, 0, 0, 0);
   return res;
 }
 
index d9c3ebbf9c195cb58d49e9720aa71fec18cbb8d7..38238f434a9b4ba31b0b7aa7f640fb7d70768f58 100644 (file)
@@ -27,7 +27,6 @@
 #include "drd_clientobj.h"
 #include "drd_error.h"
 #include "drd_suppression.h"
-#include "priv_drd_clientreq.h"
 #include "pub_tool_errormgr.h"    // VG_(maybe_record_error)()
 #include "pub_tool_libcassert.h"  // tl_assert()
 #include "pub_tool_libcprint.h"   // VG_(printf)()
index d69657a9ffe578eed844d987093fcac1e95cdfdd..e83d0e67d9881b39767cd0e2eee5e244fbe9c9da 100644 (file)
@@ -31,7 +31,6 @@
 #include "drd_thread.h"
 #include "drd_track.h"
 #include "drd_rwlock.h"
-#include "priv_drd_clientreq.h"
 #include "pub_tool_basics.h"      // Bool
 #include "pub_tool_debuginfo.h"   // VG_(describe_IP)()
 #include "pub_tool_libcassert.h"
@@ -133,10 +132,14 @@ static Bool drd_handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret)
 
   switch (arg[0])
   {
-  case VG_USERREQ__GET_THREAD_SELF:
+  case VG_USERREQ__DRD_GET_VALGRIND_THREAD_ID:
     result = vg_tid;
     break;
 
+  case VG_USERREQ__DRD_GET_DRD_THREAD_ID:
+    result = drd_tid;
+    break;
+
   case VG_USERREQ__DRD_START_SUPPRESSION:
     drd_start_suppression(arg[1], arg[1] + arg[2], "client");
     break;
index 595a8eeb400a6d317fb73d25eaa574a4a0e36288..57bd9d13d363d763d10ebdffca90a566734f065e 100644 (file)
@@ -1,3 +1,28 @@
+/*
+  This file is part of drd, a data race detector.
+
+  Copyright (C) 2006-2008 Bart Van Assche
+  bart.vanassche@gmail.com
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 2 of the
+  License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+  02111-1307, USA.
+
+  The GNU General Public License is contained in the file COPYING.
+*/
+
+
 #ifndef __DRD_CLIENTREQ_H
 #define __DRD_CLIENTREQ_H
 
@@ -163,5 +188,7 @@ typedef enum
     gomp_barrier = 2
   } BarrierT;
 
+void drd_clientreq_init(void);
+
 
 #endif //  __DRD_CLIENTREQ_H
index 5e30adfe41d82a25e21b65b1e93148a753c9ef36..607331c8bc21149fbf87524e136ab4dd1ce813d8 100644 (file)
@@ -39,7 +39,6 @@
 #include "drd_track.h"
 #include "drd_vc.h"
 #include "libvex_guest_offsets.h"
-#include "priv_drd_clientreq.h"
 #include "pub_drd_bitmap.h"
 #include "pub_tool_vki.h"         // Must be included before pub_tool_libcproc
 #include "pub_tool_basics.h"
index 2176ba1ab37297a8c1e62332d429c3cd16b86d6b..148ec2397516ab0c45afe5a0ba278d17fde9571f 100644 (file)
@@ -26,7 +26,6 @@
 #include "drd_clientobj.h"
 #include "drd_error.h"
 #include "drd_mutex.h"
-#include "priv_drd_clientreq.h"
 #include "pub_tool_vki.h"
 #include "pub_tool_errormgr.h"    // VG_(maybe_record_error)()
 #include "pub_tool_libcassert.h"  // tl_assert()
index f4b2fe85914fcde1eced81eebc7b76ccc69dfb1a..44058b455bd391d552c1a02e769ffad03d8d0fc6 100644 (file)
@@ -26,7 +26,6 @@
 #include "drd_clientobj.h"
 #include "drd_error.h"
 #include "drd_rwlock.h"
-#include "priv_drd_clientreq.h"
 #include "pub_tool_vki.h"
 #include "pub_tool_errormgr.h"    // VG_(maybe_record_error)()
 #include "pub_tool_libcassert.h"  // tl_assert()
index 4bedf8f0c8bd4f1693c4a87d73d7db026044f2b0..d3d0d17696b0b9f23abfeb3a004dce21bca91893 100644 (file)
@@ -27,7 +27,6 @@
 #include "drd_error.h"
 #include "drd_semaphore.h"
 #include "drd_suppression.h"
-#include "priv_drd_clientreq.h"
 #include "pub_tool_errormgr.h"    // VG_(maybe_record_error)()
 #include "pub_tool_libcassert.h"  // tl_assert()
 #include "pub_tool_libcprint.h"   // VG_(printf)()
diff --git a/exp-drd/priv_drd_clientreq.h b/exp-drd/priv_drd_clientreq.h
deleted file mode 100644 (file)
index 2b566b6..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-  This file is part of drd, a data race detector.
-
-  Copyright (C) 2006-2008 Bart Van Assche
-  bart.vanassche@gmail.com
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU General Public License as
-  published by the Free Software Foundation; either version 2 of the
-  License, or (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-  02111-1307, USA.
-
-  The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __PRIV_DRD_CLIENTREQ_H
-#define __PRIV_DRD_CLIENTREQ_H
-
-void drd_clientreq_init(void);
-
-#endif /* __PRIV_DRD_CLIENTREQ_H */
index 683fc6d6bf0aacaec83fe94687fc7f0ac96a65d6..69fa6648ff2666a7bbe4daad33b7f2a99df6b31c 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio.h>      // printf()
 #include <pthread.h>
 #include <unistd.h>    // usleep()
-#include "../drd.h"
+
 
 
 // Local functions declarations.
index bc4df51765dc61b675c7fe8c16150b71dffe4f6d..ea11b6f395af13ff4b590bac0b1e8a74a2898956 100644 (file)
@@ -10,7 +10,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>  // getopt()
-#include "../drd.h"
 
 
 static int is_prime(int* const pflag, int v)
index cc830dec55be84279ea41b5ed7efee3cbfc6c7c2..303a5d84fe35dd315632d5532799c24d468744a5 100644 (file)
@@ -6,7 +6,6 @@
 #include <stdio.h>      // printf()
 #include <pthread.h>
 #include <unistd.h>    // usleep()
-#include "../drd.h"
 
 
 // Local functions declarations.
index a2857e046efee3d1312455c1759e3c7b3106e13f..506693c181c88ac45969efacf0dcf2948a2a514a 100644 (file)
@@ -8,7 +8,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include "../drd.h"
 
 
 static int s_finished_count;
index d76f6c97d74568f53b375b5af853107d82b094a2..27602ab6e384a949fae99dd1ddfea7db2a7c4b4f 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include "../drd.h"
 
 
 static sem_t s_sem;
index 9f4fe0b052e271d63b398e432d47430c493688cf..e07524f090b1c9dc2e9c934fc7e2f25aeda7af45 100644 (file)
@@ -11,7 +11,7 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
-#include "../drd.h"
+
 
 
 static pthread_rwlock_t s_rwlock;
index d88b35019ac8d5463e2e2d2584180dbcafb1f1b3..1e23e1cc28512ae26b73b71356c3fd405b9c5e23 100644 (file)
@@ -29,7 +29,7 @@
 #include <pthread.h>
 #include <semaphore.h>
 #include <unistd.h>    // usleep()
-#include "../drd.h"
+
 
 
 // Local functions declarations.
index 042ad31f1371a805b29bec7e01b789531743acf3..2023cf35c5b18d1e45fecd3d12e174b186a31a66 100644 (file)
@@ -31,7 +31,7 @@ static void print_thread_id(const char* const label)
     char msg[256];
     snprintf(msg, sizeof(msg),
              "%spid %d / kernel thread ID %d / Valgrind thread ID %d\n",
-             label, getpid(), getktid(), vg_get_drd_threadid());
+             label, getpid(), getktid(), vg_get_valgrind_threadid());
     write(STDOUT_FILENO, msg, strlen(msg));
   }
 }
@@ -61,7 +61,7 @@ int main(int argc, char** argv)
   if (argc > 1)
     s_debug = 1;
 
-  vgthreadid = vg_get_drd_threadid();
+  vgthreadid = vg_get_valgrind_threadid();
 
   print_thread_id("main: ");