ps problem (update on my previous posting)

Jim Shankland jas at rtech.ARPA
Tue Feb 5 09:54:55 AEST 1985


> > ... ps(1) looks at stderr to figure out what the "controlling
> > terminal" is.
> > Gordon A. Moffett		...!{ihnp4,hplabs,sun}!amdahl!gam
> 
> If this is true, it seems like a horrible hack to me.  Surely ps could
> get its notion of the controlling terminal from the proc table entry
> for the ps process itself (it is, after all, already rooting around
> in the proc table)?  The notion of a controlling terminal is an attribute
> of a process, and need not have any connection with what files that
> process has open.
> 
> Anybody know whether (1) Gordon is wrong; (2) Gordon is right, and I'm
> right, so ps is just ugly; or (3) I've missed something?

Rather than just asking, I thought I'd check, myself.  First, a minor
inaccuracy in my above posting:  the control terminal information is
stored in a process's u area, not in the proc table.  However, ps
looks in the u area of every process it displays, anyway.  Second, ps
by default does indeed display all processes whose control terminal
is the same as file descriptor 2 (a.k.a. stderr).  For the reasons
given above, this strikes me as stupid.  By the way, the source for ps
would gag a goat.

Also, none of this applies to the Berklix ps's.

Jim Shankland
..!ucbvax!mtxinu!jas



More information about the Comp.unix.wizards mailing list