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.
This commit is contained in:
christos 2012-10-11 17:11:16 +00:00
parent a9bb3b0c76
commit f6e747aed2
3 changed files with 71 additions and 13 deletions

View File

@ -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 \

View File

@ -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}

View File

@ -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_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);
}