I also noticed similar constructs inside the stat() calls, to translate
device major/minor numbers. As you can see, some stat() routines call
translate_path_major_minor_at() after performing the regular stat()
operation. The translate_path_major_minor_at() is implemented by calling
kern_openat(). This has three disadvantages:
- It is non-atomic.
- It can only perform the translation on nodes it has O_RDONLY access
to. This shouldn't be a big problem, but may cause inconsistencies
when users look around in devfs.
- The translation may not always work when the calling process is out of
- Opening a device node can have side effects, such as rewinding tapes,
raising DTR on serial lines, triggering errors, or denying access to other
consumers due to exclusive access requirements.
Robert N M Watson
University of Cambridge