mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-11-23 23:10:57 +07:00
build-sys: store journald code in a noinst library
The point is to allow the use of journald functions by other binaries. Before, journald code was split into multiple files (journald-*.[ch]), but all those files all required functions from journald.c. And journald.c has its own main(). Now, it is possible to link against those functions, e.g. from test binaries. This constitutes a fix for https://bugzilla.redhat.com/show_bug.cgi?id=872638. The patch does the following: 1. rename journald.h to journald-server.h and move corresponding code to journald-server.c. 2. add journald-server.c and other journald-*.c parts to libsystemd-journal-internal. 3. remove journald-syslog.c from test_journal_syslog_SOURCES, since it is now contained in libsystemd-journal-internal. There are no code changes, apart from the removal of a few static's, to allow function calls between files.
This commit is contained in:
parent
be1015dd34
commit
d025f1e4dc
77
Makefile.am
77
Makefile.am
@ -2432,42 +2432,12 @@ EXTRA_DIST += \
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
systemd_journald_SOURCES = \
|
systemd_journald_SOURCES = \
|
||||||
src/journal/journald.c \
|
src/journal/journald.c \
|
||||||
src/journal/journald.h \
|
src/journal/journald-server.h
|
||||||
src/journal/journald-kmsg.c \
|
|
||||||
src/journal/journald-kmsg.h \
|
|
||||||
src/journal/journald-syslog.c \
|
|
||||||
src/journal/journald-syslog.h \
|
|
||||||
src/journal/journald-stream.c \
|
|
||||||
src/journal/journald-stream.h \
|
|
||||||
src/journal/journald-console.c \
|
|
||||||
src/journal/journald-console.h \
|
|
||||||
src/journal/journald-native.c \
|
|
||||||
src/journal/journald-native.h \
|
|
||||||
src/journal/journald-rate-limit.c \
|
|
||||||
src/journal/journald-rate-limit.h \
|
|
||||||
src/journal/journal-internal.h
|
|
||||||
|
|
||||||
nodist_systemd_journald_SOURCES = \
|
|
||||||
src/journal/journald-gperf.c
|
|
||||||
|
|
||||||
systemd_journald_LDADD = \
|
systemd_journald_LDADD = \
|
||||||
libsystemd-label.la \
|
|
||||||
libsystemd-shared.la \
|
|
||||||
libsystemd-audit.la \
|
|
||||||
libsystemd-daemon.la \
|
|
||||||
libsystemd-id128-internal.la \
|
|
||||||
libsystemd-journal-internal.la \
|
libsystemd-journal-internal.la \
|
||||||
libudev.la
|
libsystemd-shared.la \
|
||||||
|
libsystemd-id128-internal.la
|
||||||
if ENABLE_LOGIND
|
|
||||||
systemd_journald_LDADD += \
|
|
||||||
libsystemd-login-internal.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
if HAVE_ACL
|
|
||||||
systemd_journald_LDADD += \
|
|
||||||
libsystemd-acl.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
systemd_cat_SOURCES = \
|
systemd_cat_SOURCES = \
|
||||||
src/journal/cat.c
|
src/journal/cat.c
|
||||||
@ -2524,12 +2494,11 @@ test_journal_send_LDADD = \
|
|||||||
libsystemd-id128-internal.la
|
libsystemd-id128-internal.la
|
||||||
|
|
||||||
test_journal_syslog_SOURCES = \
|
test_journal_syslog_SOURCES = \
|
||||||
src/journal/test-journal-syslog.c \
|
src/journal/test-journal-syslog.c
|
||||||
src/journal/journald-syslog.c
|
|
||||||
|
|
||||||
test_journal_syslog_LDADD = \
|
test_journal_syslog_LDADD = \
|
||||||
libsystemd-shared.la \
|
|
||||||
libsystemd-journal-internal.la \
|
libsystemd-journal-internal.la \
|
||||||
|
libsystemd-shared.la \
|
||||||
libsystemd-id128-internal.la
|
libsystemd-id128-internal.la
|
||||||
|
|
||||||
test_journal_match_SOURCES = \
|
test_journal_match_SOURCES = \
|
||||||
@ -2603,12 +2572,44 @@ libsystemd_journal_la_LIBADD = \
|
|||||||
libsystemd-id128-internal.la
|
libsystemd-id128-internal.la
|
||||||
|
|
||||||
libsystemd_journal_internal_la_SOURCES = \
|
libsystemd_journal_internal_la_SOURCES = \
|
||||||
$(libsystemd_journal_la_SOURCES)
|
$(libsystemd_journal_la_SOURCES) \
|
||||||
|
src/journal/journald-kmsg.c \
|
||||||
|
src/journal/journald-kmsg.h \
|
||||||
|
src/journal/journald-syslog.c \
|
||||||
|
src/journal/journald-syslog.h \
|
||||||
|
src/journal/journald-stream.c \
|
||||||
|
src/journal/journald-stream.h \
|
||||||
|
src/journal/journald-server.c \
|
||||||
|
src/journal/journald-server.h \
|
||||||
|
src/journal/journald-console.c \
|
||||||
|
src/journal/journald-console.h \
|
||||||
|
src/journal/journald-native.c \
|
||||||
|
src/journal/journald-native.h \
|
||||||
|
src/journal/journald-rate-limit.c \
|
||||||
|
src/journal/journald-rate-limit.h \
|
||||||
|
src/journal/journal-internal.h
|
||||||
|
|
||||||
libsystemd_journal_internal_la_CFLAGS = \
|
libsystemd_journal_internal_la_CFLAGS = \
|
||||||
$(AM_CFLAGS)
|
$(AM_CFLAGS)
|
||||||
|
|
||||||
libsystemd_journal_internal_la_LIBADD =
|
libsystemd_journal_internal_la_LIBADD = \
|
||||||
|
libsystemd-label.la \
|
||||||
|
libsystemd-audit.la \
|
||||||
|
libsystemd-daemon.la \
|
||||||
|
libudev.la
|
||||||
|
|
||||||
|
nodist_libsystemd_journal_internal_la_SOURCES = \
|
||||||
|
src/journal/journald-gperf.c
|
||||||
|
|
||||||
|
if ENABLE_LOGIND
|
||||||
|
libsystemd_journal_internal_la_LIBADD += \
|
||||||
|
libsystemd-login-internal.la
|
||||||
|
endif
|
||||||
|
|
||||||
|
if HAVE_ACL
|
||||||
|
libsystemd_journal_internal_la_LIBADD += \
|
||||||
|
libsystemd-acl.la
|
||||||
|
endif
|
||||||
|
|
||||||
if HAVE_XZ
|
if HAVE_XZ
|
||||||
libsystemd_journal_la_SOURCES += \
|
libsystemd_journal_la_SOURCES += \
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
#include "journald-console.h"
|
#include "journald-console.h"
|
||||||
|
|
||||||
void server_forward_console(
|
void server_forward_console(
|
||||||
|
@ -21,6 +21,6 @@
|
|||||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
|
|
||||||
void server_forward_console(Server *s, int priority, const char *identifier, const char *message, struct ucred *ucred);
|
void server_forward_console(Server *s, int priority, const char *identifier, const char *message, struct ucred *ucred);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include "conf-parser.h"
|
#include "conf-parser.h"
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
%}
|
%}
|
||||||
struct ConfigPerfItem;
|
struct ConfigPerfItem;
|
||||||
%null_strings
|
%null_strings
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <systemd/sd-messages.h>
|
#include <systemd/sd-messages.h>
|
||||||
#include <libudev.h>
|
#include <libudev.h>
|
||||||
|
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
#include "journald-kmsg.h"
|
#include "journald-kmsg.h"
|
||||||
#include "journald-syslog.h"
|
#include "journald-syslog.h"
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
|
|
||||||
int server_open_dev_kmsg(Server *s);
|
int server_open_dev_kmsg(Server *s);
|
||||||
int server_read_dev_kmsg(Server *s);
|
int server_read_dev_kmsg(Server *s);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
#include "path-util.h"
|
#include "path-util.h"
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
#include "journald-native.h"
|
#include "journald-native.h"
|
||||||
#include "journald-kmsg.h"
|
#include "journald-kmsg.h"
|
||||||
#include "journald-console.h"
|
#include "journald-console.h"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
|
|
||||||
void server_process_native_message(Server *s, const void *buffer, size_t buffer_size, struct ucred *ucred, struct timeval *tv, const char *label, size_t label_len);
|
void server_process_native_message(Server *s, const void *buffer, size_t buffer_size, struct ucred *ucred, struct timeval *tv, const char *label, size_t label_len);
|
||||||
|
|
||||||
|
1502
src/journal/journald-server.c
Normal file
1502
src/journal/journald-server.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <sys/epoll.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
@ -139,3 +140,13 @@ int config_parse_split_mode(const char *filename, unsigned line, const char *sec
|
|||||||
|
|
||||||
const char *split_mode_to_string(SplitMode s);
|
const char *split_mode_to_string(SplitMode s);
|
||||||
SplitMode split_mode_from_string(const char *s);
|
SplitMode split_mode_from_string(const char *s);
|
||||||
|
|
||||||
|
void server_fix_perms(Server *s, JournalFile *f, uid_t uid);
|
||||||
|
bool shall_try_append_again(JournalFile *f, int r);
|
||||||
|
int server_init(Server *s);
|
||||||
|
void server_done(Server *s);
|
||||||
|
void server_vacuum(Server *s);
|
||||||
|
void server_rotate(Server *s);
|
||||||
|
int server_flush_to_var(Server *s);
|
||||||
|
int process_event(Server *s, struct epoll_event *ev);
|
||||||
|
void server_maybe_append_tags(Server *s);
|
@ -29,7 +29,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
#include "journald-stream.h"
|
#include "journald-stream.h"
|
||||||
#include "journald-syslog.h"
|
#include "journald-syslog.h"
|
||||||
#include "journald-kmsg.h"
|
#include "journald-kmsg.h"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
|
|
||||||
int server_open_stdout_socket(Server *s);
|
int server_open_stdout_socket(Server *s);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "systemd/sd-messages.h"
|
#include "systemd/sd-messages.h"
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
#include "journald-syslog.h"
|
#include "journald-syslog.h"
|
||||||
#include "journald-kmsg.h"
|
#include "journald-kmsg.h"
|
||||||
#include "journald-console.h"
|
#include "journald-console.h"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include "journald.h"
|
#include "journald-server.h"
|
||||||
|
|
||||||
int syslog_fixup_facility(int priority);
|
int syslog_fixup_facility(int priority);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user