Commit graph

42 commits

Author SHA1 Message Date
Kenny Levinsen
1dbf100205 logind: switch_session should return 0 on success
It currently returned -1 on failure and 1 on success. The API is
intended to return -1 on failure and 0 on success, so fix that.
2020-11-24 13:12:31 +01:00
Isaac Freund
3c80a9db96 libseat: log error when failing to open socket
The most common pain point I've seen with people trying out seat is
forgetting to add themselves to whatever group the distro has chosen
to own the socket.

Logging this error and path of the socket should make it easier to tell
why things aren't working.
2020-11-21 21:03:55 +01:00
Kenny Levinsen
29ba210958 libseat: Better error reporting from open_seat 2020-10-11 23:31:07 +02:00
Kenny Levinsen
7d785ea993 logind: clang-format 2020-10-11 01:41:34 +02:00
Kenny Levinsen
daffed0955 logind: Use seat_path for SwitchTo 2020-10-10 19:39:28 +02:00
Kenny Levinsen
7bf91a5f9f logind: close_device should not close fd 2020-09-28 18:53:38 +02:00
Kenny Levinsen
0132841987 libseat/seatd: Fix socket path bounds 2020-09-22 01:14:24 +02:00
Kenny Levinsen
884c1416b3 meson: Make default seatd socket path configurable
FreeBSD and Linux have different preferred socket locations. Expose an
option to set the location, and implement simple auto-logic for
linux/freebsd.
2020-09-22 01:14:20 +02:00
Kenny Levinsen
6fa82930d0 libseat: Execute bg events after IPC calls
If a background event was queued during call dispatch, and no unread
data was left on the socket, there would be no incentive for the user to
call dispatch, and as a result, the events would never be executed.

Execute events at the end of IPC calls that read from the socket to
avoid stalls.
2020-09-22 01:01:46 +02:00
Kenny Levinsen
4c22c7b004 libseat: Dispatch all non-bg events on IPC call
Dispatch on IPC call only dispatched until the first message was
successfully processed. This could lead to premature dispatch
termination if a background event was received during an IPC call.

Instead, continue dispatching until a non-bg opcode is reported or an
error is received.
2020-09-22 01:01:46 +02:00
Kenny Levinsen
047d8b284c libseat: Handle SERVER_ERROR correctly
The connection buffer position was erroneously rewinded before reading
the protocol message when the message was a SERVER_ERROR.
2020-09-07 23:35:24 +02:00
Kenny Levinsen
5b8117f3d4 client: Do not leak idle clients on exit 2020-08-31 23:13:16 +02:00
Kenny Levinsen
bbfb770c73 linked_list: linked_list_take should concat lists 2020-08-31 14:09:59 +02:00
Kenny Levinsen
e86c9ec2b7 seatd: Remove unused device_closed msg body 2020-08-30 03:26:32 +02:00
Kenny Levinsen
c36cc962e6 linked_list: Implement linked_list_take 2020-08-30 00:05:19 +02:00
Kenny Levinsen
1ae6c3b3dd libseat: Check euid before using builtin 2020-08-29 23:01:56 +02:00
Kenny Levinsen
52fe75d5a4 libseat: Remove pointless check 2020-08-29 22:55:17 +02:00
Kenny Levinsen
98506d2ba4 libseat: Keep track of error state
Store if an error has occurred and return -1 with ENOTCONN from all
future calls, avoiding attempts to use a broken connection.
2020-08-29 22:45:01 +02:00
Kenny Levinsen
8b4d139873 libseat: Improve logging with seatd conn helpers
Add helpers around connection access to have all logging centralized and
reduce code duplication. Improve existing helpers to further reduce code
duplication.

The seatd backend should have much better logging after this.
2020-08-29 20:56:42 +02:00
Kenny Levinsen
69d57aaf33 libseat: Assert that listener is non-NULL 2020-08-29 20:29:35 +02:00
Kenny Levinsen
6e6903829e logind: Merge PropertiesChanged handlers 2020-08-28 22:55:25 +02:00
Kenny Levinsen
74eee486fa libseat: Expand logging in all backends 2020-08-28 22:55:10 +02:00
Kenny Levinsen
1e6d4f451f libseat: Only print backend attempts for matches 2020-08-28 22:40:10 +02:00
Simon Ser
07ceeeebe0 Introduce libseat_set_log_level
The default level is SILENT. log_init no longer takes an initial log
level (so that calls to libseat_set_log_level prior to log_init work
correctly).
2020-08-28 01:21:57 +02:00
Simon Ser
48b9bf4707 Nuke LIBSEAT_LOGLEVEL
This will be replaced with a libseat API to set the log level.
2020-08-28 01:21:57 +02:00
Simon Ser
a254fe3692 Rename enum log_level to libseat_log_level
This is preparatory work for exposing a public function to set libseat's
log handler.
2020-08-28 01:21:57 +02:00
Kenny Levinsen
ab4b961492 libseat: Remove useless logind fallbacks
The logind code is based on the wlroots implementation, which in turn
contained copy-paste code from Mutter that serves no purpose here.
2020-08-24 02:55:14 +02:00
Kenny Levinsen
26aff21058 logind: Set session type from env 2020-08-23 20:13:05 +02:00
Kenny Levinsen
8ab3fc03aa logind: Remove session type check 2020-08-23 20:12:51 +02:00
Kenny Levinsen
24c66d8c08 logind: Remove useless check 2020-08-23 20:12:29 +02:00
Kenny Levinsen
7d2668e360 logind: Allow SwitchTo for all seats 2020-08-06 02:25:24 +02:00
Kenny Levinsen
0fd525e85e logind: close_device always returned error
Error handling was broken in close_device, always returning -1.

Use the return value, and add a few errno assignments while we're at it.
2020-08-06 02:25:24 +02:00
Kenny Levinsen
3586530d81 libseat: Rename libseat_impl to seat_impl 2020-08-05 23:41:55 +02:00
Kenny Levinsen
493cc2a97d log: Remove libseat prefixes 2020-08-05 23:41:55 +02:00
Kenny Levinsen
563a932659 Remove pointless compiler.h 2020-08-05 23:20:50 +02:00
Kenny Levinsen
250adee852 libseat: Use LIBSEAT_LOGLEVEL instead of SEATD_LOGLEVEL 2020-08-03 02:49:07 +02:00
Kenny Levinsen
e25688fed6 libseat: Convert clients to linked_list 2020-08-03 02:49:04 +02:00
Kenny Levinsen
c35b2d2d88 server: Stack-allocate the server 2020-08-03 02:13:47 +02:00
Kenny Levinsen
3e301b8e70 libseat: Use symbol file instead of -fvisibility 2020-08-03 00:54:55 +02:00
Kenny Levinsen
6f6f5de154 seatd: Perform clean server shutdown 2020-08-01 17:02:28 +02:00
Kenny Levinsen
56947d530e FreeBSD compiler warning fix 2020-08-01 16:53:44 +02:00
Kenny Levinsen
61716a2c77 Initial implementation of seatd and libseat 2020-07-31 00:22:18 +02:00