## InfinotedUtil InfinotedUtil — Miscellaneous helper functions. |

## Stability Level

Unstable, unless otherwise indicated

## Functions

gboolean | infinoted_util_create_dirname ()
void | infinoted_util_set_errno_error ()
void | infinoted_util_daemon_set_global_pid_file_proc ()
void | infinoted_util_daemon_set_local_pid_file_proc ()
int | infinoted_util_daemon_pid_file_kill ()

## Includes

    #include <infinoted/infinoted-util.h>

## Description

This section contains a few helper functions that are used in the infinoted implementation and are exposed to the plugin interface for convenience of plugin developers.

## Functions

### infinoted_util_create_dirname ()

    gboolean
    infinoted_util_create_dirname (const gchar *path,
                                   GError **error);

Creates directories leading to the given path. Does not create a directory for the last component of the path, assuming that it is a filename that you are going to write into that directory later.

#### Parameters

path | The filename to create a path to. | [type filename]
error | Location to store error information, if any. |

#### Returns

`TRUE` on success, or `FALSE` on error in which case `error` is set.

### infinoted_util_set_errno_error ()

    void
    infinoted_util_set_errno_error (GError **error,
                                    int save_errno,
                                    const char *prefix);

Sets `error` to `save_errno` with domain ERRNO_ERROR. If `prefix` is non-`NULL`, `prefix` is prefixed to `error` 's message, obtained by `strerror()`.

#### Parameters

error | A pointer to a GError pointer, or `NULL`. |
save_errno | An errno variable. |
prefix | A prefix string, or `NULL`. | [allow-none]

### infinoted_util_daemon_set_global_pid_file_proc ()

    void
    infinoted_util_daemon_set_global_pid_file_proc
                                   (void);

When attempting to read or write the PID file use the global file.

### infinoted_util_daemon_set_local_pid_file_proc ()

    void
    infinoted_util_daemon_set_local_pid_file_proc
                                   (void);

When attempting to read or write the PID file use the local file which is in the owner's home directory.

### infinoted_util_daemon_pid_file_kill ()

    int
    infinoted_util_daemon_pid_file_kill (int sig);

This is a thin wrapper for ``daemon_pid_file_kill()`` which uses ``daemon_pid_file_kill_wait()`` if available with a timeout of 5 seconds.

#### Parameters

sig | The signal to send to the daemon process. |

#### Returns

0 if the signal was sent or nonzero otherwise.