kernel - Fix /dev/fd/N and clean up the old dup error-code-driven path
* When opening /dev/fd/N, replicate the file pointer for descriptors
that represent vnodes instead of dup()ing. This ensures that the seek
offset and other fp-related elements are not shared unexpectedly.
* Refactor the open() path to allow dev_dopen() to replace the
struct file by passing a struct file ** instead of a struct file *.
This removes old error-code-based hacks.
* This fixes the shared seek position that fexecve() was operating with
due to its use of /dev/fd/N for scripts.
Reported-by: aly
24 files changed: