Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

The llseek method

The llseek function is called when you move the cursor position within a file. The entry point of this method in user space is lseek(). You can refer to the man page in order to print the full description of either method from user space: man llseek and man lseek. Its prototype looks as follows:

loff_t(*llseek) (struct file *filp, loff_t offset, int whence); 

The preceding command is explained as following:

  • The return value is the new position in the file.
  • loff_t is an offset, relative to the current file position, which defines how much it will be changed.
  • whence defines where to seek from. Possible values are:
    • SEEK_SET: This puts the cursor into a position relative to the beginning of the file
    • SEEK_CUR: This puts the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content