From owner-freebsd-current Sat Jan 9 11:42:00 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA03520 for freebsd-current-outgoing; Sat, 9 Jan 1999 11:42:00 -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 LAA03514 for ; Sat, 9 Jan 1999 11:41:58 -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 OAA02629; Sat, 9 Jan 1999 14:41:29 -0500 (EST) Date: Sat, 9 Jan 1999 14:41:29 -0500 (EST) From: Brian Feldman X-Sender: green@janus.syracuse.net To: Kenneth Wayne Culver cc: freebsd-current@FreeBSD.ORG Subject: Re: USER_LDT in Linux emulation In-Reply-To: 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, didn't include the sendmsg() weirdness I need a bit of help with. {"/home/green/wine-990103"}$ ./wine socket: 3 struct msghdr: msg_name = (nil) msg_namelen = 0 msg_iov = 0xefbfd6e8 msg_iovlen = 2 msg_control = 0xefbfd6b0 msg_controllen = 16 msg_flags = 0 msghdr.msg_iov[0].iov_base = 0xefbfd688 msghdr.msg_iov[0].iov_len = 12 msghdr.msg_iov[1].iov_base = 0xefbfd790 msghdr.msg_iov[1].iov_len = 4 sendmsg: Invalid argument Client protocol error:(nil): partial msg sent -1/16 Memory fault (core dumped) {"/home/green/wine-990103"}$ Relevant code: LIENT_SendRequest_v * * Send a request to the server. */ static void CLIENT_SendRequest_v( enum request req, int pass_fd, struct iovec *vec, int veclen ) { THDB *thdb = THREAD_Current(); #ifndef HAVE_MSGHDR_ACCRIGHTS struct cmsg_fd cmsg = { sizeof(cmsg), SOL_SOCKET, SCM_RIGHTS, pass_fd }; #endif struct msghdr msghdr = { NULL, 0, vec, veclen, NULL, 0, 0}; struct header head; int i, ret, len; assert( veclen > 0 ); vec[0].iov_base = &head; vec[0].iov_len = sizeof(head); for (i = len = 0; i < veclen; i++) len += vec[i].iov_len; assert( len <= MAX_MSG_LENGTH ); head.type = req; head.len = len; head.seq = thdb->seq++; if (pass_fd != -1) /* we have an fd to send */ { #ifdef HAVE_MSGHDR_ACCRIGHTS msghdr.msg_accrights = (void *)&pass_fd; msghdr.msg_accrightslen = sizeof(pass_fd); #else msghdr.msg_control = &cmsg; msghdr.msg_controllen = sizeof(cmsg); #endif } printf("socket: %d\n" "struct msghdr:\n" "msg_name = %p\n" "msg_namelen = %d\n" "msg_iov = %p\n" "msg_iovlen = %d\n" "msg_control = %p\n" "msg_controllen = %d\n" "msg_flags = %d\n", thdb->socket, msghdr.msg_name, msghdr.msg_namelen, msghdr.msg_iov, msghdr.msg_iovlen, msghdr.msg_control, msghdr.msg_controllen, msghdr.msg_flags); { register struct iovec *iov = msghdr.msg_iov; int c; for (c = 0; c < msghdr.msg_iovlen; c++) printf("msghdr.msg_iov[%d].iov_base = %p\n" "msghdr.msg_iov[%d].iov_len = %d\n", c, iov[c].iov_base, c, iov[c].iov_len); } if ((ret = sendmsg( thdb->socket, &msghdr, 0 )) < len) { if (ret == -1) perror( "sendmsg" ); CLIENT_ProtocolError( "partial msg sent %d/%d\n", ret, len ); } /* we passed the fd now we can close it */ if (pass_fd != -1) close( pass_fd ); } Brian Feldman _ __ ___ ___ ___ green@unixhelp.org _ __ ___ | _ ) __| \ http://www.freebsd.org/ _ __ ___ ____ | _ \__ \ |) | FreeBSD: The Power to Serve! _ __ ___ ____ _____ |___/___/___/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message