Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!ericom!juno11.ericsson.se!etxtorn From: etxtorn@juno11.ericsson.se (Thomas Tornblom TM/JU 99367) Newsgroups: comp.unix.wizards Subject: Re: changing cmd listing for ps -f Keywords: ps command fork Message-ID: <1990Jul3.093553.3085@ericsson.se> Date: 3 Jul 90 09:35:53 GMT References: <8259@b11.ingr.com> Sender: news@ericsson.se Distribution: comp Organization: Ericsson Telecom AB, Stockholm, Sweden Lines: 24 In article <8259@b11.ingr.com> kiick@b11.ingr.com (chris kiick) writes: >How can I change the command name that ps -f lists from within > a program? What I'm trying to do is to fork off a process that will > look different to a person doing a ps -f. Changing argv doesn't > seem to do it. Any Ideas? > >thanks. > >*********************************************************** > Chris J. Kiick | work phone: (205) 730-6171 > Programmer at Large | Email: ingr!b11!marvin!kiick > "Ideas for sale, Cheap!" | > >*********************************************************** I guess you're running system V of some flavor. System V:s ps has some sanity checking built in that wont let you just change the argv pointers. The pointers are checked so that they don't point "too low" in memory. One way of circumventing this is to copy the strings in place (strcpy), not just changing the pointers. This can be a bit tricky though as you have to check so that you don't run off the old strings. Thomas