aboutsummaryrefslogtreecommitdiff
path: root/seatd
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-09-22 01:00:18 +0200
committerKenny Levinsen <kl@kl.wtf>2020-09-22 01:14:24 +0200
commitbe45c480ec0792c7dfb97e39b4f5369b75593ae8 (patch)
treee7d8a7e18d45269db06b55427a4b7ca5d7d23e19 /seatd
parentba4c4226595598f6e3f9712eed6c04c49b7399e5 (diff)
terminal: Ack both release and acquire
Linux only requires acking release and ignores ack of acquire, but FreeBSD is more stringent and will patiently wait for both to be acked. Implement proper acking for both events.
Diffstat (limited to 'seatd')
-rw-r--r--seatd/seat.c20
-rw-r--r--seatd/server.c2
2 files changed, 13 insertions, 9 deletions
diff --git a/seatd/seat.c b/seatd/seat.c
index 16935cf..1ce44d0 100644
--- a/seatd/seat.c
+++ b/seatd/seat.c
@@ -99,13 +99,17 @@ static int vt_switch(struct seat *seat, int vt) {
return 0;
}
-static int vt_ack(struct seat *seat) {
+static int vt_ack(struct seat *seat, bool release) {
int tty0fd = terminal_open(seat->cur_vt);
if (tty0fd == -1) {
log_errorf("unable to open tty0: %s", strerror(errno));
return -1;
}
- terminal_ack_switch(tty0fd);
+ if (release) {
+ terminal_ack_release(tty0fd);
+ } else {
+ terminal_ack_acquire(tty0fd);
+ }
close(tty0fd);
return 0;
}
@@ -610,29 +614,29 @@ int seat_vt_activate(struct seat *seat) {
log_debug("VT activation on non VT-bound seat, ignoring");
return -1;
}
-
- log_debug("switching session from VT activation");
seat_update_vt(seat);
+ log_debug("activating VT");
+ vt_ack(seat, false);
if (seat->active_client == NULL) {
seat_activate(seat);
}
return 0;
}
-int seat_prepare_vt_switch(struct seat *seat) {
+int seat_vt_release(struct seat *seat) {
assert(seat);
if (!seat->vt_bound) {
- log_debug("VT switch request on non VT-bound seat, ignoring");
+ log_debug("VT release request on non VT-bound seat, ignoring");
return -1;
}
seat_update_vt(seat);
- log_debug("acking VT switch");
+ log_debug("releasing VT");
if (seat->active_client != NULL) {
seat_disable_client(seat->active_client);
}
- vt_ack(seat);
+ vt_ack(seat, true);
seat->cur_vt = -1;
return 0;
}
diff --git a/seatd/server.c b/seatd/server.c
index 90aa610..acb366e 100644
--- a/seatd/server.c
+++ b/seatd/server.c
@@ -97,7 +97,7 @@ static int server_handle_vt_rel(int signal, void *data) {
return -1;
}
- seat_prepare_vt_switch(seat);
+ seat_vt_release(seat);
return 0;
}