[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a9cc7j1o.fsf@sable.mobileactivedefense.com>
Date: Wed, 26 Mar 2014 21:21:23 +0000
From: Rainer Weikusat <rweikusat@...ileactivedefense.com>
To: David Miller <davem@...emloft.net>
Cc: eric.dumazet@...il.com, David.Laight@...LAB.COM,
netdev@...r.kernel.org
Subject: Re: [PATCH] net: unix: non blocking recvmsg() should not return -EINTR
David Miller <davem@...emloft.net> writes:
> From: Rainer Weikusat <rweikusat@...ileactivedefense.com>:
>> As I already wrote, this is a theoretical problem with no really
>> satisfactory solution minus noting that both 'nonblocking sockets' and
>> 'multithreaded kernels' are somewhat alien concepts when considering the
>> system where EINTR originated (AFAIK).
>
> I completely disagree.
And I "completely disagree" with having written the text above, that is
minus the "reporting EAGAIN when the call was really interrupted by a
signal is inaccurate" and "for pragmatic reasons, the kernel should
behave in line with common expectations about its behaviour" parts which
means
a) This is an 'interesting theoretical problem to me' (but maybe not to
you)
b) my suggestion would be to apply the patch regardless of it.
BTW, here's the program with the O_NONBLOCK read call which blocks until
the end of electricity, at least on 3.2.9:
---------
#include <fcntl.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
int main(void)
{
struct sockaddr_un sun;
int fd;
fd = socket(AF_UNIX, SOCK_DGRAM, 0);
sun.sun_family = AF_UNIX;
strncpy(sun.sun_path, "/tmp/bla", sizeof(sun.sun_path));
bind(fd, (struct sockaddr *)&sun, sizeof(sun));
if (fork() == 0) read(fd, &fd, sizeof(fd));
sleep(1);
fcntl(fd, F_SETFL, O_NONBLOCK);
read(fd, &fd, sizeof(fd));
return 0;
}
--------
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists