| 874 | } |
| 875 | |
| 876 | static void net_vsyslog(ACL_LOG *log, const char *info, |
| 877 | const char *fmt, va_list ap) |
| 878 | { |
| 879 | char tbuf[1024], *buf; |
| 880 | size_t len; |
| 881 | |
| 882 | if (__log_thread_id) { |
| 883 | #ifdef MINGW |
| 884 | snprintf(tbuf, sizeof(tbuf), " %s (pid=%d, tid=%lu)(%s): ", |
| 885 | log->logpre, (int) getpid(), |
| 886 | (unsigned long) acl_pthread_self(), info); |
| 887 | #elif defined(ACL_LINUX) |
| 888 | snprintf(tbuf, sizeof(tbuf), " %s (pid=%d, tid=%llu)(%s): ", |
| 889 | log->logpre, (int) getpid(), |
| 890 | (unsigned long long int) acl_pthread_self(), info); |
| 891 | #elif defined(SUNOS5) |
| 892 | snprintf(tbuf, sizeof(tbuf), " %s (pid=%d, tid=%d)(%s): ", |
| 893 | log->logpre, (int) getpid(), |
| 894 | (int) acl_pthread_self(), info); |
| 895 | #elif defined(ACL_WINDOWS) |
| 896 | snprintf(tbuf, sizeof(tbuf), " %s (pid=%d, tid=%d)(%s): ", |
| 897 | log->logpre, (int) _getpid(), |
| 898 | (int) acl_pthread_self(), info); |
| 899 | #else |
| 900 | snprintf(tbuf, sizeof(tbuf), " %s: (%s): ", log->logpre, info); |
| 901 | #endif |
| 902 | } else { |
| 903 | #if defined(SUNOS5) |
| 904 | snprintf(tbuf, sizeof(tbuf), " %s (pid=%d)(%s): ", |
| 905 | log->logpre, (int) getpid(), info); |
| 906 | #elif defined(ACL_WINDOWS) |
| 907 | snprintf(tbuf, sizeof(tbuf), " %s (pid=%d)(%s): ", |
| 908 | log->logpre, (int) _getpid(), info); |
| 909 | #else |
| 910 | snprintf(tbuf, sizeof(tbuf), " %s (pid=%d)(%s): ", |
| 911 | log->logpre, (int) getpid(), info); |
| 912 | #endif |
| 913 | } |
| 914 | |
| 915 | buf = get_buf(tbuf, fmt, ap, log->type == ACL_LOG_T_UDP |
| 916 | ? NULL : "\r\n", &len); |
| 917 | |
| 918 | if (log->lock && log->type != ACL_LOG_T_UDP) { |
| 919 | thread_mutex_lock(log->lock); |
| 920 | } |
| 921 | |
| 922 | if (log->type == ACL_LOG_T_UDP) { |
| 923 | (void) private_vstream_write(log->fp, buf, len); |
| 924 | log->count++; |
| 925 | } else if (private_vstream_writen(log->fp, buf, len) == ACL_VSTREAM_EOF) { |
| 926 | log->flag |= ACL_LOG_F_DEAD; |
| 927 | } else { |
| 928 | log->count++; |
| 929 | } |
| 930 | |
| 931 | if (log->lock && log->type != ACL_LOG_T_UDP) { |
| 932 | thread_mutex_unlock(log->lock); |
| 933 | } |
no test coverage detected
searching dependent graphs…