Date: Sat, 9 Jan 1999 14:41:29 -0500 (EST) From: Brian Feldman <green@unixhelp.org> To: Kenneth Wayne Culver <culverk@wam.umd.edu> Cc: freebsd-current@FreeBSD.ORG Subject: Re: USER_LDT in Linux emulation Message-ID: <Pine.BSF.4.05.9901091439450.304-100000@janus.syracuse.net> In-Reply-To: <Pine.BSF.4.05.9901091424580.304-100000@janus.syracuse.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901091439450.304-100000>
