diff options
author | jshalf <jshalf@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2007-10-26 00:37:11 +0000 |
---|---|---|
committer | jshalf <jshalf@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2007-10-26 00:37:11 +0000 |
commit | 9b7dad6ad0d13f50a69f54225456171b5017bde5 (patch) | |
tree | 2006123784a4cac8e163f6e93e535f1cf9413ab5 /src/util | |
parent | 95ce88d27a9b486bccd5362bd93955e4c58f46a7 (diff) |
Fixing Network.c for Cray XT4 Compute Node Linux Compatibility.
Network.c uses gethostbyname() which is available on the front-end
nodes of the XT4, but not available on Compute Node Linux back-end
nodes. The code will link fine with gethostbyname(), but will resolve
to the dynamically shared library version of glibc. Since the Compute
nodes do not understand dynamically linked libraries (only static linking),
then it causes a fatal runtime error if gethostbyname() is invoked even
though the compiler will not provide any warning that something bad
will occur.
Therefore, if you #define CRAY_XT, it will disable the gethostbyname() so as
to prevent a fatal runtime error when GetHostName is called.
Need to find out a way to recognize Cray XT4/Compute-node-Linux systems
automatically. The front-end of the XT4 looks exactly like a Linux cluster.
(uname returns "Linux"). Perhaps add a test to the Linux cluster known
architectures file that points it to a XT4_CNL known-architetures file.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4434 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/Network.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util/Network.c b/src/util/Network.c index 3cf3ed51..27c3b43c 100644 --- a/src/util/Network.c +++ b/src/util/Network.c @@ -81,15 +81,17 @@ void Util_GetHostName (char *name, int length) if (! strchr (name, '.')) { #ifdef HAVE_GETHOSTBYNAME - struct hostent *thishostent; - + struct hostent *thishostent=0; +#ifndef CRAY_XT thishostent = gethostbyname (name); +#endif if (thishostent) { strncpy (name, thishostent->h_name, length); name[length - 1] = 0; } + else name[0]='\0'; #endif } } |