| 152 |
return -3; |
return -3; |
| 153 |
} |
} |
| 154 |
|
|
| 155 |
size = sizeof(shmid) + sizeof(ARTICLE_BLOCK) * (size_t)block_count_in_shm; |
size = sizeof(ARTICLE_BLOCK) * (size_t)block_count_in_shm; |
| 156 |
shmid = shmget(key, size, IPC_CREAT | IPC_EXCL | 0600); |
shmid = shmget(key, size, IPC_CREAT | IPC_EXCL | 0600); |
| 157 |
if (shmid == -1) |
if (shmid == -1) |
| 158 |
{ |
{ |
| 361 |
return (p_block->articles + (index % ARTICLE_PER_BLOCK)); |
return (p_block->articles + (index % ARTICLE_PER_BLOCK)); |
| 362 |
} |
} |
| 363 |
|
|
| 364 |
extern int section_list_pool_init(const char *filename) |
extern int section_list_init(const char *filename) |
| 365 |
{ |
{ |
| 366 |
int semid; |
int semid; |
| 367 |
int shmid; |
int shmid; |
| 374 |
|
|
| 375 |
if (p_section_list_pool == NULL || p_trie_dict_section_by_name == NULL || p_trie_dict_section_by_sid == NULL) |
if (p_section_list_pool == NULL || p_trie_dict_section_by_name == NULL || p_trie_dict_section_by_sid == NULL) |
| 376 |
{ |
{ |
| 377 |
section_list_pool_cleanup(); |
section_list_cleanup(); |
| 378 |
} |
} |
| 379 |
|
|
| 380 |
proj_id = (int)(time(NULL) % getpid()); |
proj_id = (int)(time(NULL) % getpid()); |
| 496 |
if (trie_dict_set(p_trie_dict_section_by_sid, sid_str, section_list_count) != 1) |
if (trie_dict_set(p_trie_dict_section_by_sid, sid_str, section_list_count) != 1) |
| 497 |
{ |
{ |
| 498 |
log_error("trie_dict_set(section, %d, %d) error\n", sid, section_list_count); |
log_error("trie_dict_set(section, %d, %d) error\n", sid, section_list_count); |
|
log_std("Debug %x %x %x %x\n", sid_str[0], sid_str[1], sid_str[2], sid_str[3]); |
|
| 499 |
return NULL; |
return NULL; |
| 500 |
} |
} |
| 501 |
|
|
| 519 |
p_section->last_page_visible_article_count = 0; |
p_section->last_page_visible_article_count = 0; |
| 520 |
} |
} |
| 521 |
|
|
| 522 |
void section_list_pool_cleanup(void) |
void section_list_cleanup(void) |
| 523 |
{ |
{ |
| 524 |
if (p_trie_dict_section_by_name != NULL) |
if (p_trie_dict_section_by_name != NULL) |
| 525 |
{ |
{ |