How swayam0611/xv6-addinglseek works
This is xv6 with an added lseek system call. The principal workflow is a user running trylseek from the shell: the user-facing API enters the syscall dispatch path, which reaches the kernel implementation to adjust an inode-backed file offset. The implementation supports SEEK_SET, SEEK_CUR, and SEEK_END, checks bounds, locks the inode, and rejects pipes. The README documents these relationships and the test workflow; source excerpts do not show the syscall implementation itself, so the graph does not infer lower-level calls beyond those documented.
Main entry points: sysfile.c Seek handler · trylseek.c Seek demo · syscall.c Syscall dispatch · sh.c xv6 shell
Components 11
System call path
- Syscall numbers
syscall.h - Syscall dispatch
syscall.c - Seek handler
sysfile.c - Seek modes
fcntl.h
File storage
- Open file state
file.h - Inode filesystem
fs.c - Block cache
bio.c
Other components
- Shell user
Connections 10
- Shell user → xv6 shell: runs commands
README - xv6 shell → Seek demo: runs demo
README - Seek demo → User API: calls lseek
README - User API → Syscall dispatch: enters syscall
README - Syscall numbers → Syscall dispatch: registers call
README - Syscall dispatch → Seek handler: dispatches lseek
README - Seek handler → Seek modes: uses seek modes
README - Seek handler → Open file state: checks file type
README - Seek handler → Inode filesystem: locks inode
README - Seek demo → Inode filesystem: tests seek results