Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Mar 2020 18:39:52 +0100
From:      Jan Bramkamp <crest@rlwinm.de>
To:        freebsd-hackers@freebsd.org
Subject:   Re: How to access a user space file from kernel space in FreeBSD.
Message-ID:  <e537b92b-46a1-1b09-7618-fc582392d363@rlwinm.de>
In-Reply-To: <CAF3txfi1mNcmQEFDfOx01AA2aWza1Fteb7fisC%2BtWVQccoV77Q@mail.gmail.com>
References:  <CAF3txfi1mNcmQEFDfOx01AA2aWza1Fteb7fisC%2BtWVQccoV77Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 20.03.20 15:40, Arpan Palit wrote:
> Hi all,
>
> I am working on (kernel)driver ioctl implementation for file read/write,
> where I need to know what are API's which can expose to read,write and
> close user space file from kernel space. In general I need to know the
> answer for the below questions.
>
> i).   How to open a user space file from driver(kernel space) ?
> ii).  How to create a new user space file from driver(kernel space) ?
> iii). How to get file parameters like size of the file ?
> iv). How to read/write the files from the driver(kernel space) ?

What you ask can be done inside the kernel, but it doesn't sound like a 
good design choice for a device driver. I suspect there are better ways 
for a (device) driver to to interact with the rest of the system. If you 
want to write a device driver I would recommend that you to backtrack 
and describe what problem you want solve instead of how you attempted to 
solve it. Should you want to learn about corner cases in the kernel 
that's fine too.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e537b92b-46a1-1b09-7618-fc582392d363>