diff --git a/smi/src/nrt_system.c b/smi/src/nrt_system.c index 7edfab37cf4d6217150b68f42ec5ca89e1c5b9e2..fef9e767f885f0a775eeb3199334f6ba47502d8a 100644 --- a/smi/src/nrt_system.c +++ b/smi/src/nrt_system.c @@ -367,7 +367,24 @@ int nrtSmi(char *esmFile, char *tssFile, char *tdeFile, char *cfgFile) { if (esmFile==NULL || tssFile==NULL || tdeFile==NULL || cfgFile==NULL) { goto exit; } + + /* check size of int type */ + if (sizeof(int)*CHAR_BIT<4*8) + { + error=4; + printf("[nrtSmi] int size too small\n"); + goto exit; + } + /* check lock constant */ + int lock; + __sync_fetch_and_nand(&lock,0); + if (lock!=NAND_LOCK) { + error=4; + printf("[nrtSmi] NAND_LOCK mismatch\n"); + goto exit; + } + /* check size of data types */ if (sizeof(char)!=CHAR_S || sizeof(short)!=SHORT_S || sizeof(int)!=INT_S || sizeof(long)!=LONG_S || @@ -377,14 +394,6 @@ int nrtSmi(char *esmFile, char *tssFile, char *tdeFile, char *cfgFile) { printf("[nrtSmi] data type mismatch\n"); goto exit; } - - /* check size of sig_atomic_t type */ - if (sizeof(sig_atomic_t)*CHAR_BIT<4*8) - { - error=4; - printf("[nrtSmi] atomic type size too small\n"); - goto exit; - } printf("[nrtSmi] allocating system shared memory\n"); if (initShm(&shm_fd,sizeof(shm_struct),(void *) &shm,SHM_FILE)!=0) { diff --git a/smi/src/smi_def.h b/smi/src/smi_def.h index 118ab0d0f55697924867a97d11d5ff9bdc9d376e..4dd41c96d212eb5b01e8d6b0988cb0e9750a9d46 100644 --- a/smi/src/smi_def.h +++ b/smi/src/smi_def.h @@ -1,6 +1,8 @@ #ifndef SMIDEF_H #define SMIDEF_H +#define NAND_LOCK -1 + #define NIL 0 #define AVAILABLE 0 #define REQUESTED 1