Hi, with the attached test source, I get SIGLOST in recvfrom(). Basically what happens in recvfrom() is the following: - the __socket_recv() RPC returns a MACH_PORT_NULL 'addrport' - execution goes inside the "if (addr != NULL)" - the __socket_whatis_address() RPC fails because of the null port (I presume), so err is MACH_SEND_INVALID_DEST - the generic "if (err)" is followed, and then __hurd_sockfail() raises SIGLOST
The question is: is __socket_recv() supposed to actually return an addrport in this case, or should recvfrom() just being able to gracefully cope with this situation? On Linux the address length is set to 0 by recvfrom(), so I guess that this kind of sockets have no address? -- Pino Toscano
#include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <stdlib.h> void die(int x, const char *s) { perror(s); exit(x); } int main() { int ret; int p[2]; char buf[2]; char namebuf[256]; socklen_t bufsize = sizeof(namebuf); ret = socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, p); if (ret) die(1, "socketpair"); ret = send(p[0], "xyz", 3, 0); printf("> send: %d\n", ret); if (ret < 0) die(2, "send"); ret = recvfrom(p[1], buf, sizeof(buf), 0, (struct sockaddr *)namebuf, &bufsize); printf("> recvfrom: %d, %d\n", ret, bufsize); if (ret < 0) die(3, "recvfrom"); close(p[0]); close(p[1]); return 0; }
signature.asc
Description: This is a digitally signed message part.