Age | Commit message (Collapse) | Author |
|
This reduces ifdefs and avoids overloading evdev as something it is not.
|
|
|
|
If we're part of the libseat builtin backend, then we only have one
client. Shut down the server when this client disconnects.
|
|
|
|
Configurable socket paths exist mainly to facilitate multiple parallel
seatd instances. However, the only valid use-case for running multiple
instances of seatd is testing during development, which can just as well
be done by changing SEATD_DEFAULTPATH at compile-time for test builds.
Remove the command-line argument in seatd for runtime configuration of
socket path, hardcode the socket path in seatd-launch, and change seatd
unlink/chmod/chown code to not run when started by seatd-launch.
This means that seatd-launch will now fail to start seatd if another
seatd instance is already running. The unlink code still runs when seatd
is started normally to assist in system crash recovery, but this may be
removed later if we deem it unnecessary.
|
|
This ensures early failure and better error messages.
|
|
SEATD_LOGLEVEL was used to set the loglevel despite already having
getopt in place. Remove the environment variable and make a command-line
argument for it instead.
|
|
|
|
|
|
SOCK_PATH is made redundant by the -s command-line argument added in
a98e0c4ce90347d37370f2debcbed8ae9678a990. Support was originally left
behind for short-term compatibility, but it should be fine to remove.
Previous socket cleanup is changed to run unconditionally. The cleanup
now fails if the existing file is not a socket.
|
|
errno won't be set when poll returns EVENT_ERROR.
|
|
If close fails, it'll mess up errno, and log_errorf will print a
non-sensical value.
|
|
When device open or close messages are sent to seatd, libseat must read
messages from the socket until it sees the associated response message.
This means that it may drain enable/disable seat events from the socket,
queueing them internally for deferred processing.
As the socket is drained, the caller will not wake from a poll and have
no reason to dispatch libseat. To ensure that these messages would not
be left in the queue, 6fa82930d0c5660eea3102989c765dc864514e36 made it
so that open/close calls would execute all queued events just before
returning.
Unfortunately, this had the side-effect of having events fire from the
stack of libseat_open_device or libseat_close_device, which we now see
cause problems in compositors. Specifically, an issue has been observed
where libinput end up calling libseat_close_device, which in turn
dispatch a disable seat event that calls libinput_suspend. libinput does
not like this.
Instead, remove the execution from libseat_open_device and
libseat_close_device, and instead make a "ping" request to seatd if
events have been queued. The response to this will wake us up and ensure
that dispatch is called.
|
|
New clients could only be added to a VT bound seat if there were no
"active" client, regardless of its actual state. This meant that if one
switched from an "active" VT to an "inactive" VT, the seat would be
blocked while the "active" client was in CLIENT_PENDING_DISABLE, causing
new clients to possibly fail should the old client take its time with
the ack.
Instead, allow new clients to also be added if there is an active client
whose state is CLIENT_PENDING_DISABLE, and there is no client with the
new VT as its session ID.
|
|
The kernel Secure Attention Key killer, triggered by SysRq+k, kills all
processes that hold an fd referencing the tty.
To avoid its attention, we stop storing the fd for the currently active
VT in seat state. This has the added benefit of simplifying state a bit.
|
|
c8b3a22d4ef0f69c3d22f0ec1170b89c93ef1dc3 snuck in a change which
converts chown/chmod to fchown/fchmod using the socket fd. This appears
to succeed under Linux, but fails with EINVAL on FreeBSD. As the error
handling in this area was flawed, CI failed to catch the regression.
Partially revert c8b3a22d4ef0f69c3d22f0ec1170b89c93ef1dc3 to fix the
regression on FreeBSD.
|
|
chmod/chown errors were logged, but did not result in failure opening
the seatd socket. This meant that errors would not get caught by CI.
|
|
The UID/GID defaulted to 0, which results in trying to chown to root
when a UID or GID isn't requested. Instead, deafult to -1 so that the
unspecified values are left intact.
|
|
This adds the ability to specify the number of an fd that is inherited
by the process as open. Once seatd is read to serve requests, it will
write a single newline and close the fd.
|
|
https://cgit.freebsd.org/src/commit/?id=925f44f33862908f9a2e72520a17af148c7d0db5
https://cgit.freebsd.org/src/commit/?id=2b61bda2c75f30f6eadd18fb891fd885e4c8d19d
|
|
|
|
|
|
|
|
This fd would only still be set after closing clients if no clients were
active on the current VT.
|
|
Removing the link before before means that we can return without a link,
resulting in a double-remove.
|
|
|
|
|
|
|
|
If a client closed while it was disabled, the VT would not be torn down.
If the user navigated back to the VT it belonged to, they would be
stuck.
When a client is disabled, open the fd for the VT it belonged to and
perform regular teardown on it.
|
|
This simplifies logic in seat handling.
|
|
|
|
|
|
This is only available on FreeBSD 13, so test for that version.
|
|
This is wrong, and leads to LOCAL_PEERCRED being interpreted as
SO_DEBUG. 0 should be used instead.
See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246189.
|
|
|
|
There is nothing for us to dispatch unless we wake on an fd, so just
retry poll if it fails with EINTR instead of doing a full dispatch loop.
|
|
|
|
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.
|
|
|
|
FreeBSD and Linux have different preferred socket locations. Expose an
option to set the location, and implement simple auto-logic for
linux/freebsd.
|
|
|
|
|
|
|
|
Only if a device had an fd and was active would an fd be closed. As
devices are deactivated early on session switch, this lead to fd
leakage.
Close fds regardless of active state.
|
|
The seat activation logic did not correctly handle VT switching and
switching between multiple sessions.
Session switching on VT-bound seats is now performed using a VT switch,
taking advantage of VT signals to perform the actual switch. This
simplifies switching logic and makes it more robust.
|
|
|
|
Signal handling relied on poll(2) being interrupted by signals, followed
by a check for signal handlers flagging a signal as received. This only
allowed signals that were received during poll(2) to be handled
correctly.
Implement the usual self-pipe implementation, where signal handlers
write an arbitrary byte to a polled file descriptor to ensure proper
level-triggered signal handling.
|
|
|
|
|
|
|