Customize process name in process list - how?
From: Charles Sullivan (cwsulliv_at_triad.rr.com)
Date: 09/18/04
- Next message: Sam Wormley: "Re: Linuxes are all proprietary."
- Previous message: Rex Ballard: "Linux is the product of Standards - Re: Linuxes are all proprietary."
- Next in thread: Kasper Dupont: "Re: Customize process name in process list - how?"
- Reply: Kasper Dupont: "Re: Customize process name in process list - how?"
- Reply: Charles Sullivan: "Re: Customize process name in process list - THANKS!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 18 Sep 2004 19:45:42 GMT
I have a C program ('myprog') which installs itself as a
background process. It can have varied functions
which are determined by the command line arguments
and other system features when it is executed.
I'd like the name appearing in the process status
table to more clearly reflect its particular function,
e.g., instead of just seeing:
myprog args1 ...
or
myprog args2 ...
I'd like them to be (just making these up):
my_reader
or
my_writer
The (much abbreviated) code fragment I'm using
for loading this process is similar to this:
-------------------------------
shell = "/bin/bash";
environment_ptr = ...
sprintf(buffer, "myprog %s", <argument>);
if ( (status = fork()) == -1 ) {
/* Can't fork */
exit(1);
}
if ( status == 0 ) {
/* Child process */
aargv[0] = shell;
aargv[1] = "-c";
aargv[2] = buffer;
aargv[3] = NULL;
execve(shell, aargv, environment_ptr);
/* Exit if exec failure */
exit(1);
}
/* Parent process */
return 0;
-------------------------------
Question: What do I need to do to change the
name in the process status list ('ps aux') to
say, "my_reader" ?
Regards,
Charles Sullivan
- Next message: Sam Wormley: "Re: Linuxes are all proprietary."
- Previous message: Rex Ballard: "Linux is the product of Standards - Re: Linuxes are all proprietary."
- Next in thread: Kasper Dupont: "Re: Customize process name in process list - how?"
- Reply: Kasper Dupont: "Re: Customize process name in process list - how?"
- Reply: Charles Sullivan: "Re: Customize process name in process list - THANKS!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]