gnustep-dev
[Top][All Lists]
Advanced

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

Re: NSProcessInfo incompleteness


From: Nicola Pero
Subject: Re: NSProcessInfo incompleteness
Date: Mon, 8 Apr 2002 14:05:48 +0100 (BST)

> 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.




reply via email to

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