Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jun 2005 22:20:55 -0700
From:      John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To:        shiner chen <shiner_chen@yahoo.com.cn>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: a error about the kern_sendit
Message-ID:  <20050603052054.GE594@funkthat.com>
In-Reply-To: <20050603034129.34801.qmail@web15510.mail.cnb.yahoo.com>
References:  <20050603034129.34801.qmail@web15510.mail.cnb.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050603052054.GE594>