a error about the kern_sendit

John-Mark Gurney gurney_j at resnet.uoregon.edu
Thu Jun 2 22:20:58 PDT 2005


shiner chen wrote this message on Fri, Jun 03, 2005 at 11:41 +0800:
> 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!!

This buffer is in SYSSPACE:
>  /* 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);*/
				       ^ but you say it's in userspace..

Look at uio.h for the enum uio_seg definition...  and uio(9) is also
useful...  Try replacing that last zero with UIO_SYSSPACE..

>  st = keta_kern_sendit(td, control_so,&msg,0,0); 

and possibly here...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the freebsd-hackers mailing list