Date: Fri, 3 Jun 2005 11:41:29 +0800 (CST) From: shiner chen <shiner_chen@yahoo.com.cn> To: freebsd-hackers@freebsd.org Subject: a error about the kern_sendit Message-ID: <20050603034129.34801.qmail@web15510.mail.cnb.yahoo.com>
index | next in thread | raw e-mail
i wrote a function to send the data of my a data structure in my kld by socket in kernel, the function as follow:
the arg 1 is file descriptor of socket. the arg 2 is the address of data structure. the arg 3 is the length of data structure and it is 20 bytes .
the error return by kern_sendit is EFAULT(14), i check the address of data structure ,but it is right!
why ? who can tell me. thanks!!
int loadinfo_send(int so_fd, struct thread *td,
char *snd_buf, unsigned int uBufLen)
{
int st = 0;
/* read */
struct iovec aiov;
struct msghdr msg;
msg.msg_name = 0;
msg.msg_namelen = 0;
msg.msg_iov = &aiov;
msg.msg_iovlen = 1;
msg.msg_control = 0;
msg.msg_flags = 0;
/* do actual send operation now */
aiov.iov_base = snd_buf ;
aiov.iov_len = uBufLen;
///////// there is error////////////////////////
/*st = kern_sendit(td, so_fd,&msg,0,0);*/
st = keta_kern_sendit(td, control_so,&msg,0,0);
if( st!=0 ){
if ( st == EAGAIN ){
loadinfo_msleep(1);
}
else{
log(LOG_DEBUG,"in loadinfo_send, send error(%d)!\n",st);
return st;
}
}
log(LOG_DEBUG,"send successfully !\n");
return st;
}
---------------------------------
DO YOU YAHOO!?
雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050603034129.34801.qmail>
