1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>futex_wait_requeue_pi</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Unreliable Guide To Locking"><link rel="up" href="apiref-futex.html" title="Chapter&#160;12.&#160;Futex API reference"><link rel="prev" href="API-handle-early-requeue-pi-wakeup.html" title="handle_early_requeue_pi_wakeup"><link rel="next" href="API-sys-set-robust-list.html" title="sys_set_robust_list"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">futex_wait_requeue_pi</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-handle-early-requeue-pi-wakeup.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;12.&#160;Futex API reference</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-sys-set-robust-list.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-futex-wait-requeue-pi"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>futex_wait_requeue_pi &#8212; 
2     Wait on uaddr and take uaddr2
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">futex_wait_requeue_pi </b>(</code></td><td>u32 __user * <var class="pdparam">uaddr</var>, </td></tr><tr><td>&#160;</td><td>unsigned int <var class="pdparam">flags</var>, </td></tr><tr><td>&#160;</td><td>u32 <var class="pdparam">val</var>, </td></tr><tr><td>&#160;</td><td>ktime_t * <var class="pdparam">abs_time</var>, </td></tr><tr><td>&#160;</td><td>u32 <var class="pdparam">bitset</var>, </td></tr><tr><td>&#160;</td><td>u32 __user * <var class="pdparam">uaddr2</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1124957116"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>uaddr</code></em></span></dt><dd><p>
4     the futex we initially wait on (non-pi)
5    </p></dd><dt><span class="term"><em class="parameter"><code>flags</code></em></span></dt><dd><p>
6     futex flags (FLAGS_SHARED, FLAGS_CLOCKRT, etc.), they must be
7     the same type, no requeueing from private to shared, etc.
8    </p></dd><dt><span class="term"><em class="parameter"><code>val</code></em></span></dt><dd><p>
9     the expected value of uaddr
10    </p></dd><dt><span class="term"><em class="parameter"><code>abs_time</code></em></span></dt><dd><p>
11     absolute timeout
12    </p></dd><dt><span class="term"><em class="parameter"><code>bitset</code></em></span></dt><dd><p>
13     32 bit wakeup bitset set by userspace, defaults to all
14    </p></dd><dt><span class="term"><em class="parameter"><code>uaddr2</code></em></span></dt><dd><p>
15     the pi futex we will take prior to returning to user-space
16    </p></dd></dl></div></div><div class="refsect1"><a name="idp1124963804"></a><h2>Description</h2><p>
17   The caller will wait on uaddr and will be requeued by <code class="function">futex_requeue</code> to
18   uaddr2 which must be PI aware and unique from uaddr.  Normal wakeup will wake
19   on uaddr2 and complete the acquisition of the rt_mutex prior to returning to
20   userspace.  This ensures the rt_mutex maintains an owner when it has waiters;
21   without one, the pi logic would not know which task to boost/deboost, if
22   there was a need to.
23   </p><p>
24
25   We call schedule in <code class="function">futex_wait_queue_me</code> when we enqueue and return there
26   via the following--
27   1) wakeup on uaddr2 after an atomic lock acquisition by <code class="function">futex_requeue</code>
28   2) wakeup on uaddr2 after a requeue
29   3) signal
30   4) timeout
31   </p><p>
32
33   If 3, cleanup and return -ERESTARTNOINTR.
34   </p><p>
35
36   If 2, we may then block on trying to take the rt_mutex and return via:
37   5) successful lock
38   6) signal
39   7) timeout
40   8) other lock acquisition failure
41   </p><p>
42
43   If 6, return -EWOULDBLOCK (restarting the syscall would do the same).
44   </p><p>
45
46   If 4 or 7, we cleanup and return with -ETIMEDOUT.
47</p></div><div class="refsect1"><a name="idp1124966972"></a><h2>Return</h2><p>
48   0 - On success;
49   &lt;0 - On error
50</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-handle-early-requeue-pi-wakeup.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="apiref-futex.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-sys-set-robust-list.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">handle_early_requeue_pi_wakeup</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">sys_set_robust_list</span></td></tr></table></div></body></html>
51