Re: ioctl(), passed structure zeroed

Martin Husemann <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
On Sat, Mar 08, 2025 at 03:07:25PM +0100, Peter Skvarka wrote:
> Hello,
> 
> I call ioctl() containing request code created with _IOR(..., mystruct)
> and kernel module processed it.
> When I create instance of mystruct, fill it's members with some values and I
> pass it's pointer like third parameter to ioctl() then members of structure
> appears zeroed in kernel code.
> 
> Is it correct behavior or am I doing something wrong ?

Yes, _IOR only reads data from the kernel (copies the result structure
out to userland), nothing is copied in from userland to kernel. _IOW
only copies in (userland -> kernel), _IORW does both.

Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.