From: Waldemar Kozaczuk <jwkozac...@gmail.com> Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> Branch: master
socket: warn about missing ancillary information handling Nadav Har`El writes: "I think we never properly implemented the "ancillary data" (control message) feature of sockets which can be used to, among other things, send an open file descriptor between two processes communicating over a UNIX-domain socket. I don't remember why we never implemented this - I think the problem was (considering the file this is in, compat/linux/linux_socket.cc) that the BSD-based code assumes this ancillary data has one structure, but the Linux API assumes a different structure. Unfortunately this will be hard to fix properly without looking at the code and at the socket manual pages, and trying to remember what the heck this code is supposed to be doing. I also see there's a lot of #if 0 code in this area :-( Perhaps we can take a patch which doesn't outright remove these asserts, but just replaces them by a WARN_ONCE or something, so we'll allow these control messages but warn that they may not be handled properly." This patch makes it possible to run som XWindows apps like xclock, xeyes, etc. Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- diff --git a/bsd/sys/compat/linux/linux_socket.cc b/bsd/sys/compat/linux/linux_socket.cc --- a/bsd/sys/compat/linux/linux_socket.cc +++ b/bsd/sys/compat/linux/linux_socket.cc @@ -57,6 +57,7 @@ #include <bsd/sys/compat/linux/linux.h> #include <bsd/sys/compat/linux/linux_socket.h> +#include <osv/stubbing.hh> #define __NEED_sa_family_t #include <bits/alltypes.h> @@ -1081,7 +1082,10 @@ linux_recvmsg(int s, struct msghdr *msg, int flags, ssize_t* bytes) goto bad; } - assert(msg->msg_controllen == 0); + //TODO: Implement handling of ancillary data - see http://www.masterraghu.com/subjects/np/introduction/unix_network_programming_v1.3/ch14lev1sec6.html + if (msg->msg_controllen != 0) { + WARN_ONCE("linux_recvmsg: ignoring ancillary data (control message)!\n"); + } assert(msg->msg_control == NULL); #if 0 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000898ee605a4b34337%40google.com.