Age | Commit message (Collapse) | Author |
|
Proper handling of client disconnect mean that we no longer need
deathsig handling.
|
|
If we're part of the libseat builtin backend, then we only have one
client. Shut down the server when this client disconnects.
|
|
We will not get a socket hangup if we have duplicates socket fds in the
parent or child, so make sure we clean this up properly after fork.
|
|
This allows us to distinguish between when we build seatd as part of the
builtin libseat backend, or when we build seatd on its own.
|
|
|
|
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.
|
|
|
|
We also reduce the size of the buffer from 256 bytes to a much more
reasonable 32 bytes.
|
|
|
|
This should not need to be configured, so remove the argument. If
downstream prefers a different folder, the location can be made
compile-time configurable like for seatd itself.
|
|
seatd cleans up after itself and takes care of stale sockets when
applicable, so seatd-launch should not replicate this functionality.
|
|
|
|
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.
|
|
sd_bus_call_method may have read and queued our ping response, so we
cannot assume that a previous ping will make the socket readable.
Instead, always send a ping if read or write queues are not empty, even
if a ping has already been sent.
|
|
This both simplifies our code and fixes an exec fd leak when using
builtin or noop backends.
|
|
This allows users to just click the link to join the IRC channel.
|
|
This allows downstream users to write:
dependency('libseat', fallback: 'seatd')
instead of having to rely on the seatd/meson.build's variable name:
dependency('libseat', fallback: ['seatd', 'libseat'])
|
|
Just use the built-in feed/capture Meson options instead.
|
|
This reduces the boilerplate a bit. Use logind.name() instead of
having a separate source of truth. Requires adapting the checks a
bit because the dep name has a "lib" prefix.
|
|
If the compiler errors out on some -DXXX flag, then we're in
trouble. Avoid using cc.get_supported_arguments for defines we
require. Only use it for detecting support for warning flags.
|
|
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.
|
|
|
|
|
|
|
|
errno was not being set by open_seat in most cases, leading to
simpletest possibly failing with "libseat_open_seat() failed: Success".
|
|
|
|
Up until now we assumed the session was always active on startup.
This might not be the case. Instead, read the current value of the
Active property.
|
|
The smoketest script has gotten significantly simpler, and can simply be
inlined into the build scripts if we don't care about running the tests
twice.
This should fix CI for mailing list patches.
|
|
|
|
sd_bus_call drains received messages into the receive queue, and peeks
for its own return value. It does not dispatch the receive queue.
As the socket is drained, the caller will not wake from a poll and have
no reason to dispatch libseat. This has gone unnoticed largely due to
logind sending an event for every device, making it unlikely that no
unread message will be left on the socket.
Like we have done for seatd, we fix this by sending a "ping" request to
logind if anything is left in our receive queue as reported by
sd_bus_get_events. The response to this will wake us up and ensure that
dispatch is called.
|
|
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.
|
|
|
|
The parent environment might contain nasty things. Create a new
environment for the seatd process containing only the environment
variables we care about. For now, that's only SEATD_LOGLEVEL.
|
|
We previously used execlp to execute seatd, which had the effect of
searching PATH for the executable. This allowed the caller to control
what executable was run, which is bad if SUID has been set.
Instead, expose the absolute install path for seatd from meason as a
define, and use that in a call to execv.
|
|
|
|
|
|
Makes it easier to find out that something went wrong.
|
|
Mimick shells and exit with a status >128 if our child has been
signalled. Exiting with 128 + signal number is what most shells do
(POSIX only requires them to exit with >128).
|
|
|
|
The command indexing had not been updated afer the introduction of
getopt, so combining a command with flags would fail.
Add error handling for if no command was specified while we're at it.
|
|
$ seatd-launch sway -c /dev/null
Could not start target: No such file or directory
|
|
|
|
|
|
|
|
|
|
Instead of relying on seatd's user/group arguments, which require
turning our UID back into a username, just chmod/chown the socket
ourselves once seatd is ready.
We also reduce the permissions to just user access, instead of user and
group like seatd specifies.
|
|
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.
|