Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc take care of the signal safe syslog calls which are...



details:   https://anonhg.NetBSD.org/src/rev/2706a585c373
branches:  trunk
changeset: 781987:2706a585c373
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 11 17:09:55 2012 +0000

description:
take care of the signal safe syslog calls which are not exposed.

diffstat:

 lib/libc/compat/gen/compat_syslog.c |  56 ++++++++++++++++++++++++++++++++++++-
 lib/libc/gen/syslog.c               |   9 +----
 lib/libc/include/extern.h           |  17 +++++-----
 3 files changed, 66 insertions(+), 16 deletions(-)

diffs (157 lines):

diff -r 4777a8e4d051 -r 2706a585c373 lib/libc/compat/gen/compat_syslog.c
--- a/lib/libc/compat/gen/compat_syslog.c       Thu Oct 11 11:12:21 2012 +0000
+++ b/lib/libc/compat/gen/compat_syslog.c       Thu Oct 11 17:09:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_syslog.c,v 1.1 2012/10/10 22:52:26 christos Exp $       */
+/*     $NetBSD: compat_syslog.c,v 1.2 2012/10/11 17:09:55 christos Exp $       */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -39,6 +39,15 @@
 #include <sys/syslog.h>
 #include <compat/sys/syslog.h>
 
+void   syslog_ss(int, struct syslog_data60 *, const char *, ...)
+    __printflike(3, 4);
+void    vsyslog_ss(int, struct syslog_data60 *, const char *, va_list) 
+    __printflike(3, 0); 
+void   syslogp_ss(int, struct syslog_data60 *, const char *, const char *, 
+    const char *, ...) __printflike(5, 0);
+void   vsyslogp_ss(int, struct syslog_data60 *, const char *, const char *, 
+    const char *, va_list) __printflike(5, 0);
+
 #ifdef __weak_alias
 __weak_alias(closelog_r,_closelog_r)
 __weak_alias(openlog_r,_openlog_r)
@@ -47,6 +56,11 @@
 __weak_alias(vsyslog_r,_vsyslog_r)
 __weak_alias(syslogp_r,_syslogp_r)
 __weak_alias(vsyslogp_r,_vsyslogp_r)
+
+__weak_alias(syslog_ss,_syslog_ss)
+__weak_alias(vsyslog_ss,_vsyslog_ss)
+__weak_alias(syslogp_ss,_syslogp_ss)
+__weak_alias(vsyslogp_ss,_vsyslogp_ss)
 #endif /* __weak_alias */
 
 __warn_references(closelog_r,
@@ -127,6 +141,7 @@
        syslog_data_convert(&data, data60);
        __vsyslog_r60(pri, &data, fmt, ap);
 }
+
 void
 syslogp_r(int pri, struct syslog_data60 *data60, const char *msgid,
     const char *sdfmt, const char *msgfmt, ...)
@@ -149,3 +164,42 @@
 
        __vsyslogp_r60(pri, &data, msgid, sdfmt, msgfmt, ap);
 }
+
+/*
+ * These are semi-private
+ */
+#define LOG_SIGNAL_SAFE (int)0x80000000
+
+void
+syslog_ss(int pri, struct syslog_data60 *data, const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vsyslog_r(pri | LOG_SIGNAL_SAFE, data, fmt, ap);
+       va_end(ap);
+}
+
+void
+syslogp_ss(int pri, struct syslog_data60 *data, const char *msgid,
+    const char *sdfmt, const char *msgfmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, msgfmt);
+       vsyslogp_r(pri | LOG_SIGNAL_SAFE, data, msgid, sdfmt, msgfmt, ap);
+       va_end(ap);
+}
+
+void
+vsyslog_ss(int pri, struct syslog_data60 *data, const char *fmt, va_list ap)
+{
+       vsyslog_r(pri | LOG_SIGNAL_SAFE, data, fmt, ap);
+}
+
+void
+vsyslogp_ss(int pri, struct syslog_data60 *data, const char *msgid,
+    const char *sdfmt, const char *msgfmt, va_list ap)
+{
+       vsyslogp_r(pri | LOG_SIGNAL_SAFE, data, msgid, sdfmt, msgfmt, ap);
+}
diff -r 4777a8e4d051 -r 2706a585c373 lib/libc/gen/syslog.c
--- a/lib/libc/gen/syslog.c     Thu Oct 11 11:12:21 2012 +0000
+++ b/lib/libc/gen/syslog.c     Thu Oct 11 17:09:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syslog.c,v 1.52 2012/10/10 23:53:43 christos Exp $     */
+/*     $NetBSD: syslog.c,v 1.53 2012/10/11 17:09:55 christos Exp $     */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)syslog.c   8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: syslog.c,v 1.52 2012/10/10 23:53:43 christos Exp $");
+__RCSID("$NetBSD: syslog.c,v 1.53 2012/10/11 17:09:55 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -67,11 +67,6 @@
 __weak_alias(vsyslog,_vsyslog)
 __weak_alias(syslogp,_syslogp)
 __weak_alias(vsyslogp,_vsyslogp)
-
-__weak_alias(syslog_ss,_syslog_ss)
-__weak_alias(vsyslog_ss,_vsyslog_ss)
-__weak_alias(syslogp_ss,_syslogp_ss)
-__weak_alias(vsyslogp_ss,_vsyslogp_ss)
 #endif
 
 static struct syslog_data sdata = SYSLOG_DATA_INIT;
diff -r 4777a8e4d051 -r 2706a585c373 lib/libc/include/extern.h
--- a/lib/libc/include/extern.h Thu Oct 11 11:12:21 2012 +0000
+++ b/lib/libc/include/extern.h Thu Oct 11 17:09:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.20 2012/09/12 02:00:53 manu Exp $ */
+/*     $NetBSD: extern.h,v 1.21 2012/10/11 17:09:56 christos Exp $     */
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -49,21 +49,22 @@
 char *__ldtoa(long double *, int, int, int *, int *, char **);
 #endif
 
+#ifndef __LIBC12_SOURCE__
 struct syslog_data;
 void   syslog_ss(int, struct syslog_data *, const char *, ...)
-    __attribute__((__format__(__printf__,3,4)));
-void   vsyslog_ss(int, struct syslog_data *, const char *, va_list);
+    __RENAME(__syslog_ss60) __printflike(3, 4);
 void    vsyslog_ss(int, struct syslog_data *, const char *, va_list) 
-    __attribute__((__format__(__printf__,3,0))); 
+    __RENAME(__vsyslog_ss60) __printflike(3, 0); 
 void   syslogp_ss(int, struct syslog_data *, const char *, const char *, 
-    const char *, ...) __attribute__((__format__(__printf__,5,0))); 
+    const char *, ...) __RENAME(__syslogp_ss60) __printflike(5, 0);
 void   vsyslogp_ss(int, struct syslog_data *, const char *, const char *, 
-    const char *, va_list) __attribute__((__format__(__printf__,5,0))); 
+    const char *, va_list) __RENAME(__vsyslogp_ss60) __printflike(5, 0);
+#endif
 
 int    snprintf_ss(char * __restrict, size_t, const char * __restrict, ...)
-    __attribute__((__format__(__printf__, 3, 4)));
+    __printflike(3, 4);
 int    vsnprintf_ss(char * __restrict, size_t, const char * __restrict,
-    va_list) __attribute__((__format__(__printf__, 3, 0)));
+    va_list) __printflike(3, 0);
 
 void   _malloc_prefork(void);
 void   _malloc_postfork(void);



Home | Main Index | Thread Index | Old Index