1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * Copyright © 2009, 2010 Christian Persch
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __BTE_BTE_PTY_H__
#define __BTE_BTE_PTY_H__

#if !defined (__BTE_BTE_H_INSIDE__) && !defined (BTE_COMPILATION)
#error "Only <bte/bte.h> can be included directly."
#endif

#include <gio/gio.h>

#include "bteenums.h"
#include "btemacros.h"

G_BEGIN_DECLS

#define BTE_SPAWN_NO_PARENT_ENVV        (1 << 25)
#define BTE_SPAWN_NO_SYSTEMD_SCOPE      (1 << 26)
#define BTE_SPAWN_REQUIRE_SYSTEMD_SCOPE (1 << 27)

_BTE_PUBLIC
GQuark bte_pty_error_quark (void) _BTE_CXX_NOEXCEPT;

/**
 * BTE_PTY_ERROR:
 *
 * Error domain for BTE PTY errors. Errors in this domain will be from the #BtePtyError
 * enumeration. See #GError for more information on error domains.
 */
#define BTE_PTY_ERROR (bte_pty_error_quark ())

/* BTE PTY object */

#define BTE_TYPE_PTY            (bte_pty_get_type())
#define BTE_PTY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), BTE_TYPE_PTY, BtePty))
#define BTE_PTY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  BTE_TYPE_PTY, BtePtyClass))
#define BTE_IS_PTY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BTE_TYPE_PTY))
#define BTE_IS_PTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  BTE_TYPE_PTY))
#define BTE_PTY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  BTE_TYPE_PTY, BtePtyClass))

typedef struct _BtePty        BtePty;
typedef struct _BtePtyClass   BtePtyClass;

_BTE_PUBLIC
GType bte_pty_get_type (void);

_BTE_PUBLIC
BtePty *bte_pty_new_sync (BtePtyFlags flags,
                          GCancellable *cancellable,
                          GError **error) _BTE_CXX_NOEXCEPT;

_BTE_PUBLIC
BtePty *bte_pty_new_foreign_sync (int fd,
                                  GCancellable *cancellable,
                                  GError **error) _BTE_CXX_NOEXCEPT;

_BTE_PUBLIC
int bte_pty_get_fd (BtePty *pty) _BTE_CXX_NOEXCEPT _BTE_GNUC_NONNULL(1);

_BTE_PUBLIC
void bte_pty_child_setup (BtePty *pty) _BTE_CXX_NOEXCEPT _BTE_GNUC_NONNULL(1);

_BTE_PUBLIC
gboolean bte_pty_get_size (BtePty *pty,
                           int *rows,
                           int *columns,
                           GError **error) _BTE_CXX_NOEXCEPT _BTE_GNUC_NONNULL(1);

_BTE_PUBLIC
gboolean bte_pty_set_size (BtePty *pty,
                           int rows,
                           int columns,
                           GError **error) _BTE_CXX_NOEXCEPT _BTE_GNUC_NONNULL(1);

_BTE_PUBLIC
gboolean bte_pty_set_utf8 (BtePty *pty,
                           gboolean utf8,
                           GError **error) _BTE_CXX_NOEXCEPT _BTE_GNUC_NONNULL(1);

G_DEFINE_AUTOPTR_CLEANUP_FUNC(BtePty, g_object_unref)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_AUTOPTR_CLEANUP_FUNC is a macro then please configure it.

_BTE_PUBLIC
void bte_pty_spawn_async(BtePty *pty,
                         const char *working_directory,
                         char **argv,
                         char **envv,
                         GSpawnFlags spawn_flags,
                         GSpawnChildSetupFunc child_setup,
                         gpointer child_setup_data,
                         GDestroyNotify child_setup_data_destroy,
                         int timeout,
                         GCancellable *cancellable,
                         GAsyncReadyCallback callback,
                         gpointer user_data) _BTE_CXX_NOEXCEPT _BTE_GNUC_NONNULL(1) _BTE_GNUC_NONNULL(3);

_BTE_PUBLIC
void bte_pty_spawn_with_fds_async(BtePty *pty,
                                  char const* working_directory,
                                  char const* const* argv,
                                  char const* const* envv,
                                  int const* fds,
                                  int n_fds,
                                  int const* map_fds,
                                  int n_map_fds,
                                  GSpawnFlags spawn_flags,
                                  GSpawnChildSetupFunc child_setup,
                                  gpointer child_setup_data,
                                  GDestroyNotify child_setup_data_destroy,
                                  int timeout,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data) _BTE_CXX_NOEXCEPT _BTE_GNUC_NONNULL(1) _BTE_GNUC_NONNULL(3);

_BTE_PUBLIC
gboolean bte_pty_spawn_finish(BtePty *pty,
                              GAsyncResult *result,
                              GPid *child_pid /* out */,
                              GError **error) _BTE_CXX_NOEXCEPT _BTE_GNUC_NONNULL(1) _BTE_GNUC_NONNULL(2);

G_END_DECLS

#endif /* __BTE_BTE_PTY_H__ */