* allocation du tableau de poolData
This commit is contained in:
parent
0912a92668
commit
d5952f8245
1 changed files with 31 additions and 7 deletions
|
@ -72,7 +72,7 @@ msgSpace * msgSpaceCreate(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
printf( "Map addr is 0x%08x\n", (int)mSAddr );
|
||||
printf( "msgSpace map addr is 0x%08x\n", (int)mSAddr );
|
||||
|
||||
/* on ferme le descripteur du fichier */
|
||||
close(mSFd);
|
||||
|
@ -97,15 +97,32 @@ msgSpace * msgSpaceCreate(
|
|||
strerror( errno ) );
|
||||
return NULL;
|
||||
}
|
||||
/* TODO:allocation de la bonne zone mémoire pour le poolData */
|
||||
|
||||
/* TODO: on ajoute spaceId a la liste des msgSpace connus */
|
||||
/* allocation de la bonne zone mémoire pour le poolData */
|
||||
if (ftruncate(mSFd, poolNb*sizeof(* msgPoolData)) == -1){
|
||||
fprintf( stderr, "msgSpace resizing failed: %s\n",
|
||||
strerror( errno ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* TODO: on crée queueNb files de messages */
|
||||
/* TODO: attacher chacun des msgPoolData :
|
||||
* - y écrire les informations passées en param
|
||||
* - creer les zones mémoires de chacune des pool
|
||||
*/
|
||||
mSPoolDataAddr = mmap( 0, sizeof( *mSAddr ),
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED, mSFd, 0 );
|
||||
if( mSPoolDataAddr == MAP_FAILED ) {
|
||||
fprintf( stderr, "mmap failed: %s\n",
|
||||
strerror( errno ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* on créer poolNb pool de buffers */
|
||||
/* et on "attache" tout ce beau monde au spaceId */
|
||||
for (i=0;i<poolNb;i++){
|
||||
printf( "msgPoolData map addr is 0x%08x\n", (int)mSPoolDataFd );
|
||||
|
||||
|
||||
|
||||
for (i=0;i<poolNb;i++){
|
||||
// creation d'une pool
|
||||
|
||||
// mSAddr->
|
||||
|
@ -113,6 +130,13 @@ msgSpace * msgSpaceCreate(
|
|||
}
|
||||
|
||||
|
||||
/* TODO: on ajoute spaceId a la liste des msgSpace connus */
|
||||
|
||||
/* TODO: on crée queueNb files de messages */
|
||||
|
||||
|
||||
|
||||
|
||||
/* on renvoie un pointeur sur le bon spaceId */
|
||||
return mSAddr;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue