| 114 |
|
|
| 115 |
int set_trie_dict_shm_readonly(void) |
int set_trie_dict_shm_readonly(void) |
| 116 |
{ |
{ |
| 117 |
|
#ifndef __CYGWIN__ |
| 118 |
int shmid; |
int shmid; |
| 119 |
void *p_shm; |
void *p_shm; |
| 120 |
|
|
| 127 |
shmid = p_trie_node_pool->shmid; |
shmid = p_trie_node_pool->shmid; |
| 128 |
|
|
| 129 |
// Remap shared memory in read-only mode |
// Remap shared memory in read-only mode |
|
#if defined(__CYGWIN__) |
|
|
if (shmdt(p_trie_node_pool) == -1) |
|
|
{ |
|
|
log_error("shmdt(trie_node_pool) error (%d)\n", errno); |
|
|
return -1; |
|
|
} |
|
|
p_shm = shmat(shmid, p_trie_node_pool, SHM_RDONLY); |
|
|
#else |
|
| 130 |
p_shm = shmat(shmid, p_trie_node_pool, SHM_RDONLY | SHM_REMAP); |
p_shm = shmat(shmid, p_trie_node_pool, SHM_RDONLY | SHM_REMAP); |
|
#endif |
|
| 131 |
if (p_shm == (void *)-1) |
if (p_shm == (void *)-1) |
| 132 |
{ |
{ |
| 133 |
log_error("shmat(trie_node_pool shmid=%d) error (%d)\n", shmid, errno); |
log_error("shmat(trie_node_pool shmid=%d) error (%d)\n", shmid, errno); |
| 135 |
} |
} |
| 136 |
|
|
| 137 |
p_trie_node_pool = p_shm; |
p_trie_node_pool = p_shm; |
| 138 |
|
#endif |
| 139 |
|
|
| 140 |
return 0; |
return 0; |
| 141 |
} |
} |