a error about the kern_sendit

shiner chen shiner_chen at yahoo.com.cn
Thu Jun 2 20:41:32 PDT 2005


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ÓÊÏ䣭ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä 


More information about the freebsd-hackers mailing list