FreeBSD Bugzilla – Attachment 183537 Details for
Bug 186114
net/mpd5 hangs after a certain number of users connect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for lib/syslog by kib
syslog.patch (text/plain), 2.53 KB, created by
Eugene Grosbein
on 2017-06-16 15:23:29 UTC
(
hide
)
Description:
patch for lib/syslog by kib
Filename:
MIME Type:
Creator:
Eugene Grosbein
Created:
2017-06-16 15:23:29 UTC
Size:
2.53 KB
patch
obsolete
>--- lib/libc/gen/syslog.c.orig 2017-02-15 13:07:42.480404000 +0700 >+++ lib/libc/gen/syslog.c 2017-06-15 17:19:12.834060000 +0700 >@@ -129,8 +129,8 @@ syslog(int pri, const char *fmt, ...) > va_end(ap); > } > >-void >-vsyslog(int pri, const char *fmt, va_list ap) >+static void >+vsyslog1(int pri, const char *fmt, va_list ap) > { > int cnt; > char ch, *p; >@@ -151,13 +151,9 @@ vsyslog(int pri, const char *fmt, va_lis > > saved_errno = errno; > >- THREAD_LOCK(); >- > /* Check priority against setlogmask values. */ >- if (!(LOG_MASK(LOG_PRI(pri)) & LogMask)) { >- THREAD_UNLOCK(); >+ if (!(LOG_MASK(LOG_PRI(pri)) & LogMask)) > return; >- } > > /* Set default facility if none specified. */ > if ((pri & LOG_FACMASK) == 0) >@@ -167,10 +163,8 @@ vsyslog(int pri, const char *fmt, va_lis > tbuf_cookie.base = tbuf; > tbuf_cookie.left = sizeof(tbuf); > fp = fwopen(&tbuf_cookie, writehook); >- if (fp == NULL) { >- THREAD_UNLOCK(); >+ if (fp == NULL) > return; >- } > > /* Build the message. */ > (void)time(&now); >@@ -200,7 +194,6 @@ vsyslog(int pri, const char *fmt, va_lis > fmt_fp = fwopen(&fmt_cookie, writehook); > if (fmt_fp == NULL) { > fclose(fp); >- THREAD_UNLOCK(); > return; > } > >@@ -285,10 +278,8 @@ vsyslog(int pri, const char *fmt, va_lis > */ > disconnectlog(); > connectlog(); >- if (send(LogFile, tbuf, cnt, 0) >= 0) { >- THREAD_UNLOCK(); >+ if (send(LogFile, tbuf, cnt, 0) >= 0) > return; >- } > /* > * if the resend failed, fall through to > * possible scenario 2 >@@ -303,15 +294,11 @@ vsyslog(int pri, const char *fmt, va_lis > if (status == CONNPRIV) > break; > _usleep(1); >- if (send(LogFile, tbuf, cnt, 0) >= 0) { >- THREAD_UNLOCK(); >+ if (send(LogFile, tbuf, cnt, 0) >= 0) > return; >- } > } >- } else { >- THREAD_UNLOCK(); >+ } else > return; >- } > > /* > * Output the message to the console; try not to block >@@ -333,10 +320,25 @@ vsyslog(int pri, const char *fmt, va_lis > (void)_writev(fd, iov, 2); > (void)_close(fd); > } >+} >+ >+static void >+syslog_cancel_cleanup(void *arg __unused) >+{ > > THREAD_UNLOCK(); > } > >+void >+vsyslog(int pri, const char *fmt, va_list ap) >+{ >+ >+ THREAD_LOCK(); >+ pthread_cleanup_push(syslog_cancel_cleanup, NULL); >+ vsyslog1(pri, fmt, ap); >+ pthread_cleanup_pop(1); >+} >+ > /* Should be called with mutex acquired */ > static void > disconnectlog(void) >@@ -424,8 +426,9 @@ void > openlog(const char *ident, int logstat, int logfac) > { > THREAD_LOCK(); >+ pthread_cleanup_push(syslog_cancel_cleanup, NULL); > openlog_unlocked(ident, logstat, logfac); >- THREAD_UNLOCK(); >+ pthread_cleanup_pop(1); > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 186114
:
165278
|
165279
|
165280
|
165626
|
175989
|
183536
| 183537 |
183538