Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!oliveb!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: Destroying arguments Message-ID: <19364@sun.uucp> Date: Wed, 20-May-87 17:15:51 EDT Article-I.D.: sun.19364 Posted: Wed May 20 17:15:51 1987 Date-Received: Sat, 23-May-87 07:58:33 EDT References: <292@osupyr.UUCP> <239@polyof.UUCP> <485@bene.UUCP> <6723@mimsy.UUCP> <1717@ttrdc.UUCP> Sender: news@sun.uucp Distribution: comp.unix.questions Lines: 43 > > The 3B2 version of "ps" does it > > differently; the kernel stashes a string away in the U area that > > contains the original arguments used to invoke the program. (I have > > no idea whether this was done because somebody thought this was the > > right way to do things, or because they couldn't figure out how to > > snarf the arguments up on a machine whose stack grows upward in > > memory....) On this machine, you *can't* smash your argument list. > > Period. > > This may well be true on some machines and implementations, but don't > unjustly blacken the 3B2, please. I tried this code on a 3B2/400 > running System V Release 2.0.4 swapping: > > (Could someone please try this on SVR3 3B2 and tell me if it works the > same way?) I just did. It doesn't work the same way. If I do $ ./stomp_argv the "ps" it runs says that a program named "./stomp_argv" is running (and no, it is not picking up "u.u_comm"; if it were, it would have said "[ stomp_argv ]", not "./stomp_argv"). In other words, on a 3B2 running S5R3, you can't hide your argument list from "ps"; my assertions stand. Maybe the swapping release didn't have this hack to stuff the argument list into the U area - there is a comment in the S5R3 "ps" that says /* no u_psargs on 3b5, look in user stack */ and I'm not certain the 3B5 had a paging release, so this may be the case. One is tempted to ask, however, what is so difficult about this? The code to snarf this stuff from the user area has #if vax || u3b || u3b2 around it. It is certainly not impossible to get the argument list from the process' stack on a paging VAX. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com