(if i'm off topic or should look elsewhere i apologize - couldn't find
information anywhere)
I am coding a kernel module and implementing a file's operations, the
read operation received an loff_t *offset parameter, why is this a
pointer? is it in userspace?
On 04/26/2011 01:58 PM, Amit Ben Shahar wrote:
> (if i'm off topic or should look elsewhere i apologize - couldn't find
> information anywhere)
> I am coding a kernel module and implementing a file's operations, the
> read operation received an loff_t *offset parameter, why is this a
> pointer?
Because you are responsible for changing it appropriately.
> is it in userspace?
Nope, in kernelspace.
I think this is described in LDD3, isn't it?
regards,
--
js
On Tuesday 26 April 2011, Amit Ben Shahar wrote:
> (if i'm off topic or should look elsewhere i apologize - couldn't find
> information anywhere)
> I am coding a kernel module and implementing a file's operations, the
> read operation received an loff_t *offset parameter, why is this a
> pointer? is it in userspace?
The read function must update the offset independent of the return value.
See simple_read_from_buffer() as an example.
Arnd
> The read function must update the offset independent of the return value.
> See simple_read_from_buffer() as an example.
Thank you - that helped greatly and solved my problem.
Amit.