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:
Provide macros for the GCC attribute(cleanup) that work with GLib data types. Using these can dramatically simplify local memory management inside functions.
- Prototype and test APIs that will eventually be in GLib. Currently these include "GSSubprocess" for launching child processes, and some GFile helpers.
 - Provide Linux-specific APIs in a nicer GLib fashion, such as O_NOATIME.
 
Requirements
gio-unix-2.0 (libgsystem will not build on Windows)
- GCC or CLang (the known compilers implementing attribute(cleanup)); compilers which are known to currently NOT implement this are MSVC and Sun Studio.
 
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
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.