[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ob0q3vu1.fsf@sable.mobileactivedefense.com>
Date: Fri, 28 Mar 2014 20:35:34 +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
Rainer Weikusat <rw@...le> writes:
[...]
> ---------
> #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;
> }
> --------
In the interest of fairness, here's a more realistic test case (tested
on 3.2.9 and 3.2.54):
--------------
#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) recv(fd, &fd, sizeof(fd), 0);
sleep(1);
recv(fd, &fd, sizeof(fd), MSG_DONTWAIT);
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