Path: utzoo!telly!attcan!uunet!mtndew!friedl From: friedl@mtndew.UUCP (Stephen J. Friedl) Newsgroups: comp.unix.wizards Subject: Re: changing cmd listing for ps -f Keywords: ps command fork Message-ID: <462@mtndew.UUCP> Date: 5 Jul 90 04:35:40 GMT References: <8259@b11.ingr.com> <1990Jul3.093553.3085@ericsson.se> <1793@necisa.ho.necisa.oz> Distribution: comp Organization: VSI*FAX Tech Center Lines: 31 In article <1793@necisa.ho.necisa.oz>, boyd@necisa.ho.necisa.oz (Boyd Roberts) writes: > Nothing you do on System V will change the command name/argument list > that ps prints. Both the command name and some of the `arguments' are > stored in the U area and are not modifiable by any `reliable' method. The industrious can find an unreliable but fun method. At the start of your program, make a pipe. Write all your real args down the pipe and then modify the arg list to taste but with some magic word as argv[0] so the program knows that it's on the second round. I usually use the empty string. Then close the write half of the pipe and exec yourself (finding your own name could be hard). On the second round you look for the magic token in argv[0]. If found, open /dev/null and then close it again: the read pipe will be one less than the descriptor returned. Read all your args from it and stick them back in whatever argv you want to work with, close the pipe, and continue. Now ps will show the arglist you want. Yes, it is an unreliable hack but I felt kind of clever when I thought of it :-) Steve -- Stephen J. Friedl, KA8CMY / Software Consultant / Tustin, CA / 3B2-kind-of-guy +1 714 544 6561 / friedl@mtndew.Tustin.CA.US / {uunet,attmail}!mtndew!friedl "Show me a good loser and I'll show you a loser" - Roger Penske