]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/ptyfwd.h
Merge pull request #2100 from msekletar/nologin-label
[thirdparty/systemd.git] / src / shared / ptyfwd.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6 This file is part of systemd.
7
8 Copyright 2010-2013 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <stdbool.h>
25
26 #include "sd-event.h"
27
28 #include "macro.h"
29
30 typedef struct PTYForward PTYForward;
31
32 typedef enum PTYForwardFlags {
33 PTY_FORWARD_READ_ONLY = 1,
34
35 /* Continue reading after hangup? */
36 PTY_FORWARD_IGNORE_VHANGUP = 2,
37
38 /* Continue reading after hangup but only if we never read anything else? */
39 PTY_FORWARD_IGNORE_INITIAL_VHANGUP = 4,
40 } PTYForwardFlags;
41
42 int pty_forward_new(sd_event *event, int master, PTYForwardFlags flags, PTYForward **f);
43 PTYForward *pty_forward_free(PTYForward *f);
44
45 int pty_forward_get_last_char(PTYForward *f, char *ch);
46
47 int pty_forward_set_ignore_vhangup(PTYForward *f, bool ignore_vhangup);
48 int pty_forward_get_ignore_vhangup(PTYForward *f);
49
50 DEFINE_TRIVIAL_CLEANUP_FUNC(PTYForward*, pty_forward_free);