[Mono-list] Change mono process name in ps/top

Robert Jordan robertj at gmx.net
Sun Jan 24 10:55:33 EST 2010


On 24.01.2010 16:08, Bryan Murphy wrote:
> On Sat, Jan 23, 2010 at 3:41 PM, Michael Hutchinson<
> m.j.hutchinson at gmail.com>  wrote:
>
>> For setting the name that ps uses you can use the -a argument to exec.
>> Some older systems may not support this, such as MacOS 10.4, but we do
>> it in MonoDevelop and haven't seen any problems reported with Linuxes.
>>
>> exec -a processname mono your.exe
>>
>> You need to use both tricks to make sure the name shows up everywhere.
>>
>
> I tried Robert's suggestion, however, because it doesn't work under ps it's
> not as useful as I would like it to be.  At the end of the day, I'm trying
> to accomplish something like what postgres does:
>
> ps aux | grep postgres
>
> postgres: IDLE
> postgres: SELECT
> postgres: INSERT
>
> etc.
>
> where I can get a quick idea what the process is doing without having to dig
> around a bunch of log files.  It's clearly possible, other applications do
> it.

Yes, native applications with access to main's argv[0] can achieve
it easily under Linux, but managed apps simply cannot access this
location. There is also no way that I know of to get a ptr to
this memory location from a native library, so p/invoke won't
help either.

You may want to file an enhancement request with Mono's bugzilla
stating that you wish a facility for *dynamically* changing
the process name.

Robert.



More information about the Mono-list mailing list