Comment

Comment by Someone

Apart from history and standards, what is the reason for having the path to the current directory or even the current directory known to the kernel?

The shell already seems to track it, so presumably, that logic could have been part of the standard library, and get tracked from user-mode.

If the kernel has to track the current directory (e.g. for performance reasons, to make accessing files relative to a particular directory more efficient), wouldn’t just remembering the device ID and inode be easier for the kernel?

Alternatively, there could be kernel calls taking (device, inode) pairs, and the kernel could be completely ignorant of the ‘current directory’ concept.

That can work; except for naming them ‘directory ID’ instead of ‘inode’, that’s what the first Mac OS hierarchical file system did; paths were second-class citizens here.

parent Someone 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton