LCOV - code coverage report
Current view: top level - shared - pty.h (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 1 1 100.0 %
Date: 2015-07-29 18:47:03 Functions: 1 1 100.0 %

          Line data    Source code
       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 2014 David Herrmann <dh.herrmann@gmail.com>
       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             : #include <unistd.h>
      26             : 
      27             : #include "barrier.h"
      28             : #include "macro.h"
      29             : #include "sd-event.h"
      30             : 
      31             : typedef struct Pty Pty;
      32             : 
      33             : enum {
      34             :         PTY_CHILD,
      35             :         PTY_HUP,
      36             :         PTY_DATA,
      37             : };
      38             : 
      39             : typedef int (*pty_event_t) (Pty *pty, void *userdata, unsigned int event, const void *ptr, size_t size);
      40             : 
      41             : int pty_new(Pty **out);
      42             : Pty *pty_ref(Pty *pty);
      43             : Pty *pty_unref(Pty *pty);
      44             : 
      45             : #define _pty_unref_ _cleanup_(pty_unrefp)
      46        3000 : DEFINE_TRIVIAL_CLEANUP_FUNC(Pty*, pty_unref);
      47             : 
      48             : Barrier *pty_get_barrier(Pty *pty);
      49             : 
      50             : bool pty_is_unknown(Pty *pty);
      51             : bool pty_is_parent(Pty *pty);
      52             : bool pty_is_child(Pty *pty);
      53             : bool pty_has_child(Pty *pty);
      54             : pid_t pty_get_child(Pty *pty);
      55             : 
      56             : bool pty_is_open(Pty *pty);
      57             : int pty_get_fd(Pty *pty);
      58             : 
      59             : int pty_make_child(Pty *pty);
      60             : int pty_make_parent(Pty *pty, pid_t child);
      61             : int pty_unlock(Pty *pty);
      62             : int pty_setup_child(Pty *pty);
      63             : void pty_close(Pty *pty);
      64             : 
      65             : int pty_attach_event(Pty *pty, sd_event *event, pty_event_t event_fn, void *event_fn_userdata);
      66             : void pty_detach_event(Pty *pty);
      67             : 
      68             : int pty_write(Pty *pty, const void *buf, size_t size);
      69             : int pty_signal(Pty *pty, int sig);
      70             : int pty_resize(Pty *pty, unsigned short term_width, unsigned short term_height);
      71             : 
      72             : pid_t pty_fork(Pty **out, sd_event *event, pty_event_t event_fn, void *event_fn_userdata, unsigned short initial_term_width, unsigned short initial_term_height);

Generated by: LCOV version 1.11