Commit graph

285 commits

Author SHA1 Message Date
Simon Ser
207e2a5936 man: add missing arg in -n syntax 2023-01-28 23:10:29 +01:00
Chia-I Wu
9b8b6e0bf8 noop: initialize initial_setup
Otherwise the enable_seat callback is never called.
2023-01-16 13:13:52 +01:00
Simon Ser
14355639f8 man: document SEATD_VTBOUND 2022-11-30 18:38:50 +01:00
Kenny Levinsen
a803ba0502 seatd-launch: Avoid argv[0] in help text 2022-05-23 22:03:38 +02:00
Kenny Levinsen
6888653a8d wscons: Fix STRLEN 2022-03-30 00:39:35 +02:00
Simon Ser
2842f0e2b1 seatd: refuse to compile with missing get_peer impl
Instead of using a stub, error out when get_peer isn't implemented
for the target platform. client_create relies on it.
2022-03-29 20:08:00 +02:00
Simon Ser
85d0bf5943 seatd: handle client_create failure
Failure to create the client causes a null pointer dereference.
2022-03-29 20:07:47 +02:00
Kenny Levinsen
8f8c9558e6 drm: Make dev_is_drm local to logind backend
This function is only used for logind, which is Linux-specific, but the
presence in common/drm.c suggested that it had to be portable.

Move it to the logind backend for now.
2022-03-29 10:54:27 +02:00
Kenny Levinsen
0462e9331d wscons: Move to its own device type
This reduces ifdefs and avoids overloading evdev as something it is not.
2022-03-29 10:54:27 +02:00
Kenny Levinsen
684dd61945 terminal: Revert FreeBSD behavior in set_keyboard
4ad48cb305 introduced support for NetBSD,
which modified a number of our ifdefs. In that process, FreeBSD was
accidentally excluded from an important code path that controls keyboard
usage on the kernel console.

Revert part of that change to restore FreeBSD behavior.
2022-03-29 10:03:30 +02:00
Kenny Levinsen
d5539dead8 meson: library soversion arg should be string
muon, a meson implementation in C, is more strict with its types and
revealed this discrepancy between meson behavior and documentation.
2022-03-28 16:28:00 +02:00
Kenny Levinsen
845256009b readme: Mention NetBSD 2022-03-23 20:29:09 +01:00
illiliti
a5f9a2a2c8 ci: Add NetBSD 2022-03-16 21:39:46 +01:00
illiliti
4ad48cb305 Initial netbsd support 2022-03-16 21:39:46 +01:00
Kenny Levinsen
1990f9b034 ci: Set loglevel argument to debug 2022-03-16 21:27:05 +01:00
Kenny Levinsen
bb0efb65b3 Bump version to 0.7.0 2022-03-03 17:52:50 +01:00
Kenny Levinsen
ce6a6b7d2e meson: Fix meson warnings 2022-03-03 17:52:26 +01:00
Kenny Levinsen
8dc6a50d88 builtin: Remove deathsig and log start/stop
Proper handling of client disconnect mean that we no longer need
deathsig handling.
2022-03-03 17:52:21 +01:00
Kenny Levinsen
795cf169e7 seatd: Shut down on client disconnect in builtin
If we're part of the libseat builtin backend, then we only have one
client. Shut down the server when this client disconnects.
2022-03-03 14:44:56 +01:00
Kenny Levinsen
46c83972fe builtin: Close other end of socketpair after fork
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.
2022-03-03 14:44:49 +01:00
Kenny Levinsen
abcecbb53b meson: Only set libseat defines for libseat itself
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.
2022-03-03 14:40:40 +01:00
Kenny Levinsen
ae42d05513 seatd: Change default log-level to info 2022-02-26 22:56:42 +01:00
Kenny Levinsen
0d6bdf4f01 seatd: Remove runtime socket path configuration
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.
2022-02-26 22:25:27 +01:00
Kenny Levinsen
466efea49b seatd: Handle socket unlink errors
This ensures early failure and better error messages.
2022-02-26 19:37:49 +01:00
Kenny Levinsen
9bbdf0f0b8 seatd: Command-line argument for loglevel
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.
2022-02-26 19:17:26 +01:00
Kenny Levinsen
3eb0db57bb seatd-launch: Minor readability improvements 2022-02-21 21:33:06 +01:00
Kenny Levinsen
ed90ed62cd seatd-launch: Use snprintf for socket path
We also reduce the size of the buffer from 256 bytes to a much more
reasonable 32 bytes.
2022-02-21 21:27:14 +01:00
Kenny Levinsen
a44476ce65 seatd: Fix usage rendering 2022-02-21 12:04:09 +01:00
Kenny Levinsen
10658dc543 seatd-launch: Remove socket path command line arg
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.
2022-02-21 12:02:31 +01:00
Kenny Levinsen
32d06482d3 seatd-launch: Do not unlink socket path
seatd cleans up after itself and takes care of stale sockets when
applicable, so seatd-launch should not replicate this functionality.
2022-02-21 12:02:31 +01:00
Kenny Levinsen
0864f6a3ac seatd: Ensure socket gets unlinked on error 2022-02-21 12:02:31 +01:00
Kenny Levinsen
157ce68565 seatd: Remove SOCK_PATH and improve cleanup
SOCK_PATH is made redundant by the -s command-line argument added in
a98e0c4ce9. 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.
2022-02-21 12:02:31 +01:00
Kenny Levinsen
f128359332 logind: Always send ping if data is queued
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.
2022-02-15 13:51:49 +01:00
Kenny Levinsen
b47c79d731 libseat: Use SOCK_CLOEXEC and SOCK_NONBLOCK
This both simplifies our code and fixes an exec fd leak when using
builtin or noop backends.
2022-02-09 23:22:29 +01:00
Simon Ser
96a5de8859 readme: add irc:// link
This allows users to just click the link to join the IRC channel.
2021-12-16 10:40:53 +01:00
Simon Ser
936ff9dbea build: use meson.override_dependency
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'])
2021-12-16 10:40:32 +01:00
Simon Ser
f381e22955 build: don't use sh for scdoc
Just use the built-in feed/capture Meson options instead.
2021-11-28 15:41:53 +01:00
Simon Ser
d92fa01f88 build: use list for logind dep
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.
2021-11-28 15:40:56 +01:00
Simon Ser
69cf5c36e0 build: don't use cc.get_supported_arguments for defines
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.
2021-10-28 16:31:17 +02:00
Simon Ser
88529f0856 seatd: don't log errno on EVENT_ERROR
errno won't be set when poll returns EVENT_ERROR.
2021-10-24 00:55:32 +02:00
Simon Ser
cb7a94378b seatd: avoid overwriting errno in set_nonblock error handling
If close fails, it'll mess up errno, and log_errorf will print a
non-sensical value.
2021-10-24 00:52:08 +02:00
Kenny Levinsen
88db55f606 Bump version to 0.6.3 2021-10-19 21:39:17 +02:00
Kenny Levinsen
e35c9cd02e logind: Set userdata for ping_handler 2021-10-05 10:05:25 +02:00
Kenny Levinsen
ec0d6565bb ci: Add logind smoketest to arch 2021-09-22 23:06:59 +02:00
Kenny Levinsen
8e5c00e7c8 logind: Improve error handling in open_seat
errno was not being set by open_seat in most cases, leading to
simpletest possibly failing with "libseat_open_seat() failed: Success".
2021-09-22 23:04:40 +02:00
Simon Ser
d2193b45ff examples/simpletest: check for libseat_dispatch failures 2021-09-22 21:59:41 +02:00
Simon Ser
262ccef84e logind: check if session is active on startup
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.
2021-09-22 21:55:49 +02:00
Kenny Levinsen
1c376ca9b1 ci: Inline smoketest into build scripts
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.
2021-09-21 13:11:55 +02:00
Kenny Levinsen
e2baadc230 clang-format: Fix alignment 2021-09-21 12:48:24 +02:00
Kenny Levinsen
db08fb921f logind: Send ping to wake us up later
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.
2021-09-21 11:18:18 +02:00