Module Name:    src
Committed By:   christos
Date:           Thu Oct 11 17:11:16 UTC 2012

Modified Files:
        src/distrib/utils/libhack: Makefile Makefile.inc syslog.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/distrib/utils/libhack/Makefile
cvs rdiff -u -r1.23 -r1.24 src/distrib/utils/libhack/Makefile.inc
cvs rdiff -u -r1.7 -r1.8 src/distrib/utils/libhack/syslog.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/libhack/Makefile
diff -u src/distrib/utils/libhack/Makefile:1.22 src/distrib/utils/libhack/Makefile:1.23
--- src/distrib/utils/libhack/Makefile:1.22	Thu Jan  1 19:20:18 2009
+++ src/distrib/utils/libhack/Makefile	Thu Oct 11 13:11:16 2012
@@ -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 \

Index: src/distrib/utils/libhack/Makefile.inc
diff -u src/distrib/utils/libhack/Makefile.inc:1.23 src/distrib/utils/libhack/Makefile.inc:1.24
--- src/distrib/utils/libhack/Makefile.inc:1.23	Thu Jan  1 19:20:18 2009
+++ src/distrib/utils/libhack/Makefile.inc	Thu Oct 11 13:11:16 2012
@@ -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 
 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}
 

Index: src/distrib/utils/libhack/syslog.c
diff -u src/distrib/utils/libhack/syslog.c:1.7 src/distrib/utils/libhack/syslog.c:1.8
--- src/distrib/utils/libhack/syslog.c:1.7	Sat Jul 14 16:32:39 2012
+++ src/distrib/utils/libhack/syslog.c	Thu Oct 11 13:11:16 2012
@@ -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 @@ 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_lis
 	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_da
 	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_dat
 	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);
+}

Reply via email to