On Tue, Apr 03, 2012 at 04:03:14AM +0200, [email protected] wrote: > Ok, I know, reading the link needs access to proc filesystem but which > Linux system do not enable that access in it's early boot stage? And > if proc is really not available (in the early boot process) the > call to ttyname may just fail with an error which let tty complain with > "not a tty". At that time you usually know your tty (/dev/console) and > the test "[ -t 0 ]" still works right. IMHO a good case how to save > time and space in uClibc. May be with a configurable option if readlink > is used or the scan loop, with a Linux default of readlink.
Perhaps a more robust solution would be to do this: 1. Try /proc if it works. 2. Fallback to fstat() to read the major/minor number for stdin, and use that to construct a candidate pathname based on standard naming rules. stat() the pathname, and if they match, use it. 3. Finally (optional; personally I would omit this step because it's bloated and ugly) scan /dev for a matching device. Rich _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
