Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!clyde!cbosgd!ihnp4!homxb!houxm!hropus!jgy From: jgy@hropus.UUCP (John Young) Newsgroups: comp.unix.questions Subject: Re: Destroying arguments Message-ID: <1042@hropus.UUCP> Date: Tue, 19-May-87 14:06:39 EDT Article-I.D.: hropus.1042 Posted: Tue May 19 14:06:39 1987 Date-Received: Sat, 23-May-87 13:28:29 EDT References: <292@osupyr.UUCP> <239@polyof.UUCP> <485@bene.UUCP> <6723@mimsy.UUCP> <19131@sun.uucp> Distribution: comp.unix.questions Organization: Bell Labs, Holmdel, NJ Lines: 27 Guy Harris says: > This really isn't a C question at all, it's a UNIX question, so I'll > redirect it where it should have been sent in the first place. > ......... > As do most other versions of "ps". 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. > ...... Not true. It depends on which UNIX your running on your 3B2: a) On a SWAPPING system a 'ps -l' will show you the u.u_comm field which will give you JUST the first argument (normally the program name) of the process. This can not be changed by normal methods from inside the process. 'ps -f' will show you what's really pointed to by argv[0] which can be changed. b) On a PAGING system ONLY the first 40 bytes of arguments are copied into the saftey of the user block (ps may not show you much more than this anyway) so if you want arguments passed to you with some secrecy just put them futher down the line.