The kernel and character set encodings
Posted Feb 20, 2004 22:32 UTC (Fri) by spitzak
In reply to: The kernel and character set encodings
Parent article: The kernel and character set encodings
I agree that a length is needed, not just for encoding NUL, but to allow
a slash-seperated name to be quickly converted to this form, without a
need to malloc and copy a block of memory for each piece.
One possibly less-ugly scheme is to use Plan9's "walk" style. You have
"file descriptors" that represent a filename, unopened as yet. These are
created by copying an
existing one (a small set, such as one for "/", are provided when the
program starts up, like stdin/out). There is then a call something like
walk(fd,char* name,int length) which moves fd to the subdirectory in
name[0..length-1]. When you finally are at the desired file you call
open(fd,mode). Existing open() calls would be turned into a bunch of walk
calls followed by a new open.
With this, no arrays are passed to the kernel, and it does not have to
store these arrays.
to post comments)