in reply to How do I change my program's name under ps? ($0='abc' is messed up)

This is because when the process is created, the first argument is allocated to be the size of the actual process name. Try appending a \0 to your fake process name.
  • Comment on Re: How do I change my program's name under ps? ($0='abc' is messed up)

Replies are listed 'Best First'.
Re: Re: How do I change my program's name under ps? ($0='abc' is messed up)
by entropy (Sexton) on May 30, 2001 at 00:56 UTC
    \0 doesn't help on linux... On FreeBSD it seems to work with or without the \0 (in addition to displaying the original process name).

    If the memory is pre-allocated, then do I have to worry about overflowing it?

      Nope, you don't have to worry about overflowing it in Perl. You do however, when dealing with argv[0] in C, etc.