Hi Carlos, On 2/23/09, Carlos O'Donell <carlos@xxxxxxxxxxxxxxxx> wrote: > On Sun, Feb 22, 2009 at 10:31 PM, Michael Kerrisk > <mtk.manpages@xxxxxxxxxxxxxx> wrote: >> Hmmm -- "often" is rather strong. I will certainly allow >> "occasionally" (or perhaps a little more), and I note in passing that >> for someone making the claim of "often", I never saw a patch from you >> so far to correct an error... > > Sorry Michael, I actually meant to say "often incomplete" instead of > "often incorrect." I appreciate your work on the man-pages project. > > As penance. Thanks. Apology accepted ;-). > ~~~ > The write.2 man-page should mention EWOULDBLOCK could be returned by a > write to a socket. Thanks. Yes, that mail thread already prompted me to look at all pages that discuss EAGAIN and EWOULDBLOCK, and I have a fix in progress for accept(2), recv(2), send(2), read(2), and write(2). Essentially the fix to go in each of these pages is this: For non-blocking sockets, POSIX says that the interfaces can return either error, and since POSIX.1 does require that EAGAIN == EWOULDBLOCK, a portable application should check for both possibilities. > POSIX says it may return EWOULDBLOCK by a write to a socket. > http://www.opengroup.org/onlinepubs/009695399/functions/write.html > > It appears that some of the linux kernel net code in 2.6.29-rc5 may > return -EWOULDBLOCK, but I can't be 100% sure that it would be the > result of a write to a socket. Yes, it looks to me like there is a little confusion in the kernel code (which isn't generally visible in userspace where EAGAIN == EWOULDBLOCK). I'd say that probably all the net/ code sould be using either one constant or the other. (It appears to be only some of the more obscure networking protocols that use EWOULDBLOCK.) > Patch is against git master. Thanks. My changes already encompass your proposal below, but I have taken the liberty to record a Reported-by: for you in the change log. Cheers, Michael > ~~~ > diff --git a/man2/write.2 b/man2/write.2 > index 3bcc93d..ad9ef56 100644 > --- a/man2/write.2 > +++ b/man2/write.2 > @@ -157,6 +157,13 @@ When this happens the writing process will also receive > a > signal. > (Thus, the write return value is seen only if the program > catches, blocks or ignores this signal.) > +.TP > +.B EAGAIN > +or > +.B EWOULDBLOCK > +.I fd > +is a socket, is marked O_NONBLOCK, and write would block. Sockets > +created with SOCK_NONBLOCK are marked O_NONBLOCK. > .PP > Other errors may occur, depending on the object connected to > .IR fd . > ~~~ > > Cheers, > Carlos. > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html