gnustep-dev
[Top][All Lists]
Advanced

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

Re: NSProcessInfo incompleteness


From: Richard Frith-Macdonald
Subject: Re: NSProcessInfo incompleteness
Date: Mon, 8 Apr 2002 16:17:03 +0100

On Monday, April 8, 2002, at 02:05 PM, Nicola Pero wrote:


And once again ...

Just found out that

- (unsigned int)operatingSystem;
- (NSString *)operatingSystemName;

are missing from NSProcessInfo. I'm not sure if they're part of the
OPENSTEP spec, but they are part of OS X Server 1.x and OS X 10.0.x.
While I never found the first method usable at all, the second is usable
by socket servers that like to give away some info of the host system.
IMO the latter could be implemented as easy as this:

- (NSString *)operatingSystemName;
{
        NSString *env = [[NSProcessInfo processInfo] environment];
        NSString *str = [env objectForKey: @"GNUSTEP_HOST_CPU"];
        return str;
}

Probably with better error checking, although it'd be interesting what
should be assumed as default if this info can't be found during
runtime ... hm.

GNUSTEP_HOST_CPU would give 'ix86' ; I think if environment variables are
to be used, GNUSTEP_HOST_OS (which would give 'linux-gnu') would be a
better choice.

But likely it would be better to get the information from a /proc
filesystem (if avaialable), or failing that, from uname, and failing that
from some other os function/method/program, and only when all else is
failing I would use shell env variables.

I'm not sure how much information the operationSystemName should return,
or in which format - I would return something like 'Linux', 'Windows',
'Solaris' but I've not read the doc nor compared with what other systems
return.

The documentation doesn't say (as usual).
Anyway, I've implemented it using [NSBundle +_gnustep_host_os] as a quick
solution (I'll commit soon). I think ideally you are right, and the system
should examine /proc and use other heuristics at runtime - but it's just
too much work for too little gain.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]