Re: [Pkg-citadel-devel] Bug#590005: citadel: FTBFS on kfreebsd-*:threads.c:852: error: 'SYS_gettid' undeclared
On Sat, 2010-07-24 at 19:22:59 +0200, Cyril Brulebois wrote:
> Wilfried Goesgens <email@example.com> (24/07/2010):
> > the line is to determine the LWPID of the thread in question; it
> > doesn't seem as if pthread offers a portable wrapper, it just gives
> > you the thread-ID which otoh you won't find anywhere else on the
> > system aside of gdb; for example top or ps just give you the LWPID.
> > whats the BSD-way of doing this?
> > the lines in question look like that:
> > #ifdef HAVE_SYSCALL_H
> > this_thread->reltid = syscall(SYS_gettid);
> > #endif
The FreeBSD kernel suports the thr_self(2) syscall, which you'd have
to invoke manually yourself. But, checking the citadel code it seems
it would work just fine if SYS_gettid availability was checked for, as
it's only using the tid for logging. Retrieving it is just non-portable
and should not be generally used or depended on, though.