OSDN Git Service

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