OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / original / man2 / gettid.2
1 .\" Copyright 2003 Abhijit Menon-Sen <ams@wiw.org>
2 .\" and Copyright (C) 2008 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .TH GETTID 2 2014-02-11 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 gettid \- get thread identification
29 .SH SYNOPSIS
30 .nf
31 .B #include <sys/types.h>
32 .sp
33 .B pid_t gettid(void);
34 .fi
35
36 .IR Note :
37 There is no glibc wrapper for this system call; see NOTES.
38 .SH DESCRIPTION
39 .BR gettid ()
40 returns the caller's thread ID (TID).
41 In a single-threaded process, the thread ID
42 is equal to the process ID (PID, as returned by
43 .BR getpid (2)).
44 In a multithreaded process, all threads
45 have the same PID, but each one has a unique TID.
46 For further details, see the discussion of
47 .BR CLONE_THREAD
48 in
49 .BR clone (2).
50 .SH RETURN VALUE
51 On success, returns the thread ID of the calling process.
52 .SH ERRORS
53 This call is always successful.
54 .SH VERSIONS
55 The
56 .BR gettid ()
57 system call first appeared on Linux in kernel 2.4.11.
58 .SH CONFORMING TO
59 .BR gettid ()
60 is Linux-specific and should not be used in programs that
61 are intended to be portable.
62 .SH NOTES
63 Glibc does not provide a wrapper for this system call; call it using
64 .BR syscall (2).
65 .\" FIXME . See http://sourceware.org/bugzilla/show_bug.cgi?id=6399
66 .\" "gettid() should have a wrapper"
67
68 The thread ID returned by this call is not the same thing as a
69 POSIX thread ID (i.e., the opaque value returned by
70 .BR pthread_self (3)).
71 .SH SEE ALSO
72 .BR capget (2),
73 .BR clone (2),
74 .BR fcntl (2),
75 .BR fork (2),
76 .BR get_robust_list (2),
77 .BR getpid (2),
78 .\" .BR kcmp (2),
79 .BR ioprio_set (2),
80 .\" .BR move_pages (2),
81 .\" .BR migrate_pages (2),
82 .BR perf_event_open (2),
83 .\" .BR process_vm_readv (2),
84 .\" .BR ptrace (2),
85 .BR sched_setaffinity (2),
86 .BR sched_setparam (2),
87 .BR sched_setscheduler (2),
88 .BR tgkill (2),
89 .BR timer_create (2)
90 .SH COLOPHON
91 This page is part of release 3.79 of the Linux
92 .I man-pages
93 project.
94 A description of the project,
95 information about reporting bugs,
96 and the latest version of this page,
97 can be found at
98 \%http://www.kernel.org/doc/man\-pages/.