Commit 82863656 authored by Hans de Goede's avatar Hans de Goede

systemd-logind: Add systemd-logind "core"

This commits add the bulk of the systemd-logind integration code, but does
not hook it up yet other then calling its init and fini functions, which
don't do that much.

Note the configure bits check for udev since systemd-logind use will only be
supported in combination with udev. Besides that it only checks for dbus
since all communication with systemd-logind is happening over dbus, so
no further libs are needed.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 5fb641a2
......@@ -626,6 +626,7 @@ AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg
AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes])
AC_ARG_ENABLE(systemd-logind, AC_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
......@@ -901,6 +902,26 @@ if test "x$CONFIG_HAL" = xyes; then
fi
AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
if test "x$SYSTEMD_LOGIND" = xauto; then
if test "x$HAVE_DBUS" = xyes -a "x$CONFIG_UDEV" = xyes ; then
SYSTEMD_LOGIND=yes
else
SYSTEMD_LOGIND=no
fi
fi
if test "x$SYSTEMD_LOGIND" = xyes; then
if ! test "x$HAVE_DBUS" = xyes; then
AC_MSG_ERROR([systemd-logind requested, but D-Bus is not installed.])
fi
if ! test "x$CONFIG_UDEV" = xyes ; then
AC_MSG_ERROR([systemd-logind is only supported in combination with udev configuration.])
fi
AC_DEFINE(SYSTEMD_LOGIND, 1, [Enable systemd-logind integration])
NEED_DBUS="yes"
fi
AM_CONDITIONAL(SYSTEMD_LOGIND, [test "x$SYSTEMD_LOGIND" = xyes])
if test "x$NEED_DBUS" = xyes; then
AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core])
fi
......
......@@ -54,6 +54,7 @@
#include "site.h"
#include "mi.h"
#include "dbus-core.h"
#include "systemd-logind.h"
#include "compiler.h"
......@@ -458,6 +459,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
DoShowOptions();
dbus_core_init();
systemd_logind_init();
/* Do a general bus probe. This will be a PCI probe for x86 platforms */
xf86BusProbe();
......@@ -1062,6 +1064,7 @@ ddxGiveUp(enum ExitCode error)
if (xorgHWOpenConsole)
xf86CloseConsole();
systemd_logind_fini();
dbus_core_fini();
xf86CloseLog(error);
......
......@@ -52,7 +52,7 @@ int platformSlotClaimed;
int xf86_num_platform_devices;
static struct xf86_platform_device *xf86_platform_devices;
struct xf86_platform_device *xf86_platform_devices;
int
xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned)
......
......@@ -36,12 +36,14 @@ struct xf86_platform_device {
/* xf86_platform_device flags */
#define XF86_PDEV_UNOWNED 0x01
#define XF86_PDEV_SERVER_FD 0x02
#define XF86_PDEV_PAUSED 0x04
#ifdef XSERVER_PLATFORM_BUS
int xf86platformProbe(void);
int xf86platformProbeDev(DriverPtr drvp);
extern int xf86_num_platform_devices;
extern struct xf86_platform_device *xf86_platform_devices;
extern char *
xf86_get_platform_attrib(int index, int attrib_id);
......
......@@ -21,6 +21,11 @@ APM_SRCS = lnx_apm.c
XORG_CFLAGS += -DHAVE_APM
endif
if SYSTEMD_LOGIND
LOGIND_SRCS = systemd-logind.c
XORG_CFLAGS += $(DBUS_CFLAGS)
endif
liblinux_la_SOURCES = lnx_init.c lnx_video.c \
lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \
$(srcdir)/../shared/bios_mmap.c \
......@@ -30,6 +35,7 @@ liblinux_la_SOURCES = lnx_init.c lnx_video.c \
$(srcdir)/../shared/sigio.c \
$(ACPI_SRCS) \
$(APM_SRCS) \
$(LOGIND_SRCS) \
$(PLATFORM_PCI_SUPPORT)
AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES)
......
This diff is collapsed.
......@@ -72,4 +72,5 @@ EXTRA_DIST = \
dix-config-apple-verbatim.h \
dixfontstubs.h eventconvert.h eventstr.h inpututils.h \
protocol-versions.h \
systemd-logind.h \
xsha1.h
......@@ -420,6 +420,9 @@
/* Support HAL for hotplug */
#undef CONFIG_HAL
/* Enable systemd-logind integration */
#undef SYSTEMD_LOGIND 1
/* Have a monotonic clock from clock_gettime() */
#undef MONOTONIC_CLOCK
......
/*
* Copyright © 2013 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Hans de Goede <hdegoede@redhat.com>
*/
#ifndef SYSTEMD_LOGIND_H
#define SYSTEMD_LOGIND_H
#ifdef SYSTEMD_LOGIND
int systemd_logind_init(void);
void systemd_logind_fini(void);
int systemd_logind_take_fd(int major, int minor, const char *path, Bool *paus);
void systemd_logind_release_fd(int major, int minor);
int systemd_logind_controls_session(void);
void systemd_logind_vtenter(void);
#else
#define systemd_logind_init()
#define systemd_logind_fini()
#define systemd_logind_take_fd(major, minor, path) -1
#define systemd_logind_release_fd(dev)
#define systemd_logind_controls_session() 0
#define systemd_logind_vtenter()
#endif
#endif
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