We are redefining HOST_NAME_MAX in MonteCarlo.hh

Removed the redefinition.  Included climits and changed HOST_NAME_MAX to _POSIX_HOST_NAME_MAX
which should be defined on the systems we support.

refs #265
This commit is contained in:
Alex Lin 2016-07-06 14:56:05 -05:00
parent 3a7e756926
commit f90a76be6b
4 changed files with 5 additions and 8 deletions

View File

@ -7,16 +7,13 @@
#include <deque>
#include <vector>
#include <climits>
#include "trick/MonteVar.hh"
#include "trick/Executive.hh"
#include "trick/RemoteShell.hh"
#include "trick/tc.h"
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 128
#endif
namespace Trick {
/**

View File

@ -22,8 +22,8 @@ Trick::MonteCarlo::MonteCarlo() :
slaves_head = NULL;
char hostname[HOST_NAME_MAX + 1];
gethostname(hostname, HOST_NAME_MAX);
char hostname[_POSIX_HOST_NAME_MAX + 1];
gethostname(hostname, _POSIX_HOST_NAME_MAX);
machine_name = hostname;
memset(&listen_device, 0, sizeof(TCDevice)) ;

View File

@ -131,7 +131,7 @@ void Trick::MonteCarlo::read_slave_port(Trick::MonteSlave *curr_slave) {
void Trick::MonteCarlo::read_machine_name(Trick::MonteSlave *curr_slave) {
int num_bytes;
char slave_name[HOST_NAME_MAX];
char slave_name[_POSIX_HOST_NAME_MAX];
tc_read(&connection_device, (char *)&num_bytes, (int)sizeof(num_bytes));
num_bytes = ntohl(num_bytes) ;

View File

@ -51,7 +51,7 @@ int Trick::MonteCarlo::slave_init() {
int id = htonl(slave_id);
tc_write(&connection_device, (char *)&id, (int)sizeof(id));
char hostname[HOST_NAME_MAX];
char hostname[_POSIX_HOST_NAME_MAX];
gethostname(hostname, sizeof(hostname)-1);
int num_bytes = htonl(strlen(hostname));