Hallo Denys!
> Newer bash seems to use /proc/PID/fd/NNN. Need to investigate hot it does 
> that.
That don't need to be investigated and isn't difficult to do:

- use open() or creat() to create a file or maybe pipe()/fork() to run a
child process
- in case a file is created temporarily do an unlink() while still
holding the file open
- use sprintf( "/proc/%u/fd/%d", getpid(), your_open_fd )

That's it. The file still exists on file system until all references to
it's file descriptor got closed and is automatically removed afterwards.
Also a well known practice (without that /proc/... stuff) handling
temporary files under Unix without having the risk that unused files get
not removed after termination of the process (even if killed
unexpectedly / unhandled). ... additionally it keeps foreign eyes from
tweaking at temporary file contents. If you do the unlink right after
creat or open the chance that any other process can open and access the
file is extremely low.

--
Harald

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to