Kyle McDonald wrote:
> Juergen Keil wrote:
> > Can you try "ls -lR / | truss more" ? What kind of error
> > does it get (when it tries to read from stderr fd#2) ?
> >
> Looks like EBADF:
>
> # ls -lR / | truss more
...
> write(2, "07", 1) = 1
> read(2, 0x08047AF0, 1) Err#9 EBADF
> ioctl(2, TCSETAF, 0x080669C6) = 0
> write(2, "\n", 1) = 1
> _exit(0)
Yep, and combined with the pfiles output for the shell this
confirms that stderr is open in write-only mode.
> > You may also want to check the shell's filedescriptor flags
> > with "pfiles $$". And in case stderr isn't opened O_RDWR check
> > the process tree with "ptree $$" and use "pfiles {pid}" on the
> > parents to find out where the readability of stderr is lost.
> >
> Looks like svc.startd:
> # pfiles $$
> 457: /sbin/sh
> Current rlimit: 256 file descriptors
> 0: S_IFCHR mode:0620 dev:284,0 ino:4 uid:0 gid:7 rdev:0,0
> O_RDONLY|O_LARGEFILE
> /devices/pseudo/[EMAIL PROTECTED]:console
> 1: S_IFCHR mode:0620 dev:284,0 ino:4 uid:0 gid:7 rdev:0,0
> O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
> /devices/pseudo/[EMAIL PROTECTED]:console
> 2: S_IFCHR mode:0620 dev:284,0 ino:4 uid:0 gid:7 rdev:0,0
> O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
> /devices/pseudo/[EMAIL PROTECTED]:console
Most likely the console was re-opened as stdin/out/err
when svc.startd has forked and exec'ed that /bin/sh.
I see similar things in the process tree that is started when
choosing "6. Single user shell" from the initial menu. In this
case it is the service "svc:/system/install-discovery:default"
(according to "svcs -x" / "svcs -a") that is "starting" the process
tree:
7 /lib/svc/bin/svc.startd
10 /sbin/sh /sbin/install-discovery
69 /sbin/sh /sbin/install-discovery
80 /bin/sh /sbin/sulogin
...
Process 10 has it's stderr open on the console in O_WRONLY mode.
And a "svcprop svc:/system/install-discovery:default"
(or "svcprop install-discovery") reveals this start/exec property:
/sbin/install-discovery < /dev/console > /dev/console 2>&1
Maybe you find a similar start/exec property for the service
that has started your /sbin/sh process / pid 457.
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
[email protected]