]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-login: get rid of seat_can_multi_session()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Apr 2020 11:57:40 +0000 (13:57 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Apr 2020 14:15:30 +0000 (16:15 +0200)
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.

man/rules/meson.build
man/sd_seat_get_active.xml
src/libsystemd/sd-login/sd-login.c
src/libsystemd/sd-login/test-login.c
src/login/logind-seat-dbus.c
src/login/logind-seat.c
src/login/logind-seat.h
src/systemd/sd-login.h
tools/meson-check-api-docs.sh

index 97f4fbc00653b05da4a075a77d5dd7196fa778eb..ea20a5db3aee8c474090377138c7f974abb053c3 100644 (file)
@@ -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',
index 2dba6803f1e48962435207aeb4da7aa453f09c29..cf70b35785a58255fb56ad9f40c3e7042e355fa9 100644 (file)
@@ -19,7 +19,6 @@
   <refnamediv>
     <refname>sd_seat_get_active</refname>
     <refname>sd_seat_get_sessions</refname>
-    <refname>sd_seat_can_multi_session</refname>
     <refname>sd_seat_can_tty</refname>
     <refname>sd_seat_can_graphical</refname>
     <refpurpose>Determine state of a specific seat</refpurpose>
         <paramdef>unsigned int *<parameter>n_uids</parameter></paramdef>
       </funcprototype>
 
-      <funcprototype>
-        <funcdef>int <function>sd_seat_can_multi_session</function></funcdef>
-        <paramdef>const char *<parameter>seat</parameter></paramdef>
-      </funcprototype>
-
       <funcprototype>
         <funcdef>int <function>sd_seat_can_tty</function></funcdef>
         <paramdef>const char *<parameter>seat</parameter></paramdef>
     <constant>NULL</constant> may be returned and should be considered
     equivalent to an empty array.</para>
 
-    <para><function>sd_seat_can_multi_session()</function> 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).</para>
-
     <para><function>sd_seat_can_tty()</function> may be used to
     determine whether a specific seat provides TTY functionality, i.e.
     is useful as a text console.</para>
 
     <para> On success, <function>sd_seat_get_active()</function> returns 0 or a positive integer. On success,
     <function>sd_seat_get_sessions()</function> returns the number of entries in the session identifier
-    array. If the test succeeds, <function>sd_seat_can_multi_session</function>,
+    array. If the test succeeds,
     <function>sd_seat_can_tty</function> and <function>sd_seat_can_graphical</function> return a positive
     integer, if it fails 0. On failure, these calls return a negative errno-style error code.</para>
 
 
   <xi:include href="libsystemd-pkgconfig.xml" />
 
+  <refsect1>
+    <title>History</title>
+
+    <para>In the past, <function>sd_seat_can_multi_session()</function> 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.</para>
+  </refsect1>
+
   <refsect1>
     <title>See Also</title>
 
index 3e96c98cd95a2b9a5afa807ebb248c6f9a140cde..746c895b6120dff18740123dca15e096f9aa3a3c 100644 (file)
@@ -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) {
index 49ed24727868db29acb1bbd045366f38070a52f7..c0c77e04714bc1c54d8a29f8e27445554845ad59 100644 (file)
@@ -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);
index 0a5df937cc1a630523383bbf85ec98462647587f..15d4a25a92ce70a7f6dd8056d6891c9909e57451 100644 (file)
@@ -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),
index 4d51a326a2a7afb362e93a8c03864ed36b295e94..157fc9423cbd804b13a798d4a8d155439c7ee577 100644 (file)
@@ -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);
 
index 64cdf2f25ae78fc9372432cb20f26f3f9570cf73..f4b57ce8d2272180b978607d9ccf41cf8ef0a151 100644 (file)
@@ -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);
index 50be5433db4b468acb8ff042e9c7172edfa24ee5..e18f01bb671de665892c01c4e333a80a34dccf01 100644 (file)
@@ -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);
index 2ba50108767ff8ced8fbfe137c17e061765b5ed1..adaf23883ef70bb837c9251814245e9e3e5d9468 100755 (executable)
@@ -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