[systemd-commits] 4 commits - configure.ac Makefile.am src/core src/network src/shared
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Thu Nov 28 11:40:03 PST 2013
Makefile.am | 4 +
configure.ac | 12 ++-
src/core/swap.c | 2
src/network/networkd-bridge.c | 2
src/shared/virt.c | 140 ++++++++++++++++++++++++------------------
5 files changed, 94 insertions(+), 66 deletions(-)
New commits:
commit df41aaf9a2b195c9a8bb6fca6672cbf25bc147fb
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Nov 28 14:20:07 2013 -0500
Remove some unused variables
diff --git a/src/core/swap.c b/src/core/swap.c
index 1d02eb2..b197eb4 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1182,7 +1182,6 @@ static int swap_dispatch_io(sd_event_source *source, int fd, uint32_t revents, v
}
static Unit *swap_following(Unit *u) {
- _cleanup_free_ char *p = NULL;
Swap *s = SWAP(u);
Swap *other, *first = NULL;
@@ -1336,7 +1335,6 @@ int swap_process_new_device(Manager *m, struct udev_device *dev) {
}
int swap_process_removed_device(Manager *m, struct udev_device *dev) {
- _cleanup_free_ char *e = NULL;
const char *dn;
int r = 0;
Swap *s;
diff --git a/src/network/networkd-bridge.c b/src/network/networkd-bridge.c
index 371c093..e9dceab 100644
--- a/src/network/networkd-bridge.c
+++ b/src/network/networkd-bridge.c
@@ -202,8 +202,6 @@ static int bridge_create(Bridge *bridge) {
}
int bridge_join(Bridge *bridge, Link *link, sd_rtnl_message_handler_t callback) {
- _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *req = NULL;
-
if (bridge->state == BRIDGE_STATE_READY) {
bridge_join_ready(bridge, link, callback);
} else {
commit 0b340bcf0e1e52efb4a5ba1bd4eda8e3349baaed
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Wed Nov 20 15:43:50 2013 -0500
build-sys: use C99
We already use various constructs, so let's just admit that we're using C99.
diff --git a/configure.ac b/configure.ac
index ab24266..db9440d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,10 +60,7 @@ AC_PROG_SED
AC_PROG_GREP
AC_PROG_AWK
-AC_PROG_CC
AC_PROG_CC_C99
-AM_PROG_CC_C_O
-AC_PROG_GCC_TRADITIONAL
AC_PATH_PROG([M4], [m4])
AC_PATH_PROG([XSLTPROC], [xsltproc])
commit bdb628eec6f5d5111251bd1a4d68516cef33d7d0
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Nov 28 13:34:08 2013 -0500
virt: split detect_vm into separate functions
It didn't build on arm. Let's simplify it a bit by
splitting x86 specific parts out, which should also make
things easier when arm virtualization support is added.
diff --git a/src/shared/virt.c b/src/shared/virt.c
index 537ccda..4e18638 100644
--- a/src/shared/virt.c
+++ b/src/shared/virt.c
@@ -27,30 +27,10 @@
#include "virt.h"
#include "fileio.h"
-/* Returns a short identifier for the various VM implementations */
-int detect_vm(const char **id) {
- _cleanup_free_ char *cpuinfo_contents = NULL;
- int r;
-
-#if defined(__i386__) || defined(__x86_64__)
+static int detect_vm_cpuid(const char **_id) {
/* Both CPUID and DMI are x86 specific interfaces... */
-
- static const char *const dmi_vendors[] = {
- "/sys/class/dmi/id/sys_vendor",
- "/sys/class/dmi/id/board_vendor",
- "/sys/class/dmi/id/bios_vendor"
- };
-
- static const char dmi_vendor_table[] =
- "QEMU\0" "qemu\0"
- /* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
- "VMware\0" "vmware\0"
- "VMW\0" "vmware\0"
- "Microsoft Corporation\0" "microsoft\0"
- "innotek GmbH\0" "oracle\0"
- "Xen\0" "xen\0"
- "Bochs\0" "bochs\0";
+#if defined(__i386__) || defined(__x86_64__)
static const char cpuid_vendor_table[] =
"XenVMMXenVMM\0" "xen\0"
@@ -60,40 +40,13 @@ int detect_vm(const char **id) {
/* http://msdn.microsoft.com/en-us/library/ff542428.aspx */
"Microsoft Hv\0" "microsoft\0";
- static __thread int cached_found = -1;
- static __thread const char *cached_id = NULL;
-
uint32_t eax, ecx;
union {
uint32_t sig32[3];
char text[13];
} sig = {};
- unsigned i;
const char *j, *k;
bool hypervisor;
- _cleanup_free_ char *hvtype = NULL;
- const char *_id = NULL;
-
- if (_likely_(cached_found >= 0)) {
-
- if (id)
- *id = cached_id;
-
- return cached_found;
- }
-
- /* Try high-level hypervisor sysfs file first:
- *
- * https://bugs.freedesktop.org/show_bug.cgi?id=61491 */
- r = read_one_line_file("/sys/hypervisor/type", &hvtype);
- if (r >= 0) {
- if (streq(hvtype, "xen")) {
- _id = "xen";
- r = 1;
- goto finish;
- }
- } else if (r != -ENOENT)
- return r;
/* http://lwn.net/Articles/301888/ */
@@ -136,14 +89,44 @@ int detect_vm(const char **id) {
NULSTR_FOREACH_PAIR(j, k, cpuid_vendor_table)
if (streq(sig.text, j)) {
- _id = k;
- r = 1;
- goto finish;
+ *_id = k;
+ return 1;
}
+
+ *_id = "other";
+ return 0;
}
+#endif
+
+ return 0;
+}
+
+static int detect_vm_dmi(const char **_id) {
+
+ /* Both CPUID and DMI are x86 specific interfaces... */
+#if defined(__i386__) || defined(__x86_64__)
+
+ static const char *const dmi_vendors[] = {
+ "/sys/class/dmi/id/sys_vendor",
+ "/sys/class/dmi/id/board_vendor",
+ "/sys/class/dmi/id/bios_vendor"
+ };
+
+ static const char dmi_vendor_table[] =
+ "QEMU\0" "qemu\0"
+ /* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
+ "VMware\0" "vmware\0"
+ "VMW\0" "vmware\0"
+ "Microsoft Corporation\0" "microsoft\0"
+ "innotek GmbH\0" "oracle\0"
+ "Xen\0" "xen\0"
+ "Bochs\0" "bochs\0";
+ unsigned i;
for (i = 0; i < ELEMENTSOF(dmi_vendors); i++) {
_cleanup_free_ char *s = NULL;
+ const char *j, *k;
+ int r;
r = read_one_line_file(dmi_vendors[i], &s);
if (r < 0) {
@@ -155,20 +138,59 @@ int detect_vm(const char **id) {
NULSTR_FOREACH_PAIR(j, k, dmi_vendor_table)
if (startswith(s, j)) {
- _id = k;
- r = 1;
- goto finish;
+ *_id = k;
+ return 1;
}
}
+#endif
- if (hypervisor || hvtype) {
- _id = "other";
+ return 0;
+}
+
+/* Returns a short identifier for the various VM implementations */
+int detect_vm(const char **id) {
+ _cleanup_free_ char *hvtype = NULL, *cpuinfo_contents = NULL;
+ static __thread int cached_found = -1;
+ static __thread const char *cached_id = NULL;
+ const char *_id = NULL;
+ int r;
+
+ if (_likely_(cached_found >= 0)) {
+
+ if (id)
+ *id = cached_id;
+
+ return cached_found;
+ }
+
+ /* Try high-level hypervisor sysfs file first:
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=61491 */
+ r = read_one_line_file("/sys/hypervisor/type", &hvtype);
+ if (r >= 0) {
+ if (streq(hvtype, "xen")) {
+ _id = "xen";
+ r = 1;
+ goto finish;
+ }
+ } else if (r != -ENOENT)
+ return r;
+
+ /* this will set _id to "other" and return 0 for unknown hypervisors */
+ r = detect_vm_cpuid(&_id);
+ if (r != 0)
+ goto finish;
+
+ r = detect_vm_dmi(&_id);
+ if (r != 0)
+ goto finish;
+
+ if (_id) {
+ /* "other" */
r = 1;
goto finish;
}
-#endif
-
/* Detect User-Mode Linux by reading /proc/cpuinfo */
r = read_full_file("/proc/cpuinfo", &cpuinfo_contents, NULL);
if (r < 0)
commit bd441fa27a22b7c6e11d9330560e0622fb69f297
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Nov 28 12:07:29 2013 -0500
build-sys: make multi-seat-x optional
At some point it should become disabled by default.
http://lists.freedesktop.org/archives/systemd-devel/2013-November/014869.html
diff --git a/Makefile.am b/Makefile.am
index 90874df..3598edd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4141,6 +4141,8 @@ MULTI_USER_TARGET_WANTS += \
SYSTEM_UNIT_ALIASES += \
systemd-logind.service dbus-org.freedesktop.login1.service
+if ENABLE_MULTI_SEAT_X
+
systemd_multi_seat_x_SOURCES = \
src/login/multi-seat-x.c
@@ -4151,6 +4153,8 @@ systemd_multi_seat_x_LDADD = \
rootlibexec_PROGRAMS += \
systemd-multi-seat-x
+endif
+
dist_udevrules_DATA += \
src/login/70-uaccess.rules \
src/login/70-power-switch.rules
diff --git a/configure.ac b/configure.ac
index f1b00c5..ab24266 100644
--- a/configure.ac
+++ b/configure.ac
@@ -794,6 +794,14 @@ fi
AM_CONDITIONAL(ENABLE_EFI, [test "x$have_efi" = "xyes"])
# ------------------------------------------------------------------------------
+have_multi_seat_x=no
+AC_ARG_ENABLE(multi_seat_x, AS_HELP_STRING([--disable-multi-seat-x], [do not build multi-seat-x]))
+if test "x$enable_multi_seat_x" != "xno"; then
+ have_multi_seat_x=yes
+fi
+AM_CONDITIONAL(ENABLE_MULTI_SEAT_X, [test "$have_multi_seat_x" = "yes"])
+
+# ------------------------------------------------------------------------------
AC_ARG_WITH(rc-local-script-path-start,
AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
[Path to /etc/rc.local]),
@@ -1077,6 +1085,7 @@ AC_MSG_RESULT([
nss-myhostname: ${have_myhostname}
gudev: ${enable_gudev}
gintrospection: ${enable_introspection}
+ multi-seat-x: ${have_multi_seat_x}
Python: ${have_python}
Python Headers: ${have_python_devel}
man pages: ${have_manpages}
More information about the systemd-commits
mailing list