Question
· Nov 10, 2016

What the Cache class to find the NodeName

Hi,

I have a requirement to convert uname -n (Unix comamnd) with its equivalent Cache class. Can anyone help on this please

Thanks & Regards,

Sadagopan TS

Discussion (7)1
Log in or sign up to continue

Hi On further checking, i am able to found the below C code to get the %ZNODENAME. Is there any equivalent Cache class to get this. Ideally, uname -n is the unix command, for which equivalent Cache class is required

#include <sys/utsname.h>

int get_nodename(STRING)
char *STRING;
{
        struct utsname name;

        uname(&name);
        strcpy(STRING, name.nodename);
        return(0);
}

uname -n is generally documented as returning a network host name but systems can be configured with multiple networks and it is not defined exactly what uname -n means at that point. 

The methods above, the $SYSTEM variable,  ##class(%SYS.System).GetNodeName(1) and  $System.INetInfo.LocalHostName() all return the network host name which will match uname -n if there is only one network host name on the system. $SYSTEM.InetInfo has additional methods which can be used if there is more than one host name associated with a given system.

Note that the $SYSTEM variable is loaded at system startup and can be overridden with a fixed name as part of the Cache' configuration so on some systems it may differ than what the other methods will return.