## GlibTop GlibTop — Server initilization |

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | LIBGTOP_CHECK_VERSION()
glibtop * | glibtop_init ()
glibtop * | glibtop_init_r ()
glibtop * | glibtop_init_s ()

## Types and Values

#define | GLIBTOP_MOUNTENTRY_LEN
struct | glibtop
extern glibtop * | glibtop_global_server
extern const unsigned long | glibtop_server_features

## Includes

    #include <glibtop.h>

## Description

You do not need to worry about the glibtop * server structure if you don't need - the library exports a glibtop_global_server which you can use everywhere a glibtop * is expected.

Most of the library and all of the sysdeps function also have an alias (which is the function name without the <suffix>_l</suffix>,

<suffix>_s</suffix> or <suffix>_r</suffix> suffix) which don't

take a glibtop * as argument but uses the glibtop_global_server instead.

## Functions

### LIBGTOP_CHECK_VERSION()

    #define             LIBGTOP_CHECK_VERSION(major, minor, micro)

### glibtop_init ()

    glibtop *
    glibtop_init (void);

Server initialization.

#### Returns

A glibtop reference.

### glibtop_init_r ()

    glibtop *
    glibtop_init_r (glibtop **server_ptr,
                    unsigned long  features,
                    unsigned  flags);

### glibtop_init_s ()

    glibtop *
    glibtop_init_s (glibtop **server_ptr,
                    unsigned long  features,
                    unsigned  flags);

## Types and Values

### GLIBTOP_MOUNTENTRY_LEN

    #define GLIBTOP_MOUNTENTRY_LEN 79

### struct glibtop

    struct glibtop {
    	unsigned flags;
    	unsigned method;		/* Server Method */
    	unsigned error_method;		/* Error Method */
    	int input [2];			/* Pipe client <- server */
    	int output [2];			/* Pipe client -> server */
    	int socket;			/* Accepted connection of a socket */
    	int ncpu;			/* Number of CPUs, zero if single-processor */
    	int real_ncpu;			/* Real number of CPUs. Only ncpu are monitored */
    	unsigned long os_version_code; /* Version code of the operating system */
    	const char *name;		/* Program name for error messages */
    	const char *server_command; /* Command used to invoke server */
    	const char *server_host; /* Host the server should run on */
    	const char *server_user; /* Name of the user on the target host */
    	const char *server_rsh;		/* Command used to connect to the target host */
    	unsigned long features;		/* Server is required for this features */
    	unsigned long server_port; /* Port on which daemon is listening */
    	glibtop_sysdeps sysdeps; /* Detailed feature list */
    	glibtop_sysdeps required; /* Required feature list */
    	pid_t pid;			/* PID of the server */

    	uid_t uid;
    	uid_t euid;
    	gid_t gid;
    	gid_t egid;

    	glibtop_machine *machine; /* Machine dependent data */

    	int ndisk;			/* Number of DISKs,  zero if single-disk. This pertains to disk volumes */
    	int real_ndisk;			/* Number of PHYSICAL DISKs. Only ndisk is monitored for now */
    };

### glibtop_global_server

    extern glibtop *glibtop_global_server;

### glibtop_server_features

    extern const unsigned long glibtop_server_features;