What is the equivalent of Linux 'gettid' systemcall on FreeBSD?

Pietro Cerutti gahr at gahr.ch
Fri Oct 26 02:24:34 PDT 2007

Yuri wrote:
> Hi,
> I am porting some code to FreeBSD and need to know what todoinstead of Linux gettid?

There isn't an equivalent in FreeBSD. gettid(2) is Linux-specific.
From the man page, if the thread is not part of a thread group created
by passing the flag CLONE_THREAD to clone(2) [yet another Linux-specific
system call] gettid(2) is equivalent to getpid(2).

However, if the application being ported uses clone(2), you'll first
want to decide for a threading library available on FreeBSD.

> Thanks,
> Yuri

Pietro Cerutti

PGP Public Key:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20071026/68c54d77/signature.pgp

More information about the freebsd-questions mailing list