583
584
585
586
587
588
589
590
591
592
593
594
595
596
|
pthread_create(&thread_id, NULL, filed_logging_thread, args);
filed_log_msg("START");
return(0);
}
#endif
/* Format time per RFC2616 */
static char *filed_format_time(char *buffer, size_t buffer_len, const time_t timeinfo) {
struct tm timeinfo_tm, *timeinfo_tm_p;
timeinfo_tm_p = gmtime_r(&timeinfo, &timeinfo_tm);
if (timeinfo_tm_p == NULL) {
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
|
pthread_create(&thread_id, NULL, filed_logging_thread, args);
filed_log_msg("START");
return(0);
}
#endif
static void *filed_sockettimeout_thread(void *arg) {
while (1) {
usleep(300000);
}
return(NULL);
/* NOTREACHED */
arg = arg;
}
static int filed_sockettimeout_thread_init(void) {
pthread_t thread_id;
pthread_create(&thread_id, NULL, filed_sockettimeout_thread, NULL);
return(0);
}
/* Format time per RFC2616 */
static char *filed_format_time(char *buffer, size_t buffer_len, const time_t timeinfo) {
struct tm timeinfo_tm, *timeinfo_tm_p;
timeinfo_tm_p = gmtime_r(&timeinfo, &timeinfo_tm);
if (timeinfo_tm_p == NULL) {
|
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
|
/* Create logging thread */
init_ret = filed_logging_thread_init(log_fp);
if (init_ret != 0) {
perror("filed_logging_thread_init");
return(4);
}
/* Create worker threads */
init_ret = filed_worker_threads_init(fd, thread_count, &thread_options);
if (init_ret != 0) {
perror("filed_worker_threads_init");
return(5);
|
>
>
>
>
>
>
>
>
|
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
|
/* Create logging thread */
init_ret = filed_logging_thread_init(log_fp);
if (init_ret != 0) {
perror("filed_logging_thread_init");
return(4);
}
/* Create socket termination thread */
init_ret = filed_sockettimeout_thread_init();
if (init_ret != 0) {
perror("filed_sockettimeout_thread_init");
return(6);
}
/* Create worker threads */
init_ret = filed_worker_threads_init(fd, thread_count, &thread_options);
if (init_ret != 0) {
perror("filed_worker_threads_init");
return(5);
|