GumConfig

GumConfig — gum configuration information (singleton object)

Functions

Properties

gchar * sysroot Read / Write / Construct Only

Types and Values

#define GUM_UMASK

Object Hierarchy

    GObject
    ╰── GumConfig

Includes

#include <gum/common/gum-config.h>

Description

GumConfig holds configuration information as a set of keys and values (integer or strings). The key names are defined in

General config keys,

and DBus config keys.

The configuration is retrieved from the gum configuration file. See below for where the file is searched for.

Usage

Following code snippet demonstrates how to create and use config object:


GumConfig* config = gum_config_new (sysroot_path);
const gchar *str = gum_config_get_string (config,
 GUM_CONFIG_GENERAL_SKEL_DIR, 0);
g_object_unref(config);

Where the configuration file is searched for

If gum has been compiled with --enable-debug, then these locations are used, in decreasing order of priority:

Otherwise, the config file location is determined at compilation time as $(sysconfdir) + "gum.conf"

Example configuration file

See example configuration file here:

gum configuration file

Functions

gum_config_new ()

GumConfig *
gum_config_new (const gchar *sysroot);

Create a singleton GumConfig object, which means 'sysroot' has to be passed on in the first call to this function.

Parameters

sysroot

sysroot property value.

[transfer none]

Returns

a singleton instance of GumConfig.


gum_config_prepend_sysroot ()

gchar *
gum_config_prepend_sysroot (GumConfig *self,
                            const gchar *string);

Prepends the sysroot path to the end of the 'string'. If sysroot is NULL or empty, then 'string' is duplicated and returned.

Parameters

self

an instance of GumConfig.

[transfer none]

string

string to append.

[transfer none]

Returns

concatenated string if successful, NULL otherwise.

[transfer full]


gum_config_get_int ()

gint
gum_config_get_int (GumConfig *self,
                    const gchar *key,
                    gint retval);

Get an integer configuration value.

Parameters

self

an instance of GumConfig.

[transfer none]

key

the key name

 

retval

value to be returned in case key is not found

 

Returns

the value corresponding to the key as an integer. If the key does not exist or cannot be converted to the integer, retval is returned.


gum_config_set_int ()

void
gum_config_set_int (GumConfig *self,
                    const gchar *key,
                    gint value);

Sets the configuration value to the provided integer.

Parameters

self

an instance of GumConfig.

[transfer none]

key

the key name

 

value

the value

 

gum_config_get_uint ()

guint
gum_config_get_uint (GumConfig *self,
                     const gchar *key,
                     guint retval);

Get an unsigned integer configuration value.

Parameters

self

an instance of GumConfig.

[transfer none]

key

the key name

 

retval

value to be returned in case key is not found

 

Returns

the value corresponding to the key as an unsigned integer. If the key does not exist or cannot be converted to the integer, retval is returned.


gum_config_set_uint ()

void
gum_config_set_uint (GumConfig *self,
                     const gchar *key,
                     guint value);

Sets the configuration value to the provided unsigned integer.

Parameters

self

an instance of GumConfig.

[transfer none]

key

the key name

 

value

the value

 

gum_config_get_string ()

const gchar *
gum_config_get_string (GumConfig *self,
                       const gchar *key);

Get a string configuration value.

Parameters

self

an instance of GumConfig.

[transfer none]

key

the key name.

[transfer none]

Returns

the value corresponding to the key as an string. If the key does not exist or cannot be converted to the integer, NULL is returned.


gum_config_set_string ()

void
gum_config_set_string (GumConfig *self,
                       const gchar *key,
                       const gchar *value);

Sets the configuration value to the provided string.

Parameters

self

an instance of GumConfig.

[transfer none]

key

the key name.

[transfer none]

value

the value.

[transfer none]

Types and Values

GUM_UMASK

#define GUM_UMASK  077

Value used to set the mode of home directories created for new users.

Property Details

The “sysroot” property

  “sysroot”                  gchar *

This property holds the shell path of the user. Shell path should not contain any control chars (0x00-0x1F,0x7F), comma (',' 0x2c) or colon (':' 0x3A). For new user, it is recommended to let the underlying framework to set the home directory of the user based on the configuration.

Flags: Read / Write / Construct Only

Default value: NULL