sd-login: get rid of seat_can_multi_session()

Follow-up for fa2cf64a91.
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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-04-17 13:57:40 +02:00
parent a8cff0034c
commit 8f8cc84ba4
9 changed files with 20 additions and 31 deletions

View 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',

View 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>
@ -44,11 +43,6 @@
<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>
@ -90,11 +84,6 @@
<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>
@ -114,7 +103,7 @@
<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>
@ -157,6 +146,14 @@
<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>

View 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) {

View 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);

View 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),

View 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);

View 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);

View 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);

View File

@ -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