changing cmd listing for ps -f

Thomas Tornblom TM/JU 99367 etxtorn at juno11.ericsson.se
Tue Jul 3 19:35:53 AEST 1990


In article <8259 at b11.ingr.com> kiick at 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



More information about the Comp.unix.wizards mailing list