summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am11
-rw-r--r--man/systemd-cgtop.xml5
-rw-r--r--src/libsystemd/.gitignore1
-rw-r--r--src/libsystemd/libsystemd.sym (renamed from src/libsystemd/libsystemd.sym.m4)38
-rw-r--r--src/login/logind-button.c2
-rw-r--r--src/login/logind-core.c49
-rw-r--r--src/login/logind-dbus.c2
-rw-r--r--src/login/logind.h4
8 files changed, 53 insertions, 59 deletions
diff --git a/Makefile.am b/Makefile.am
index 2a79a2a683..6594cabdf6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2841,6 +2841,7 @@ libsystemd_internal_la_SOURCES = \
src/systemd/sd-network.h \
src/systemd/sd-hwdb.h \
src/systemd/sd-device.h \
+ src/libsystemd/libsystemd.sym \
src/libsystemd/sd-bus/sd-bus.c \
src/libsystemd/sd-bus/bus-control.c \
src/libsystemd/sd-bus/bus-control.h \
@@ -2917,9 +2918,6 @@ libsystemd_internal_la_SOURCES = \
src/libsystemd/sd-resolve/sd-resolve.c \
src/libsystemd/sd-resolve/resolve-util.h
-nodist_libsystemd_internal_la_SOURCES = \
- src/libsystemd/libsystemd.sym
-
libsystemd_internal_la_LIBADD = \
libbasic.la \
-lresolv
@@ -2928,14 +2926,10 @@ noinst_LTLIBRARIES += \
libsystemd-internal.la
EXTRA_DIST += \
- src/libsystemd/libsystemd.sym.m4 \
src/libsystemd/libsystemd.pc.in \
src/libsystemd/sd-bus/DIFFERENCES \
src/libsystemd/sd-bus/GVARIANT-SERIALIZATION
-BUILT_SOURCES += \
- src/libsystemd/libsystemd.sym
-
libsystemd_la_SOURCES = \
$(libsystemd_internal_la_SOURCES) \
$(libsystemd_journal_internal_la_SOURCES)
@@ -2950,7 +2944,7 @@ libsystemd_la_CFLAGS = \
libsystemd_la_LDFLAGS = \
$(AM_LDFLAGS) \
-version-info $(LIBSYSTEMD_CURRENT):$(LIBSYSTEMD_REVISION):$(LIBSYSTEMD_AGE) \
- -Wl,--version-script=$(top_builddir)/src/libsystemd/libsystemd.sym
+ -Wl,--version-script=$(top_srcdir)/src/libsystemd/libsystemd.sym
libsystemd_la_LIBADD = \
$(libsystemd_internal_la_LIBADD) \
@@ -5960,6 +5954,7 @@ substitutions = \
'|systemgidmax=$(SYSTEM_GID_MAX)|' \
'|TTY_GID=$(TTY_GID)|' \
'|systemsleepdir=$(systemsleepdir)|' \
+ '|systemshutdowndir=$(systemshutdowndir)|' \
'|binfmtdir=$(binfmtdir)|' \
'|modulesloaddir=$(modulesloaddir)|'
diff --git a/man/systemd-cgtop.xml b/man/systemd-cgtop.xml
index d14564480d..969edd055e 100644
--- a/man/systemd-cgtop.xml
+++ b/man/systemd-cgtop.xml
@@ -85,6 +85,11 @@
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details.</para>
+ <para>The CPU load value can be between 0 and 100 times the number of
+ processors the system has. For example, if the system has 8 processors,
+ the CPU load value is going to be between 0% and 800%. The number of
+ processors can be found in <literal>/proc/cpuinfo</literal>.</para>
+
<para>To emphasize this: unless
<literal>CPUAccounting=1</literal>,
<literal>MemoryAccounting=1</literal> and
diff --git a/src/libsystemd/.gitignore b/src/libsystemd/.gitignore
index d48e1cdd13..50a1692374 100644
--- a/src/libsystemd/.gitignore
+++ b/src/libsystemd/.gitignore
@@ -1,2 +1 @@
-/libsystemd.sym
/libsystemd.pc
diff --git a/src/libsystemd/libsystemd.sym.m4 b/src/libsystemd/libsystemd.sym
index 3121e71282..809db1f6cc 100644
--- a/src/libsystemd/libsystemd.sym.m4
+++ b/src/libsystemd/libsystemd.sym
@@ -459,41 +459,3 @@ global:
sd_event_source_get_signal;
sd_event_source_get_child_pid;
} LIBSYSTEMD_220;
-
-m4_ifdef(`ENABLE_KDBUS',
-LIBSYSTEMD_FUTURE {
-global:
- /* sd-utf8 */
- sd_utf8_is_valid;
- sd_ascii_is_valid;
-
- /* sd-resolve */
- sd_resolve_default;
- sd_resolve_new;
- sd_resolve_ref;
- sd_resolve_unref;
- sd_resolve_get_fd;
- sd_resolve_get_events;
- sd_resolve_get_timeout;
- sd_resolve_process;
- sd_resolve_wait;
- sd_resolve_get_tid;
- sd_resolve_attach_event;
- sd_resolve_detach_event;
- sd_resolve_get_event;
- sd_resolve_getaddrinfo;
- sd_resolve_getnameinfo;
- sd_resolve_res_query;
- sd_resolve_res_search;
- sd_resolve_query_ref;
- sd_resolve_query_unref;
- sd_resolve_query_is_done;
- sd_resolve_query_get_userdata;
- sd_resolve_query_set_userdata;
- sd_resolve_query_get_resolve;
-
- /* sd-path */
- sd_path_home;
- sd_path_search;
-} LIBSYSTEMD_220;
-)
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index 8079d0b5aa..210b889c4f 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -100,7 +100,7 @@ static void button_lid_switch_handle_action(Manager *manager, bool is_edge) {
assert(manager);
/* If we are docked, handle the lid switch differently */
- if (manager_is_docked_or_multiple_displays(manager))
+ if (manager_is_docked_or_external_displays(manager))
handle_action = manager->handle_lid_switch_docked;
else
handle_action = manager->handle_lid_switch;
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
index f9e6ddfb3f..a6c01f7d85 100644
--- a/src/login/logind-core.c
+++ b/src/login/logind-core.c
@@ -477,7 +477,7 @@ int manager_spawn_autovt(Manager *m, unsigned int vtnr) {
return r;
}
-bool manager_is_docked(Manager *m) {
+static bool manager_is_docked(Manager *m) {
Iterator i;
Button *b;
@@ -488,7 +488,7 @@ bool manager_is_docked(Manager *m) {
return false;
}
-int manager_count_displays(Manager *m) {
+static int manager_count_external_displays(Manager *m) {
_cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
@@ -510,7 +510,8 @@ int manager_count_displays(Manager *m) {
udev_list_entry_foreach(item, first) {
_cleanup_udev_device_unref_ struct udev_device *d = NULL;
struct udev_device *p;
- const char *status;
+ const char *status, *enabled, *dash, *nn, *i;
+ bool external = false;
d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item));
if (!d)
@@ -526,6 +527,40 @@ int manager_count_displays(Manager *m) {
if (!streq_ptr(udev_device_get_subsystem(p), "drm"))
continue;
+ nn = udev_device_get_sysname(d);
+ if (!nn)
+ continue;
+
+ /* Ignore internal displays: the type is encoded in
+ * the sysfs name, as the second dash seperated item
+ * (the first is the card name, the last the connector
+ * number). We implement a whitelist of external
+ * displays here, rather than a whitelist, to ensure
+ * we don't block suspends too eagerly. */
+ dash = strchr(nn, '-');
+ if (!dash)
+ continue;
+
+ dash++;
+ FOREACH_STRING(i, "VGA-", "DVI-I-", "DVI-D-", "DVI-A-"
+ "Composite-", "SVIDEO-", "Component-",
+ "DIN-", "DP-", "HDMI-A-", "HDMI-B-", "TV-") {
+
+ if (startswith(dash, i)) {
+ external = true;
+ break;
+ }
+ }
+ if (!external)
+ continue;
+
+ /* Ignore ports that are not enabled */
+ enabled = udev_device_get_sysattr_value(d, "enabled");
+ if (!enabled)
+ continue;
+ if (!streq_ptr(enabled, "enabled"))
+ continue;
+
/* We count any connector which is not explicitly
* "disconnected" as connected. */
status = udev_device_get_sysattr_value(d, "status");
@@ -536,7 +571,7 @@ int manager_count_displays(Manager *m) {
return n;
}
-bool manager_is_docked_or_multiple_displays(Manager *m) {
+bool manager_is_docked_or_external_displays(Manager *m) {
int n;
/* If we are docked don't react to lid closing */
@@ -547,11 +582,11 @@ bool manager_is_docked_or_multiple_displays(Manager *m) {
/* If we have more than one display connected,
* assume that we are docked. */
- n = manager_count_displays(m);
+ n = manager_count_external_displays(m);
if (n < 0)
log_warning_errno(n, "Display counting failed: %m");
- else if (n > 1) {
- log_debug("Multiple (%i) displays connected.", n);
+ else if (n >= 1) {
+ log_debug("External (%i) displays connected.", n);
return true;
}
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index e6f9ec7845..8ebcd3f5ca 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -258,7 +258,7 @@ static int property_get_docked(
assert(reply);
assert(m);
- return sd_bus_message_append(reply, "b", manager_is_docked_or_multiple_displays(m));
+ return sd_bus_message_append(reply, "b", manager_is_docked_or_external_displays(m));
}
static int method_get_session(sd_bus_message *message, void *userdata, sd_bus_error *error) {
diff --git a/src/login/logind.h b/src/login/logind.h
index cd226f55fc..feb381d0b1 100644
--- a/src/login/logind.h
+++ b/src/login/logind.h
@@ -156,9 +156,7 @@ int manager_get_idle_hint(Manager *m, dual_timestamp *t);
int manager_get_user_by_pid(Manager *m, pid_t pid, User **user);
int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session);
-bool manager_is_docked(Manager *m);
-int manager_count_displays(Manager *m);
-bool manager_is_docked_or_multiple_displays(Manager *m);
+bool manager_is_docked_or_external_displays(Manager *m);
extern const sd_bus_vtable manager_vtable[];