OSDN Git Service

LDP: Update original to LDP v3.68
[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 .\" %%%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 .\" FIXME Something could be added to this page (or exit(2))
27 .\"       about exit_robust_list processing
28 .\"
29 .TH GET_ROBUST_LIST 2 2014-05-10 Linux "Linux System Calls"
30 .SH NAME
31 get_robust_list, set_robust_list \- get/set list of robust futexes
32 .SH SYNOPSIS
33 .nf
34 .B #include <linux/futex.h>
35 .B #include <sys/types.h>
36 .B #include <syscall.h>
37 .sp
38 .BI "long get_robust_list(int " pid ", struct robust_list_head **" head_ptr ,
39 .BI "                     size_t *" len_ptr );
40 .BI "long set_robust_list(struct robust_list_head *" head ", size_t " len );
41 .fi
42
43 .IR Note :
44 There are no glibc wrappers for these system calls; see NOTES.
45 .SH DESCRIPTION
46 The robust futex implementation needs to maintain per-thread lists of robust
47 futexes which are unlocked when the thread exits.
48 These lists are managed in user space; the kernel is notified about only
49 the location of the head of the list.
50
51 The
52 .BR get_robust_list ()
53 system call returns the head of the robust futex list of the thread
54 whose thread ID is specified in
55 .IR pid .
56 If
57 .I pid
58 is 0,
59 the head of the list for the calling thread is returned.
60 The list head is stored in the location pointed to by
61 .IR head_ptr .
62 The size of the object pointed to by
63 .I **head_ptr
64 is stored in
65 .IR len_ptr .
66
67 The
68 .BR set_robust_list ()
69 system call requests the kernel to record the head of the list of
70 robust futexes owned by the calling thread.
71 The
72 .I head
73 argument is the list head to record.
74 The
75 .I len
76 argument should be
77 .IR sizeof(*head) .
78 .SH RETURN VALUE
79 The
80 .BR set_robust_list ()
81 and
82 .BR get_robust_list ()
83 system calls return zero when the operation is successful,
84 an error code otherwise.
85 .SH ERRORS
86 The
87 .BR set_robust_list ()
88 system call can fail with the following error:
89 .TP
90 .B EINVAL
91 .I len
92 does not match the size of structure
93 .B struct robust_list_head
94 expected by kernel.
95 .PP
96 The
97 .BR get_robust_list ()
98 system call can fail with the following errors:
99 .TP
100 .B EPERM
101 The calling process does not have permission to see the robust futex list of
102 the thread with the thread ID
103 .IR pid ,
104 and does not have the
105 .BR CAP_SYS_PTRACE
106 capability.
107 .TP
108 .B ESRCH
109 No thread with the thread ID
110 .I pid
111 could be found.
112 .TP
113 .B EFAULT
114 The head of the robust futex list can't be stored at the location
115 .IR head .
116 .SH VERSIONS
117 These system calls were added in Linux 2.6.17.
118 No library support is provided; use
119 .BR syscall (2).
120 .SH NOTES
121 These system calls are not needed by normal applications.
122 No support for them is provided in glibc.
123 In the unlikely event that you want to call them directly, use
124 .BR syscall (2).
125
126 A thread can have only one robust futex list;
127 therefore applications that wish
128 to use this functionality should use the robust mutexes provided by glibc.
129 .SH SEE ALSO
130 .BR futex (2)
131 .\" .BR pthread_mutexattr_setrobust_np (3)
132
133 .IR Documentation/robust-futexes.txt
134 and
135 .IR Documentation/robust-futex-ABI.txt
136 in the Linux kernel source tree
137 .\" http://lwn.net/Articles/172149/
138 .SH COLOPHON
139 This page is part of release 3.68 of the Linux
140 .I man-pages
141 project.
142 A description of the project,
143 information about reporting bugs,
144 and the latest version of this page,
145 can be found at
146 \%http://www.kernel.org/doc/man\-pages/.