1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>eventfd_ctx_read</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Filesystems API"><link rel="up" href="fs_events.html" title="Chapter 3. Events based on file descriptors"><link rel="prev" href="API-eventfd-ctx-remove-wait-queue.html" title="eventfd_ctx_remove_wait_queue"><link rel="next" href="API-eventfd-fget.html" title="eventfd_fget"></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">eventfd_ctx_read</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-eventfd-ctx-remove-wait-queue.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Events based on file descriptors</th><td width="20%" align="right"> <a accesskey="n" href="API-eventfd-fget.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-eventfd-ctx-read"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>eventfd_ctx_read — 2 Reads the eventfd counter or wait if it is zero. 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">ssize_t <b class="fsfunc">eventfd_ctx_read </b>(</code></td><td>struct eventfd_ctx * <var class="pdparam">ctx</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">no_wait</var>, </td></tr><tr><td> </td><td>__u64 * <var class="pdparam">cnt</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1103146868"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>ctx</code></em></span></dt><dd><p> 4 [in] Pointer to eventfd context. 5 </p></dd><dt><span class="term"><em class="parameter"><code>no_wait</code></em></span></dt><dd><p> 6 [in] Different from zero if the operation should not block. 7 </p></dd><dt><span class="term"><em class="parameter"><code>cnt</code></em></span></dt><dd><p> 8 [out] Pointer to the 64-bit counter value. 9 </p></dd></dl></div></div><div class="refsect1"><a name="idp1103150572"></a><h2>Description</h2><p> 10 Returns <code class="constant">0</code> if successful, or the following error codes: 11 </p><p> 12 13 -EAGAIN : The operation would have blocked but <em class="parameter"><code>no_wait</code></em> was non-zero. 14 -ERESTARTSYS : A signal interrupted the wait operation. 15 </p><p> 16 17 If <em class="parameter"><code>no_wait</code></em> is zero, the function might sleep until the eventfd internal 18 counter becomes greater than zero. 19</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-eventfd-ctx-remove-wait-queue.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="fs_events.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-eventfd-fget.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">eventfd_ctx_remove_wait_queue</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">eventfd_fget</span></td></tr></table></div></body></html> 20