vfs_setpos_cookie(9)
π NAME π
okay so bestie, we're in the Kernel API Manual, and the main character of this page is vfs_setpos_cookie(9). It's giving "update the file offset for lseek and reset cookie" energy, no cap. π¦
β¨ SYNOPSIS β¨
Signature time, and yes you're gonna copy it exactly β types and names are sacred:
loff_t vfs_setpos_cookie (struct file *file , loff_t offset , loff_t
maxsize , u64 *cookie );
π ARGUMENTS π
fileβ thefilestructure in question. literally the file we're working with.offsetβ the file offset to seek to. seek slay.maxsizeβ maximum file size.cookieβ the cookie to reset. not the snack kind, but okay. πͺ
π¦ DESCRIPTION π¦
So here's the vibe: update the file offset to the value specified by offset if the given offset is valid and it is not equal to the current file offset, and reset the specified cookie to indicate that a seek happened. That's the whole assignment, periodt. π
Return the specified offset on success, and return -EINVAL on invalid offset. Iconic, simple, done.
π SEE ALSO π
Kernel file ./fs/read_write.c is the home base, iykyk. Also go look at:
vfs_setpos(9)must_set_pos(9)generic_file_llseek_size(9)generic_llseek_cookie(9)generic_file_llseek(9)fixed_size_llseek(9)no_seek_end_llseek(9)no_seek_end_llseek_size(9)noop_llseek(9)
And that's the page, bestie. The source/version footer is ./fs, dated October 2026, and the title is vfs_setpos_cookie(9). Stay hydrated and may your offsets always be valid πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms