Process Arguments: Libgtop Reference Manual

## Process Arguments Process Arguments — Get process command line arguments |

## Stability Level

Stable, unless otherwise indicated

## Functions

char * | glibtop_get_proc_args ()
char ** | glibtop_get_proc_argv ()

## Types and Values

struct | glibtop_proc_args

## Includes

    #include <glibtop/procargs.h>

## Description

## Functions

### glibtop_get_proc_args ()

    char *
    glibtop_get_proc_args (glibtop_proc_args *buf,
                           pid_t pid,
                           unsigned  max_len);

Get process command line arguments.

#### Parameters

buf | Struct with `size` of returned string. |
pid | Process id |
max_len | Maximum length of string to return (use zero to get all arguments). |

#### Returns

`pid` 's command line arguments separated by null bytes; the length of this string is returned in the `buf` size field. You are required to free the string when done.

### glibtop_get_proc_argv ()

    char **
    glibtop_get_proc_argv (glibtop_proc_args *buf,
                           pid_t pid,
                           unsigned  max_len);

Get process command line arguments.

#### Parameters

buf | Struct with `size` of combined returned arguments. |
pid | Process id |
max_len | Maximum length of all arguments combined (use zero to get all arguments). |

#### Returns

A NULL-terminated array of strings with all arguments of process pid (up to `max_len` characters). Remember to `g_strfreev` the returned array to avoid a memory leak.

## Types and Values

### struct glibtop_proc_args

    struct glibtop_proc_args {
    	guint64 flags;
    	guint64 size;			/* GLIBTOP_PROC_ARGS_SIZE */
    };

## See Also

libgtop-Process-List