| 1331 |
|
|
| 1332 |
int load_menu_shm(MENU_SET *p_menu_set) |
int load_menu_shm(MENU_SET *p_menu_set) |
| 1333 |
{ |
{ |
| 1334 |
|
void *p_shm; |
| 1335 |
|
|
| 1336 |
// Mount shared memory |
// Mount shared memory |
| 1337 |
if (p_menu_set->p_reserved == NULL) |
p_shm = shmat(p_menu_set->shmid, NULL, SHM_RDONLY); |
| 1338 |
|
if (p_shm == (void *)-1) |
| 1339 |
|
{ |
| 1340 |
|
log_error("shmat() error (%d)\n", errno); |
| 1341 |
|
return -1; |
| 1342 |
|
} |
| 1343 |
|
|
| 1344 |
|
if (p_menu_set->p_reserved != NULL && shmdt(p_menu_set->p_reserved) == -1) |
| 1345 |
{ |
{ |
| 1346 |
p_menu_set->p_reserved = shmat(p_menu_set->shmid, NULL, SHM_RDONLY); |
log_error("shmdt() error (%d)\n", errno); |
| 1347 |
if (p_menu_set->p_reserved == (void *)-1) |
return -2; |
|
{ |
|
|
log_error("shmat() error (%d)\n", errno); |
|
|
return -1; |
|
|
} |
|
| 1348 |
} |
} |
| 1349 |
|
p_menu_set->p_reserved = p_shm; |
| 1350 |
|
|
| 1351 |
p_menu_set->p_menu_pool = p_menu_set->p_reserved + MENU_SET_RESERVED_LENGTH; |
p_menu_set->p_menu_pool = p_menu_set->p_reserved + MENU_SET_RESERVED_LENGTH; |
| 1352 |
p_menu_set->p_menu_item_pool = p_menu_set->p_menu_pool + sizeof(MENU) * MAX_MENUS; |
p_menu_set->p_menu_item_pool = p_menu_set->p_menu_pool + sizeof(MENU) * MAX_MENUS; |