From f6e747aed2daae486078a1fbf8574d884b0c15e4 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 11 Oct 2012 17:11:16 +0000 Subject: [PATCH] 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. --- distrib/utils/libhack/Makefile | 6 ++- distrib/utils/libhack/Makefile.inc | 4 +- distrib/utils/libhack/syslog.c | 74 +++++++++++++++++++++++++----- 3 files changed, 71 insertions(+), 13 deletions(-) diff --git a/distrib/utils/libhack/Makefile b/distrib/utils/libhack/Makefile index e727f81f674d..a53b1d34bbde 100644 --- a/distrib/utils/libhack/Makefile +++ b/distrib/utils/libhack/Makefile @@ -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 --git a/distrib/utils/libhack/Makefile.inc b/distrib/utils/libhack/Makefile.inc index baa8e6404c57..2cfd6cfc8421 100644 --- a/distrib/utils/libhack/Makefile.inc +++ b/distrib/utils/libhack/Makefile.inc @@ -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 @@ HACKOBJS+= getcap.o getgrent.o getnet.o getnetgr.o getpwent.o \ 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 --git a/distrib/utils/libhack/syslog.c b/distrib/utils/libhack/syslog.c index 4434dbd829c6..297ada5fb41b 100644 --- a/distrib/utils/libhack/syslog.c +++ b/distrib/utils/libhack/syslog.c @@ -1,9 +1,21 @@ +#include "namespace.h" #include #include #include #include #include #include +#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 @@ setlogmask(int mask) return 0xff; } -__strong_alias(_syslog, syslog) void syslog(int fac, const char *fmt, ...) { @@ -31,7 +42,6 @@ syslog(int fac, const char *fmt, ...) va_end(ap); } -__strong_alias(_vsyslog, vsyslog) void vsyslog(int fac, const char *fmt, va_list ap) { @@ -43,8 +53,6 @@ vsyslog(int fac, const char *fmt, va_list ap) 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 @@ syslog_ss(int priority, struct syslog_data *data, const char *fmt, ...) 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 @@ syslog_r(int priority, struct syslog_data *data, const char *fmt, ...) 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); +}