session
Header: kmsroots/session.h
Table of contents (click to go)
Macros
Enums
Unions
Structs
Functions
Function Pointers
API Documentation
kmr_session
-
struct kmr_session
kmr_session_create
-
struct kmr_session *kmr_session_create(void);
Create logind/seatd session to access devices without being root. Function populates all the members of the
structkmr_session.- Parameters:
- sessionPointer to a
structkmr_sessionstores information about the current session - Returns:
- on success: pointer to
structkmr_sessionon failure: NULL
kmr_session_destroy
-
void kmr_session_destroy(struct kmr_session *session);
Frees any allocated memory and closes FD’s (if open) created after
kmr_session_create()call- Parameters:
- sessionMust pass a valid pointer to a
structkmr_session
/* Free'd members with fd's closed */ struct kmr_session { int seatFd; struct libseat *seat; };
kmr_session_switch_vt
-
int kmr_session_switch_vt(struct kmr_session *session, unsigned int vt);
Calls libseat_switch_session() which 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.
kmr_session_take_control_of_device
-
int kmr_session_take_control_of_device(struct kmr_session *session, const char *devpath);
The TakeDevice systemd-logind D-Bus interface function allows session controller to get a file descriptor for a specific device and allows one to acquire control over the given device (i.e GPU,keyboard,mouse,etc). This functions returns a file descriptor to the device that has been acquired.
- Parameters:
- sessionPointer to a
structkmr_sessionstores information about the current sessiondevpathPath to a given character device associated with a connected device - Returns:
- on success: an open file descriptoron failure: -1
kmr_session_release_device
-
void kmr_session_release_device(struct kmr_session *session, int fd);
The ReleaseDevice systemd-logind D-Bus interface function allows for one to release control over a given device (i.e GPU,keyboard,mouse,etc). The function also closes the passed file descriptor.
- Parameters:
- sessionMust pass a pointer to a
structkmr_sessionfdOpen file descriptor associated with a given character device file