From owner-freebsd-current Sun Jan 10 19:34:22 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA23901 for freebsd-current-outgoing; Sun, 10 Jan 1999 19:34:22 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from janus.syracuse.net (janus.syracuse.net [205.232.47.15]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA23896 for ; Sun, 10 Jan 1999 19:34:18 -0800 (PST) (envelope-from green@unixhelp.org) Received: from localhost (green@localhost) by janus.syracuse.net (8.8.8/8.8.7) with ESMTP id WAA07709 for ; Sun, 10 Jan 1999 22:33:50 -0500 (EST) Date: Sun, 10 Jan 1999 22:33:50 -0500 (EST) From: Brian Feldman X-Sender: green@janus.syracuse.net To: freebsd-current@FreeBSD.ORG Subject: Re: Linux sendmsg() (correction) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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