<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>__skb_recv_datagram</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Linux Networking and Network Devices APIs" /><link rel="up" href="ch01s02.html" title="Socket Buffer Functions" /><link rel="prev" href="re101.html" title="__sk_mem_reclaim" /><link rel="next" href="re103.html" title="skb_kill_datagram" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>__skb_recv_datagram</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re101.html">Prev</a> </td><th width="60%" align="center">Socket Buffer Functions</th><td width="20%" align="right"> <a accesskey="n" href="re103.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="__skb_recv_datagram"><a id="API---skb-recv-datagram"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>__skb_recv_datagram — Receive a datagram skbuff </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">struct sk_buff * <b class="fsfunc">__skb_recv_datagram </b>(</code></td><td>struct sock * <var class="pdparam">sk</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">flags</var>, </td></tr><tr><td> </td><td>int * <var class="pdparam">peeked</var>, </td></tr><tr><td> </td><td>int * <var class="pdparam">err</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2733354"></a><h2>Arguments</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>sk</code></em></span></dt><dd><p> socket </p></dd><dt><span class="term"><em class="parameter"><code>flags</code></em></span></dt><dd><p> MSG_ flags </p></dd><dt><span class="term"><em class="parameter"><code>peeked</code></em></span></dt><dd><p> returns non-zero if this packet has been seen before </p></dd><dt><span class="term"><em class="parameter"><code>err</code></em></span></dt><dd><p> error code returned </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2733432"></a><h2>Description</h2><p> Get a datagram skbuff, understands the peeking, nonblocking wakeups and possible races. This replaces identical code in packet, raw and udp, as well as the IPX AX.25 and Appletalk. It also finally fixes the long standing peek and read race for datagram sockets. If you alter this routine remember it must be re-entrant. </p><p> This function will lock the socket if a skb is returned, so the caller needs to unlock the socket in that case (usually by calling skb_free_datagram) </p><p> * It does not lock socket since today. This function is * free of race conditions. This measure should/can improve * significantly datagram socket latencies at high loads, * when data copying to user space takes lots of time. * (BTW I've just killed the last <code class="function">cli</code> in IP/IPv6/core/netlink/packet * 8) Great win.) * --ANK (980729) </p><p> The order of the tests when we find no data waiting are specified quite explicitly by POSIX 1003.1g, don't change them without having the standard around please. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re101.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01s02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re103.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>__sk_mem_reclaim</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span>skb_kill_datagram</span></td></tr></table></div></body></html>