~kennylevinsen/seatd

5b259b3ab4cf5a4f6166c6027def454910b6d7d1 — Kenny Levinsen 3 years ago 1867f29 libseat-manpage
man: Add libseat manpages
A man/libseat-device.3.scd => man/libseat-device.3.scd +43 -0
@@ 0,0 1,43 @@
libseat_device(3)

# NAME

libseat_open_device, libseat_close_device - libseat device management

# SYNOPSIS

*\#include <libseat.h>*

*int libseat_open_device(struct libseat \**_seat_*, const char \**_path_*, int \**_fd_*);*++
*int libseat_close_device(struct libseat \**_seat_*, int *_device_id_*);*

# DESCRIPTION

## libseat_open_device()

Opens a device on the seat, returning its device ID and placing the fd in
the specified pointer.

This will only succeed if the seat is active and the device is of a type
permitted for opening on the backend, such as drm and evdev.

The device may be revoked in some situations, such as in situations where a
seat session switch is being forced.

Returns the device id on success. Returns -1 and sets errno on error.

## libseat_close_device()

Closes a device that has been opened on the seat using the device_id from
libseat_open_device.

Returns 0 on success. Returns -1 and sets errno on error.

# SEE ALSO

*libseat(3)*, *libseat-seat(3)*

# AUTHORS

Maintained by Kenny Levinsen <contact@kl.wtf>. For more information about seatd
development, see https://sr.ht/~kennylevinsen/seatd.

A man/libseat-dispatch.3.scd => man/libseat-dispatch.3.scd +42 -0
@@ 0,0 1,42 @@
libseat-dispatch(3)

# NAME

libseat_get_fd, libseat_dispatch - libseat event dispatch

# SYNOPSIS

*\#include <libseat.h>*

*int libseat_get_fd(struct libseat \**_seat_*);*++
*int libseat_dispatch(struct libseat \**_seat_*, int *_timeout_*);*

# DESCRIPTION

## libseat_get_fd()

Retrieve the pollable connection fd for a given libseat instance. Used to
poll the libseat connection for events that need to be dispatched.

Returns a pollable fd on success. Returns -1 and sets errno on error.

## libseat_dispatch()

Reads and dispatches events on the libseat connection fd.

The specified timeout dictates how long libseat might wait for data if none
is available: 0 means that no wait will occur, -1 means that libseat might
wait indefinitely for data to arrive, while > 0 is the maximum wait in
milliseconds that might occur.

Returns a positive number signifying processed internal messages on success.
Returns 0-if no messages were processed. Returns -1 and sets errno on error.

# SEE ALSO

*libseat(3)*, *libseat-seat(3)*

# AUTHORS

Maintained by Kenny Levinsen <contact@kl.wtf>. For more information about seatd
development, see https://sr.ht/~kennylevinsen/seatd.

A man/libseat-log.3.scd => man/libseat-log.3.scd +48 -0
@@ 0,0 1,48 @@
libseat(3)

# NAME

libseat_set_log_handler, libseat_set_log_level, libseat_log_level, libseat_log_func - libseat log handling

# SYNOPSIS

*\#include <libseat.h>*

*enum libseat_log_level {*++
*	LIBSEAT_LOG_LEVEL_SILENT = 0,*++
*	LIBSEAT_LOG_LEVEL_ERROR = 1,*++
*	LIBSEAT_LOG_LEVEL_INFO = 2,*++
*	LIBSEAT_LOG_LEVEL_DEBUG = 3,*++
*	LIBSEAT_LOG_LEVEL_LAST,*++
*};*

*typedef void (\*libseat_log_func)(enum libseat_log_level *_level_*, const char \**_format_*, va_list *_args_*);*

*void libseat_set_log_handler(libseat_log_func *_handler_*);*++
*void libseat_set_log_level(enum libseat_log_level *_level_*);*

# DESCRIPTION

## libseat_set_log_handler()

Sets the handler for log messages.

The handler will be called for each message whose level is lower or equal
to the current log level. If the handler is NULL, the handler is reset to
the default.

## libseat_set_log_level()

Sets the libseat log level.

Only log messages whose level is lower or equal than the current log level
will be processed, others will be ignored.

# SEE ALSO

*libseat(3)*, *libseat-seat(3)*

# AUTHORS

Maintained by Kenny Levinsen <contact@kl.wtf>. For more information about seatd
development, see https://sr.ht/~kennylevinsen/seatd.

A man/libseat-seat.3.scd => man/libseat-seat.3.scd +79 -0
@@ 0,0 1,79 @@
libseat_seat(3)

# NAME

libseat_open_seat, libseat_disable_seat, libseat_close_seat - libseat seat management

# SYNOPSIS

*\#include <libseat.h>*

*struct libseat;*

*struct libseat_seat_listener {*++
*	void (\**_enable_seat_*)(struct libseat \**_seat_*, void \**_userdata_*);*++
*	void (\**_disable_seat_*)(struct libseat \**_seat_*, void \**_userdata_*);*++
*};*

*struct libseat \*libseat_open_seat(struct libseat_seat_listener \**_listener_*, void \**_userdata_*);*++
*int libseat_disable_seat(struct libseat \**_seat_*);*++
*int libseat_close_seat(struct libseat \**_seat_*);*

*const char \*libseat_seat_name(struct libseat \**_seat_*);*

# DESCRIPTION

The functions described here manage a seat, backed by one of the backends
supported by libseat.

## libseat_open_seat()

Opens a seat, taking control of it if possible and returning a pointer to the
libseat instance. If LIBSEAT_BACKEND is set, the specified backend is used.
Otherwise, the first successful backend will be used.

The seat listener specified is used to signal events on the seat, and must be
non-NULL. The userdata pointer will be provided in all calls to the seat
listener.

The available backends, if enabled at compile-time, are: seatd, logind and
builtin.

To use builtin, the process must have CAP_SYS_ADMIN or be root at the time of
the call. These privileges can be dropped at any point after the call.

The returned pointer must be destroyed with libseat_close_seat.

Returns a pointer to an opaque libseat struct on success. Returns NULL and sets
errno on error.

## libseat_disable_seat()

Disables a seat, used in response to a disable_seat event. After disabling
the seat, the seat devices must not be used until enable_seat is received,
and all requests on the seat will fail during this period.

Returns 0 on success. -1 and sets errno on error.

## libseat_close_seat()

Closes the seat. This frees the libseat structure.

Returns 0 on success. Returns -1 and sets errno on error.

## libseat_seat_name()

Retrieves the name of the seat that is currently made available through the
provided libseat instance.

The returned string is owned by the libseat instance, and must not be
modified. It remains valid as long as the seat is open.

# SEE ALSO

*libseat(3)*, *libseat-device(3)*, *libseat-session(3)*, *libseat-dispatch(3)*, *libseat-log(3)*

# AUTHORS

Maintained by Kenny Levinsen <contact@kl.wtf>. For more information about seatd
development, see https://sr.ht/~kennylevinsen/seatd.

A man/libseat-session.3.scd => man/libseat-session.3.scd +31 -0
@@ 0,0 1,31 @@
libseat-session(3)

# NAME

libseat_switch_session - libseat session management

# SYNOPSIS

*\#include <libseat.h>*

*int libseat_switch_session(struct libseat \**_seat_*, int *_session_*);*

# DESCRIPTION

Requests that the seat switches session to the specified session number.
For seats that are VT-bound, the session number matches the VT number, and
switching session results in a VT switch.

A call to libseat_switch_session does not imply that a switch will occur,
and the caller should assume that the session continues unaffected.

Returns 0 on success. Returns -1 and sets errno on error.

# SEE ALSO

*libseat(3)*, *libseat-seat(3)*

# AUTHORS

Maintained by Kenny Levinsen <contact@kl.wtf>. For more information about seatd
development, see https://sr.ht/~kennylevinsen/seatd.

A man/libseat.3.scd => man/libseat.3.scd +35 -0
@@ 0,0 1,35 @@
libseat(3)

# NAME

libseat - A seat management library

# SYNOPSIS

*\#include <libseat.h>*

# DESCRIPTION

*libseat* provides seat management with multiple backends in an easy to use
package.

See the respective sub-pages for more information.

# BACKENDS

*libseat* supports the following backends:
- *seatd(1)*
- (e)logind
- builtin, using an embedded *seatd(1)* instance

The backends are auto-detected at runtime, but can be forced with the
*LIBSEAT_BACKEND* environment variable.

# SEE ALSO

*seatd(1)*, *libseat-seat(3)*, *libseat-device(3)*, *libseat-session(3)*, *libseat-dispatch(3)*, *libseat-log(3)*

# AUTHORS

Maintained by Kenny Levinsen <contact@kl.wtf>. For more information about seatd
development, see https://sr.ht/~kennylevinsen/seatd.

M meson.build => meson.build +9 -1
@@ 186,7 186,15 @@ if scdoc.found()
	sh = find_program('sh', native: true)
	scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)

	man_pages = ['seatd.1.scd']
	man_pages = [
	   'seatd.1.scd',
	   'libseat.3.scd',
	   'libseat-seat.3.scd',
	   'libseat-device.3.scd',
	   'libseat-session.3.scd',
	   'libseat-dispatch.3.scd',
	   'libseat-log.3.scd',
	]

	mandir = get_option('mandir')