Add pool allocate (squash)

This commit is contained in:
Glenn Y. Rolland 2019-09-17 14:16:29 +02:00
parent 37b871297f
commit 665cb90dd6
2 changed files with 25 additions and 2 deletions

View file

@ -55,3 +55,26 @@ int msgSpacePoolId2nzgPoolId(msgSpacePoolId dest,msgSpacePoolId src, int num){
// //donne l'adr en mappant in the memory
//poolAddr = mmap(NULL, sizeof(*msgPool), PROT_NONE, MAP_SHARED, poolFd, 0);
msgPool * msgPoolAllocate(int poolFd, msgSpace *msg) {
msgPool * poolAddr;
int dataId;
//msgSpacePoolData spoolData;
//dataId = msg->poolDataId;
//spoolData[dataId];
//donne l'adr en mappant in the memory
poolAddr = mmap(NULL, sizeof(*msgPool), PROT_NONE, MAP_SHARED, poolFd, 0);
if(poolAddr == MAP_FAILED) {
fprintf( stderr, "mmap failed: %s\n",
strerror( errno ) );
return NULL;
}
// on renvoie le pointeur sur le bon pool
return poolAddr;
}