[systemd-commits] 4 commits - src/libsystemd src/libsystemd-terminal
David Herrmann
dvdhrm at kemper.freedesktop.org
Mon Sep 29 06:45:33 PDT 2014
src/libsystemd-terminal/sysview-internal.h | 1
src/libsystemd-terminal/sysview.c | 34 ++++++++++++++++++++++
src/libsystemd-terminal/sysview.h | 2 +
src/libsystemd/sd-bus/kdbus.h | 3 -
src/libsystemd/sd-bus/test-bus-kernel-benchmark.c | 2 -
5 files changed, 39 insertions(+), 3 deletions(-)
New commits:
commit 1679ddc4601982a5b3a852c7ac75277e98781136
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Mon Sep 29 15:44:44 2014 +0200
bus: use 2M as maximum message size in benchmark
The kdbus limit is 2M and we removed the bus-owner override. Therefore,
use at most 2M as message size.
diff --git a/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c b/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
index cd88e67..35f87e9 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
@@ -33,7 +33,7 @@
#include "bus-internal.h"
#include "bus-util.h"
-#define MAX_SIZE (4*1024*1024)
+#define MAX_SIZE (2*1024*1024)
static usec_t arg_loop_usec = 100 * USEC_PER_MSEC;
commit bfd6d8a322414a7ebd1a64a717c1834e6cb00d7d
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Mon Sep 29 15:36:20 2014 +0200
terminal: add helper to retrieve the seat of a session
Allow sysview users to retrieve the seat that a session is assigned to.
diff --git a/src/libsystemd-terminal/sysview.c b/src/libsystemd-terminal/sysview.c
index 919fadf..70a6ca7 100644
--- a/src/libsystemd-terminal/sysview.c
+++ b/src/libsystemd-terminal/sysview.c
@@ -267,6 +267,12 @@ const char *sysview_session_get_name(sysview_session *session) {
return session->name;
}
+sysview_seat *sysview_session_get_seat(sysview_session *session) {
+ assert_return(session, NULL);
+
+ return session->seat;
+}
+
static int session_take_control_fn(sd_bus *bus,
sd_bus_message *reply,
void *userdata,
diff --git a/src/libsystemd-terminal/sysview.h b/src/libsystemd-terminal/sysview.h
index 31b800f..cad603d 100644
--- a/src/libsystemd-terminal/sysview.h
+++ b/src/libsystemd-terminal/sysview.h
@@ -128,6 +128,7 @@ void sysview_session_set_userdata(sysview_session *session, void *userdata);
void *sysview_session_get_userdata(sysview_session *session);
const char *sysview_session_get_name(sysview_session *session);
+sysview_seat *sysview_session_get_seat(sysview_session *session);
int sysview_session_take_control(sysview_session *session);
void sysview_session_release_control(sysview_session *session);
commit 8bf4a42a2efcc53479a422e97240ce347dc3ffae
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Mon Sep 29 15:35:51 2014 +0200
bus: sync kdbus.h (ABI break!)
diff --git a/src/libsystemd/sd-bus/kdbus.h b/src/libsystemd/sd-bus/kdbus.h
index 77a153b..7fb1171 100644
--- a/src/libsystemd/sd-bus/kdbus.h
+++ b/src/libsystemd/sd-bus/kdbus.h
@@ -4,6 +4,7 @@
* Copyright (C) 2013-2014 Linux Foundation
* Copyright (C) 2013-2014 Lennart Poettering
* Copyright (C) 2013-2014 Daniel Mack <daniel at zonque.org>
+ * Copyright (C) 2013-2014 David Herrmann <dh.herrmann at gmail.com>
*
* kdbus is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
@@ -212,7 +213,6 @@ struct kdbus_policy_access {
* bloom filter
* @KDBUS_ITEM_DST_NAME: Destination's well-known name
* @KDBUS_ITEM_MAKE_NAME: Name of domain, bus, endpoint
- * @KDBUS_ITEM_MEMFD_NAME: The human readable name of a memfd (debugging)
* @KDBUS_ITEM_ATTACH_FLAGS: Attach-flags, used for updating which metadata
* a connection subscribes to
* @_KDBUS_ITEM_ATTACH_BASE: Start of metadata attach items
@@ -253,7 +253,6 @@ enum kdbus_item_type {
KDBUS_ITEM_BLOOM_MASK,
KDBUS_ITEM_DST_NAME,
KDBUS_ITEM_MAKE_NAME,
- KDBUS_ITEM_MEMFD_NAME,
KDBUS_ITEM_ATTACH_FLAGS,
_KDBUS_ITEM_ATTACH_BASE = 0x1000,
commit 1c7830cc105bfe217abe6f304f4785bbeab209f6
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Mon Sep 29 14:59:01 2014 +0200
terminal: add sysview_seat_switch_to()
Add helper to perform session switches on a specific seat whenever we
retrieve a VT-switch keyboard event.
diff --git a/src/libsystemd-terminal/sysview-internal.h b/src/libsystemd-terminal/sysview-internal.h
index d9f7fe3..39ff933 100644
--- a/src/libsystemd-terminal/sysview-internal.h
+++ b/src/libsystemd-terminal/sysview-internal.h
@@ -88,6 +88,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(sysview_session*, sysview_session_free);
struct sysview_seat {
sysview_context *context;
char *name;
+ char *path;
Hashmap *session_map;
Hashmap *device_map;
diff --git a/src/libsystemd-terminal/sysview.c b/src/libsystemd-terminal/sysview.c
index cd776f6..919fadf 100644
--- a/src/libsystemd-terminal/sysview.c
+++ b/src/libsystemd-terminal/sysview.c
@@ -391,6 +391,10 @@ int sysview_seat_new(sysview_seat **out, sysview_context *c, const char *name) {
if (!seat->name)
return -ENOMEM;
+ r = sd_bus_path_encode("/org/freedesktop/login1/seat", seat->name, &seat->path);
+ if (r < 0)
+ return r;
+
seat->session_map = hashmap_new(&string_hash_ops);
if (!seat->session_map)
return -ENOMEM;
@@ -422,6 +426,7 @@ sysview_seat *sysview_seat_free(sysview_seat *seat) {
hashmap_free(seat->device_map);
hashmap_free(seat->session_map);
+ free(seat->path);
free(seat->name);
free(seat);
@@ -434,6 +439,29 @@ const char *sysview_seat_get_name(sysview_seat *seat) {
return seat->name;
}
+int sysview_seat_switch_to(sysview_seat *seat, uint32_t nr) {
+ _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
+ int r;
+
+ assert_return(seat, -EINVAL);
+ assert_return(seat->context->sysbus, -EINVAL);
+
+ r = sd_bus_message_new_method_call(seat->context->sysbus,
+ &m,
+ "org.freedesktop.login1",
+ seat->path,
+ "org.freedesktop.login1.Seat",
+ "SwitchTo");
+ if (r < 0)
+ return r;
+
+ r = sd_bus_message_append(m, "u", nr);
+ if (r < 0)
+ return r;
+
+ return sd_bus_send(seat->context->sysbus, m, NULL);
+}
+
/*
* Contexts
*/
diff --git a/src/libsystemd-terminal/sysview.h b/src/libsystemd-terminal/sysview.h
index f691e49..31b800f 100644
--- a/src/libsystemd-terminal/sysview.h
+++ b/src/libsystemd-terminal/sysview.h
@@ -137,6 +137,7 @@ void sysview_session_release_control(sysview_session *session);
*/
const char *sysview_seat_get_name(sysview_seat *seat);
+int sysview_seat_switch_to(sysview_seat *seat, uint32_t nr);
/*
* Contexts
More information about the systemd-commits
mailing list