aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-09-22examples/simpletest: check for libseat_dispatch failuresSimon Ser
2021-09-22logind: check if session is active on startupSimon Ser
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-21ci: Inline smoketest into build scriptsKenny Levinsen
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-21clang-format: Fix alignmentKenny Levinsen
2021-09-21logind: Send ping to wake us up laterKenny Levinsen
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-21seatd: Implement ping request to wake up laterKenny Levinsen
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.
2021-09-16Bump version to 0.6.2Kenny Levinsen
2021-09-16seatd-launch: Specify exact environment to seatdKenny Levinsen
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.
2021-09-16seatd-launch: Use absolute path for seatdKenny Levinsen
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.
2021-09-16ci: Install seatd instead of manipulating PATHKenny Levinsen
2021-09-14Bump version to 0.6.1Kenny Levinsen
2021-09-13seatd-launch: print unlink/kill errorsSimon Ser
Makes it easier to find out that something went wrong.
2021-09-13seatd-launch: exit with status >128 if child is signalledSimon Ser
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).
2021-09-12man/seatd-launch: Make mssage about root clearerKenny Levinsen
2021-09-12seatd-launch: Use optind to find the commandKenny Levinsen
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.
2021-09-12seatd-launch: respect PATH when looking for commandJan Beich
$ seatd-launch sway -c /dev/null Could not start target: No such file or directory
2021-09-11man: Add seatd-launch(1) to SEE ALSO of seatd(1)Kenny Levinsen
2021-09-11Bump version to 0.6.0Kenny Levinsen
2021-09-08seatd-launch: Fix chmod error gotoKenny Levinsen
2021-09-08man: Add simple seatd-launch(1) pageKenny Levinsen
2021-09-08seatd-launch: Set socket permissions directlyKenny Levinsen
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.
2021-09-07seat: Allow new clients when active is pending ackKenny Levinsen
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.
2021-09-02Add .editorconfigSimon Ser
Allows text editor auto-configuration.
2021-09-02seat: Avoid holding a tty fdKenny Levinsen
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.
2021-09-02meson.build: fix build with gcc < 7Fabrice Fontaine
Test if arguments (e.g. -Wimplicit-fallthrough) is available before using it as -Wimplicit-fallthrough has been added only since gcc 7.1 and https://github.com/gcc-mirror/gcc/commit/81fea426da8c4687bb32e6894dc26f00ae211822 and so it will raise the following build failure with gcc < 7: arm-none-linux-gnueabi-gcc: error: unrecognized command line option '-Wimplicit-fallthrough' Fixes: - http://autobuild.buildroot.org/results/0ee6816a7cceebdafd07612677a594bdf68e0790 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-08-15libseat: Fix build of builtin backendKenny Levinsen
This was regressed by 166feaea3394e00af14418e074ae090e31922f33 which missed the builtin backend when changing struct libseat_seat_listener to being passed around as const.
2021-08-15libseat: Update builtin backend root requirement documentationGreg Depoire--Ferrer
The builtin backend no longer requires root, setuid or CAP_SYS_ADMIN. This commit updates the documentation accordingly.
2021-08-15Revert "libseat: Check euid before using builtin"Greg Depoire--Ferrer
This reverts commit 1ae6c3b3ddf0ce2a2e1817eb9c74e0c03153df58. A user might want to run the builtin server as non root, if they have permission to use the devices. The check was originally copied from wlroots's direct backend. It was reverted in fa05d3cde68d with a detailed explanation of why root priviledges are not always necessary to use the DRM device.
2021-08-15logind: Remove redundant null checkKenny Levinsen
2021-08-15Make libseat_seat_listener constSimon Ser
libseat will never write to that struct. Let's allow callers to make it read-only.
2021-08-08seatd: Use path in chmod/chown operationsKenny Levinsen
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.
2021-08-08seatd: Improve socket permission error handlingKenny Levinsen
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.
2021-08-06seatd-launch: Command line argument supportKenny Levinsen
2021-08-06seatd-launch: check for getpwuid errorsSimon Ser
2021-08-06seatd-launch: don't use gotos in child processesSimon Ser
While forked (child pid is zero), don't use gotos. These will execute atexit functions and potentially mess up the stdlib. Instead, use _exit.
2021-08-06seatd-launch: propagate child exit statusSimon Ser
When the child process exits with a non-zero code or is killed, return with a non-zero code as well.
2021-08-06ci: Fix meson flagsKenny Levinsen
2021-08-06ci: Use seatd-launchKenny Levinsen
2021-08-06seatd-launch: Add seatd launch wrapperKenny Levinsen
This launch wrapper is used to conveniently start a new seatd instance, wait for it to be ready, and launch a target application.
2021-08-06seatd: Only set UID/GID when specifiedKenny Levinsen
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.
2021-08-06seatd: s6-style readiness notification supportKenny Levinsen
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.
2021-08-06seatd: We shouldn't poll if predispatch > 0Kenny Levinsen
This condition was accidentally botched as part of 5923e0edc9bb157cf6398b63d51cc3c0aaf06001
2021-07-09libseat: Rename dispatch_background in backendsKenny Levinsen
This name never made much sense. dispatch_and_execute is more meaningful, especially when compared to the non-executing dispatch function.
2021-07-09libseat/seatd: Add dispatch_pending_and_executeKenny Levinsen
This handler returns the number of dispatched or executed events, or -1 if dispatch_pending failed. This helper is used to clean up dispatch_background, which now ensures that all events are executed before we read or poll the connection, and have improved error handling in the corner case where the second dispatch_pending failed.
2021-07-08libseat/seatd: Return executed eventsKenny Levinsen
Dispatch needs to report if something has happened, which includes events executed from the queue as these could have lead to additional dispatch and queuing.
2021-07-06build: add prefix to libseat optionsSimon Ser
The option names are a little bit confusing, because it's not clear which ones toggle libseat features, and which ones toggle seatd features. Add a "libseat-" prefix to libseat-specific features, to make it more obvious that they only are about the library.
2021-06-20link with rtSimeon Schaub
Since seatd uses `clock_gettime`, this is needed when cross-compiling. This came up in https://github.com/JuliaPackaging/Yggdrasil/pull/3193.
2021-05-19readme: Update discuss sectionKenny Levinsen
2021-04-25meson: Support building builtin without seatdKenny Levinsen
The builtin backend relies on the seatd backend implementation. When builtin was enabled without seatd, compilation would fail due to the implementation not being included. Include the implementation if either seatd or builtin is enabled.
2021-04-25libseat/seatd: downgrade ENOENT log to infoSimon Ser
The socket is expected not to be found if seatd is not running. In general other backends will be attempted after seatd. There is already an error message in case no backend can be started.