Commit 114a50f8 authored by Lennart Poettering's avatar Lennart Poettering
Browse files

sd-daemon: turn sd-daemon.c into a shared library

parent d40c9816
libsystemd-daemon.pc
libsystemd-login.pc libsystemd-login.pc
test-login test-login
systemd-loginctl systemd-loginctl
......
...@@ -23,6 +23,10 @@ LIBSYSTEMD_LOGIN_CURRENT=0 ...@@ -23,6 +23,10 @@ LIBSYSTEMD_LOGIN_CURRENT=0
LIBSYSTEMD_LOGIN_REVISION=0 LIBSYSTEMD_LOGIN_REVISION=0
LIBSYSTEMD_LOGIN_AGE=0 LIBSYSTEMD_LOGIN_AGE=0
LIBSYSTEMD_DAEMON_CURRENT=0
LIBSYSTEMD_DAEMON_REVISION=0
LIBSYSTEMD_DAEMON_AGE=0
# Dirs of external packages # Dirs of external packages
dbuspolicydir=@dbuspolicydir@ dbuspolicydir=@dbuspolicydir@
dbussessionservicedir=@dbussessionservicedir@ dbussessionservicedir=@dbussessionservicedir@
...@@ -189,6 +193,7 @@ systemgenerator_PROGRAMS += \ ...@@ -189,6 +193,7 @@ systemgenerator_PROGRAMS += \
endif endif
lib_LTLIBRARIES = \ lib_LTLIBRARIES = \
libsystemd-daemon.la \
libsystemd-login.la libsystemd-login.la
pkginclude_HEADERS = \ pkginclude_HEADERS = \
...@@ -422,6 +427,7 @@ EXTRA_DIST = \ ...@@ -422,6 +427,7 @@ EXTRA_DIST = \
units/quotacheck.service.in \ units/quotacheck.service.in \
units/user@.service.in \ units/user@.service.in \
systemd.pc.in \ systemd.pc.in \
libsystemd-daemon.pc.in \
libsystemd-login.pc.in \ libsystemd-login.pc.in \
introspect.awk \ introspect.awk \
src/73-seat-late.rules.in src/73-seat-late.rules.in
...@@ -486,6 +492,7 @@ dist_doc_DATA = \ ...@@ -486,6 +492,7 @@ dist_doc_DATA = \
pkgconfigdata_DATA = \ pkgconfigdata_DATA = \
systemd.pc \ systemd.pc \
libsystemd-daemon.pc \
libsystemd-login.pc libsystemd-login.pc
# Passed through intltool only # Passed through intltool only
...@@ -511,8 +518,7 @@ EXTRA_DIST += \ ...@@ -511,8 +518,7 @@ EXTRA_DIST += \
noinst_LTLIBRARIES = \ noinst_LTLIBRARIES = \
libsystemd-basic.la \ libsystemd-basic.la \
libsystemd-core.la \ libsystemd-core.la
libsystemd-daemon.la
libsystemd_basic_la_SOURCES = \ libsystemd_basic_la_SOURCES = \
src/util.c \ src/util.c \
...@@ -601,9 +607,6 @@ libsystemd_core_la_LIBADD = \ ...@@ -601,9 +607,6 @@ libsystemd_core_la_LIBADD = \
$(PAM_LIBS) \ $(PAM_LIBS) \
$(AUDIT_LIBS) $(AUDIT_LIBS)
libsystemd_daemon_la_SOURCES = \
src/sd-daemon.c
# This is needed because automake is buggy in how it generates the # This is needed because automake is buggy in how it generates the
# rules for C programs, but not Vala programs. We therefore can't # rules for C programs, but not Vala programs. We therefore can't
# list the .h files as dependencies if we want make dist to work. # list the .h files as dependencies if we want make dist to work.
...@@ -1364,18 +1367,30 @@ pam_systemd_la_LIBADD = \ ...@@ -1364,18 +1367,30 @@ pam_systemd_la_LIBADD = \
$(PAM_LIBS) \ $(PAM_LIBS) \
$(DBUS_LIBS) $(DBUS_LIBS)
libsystemd_login_la_CFLAGS = \ libsystemd_daemon_la_SOURCES = \
src/sd-daemon.c
libsystemd_daemon_la_CFLAGS = \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
-fvisibility=hidden -fvisibility=hidden \
-DSD_EXPORT_SYMBOLS
libsystemd_login_la_LDFLAGS = \ libsystemd_daemon_la_LDFLAGS = \
-shared \ -shared \
-version-info $(LIBSYSTEMD_LOGIN_CURRENT):$(LIBSYSTEMD_LOGIN_REVISION):$(LIBSYSTEMD_LOGIN_AGE) -version-info $(LIBSYSTEMD_DAEMON_CURRENT):$(LIBSYSTEMD_DAEMON_REVISION):$(LIBSYSTEMD_DAEMON_AGE)
libsystemd_login_la_SOURCES = \ libsystemd_login_la_SOURCES = \
src/sd-login.c \ src/sd-login.c \
src/cgroup-util.c src/cgroup-util.c
libsystemd_login_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=hidden
libsystemd_login_la_LDFLAGS = \
-shared \
-version-info $(LIBSYSTEMD_LOGIN_CURRENT):$(LIBSYSTEMD_LOGIN_REVISION):$(LIBSYSTEMD_LOGIN_AGE)
libsystemd_login_la_LIBADD = \ libsystemd_login_la_LIBADD = \
libsystemd-basic.la libsystemd-basic.la
...@@ -1512,22 +1527,22 @@ endif ...@@ -1512,22 +1527,22 @@ endif
DBUS_PREPROCESS = $(CPP) -P $(DBUS_CFLAGS) -imacros dbus/dbus-protocol.h DBUS_PREPROCESS = $(CPP) -P $(DBUS_CFLAGS) -imacros dbus/dbus-protocol.h
org.freedesktop.systemd1.%.xml: systemd org.freedesktop.systemd1.%.xml: systemd
$(AM_V_GEN)$(OBJCOPY) -O binary -j introspect.$* $< $@.tmp && \ $(AM_V_GEN)$(LIBTOOL) --mode=execute $(OBJCOPY) -O binary -j introspect.$* $< $@.tmp && \
$(STRINGS) $@.tmp | $(AWK) -f $(srcdir)/introspect.awk | \ $(STRINGS) $@.tmp | $(AWK) -f $(srcdir)/introspect.awk | \
$(DBUS_PREPROCESS) -o $@ - && rm $@.tmp $(DBUS_PREPROCESS) -o $@ - && rm $@.tmp
org.freedesktop.hostname1.xml: systemd-hostnamed org.freedesktop.hostname1.xml: systemd-hostnamed
$(AM_V_GEN)$(OBJCOPY) -O binary -j introspect.hostname1 $< $@.tmp && \ $(AM_V_GEN)$(LIBTOOL) --mode=execute $(OBJCOPY) -O binary -j introspect.hostname1 $< $@.tmp && \
$(STRINGS) $@.tmp | $(AWK) -f $(srcdir)/introspect.awk | \ $(STRINGS) $@.tmp | $(AWK) -f $(srcdir)/introspect.awk | \
$(DBUS_PREPROCESS) -o $@ - && rm $@.tmp $(DBUS_PREPROCESS) -o $@ - && rm $@.tmp
org.freedesktop.locale1.xml: systemd-localed org.freedesktop.locale1.xml: systemd-localed
$(AM_V_GEN)$(OBJCOPY) -O binary -j introspect.locale1 $< $@.tmp && \ $(AM_V_GEN)$(LIBTOOL) --mode=execute $(OBJCOPY) -O binary -j introspect.locale1 $< $@.tmp && \
$(STRINGS) $@.tmp | $(AWK) -f $(srcdir)/introspect.awk | \ $(STRINGS) $@.tmp | $(AWK) -f $(srcdir)/introspect.awk | \
$(DBUS_PREPROCESS) -o $@ - && rm $@.tmp $(DBUS_PREPROCESS) -o $@ - && rm $@.tmp
org.freedesktop.timedate1.xml: systemd-timedated org.freedesktop.timedate1.xml: systemd-timedated
$(AM_V_GEN)$(OBJCOPY) -O binary -j introspect.timedate1 $< $@.tmp && \ $(AM_V_GEN)$(LIBTOOL) --mode=execute $(OBJCOPY) -O binary -j introspect.timedate1 $< $@.tmp && \
$(STRINGS) $@.tmp | $(AWK) -f $(srcdir)/introspect.awk | \ $(STRINGS) $@.tmp | $(AWK) -f $(srcdir)/introspect.awk | \
$(DBUS_PREPROCESS) -o $@ - && rm $@.tmp $(DBUS_PREPROCESS) -o $@ - && rm $@.tmp
......
# 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 Daemon Utility Library
URL: @PACKAGE_URL@
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lsystemd-daemon
Cflags: -I${includedir}
...@@ -49,13 +49,19 @@ ...@@ -49,13 +49,19 @@
#include "sd-daemon.h" #include "sd-daemon.h"
#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS) #if (__GNUC__ >= 4)
#define _sd_hidden_ __attribute__ ((visibility("hidden"))) #ifdef SD_EXPORT_SYMBOLS
/* Export symbols */
#define _sd_export_ __attribute__ ((visibility("default")))
#else #else
#define _sd_hidden_ /* Don't export the symbols */
#define _sd_export_ __attribute__ ((visibility("hidden")))
#endif
#else
#define _sd_export_
#endif #endif
_sd_hidden_ int sd_listen_fds(int unset_environment) { _sd_export_ int sd_listen_fds(int unset_environment) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__) #if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 0; return 0;
...@@ -136,7 +142,7 @@ finish: ...@@ -136,7 +142,7 @@ finish:
#endif #endif
} }
_sd_hidden_ int sd_is_fifo(int fd, const char *path) { _sd_export_ int sd_is_fifo(int fd, const char *path) {
struct stat st_fd; struct stat st_fd;
if (fd < 0) if (fd < 0)
...@@ -169,7 +175,7 @@ _sd_hidden_ int sd_is_fifo(int fd, const char *path) { ...@@ -169,7 +175,7 @@ _sd_hidden_ int sd_is_fifo(int fd, const char *path) {
return 1; return 1;
} }
_sd_hidden_ int sd_is_special(int fd, const char *path) { _sd_export_ int sd_is_special(int fd, const char *path) {
struct stat st_fd; struct stat st_fd;
if (fd < 0) if (fd < 0)
...@@ -256,7 +262,7 @@ union sockaddr_union { ...@@ -256,7 +262,7 @@ union sockaddr_union {
struct sockaddr_storage storage; struct sockaddr_storage storage;
}; };
_sd_hidden_ int sd_is_socket(int fd, int family, int type, int listening) { _sd_export_ int sd_is_socket(int fd, int family, int type, int listening) {
int r; int r;
if (family < 0) if (family < 0)
...@@ -284,7 +290,7 @@ _sd_hidden_ int sd_is_socket(int fd, int family, int type, int listening) { ...@@ -284,7 +290,7 @@ _sd_hidden_ int sd_is_socket(int fd, int family, int type, int listening) {
return 1; return 1;
} }
_sd_hidden_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { _sd_export_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
union sockaddr_union sockaddr; union sockaddr_union sockaddr;
socklen_t l; socklen_t l;
int r; int r;
...@@ -329,7 +335,7 @@ _sd_hidden_ int sd_is_socket_inet(int fd, int family, int type, int listening, u ...@@ -329,7 +335,7 @@ _sd_hidden_ int sd_is_socket_inet(int fd, int family, int type, int listening, u
return 1; return 1;
} }
_sd_hidden_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { _sd_export_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
union sockaddr_union sockaddr; union sockaddr_union sockaddr;
socklen_t l; socklen_t l;
int r; int r;
...@@ -372,7 +378,7 @@ _sd_hidden_ int sd_is_socket_unix(int fd, int type, int listening, const char *p ...@@ -372,7 +378,7 @@ _sd_hidden_ int sd_is_socket_unix(int fd, int type, int listening, const char *p
return 1; return 1;
} }
_sd_hidden_ int sd_is_mq(int fd, const char *path) { _sd_export_ int sd_is_mq(int fd, const char *path) {
#if !defined(__linux__) #if !defined(__linux__)
return 0; return 0;
#else #else
...@@ -409,7 +415,7 @@ _sd_hidden_ int sd_is_mq(int fd, const char *path) { ...@@ -409,7 +415,7 @@ _sd_hidden_ int sd_is_mq(int fd, const char *path) {
#endif #endif
} }
_sd_hidden_ int sd_notify(int unset_environment, const char *state) { _sd_export_ int sd_notify(int unset_environment, const char *state) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) #if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC)
return 0; return 0;
#else #else
...@@ -477,7 +483,7 @@ finish: ...@@ -477,7 +483,7 @@ finish:
#endif #endif
} }
_sd_hidden_ int sd_notifyf(int unset_environment, const char *format, ...) { _sd_export_ int sd_notifyf(int unset_environment, const char *format, ...) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__) #if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 0; return 0;
#else #else
...@@ -499,7 +505,7 @@ _sd_hidden_ int sd_notifyf(int unset_environment, const char *format, ...) { ...@@ -499,7 +505,7 @@ _sd_hidden_ int sd_notifyf(int unset_environment, const char *format, ...) {
#endif #endif
} }
_sd_hidden_ int sd_booted(void) { _sd_export_ int sd_booted(void) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__) #if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 0; return 0;
#else #else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment