| 1560 |
return index; |
return index; |
| 1561 |
} |
} |
| 1562 |
|
|
| 1563 |
|
int get_section_info(SECTION_LIST *p_section, char *sname, char *stitle, char *master_list) |
| 1564 |
|
{ |
| 1565 |
|
if (p_section == NULL) |
| 1566 |
|
{ |
| 1567 |
|
log_error("NULL pointer error\n"); |
| 1568 |
|
return -1; |
| 1569 |
|
} |
| 1570 |
|
|
| 1571 |
|
if (section_list_rd_lock(p_section) < 0) |
| 1572 |
|
{ |
| 1573 |
|
log_error("section_list_rd_lock(sid=%d) error\n", p_section->sid); |
| 1574 |
|
return -2; |
| 1575 |
|
} |
| 1576 |
|
|
| 1577 |
|
if (sname != NULL) |
| 1578 |
|
{ |
| 1579 |
|
memcpy(sname, p_section->sname, sizeof(p_section->sname)); |
| 1580 |
|
} |
| 1581 |
|
if (stitle != NULL) |
| 1582 |
|
{ |
| 1583 |
|
memcpy(stitle, p_section->stitle, sizeof(p_section->stitle)); |
| 1584 |
|
} |
| 1585 |
|
if (master_list != NULL) |
| 1586 |
|
{ |
| 1587 |
|
memcpy(master_list, p_section->master_list, sizeof(p_section->master_list)); |
| 1588 |
|
} |
| 1589 |
|
|
| 1590 |
|
// release lock of section |
| 1591 |
|
if (section_list_rd_unlock(p_section) < 0) |
| 1592 |
|
{ |
| 1593 |
|
log_error("section_list_rd_unlock(sid=%d) error\n", p_section->sid); |
| 1594 |
|
return -2; |
| 1595 |
|
} |
| 1596 |
|
|
| 1597 |
|
return 0; |
| 1598 |
|
} |
| 1599 |
|
|
| 1600 |
int section_list_try_rd_lock(SECTION_LIST *p_section, int wait_sec) |
int section_list_try_rd_lock(SECTION_LIST *p_section, int wait_sec) |
| 1601 |
{ |
{ |
| 1602 |
int index; |
int index; |