]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/ptyfwd.h
pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
[thirdparty/systemd.git] / src / shared / ptyfwd.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include <stdbool.h>
5
6 #include "sd-event.h"
7
8 #include "macro.h"
9
10 typedef struct PTYForward PTYForward;
11
12 typedef enum PTYForwardFlags {
13 PTY_FORWARD_READ_ONLY = 1,
14
15 /* Continue reading after hangup? */
16 PTY_FORWARD_IGNORE_VHANGUP = 2,
17
18 /* Continue reading after hangup but only if we never read anything else? */
19 PTY_FORWARD_IGNORE_INITIAL_VHANGUP = 4,
20 } PTYForwardFlags;
21
22 typedef int (*PTYForwardHandler)(PTYForward *f, int rcode, void*userdata);
23
24 int pty_forward_new(sd_event *event, int master, PTYForwardFlags flags, PTYForward **f);
25 PTYForward *pty_forward_free(PTYForward *f);
26
27 int pty_forward_get_last_char(PTYForward *f, char *ch);
28
29 int pty_forward_set_ignore_vhangup(PTYForward *f, bool ignore_vhangup);
30 bool pty_forward_get_ignore_vhangup(PTYForward *f);
31
32 bool pty_forward_is_done(PTYForward *f);
33
34 void pty_forward_set_handler(PTYForward *f, PTYForwardHandler handler, void *userdata);
35
36 bool pty_forward_drain(PTYForward *f);
37
38 int pty_forward_set_priority(PTYForward *f, int64_t priority);
39
40 DEFINE_TRIVIAL_CLEANUP_FUNC(PTYForward*, pty_forward_free);