PERFORCE change 152512 for review
Peter Wemm
peter at FreeBSD.org
Wed Nov 5 01:34:08 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=152512
Change 152512 by peter at peter_overcee on 2008/11/05 09:33:31
Make gettid() work. (loosely from phk)
Affected files ...
.. //depot/projects/valgrind/coregrind/m_libcproc.c#6 edit
Differences ...
==== //depot/projects/valgrind/coregrind/m_libcproc.c#6 (text+ko) ====
@@ -368,15 +368,8 @@
pids, etc
------------------------------------------------------------------ */
-#ifdef VGO_freebsd
Int VG_(gettid)(void)
{
- // VG_(printf)("valgrind: gettid() faked\n");
- return VG_(do_syscall0)(__NR_getpid).res;
-}
-#else
-Int VG_(gettid)(void)
-{
# if defined(VGO_aix5)
SysRes res;
Int r;
@@ -385,6 +378,15 @@
r = res.res;
return r;
+# elif defined(VGO_freebsd)
+ SysRes res;
+ long tid;
+
+ res = VG_(do_syscall1)(__NR_thr_self, (UWord)&tid);
+ if (res.isError)
+ tid = VG_(do_syscall0)(__NR_getpid).res;
+ return tid;
+
# else
SysRes res = VG_(do_syscall0)(__NR_gettid);
@@ -415,7 +417,6 @@
return res.res;
# endif
}
-#endif
/* You'd be amazed how many places need to know the current pid. */
Int VG_(getpid) ( void )
More information about the p4-projects
mailing list