Date: Wed, 5 Nov 2008 09:34:07 GMT From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 152512 for review Message-ID: <200811050934.mA59Y7jx067418@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=152512 Change 152512 by peter@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 )
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811050934.mA59Y7jx067418>