Date: Sun, 10 Jan 1999 22:33:50 -0500 (EST) From: Brian Feldman <green@unixhelp.org> To: freebsd-current@FreeBSD.ORG Subject: Re: Linux sendmsg() (correction) Message-ID: <Pine.BSF.4.05.9901102227060.5840-100000@janus.syracuse.net>
next in thread | raw e-mail | index | archive | help
Whoops, color my face blue :( For some reason, my Linux sendmsg() patches failed, and frankly it seems to be the fault of offsetof... after replacing offsetof with what the current code is, it actually works... Committers? :) It's rather nice to have sendmsg() with a msg_control actually working now! (If anyone knows why the same code, instead using ptr + offsetof(stu,ff), now being &((stu)ptr)->ff, works right.... please let me know?) Brian Feldman _ __ ___ ___ ___ green@unixhelp.org _ __ ___ | _ ) __| \ http://www.freebsd.org/ _ __ ___ ____ | _ \__ \ |) | FreeBSD: The Power to Serve! _ __ ___ ____ _____ |___/___/___/ --- src/sys/i386/linux/linux_socket.c.orig Sun Jan 10 22:28:32 1999 +++ src/sys/i386/linux/linux_socket.c Sun Jan 10 22:25:09 1999 @@ -811,7 +811,40 @@ case LINUX_GETSOCKOPT: return linux_getsockopt(p, args->args); case LINUX_SENDMSG: - return sendmsg(p, args->args); + do { + int error; + int level; + caddr_t control; + struct { + int s; + const struct msghdr *msg; + int flags; + } *uap = args->args; + + error = copyin(&uap->msg->msg_control, + &control, sizeof(caddr_t)); + if (error) + return error; + if (control == NULL) + goto done; + error = copyin(&((struct cmsghdr *)control)->cmsg_level, + &level, sizeof(int)); + if (error) + return error; + if (level == 1) { + /* + * Linux thinks that SOL_SOCKET is 1; we know that it's really + * 0xffff, of course. + */ + level = SOL_SOCKET; + error = copyout(&level, &((struct cmsghdr *)control)-> + cmsg_level, sizeof(int)); + if (error) + return error; + } + done: + return sendmsg(p, args->args); + } while (0); case LINUX_RECVMSG: return recvmsg(p, args->args); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901102227060.5840-100000>