Blame include/glibtop/procstate.h

Packit d37888
/* Copyright (C) 1998-99 Martin Baulig
Packit d37888
   This file is part of LibGTop 1.0.
Packit d37888
Packit d37888
   Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
Packit d37888
Packit d37888
   LibGTop is free software; you can redistribute it and/or modify it
Packit d37888
   under the terms of the GNU General Public License as published by
Packit d37888
   the Free Software Foundation; either version 2 of the License,
Packit d37888
   or (at your option) any later version.
Packit d37888
Packit d37888
   LibGTop is distributed in the hope that it will be useful, but WITHOUT
Packit d37888
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
Packit d37888
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit d37888
   for more details.
Packit d37888
Packit d37888
   You should have received a copy of the GNU General Public License
Packit d37888
   along with LibGTop; see the file COPYING. If not, write to the
Packit d37888
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Packit d37888
   Boston, MA 02110-1301, USA.
Packit d37888
*/
Packit d37888
Packit d37888
#ifndef __GLIBTOP_PROCSTATE_H__
Packit d37888
#define __GLIBTOP_PROCSTATE_H__
Packit d37888
Packit d37888
#include <glibtop.h>
Packit d37888
#include <glibtop/global.h>
Packit d37888
Packit d37888
G_BEGIN_DECLS
Packit d37888
Packit d37888
#define GLIBTOP_PROC_STATE_CMD		0
Packit d37888
#define GLIBTOP_PROC_STATE_STATE	1
Packit d37888
#define GLIBTOP_PROC_STATE_UID		2
Packit d37888
#define GLIBTOP_PROC_STATE_GID		3
Packit d37888
#define GLIBTOP_PROC_STATE_RUID     4
Packit d37888
#define GLIBTOP_PROC_STATE_RGID     5
Packit d37888
#define GLIBTOP_PROC_STATE_HAS_CPU  6
Packit d37888
#define GLIBTOP_PROC_STATE_PROCESSOR 7
Packit d37888
#define GLIBTOP_PROC_STATE_LAST_PROCESSOR 8
Packit d37888
Packit d37888
#define GLIBTOP_MAX_PROC_STATE		9
Packit d37888
Packit d37888
#define GLIBTOP_PROCESS_RUNNING                 1
Packit d37888
#define GLIBTOP_PROCESS_INTERRUPTIBLE           2
Packit d37888
#define GLIBTOP_PROCESS_UNINTERRUPTIBLE         4
Packit d37888
#define GLIBTOP_PROCESS_ZOMBIE                  8
Packit d37888
#define GLIBTOP_PROCESS_STOPPED                 16
Packit d37888
#define GLIBTOP_PROCESS_SWAPPING                32
Packit d37888
#define GLIBTOP_PROCESS_DEAD                    64
Packit d37888
Packit d37888
typedef struct _glibtop_proc_state	glibtop_proc_state;
Packit d37888
Packit d37888
/* Name and status */
Packit d37888
Packit d37888
struct _glibtop_proc_state
Packit d37888
{
Packit d37888
	guint64 flags;
Packit d37888
	char cmd[40];		/* basename of executable file in
Packit d37888
				 * call to exec(2) */
Packit d37888
	unsigned state;
Packit d37888
	/* NOTE: when porting the library, TRY HARD to implement the
Packit d37888
	 *       following two fields. */
Packit d37888
	/* IMPORTANT NOTICE: For security reasons, it is extremely important
Packit d37888
	 *                   only to set the flags value for those two
Packit d37888
	 *                   fields if their values are corrent ! */
Packit d37888
	int uid;		/* UID of process */
Packit d37888
	int gid;		/* GID of process */
Packit d37888
    int ruid;
Packit d37888
    int rgid;
Packit d37888
    int has_cpu;
Packit d37888
    int processor;
Packit d37888
    int last_processor;
Packit d37888
};
Packit d37888
Packit d37888
void glibtop_get_proc_state(glibtop_proc_state *buf, pid_t pid);
Packit d37888
Packit d37888
#if GLIBTOP_SUID_PROC_STATE
Packit d37888
#define glibtop_get_proc_state_r	glibtop_get_proc_state_p
Packit d37888
#else
Packit d37888
#define glibtop_get_proc_state_r	glibtop_get_proc_state_s
Packit d37888
#endif
Packit d37888
Packit d37888
void glibtop_get_proc_state_l (glibtop *server, glibtop_proc_state *buf, pid_t pid);
Packit d37888
Packit d37888
#if GLIBTOP_SUID_PROC_STATE
Packit d37888
void _glibtop_init_proc_state_p (glibtop *server);
Packit d37888
void glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, pid_t pid);
Packit d37888
#else
Packit d37888
void _glibtop_init_proc_state_s (glibtop *server);
Packit d37888
void glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid);
Packit d37888
#endif
Packit d37888
Packit d37888
Packit d37888
G_END_DECLS
Packit d37888
Packit d37888
#endif