## procstate

procstate

## Synopsis

    #include <glibtop/procstate.h>

    #define             GLIBTOP_PROC_STATE_CMD
    #define             GLIBTOP_PROC_STATE_STATE
    #define             GLIBTOP_PROC_STATE_UID
    #define             GLIBTOP_PROC_STATE_GID
    #define             GLIBTOP_PROC_STATE_RUID
    #define             GLIBTOP_PROC_STATE_RGID
    #define             GLIBTOP_PROC_STATE_HAS_CPU
    #define             GLIBTOP_PROC_STATE_PROCESSOR
    #define             GLIBTOP_PROC_STATE_LAST_PROCESSOR
    #define             GLIBTOP_MAX_PROC_STATE
    #define             GLIBTOP_PROCESS_RUNNING
    #define             GLIBTOP_PROCESS_INTERRUPTIBLE
    #define             GLIBTOP_PROCESS_UNINTERRUPTIBLE
    #define             GLIBTOP_PROCESS_ZOMBIE
    #define             GLIBTOP_PROCESS_STOPPED
    #define             GLIBTOP_PROCESS_SWAPPING
    #define             GLIBTOP_PROCESS_DEAD
    struct              glibtop_proc_state;
    void                glibtop_get_proc_state              (glibtop_proc_state *buf,
                                                             pid_t pid);
    #define             glibtop_get_proc_state_r
    void                glibtop_get_proc_state_l            (glibtop *server,
                                                             glibtop_proc_state *buf,
                                                             pid_t pid);
    void                glibtop_get_proc_state_p            (glibtop *server,
                                                             glibtop_proc_state *buf,
                                                             pid_t pid);
    void                glibtop_get_proc_state_s            (glibtop *server,
                                                             glibtop_proc_state *buf,
                                                             pid_t pid);

## Description

## Details

### GLIBTOP_PROC_STATE_CMD

    #define GLIBTOP_PROC_STATE_CMD		0

### GLIBTOP_PROC_STATE_STATE

    #define GLIBTOP_PROC_STATE_STATE 1

### GLIBTOP_PROC_STATE_UID

    #define GLIBTOP_PROC_STATE_UID		2

### GLIBTOP_PROC_STATE_GID

    #define GLIBTOP_PROC_STATE_GID		3

### GLIBTOP_PROC_STATE_RUID

    #define GLIBTOP_PROC_STATE_RUID     4

### GLIBTOP_PROC_STATE_RGID

    #define GLIBTOP_PROC_STATE_RGID     5

### GLIBTOP_PROC_STATE_HAS_CPU

    #define GLIBTOP_PROC_STATE_HAS_CPU  6

### GLIBTOP_PROC_STATE_PROCESSOR

    #define GLIBTOP_PROC_STATE_PROCESSOR 7

### GLIBTOP_PROC_STATE_LAST_PROCESSOR

    #define GLIBTOP_PROC_STATE_LAST_PROCESSOR 8

### GLIBTOP_MAX_PROC_STATE

    #define GLIBTOP_MAX_PROC_STATE		9

### GLIBTOP_PROCESS_RUNNING

    #define GLIBTOP_PROCESS_RUNNING                 1

### GLIBTOP_PROCESS_INTERRUPTIBLE

    #define GLIBTOP_PROCESS_INTERRUPTIBLE           2

### GLIBTOP_PROCESS_UNINTERRUPTIBLE

    #define GLIBTOP_PROCESS_UNINTERRUPTIBLE         4

### GLIBTOP_PROCESS_ZOMBIE

    #define GLIBTOP_PROCESS_ZOMBIE                  8

### GLIBTOP_PROCESS_STOPPED

    #define GLIBTOP_PROCESS_STOPPED                 16

### GLIBTOP_PROCESS_SWAPPING

    #define GLIBTOP_PROCESS_SWAPPING                32

### GLIBTOP_PROCESS_DEAD

    #define GLIBTOP_PROCESS_DEAD                    64

### struct glibtop_proc_state

    struct glibtop_proc_state {
    	guint64 flags;
    	char cmd[40];		/* basename of executable file in
    				 * call to exec(2) */
    	unsigned state;
    	/* NOTE: when porting the library, TRY HARD to implement the
    	 *       following two fields. */
    	/* IMPORTANT NOTICE: For security reasons, it is extremely important
    	 *                   only to set the flags value for those two
    	 *                   fields if their values are corrent ! */
    	int uid;		/* UID of process */
    	int gid;		/* GID of process */
        int ruid;
        int rgid;
        int has_cpu;
        int processor;
        int last_processor;
    };

### glibtop_get_proc_state ()

    void                glibtop_get_proc_state              (glibtop_proc_state *buf,
                                                             pid_t pid);

`buf` : |
`pid` : |

### glibtop_get_proc_state_r

    #define glibtop_get_proc_state_r glibtop_get_proc_state_p

### glibtop_get_proc_state_l ()

    void                glibtop_get_proc_state_l            (glibtop *server,
                                                             glibtop_proc_state *buf,
                                                             pid_t pid);

`server` : |
`buf` : |
`pid` : |

### glibtop_get_proc_state_p ()

    void                glibtop_get_proc_state_p            (glibtop *server,
                                                             glibtop_proc_state *buf,
                                                             pid_t pid);

`server` : |
`buf` : |
`pid` : |

### glibtop_get_proc_state_s ()

    void                glibtop_get_proc_state_s            (glibtop *server,
                                                             glibtop_proc_state *buf,
                                                             pid_t pid);

`server` : |
`buf` : |
`pid` : |