From: Zbigniew Jędrzejewski-Szmek Date: Fri, 17 Apr 2020 11:57:40 +0000 (+0200) Subject: sd-login: get rid of seat_can_multi_session() X-Git-Tag: v246-rc1~569^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f8cc84ba4612e74cd1e26898c6816e6e60fc4e9;p=thirdparty%2Fsystemd.git sd-login: get rid of seat_can_multi_session() Follow-up for fa2cf64a917d31605d40d34e98ce9e2e066064fa. Backwards-compat is retained. A short note is added in docs, in case people see sd_seat_can_multi_session() mentioned somewhere and wonder what happened to it. Also see https://github.com/systemd/systemd/pull/15337#issuecomment-610369404. --- diff --git a/man/rules/meson.build b/man/rules/meson.build index 97f4fbc0065..ea20a5db3ae 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -665,10 +665,7 @@ manpages = [ 'HAVE_PAM'], ['sd_seat_get_active', '3', - ['sd_seat_can_graphical', - 'sd_seat_can_multi_session', - 'sd_seat_can_tty', - 'sd_seat_get_sessions'], + ['sd_seat_can_graphical', 'sd_seat_can_tty', 'sd_seat_get_sessions'], 'HAVE_PAM'], ['sd_session_is_active', '3', diff --git a/man/sd_seat_get_active.xml b/man/sd_seat_get_active.xml index 2dba6803f1e..cf70b35785a 100644 --- a/man/sd_seat_get_active.xml +++ b/man/sd_seat_get_active.xml @@ -19,7 +19,6 @@ sd_seat_get_active sd_seat_get_sessions - sd_seat_can_multi_session sd_seat_can_tty sd_seat_can_graphical Determine state of a specific seat @@ -44,11 +43,6 @@ unsigned int *n_uids - - int sd_seat_can_multi_session - const char *seat - - int sd_seat_can_tty const char *seat @@ -90,11 +84,6 @@ NULL may be returned and should be considered equivalent to an empty array. - sd_seat_can_multi_session() may be used - to determine whether a specific seat is capable of multi-session, - i.e. allows multiple login sessions in parallel (with only one - being active at a time). - sd_seat_can_tty() may be used to determine whether a specific seat provides TTY functionality, i.e. is useful as a text console. @@ -114,7 +103,7 @@ On success, sd_seat_get_active() returns 0 or a positive integer. On success, sd_seat_get_sessions() returns the number of entries in the session identifier - array. If the test succeeds, sd_seat_can_multi_session, + array. If the test succeeds, sd_seat_can_tty and sd_seat_can_graphical return a positive integer, if it fails 0. On failure, these calls return a negative errno-style error code. @@ -157,6 +146,14 @@ + + History + + In the past, sd_seat_can_multi_session() was used to check whether the seat + supports multiple sessions. All seats support that now, so that function has been deprecated and always + returns true. + + See Also diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 3e96c98cd95..746c895b612 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -746,7 +746,7 @@ static int seat_get_can(const char *seat, const char *variable) { } _public_ int sd_seat_can_multi_session(const char *seat) { - return seat_get_can(seat, "CAN_MULTI_SESSION"); + return true; } _public_ int sd_seat_can_tty(const char *seat) { diff --git a/src/libsystemd/sd-login/test-login.c b/src/libsystemd/sd-login/test-login.c index 49ed2472786..c0c77e04714 100644 --- a/src/libsystemd/sd-login/test-login.c +++ b/src/libsystemd/sd-login/test-login.c @@ -142,8 +142,11 @@ static void test_login(void) { log_info("sd_session_get_seat(\"%s\") → \"%s\"", session, seat); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" r = sd_seat_can_multi_session(seat); - assert_se(r >= 0); +#pragma GCC diagnostic pop + assert_se(r == 1); log_info("sd_session_can_multi_seat(\"%s\") → %s", seat, yes_no(r)); r = sd_seat_can_tty(seat); diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c index 0a5df937cc1..15d4a25a92c 100644 --- a/src/login/logind-seat-dbus.c +++ b/src/login/logind-seat-dbus.c @@ -17,7 +17,7 @@ #include "user-util.h" #include "util.h" -static BUS_DEFINE_PROPERTY_GET(property_get_can_multi_session, "b", Seat, seat_can_multi_session); +static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_const_true, "b", true); static BUS_DEFINE_PROPERTY_GET(property_get_can_tty, "b", Seat, seat_can_tty); static BUS_DEFINE_PROPERTY_GET(property_get_can_graphical, "b", Seat, seat_can_graphical); @@ -296,7 +296,7 @@ const sd_bus_vtable seat_vtable[] = { SD_BUS_PROPERTY("Id", "s", NULL, offsetof(Seat, id), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("ActiveSession", "(so)", property_get_active_session, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), - SD_BUS_PROPERTY("CanMultiSession", "b", property_get_can_multi_session, 0, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("CanMultiSession", "b", property_get_const_true, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN), SD_BUS_PROPERTY("CanTTY", "b", property_get_can_tty, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("CanGraphical", "b", property_get_can_graphical, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("Sessions", "a(so)", property_get_sessions, 0, 0), diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 4d51a326a2a..157fc9423cb 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -104,11 +104,10 @@ int seat_save(Seat *s) { fprintf(f, "# This is private data. Do not parse.\n" "IS_SEAT0=%i\n" - "CAN_MULTI_SESSION=%i\n" + "CAN_MULTI_SESSION=1\n" "CAN_TTY=%i\n" "CAN_GRAPHICAL=%i\n", seat_is_seat0(s), - seat_can_multi_session(s), seat_can_tty(s), seat_can_graphical(s)); @@ -558,13 +557,6 @@ bool seat_is_seat0(Seat *s) { return s->manager->seat0 == s; } -bool seat_can_multi_session(Seat *s) { - assert(s); - - /* multiple sessions are supported on all seats now */ - return true; -} - bool seat_can_tty(Seat *s) { assert(s); diff --git a/src/login/logind-seat.h b/src/login/logind-seat.h index 64cdf2f25ae..f4b57ce8d22 100644 --- a/src/login/logind-seat.h +++ b/src/login/logind-seat.h @@ -51,7 +51,6 @@ void seat_claim_position(Seat *s, Session *session, unsigned pos); bool seat_has_vts(Seat *s); bool seat_is_seat0(Seat *s); -bool seat_can_multi_session(Seat *s); bool seat_can_tty(Seat *s); bool seat_has_master_device(Seat *s); bool seat_can_graphical(Seat *s); diff --git a/src/systemd/sd-login.h b/src/systemd/sd-login.h index 50be5433db4..e18f01bb671 100644 --- a/src/systemd/sd-login.h +++ b/src/systemd/sd-login.h @@ -183,7 +183,7 @@ int sd_seat_get_active(const char *seat, char **session, uid_t *uid); int sd_seat_get_sessions(const char *seat, char ***sessions, uid_t **uid, unsigned *n_uids); /* Return whether the seat is multi-session capable */ -int sd_seat_can_multi_session(const char *seat); +int sd_seat_can_multi_session(const char *seat) _sd_deprecated_; /* Return whether the seat is TTY capable, i.e. suitable for showing console UIs */ int sd_seat_can_tty(const char *seat); diff --git a/tools/meson-check-api-docs.sh b/tools/meson-check-api-docs.sh index 2ba50108767..adaf23883ef 100755 --- a/tools/meson-check-api-docs.sh +++ b/tools/meson-check-api-docs.sh @@ -11,6 +11,7 @@ deprecated=" -e sd_bus_process_priority -e sd_bus_message_get_priority -e sd_bus_message_set_priority + -e sd_seat_can_multi_session " for symbol in `nm -g --defined-only "$@" | grep " T " | cut -d" " -f3 | grep -wv $deprecated | sort -u` ; do