since: 2.64


g_get_os_info (
  const gchar* key_name


Get information about the operating system.

On Linux this comes from the /etc/os-release file. On other systems, it may come from a variety of sources. You can either use the standard key names like G_OS_INFO_KEY_NAME or pass any UTF-8 string key name. For example, /etc/os-release provides a number of other less commonly used values that may be useful. No key is guaranteed to be provided, so the caller should always check if the result is NULL.

Available since: 2.64



Type: const gchar*

A key for the OS info being requested, for example G_OS_INFO_KEY_NAME.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: gchar*

The associated value for the requested key or NULL if this information is not provided.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be NULL.
The value is a NUL terminated UTF-8 string.