Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/libhack make libhack's syslog.c produce exactl...



details:   https://anonhg.NetBSD.org/src/rev/fbc0750712e1
branches:  trunk
changeset: 781988:fbc0750712e1
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 11 17:11:16 2012 +0000

description:
make libhack's syslog.c produce exactly the same symbols as libc's syslog.c,
so that in the future we can keep them synced. Avoid strong_alias since it
does not play well with symbol renaming.

diffstat:

 distrib/utils/libhack/Makefile     |   6 ++-
 distrib/utils/libhack/Makefile.inc |   4 +-
 distrib/utils/libhack/syslog.c     |  74 ++++++++++++++++++++++++++++++++-----
 3 files changed, 71 insertions(+), 13 deletions(-)

diffs (187 lines):

diff -r 2706a585c373 -r fbc0750712e1 distrib/utils/libhack/Makefile
--- a/distrib/utils/libhack/Makefile    Thu Oct 11 17:09:55 2012 +0000
+++ b/distrib/utils/libhack/Makefile    Thu Oct 11 17:11:16 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2009/01/02 00:20:18 tnozaki Exp $
+# $NetBSD: Makefile,v 1.23 2012/10/11 17:11:16 christos Exp $
 #
 # Stubs to kill off some things from libc:
 # This save space on a boot system.
@@ -6,9 +6,13 @@
 
 .PATH.c: ${.CURDIR}/../../../lib/libc/gen ${.CURDIR}/../../../lib/libc/locale
 
+HACKSRC?=${.CURDIR}
+HACKOBJ?=${.OBJDIR}
+
 CPPFLAGS+=     -DSMALL
 CPPFLAGS.runetable.c+= -I${HACKSRC}/../../../lib/libc/citrus \
                        -DALL_80_TO_FF_SW1
+CPPFLAGS.syslog.c+=    -I${HACKSRC}/../../../lib/libc/include
 
 LIB=           hack
 SRCS=          getcap.c getgrent.c getnet.c getnetgr.c getpwent.c \
diff -r 2706a585c373 -r fbc0750712e1 distrib/utils/libhack/Makefile.inc
--- a/distrib/utils/libhack/Makefile.inc        Thu Oct 11 17:09:55 2012 +0000
+++ b/distrib/utils/libhack/Makefile.inc        Thu Oct 11 17:11:16 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.23 2009/01/02 00:20:18 tnozaki Exp $
+# $NetBSD: Makefile.inc,v 1.24 2012/10/11 17:11:16 christos Exp $
 #
 # Include this fragment to build libhack.o
 # It is .o and not .a to make sure these are the
@@ -24,6 +24,8 @@
 CPPFLAGS.runetable.c+= -I${HACKSRC}/../../../lib/libc/citrus \
                        -DALL_80_TO_FF_SW1
 
+CPPFLAGS.syslog.c+= -I${HACKSRC}/../../../lib/libc/include
+
 libhack.o: ${HACKOBJS}
        ${LD} -r -o $@ ${HACKOBJS}
 
diff -r 2706a585c373 -r fbc0750712e1 distrib/utils/libhack/syslog.c
--- a/distrib/utils/libhack/syslog.c    Thu Oct 11 17:09:55 2012 +0000
+++ b/distrib/utils/libhack/syslog.c    Thu Oct 11 17:11:16 2012 +0000
@@ -1,9 +1,21 @@
+#include "namespace.h"
 #include <sys/types.h>
 #include <sys/syslog.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <stdarg.h>
+#include "extern.h"
+
+#ifdef __weak_alias
+__weak_alias(closelog,_closelog)
+__weak_alias(openlog,_openlog)
+__weak_alias(setlogmask,_setlogmask)
+__weak_alias(syslog,_syslog)
+__weak_alias(vsyslog,_vsyslog)
+__weak_alias(syslogp,_syslogp)
+__weak_alias(vsyslogp,_vsyslogp)
+#endif
 
 void
 openlog(const char *path, int opt, int fac)
@@ -21,7 +33,6 @@
        return 0xff;
 }
 
-__strong_alias(_syslog, syslog)
 void
 syslog(int fac, const char *fmt, ...)
 {
@@ -31,7 +42,6 @@
        va_end(ap);
 }
 
-__strong_alias(_vsyslog, vsyslog)
 void
 vsyslog(int fac, const char *fmt, va_list ap)
 {
@@ -43,8 +53,6 @@
        fflush(stderr);
 }
 
-void syslog_ss(int, struct syslog_data *, const char *, ...);
-__strong_alias(_syslog_ss, syslog_ss)
 void
 syslog_ss(int priority, struct syslog_data *data, const char *fmt, ...)
 {
@@ -54,15 +62,12 @@
        va_end(ap);
 }
 
-void vsyslog_ss(int, struct syslog_data *, const char *, va_list);
-__strong_alias(_vsyslog_ss, vsyslog_ss)
 void
 vsyslog_ss(int priority, struct syslog_data *data, const char *fmt, va_list ap)
 {
        vsyslog(priority, fmt, ap);
 }
 
-__strong_alias(_syslog_r, syslog_r)
 void
 syslog_r(int priority, struct syslog_data *data, const char *fmt, ...)
 {
@@ -72,28 +77,75 @@
        va_end(ap);
 }
 
-__strong_alias(_vsyslog_r, vsyslog_r)
 void
 vsyslog_r(int priority, struct syslog_data *data, const char *fmt, va_list ap)
 {
        vsyslog(priority, fmt, ap);
 }
 
-__strong_alias(_closelog_r, closelog_r)
 void
 closelog_r(struct syslog_data *data)
 {
 }
 
-__strong_alias(_setlogmask_r, setlogmask_r)
 int
 setlogmask_r(int maskpri, struct syslog_data *data)
 {
        return 0xff;
 }
 
-__strong_alias(_openlog_r, openlog_r)
 void
 openlog_r(const char *id, int logopt, int facility, struct syslog_data *data)
 {
 }
+
+void
+syslogp_r(int priority, struct syslog_data *data, const char *msgid,
+    const char *sdfmt, const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       vsyslog(priority, fmt, ap);
+       va_end(ap);
+}
+
+void
+vsyslogp_r(int priority, struct syslog_data *data, const char *msgid,
+    const char *sdfmt, const char *fmt, va_list ap)
+{
+       vsyslog(priority, fmt, ap);
+}
+
+void
+syslogp_ss(int priority, struct syslog_data *data, const char *msgid,
+    const char *sdfmt, const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       vsyslog(priority, fmt, ap);
+       va_end(ap);
+}
+
+void
+vsyslogp_ss(int priority, struct syslog_data *data, const char *msgid,
+    const char *sdfmt, const char *fmt, va_list ap)
+{
+       vsyslog(priority, fmt, ap);
+}
+
+void
+syslogp(int priority, const char *msgid, const char *sdfmt, const char *fmt,
+    ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       vsyslog(priority, fmt, ap);
+       va_end(ap);
+}
+
+void
+vsyslogp(int priority, const char *msgid, const char *sdfmt, const char *fmt,
+    va_list ap)
+{
+       vsyslog(priority, fmt, ap);
+}



Home | Main Index | Thread Index | Old Index