Re: how to use the function copyout()
From: Scott Long (scottl_at_samsco.org)
Date: 07/26/05
- Previous message: Scott Long: "Re: how to use the function copyout()"
- In reply to: Giorgos Keramidas: "Re: how to use the function copyout()"
- Next in thread: Matthew N. Dodd: "RE: how to use the function copyout()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 25 Jul 2005 17:15:43 -0600 To: Giorgos Keramidas <keramida@freebsd.org>
Giorgos Keramidas wrote:
> On 2005-07-25 18:14, Felix-KM <Felix-KM@yandex.ru> wrote:
>
>>>I have no idea if it is possible for ioctls to have mapped more than
>>>a few 100 bytes for data exchange. You should use read and uiomove()
>>>instead.
>>
>>So if I get it right, it's impossible in FreeBSD to gain access to
>>64KB of user's program memory with ioctl?
>>
>>My situation is this - I have a device driver for Linux. My task is
>>port it as it is (1:1) into FreeBSD.
>>
>>In the Linux driver Ioctl is realized with the macroses _put_user
>>_get_user all over it. As I understand in FreeBSD their analogues are
>>functions described in store(9), copy(9) and fetch(9).
>>
>>So the problem is that in my user program an array short unsigned int
>>Data[32768] is defined. I need to gain access to the array(to each
>>element of it) from device driver with Ioctl handler.
>>
>>Is it possible to do? If yes, then how it can be done?
>
>
> A better alternative that doesn't involve copying huge amounts of data
> from userlevel to kernel space and vice versa is probably to pass just
> the address of the area with an ioctl() and then map the appropriate
> pages from the address space of the user process to an area where the
> kernel can access the data directly?
>
The kernel can see all of the user address space already, assuming that
it's operating in the same process context as the user application (i.e.
you haven't defered the ioctl call to a kthread, which is not normally
the case). Mapping isn't the problem.
Scott
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
- Previous message: Scott Long: "Re: how to use the function copyout()"
- In reply to: Giorgos Keramidas: "Re: how to use the function copyout()"
- Next in thread: Matthew N. Dodd: "RE: how to use the function copyout()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: Sleeping thread not receive signal until it wakes up
... of the thread will keep calling IOCTL to get information from the ... kernel
and will be blocked if there is no new information. ... and register a SIGALRM handler
in the thread by using sigaction. ... the ISR routine when interrupt happens, ...
(Linux-Kernel) - Re: Sleeping thread not receive signal until it wakes up
... >>> of the thread will keep calling IOCTL to get information from the ...
>>> kernel and will be blocked if there is no new information. ... >>>
and register a SIGALRM handler in the thread by using sigaction. ... (Linux-Kernel) - Re: Sleeping thread not receive signal until it wakes up
... of the thread will keep calling IOCTL to get information from the ... kernel
and will be blocked if there is no new information. ... and register a SIGALRM handler
in the thread by using sigaction. ... (Linux-Kernel) - ioctls, etc. (was Re: [PATCH 1/4] sas: add flag for locally attached PHYs)
... > no-new IOCTL policy certainly came as a surprise to the authors. ... operation"
interface. ... a block driver is nothing but a message queue. ... kernel
now for generic event delivery. ... (Linux-Kernel) - Re: Sleeping thread not receive signal until it wakes up
... >> Anything kernel configuration I need to be aware of to enable ... ioctl
code is called with interrupts enabled. ... the likes CONFIG flag in my config
file. ... (Linux-Kernel)