Полезная информация

next up previous contents
Next: The read() and write() Up: The VFS Previous: The VFS

The lseek() function

This function is called when the system call lseek() is called on the device special file representing your device. An understanding of what the system call lseek() does should be sufficient to explain this function, which moves to the desired offset. It takes these four arguments:

dispitems300

lseek() returns -errno on error, or tex2html_wrap_inline2856 0 the absolute position after the lseek.

If there is no lseek(), the kernel will take the default action, which is to modify the file->f_pos element. For an origin of 2, the default action is to return -EINVAL if file->f_inode is NULL, otherwise it sets file->f_pos to file->f_inode->i_size + offset. Because of this, if lseek() should return an error for your device, you must write an lseek() function which returns that error.



Converted on:
Mon Apr 1 10:20:16 EST 1996