[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CABMFubf=Ht7xFaN+9jiddDj08D150jwHpio8i09KHCSD_9bK=Q@mail.gmail.com>
Date: Tue, 26 Nov 2019 15:29:30 -0700
From: Jeremy Rifkin <rifkin.jer@...il.com>
To: mtk.manpages@...il.com
Cc: linux-man@...r.kernel.org, netdev@...r.kernel.org
Subject: [patch] accept.2: Added information about what can cause EAGAIN and
EWOULDBLOCK errors
Hello,
According to the accept.2 man page, EAGAIN and EWOULDBLOCK errors can occur when
"The socket is marked nonblocking and no connections are present to be
accepted". I have found that these errors can also occur when a receive timeout
has been set on the socket and the timeout expires before a connection can be
accepted. This appears to be the same behavior of the recv system call whose man
page states that EAGAIN and EWOULDBLOCK occur when "The socket is marked
nonblocking and the receive operation would block, or a receive timeout had been
set and the timeout expired before data was received."
I've included a test program to demonstrate that accept will fail with exit code
EAGAIN/EWOULDBLOCK when a receive timeout is set and the timeout expires.
This patch applies to the latest version man-pages, 5.04. I have amended
accept.2 to include this second reason why EAGAIN/EWOULDBLOCK can
occur. I have tried to use similar wording to that of the recv.2 man page.
======== Begin Diff ========
diff --git a/man2/accept.2 b/man2/accept.2
index a4bebd214..63e90a5e6 100644
--- a/man2/accept.2
+++ b/man2/accept.2
@@ -208,7 +208,9 @@ and
.BR EAGAIN " or " EWOULDBLOCK
.\" Actually EAGAIN on Linux
The socket is marked nonblocking and no connections are
-present to be accepted.
+present to be accepted, or a receive timeout has been
+set and the timeout expired before a new connection
+was available to be accepted.
POSIX.1-2001 and POSIX.1-2008
allow either error to be returned for this case,
and do not require these constants to have the same value,
========= End Diff =========
- Jeremy Rifkin
View attachment "accept2test.c" of type "text/plain" (3012 bytes)
Powered by blists - more mailing lists