## Process List Process List — List running processes |

## Stability Level

Stable, unless otherwise indicated

## Functions

pid_t * | glibtop_get_proclist ()

## Types and Values

#define | GLIBTOP_KERN_PROC_ALL
#define | GLIBTOP_KERN_PROC_PID
#define | GLIBTOP_KERN_PROC_PGRP
#define | GLIBTOP_KERN_PROC_SESSION
#define | GLIBTOP_KERN_PROC_TTY
#define | GLIBTOP_KERN_PROC_UID
#define | GLIBTOP_KERN_PROC_RUID
#define | GLIBTOP_KERN_PROC_MASK
#define | GLIBTOP_EXCLUDE_IDLE
#define | GLIBTOP_EXCLUDE_SYSTEM
#define | GLIBTOP_EXCLUDE_NOTTY
struct | glibtop_proclist

## Includes

    #include <glibtop/proclist.h>

## Description

## Functions

### glibtop_get_proclist ()

    pid_t *
    glibtop_get_proclist (glibtop_proclist *buf,
                          gint64 which,
                          gint64 arg);

#### Parameters

buf | Extra return information, see glibtop_proclist. |
which | Criteria for processes in returned list. See the GLIBTOP_KERN_PROC_* and GLIBTOP_EXCLUDE_* constants. |
arg | Extra arguments applied to `which` . Only GLIBTOP_KERN_PROC_* constants take arguments, see each constant definition for particular `arg` description. |

#### Returns

A list of running processes or NULL on error. The returned list is allocated using `g_malloc` and must be freed using `g_free` to avoid a memory leak.

## Types and Values

### GLIBTOP_KERN_PROC_ALL

    #define GLIBTOP_KERN_PROC_ALL		0

Return information about all processes

### GLIBTOP_KERN_PROC_PID

    #define GLIBTOP_KERN_PROC_PID		1

Return all processes with the pid which is passed in `arg` . You can use this to find out whether some process still exists.

### GLIBTOP_KERN_PROC_PGRP

    #define GLIBTOP_KERN_PROC_PGRP		2

Return all processes in the process group passed in `arg` .

### GLIBTOP_KERN_PROC_SESSION

    #define GLIBTOP_KERN_PROC_SESSION 3

Return all processes in the session passed in `arg` .

### GLIBTOP_KERN_PROC_TTY

    #define GLIBTOP_KERN_PROC_TTY		4

Return all processes which have the controlling tty passed in `arg` (which is interpreted as the device number).

### GLIBTOP_KERN_PROC_UID

    #define GLIBTOP_KERN_PROC_UID		5

Return all processes with the effective uid passed in `arg` .

### GLIBTOP_KERN_PROC_RUID

    #define GLIBTOP_KERN_PROC_RUID		6

Return all processes with the real uid passed in `arg` .

### GLIBTOP_KERN_PROC_MASK

    #define GLIBTOP_KERN_PROC_MASK		15

### GLIBTOP_EXCLUDE_IDLE

    #define GLIBTOP_EXCLUDE_IDLE		0x1000

Exclude idle processes.

### GLIBTOP_EXCLUDE_SYSTEM

    #define GLIBTOP_EXCLUDE_SYSTEM		0x2000

Exclude system (on most UNIXes root's) processes.

### GLIBTOP_EXCLUDE_NOTTY

    #define GLIBTOP_EXCLUDE_NOTTY		0x4000

Exclude processes without a controlling terminal.

### struct glibtop_proclist

    struct glibtop_proclist {
    	guint64 flags;
    	guint64 number;			/* GLIBTOP_PROCLIST_NUMBER */
    	guint64 total;			/* GLIBTOP_PROCLIST_TOTAL */
    	guint64 size;			/* GLIBTOP_PROCLIST_SIZE */
    };

#### Members

guint64 `flags`; |  |
guint64 `number`; | Number of entries in the returned list. |
guint64 `total`; | Total size of the returned list (this equals `number` * `size` ). |
guint64 `size`; | Size of a single entry in the returned list (this equals sizeof(unsigned)). |