- Jul 28, 2023
-
-
Simon McVittie authored
When testing something that is expected to fail or crash, it's useful to disable core dump reporting. This is a slightly simplified version of GNOME/glib!3510: because libglnx isn't portable to non-Linux, we can assume that <sys/prctl.h>, prctl() and <sys/resource.h> are always available, so we don't need to check for them in the build system. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
- Feb 27, 2023
-
-
Will Thompson authored
backports: Add g_steal_fd, from GLib >= 2.70 See merge request GNOME/libglnx!47
-
- Nov 08, 2022
-
-
Simon McVittie authored
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>
-
- Nov 01, 2022
-
-
Colin Walters authored
backports: Add a backport of g_memdup2() See merge request GNOME/libglnx!46
-
- Oct 28, 2022
-
-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
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>
-
- Oct 10, 2022
-
-
Simon McVittie authored
backport-testutils: Add g_assert_true(), g_assert_false() See merge request GNOME/libglnx!44
-
Will Thompson authored
tests: Ensure saveptr is NULL before first call to strtok_r() See merge request GNOME/libglnx!45
-
Simon McVittie authored
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>
-
Simon McVittie authored
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>
-
Will Thompson authored
build: Explicitly disable warnings for non-ISO C features See merge request GNOME/libglnx!42
-
Simon McVittie authored
backports: Backport new NONE/DEFAULT constants from GLib 2.74 See merge request GNOME/libglnx!39
-
Simon McVittie authored
backports: Use #ifndef instead of GLIB_CHECK_VERSION See merge request GNOME/libglnx!43
-
Simon McVittie authored
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>
-
Simon McVittie authored
Backport g_test_skip_printf(), etc. See merge request GNOME/libglnx!38
-
Simon McVittie authored
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>
-
Simon McVittie authored
backports: Backport g_info() See merge request GNOME/libglnx!40
-
Simon McVittie authored
Add backports of straightforward constants See merge request GNOME/libglnx!37
-
Simon McVittie authored
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>
-
Simon McVittie authored
build: Reduce default warning level from 3 to 2 See merge request GNOME/libglnx!36
-
- Aug 19, 2022
-
-
Simon McVittie authored
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>
-
Simon McVittie authored
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>
-
Simon McVittie authored
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>
-
Simon McVittie authored
These are convenient for the same reasons as G_SOURCE_REMOVE and G_SOURCE_CONTINUE. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
These make tables of options a bit clearer to write. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
This makes the absence of flags a bit clearer to write. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
- Aug 01, 2022
-
-
Colin Walters authored
fdio: fix fd offset handling with `FICLONE` See merge request GNOME/libglnx!41
-
- Jul 29, 2022
-
-
Jonathan Lebon authored
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
-
- Jul 27, 2022
-
-
Simon McVittie authored
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>
-
Simon McVittie authored
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>
-
- May 10, 2022
-
-
Phaedrus Leeds authored
Fix and enable more compiler warnings See merge request GNOME/libglnx!35
-
Phaedrus Leeds authored
Improve Meson subproject support See merge request GNOME/libglnx!34
-
- Apr 24, 2022
-
-
Simon McVittie authored
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>
-
Simon McVittie authored
This silences a warning from gcc -Wsign-compare. g_get_monotonic_time() returns a signed int64. Signed-off-by:
Simon McVittie <smcv@collabora.com>
-
Simon McVittie authored
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>
-
Simon McVittie authored
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>
-
Simon McVittie authored
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>
-
Simon McVittie authored
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>
-
Simon McVittie authored
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>
-
- Apr 21, 2022
-
-
Simon McVittie authored
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>
-