Commit Graph

16 Commits

Author SHA1 Message Date
Sebastian Wick
a973baad08 chase: Add glnx_chaseat which functions similar to openat2
The selling features are:

* Support for RESOLVE_BENEATH, RESOLVE_IN_ROOT and RESOLVE_NO_SYMLINKS
* Fallback from openat2 to open_tree to openat for compatibility
* Triggering of automounts
2026-03-17 18:40:38 +01:00
Simon McVittie
5a60c0bca5 Move assertion/test utilities to a separate header
A lot of recent convenience APIs can easily be backported, but they'll
clutter glnx-backports.h. In preparation, split these out.

Another reason to separate these is that when we start adding backports
of test utilities that need implementation code in the libglnx static
library, we'll want their implementations to be in a separate
translation unit, so that they don't get linked into production
executables, only into tests.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-08-19 10:56:36 +01:00
Simon McVittie
81c6adb0f7 Declare copyright and licensing using REUSE
To fill in some gaps, I've had to make some assumptions:

* trivial changes (such as checking for an additional function or
  header file in libglnx.m4) are assumed to not be copyrightable
* Will Thompson and Matthew Leeds are assumed to be contributing on
  behalf of Endless Mobile Inc.
* files with no explicit licensing information are assumed to be
  under the license found in COPYING

Reference: https://reuse.software/
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-02-19 22:57:48 +00:00
Colin Walters
dd5fd9c1e5 missing: Sync from latest systemd, add memfd_create()
Planning to use memfd_create() in flatpak and rpm-ostree, which both use
bubblewrap, and want to pass read-only data via file descriptor to the
container. Passing via `O_TMPFILE` requires `O_RDWR` (read and write),
and passing via a pipe would require buffering.

The systemd `missing.h` has grown enormously; I only cherry-picked the bits for
memfd.
2017-10-01 09:51:14 -07:00
Colin Walters
9a1b77ef96 Add G_IN_SET, patch our internal users via spatch
I originally tried to get this into GLib:
https://bugzilla.gnome.org/show_bug.cgi?id=783751

But that looks like it's going to fail due to MSVC. Let's add it here at least
so I can start using it tomorrow and not wait for the MSVC team to catch up.

I renamed `glnx-alloca.h` to `glnx-macros.h` as a more natural collective
home for things from systemd's `macro.h`.

Finally, I used a Coccinelle spatch similar to the one referenced
in the above BZ to patch our uses.
2017-06-14 12:48:20 -04:00
Colin Walters
7ce80827bd Remove libcontainer
No longer used by anything; see https://github.com/projectatomic/rpm-ostree/pull/429
2016-08-30 16:14:22 -04:00
Colin Walters
2ca280f012 Introduce glnx-alloca.h with glnx_strjoina()
This is taken from systemd, and is really useful when one has a few
known-to-be-small strings one wants to concatenate without resorting
to malloc.
2016-01-24 12:10:26 -05:00
Colin Walters
0cf50c6735 Add a generic glnx-backports.h
Where we can put general functions that come in newer glib.
2015-08-29 09:29:11 -04:00
Colin Walters
be6bc2d75d lockfile: New code to lock files, massaged from systemd
Will be used by OSTree to lock the sysroot against concurrent
manipulation.  Taken from current systemd git master, tweaked to
GLibify.
2015-05-05 08:49:00 -04:00
Colin Walters
a11b2eb20a Import libcontainer code from rpm-ostree
Now that this module is Linux specific, we can more cleanly depend on
it here.
2015-03-04 18:29:14 -05:00
Colin Walters
1ebfefa565 fdio: New APIs to read/write on fds, fd-relative
We don't have this really in GLib, unfortunately.  We do want
GCancellable, but we also want to operate on raw fds where possible.

The "read a file and validate as UTF-8" is a common use case of mine,
and this combines that with openat().
2015-02-20 12:17:04 -05:00
Colin Walters
d469ad2a9c Include autocleanups - it has the definitions which we want 2015-02-19 15:35:35 -05:00
Colin Walters
64936b6700 Import console from rpm-ostree
This contains some basic progress bar drawing code for now.
2015-02-17 16:52:49 -05:00
Colin Walters
f5399c8348 Import xattr reading code from libgsystem 2015-02-15 17:26:47 -05:00
Colin Walters
8e9a171ec4 Import directory iteration, errno handling, and shutil from libgsystem 2015-02-15 11:53:34 -05:00
Colin Walters
5ac3f4a119 Initial commit; backport of GLib autoptr code
This module is a new successor to libgsystem.  It currently contains a
backport of the GLib cleanup macros, but soon more Linux-specific code
will be added.
2015-02-14 13:41:51 -05:00