Misc, cleanup remaining SYSV #ifdefs and simplify a bit

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-10-23 12:51:49 +02:00
parent 5114907afe
commit 3309fb2d50
3 changed files with 16 additions and 25 deletions

View File

@ -25,17 +25,17 @@ AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter
AM_CFLAGS += -fomit-frame-pointer -fno-strength-reduce
syslogd_SOURCES = syslogd.c pidfile.c pidfile.h
syslogd_CPPFLAGS = -DSYSV -DINET6 -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE
syslogd_CPPFLAGS = -DINET6 -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE
klogd_SOURCES = klogd.c klogd.h syslog.c pidfile.c pidfile.h \
ksym.c ksyms.h ksym_mod.c module.h
klogd_CPPFLAGS = -DSYSV -DALLOW_KERNEL_LOGGING \
klogd_CPPFLAGS = -DALLOW_KERNEL_LOGGING \
-D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE
logger_SOURCES = logger.c syslog.c
logger_CPPFLAGS = -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE
tsyslogd_SOURCES = syslogd.c pidfile.c pidfile.h
tsyslogd_CPPFLAGS = -DSYSV -DINET6 -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -DTESTING
tsyslogd_CPPFLAGS = -DINET6 -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -DTESTING
syslog_tst_SOURCES = syslog_tst.c

View File

@ -18,9 +18,9 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
CC= gcc
#SKFLAGS= -g -DSYSV -Wall
#SKFLAGS= -g -Wall
#LDFLAGS= -g
SKFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
SKFLAGS= $(RPM_OPT_FLAGS) -O3 -fomit-frame-pointer -Wall -fno-strength-reduce
# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
# $(shell getconf LFS_SKFLAGS)

View File

@ -852,7 +852,7 @@ void debug_switch();
void logerror(const char *type);
void die(int sig);
#ifndef TESTING
void doexit(int sig);
void doexit(int sig);
#endif
void init();
static int strtobytes(char *arg);
@ -2110,11 +2110,7 @@ void fprintlog(struct filed *f, char *from, int flags, char *msg)
case F_CONSOLE:
f->f_time = now;
#ifdef UNIXPC
if (1) {
#else
if (flags & IGN_CONS) {
#endif
logit(" (ignored).\n");
break;
}
@ -2196,9 +2192,6 @@ void fprintlog(struct filed *f, char *from, int flags, char *msg)
f->f_prevcount = 0;
return;
}
#if FALSE
} /* balance parentheses for emacs */
#endif
jmp_buf ttybuf;
@ -2237,10 +2230,7 @@ void wallmsg(struct filed *f, struct iovec *iov)
if (fork() == 0) {
(void)signal(SIGTERM, SIG_DFL);
(void)alarm(0);
#ifndef SYSV
(void)signal(SIGTTOU, SIG_IGN);
(void)sigsetmask(0);
#endif
(void)snprintf(greetings, sizeof(greetings),
"\r\n\7Message from syslogd@%s at %.24s ...\r\n",
(char *)iov[2].iov_base, ctime(&now));
@ -2308,18 +2298,19 @@ void wallmsg(struct filed *f, struct iovec *iov)
void reapchild(int signo)
{
int saved_errno = errno;
#if defined(SYSV) && !defined(linux)
(void)signal(SIGCHLD, reapchild); /* reset signal handler -ASP */
wait(NULL);
#else
#ifdef linux
int status;
while (wait3(&status, WNOHANG, (struct rusage *)NULL) > 0)
while (wait3(&status, WNOHANG, NULL) > 0)
;
signal(SIGCHLD, reapchild); /* reset signal handler -ASP */
#else
signal(SIGCHLD, reapchild); /* reset signal handler -ASP */
wait(NULL);
#endif
#ifdef linux
(void)signal(SIGCHLD, reapchild); /* reset signal handler -ASP */
#endif
errno = saved_errno;
}