]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Hey Emacs! This file is -*- nroff -*- source. |
2 | .\" | |
3 | .\" Copyright 2003 Abhijit Menon-Sen <ams@wiw.org> | |
4 | .\" Permission is granted to make and distribute verbatim copies of this | |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
12 | .\" | |
13 | .\" Since the Linux kernel and libraries are constantly changing, this | |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
20 | .\" | |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
23 | .\" | |
24 | .TH GETTID 2 "2003-02-01" "Linux 2.4.20" "Linux Programmer's Manual" | |
25 | .SH NAME | |
26 | gettid \- get thread identification | |
27 | .SH SYNOPSIS | |
16718a1c | 28 | .nf |
fea681da MK |
29 | .B #include <sys/types.h> |
30 | .br | |
31 | .B #include <linux/unistd.h> | |
6e2d1c54 | 32 | .br |
527d9933 | 33 | .B #include <errno.h> |
fea681da | 34 | .sp |
cb2431bf | 35 | .B _syscall0(pid_t, gettid) |
16718a1c | 36 | /* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */ |
fea681da | 37 | .sp |
16718a1c | 38 | .fi |
fea681da MK |
39 | .B pid_t gettid(void); |
40 | .SH DESCRIPTION | |
e511ffb6 | 41 | \fBgettid\fP() returns the thread ID of the current process. This is equal |
fea681da MK |
42 | to the process ID (as returned by |
43 | .BR getpid (2)), | |
44 | unless the process is part of a thread group (created by specifying | |
45 | the CLONE_THREAD flag to the | |
46 | .BR clone (2) | |
47 | system call). All processes in the same thread group | |
48 | have the same PID, but each one has a unique TID. | |
49 | .SH "RETURN VALUE" | |
50 | On success, returns the thread ID of the current process. | |
51 | .SH ERRORS | |
52 | This call is always successful. | |
53 | .SH "CONFORMING TO" | |
e511ffb6 | 54 | \fBgettid\fP() is Linux specific and should not be used in programs that |
fea681da MK |
55 | are intended to be portable. |
56 | .SH "SEE ALSO" | |
57 | .BR clone (2), | |
58 | .BR fork (2), | |
59 | .BR getpid (2) |