| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| | |
backports: Add g_steal_fd, from GLib >= 2.70
See merge request GNOME/libglnx!47
|
|/
|
|
|
|
|
|
|
|
| |
This is essentially the same as glnx_steal_fd, so make glnx_steal_fd an
alias for it.
The unit test is taken from GLib, slightly modified to avoid g_close()
and also test the old name glnx_steal_fd().
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\
| |
| |
| |
| | |
backports: Add a backport of g_memdup2()
See merge request GNOME/libglnx!46
|
| |
| |
| |
| | |
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|/
|
|
|
|
|
|
|
|
|
|
| |
g_memdup2() replaces g_memdup(), which is prone to integer overflow on
64-bit systems if copying a very large object with an
attacker-controlled size.
The original version in GLib is extern, but it seems simple enough to
inline a backport.
Related: https://gitlab.gnome.org/GNOME/glib/-/issues/2319
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\
| |
| |
| |
| | |
backport-testutils: Add g_assert_true(), g_assert_false()
See merge request GNOME/libglnx!44
|
| |
| |
| |
| |
| |
| |
| |
| | |
These were only added in 2.38, and some projects with particularly
ancient dependencies (like the Steam Runtime, based on a 2012 version
of Ubuntu) still avoid depending on that version.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \
| |/
|/|
| |
| | |
tests: Ensure saveptr is NULL before first call to strtok_r()
See merge request GNOME/libglnx!45
|
|/
|
|
|
|
|
|
|
| |
The standards-conformant behaviour is that the contents of saveptr
are ignored when the first argument is non-NULL, but the man page notes
that some older implementations required saveptr to be NULL in that
situation, and the gcc 4.8 provided by the Steam Runtime warns about this.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\
| |
| |
| |
| | |
build: Explicitly disable warnings for non-ISO C features
See merge request GNOME/libglnx!42
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
libglnx is intentionally not portable to non-Unix platforms or to
compilers that do not implement gcc/clang extensions, so it's
counterproductive to warn about these extensions, even if libglnx is used
by a parent project that generally (for the parts that don't use
libglnx) wants to be portable to any ISO C compiler.
Suggested by Will Thompson on !36.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \
| | |
| | |
| | |
| | | |
backports: Backport new NONE/DEFAULT constants from GLib 2.74
See merge request GNOME/libglnx!39
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
These enums were not originally defined with a zero-valued constant
(or in the case of GApplicationFlags, the constant always existed but
its name was inappropriate for GObject-Introspection), and the
corresponding constants were added in GLib 2.74 to make them more
self-documenting.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
backports: Use #ifndef instead of GLIB_CHECK_VERSION
See merge request GNOME/libglnx!43
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
As Will Thompson pointed out on !37, G_OPTION_ENTRY_NULL is a macro in
GLib, so we can test for it with `#ifndef` rather than a version guard.
This is a little bit nicer for parent projects that might already have
their own backport of it.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
Backport g_test_skip_printf(), etc.
See merge request GNOME/libglnx!38
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This includes a test (who tests the tests themselves?). Run
as `${build}/tests/testing --tap` with semi-modern GLib, or
`${build}/tests/testing --verbose` with GLib < 2.38, to check that the
output is as reasonable as possible given the limitations of the GLib
version in use.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is an enabler for testing a backport of GTest helpers
(g_test_skip(), etc.) in the oldest environment that I have conveniently
available (Steam Runtime 1 'scout' with GLib 2.32).
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
backports: Backport g_info()
See merge request GNOME/libglnx!40
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The rest of the g_log() wrappers have been there since time immemorial,
but g_info() was initially omitted. It's useful for projects like Flatpak
that want to have two levels of off-by-default logging, which map nicely
to info and debug.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \ \ \
| | |/ /
| |/| /
| |_|/
|/| | |
Add backports of straightforward constants
See merge request GNOME/libglnx!37
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
These are convenient for the same reasons as G_SOURCE_REMOVE and
G_SOURCE_CONTINUE.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| | |
| | |
| | |
| | |
| | |
| | | |
These make tables of options a bit clearer to write.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| | |
| | |
| | |
| | |
| | |
| | | |
This makes the absence of flags a bit clearer to write.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
build: Reduce default warning level from 3 to 2
See merge request GNOME/libglnx!36
|
| |/
| |
| |
| |
| |
| |
| |
| | |
Warning level 2 is -Wall -Wextra, and warning level 3 adds -Wpedantic
(warnings about use of non-ISO extensions). libglnx is intentionally
using non-ISO features, so -Wpedantic is counterproductive.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \
| |/
|/|
| |
| | |
fdio: fix fd offset handling with `FICLONE`
See merge request GNOME/libglnx!41
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using `FICLONE`, the kernel does a full file clone and disregards the
fd offsets. Users of this API however assume that it *is*
offset-sensitive. So we need to verify that the fd offsets are at the
start of the files before we call `FICLONE`. This was done in systemd also
in:
https://github.com/systemd/systemd/commit/c622fbdb8d37
The commit message does not explain this but `ioctl_ficlone(2)` says:
The `FICLONE` ioctl clones entire files.
(Compare with `FICLONERANGE`, which takes a struct with offsets and the
length).
Similarly, we need to seek to the end of the file descriptors on success
so that we're consistent with the behaviour of the other backends
available (`copy_file_range`, `sendfile` and manual copying). This also
matches what systemd does nowadays:
https://github.com/systemd/systemd/blob/80f967311ac5/src/shared/copy.c#L199
|
|\
| |
| |
| |
| | |
Fix and enable more compiler warnings
See merge request GNOME/libglnx!35
|
| |
| |
| |
| |
| |
| |
| |
| | |
If we keep this module closer to warnings-clean, then it can be
submoduled into Meson projects that enable warnings by default without
having to override it to a lower warning-level.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| | |
This silences a warning from gcc -Wsign-compare. g_get_monotonic_time()
returns a signed int64.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
g_variant_n_children() returns a size_t (or gsize, which is equivalent)
so in principle it could overflow an int, although in practice we are
not going to have that many extended attributes. This silences a
warning from gcc -Wsign-compare.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
This is documented as taking a length of -1, but the parameter is
unsigned, so it's more correctly ((gsize) -1). This silences a warning
from gcc -Wsign-compare.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| | |
gcc -Wsign-compare warns about this. The iteration limit is constant
and small enough that either int or guint would be fine.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| | |
These functions take a GCancellable for consistency with other file
APIs, but are not actually cancellable at the moment.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| | |
This signal handler is only called for SIGWINCH, so it doesn't need
to look at its parameter.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\ \
| |/
|/|
| |
| | |
Improve Meson subproject support
See merge request GNOME/libglnx!34
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
fallocate() is only visible in fcntl.h if _GNU_SOURCE is defined.
Most users of libglnx will want to do that anyway, but it seems nicer
to avoid "implicit declaration of function ‘fallocate’" warnings from
simply including <libglnx.h> into naive code.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| | |
What isn't tested usually doesn't work, and the only way to use libglnx
is as a subproject, so test it like that.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| | |
If we're building libglnx as a subproject in a larger project, we won't
necessarily want to run these.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
One of Flatpak's unit tests uses this, for _GLNX_TEST_SCOPED_TEMP_DIR.
Its API is not really stable, but libglnx is a "copylib" anyway, so
none of it has (or needs) a strictly stable API.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This copylib isn't intended to be part of anyone's ABI. In Autotools,
this is typically implemented by doing some ad-hoc compiler checks and
adding -fvisibility=hidden to the global CFLAGS of any library that
pulls in libglnx, but in Meson it's a build system feature.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|/
|
|
|
|
|
|
|
| |
If we don't do this, users of libglnx all have to add this dependency
themselves, otherwise they'll get errors like:
fatal error: gio/gfiledescriptorbased.h: No such file or directory
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|\
| |
| |
| |
| | |
Add libglnx-config.h to CLEANFILES
See merge request GNOME/libglnx!33
|
|/
|
|
|
| |
This fixes make distcheck for Flatpak (but you have to re-run
autogen.sh).
|
|\
| |
| |
| |
| | |
tests: Don't copy extended attributes when testing pseudo-files
See merge request GNOME/libglnx!32
|
|/
|
|
|
|
|
| |
It seems that on SELinux systems, files in /proc have extended
attributes that cannot be copied by an unprivileged user.
Signed-off-by: Simon McVittie <smcv@debian.org>
|
|\
| |
| |
| |
| | |
Declare copyright and licensing using REUSE
See merge request GNOME/libglnx!27
|
| |
| |
| |
| |
| |
| |
| | |
Will Thompson reports that all of Endless' IP was transferred to
Endless OS Foundation LLC.
Signed-off-by: Simon McVittie <smcv@debian.org>
|