This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

What

LibGSystem is a GIO-based library, targeted primarily for use by operating system components.

It is on track to being deprecated; some of its components have moved into GLib (the cleanup macros and subprocess). Other Linux-specific parts will move into a to-be-created git submodule (likely "libgsystem2").

Old Description

It has a few goals:

Requirements

How

Libgsystem used to be a git submodule. If you are still using it this way, you can follow the submodule branch. To use it that way, see Projects/LibGSystem/SubmoduleInstructions.

Example users

OSTree

attribute(cleanup) macros

These macros allow automatically performing an unref/free on GLib data types when a variable goes out of scope. They're based on the GCC attribute(cleanup). See GCC manual, this post to gtk-devel-list, networkmanager-devel discussion.

Example:

static void
print_yes_if_file_exists (GFile *path)
{
  gs_unref_object GFileInfo *fileinfo = NULL;

  fileinfo = g_file_query_info (path, "standard::*", 0, NULL, NULL);
  if (!fileinfo)
    return; /* fileinfo is automatically unreffed here */
  g_print ("yes\n");
  /* fileinfo is automatically unreffed here */
}

GLib utility API

libgsystem includes at present high level file helpers, subprocess launching, and more.

Linux-specific APIs

While GLib transparently takes advantage of Linux features in may cases, not all APIs are wrapped nicely. An example API that libgsystem provides is reading a file with O_NOATIME.


2024-10-23 11:37