Close() Syscall | 32 Bit OS Dev (in C)
Adding a close() syscall to clear file table and inode table entries for files opened by open().
Errata:
- close() does not free the memory allocated for a file from open(), causing a memory leak! D'oh. This is fixed at the start of the next video. I also need to think through logic for handing O_RDONLY/O_WRONLY/O_RDWR in read() & write() later on.
Next video:
- Seek() syscall and basic tests
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 1bf04d9f7df879bb65cf9bf6c0a5de92979b5e3d
Join the Community Discord: https://discord.gg/yKm4T89QFn
Notes/Thoughts:
- While I'm not too picky on the recording & programming time for these videos, a maximum time of 1 or 1.5 hrs should have benefits: faster editing and uploading, especially at 4K file sizes; a more consistent upload schedule; a more focused effort, trying for only 1-3 things or ideas per video; not wasting people's time as much as I have been; and more motivation and energy to make content.
I want to get meaningful progress done on more than 1 project, and not have 100s or 1000s of videos of barely making anything and taking forever to do anything substantial. I'll try to strike a middle-ground and get 1-3 working "deliverables" per video e.g. 1 syscall with a test, a ppm viewer, normal vs insert mode toggle in a text editor, etc. This has the benefit of clearly marking checkpoints/commits in git repos, marking a start/end per feature or video, and easier tracking of progress and output. That's my hope, at least.
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
8:33 close() syscall
25:11 neovim formatoptions/colorcolumn
26:37 close() syscall
31:38 test close()
39:55 add seek() whence values
47:55 wrap 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/
#osdev #close #syscalls