udp.7: Add FIONREAD warning.

Warn that FIONREAD can't can't distinguish case of a zero-length
datagram from the case where no datagrams are available.

Reported-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2010-06-13 05:00:58 +02:00
parent be62f42148
commit 402ffae30d
1 changed files with 14 additions and 1 deletions

View File

@ -5,7 +5,7 @@
.\" of the modification is added to the header.
.\" $Id: udp.7,v 1.7 2000/01/22 01:55:05 freitag Exp $
.\"
.TH UDP 7 2009-09-30 "Linux" "Linux Programmer's Manual"
.TH UDP 7 2010-06-13 "Linux" "Linux Programmer's Manual"
.SH NAME
udp \- User Datagram Protocol for IPv4
.SH SYNOPSIS
@ -205,6 +205,19 @@ The correct syntax is:
Gets a pointer to an integer as argument.
Returns the size of the next pending datagram in the integer in bytes,
or 0 when no datagram is pending.
.B Warning:
Using
.BR FIONREAD ,
it is impossible to distinguish the case where no datagram is pending
from the case where the next pending datagram contains zero bytes of data.
It is safer to use
.BR select (2),
.BR poll (2),
or
.BR epoll (7)
to distinguish these cases.
.\" See http://www.securiteam.com/unixfocus/5KP0I15IKO.html
.\" "GNUnet DoS (UDP Socket Unreachable)", 14 May 2006
.TP
.BR TIOCOUTQ " (" SIOCOUTQ )
Returns the number of data bytes in the local send queue.