SetProcessName



I just recently installed a new version of f-spot and I found to my dismay
that the following error appears when I try to run it:

Unhandled Exception: System.ApplicationException: Error setting process name: 0
in <0x0008a> FSpot.Driver:SetProcessName (System.String name)
in <0x00090> FSpot.Driver:Main (System.String[] args)

I think this is because I'm using a kind of old kernel version, but shouldn't
it be a little more graceful about this error?

public static void SetProcessName(string name)
{
	try {
		if(prctl(15 /* PR_SET_NAME */, name,
			0, 0, 0) != 0) {
			throw new ApplicationException("Error setting process name: " +
			Mono.Unix.Native.Stdlib.GetLastError());
		}
	} catch (DllNotFoundException de) {
		/* noop */
	}
}

As far as I know, PR_SET_NAME was added at some point after 2.6.5 (which
I am presently using... don't ask why :-)).

-- 
Tim Coleman <tim timcoleman com>                       [43.43 N 80.45 W]
BMath, Honours Combinatorics and Optimization, University of Waterloo
Software Developer, Global Services, Open Text Corporation
"Under capitalism, man exploits man.  Under communism, it's just the
 opposite." -- J.K. Galbraith



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]