Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2003 09:21:55 -0400 (EDT)
From:      Marc Ramirez <marc.ramirez@bluecirclesoft.com>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Communications kernel -> userland
Message-ID:  <20030721092121.V47203@www.bluecirclesoft.com>
In-Reply-To: <3F18D07F.BEE28FF9@mindspring.com>
References:  <20030718150047.O61759@www.bluecirclesoft.com> <3F18D07F.BEE28FF9@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 18 Jul 2003, Terry Lambert wrote:

> Marc Ramirez wrote:
> > I asked this in -questions, but got no response; sorry for the repost.
> >
> > I have a device driver that needs to make requests for data from a
> > userland daemon.  What's the preferred method for doing this in 4.8R and
> > 5.1R?  I'm assuming the answer is Unix-domain sockets...
>
> It depends on the application.  In most cases these are set up
> as request/response protocols.
>
> In that case, the best method is to ise an ioctl() or fcntl()
> (which you use depends on what in the kernel is talking to
> userland), and then "returning" to user space with the request.
> The userland then makes another call back down with the response,
> and the next wait-for-request.  This saves you fully 50% of the
> protection domain crossing system calls from an ordinary callback,
> and it saves you 300% of the protection domain crossings of what
> you would need for a pipe/FIFO/unix-domain-socket.

I understand.  Thanks!

> E.g.:
>
> 	user				kernel
> 	----				------
> REQ1					make_req()
> 					sleep_waiting_for_available()
> 	ioctl(fd, MY_GETREQ, &req)
> 	sleep_waiting_for_req()
> 					copyout()
> 					sleep_waiting_for_rsp()
> 	ioctl(fd, MY_RSPREQ, &req)
> 	sleep_waiting_for_req()
> 					copyin()
> 					...
> REQ2					make_req()
> 					copyout()
> 					sleep_waiting_for_rsp()
> 	ioctl(fd, MY_RSPREQ, &req)
> 	sleep_waiting_for_req()
> 					copyin()
> 					...
> ...
>
> -- Terry
>


--
Marc Ramirez
Blue Circle Software Corporation
513-688-1070 (main)
513-382-1270 (direct)
www.bluecirclesoft.com



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