Up

NSProcessInfo class reference

Authors

Georg Tuparev (Tuparev@EMBL-Heidelberg.de)
Richard Frith-Macdonald (rfm@gnu.org)

Version: 38120

Date: 2014-10-17 07:42:34 -0600 (Fri, 17 Oct 2014)

Copyright: (C) 1995-2014 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the NSProcessInfo class
  2. Software documentation for the NSProcessInfo(GNUstep) category

Software documentation for the NSProcessInfo class

NSProcessInfo : NSObject

Declared in:
Foundation/NSProcessInfo.h
Availability: OpenStep

Instances of this class encapsulate information on the current process. For example, you can get the arguments, environment variables, host name, or process name. There is only one instance per process, for obvious reasons, and it may be obtained through the +processInfo method.
Method summary

processInfo 

+ (NSProcessInfo*) processInfo;
Availability: OpenStep

Returns the shared NSProcessInfo object for the current process.

activeProcessorCount 

- (NSUInteger) activeProcessorCount;
Availability: MacOS-X 10.5.0

Not implemented

arguments 

- (NSArray*) arguments;
Availability: OpenStep

Returns an array containing the arguments supplied to start this process.
NB. In GNUstep, any arguments of the form --GNU-Debug=... are not included in this array... they are part of the debug mechanism, and are hidden so that setting debug variables will not effect the normal operation of the program.
Please note, the special --GNU-Debug=... syntax differs from that which is used to specify values for the NSUserDefaults system.
User defaults are set on the command line by specifying the default name (with a leading hyphen) as one argument, and the default value as the following argument. The arguments used to set user defaults are present in the array returned by this method.

environment 

- (NSDictionary*) environment;
Availability: OpenStep

Returns a dictionary giving the environment variables which were provided for the process to use.

globallyUniqueString 

- (NSString*) globallyUniqueString;
Availability: OpenStep

Returns a string which may be used as a globally unique identifier.
The string contains the host name, the process ID, a timestamp and a counter.
The first three values identify the process in which the string is generated, while the fourth ensures that multiple strings generated within the same process are unique.

hostName 

- (NSString*) hostName;
Availability: OpenStep

Returns the name of the machine on which this process is running.

operatingSystem 

- (NSUInteger) operatingSystem;
Availability: MacOS-X 10.0.0

Return a number representing the operating system type.
The known types are listed in the header file, but not all of the listed types are actually implemented... some are present for MacOS-X compatibility only.
  • NSWindowsNTOperatingSystem - used for Windows NT, and later
  • NSWindows95OperatingSystem - probably never to be implemented
  • NSSolarisOperatingSystem - used for Sun Solaris
  • NSHPUXOperatingSystem - used for HP/UX
  • NSMACHOperatingSystem - MacOSX and perhaps Hurd in future?
  • NSSunOSOperatingSystem - Used for Sun Sun/OS
  • NSOSF1OperatingSystem - Used for OSF/1 (probably obsolete)
  • GSGNULinuxOperatingSystem - the GNUstep 'standard'
  • GSBSDOperatingSystem - BSD derived operating systems
  • GSBeperatingSystem - Used for Be-OS (probably obsolete)
  • GSCygwinOperatingSystem - cygwin unix-like environment

operatingSystemName 

- (NSString*) operatingSystemName;
Availability: MacOS-X 10.0.0

Return a human readable string representing the operating system type.
The supported types are -
  • NSWindowsNTOperatingSystem - used for Windows NT, and later
  • NSWindows95OperatingSystem - probably never to be implemented
  • NSSolarisOperatingSystem - used for Sun Solaris
  • NSHPUXOperatingSystem - used for HP/UX
  • NSMACHOperatingSystem - MacOSX and perhaps Hurd in future?
  • NSSunOSOperatingSystem - Used for Sun Sun/OS
  • NSOSF1OperatingSystem - Used for OSF/1 (probably obsolete)
  • GSGNULinuxOperatingSystem - the GNUstep 'standard'
  • GSBSDOperatingSystem - BSD derived operating systems
  • GSBeperatingSystem - Used for Be-OS (probably obsolete)
  • GSCygwinOperatingSystem - cygwin unix-like environment

operatingSystemVersionString 

- (NSString*) operatingSystemVersionString;
Availability: MacOS-X 10.2.0

Description forthcoming.

physicalMemory 

- (unsigned long long) physicalMemory;
Availability: MacOS-X 10.5.0

Not implemented

processIdentifier 

- (int) processIdentifier;
Availability: MacOS-X 10.0.0

Returns the process identifier number which uniquely identifies this process on this machine.

processName 

- (NSString*) processName;
Availability: OpenStep

Returns the process name for this process. This may have been set using the -setProcessName: method, or may be the default process name (the file name of the binary being executed).

processorCount 

- (NSUInteger) processorCount;
Availability: MacOS-X 10.5.0

Not implemented

setProcessName: 

- (void) setProcessName: (NSString*)newName;
Availability: OpenStep

Change the name of the current process to newName.

Software documentation for the NSProcessInfo(GNUstep) category

NSProcessInfo(GNUstep)

Declared in:
Foundation/NSProcessInfo.h
Availability: Base
Likely to be changed/moved/removed at 1.17.0

Provides GNUstep-specific methods for controlled debug logging (a GNUstep facility) and an internal/developer-related method.
Method summary

initializeWithArguments: count: environment: 

+ (void) initializeWithArguments: (char**)argv count: (int)argc environment: (char**)env;
Availability: Base
Likely to be changed/moved/removed at 1.17.0

Obsolete... the GSInitializeProcess() function has the same effect and can be called more easily from other languages (particularly C).

setLogFile: 

- (BOOL) setLogFile: (NSString*)path;
Availability: Base
Likely to be changed/moved/removed at 1.17.0

Set the file to which NSLog output should be directed.
Returns YES on success, NO on failure.
By default logging goes to standard error.


Up