From 402ffae30dc147cf4b4181080a84c91573b78fa3 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sun, 13 Jun 2010 05:00:58 +0200 Subject: [PATCH] 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 Signed-off-by: Michael Kerrisk --- man7/udp.7 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/man7/udp.7 b/man7/udp.7 index 53a91db1c..c2e7003e3 100644 --- a/man7/udp.7 +++ b/man7/udp.7 @@ -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.