* renommages

This commit is contained in:
glenux 2004-02-21 13:17:47 +00:00 committed by Glenn Y. Rolland
parent b6c68da039
commit e085e22af4
7 changed files with 35 additions and 19 deletions

View file

@ -18,7 +18,7 @@ void * msgAllocate(msgSpace *space,
void * resultAddr;
int i, mSPoolDataTabFd;
msgSpacePoolId resultPoolID;
msgPoolId resultPoolID;
/* tableau des valeurs des semPoolCoef/pool pour identifier le pool
* qui sera libéré le plus rapidement */
float semPoolCoef[space->poolNb];
@ -109,6 +109,7 @@ void * msgAllocate(msgSpace *space,
}
}
}else {
semFd=sem_open(mSPoolDataTab[i].id,0);
if (sem_wait(semFd) < 0){
perror("sem_wait");

View file

@ -17,28 +17,41 @@ int msgSpaceIdIntern(msgSpaceId dest,const msgSpaceId src ){
return 0;
}
int msgPoolDataIdIntern(msgSpaceId dest,const msgSpaceId src ){
int msgPoolSemIdIntern(msgSemId destSemId,const msgPoolDataId srcPoolId ){
if (strlen(srcPoolId)>MSGSPACE_ID_LEN*4){
return -1;
}
/* sprintf(resNzgId,"/tmp/.nzg-%s",(char *)spaceId); */
#ifdef _NZG_REALFILEID
sprintf(destSemId,"/tmp/nzgPoolData%s",(char *)srcPoolId);
#else
sprintf(destSemId,"/nzgPoolData%s",(char *)srcPoolId);
#endif
return 0;
}
int msgPoolDataIdIntern(msgPoolDataId dest,const msgSpaceId src ){
if (strlen(src)>MSGSPACE_ID_LEN){
return -1;
}
/* sprintf(resNzgId,"/tmp/.nzg-%s",(char *)spaceId); */
#ifdef _NZG_REALFILEID
sprintf(dest,"/tmp/nzgSpacePoolData%s",(char *)src);
sprintf(dest,"/tmp/nzgPoolData%s",(char *)src);
#else
sprintf(dest,"/nzgSpacePoolData%s",(char *)src);
sprintf(dest,"/nzgPoolData%s",(char *)src);
#endif
return 0;
}
int msgSpacePoolId2nzgPoolId(msgSpacePoolId dest,msgSpacePoolId src, int num){
int msgSpacePoolId2nzgPoolId(msgPoolId dest,msgPoolId src, int num){
if (strlen(src)>MSGSPACE_ID_LEN){
return -1;
}
#ifdef _NZG_REALFILEID
sprintf(dest,"/tmp/nzgSpacePool%s%d",(char *)src,num);
sprintf(dest,"/tmp/nzgPool%s%d",(char *)src,num);
#else
sprintf(dest,"/nzgSpacePool%s%d",(char *)src,num);
sprintf(dest,"/nzgPool%s%d",(char *)src,num);
#endif
return 0;
}

View file

@ -7,7 +7,7 @@
/* nzg_ids.c */
int msgSpaceIdIntern(msgSpaceId dest, const msgSpaceId src);
int msgPoolDataIdIntern(msgSpaceId dest, const msgSpaceId src);
int msgSpacePoolId2nzgPoolId(msgSpacePoolId dest, msgSpacePoolId src, int num);
int msgSpacePoolId2nzgPoolId(msgPoolId dest, msgPoolId src, int num);
#endif

View file

@ -10,10 +10,12 @@ typedef char msgSpaceId[MSGSPACE_ID_LEN];
typedef char msgSpaceListId[4*MSGSPACE_ID_LEN];
typedef char msgSpaceListElemId[4*MSGSPACE_ID_LEN];
typedef char msgSpacePoolDataId[4*MSGSPACE_ID_LEN];
typedef char msgSpacePoolId[4*MSGSPACE_ID_LEN];
typedef char msgSpaceQueueDataId[4*MSGSPACE_ID_LEN];
typedef char msgSpaceQueueId[4*MSGSPACE_ID_LEN];
typedef char msgPoolDataId[4*MSGSPACE_ID_LEN];
typedef char msgPoolId[4*MSGSPACE_ID_LEN];
typedef char msgSemId[4*MSGSPACE_ID_LEN];
typedef char msgQueueDataId[4*MSGSPACE_ID_LEN];
typedef char msgQueueId[4*MSGSPACE_ID_LEN];
/* pid[] */
/* liste des processus demandeurs */
@ -23,7 +25,7 @@ typedef struct MsgPool {
} msgPool;
typedef struct MsgPoolData {
msgSpacePoolId id;
msgPoolId id;
int bufferNb;
int bufferSize;
int allocDispBuffer;
@ -38,7 +40,7 @@ typedef struct MsgSpace {
int poolNb;
int queueNb;
int pid;
msgSpacePoolDataId poolDataId;
msgPoolDataId poolDataId;
} msgSpace;

View file

@ -4,14 +4,14 @@
liste process demandeurs */
int msgPoolCreate(
msgSpacePoolId poolId,
msgPoolId poolId,
int buffNb,
int buffSize
) {
int poolFd;
static int poolNb;
msgSpacePoolId id;
msgPoolId id;
sem_t * sem;
if (msgSpacePoolId2nzgPoolId(id,poolId,poolNb) == -1){

View file

@ -4,8 +4,8 @@
/* nzg_list.c */
/* msgSpaceListId msgSpaceIdList(void); */
/* nzg_pool.c */
int msgPoolCreate(msgSpacePoolId poolId, int buffNb, int buffSize);
int msgSpacePoolId2nzgPoolId(msgSpacePoolId dest, msgSpacePoolId src, int num);
int msgPoolCreate(msgPoolId poolId, int buffNb, int buffSize);
int msgSpacePoolId2nzgPoolId(msgPoolId dest, msgPoolId src, int num);
/* nzg_spaces.c */
msgSpace *msgSpaceCreate(msgSpaceId spaceId, int queueNb, int poolNb, msgPool *queueNbCar);
msgSpace *msgSpaceOpen(msgSpaceId spaceId);

View file

@ -28,7 +28,7 @@ msgSpace * msgSpaceCreate(
static int mSIdNum=-1;
msgSpace * mSAddr;
msgSpacePoolId poolDataId;
msgPoolId poolDataId;
msgPoolData * mSPoolDataAddr;
fprintf(stderr,"Creating msgSpace with id : %s\n",spaceId);