*debut de liste chaine

This commit is contained in:
rivka_zan 2004-02-22 15:37:47 +00:00 committed by Glenn Y. Rolland
parent 607d86085a
commit eda639b42f

View file

@ -1,7 +1,79 @@
#include "libnazgul.h"
/* ajout dans la liste */
#define MSGSPACE_DEFAULT_MODE 0600
#include <unistd.h> /* POSIX et al */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h> /* pour O_RDWR */
#include <sys/types.h>
#include <sys/mman.h> /* shm_open */
#include <errno.h>
/*typedef struct MsgSpaceListElem *msgSpaceListElemId;
struct MsgSpaceListElem {
// void * tete;
msgSpaceListElemId tete;
int ownerPid;
msgSpaceListElemId queu;
};
msgSpaceListElemId *mslist;
*/
void *add(char * idAncien, char *idNouveau);
int descMemory;
void * add(char * idAncien, char *idNouveau){
descMemory=shm_open("/titi",
O_RDWR|O_CREAT|O_EXCL|O_TRUNC,
0600);
if (descMemory== -1){
printf("erreur de sh_open\n");
return NULL;
};
if (ftruncate(descMemory,1024)== -1 ){
printf("erreur ftruncate");
}
/* memory= mmap(0, 1024,
PROT_READ | PROT_WRITE,
MAP_SHARED, mSFd, 0)*/
Strcpy(idAncien, idNouveau);
}
/* ajout dans la liste */
/*AVEC POINTEUR */
/*
msgSpaceListElem *addBegining( msgSpaceListElem*list,int ownerpid){
msgSpaceListElem *unSpacemsgListElem;
if( (unSpacemsgListElem=(msgSpaceListElem *)malloc(sizeof(msgSpaceListElem) ) )==NULL){
@ -29,5 +101,5 @@ int test(int argc,char **argv){
}
return(0);
}
*/