News for hackers. Stuff that matters.
Re:Unix Shells and the Current Directory by benou on Sunday November 26, 2023 @03:42PM (#38424835)
My guess is kernel needs to know the current directory of a process so that when said process tries to open a file without an absolute path (eg. just "file.txt" and not "/tmp/file.txt"), it can open "$CWD/file.txt".

This must be tracked by kernel, because not all syscalls go through libc, you can issue the open syscall directly from a process.

There might be other reasons, but I'd bet it's the main one.

There are no comments on this comment yet.