Fix for compiling with x86_64 systems and fix for -O2 optimiztions issues in server client communication.

git-svn-id: svn://opensvn.adaptivecomputing.com/maui/trunk@108 3f5042e3-fb1d-0410-be18-d6ca2573e517
This commit is contained in:
bchristiansen 2008-12-09 20:54:30 +00:00
parent 788393f8ac
commit 9cbaa08be7
13 changed files with 64 additions and 47 deletions

View File

@ -1,5 +1,7 @@
Maui 3.2.6p21
- Fixed CHECKSUM authentication for maui + slurm. Thanks goes to Eyegene Ryabinkin.
- Fixed 64bit issue. Maui assumed ints were always 8 bytes for 64bit systems even though x86_64 ints are still 4 bytes. This lead to aliasing of large indexed node properties to smaller indexed properties. Maui now triggers off of sizeof(int). Thanks goes to Alexis Cousein.
- Fixed an optimiztion issue with x86_64 systems. -O2 was optimizing out parts of the communication strings.
Maui 3.2.6p20
- Fixed a potential security issue when Maui is used with some PBS configurations.

View File

@ -453,6 +453,7 @@ void MSysShutdown(int);
int MSysDestroyObjects(void);
int MSysDiagnose(char *,int,long);
int MSysStartServer(int);
int M64Init(m64_t *);

View File

@ -125,6 +125,7 @@ enum MActivePolicyTypeEnum {
#define M32UINT4 unsigned long
#define M32UINT8 unsigned long long
/* ints on x86_64 are still 4 bytes */
#ifdef __M64
#define MINTBITS 64
#define MINTLBITS 6

View File

@ -1303,9 +1303,11 @@ int MSUSendData(
if (DoSocketLayerAuth == TRUE)
{
char tmpStr[MMAX_BUFFER];
time(&Now);
sprintf(TSLine,"%s%ld %s%s",
sprintf(tmpStr,"%s%ld %s%s",
MCKeyword[mckTimeStamp],
(long)Now,
MCKeyword[mckAuth],
@ -1320,7 +1322,7 @@ int MSUSendData(
}
sprintf(TSLine,"%s %s",
TSLine,
tmpStr,
MCKeyword[mckData]);
MSecGetChecksum2(

View File

@ -130,7 +130,6 @@ int MSecMD5GetDigest(char *,int,char *,int,char *,int);
#ifndef __M32COMPAT
int M64Init(
@ -143,10 +142,10 @@ int M64Init(
M->Is64 = FALSE;
M->INTBC = M32INTBITS;
M->INTLBC = M32INTLBITS;
M->MIntSize = M32INTSIZE;
M->IntShift = M32INTSHIFT;
M->INTBITS = M32INTBITS;
M->INTLBITS = M32INTLBITS;
M->INTSIZE = M32INTSIZE;
M->INTSHIFT = M32INTSHIFT;
}
else
{
@ -154,10 +153,10 @@ int M64Init(
M->Is64 = TRUE;
M->INTBC = M64INTBITS;
M->INTLBC = M64INTLBITS;
M->MIntSize = M64INTSIZE;
M->IntShift = M64INTSHIFT;
M->INTBITS = M64INTBITS;
M->INTLBITS = M64INTLBITS;
M->INTSIZE = M64INTSIZE;
M->INTSHIFT = M64INTSHIFT;
}
MDB(5,fSTRUCT) MLog("INFO: 64Bit enabled: %s UINT4[%d] UINT8[%d]\n",
@ -168,7 +167,6 @@ int M64Init(
return(SUCCESS);
} /* END M64Init() */
#endif /* !__M32COMPAT */

View File

@ -23,6 +23,7 @@ extern mckpt_t MCP;
extern mrm_t MRM[];
extern mstat_t MStat;
extern mattrlist_t MAList;
extern m64_t M64;
extern const char *MQALType[];
extern const char *MResourceType[];
@ -1252,7 +1253,7 @@ char *MParBMToString(
{
P = &MPar[pindex];
if (!(BM[pindex >> MINTLBITS] & (1 << (pindex % MINTBITS))))
if (!(BM[pindex >> M64.INTLBITS] & (1 << (pindex % M64.INTBITS))))
continue;
if (P->Name[0] == '\0')

View File

@ -17,6 +17,7 @@ extern mgcred_t *MUser[];
extern mgcred_t MGroup[];
extern mgcred_t MAcct[];
extern mclass_t MClass[];
extern m64_t M64;
extern const char *MQOSFlags[];
extern const char *MQALType[];
@ -896,7 +897,7 @@ char *MQOSBMToString(
for (bindex = 0;bindex < MAX_MQOS;bindex++)
{
if (!(BM[bindex >> MINTLBITS] & (1 << (bindex % MINTBITS))))
if (!(BM[bindex >> M64.INTLBITS] & (1 << (bindex % M64.INTBITS))))
continue;
Q = &MQOS[bindex];

View File

@ -19,6 +19,7 @@ extern msys_t MSystem;
extern mframe_t MFrame[];
extern mckpt_t MCP;
extern mres_t *MRes[];
extern m64_t M64;
extern int MAQ[];
extern int MUIQ[];
@ -2256,8 +2257,8 @@ int MJobSelectResourceSet(
for (sindex = 0;sindex < MaxSet;sindex++)
{
if (N->FBM[SetIndex[sindex] >> MINTLBITS] &
(1 << (SetIndex[sindex] % MINTBITS)))
if (N->FBM[SetIndex[sindex] >> M64.INTLBITS] &
(1 << (SetIndex[sindex] % M64.INTBITS)))
{
SetCount[sindex] += TC;
SetNC[sindex] ++;
@ -2422,8 +2423,8 @@ int MJobSelectResourceSet(
{
case mrstFeature:
if (N->FBM[SetIndex[sindex] >> MINTLBITS] &
(1 << (SetIndex[sindex] % MINTBITS)))
if (N->FBM[SetIndex[sindex] >> M64.INTLBITS] &
(1 << (SetIndex[sindex] % M64.INTBITS)))
{
/* node is feasible */
@ -2576,8 +2577,8 @@ int MJobSelectResourceSet(
{
case mrstFeature:
if (N->FBM[SetIndex[BestSet] >> MINTLBITS] &
(1 << (SetIndex[BestSet] % MINTBITS)))
if (N->FBM[SetIndex[BestSet] >> M64.INTLBITS] &
(1 << (SetIndex[BestSet] % M64.INTBITS)))
{
/* node is in set */

View File

@ -38,6 +38,7 @@ mjob_t *MJobTraceBuffer;
mrmfunc_t MRMFunc[MAX_MRMTYPE];
msim_t MSim;
msys_t MSys; /* cluster layout */
m64_t M64;
mx_t X;
int MFQ[MAX_MJOB]; /* terminated by '-1' value */
@ -98,6 +99,8 @@ int MSysInitialize(mbool_t DoInit)
S->X = (void *)&X;
M64Init(&M64);
MOSSyslogInit(S);
MUBuildPList((mcfg_t *)MCfg,MParam);

View File

@ -25,6 +25,7 @@ extern mnode_t *MNode[];
extern mqos_t MQOS[];
extern mpar_t MPar[];
extern mrm_t MRM[];
extern m64_t M64;
extern mframe_t MFrame[];
@ -1219,7 +1220,7 @@ int MTraceLoadWorkload(
J->SpecFlags |= MSim.TraceDefaultJobFlags;
for (index = 0;index < MINTBITS;index++)
for (index = 0;index < M64.INTBITS;index++)
{
if (!(MSim.TraceIgnoreJobFlags & (1 << index)))
continue;

View File

@ -23,6 +23,7 @@ extern const char *MComp[];
extern const char *MNodeState[];
extern const char *MHRObj[];
extern const char *MResourceType[];
extern m64_t M64;
extern mx_t X;
@ -788,7 +789,7 @@ int MUGetMAttr(
return(SUCCESS);
}
if ((AttrValue == NULL) || (MapSize < MINTSIZE))
if ((AttrValue == NULL) || (MapSize < M64.INTSIZE))
{
return(FAILURE);
}
@ -805,7 +806,7 @@ int MUGetMAttr(
if (!strcmp(MAList[AttrIndex][index],AttrValue))
{
if (AttrMap != NULL)
AttrMap[index >> MINTLBITS] |= 1 << (index % MINTBITS);
AttrMap[index >> M64.INTLBITS] |= 1 << (index % M64.INTBITS);
return(SUCCESS);
}
@ -822,7 +823,7 @@ int MUGetMAttr(
MUStrCpy(MAList[AttrIndex][index],AttrValue,sizeof(MAList[0][0]));
AttrMap[index >> MINTLBITS] |= 1 << (index % MINTBITS);
AttrMap[index >> M64.INTLBITS] |= 1 << (index % M64.INTBITS);
DBG(5,fSTRUCT) DPrint("INFO: added MAList[%s][%d]: '%s'\n",
MAttrType[AttrIndex],
@ -1069,7 +1070,7 @@ char *MUListAttrs(
Line[0] = '\0';
for (i = 1;i < MINTBITS;i++)
for (i = 1;i < M64.INTBITS;i++)
{
if ((Value & (1 << i)) && (MAList[Attr][i][0] != '\0'))
{
@ -1097,7 +1098,7 @@ char *MUMAList(
int index;
int findex;
if ((ValueMap == NULL) || (MapSize < MINTSIZE))
if ((ValueMap == NULL) || (MapSize < M64.INTSIZE))
{
strcpy(Line,NONE);
@ -1106,16 +1107,16 @@ char *MUMAList(
Line[0] = '\0';
for (findex = 0;findex < (MapSize >> MINTSHIFT);findex++)
for (findex = 0;findex < (MapSize >> M64.INTSHIFT);findex++)
{
for (index = 0;index < MINTBITS;index++)
for (index = 0;index < M64.INTBITS;index++)
{
if ((ValueMap[findex] & (1 << index)) &&
(MAList[AttrIndex][index][0] != '\0'))
{
sprintf(Line,"%s[%s]",
Line,
MAList[AttrIndex][index + findex * MINTBITS]);
MAList[AttrIndex][index + findex * M64.INTBITS]);
}
} /* END for (index) */
} /* END for (findex) */
@ -1152,7 +1153,7 @@ char *MAttrFind(
return(NULL);
}
if ((ValueMap == NULL) || (MapSize < MINTSIZE))
if ((ValueMap == NULL) || (MapSize < M64.INTSIZE))
{
return(NULL);
}
@ -1162,7 +1163,7 @@ char *MAttrFind(
for (findex = 0;findex < (MapSize >> 2);findex++)
{
for (index = 0;index < MINTBITS;index++)
for (index = 0;index < M64.INTBITS;index++)
{
if ((ValueMap[findex] & (1 << index)) &&
(MAList[AttrIndex][index][0] != '\0'))
@ -1217,7 +1218,7 @@ char *MUBListAttrs(
return(Line);
}
for (i = 1;i < MINTBITS;i++)
for (i = 1;i < M64.INTBITS;i++)
{
if ((Value & (1 << i)) && (MAList[Attr][i][0] != '\0'))
{
@ -4121,7 +4122,7 @@ char *MUBMToString(
ptr[0] = '\0';
for (i = 1;i < MINTBITS;i++)
for (i = 1;i < M64.INTBITS;i++)
{
if ((BM & (1 << i)) && (AList[i] != NULL) && (AList[i][0] != '\0'))
{
@ -4252,7 +4253,7 @@ int MUBMOR(
int mindex;
int len;
len = MAX(1,(MapSize >> MINTLBITS));
len = MAX(1,(MapSize >> M64.INTLBITS));
for (mindex = 0;mindex < len;mindex++)
{
@ -4275,7 +4276,7 @@ int MUBMAND(
int mindex;
int len;
len = MAX(1,(MapSize >> MINTLBITS));
len = MAX(1,(MapSize >> M64.INTLBITS));
for (mindex = 0;mindex < len;mindex++)
{
@ -5413,7 +5414,7 @@ char *MUMAToString(
char *ptr;
if ((ValueMap == NULL) || (MapSize < MINTSIZE))
if ((ValueMap == NULL) || (MapSize < M64.INTSIZE))
{
strcpy(Line,NONE);
@ -5422,14 +5423,14 @@ char *MUMAToString(
Line[0] = '\0';
for (findex = 0;findex < (MapSize >> MINTSHIFT);findex++)
for (findex = 0;findex < (MapSize >> M64.INTSHIFT);findex++)
{
for (index = 0;index < MINTBITS;index++)
for (index = 0;index < M64.INTBITS;index++)
{
if ((ValueMap[findex] & (1 << index)) &&
(MAList[AttrIndex][index][0] != '\0'))
{
ptr = MAList[AttrIndex][index + findex * MINTBITS];
ptr = MAList[AttrIndex][index + findex * M64.INTBITS];
if (Delim != '\0')
{

View File

@ -33,6 +33,8 @@ int UIProcessCommand(
long tmpL;
char tmpLine[MMAX_LINE];
const char *FName = "UIProcessCommand";
DBG(3,fUI) DPrint("%s(S)\n",
@ -411,16 +413,16 @@ int UIProcessCommand(
S->SBufSize = (long)sizeof(SBuffer);
sprintf(S->SBuffer,"%s%d ",
MCKeyword[mckStatusCode],
scFAILURE);
sprintf(tmpLine,"%s%d ",
MCKeyword[mckStatusCode],
scFAILURE);
Align = (int)strlen(S->SBuffer) + (int)strlen(MCKeyword[mckArgs]);
Align = (int)strlen(tmpLine) + (int)strlen(MCKeyword[mckArgs]);
sprintf(S->SBuffer,"%s%*s%s",
S->SBuffer,
16 - (Align % 16),
" ",
tmpLine,
16 - (Align % 16),
" ",
MCKeyword[mckArgs]);
HeadSize = (int)strlen(SBuffer);
@ -429,7 +431,7 @@ int UIProcessCommand(
if (Function[sindex] != NULL)
scode = (*Function[sindex])(args,S->SBuffer + HeadSize,FLAGS,Auth,&S->SBufSize);
else
scode = FAILURE;
scode = FAILURE;
ptr = S->SBuffer + strlen(MCKeyword[mckStatusCode]);

View File

@ -10,6 +10,7 @@
#define MAX_MCARGS 128
extern mattrlist_t MAList;
extern m64_t M64;
int MCResCreate(char *);
int MCJobShow(char *);
@ -563,6 +564,8 @@ int __MCInitialize()
DBG(2,fALL) DPrint("%s()\n",
FName);
M64Init(&M64);
MUBuildPList(MCfg,MParam);
strcpy(C.ServerHost,DEFAULT_MSERVERHOST);