|
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_PROCLIST_H__
|
|
Packit |
d37888 |
#define __GLIBTOP_PROCLIST_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_PROCLIST_NUMBER 0
|
|
Packit |
d37888 |
#define GLIBTOP_PROCLIST_TOTAL 1
|
|
Packit |
d37888 |
#define GLIBTOP_PROCLIST_SIZE 2
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
#define GLIBTOP_MAX_PROCLIST 3
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/* You can use the folowing constants as the `which' member of
|
|
Packit |
d37888 |
* glibtop_get_proclist () to specify which processes to fetch. */
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_KERN_PROC_ALL:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Return information about all processes
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_KERN_PROC_ALL 0
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_KERN_PROC_PID:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Return all processes with the pid which is passed in @arg. You can use this to find out whether some process still exists.
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_KERN_PROC_PID 1
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_KERN_PROC_PGRP:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Return all processes in the process group passed in @arg.
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_KERN_PROC_PGRP 2
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_KERN_PROC_SESSION:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Return all processes in the session passed in @arg.
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_KERN_PROC_SESSION 3
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_KERN_PROC_TTY:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Return all processes which have the controlling tty passed in @arg
|
|
Packit |
d37888 |
* (which is interpreted as the device number).
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_KERN_PROC_TTY 4
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_KERN_PROC_UID:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Return all processes with the effective uid passed in @arg.
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_KERN_PROC_UID 5
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_KERN_PROC_RUID:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Return all processes with the real uid passed in @arg.
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_KERN_PROC_RUID 6
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
#define GLIBTOP_KERN_PROC_MASK 15
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_EXCLUDE_IDLE:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Exclude idle processes.
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_EXCLUDE_IDLE 0x1000
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_EXCLUDE_SYSTEM:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Exclude system (on most UNIXes root's) processes.
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_EXCLUDE_SYSTEM 0x2000
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* GLIBTOP_EXCLUDE_NOTTY:
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Exclude processes without a controlling terminal.
|
|
Packit |
d37888 |
**/
|
|
Packit |
d37888 |
#define GLIBTOP_EXCLUDE_NOTTY 0x4000
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
typedef struct _glibtop_proclist glibtop_proclist;
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* glibtop_proclist:
|
|
Packit |
d37888 |
* @number: Number of entries in the returned list.
|
|
Packit |
d37888 |
* @total: Total size of the returned list (this equals @number * @size).
|
|
Packit |
d37888 |
* @size: Size of a single entry in the returned list
|
|
Packit |
d37888 |
* (this equals <type>sizeof(unsigned)</type>).
|
|
Packit |
d37888 |
*/
|
|
Packit |
d37888 |
struct _glibtop_proclist
|
|
Packit |
d37888 |
{
|
|
Packit |
d37888 |
guint64 flags;
|
|
Packit |
d37888 |
guint64 number; /* GLIBTOP_PROCLIST_NUMBER */
|
|
Packit |
d37888 |
guint64 total; /* GLIBTOP_PROCLIST_TOTAL */
|
|
Packit |
d37888 |
guint64 size; /* GLIBTOP_PROCLIST_SIZE */
|
|
Packit |
d37888 |
};
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* glibtop_get_proclist:
|
|
Packit |
d37888 |
* @buf: a #glibtop_proclist
|
|
Packit |
d37888 |
* @which: a #GLIBTOP_* constant specifying process type
|
|
Packit |
d37888 |
* @arg: an argument specific for the process type
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Returns: (array zero-terminated=1) (transfer none): an array of process
|
|
Packit |
d37888 |
* ids
|
|
Packit |
d37888 |
*/
|
|
Packit |
d37888 |
pid_t*
|
|
Packit |
d37888 |
glibtop_get_proclist(glibtop_proclist *buf, gint64 which, gint64 arg);
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
#if GLIBTOP_SUID_PROCLIST
|
|
Packit |
d37888 |
#define glibtop_get_proclist_r glibtop_get_proclist_p
|
|
Packit |
d37888 |
#else
|
|
Packit |
d37888 |
#define glibtop_get_proclist_r glibtop_get_proclist_s
|
|
Packit |
d37888 |
#endif
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* glibtop_get_proclist_l:
|
|
Packit |
d37888 |
* @server: a #glibtop server
|
|
Packit |
d37888 |
* @buf: a #glibtop_proclist
|
|
Packit |
d37888 |
* @which: a #GLIBTOP_* constant specifying process type
|
|
Packit |
d37888 |
* @arg: an argument specific for the process type
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Returns: (array zero-terminated=1) (transfer none): an array of process
|
|
Packit |
d37888 |
* ids
|
|
Packit |
d37888 |
*/
|
|
Packit |
d37888 |
pid_t*
|
|
Packit |
d37888 |
glibtop_get_proclist_l (glibtop *server, glibtop_proclist *buf,
|
|
Packit |
d37888 |
gint64 which, gint64 arg);
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
#if GLIBTOP_SUID_PROCLIST
|
|
Packit |
d37888 |
void _glibtop_init_proclist_p (glibtop *server);
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* glibtop_get_proclist_p:
|
|
Packit |
d37888 |
* @server: a #glibtop server
|
|
Packit |
d37888 |
* @buf: a #glibtop_proclist
|
|
Packit |
d37888 |
* @which: a #GLIBTOP_* constant specifying process type
|
|
Packit |
d37888 |
* @arg: an argument specific for the process type
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Returns: (array zero-terminated=1) (transfer none): an array of process
|
|
Packit |
d37888 |
* ids
|
|
Packit |
d37888 |
*/
|
|
Packit |
d37888 |
pid_t*
|
|
Packit |
d37888 |
glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
|
|
Packit |
d37888 |
gint64 which, gint64 arg);
|
|
Packit |
d37888 |
#else
|
|
Packit |
d37888 |
void _glibtop_init_proclist_s (glibtop *server);
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
/**
|
|
Packit |
d37888 |
* glibtop_get_proclist_s:
|
|
Packit |
d37888 |
* @server: a #glibtop server
|
|
Packit |
d37888 |
* @buf: a #glibtop_proclist
|
|
Packit |
d37888 |
* @which: a #GLIBTOP_* constant specifying process type
|
|
Packit |
d37888 |
* @arg: an argument specific for the process type
|
|
Packit |
d37888 |
*
|
|
Packit |
d37888 |
* Returns: (array zero-terminated=1) (transfer none): an array of process
|
|
Packit |
d37888 |
* ids
|
|
Packit |
d37888 |
*/
|
|
Packit |
d37888 |
pid_t*
|
|
Packit |
d37888 |
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
|
|
Packit |
d37888 |
gint64 which, gint64 arg);
|
|
Packit |
d37888 |
#endif
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
G_END_DECLS
|
|
Packit |
d37888 |
|
|
Packit |
d37888 |
#endif
|