| 1 |
/* sysprof-spawnable.h |
| 2 |
* |
| 3 |
* Copyright 2019 Christian Hergert <[email protected]> |
| 4 |
* |
| 5 |
* This program is free software: you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation, either version 3 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
* |
| 18 |
* SPDX-License-Identifier: GPL-3.0-or-later |
| 19 |
*/ |
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <gio/gio.h> |
| 24 |
|
| 25 |
#include <sysprof-capture.h> |
| 26 |
|
| 27 |
G_BEGIN_DECLS |
| 28 |
|
| 29 |
#define SYSPROF_TYPE_SPAWNABLE (sysprof_spawnable_get_type()) |
| 30 |
|
| 31 |
typedef void (*SysprofSpawnableFDForeach) (gint dest_fd, |
| 32 |
gint fd, |
| 33 |
gpointer user_data); |
| 34 |
|
| 35 |
SYSPROF_AVAILABLE_IN_ALL |
| 36 |
G_DECLARE_FINAL_TYPE (SysprofSpawnable, sysprof_spawnable, SYSPROF, SPAWNABLE, GObject) |
| 37 |
|
| 38 |
SYSPROF_AVAILABLE_IN_ALL |
| 39 |
SysprofSpawnable *sysprof_spawnable_new (void); |
| 40 |
SYSPROF_AVAILABLE_IN_ALL |
| 41 |
void sysprof_spawnable_prepend_argv (SysprofSpawnable *self, |
| 42 |
const char *argv); |
| 43 |
SYSPROF_AVAILABLE_IN_ALL |
| 44 |
void sysprof_spawnable_append_argv (SysprofSpawnable *self, |
| 45 |
const char *argv); |
| 46 |
SYSPROF_AVAILABLE_IN_ALL |
| 47 |
void sysprof_spawnable_append_args (SysprofSpawnable *self, |
| 48 |
const char * const *argv); |
| 49 |
SYSPROF_AVAILABLE_IN_ALL |
| 50 |
const char *sysprof_spawnable_get_cwd (SysprofSpawnable *self); |
| 51 |
SYSPROF_AVAILABLE_IN_ALL |
| 52 |
void sysprof_spawnable_set_cwd (SysprofSpawnable *self, |
| 53 |
const char *cwd); |
| 54 |
SYSPROF_AVAILABLE_IN_ALL |
| 55 |
const char * const *sysprof_spawnable_get_argv (SysprofSpawnable *self); |
| 56 |
SYSPROF_AVAILABLE_IN_ALL |
| 57 |
const char * const *sysprof_spawnable_get_environ (SysprofSpawnable *self); |
| 58 |
SYSPROF_AVAILABLE_IN_ALL |
| 59 |
void sysprof_spawnable_set_environ (SysprofSpawnable *self, |
| 60 |
const char * const *environ); |
| 61 |
SYSPROF_AVAILABLE_IN_ALL |
| 62 |
void sysprof_spawnable_setenv (SysprofSpawnable *self, |
| 63 |
const char *key, |
| 64 |
const char *value); |
| 65 |
SYSPROF_AVAILABLE_IN_ALL |
| 66 |
const char *sysprof_spawnable_getenv (SysprofSpawnable *self, |
| 67 |
const char *key); |
| 68 |
SYSPROF_AVAILABLE_IN_ALL |
| 69 |
gint sysprof_spawnable_take_fd (SysprofSpawnable *self, |
| 70 |
gint fd, |
| 71 |
gint dest_fd); |
| 72 |
SYSPROF_AVAILABLE_IN_ALL |
| 73 |
void sysprof_spawnable_foreach_fd (SysprofSpawnable *self, |
| 74 |
SysprofSpawnableFDForeach foreach, |
| 75 |
gpointer user_data); |
| 76 |
SYSPROF_AVAILABLE_IN_ALL |
| 77 |
void sysprof_spawnable_set_starting_fd (SysprofSpawnable *self, |
| 78 |
gint starting_fd); |
| 79 |
SYSPROF_AVAILABLE_IN_ALL |
| 80 |
int sysprof_spawnable_add_trace_fd (SysprofSpawnable *self, |
| 81 |
const char *envvar); |
| 82 |
SYSPROF_AVAILABLE_IN_ALL |
| 83 |
void sysprof_spawnable_add_ld_preload (SysprofSpawnable *self, |
| 84 |
const char *library_path); |
| 85 |
SYSPROF_AVAILABLE_IN_ALL |
| 86 |
GSubprocess *sysprof_spawnable_spawn (SysprofSpawnable *self, |
| 87 |
GError **error); |
| 88 |
SYSPROF_AVAILABLE_IN_ALL |
| 89 |
GSubprocessFlags sysprof_spawnable_get_flags (SysprofSpawnable *self); |
| 90 |
SYSPROF_AVAILABLE_IN_ALL |
| 91 |
void sysprof_spawnable_set_flags (SysprofSpawnable *self, |
| 92 |
GSubprocessFlags flags); |
| 93 |
|
| 94 |
G_END_DECLS |