From 4b2d99d9f4258a29f0bf8b1a78d17836e75bc378 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 30 Dec 2011 17:50:37 +0100 Subject: [PATCH] journal: add unit files and shared library glue --- .gitignore | 2 + Makefile.am | 108 +++++++++++++++++++++++++++--- libsystemd-id128.pc.in | 18 +++++ libsystemd-journal.pc.in | 19 ++++++ src/libsystemd-id128.sym | 22 ++++++ src/libsystemd-journal.sym | 45 +++++++++++++ units/.gitignore | 1 + units/systemd-journald.service.in | 24 +++++++ units/systemd-journald.socket | 24 +++++++ 9 files changed, 255 insertions(+), 8 deletions(-) create mode 100644 libsystemd-id128.pc.in create mode 100644 libsystemd-journal.pc.in create mode 100644 src/libsystemd-id128.sym create mode 100644 src/libsystemd-journal.sym create mode 100644 units/systemd-journald.service.in create mode 100644 units/systemd-journald.socket diff --git a/.gitignore b/.gitignore index 265801ff..28b40de7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/libsystemd-journal.pc +/libsystemd-id128.pc systemd-journalctl systemd-journald test-id128 diff --git a/Makefile.am b/Makefile.am index 5fe67fd1..fa0a2178 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,6 +27,14 @@ LIBSYSTEMD_DAEMON_CURRENT=0 LIBSYSTEMD_DAEMON_REVISION=0 LIBSYSTEMD_DAEMON_AGE=0 +LIBSYSTEMD_ID128_CURRENT=0 +LIBSYSTEMD_ID128_REVISION=0 +LIBSYSTEMD_ID128_AGE=0 + +LIBSYSTEMD_JOURNAL_CURRENT=0 +LIBSYSTEMD_JOURNAL_REVISION=0 +LIBSYSTEMD_JOURNAL_AGE=0 + # Dirs of external packages dbuspolicydir=@dbuspolicydir@ dbussessionservicedir=@dbussessionservicedir@ @@ -217,11 +225,15 @@ endif lib_LTLIBRARIES = \ libsystemd-daemon.la \ - libsystemd-login.la + libsystemd-login.la \ + libsystemd-id128.la \ + libsystemd-journal.la pkginclude_HEADERS = \ src/sd-daemon.h \ - src/sd-login.h + src/sd-login.h \ + src/sd-id128.h \ + src/journal/sd-journal.h noinst_PROGRAMS = \ test-engine \ @@ -389,7 +401,8 @@ dist_systemunit_DATA = \ units/quotaon.service \ units/systemd-ask-password-wall.path \ units/systemd-ask-password-console.path \ - units/syslog.target + units/syslog.target \ + units/systemd-journald.socket if HAVE_SYSV_COMPAT dist_systemunit_DATA += \ @@ -410,6 +423,7 @@ nodist_systemunit_DATA = \ units/systemd-stdout-syslog-bridge.service \ units/systemd-shutdownd.service \ units/systemd-logind.service \ + units/systemd-journald.service \ units/systemd-kmsg-syslogd.service \ units/systemd-modules-load.service \ units/systemd-vconsole-setup.service \ @@ -473,7 +487,8 @@ EXTRA_DIST = \ units/systemd-stdout-syslog-bridge.service.in \ units/systemd-shutdownd.service.in \ units/systemd-logind.service.in \ - units/systemd-kmsg-syslogd.service.in \ + units/systemd-journald.service.in \ + units/systemd-kmsg-syslogd.service.in \ units/systemd-modules-load.service.in \ units/systemd-vconsole-setup.service.in \ units/systemd-remount-api-vfs.service.in \ @@ -502,8 +517,12 @@ EXTRA_DIST = \ systemd.pc.in \ libsystemd-daemon.pc.in \ libsystemd-login.pc.in \ + libsystemd-id128.pc.in \ + libsystemd-journal.pc.in \ src/libsystemd-daemon.sym \ src/libsystemd-login.sym \ + src/libsystemd-id128.sym \ + src/libsystemd-journal.sym \ introspect.awk \ src/73-seat-late.rules.in \ src/99-systemd.rules.in \ @@ -594,7 +613,9 @@ pkgconfigdata_DATA = \ pkgconfiglib_DATA = \ libsystemd-daemon.pc \ - libsystemd-login.pc + libsystemd-login.pc \ + libsystemd-id128.pc \ + libsystemd-journal.pc # Passed through intltool only polkitpolicy_in_files = \ @@ -770,7 +791,14 @@ EXTRA_DIST += \ src/logind-user.h \ src/logind-acl.h \ src/dbus-loop.h \ - src/spawn-agent.h + src/spawn-agent.h \ + src/journal/journal-def.h \ + src/journal/journal-internal.h \ + src/journal/journal-file.h \ + src/journal/lookup3.h \ + src/journal/compress.h \ + src/journal/journal-rate-limit.h \ + src/acl-util.h MANPAGES = \ man/systemd.1 \ @@ -1703,6 +1731,69 @@ libsystemd-login-install-hook: libsystemd-login-uninstall-hook: rm -f $(DESTDIR)$(rootlibdir)/libsystemd-login.so* +libsystemd_id128_la_SOURCES = \ + src/sd-id128.c + +libsystemd_id128_la_CFLAGS = \ + $(AM_CFLAGS) \ + -fvisibility=hidden + +libsystemd_id128_la_LDFLAGS = \ + -shared \ + -version-info $(LIBSYSTEMD_ID128_CURRENT):$(LIBSYSTEMD_ID128_REVISION):$(LIBSYSTEMD_ID128_AGE) \ + -Wl,--version-script=$(top_srcdir)/src/libsystemd-id128.sym + +libsystemd_id128_la_LIBADD = \ + libsystemd-basic.la + +# move lib from $(libdir) to $(rootlibdir) and update devel link, if needed +libsystemd-id128-install-hook: + if test "$(libdir)" != "$(rootlibdir)"; then \ + mkdir -p $(DESTDIR)$(rootlibdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libsystemd-id128.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libsystemd-id128.so && \ + mv $(DESTDIR)$(libdir)/libsystemd-id128.so.* $(DESTDIR)$(rootlibdir); \ + fi + +libsystemd-id128-uninstall-hook: + rm -f $(DESTDIR)$(rootlibdir)/libsystemd-id128.so* + +libsystemd_journal_la_SOURCES = \ + src/journal/sd-journal.c \ + src/journal/journal-file.c \ + src/journal/compress.c \ + src/journal/lookup3.c \ + src/journal/journal-send.c + +libsystemd_journal_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(XZ_CFLAGS) \ + -fvisibility=hidden + +libsystemd_journal_la_LDFLAGS = \ + -shared \ + -version-info $(LIBSYSTEMD_JOURNAL_CURRENT):$(LIBSYSTEMD_JOURNAL_REVISION):$(LIBSYSTEMD_JOURNAL_AGE) \ + -Wl,--version-script=$(top_srcdir)/src/libsystemd-journal.sym + +libsystemd_journal_la_LIBADD = \ + libsystemd-basic.la \ + libsystemd-id128.la \ + $(XZ_LIBS) + +# move lib from $(libdir) to $(rootlibdir) and update devel link, if needed +libsystemd-journal-install-hook: + if test "$(libdir)" != "$(rootlibdir)"; then \ + mkdir -p $(DESTDIR)$(rootlibdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libsystemd-journal.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libsystemd-journal.so && \ + mv $(DESTDIR)$(libdir)/libsystemd-journal.so.* $(DESTDIR)$(rootlibdir); \ + fi + +libsystemd-journal-uninstall-hook: + rm -f $(DESTDIR)$(rootlibdir)/libsystemd-journal.so* + SED_PROCESS = \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ $(SED) -e 's,@rootlibexecdir\@,$(rootlibexecdir),g' \ @@ -1919,11 +2010,12 @@ endif rm -f user && \ $(LN_S) $(pkgsysconfdir)/user user ) ( cd $(DESTDIR)$(systemunitdir)/sockets.target.wants && \ - rm -f systemd-initctl.socket systemd-stdout-syslog-bridge.socket systemd-shutdownd.socket syslog.socket && \ + rm -f systemd-initctl.socket systemd-stdout-syslog-bridge.socket systemd-shutdownd.socket syslog.socket systemd-journald.socket && \ $(LN_S) ../systemd-stdout-syslog-bridge.socket systemd-stdout-syslog-bridge.socket && \ $(LN_S) ../systemd-initctl.socket systemd-initctl.socket && \ $(LN_S) ../systemd-shutdownd.socket systemd-shutdownd.socket && \ - $(LN_S) ../syslog.socket syslog.socket ) + $(LN_S) ../syslog.socket syslog.socket && \ + $(LN_S) ../systemd-journald.socket ) ( cd $(DESTDIR)$(systemunitdir)/runlevel1.target.wants && \ rm -f systemd-update-utmp-runlevel.service && \ $(LN_S) ../systemd-update-utmp-runlevel.service systemd-update-utmp-runlevel.service ) diff --git a/libsystemd-id128.pc.in b/libsystemd-id128.pc.in new file mode 100644 index 00000000..4d984fdf --- /dev/null +++ b/libsystemd-id128.pc.in @@ -0,0 +1,18 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: systemd +Description: systemd 128 Bit ID Utility Library +URL: @PACKAGE_URL@ +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lsystemd-id128 +Cflags: -I${includedir} diff --git a/libsystemd-journal.pc.in b/libsystemd-journal.pc.in new file mode 100644 index 00000000..13cc8208 --- /dev/null +++ b/libsystemd-journal.pc.in @@ -0,0 +1,19 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: systemd +Description: systemd Journal Utility Library +URL: @PACKAGE_URL@ +Version: @PACKAGE_VERSION@ +Requires: libsystemd-id128 = @PACKAGE_VERSION@ +Libs: -L${libdir} -lsystemd-journal +Cflags: -I${includedir} diff --git a/src/libsystemd-id128.sym b/src/libsystemd-id128.sym new file mode 100644 index 00000000..c4d1cf5d --- /dev/null +++ b/src/libsystemd-id128.sym @@ -0,0 +1,22 @@ +/*** + This file is part of systemd. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. +***/ + +/* Original symbols from systemd v38 */ + +LIBSYSTEMD_ID128_38 { +global: + sd_id128_to_string; + sd_id128_from_string; + sd_id128_randomize; + sd_id128_make_v4_uuid; + sd_id128_get_machine; + sd_id128_get_boot; +local: + *; +}; diff --git a/src/libsystemd-journal.sym b/src/libsystemd-journal.sym new file mode 100644 index 00000000..7653880e --- /dev/null +++ b/src/libsystemd-journal.sym @@ -0,0 +1,45 @@ +/*** + This file is part of systemd. + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. +***/ + +/* Original symbols from systemd v38 */ + +LIBSYSTEMD_JOURNAL_38 { +global: + sd_journal_print; + sd_journal_printv; + sd_journal_send; + sd_journal_sendv; + sd_journal_stream_fd; + sd_journal_open; + sd_journal_close; + sd_journal_previous; + sd_journal_next; + sd_journal_previous_skip; + sd_journal_next_skip; + sd_journal_get_realtime_usec; + sd_journal_get_monotonic_usec; + sd_journal_get_data; + sd_journal_enumerate_data; + sd_journal_restart_data; + sd_journal_add_match; + sd_journal_flush_matches; + sd_journal_seek_head; + sd_journal_seek_tail; + sd_journal_seek_monotonic_usec; + sd_journal_seek_realtime_usec; + sd_journal_seek_cursor; + sd_journal_get_cursor; + sd_journal_query_unique; + sd_journal_enumerate_unique; + sd_journal_restart_unique; + sd_journal_get_fd; + sd_journal_process; +local: + *; +}; diff --git a/units/.gitignore b/units/.gitignore index cc92c730..94412d52 100644 --- a/units/.gitignore +++ b/units/.gitignore @@ -1,3 +1,4 @@ +/systemd-journald.service user@.service systemd-logind.service systemd-localed.service diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in new file mode 100644 index 00000000..2cfc6848 --- /dev/null +++ b/units/systemd-journald.service.in @@ -0,0 +1,24 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# See systemd.special(7) for details + +[Unit] +Description=Journal Service +DefaultDependencies=no +Requires=systemd-journald.socket +After=systemd-journald.socket + +[Service] +ExecStart=@rootlibexecdir@/systemd-journald +NotifyAccess=all +StandardOutput=null +#CapabilityBoundingSet=CAP_SYS_ADMIN CAP_SETUID CAP_SETGID + +# Increase the default a bit in order to allow many simultaneous +# services being run since we keep one fd open per service. +LimitNOFILE=16384 diff --git a/units/systemd-journald.socket b/units/systemd-journald.socket new file mode 100644 index 00000000..b439bc1f --- /dev/null +++ b/units/systemd-journald.socket @@ -0,0 +1,24 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# See systemd.special(7) for details + +[Unit] +Description=Journal Socket +DefaultDependencies=no +Before=sockets.target syslog.target + +# Mount and swap units need this. If this socket unit is removed by an +# isolate request the mount and and swap units would be removed too, +# hence let's exclude this from isolate requests. +IgnoreOnIsolate=yes + +[Socket] +ListenStream=/run/systemd/stdout +ListenDatagram=/run/systemd/native +ListenDatagram=/dev/log +SocketMode=0666 -- 2.39.5