kgx-process.h 1.75 KB
Newer Older
Zander Brown's avatar
Zander Brown committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/* kgx-process.h
 *
 * Copyright 2019 Zander Brown
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include <glib.h>
22 23 24
#include <glib-object.h>

#include "kgx-config.h"
Zander Brown's avatar
Zander Brown committed
25 26 27 28 29 30 31

G_BEGIN_DECLS

typedef struct _KgxProcess KgxProcess;

#define KGX_TYPE_PROCESS (kgx_process_get_type ())

32 33
/* The type itself is always defined but we hide the symbols
 * when libgtop isn't used to highlight other places where things
34
 * need to be #if HAS_GTOP
35
 */
36
#if HAS_GTOP
37
GTree      *kgx_process_get_list    (void);
Zander Brown's avatar
Zander Brown committed
38 39 40 41
KgxProcess *kgx_process_new         (GPid        pid);
GPid        kgx_process_get_pid     (KgxProcess *self);
gint32      kgx_process_get_uid     (KgxProcess *self);
gboolean    kgx_process_get_is_root (KgxProcess *self);
42
GPid        kgx_process_get_parent  (KgxProcess *self);
Zander Brown's avatar
Zander Brown committed
43
const char *kgx_process_get_exec    (KgxProcess *self);
44 45 46
#endif
GType       kgx_process_get_type    (void);
void        kgx_process_unref       (KgxProcess *self);
Zander Brown's avatar
Zander Brown committed
47

48 49 50 51
int         kgx_pid_cmp             (gconstpointer a,
                                     gconstpointer b,
                                     gpointer      data);

Zander Brown's avatar
Zander Brown committed
52 53 54
G_DEFINE_AUTOPTR_CLEANUP_FUNC (KgxProcess, kgx_process_unref)

G_END_DECLS