*** empty log message ***

This commit is contained in:
glenux 2004-02-25 22:30:43 +00:00
parent 7bc845da58
commit 762c3b8a38
5 changed files with 91 additions and 44 deletions

View file

@ -188,7 +188,7 @@ if (mSPoolDataTabAddr==NULL){
int bufferFreeSize;
bufferFreeSize=mSPoolDataTabAddr[selectedPoolIndex].bufferSize;
printf("BufferSize : %d", bufferFreeSize);
printf("BufferSize : %d\n", bufferFreeSize);
resultAddr=msgBufferMap(mSPoolDataTabAddr,selectedPoolIndex,bufferFreeIndex);
if (resultAddr==NULL){

View file

@ -42,19 +42,34 @@ msgSpace * msgSpaceCreate(
return NULL;
}
msgSpaceListInit();
if (msgSpaceListInit() <0){
NZG_ERROR("msgSpaceListInit",nzgId);
goto ERROR;
};
printf("spaceListInit ok\n");
msgSpaceListLock();
if (msgSpaceListLock() <0){
NZG_ERROR("msgSpaceListLock","");
goto ERROR;
}
printf("spaceListLock ok\n");
if (msgSpaceListFindId(nzgId) < 1){
NZG_ERROR("spaceListFindId",nzgId);
int err;
if ((err=msgSpaceListFindId(nzgId)) < 1){
if (err==0){
NZG_ERROR("spaceListFindId : existing ",nzgId);
} else {
NZG_ERROR("spaceListFindId : error ",nzgId);
}
msgSpaceListUnlock();
// zut, il y a soit une erreur
// soit le msgSpace existe deja
// on quitte
goto ERROR;
}
printf("spaceListFind ok\n");
msgSpaceListUnlock();
if (msgSpaceListUnlock() < 0){
NZG_ERROR("msgSpaceListUnlock","");
goto ERROR;
}
printf("spaceListUnlock ok\n");
fprintf(stderr,"Creating msgSpace with id : %s\n",nzgId);
@ -106,8 +121,8 @@ msgSpace * msgSpaceCreate(
space->poolDataTabSemId);
goto ERROR;
} else {
NZG_ERROR("sem_open : creation oki",
space->poolDataTabSemId);
/* NZG_ERROR("sem_open : creation oki",
space->poolDataTabSemId); */
}
sem_close(mSDataTabSemFd);
@ -161,17 +176,17 @@ msgSpace * msgSpaceCreate(
msgPoolDataTabClose(space,poolDataTabAddr);
/* on ajoute spaceId a la liste des msgSpace connus */
msgSpaceListElemId listElemId;
printf("spaceListInit...\n");
printf("spaceListInit...\n");
printf("ok\n");
printf("ok\n");
msgSpaceListLock();
printf("spaceListLock...ok\n");
printf("spaceListLock...ok\n");
msgSpaceListElemCreate(listElemId,space);
printf("spaceListElemCreate...ok\n");
printf("spaceListElemCreate...ok\n");
msgSpaceListAdd(listElemId);
printf("spaceListAdd...ok\n");
printf("spaceListAdd...ok\n");
msgSpaceListUnlock();
printf("spaceListUnlock...ok\n");
printf("spaceListUnlock...ok\n");
/* on renvoie un pointeur sur le bon spaceId */
msgPoolDataTabUnlock(space);

View file

@ -6,13 +6,18 @@
int msgSpaceListAdd(msgSpaceListElemId newElemId){
msgSpaceListElem * listOldTailElem;
msgSpaceListElem * listNewTailElem;
msgSpaceList * list=NULL;
msgSpaceList * list;
list=msgSpaceListOpen();
if (list == NULL){
NZG_ERROR("msgSpaceListOpen","");
goto ERROR;
}
// on informe l'element qui est le dernier
listNewTailElem=msgSpaceListElemOpen(newElemId);
if (listNewTailElem==NULL){
NZG_ERROR("msgSpaceListElemOpen",newElemId);
goto ERROR;
}
strcpy(listNewTailElem->next,newElemId);
if (msgSpaceListElemClose(listNewTailElem) <0 ){
@ -23,7 +28,7 @@ int msgSpaceListAdd(msgSpaceListElemId newElemId){
/* verifier si la liste n'est pas vide... */
if((strcmp(list->headId,list->id)==0)
&& (strcmp(list->tailId,list->id)==0)) {
printf("- premier elem de queue -\n");
printf("- premier elem de spaceList -\n");
// on donne a la queue l'id de l'element
strcpy(list->headId,newElemId);
strcpy(list->tailId,newElemId);

View file

@ -8,7 +8,6 @@ int msgSpaceListElemCreate(
{
msgSpaceListElemIdIntern(listElemId,space->externId);
printf("Creating ListElem %s",listElemId);
int listElemFd;
listElemFd=shm_open(listElemId,
@ -20,7 +19,7 @@ int msgSpaceListElemCreate(
goto ERROR;
}
if (ftruncate(listElemFd, sizeof(msgQueueElem)) < 0){
if (ftruncate(listElemFd, sizeof(msgSpaceListElem)) < 0){
NZG_ERROR("ftruncate", listElemId);
goto ERROR;
}
@ -28,9 +27,20 @@ int msgSpaceListElemCreate(
close(listElemFd);
msgSpaceListElem * listElem;
listElem=msgSpaceListElemOpen(listElemId);
if (listElem ==NULL){
NZG_ERROR("msgSpaceListElemOpen",listElemId);
goto ERROR;
}
strcpy(listElem->id,listElemId);
strcpy(listElem->next,listElemId);
strcpy(listElem->spaceId,space->id);
msgSpaceListElemClose(listElem);
printf("[ ListElem : id %s,next: %s, Sid: %s ]\n",
listElem->id,
listElem->next,
listElem->spaceId);
if (msgSpaceListElemClose(listElem) <0){
NZG_ERROR("msgSpaceListElemClose",listElemId);
}
return 0;
ERROR:
return -1;

View file

@ -23,9 +23,11 @@ int msgSpaceListInit(){
/*Fait un segment de memoir partager sur espace de listelement*/
spaceListFd=shm_open(spaceListId,O_RDWR|O_CREAT|O_EXCL|O_TRUNC,0600);
spaceListFd=shm_open(spaceListId,
O_RDWR|O_CREAT|O_EXCL|O_TRUNC,
0666);
if (spaceListFd == -1){
spaceListFd=shm_open(spaceListId,O_RDWR|O_TRUNC,0600);
spaceListFd=shm_open(spaceListId,O_RDWR,0666);
if (spaceListFd == -1){
NZG_ERROR("shm_open",spaceListId);
goto ERROR;
@ -34,25 +36,40 @@ int msgSpaceListInit(){
goto EXISTING;
}
}
if (ftruncate(spaceListFd, sizeof(msgSpaceList)) < 0){
if (ftruncate(spaceListFd, sizeof(msgSpaceList)) < 0){
NZG_ERROR("ftruncate",spaceListId);
goto ERROR;
}
close(spaceListFd);
close(spaceListFd);
msgSpaceList *list;
list=msgSpaceListOpen();
if (list == NULL){
NZG_ERROR("msgSpaceListOpen","");
goto ERROR;
}
strcpy(list->id,spaceListId);
strcpy(list->headId,spaceListId);
strcpy(list->tailId,spaceListId);
msgSpaceListClose(list);
if (msgSpaceListClose(list) <0){
NZG_ERROR("msgSpaceListClose","");
goto ERROR;
}
msgSpaceListUnlock();
if (msgSpaceListUnlock() < 0){
NZG_ERROR("msgSpaceListUnlock","");
goto ERROR;
}
return 0;
ERROR:
return -1;
EXISTING:
if (msgSpaceListUnlock() < 0){
NZG_ERROR("msgSpaceListUnlock","");
goto ERROR;
}
return 0;
};