Improve msgSpace management

This commit is contained in:
Glenn Y. Rolland 2020-03-03 23:41:24 +01:00
parent 6e40948677
commit c53dc7546c
3 changed files with 15 additions and 17 deletions

View file

@ -1,12 +1,8 @@
#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 "nzg_global.h"
#include "nzg_iface.h"
#include "nzg_proto.h"
#include <sys/types.h>
#include <sys/mman.h>
/*
* spaceId : identifiant externe de l'espace de msg
@ -57,7 +53,7 @@ msgSpace * msgSpaceOpen(msgSpaceId spaceId){
}
void msgSpaceDelete(msgSpaceId spaceId){
int shmId;
//int shmId;
msgSpaceId nzgId=msgSp2nzgId(spaceId);
int er;
if ((er=shm_unlink(nzgId))<0){

View file

@ -1,3 +1,9 @@
#include <unistd.h>
#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 */
#define PAGESIZE sysconf(_SC_PAGESIZE)

View file

@ -1,13 +1,6 @@
char **msgSpaceIdList(void);
msgSpace * msgSpaceCreate(
msgSpaceId spaceId, // identifiant externe de l'espace de msg
int queueNb, // nombre de files de messages
int poolNb, // nombre de pool de buffers
msgPool * queueNbCar // tableau de caracteristiques des different pool
);
void * msgAllocate(
msgSpace * space, //espace de message concerné
int pool, //numéro de pool ou réaliser l'allocation
@ -17,7 +10,10 @@ void * msgAllocate(
/* nzg_create.c */
msgSpace *msgSpaceCreate(msgSpaceId spaceId, int queueNb, int poolNb, msgPool *queueNbCar);
msgSpace *msgSpaceCreate(
msgSpaceId spaceId, int queueNb, int poolNb, msgPool *queueNbCar
);
msgSpace *msgSpaceOpen(msgSpaceId spaceId);
void msgSpaceDelete(msgSpaceId spaceId);
msgSpaceId msgSp2nzgId(msgSpaceId spaceId);