## FlatpakInstance

FlatpakInstance — Information about a running sandbox

## Functions

GPtrArray * | flatpak_instance_get_all ()
const char * | flatpak_instance_get_id ()
const char * | flatpak_instance_get_app ()
const char * | flatpak_instance_get_arch ()
const char * | flatpak_instance_get_branch ()
const char * | flatpak_instance_get_commit ()
const char * | flatpak_instance_get_runtime ()
const char * | flatpak_instance_get_runtime_commit ()
int | flatpak_instance_get_pid ()
int | flatpak_instance_get_child_pid ()
GKeyFile * | flatpak_instance_get_info ()
gboolean | flatpak_instance_is_running ()

## Types and Values

struct | FlatpakInstance

## Object Hierarchy

        GObject
        ╰── FlatpakInstance

## Description

A FlatpakInstance refers to a running sandbox, and contains some basic information about the sandbox setup, such as the application and runtime used inside the sandbox.

Importantly, it also gives access to the PID of the main processes in the sandbox.

One way to obtain FlatpakInstances is to use `flatpak_instance_get_all()`. Another way is to use `flatpak_installation_launch_full()`.

Note that process lifecycle tracking is fundamentally racy. You have to be prepared for the sandbox and the processes represented by a FlatpakInstance to not be around anymore.

The FlatpakInstance api was added in Flatpak 1.1.

## Functions

### flatpak_instance_get_all ()

    GPtrArray *
    flatpak_instance_get_all (void);

Gets FlatpakInstance objects for all running sandboxes in the current session.

#### Returns

a GPtrArray of FlatpakInstance objects.

[transfer full][element-type FlatpakInstance]

Since: 1.1

### flatpak_instance_get_id ()

    const char *
    flatpak_instance_get_id (FlatpakInstance *self);

Gets the instance ID. The ID is used by Flatpak for bookkeeping purposes and has no further relevance.

#### Parameters

self | a FlatpakInstance |

#### Returns

the instance ID

Since: 1.1

### flatpak_instance_get_app ()

    const char *
    flatpak_instance_get_app (FlatpakInstance *self);

Gets the application ID of the application running in the instance.

Note that this may return `NULL` for sandboxes that don't have an application.

#### Parameters

self | a FlatpakInstance |

#### Returns

the application ID

Since: 1.1

### flatpak_instance_get_arch ()

    const char *
    flatpak_instance_get_arch (FlatpakInstance *self);

Gets the architecture of the application running in the instance.

#### Parameters

self | a FlatpakInstance |

#### Returns

the architecture

Since: 1.1

### flatpak_instance_get_branch ()

    const char *
    flatpak_instance_get_branch (FlatpakInstance *self);

Gets the branch of the application running in the instance.

#### Parameters

self | a FlatpakInstance |

#### Returns

the architecture

Since: 1.1

### flatpak_instance_get_commit ()

    const char *
    flatpak_instance_get_commit (FlatpakInstance *self);

Gets the commit of the application running in the instance.

#### Parameters

self | a FlatpakInstance |

#### Returns

the commit

Since: 1.1

### flatpak_instance_get_runtime ()

    const char *
    flatpak_instance_get_runtime (FlatpakInstance *self);

Gets the ref of the runtime used in the instance.

#### Parameters

self | a FlatpakInstance |

#### Returns

the runtime ref

Since: 1.1

### flatpak_instance_get_runtime_commit ()

    const char *
    flatpak_instance_get_runtime_commit (FlatpakInstance *self);

Gets the commit of the runtime used in the instance.

#### Parameters

self | a FlatpakInstance |

#### Returns

the runtime commit

Since: 1.1

### flatpak_instance_get_pid ()

    int
    flatpak_instance_get_pid (FlatpakInstance *self);

Gets the PID of the outermost process in the sandbox. This is not the application process itself, but a bubblewrap 'babysitter' process.

See `flatpak_instance_get_child_pid()`.

#### Parameters

self | a FlatpakInstance |

#### Returns

the outermost process PID

Since: 1.1

### flatpak_instance_get_child_pid ()

    int
    flatpak_instance_get_child_pid (FlatpakInstance *self);

Gets the PID of the application process in the sandbox.

See `flatpak_instance_get_pid()`.

Note that this function may return 0 immediately after launching a sandbox, for a short amount of time.

#### Parameters

self | a FlatpakInstance |

#### Returns

the application process PID

Since: 1.1

### flatpak_instance_get_info ()

    GKeyFile *
    flatpak_instance_get_info (FlatpakInstance *self);

Gets a keyfile that holds information about the running sandbox.

This file is available as /.flatpak-info inside the sandbox as well.

The most important data in the keyfile is available with separate getters, but there may be more information in the keyfile.

#### Parameters

self | a FlatpakInstance |

#### Returns

the flatpak-info keyfile

Since: 1.1

### flatpak_instance_is_running ()

    gboolean
    flatpak_instance_is_running (FlatpakInstance *self);

Finds out if the sandbox represented by `self` is still running.

#### Parameters

self | a FlatpakInstance |

#### Returns

`TRUE` if the sandbox is still running

## Types and Values

### struct FlatpakInstance

    struct FlatpakInstance;