OSDN Git Service

(split) LDP: Update original to LDP v3.41.
[linuxjm/LDP_man-pages.git] / original / man2 / get_robust_list.2
1 .\" Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
2 .\" Written by Ivana Varekova <varekova@redhat.com>
3 .\"
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 .\" FIXME Something could be added to this page (or exit(2))
25 .\"       about exit_robust_list processing
26 .\"
27 .TH GET_ROBUST_LIST 2 2012-05-03 Linux "Linux System Calls"
28 .SH NAME
29 get_robust_list, set_robust_list \- get/set list of robust futexes
30 .SH SYNOPSIS
31 .nf
32 .B #include <linux/futex.h>
33 .B #include <syscall.h>
34 .sp
35 .BI "long get_robust_list(int " pid ", struct robust_list_head **" head_ptr ,
36 .BI "                     size_t *" len_ptr );
37 .BI "long set_robust_list(struct robust_list_head *" head ", size_t " len );
38 .fi
39 .SH DESCRIPTION
40 The robust futex implementation needs to maintain per-thread lists of robust
41 futexes which are unlocked when the thread exits.
42 These lists are managed in user space; the kernel is only notified about
43 the location of the head of the list.
44
45 The
46 .BR get_robust_list ()
47 system call returns the head of the robust futex list of the thread
48 whose thread ID is specified in
49 .IR pid .
50 If
51 .I pid
52 is 0,
53 the head of the list for the calling thread is returned.
54 The list head is stored in the location pointed to by
55 .IR head_ptr .
56 The size of the object pointed to by
57 .I **head_ptr
58 is stored in
59 .IR len_ptr .
60
61 The
62 .BR set_robust_list ()
63 system call requests the kernel to record the head of the list of
64 robust futexes owned by the calling thread.
65 The
66 .I head
67 argument is the list head to record.
68 The
69 .I len
70 argument should be
71 .IR sizeof(*head) .
72 .SH "RETURN VALUE"
73 The
74 .BR set_robust_list ()
75 and
76 .BR get_robust_list ()
77 system calls return zero when the operation is successful,
78 an error code otherwise.
79 .SH ERRORS
80 The
81 .BR set_robust_list ()
82 system call can fail with the following error:
83 .TP
84 .B EINVAL
85 .I len
86 does not match the size of structure
87 .B struct robust_list_head
88 expected by kernel.
89 .PP
90 The
91 .BR get_robust_list ()
92 system call can fail with the following errors:
93 .TP
94 .B EPERM
95 The calling process does not have permission to see the robust futex list of
96 the thread with the thread ID
97 .IR pid ,
98 and does not have the
99 .BR CAP_SYS_PTRACE
100 capability.
101 .TP
102 .B ESRCH
103 No thread with the thread ID
104 .I pid
105 could be found.
106 .TP
107 .B EFAULT
108 The head of the robust futex list can't be stored at the location
109 .IR head .
110 .SH VERSIONS
111 These system calls were added in Linux 2.6.17.
112 No library support is provided; use
113 .BR syscall (2).
114 .SH NOTES
115 These system calls are not needed by normal applications.
116 No support for them is provided in glibc.
117
118 A thread can have only one robust futex list;
119 therefore applications that wish
120 to use this functionality should use the robust mutexes provided by glibc.
121 .SH "SEE ALSO"
122 .BR futex (2)
123 .\" .BR pthread_mutexattr_setrobust_np (3)
124 .br
125 The kernel source files
126 .IR Documentation/robust-futexes.txt
127 and
128 .IR Documentation/robust-futex-ABI.txt .
129 .\" http://lwn.net/Articles/172149/