]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/get_robust_list.2
ldd.1, localedef.1, add_key.2, chroot.2, clone.2, fork.2, futex.2, get_mempolicy...
[thirdparty/man-pages.git] / 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 2016-07-17 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
47 the robust futexes which are to be 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 Permission to employ
68 .BR get_robust_list ()
69 is governed by a ptrace access mode
70 .B PTRACE_MODE_READ_REALCREDS
71 check; see
72 .BR ptrace (2).
73
74 The
75 .BR set_robust_list ()
76 system call requests the kernel to record the head of the list of
77 robust futexes owned by the calling thread.
78 The
79 .I head
80 argument is the list head to record.
81 The
82 .I len
83 argument should be
84 .IR sizeof(*head) .
85 .SH RETURN VALUE
86 The
87 .BR set_robust_list ()
88 and
89 .BR get_robust_list ()
90 system calls return zero when the operation is successful,
91 an error code otherwise.
92 .SH ERRORS
93 The
94 .BR set_robust_list ()
95 system call can fail with the following error:
96 .TP
97 .B EINVAL
98 .I len
99 does not equal
100 .IR "sizeof(struct\ robust_list_head)" .
101 .PP
102 The
103 .BR get_robust_list ()
104 system call can fail with the following errors:
105 .TP
106 .B EPERM
107 The calling process does not have permission to see the robust futex list of
108 the thread with the thread ID
109 .IR pid ,
110 and does not have the
111 .BR CAP_SYS_PTRACE
112 capability.
113 .TP
114 .B ESRCH
115 No thread with the thread ID
116 .I pid
117 could be found.
118 .TP
119 .B EFAULT
120 The head of the robust futex list can't be stored at the location
121 .IR head .
122 .SH VERSIONS
123 These system calls were added in Linux 2.6.17.
124 .SH NOTES
125 These system calls are not needed by normal applications.
126 No support for them is provided in glibc.
127 In the unlikely event that you want to call them directly, use
128 .BR syscall (2).
129
130 A thread can have only one robust futex list;
131 therefore applications that wish
132 to use this functionality should use the robust mutexes provided by glibc.
133 .SH SEE ALSO
134 .BR futex (2)
135 .\" .BR pthread_mutexattr_setrobust_np (3)
136
137 .IR Documentation/robust-futexes.txt
138 and
139 .IR Documentation/robust-futex-ABI.txt
140 in the Linux kernel source tree
141 .\" http://lwn.net/Articles/172149/