diff options
Diffstat (limited to 'poky/meta/recipes-extended/sysklogd')
12 files changed, 558 insertions, 0 deletions
diff --git a/poky/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch b/poky/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch new file mode 100644 index 000000000..9567946c0 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch @@ -0,0 +1,132 @@ +From f0af5bcfd753691652eac35efbcb208c933253f1 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 31 Aug 2015 05:11:53 +0000 +Subject: [PATCH] Fix build with musl + +Explicitly include fcntl.h since with glibc is comes in as indirect +include but not with musl + +linux/time.h inclusion is not required on musl so using !__GLIBC__ is +not right for musl here + +wait type is glibc specific + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + klogd.c | 10 +--------- + ksym_mod.c | 5 +---- + pidfile.c | 1 + + syslog.c | 3 ++- + syslogd.c | 4 +--- + 5 files changed, 6 insertions(+), 17 deletions(-) + +diff --git a/klogd.c b/klogd.c +index 6cc80ed..9219671 100644 +--- a/klogd.c ++++ b/klogd.c +@@ -260,11 +260,8 @@ + #include <unistd.h> + #include <signal.h> + #include <errno.h> +-#include <sys/fcntl.h> ++#include <fcntl.h> + #include <sys/stat.h> +-#if !defined(__GLIBC__) +-#include <linux/time.h> +-#endif /* __GLIBC__ */ + #include <stdarg.h> + #include <paths.h> + #include <stdlib.h> +@@ -277,13 +274,8 @@ + + #define __LIBRARY__ + #include <linux/unistd.h> +-#if !defined(__GLIBC__) +-# define __NR_ksyslog __NR_syslog +-_syscall3(int,ksyslog,int, type, char *, buf, int, len); +-#else + #include <sys/klog.h> + #define ksyslog klogctl +-#endif + + #define LOG_BUFFER_SIZE 4096 + #define LOG_LINE_LENGTH 1000 +diff --git a/ksym_mod.c b/ksym_mod.c +index 68cd6b6..6e26da1 100644 +--- a/ksym_mod.c ++++ b/ksym_mod.c +@@ -113,12 +113,9 @@ + #include <unistd.h> + #include <signal.h> + #include <errno.h> +-#include <sys/fcntl.h> ++#include <fcntl.h> + #include <sys/stat.h> + #include "module.h" +-#if !defined(__GLIBC__) +-#include <linux/time.h> +-#endif /* __GLIBC__ */ + #include <stdarg.h> + #include <paths.h> + #include <linux/version.h> +diff --git a/pidfile.c b/pidfile.c +index e0959a0..6daa2e0 100644 +--- a/pidfile.c ++++ b/pidfile.c +@@ -31,6 +31,7 @@ + #include <string.h> + #include <errno.h> + #include <signal.h> ++#include <fcntl.h> + + /* read_pid + * +diff --git a/syslog.c b/syslog.c +index bdb3ff2..ef7b34e 100644 +--- a/syslog.c ++++ b/syslog.c +@@ -55,7 +55,7 @@ static char sccsid[] = "@(#)syslog.c 5.28 (Berkeley) 6/27/90"; + #include <sys/types.h> + #include <sys/socket.h> + #include <sys/file.h> +-#include <sys/signal.h> ++//#include <sys/signal.h> + #include <sys/syslog.h> + #if 0 + #include "syslog.h" +@@ -72,6 +72,7 @@ static char sccsid[] = "@(#)syslog.c 5.28 (Berkeley) 6/27/90"; + #include <stdarg.h> + #include <paths.h> + #include <stdio.h> ++#include <fcntl.h> + + #define _PATH_LOGNAME "/dev/log" + +diff --git a/syslogd.c b/syslogd.c +index ea73ea5..1ca0595 100644 +--- a/syslogd.c ++++ b/syslogd.c +@@ -818,9 +818,7 @@ void doexit(int sig); + void init(); + void cfline(char *line, register struct filed *f); + int decode(char *name, struct code *codetab); +-#if defined(__GLIBC__) + #define dprintf mydprintf +-#endif /* __GLIBC__ */ + static void dprintf(char *, ...); + static void allocate_log(void); + void sighup_handler(); +@@ -2094,7 +2092,7 @@ void reapchild() + (void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */ + wait ((int *)0); + #else +- union wait status; ++ int status; + + while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0) + ; +-- +2.5.1 + diff --git a/poky/meta/recipes-extended/sysklogd/files/0001-fix-problems-that-causes-a-segmentation-fault-under-.patch b/poky/meta/recipes-extended/sysklogd/files/0001-fix-problems-that-causes-a-segmentation-fault-under-.patch new file mode 100644 index 000000000..56431af84 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/0001-fix-problems-that-causes-a-segmentation-fault-under-.patch @@ -0,0 +1,28 @@ +From cb72b3e172c238b4b5ae5935dc6be54f5034fcf1 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 30 Jun 2017 18:20:06 -0700 +Subject: [PATCH 1/2] fix problems that causes a segmentation fault under some + conditions + +Upstream-Status: Inappropriate [ no upstream ] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + ksym_mod.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/ksym_mod.c b/ksym_mod.c +index 6e26da1..a3daa7d 100644 +--- a/ksym_mod.c ++++ b/ksym_mod.c +@@ -186,7 +186,6 @@ extern int InitMsyms() + else + Syslog(LOG_ERR, "Error loading kernel symbols " \ + "- %s\n", strerror(errno)); +- fclose(ksyms); + return(0); + } + +-- +2.13.2 + diff --git a/poky/meta/recipes-extended/sysklogd/files/0002-Make-way-for-respecting-flags-from-environment.patch b/poky/meta/recipes-extended/sysklogd/files/0002-Make-way-for-respecting-flags-from-environment.patch new file mode 100644 index 000000000..ebbdef303 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/0002-Make-way-for-respecting-flags-from-environment.patch @@ -0,0 +1,35 @@ +From b22f244732cd0f475af2f82fc7eecec49f90623b Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 1 Jul 2017 00:01:50 -0700 +Subject: [PATCH 2/2] Make way for respecting flags from environment + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + Makefile | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 5af1689..af699d2 100644 +--- a/Makefile ++++ b/Makefile +@@ -17,14 +17,12 @@ + # along with this program; if not, write to the Free Software + # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +-CC= gcc + #SKFLAGS= -g -DSYSV -Wall + #LDFLAGS= -g +-SKFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce ++SKFLAGS = $(CFLAGS) $(CPPFLAGS) -DSYSV -Wall -fno-strength-reduce + # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE + # $(shell getconf LFS_SKFLAGS) +-LDFLAGS= -s + + # Look where your install program is. + INSTALL = /usr/bin/install +-- +2.13.2 + diff --git a/poky/meta/recipes-extended/sysklogd/files/klogd.service b/poky/meta/recipes-extended/sysklogd/files/klogd.service new file mode 100644 index 000000000..0c888c497 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/klogd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Kernel Logging Service +After=syslogd.service + +[Service] +Type=forking +ExecStart=/sbin/klogd +PIDFile=/var/run/klogd.pid +StandardOutput=null +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/poky/meta/recipes-extended/sysklogd/files/no-strip-install.patch b/poky/meta/recipes-extended/sysklogd/files/no-strip-install.patch new file mode 100644 index 000000000..d426c83bf --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/no-strip-install.patch @@ -0,0 +1,17 @@ +Upstream-Status: Inappropriate [configuration] + +Index: sysklogd-1.5.1/Makefile +=================================================================== +--- sysklogd-1.5.1.orig/Makefile ++++ sysklogd-1.5.1/Makefile +@@ -127,8 +127,8 @@ clobber: clean + rm -f syslogd klogd ksym syslog_tst oops_test TAGS tsyslogd tklogd + + install_exec: syslogd klogd +- ${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd +- ${INSTALL} -m 500 -s klogd ${BINDIR}/klogd ++ ${INSTALL} -m 500 syslogd ${BINDIR}/syslogd ++ ${INSTALL} -m 500 klogd ${BINDIR}/klogd + + install_man: + ${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} sysklogd.8 ${MANDIR}/man8/sysklogd.8 diff --git a/poky/meta/recipes-extended/sysklogd/files/no-vectorization.patch b/poky/meta/recipes-extended/sysklogd/files/no-vectorization.patch new file mode 100644 index 000000000..c1cc042c9 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/no-vectorization.patch @@ -0,0 +1,20 @@ +Upstream-Status: Inappropriate + +The compiler should not be generating vectorized instructions on this target. +This is a work around until I can determine why this is occuring on this +particular recipe + +Index: sysklogd-1.5/Makefile +=================================================================== +--- sysklogd-1.5.orig/Makefile ++++ sysklogd-1.5/Makefile +@@ -20,7 +20,8 @@ + CC= gcc + #SKFLAGS= -g -DSYSV -Wall + #LDFLAGS= -g +-SKFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce ++SKFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce \ ++ -fno-tree-vectorize + # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE + # $(shell getconf LFS_SKFLAGS) diff --git a/poky/meta/recipes-extended/sysklogd/files/sysklogd b/poky/meta/recipes-extended/sysklogd/files/sysklogd new file mode 100755 index 000000000..258f88280 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/sysklogd @@ -0,0 +1,151 @@ +#! /bin/sh +# /etc/init.d/sysklogd: start the system log daemon. + +### BEGIN INIT INFO +# Provides: sysklogd +# Required-Start: $remote_fs $time +# Required-Stop: $remote_fs $time +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: System logger +### END INIT INFO + +# Source function library. +. /etc/init.d/functions + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +pidfile_syslogd=/var/run/syslogd.pid +pidfile_klogd=/var/run/klogd.pid +binpath_syslogd=/sbin/syslogd +binpath_klogd=/sbin/klogd + +test -x $binpath || exit 0 + +test ! -r /etc/default/syslogd || . /etc/default/syslogd + +create_xconsole() +{ + # Only proceed if /dev/xconsole is used at all + if ! grep -q '^[^#].*/dev/xconsole' /etc/syslog.conf + then + return + fi + + if [ ! -e /dev/xconsole ]; then + mknod -m 640 /dev/xconsole p + else + chmod 0640 /dev/xconsole + fi + chown root:adm /dev/xconsole + test ! -x /sbin/restorecon || /sbin/restorecon /dev/xconsole +} + +log_begin_msg () { + echo -n $1 +} + +log_end_msg () { + echo $1 +} + +log_success_msg () { + echo $1 +} + +running() +{ + # No pidfile, probably no daemon present + # + if [ ! -f $pidfile ] + then + return 1 + fi + + pid=`cat $pidfile_syslogd` + + # No pid, probably no daemon present + # + if [ -z "$pid" ] + then + return 1 + fi + + if [ ! -d /proc/$pid ] + then + return 1 + fi + + cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1` + + # No syslogd? + # + if [ "$cmd" != "$binpath" ] + then + return 1 + fi + + return 0 +} + +case "$1" in + start) + log_begin_msg "Starting system log daemon..." + create_xconsole + start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD + log_end_msg $? + log_begin_msg "Starting kernel log daemon..." + start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD + log_end_msg $? + ;; + stop) + log_begin_msg "Stopping system log daemon..." + start-stop-daemon --stop --quiet --pidfile $pidfile_syslogd --name syslogd + log_end_msg $? + log_begin_msg "Stopping kernel log daemon..." + start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd + log_end_msg $? + ;; + reload|force-reload) + log_begin_msg "Reloading system log daemon..." + start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile_syslogd --name syslogd + log_end_msg $? + log_begin_msg "Reloading kernel log daemon..." + start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd + start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD + log_end_msg $? + ;; + restart) + log_begin_msg "Restarting system log daemon..." + start-stop-daemon --stop --retry 5 --quiet --pidfile $pidfile_syslogd --name syslogd + start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD + log_end_msg $? + log_begin_msg "Reloading kernel log daemon..." + start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd + start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD + log_end_msg $? + ;; + reload-or-restart) + if running + then + $0 reload + else + $0 start + fi + ;; + status) + status syslogd + RETVAL=$? + status klogd + rval=$? + [ $RETVAL -eq 0 ] && exit $rval + exit $RETVAL + ;; + *) + log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart|status}" + exit 1 +esac + +exit 0 diff --git a/poky/meta/recipes-extended/sysklogd/files/syslog.conf b/poky/meta/recipes-extended/sysklogd/files/syslog.conf new file mode 100644 index 000000000..0849de126 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/syslog.conf @@ -0,0 +1,71 @@ +# /etc/syslog.conf Configuration file for syslogd. +# +# Ported from debian by Yu Ke <ke.yu@intel.com> +# + +# +# First some standard logfiles. Log by facility. +# + +auth,authpriv.* /var/log/auth.log +*.*;auth,authpriv.none -/var/log/syslog +#cron.* /var/log/cron.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +lpr.* -/var/log/lpr.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log + +# +# Logging for the mail system. Split it up so that +# it is easy to write scripts to parse these files. +# +mail.info -/var/log/mail.info +mail.warn -/var/log/mail.warn +mail.err /var/log/mail.err + +# Logging for INN news system +# +news.crit /var/log/news.crit +news.err /var/log/news.err +news.notice -/var/log/news.notice + +# +# Some `catch-all' logfiles. +# +*.=debug;\ +auth,authpriv.none;\ +news.none;mail.none -/var/log/debug + +*.=info;*.=notice;*.=warn;\ +auth,authpriv.none;\ +cron,daemon.none;\ +mail,news.none -/var/log/messages + +# +# Emergencies are sent to everybody logged in. +# +*.emerg * + +# +# I like to have messages displayed on the console, but only on a virtual +# console I usually leave idle. +# +#daemon,mail.*;\ +#news.=crit;news.=err;news.=notice;\ +#*.=debug;*.=info;\ +#*.=notice;*.=warn /dev/tty8 + +# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, +# you must invoke `xconsole' with the `-file' option: +# +# $ xconsole -file /dev/xconsole [...] +# +# NOTE: adjust the list below, or you'll go crazy if you have a reasonably +# busy site.. +# +daemon.*;mail.*;\ +news.err;\ +*.=debug;*.=info;\ +*.=notice;*.=warn |/dev/xconsole + diff --git a/poky/meta/recipes-extended/sysklogd/files/syslogd.service b/poky/meta/recipes-extended/sysklogd/files/syslogd.service new file mode 100644 index 000000000..eeaff3d38 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/syslogd.service @@ -0,0 +1,14 @@ +[Unit] +Description=System Logging Service +Requires=syslog.socket + +[Service] +Type=forking +ExecStart=/sbin/syslogd +PIDFile=/var/run/syslogd.pid +StandardOutput=null +Restart=on-failure + +[Install] +WantedBy=multi-user.target +Alias=syslog.service diff --git a/poky/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf b/poky/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf new file mode 100644 index 000000000..f4aecd385 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf @@ -0,0 +1 @@ +p /dev/xconsole 0640 root adm diff --git a/poky/meta/recipes-extended/sysklogd/sysklogd.inc b/poky/meta/recipes-extended/sysklogd/sysklogd.inc new file mode 100644 index 000000000..1a537fabf --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/sysklogd.inc @@ -0,0 +1,72 @@ +SUMMARY = "System Log Daemons" +DESCRIPTION = "The sysklogd package implements two system log daemons: syslogd, klogd" +HOMEPAGE = "http://www.infodrom.org/projects/sysklogd/" +SECTION = "base" + +LICENSE = "GPLv2+ & BSD" +LICENSE_syslogd = "BSD" +LICENSE_klogd = "GPLv2+" +LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \ + file://syslogd.c;beginline=2;endline=15;md5=77ffb2fec48c46d7ca0abb2d5813e7fd \ + file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \ + " + +inherit update-rc.d systemd + +SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \ + file://no-strip-install.patch \ + file://0001-Fix-build-with-musl.patch \ + file://0001-fix-problems-that-causes-a-segmentation-fault-under-.patch \ + file://0002-Make-way-for-respecting-flags-from-environment.patch \ + file://sysklogd \ + file://syslog.conf \ + file://syslogd.service \ + file://klogd.service \ + file://tmpfiles.sysklogd.conf \ + " + +SRC_URI_append_e500v2 = " file://no-vectorization.patch" + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "syslogd.service klogd.service" +SYSTEMD_AUTO_ENABLE = "enable" + +INITSCRIPT_NAME = "syslog" +CONFFILES_${PN} = "${sysconfdir}/syslog.conf" +RCONFLICTS_${PN}-syslog = "rsyslog busybox-syslog syslog-ng" + +CFLAGS += "-DSYSV -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" + +do_install () { + install -d ${D}${mandir}/man8 \ + ${D}${mandir}/man5 \ + ${D}${base_sbindir} + oe_runmake 'BINDIR=${D}${base_sbindir}' \ + 'MANDIR=${D}${mandir}' install + install -d ${D}${sysconfdir} + install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf + install -d ${D}${sysconfdir}/init.d + install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog + install -d ${D}${systemd_unitdir}/system + install -m 644 ${WORKDIR}/syslogd.service ${D}${systemd_unitdir}/system + install -m 644 ${WORKDIR}/klogd.service ${D}${systemd_unitdir}/system + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true', 'false', d)}; then + install -d ${D}${exec_prefix}/lib/tmpfiles.d + install -m 644 ${WORKDIR}/tmpfiles.sysklogd.conf ${D}${exec_prefix}/lib/tmpfiles.d/sysklogd.conf + fi +} + +FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','${exec_prefix}/lib/tmpfiles.d/sysklogd.conf', '', d)}" + +pkg_prerm_${PN} () { + if test "x$D" = "x"; then + if test "$1" = "upgrade" -o "$1" = "remove"; then + /etc/init.d/syslog stop || : + fi + fi +} + +python () { + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") +} diff --git a/poky/meta/recipes-extended/sysklogd/sysklogd_1.5.1.bb b/poky/meta/recipes-extended/sysklogd/sysklogd_1.5.1.bb new file mode 100644 index 000000000..975ecc2b6 --- /dev/null +++ b/poky/meta/recipes-extended/sysklogd/sysklogd_1.5.1.bb @@ -0,0 +1,4 @@ +require sysklogd.inc + +SRC_URI[md5sum] = "c70599ab0d037fde724f7210c2c8d7f8" +SRC_URI[sha256sum] = "5166c185ae23c92e8b9feee66a6e3d0bc944bf673112f53e3ecf62e08ce7c201" |