Seek() Syscall & Tests | 32 Bit OS Dev (in C)
Channel: Queso Fuego
Date: 2023-02-03

Adding a seek() syscall and a basic test runner command to the kernel.
Notes:
- off_t and off64_t are both signed, so int32_t (or int64_t) should be a decent analogue.
- More test functions/cases should be added of course, only have the bare minimum currently. For example, something to check for memory leaks would be good, probably by checking the before/after values of free or used blocks from the physical memory manager. Have the starting value at the top of a function and the ending value as another check at the bottom: if (starting_value == ending_value) or similar.
- SEEK_CUR and SEEK_END tests should save the current offset values and compare against those, not arbitrary 0 or other constants for empty files.
- I'll probably only write errors to screen if the functions fail, not write success or checkpoint messages.
- When there's a bunch of stuff written to screen, it scrolls and there is not currently any scrollback, the screen pixels or lines of text are not saved anywhere. That would be good to add sometime.

Next video:
- Adding to the write() syscall for files created by open(), a read() syscall, and testing for stuff if it doesn't take too long.

OS Dev playlist:
https://www.youtube.com/playlist?list=PLT7NbkyNWaqajsw8Xh7SP9KJwjfpP8TNX

Git Repos:
Sourcehut: https://git.sr.ht/~queso_fuego/quesos
Github mirror: https://github.com/queso-fuego/amateuros

Repo state at the start of this video:
git clone -n https://github.com/queso-fuego/amateuros
cd amateuros
git checkout b5817e2a44506af22a36d2fafa30a90027ccddbb

Join the Community Discord: https://discord.gg/yKm4T89QFn

Contact:
email: fuegoqueso@gmail.com
twitter: @Queso_Fuego
twitch: https://www.twitch.tv/queso_fuego

- Let me know if there's anything specific you'd like to see!

Outline:
0:00 changes since last video
7:03 seek() syscall
20:49 add basic testing to kernel
45:22 tests and debugging page fault
55:45 fixes after off-camera debugging, and fix SEEK_CUR
1:00:49 coming up & outro

Questions about setup/software/etc.? 
Check the FAQ: https://queso_fuego.srht.site/about.html

Music credits:
City Life by Artificial.Music | https://soundcloud.com/artificial-music/
Music promoted by https://www.chosic.com/free-music/all/
Creative Commons CC BY 3.0
https://creativecommons.org/licenses/by/3.0/

#seeksyscall #kerneldev #cprogramming