Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!uwvax!caip!lll-crg!styx!mcb From: mcb@styx.UUCP (Michael C. Berch) Newsgroups: net.unix-wizards,net.unix Subject: Re: externally accessing process environment Message-ID: <20554@styx.UUCP> Date: Tue, 8-Apr-86 19:18:20 EST Article-I.D.: styx.20554 Posted: Tue Apr 8 19:18:20 1986 Date-Received: Thu, 10-Apr-86 07:54:04 EST References: <171@minnie.UUCP> Reply-To: mcb@styx.UUCP (Michael C. Berch) Organization: Lawrence Livermore Laboratory, Livermore CA Lines: 21 Xref: watmath net.unix-wizards:17521 net.unix:7587 Summary: It's possible In article <171@minnie.UUCP> chris@minnie.UUCP (Chris Grevstad) writes: > Running 4.2BSD on an Integrated Solutions 68010 machine. What I would > like to know is if there is some way for a process to examine the > environment of a non-related process. What I want in particular is a > way to determine, from an external process, a terminal's type without > resorting to the possibly inaccurate file /etc/ttytype. > The examining process is running as root. There's undoubtedly a more elegant way to do this, but you can get the entire environment of a process using the 'e' option of ps(1). (i.e., "ps ewwNNNNN" where NNNNN is the process number. The 'ww' is to get the "widest" display so the lengthy string is not truncated. This is known to work on a VAX 780 running 4.2BSD. You can fork off a ps(1) and read the output through a pipe, muck around in the result to find TERM, and you're off to the races! Michael C. Berch Control Data Corp. / Lawrence Livermore Natl. Laboratory ARPA: mcb@lll-tis-b.ARPA UUCP: {ihnp4,dual}!lll-lcc!styx!mcb