Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site mips.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!decwrl!Glacier!mips!mash From: mash@mips.UUCP (John Mashey) Newsgroups: net.unix Subject: Re: Setting variables for a running process Message-ID: <139@mips.UUCP> Date: Thu, 23-May-85 03:44:46 EDT Article-I.D.: mips.139 Posted: Thu May 23 03:44:46 1985 Date-Received: Sat, 25-May-85 05:27:42 EDT References: <10893@brl-tgr.ARPA> Organization: MIPS Computer Systems, Mountain View, CA Lines: 45 William Martin writes: > Is there any way I can change my terminal type (setting the TERM variable) > while I am inside some other process? .... No, and it was on purpose. The environment was specifically designed 1) to be mostly the business of user pgms and not the OS 2) to have the same sort of inheritance semantics as everything else inherited by a child. On any UNIX, programs that want to access global state may easily do so by agreeing on a file name that contains that state, and agreeing on a signal to alert another process to look at the file. Environment variables are nothing but implicitly-passed arguments with usage agreed by programs. At one point in the design of the environment, it was contemplated that the environment be a set of global read-write variables, that lived in a new magic entity inside the kernel. This was a Wrong Thing, for 2 fundamental reasons: 1) This new magic entity could not reasonably be associated with any existing entity in the system. For example, should be owned by a uid? No, because you might be logged in twice. Did it belong to a process? No, because it would be acccessed by more than 1, or would be useless. DId it belong to a process group? This didn't make sense either. If some processes have one of these things, what happens when you fire something up in the background? Does it get its own, or not? 2) Environment variables would suddenly have indeterminate values, because their modfication sequence was now dependent on process scheduling. For example, if x were truly global, what result ought to be printed below? x=10; (x=20)& echo $x Nevertheless, the original request does illustrate a semantic discontinuity that has arisen over time. $TERM was invented originally because it was becoming obvious that even the simplest functions (like setting tabs) were terminal-dependent, and that as terminals kept getting smarter they would only get more different. At the time, people did not want to chew up the space inside the kernel to keep a terminal typename inside each tty structure, and it seemed that we could cover most normal uses of TERM with environment vars. Given all the ways that $TERM is now used, it's no longer clear exactly what it's associativity is. Maybe it (+ other useful attributes, like current window size) should belong to each virtual terminal, which would solve the original problem presented. -- -john mashey UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!mash DDD: 415-960-1200 USPS: MIPS Computer Systems, 1330 Charleston Rd, Mtn View, CA 94043