Commit graph

42 commits

Author SHA1 Message Date
Kenny Levinsen
be45c480ec terminal: Ack both release and acquire
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.
2020-09-22 01:14:24 +02:00
Kenny Levinsen
51c7467516 seat: Rework seat activation/switch logic
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.
2020-09-22 01:01:46 +02:00
Kenny Levinsen
6747c5f3f8 poller: Raise signals through self-pipe
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.
2020-09-22 01:01:46 +02:00
Kenny Levinsen
5b8117f3d4 client: Do not leak idle clients on exit 2020-08-31 23:13:16 +02:00
Kenny Levinsen
aef19fe383 test: Add test_run and test_assert macros
test_run and test_assert replaces regular assert with better logging
which include the currently running test name. The tests can now also be
built without DEBUG.
2020-08-31 14:40:58 +02:00
Kenny Levinsen
8610ec4aac Remove unused list implementation 2020-08-31 14:14:39 +02:00
Kenny Levinsen
d17632fadd poller: Convert to linked_list 2020-08-31 14:09:59 +02:00
Kenny Levinsen
d75b617faf server: Convert seat list to linked_list 2020-08-31 14:09:59 +02:00
Kenny Levinsen
7d88315fea poller: Make event sources opaque 2020-08-31 01:33:41 +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
5470c48113 seat: Destroy all clients on teardown 2020-08-29 23:49:22 +02:00
Kenny Levinsen
b7b28f0628 protocol: Add note to remove device_closed msg
The content of this message is unused, so it should be converted to a
content-less message.
2020-08-29 23:12:18 +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
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
47d4b43f1a Introduce libseat_set_log_handler
This allows libseat users to register a custom logging function.
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
a98e0c4ce9 seatd: Add command-line arguments 2020-08-07 15:50:27 +02:00
Kenny Levinsen
304489c30d libseat: Fix doc typo 2020-08-05 23:41:55 +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
fc7116ffad seat: Convert client list to linked list 2020-08-03 02:48:39 +02:00
Kenny Levinsen
9b7a12d90a seat: Convert device list to linked list 2020-08-03 02:16:21 +02:00
Kenny Levinsen
4afe674e54 linked_list: Initial implementation 2020-08-03 02:13:47 +02:00
Kenny Levinsen
c35b2d2d88 server: Stack-allocate the server 2020-08-03 02:13:47 +02:00
Kenny Levinsen
d68c5feaee poller: Inline the poller into the server struct 2020-08-03 02:13:22 +02:00
Kenny Levinsen
3f3bdd41dd poller: Remove unnecessary poll_impl abstraction 2020-08-03 01:15:20 +02:00
Kenny Levinsen
4f4a17a2bd libseat: Remove unused stdarg.h import 2020-08-03 00:57:34 +02:00
Kenny Levinsen
3a5c17f911 compiler: Rename erroneous header-guard 2020-08-03 00:57:20 +02:00
Kenny Levinsen
9d2e63d090 terminal: Remove unused prototypes 2020-08-03 00:56:38 +02:00
Kenny Levinsen
6d031426aa list: Make list_concat argument const 2020-08-03 00:56:27 +02:00
Kenny Levinsen
a003e92600 client: Prefix notification methods with 'send' 2020-08-03 00:56:10 +02:00
Kenny Levinsen
3e301b8e70 libseat: Use symbol file instead of -fvisibility 2020-08-03 00:54:55 +02:00
Kenny Levinsen
b2cbe576d1 seat: Deactivate devices before sending disable
Previously, seatd would not deactivate devices until the client had
acked the disable. In once instance, this lead to libinput spending
significant time checking and closing each input device.

As a workaround, mimick logind's behavior of deactivating devices first.
The original behavior can be reintroduced if the client-side problem is
fixed.

Closes: https://todo.sr.ht/~kennylevinsen/seatd/5
2020-08-02 21:46:13 +02:00
Kenny Levinsen
5b4d00d6cf list: Add list_pop_back 2020-08-02 21:46:13 +02:00
Kenny Levinsen
b751481e5c seat: Open/close tty on activation/deactivation
The VT and KD ioctl's are picky about the tty fd used. In order to
satisfy these, and to improve state cleanup, we now only and store the
current tty when opening a client, and use this fd to perform teardown
later. The presence of the fd is also used to signal that teardown is
needed.
2020-08-02 21:46:10 +02:00
Kenny Levinsen
d26466bf3b Remove ALWAYS_INLINE
Didn't do what I wanted it to anyway.
2020-08-01 23:13:54 +02:00
Kenny Levinsen
2be0826959 connection: Shrink buffers from 1KB to 256B each 2020-08-01 23:13:44 +02:00
Kenny Levinsen
e129536a08 devices: Use path to check device type
FreeBSD device numbers cannot be used to check the type of a device, as
they are merely unique filesystem IDs.

As the paths we use have been sanitized with realpath, we can simply use
the path to check if a requested file is an evdev or drm device. This
also allows us to make the check before the file is opened.
2020-08-01 16:53:44 +02:00
Kenny Levinsen
956a378adb log: Avoid unnecessary GNU extension 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