| 1 |
/* helpers.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 |
#ifdef __linux__ |
| 25 |
# include <linux/perf_event.h> |
| 26 |
#endif |
| 27 |
|
| 28 |
G_BEGIN_DECLS |
| 29 |
|
| 30 |
gboolean helpers_can_see_pids (void); |
| 31 |
gboolean helpers_list_processes (gint32 **processes, |
| 32 |
gsize *n_processes); |
| 33 |
void helpers_list_processes_async (GCancellable *cancellable, |
| 34 |
GAsyncReadyCallback callback, |
| 35 |
gpointer user_data); |
| 36 |
gboolean helpers_list_processes_finish (GAsyncResult *result, |
| 37 |
gint32 **processes, |
| 38 |
gsize *n_processes, |
| 39 |
GError **error); |
| 40 |
gboolean helpers_perf_event_open (GVariant *options, |
| 41 |
gint32 pid, |
| 42 |
gint32 cpu, |
| 43 |
gint group_fd, |
| 44 |
guint64 flags, |
| 45 |
gint *out_fd); |
| 46 |
gboolean helpers_get_proc_file (const gchar *path, |
| 47 |
gchar **contents, |
| 48 |
gsize *len); |
| 49 |
gboolean helpers_get_proc_fd (const gchar *path, |
| 50 |
gint *out_fd); |
| 51 |
GVariant *helpers_get_process_info (const gchar *attributes); |
| 52 |
|
| 53 |
G_END_DECLS |