Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
332 commits
Select commit Hold shift + click to select a range
80e5af9
shutil: Use new API to iterate ensuring d_type
cgwalters Jul 29, 2016
c2ba4d8
Add --disable-otmpfile
cgwalters Aug 3, 2016
5ac0d70
fdio: Only invoke fallocate() for sizes > 0
cgwalters Aug 3, 2016
871617d
Add missing files to libglnx distribution
smcv Aug 5, 2016
4ae5e3b
libcontainer: Add a fd-relative API
cgwalters Aug 7, 2016
7ce8082
Remove libcontainer
cgwalters Aug 30, 2016
1e7b968
Distribute libglnx.m4
dbnicholson Aug 31, 2016
36396b4
build: Add --enable-wrpseudo-compat
cgwalters Oct 5, 2016
7d2f577
fdio: Make GLnxFileCopyFlags actually flags
cgwalters Oct 25, 2016
abd37a4
dirfd: Set initialized flag for iters
cgwalters Oct 24, 2016
597f03b
dirfd: Use better and faster random algorithm for gen_temp_name()
cgwalters Jan 26, 2017
6bf5525
listxattr: Don't assume that first call to listxattr gives correct size
wmanley Jan 10, 2017
afd178f
xattrs: Handle xattrs changing size concurrently
cgwalters Jan 11, 2017
1ac3548
xattrs: Dedup fd reading code
cgwalters Jan 11, 2017
7be21de
xattrs: Handle ERANGE
cgwalters Jan 11, 2017
7a70363
xattrs: Add a test case for previous commits
cgwalters Jan 29, 2017
2a71cb6
COPYING: Bump to LGPL 2.1 due to systemd import
cgwalters Feb 11, 2017
0c1603d
tests/xattrs: Fix possible NULL allocation
cgwalters Feb 21, 2017
5309e36
fix bug found by -Wmaybe-uninitialized
jlebon Mar 2, 2017
c83ec7f
fdio: Expose wrappers for renameat2() EXCHANGE and NOREPLACE
cgwalters Mar 2, 2017
074236b
errors: Add new glnx_throw_errno{,_prefix}() APIs
cgwalters Mar 21, 2017
602fdd9
errors: Add glnx_throw() and tests
cgwalters Mar 21, 2017
0c52d85
glnx-errors.h: add glnx_null_throw[_*] variants
jlebon Mar 2, 2017
4040f55
errors: Fix legacy set_prefix_error_from_errno()
cgwalters Mar 24, 2017
2576a07
glnx-local-alloc: Make check for invalid FDs more general
pwithnall Apr 20, 2017
9307f51
glnx-shutil: Add glnx_shutil_mkdir_p_at_open()
pwithnall Apr 20, 2017
6746e6f
glnx-dirfd: Add variants of glnx_mkdtempat() which open the directory
pwithnall Apr 20, 2017
2b82858
glnx-fdio: Add wrappers around fstat() and fstatat() to handle errors
pwithnall Apr 21, 2017
74383ba
tests/xattrs: Skip on filesystems with no user xattr support
cgwalters Apr 19, 2017
47fafa9
Port most code (except fdio) to new style
cgwalters Apr 25, 2017
dc1956b
fdio: Mostly port to new code style
cgwalters Apr 25, 2017
3a4d0f4
fdio: Expose glnx_regfile_copy_bytes(), rewrite: GNU style, POSIX errno
cgwalters Apr 27, 2017
32231fd
glnx-errors.h: add a glnx_throw_prefix() variant
jlebon May 11, 2017
9929adc
fdio: Redo tmpfile API with GLnxTmpfile struct
cgwalters May 15, 2017
4fbd48f
fdio: Add missing return in tmpfile error case
cgwalters May 17, 2017
2f8fdf8
fdio: Allow using AT_FDCWD with GlnxTmpfile
alexlarsson May 19, 2017
66d1628
dirfd,xattrs: Port mostly to new code style
cgwalters May 26, 2017
f5ba01c
dirfd: Have dfd iter _take_fd() take a pointer and do a steal
cgwalters May 31, 2017
05abf21
fdio: Add glnx_try_fallocate()
cgwalters Jun 12, 2017
9a1b77e
Add G_IN_SET, patch our internal users via spatch
cgwalters Jun 13, 2017
e8b7d8f
test-libglnx-macros.c: fix missing semicolon
jlebon Jun 17, 2017
caa51ac
glnx-macros.h: add GLNX_HASH_TABLE_FOREACH macros
jlebon Jun 14, 2017
4d34066
fdio: Add wrappers for renameat(), unlinkat()
cgwalters Jun 26, 2017
5ab15ac
macros: add GLNX_HASH_TABLE_FOREACH_V
jlebon Jun 28, 2017
d4c5c02
fdio: Be sure to unset tmpfile's initialized state on cleanup
cgwalters Jun 28, 2017
e55fd8e
fdio: Introduce glnx_open_anonymous_tmpfile()
cgwalters Jun 28, 2017
71d8755
macros: Avoid scanning macros
cgwalters Jun 28, 2017
6c2967c
fdio: Remove extra ';' in header
cgwalters Jun 28, 2017
01e934c
tests: Fix compilation of fdio test
cgwalters Jun 28, 2017
a37e672
macros: Add a size check for hashtable iters
cgwalters Jun 30, 2017
452c371
fdio: Ensure O_TMPFILE is mode 0600
cgwalters Jul 10, 2017
210bcfc
README.md: Change xdg-app to flatpak
mwleeds Jul 13, 2017
e30a773
fdio: Add cleanup+flush API for FILE*
cgwalters Jul 10, 2017
8b75c8e
Remove glnx_stream_fstat()
cgwalters Jul 11, 2017
547bcea
fdio: Add a fchmod wrapper
cgwalters Jul 11, 2017
61ef326
fdio: Add string prefix for glnx_fstat()
cgwalters Jul 11, 2017
607f177
errors: Add GLNX_AUTO_PREFIX_ERROR
cgwalters Jul 13, 2017
23f7df1
dirfd: Add filename to glnx_opendirat()
cgwalters Jul 19, 2017
268ae48
fdio: Introduce glnx_openat_read()
cgwalters Jul 19, 2017
1c0bfd2
dirfd: Add glnx_ensure_dir()
cgwalters Jul 19, 2017
1468b70
dirfd: Add missing includes for errno
cgwalters Jul 20, 2017
7d6a31f
errors: Mark GLNX_AUTO_PREFIX_ERROR() as used
cgwalters Jul 20, 2017
c820571
errors: check for an error before prefixing
jlebon Jul 21, 2017
ea6df95
tests: Fix a -Wmaybe-uninitialized warning
cgwalters Jul 21, 2017
50a0fea
localalloc: Abort on EBADF from close() by default
cgwalters Jul 26, 2017
a46752e
local-alloc: Remove almost all macros like glnx_free, glnx_unref_variant
cgwalters Jul 31, 2017
29ad99c
console: Fix Coverity NULL deref warning
cgwalters Aug 1, 2017
d18f026
fdio: Merge systemd code to use copy_file_range(), use FICLONE
cgwalters Aug 2, 2017
1893c1f
glnx-console: Add missing NULL check before writing out text
pwithnall Aug 15, 2017
6bd24ba
dirfd: Fix typo in comment
mwleeds Aug 15, 2017
e226ccf
console: trim useless check
jlebon Aug 15, 2017
7100ebb
dirfd: New tmpdir API
cgwalters Aug 18, 2017
47d8163
test-libglnx-xattrs.c: appease -Wunused-variable
jlebon Aug 25, 2017
627d4e2
fdio: Add glnx_fstatat_allow_noent()
cgwalters Sep 6, 2017
806bb46
fdio: Use O_EXCL for anonymous tmpfiles
cgwalters Sep 11, 2017
9d995a3
fdio: Support taking ownership of tmpfile fd
cgwalters Sep 11, 2017
673f48f
fdio: Use O_TMPFILE + rename-overwrite for regfile copies
cgwalters Sep 11, 2017
b59bb2b
fdio: Add gtk-doc for stbuf parameter of glnx_file_copy_at()
cgwalters Sep 12, 2017
0428fd8
dirfd: Extend tmpdir API to support optional cleaning
cgwalters Sep 12, 2017
667d8aa
tree-wide: Use our own syscall wrappers or error prefixing
cgwalters Sep 12, 2017
c2bcca0
tests: Add macro for auto-error checking
cgwalters Sep 12, 2017
e5856ca
build-sys: Fix make dist
cgwalters Sep 17, 2017
56e7e72
dirfd: Fix typo in documentation for glnx_ensure_dir()
pwithnall Sep 21, 2017
5ee2f1b
fdio: Open target dirname for glnx_file_copy_at()
cgwalters Sep 22, 2017
292cfc8
macros: use size_t for glnx_strjoina len
jlebon Sep 25, 2017
32a4293
lockfile: Use an `initialized` member rather than explicit init
cgwalters Sep 18, 2017
e301544
shutil: Fix assertion failure in glnx_shutil_mkdir_p_at()
pwithnall Sep 26, 2017
dd5fd9c
missing: Sync from latest systemd, add memfd_create()
cgwalters Oct 1, 2017
b72906d
fdio: Generate tmpname for RENAME_EXCHANGE fallback
cgwalters Oct 2, 2017
dea16cd
fdio: Squash compiler warning from previous commit
cgwalters Oct 5, 2017
97cd6a6
Add glnx_fd_close() and glnx_autofd
cgwalters Oct 6, 2017
5362f6b
fdio: allow NULL for fstatat_allow_noent stbuf
jlebon Oct 6, 2017
b923a95
tests: drop unused variable
jlebon Oct 11, 2017
e627524
fdio: Avoid ?: syntax for fstatat_allow_noent()
cgwalters Oct 11, 2017
771d7a0
tree-wide: Use glnx_autofd and glnx_close_fd()
cgwalters Oct 16, 2017
d15a379
tree-wide: Some new style porting
cgwalters Oct 16, 2017
4577dc8
Add missing configure check for copy_file_range
wjt Nov 2, 2017
b36606b
missing-syscall: #include config.h
cgwalters Nov 2, 2017
016ea91
errors: don't use 'static inline' on varargs functions
wjt Nov 2, 2017
03b48a3
fdio: implement glnx_basename from scratch
halfline Nov 10, 2017
31ef196
fdio: Include libgen.h again for dirname()
cgwalters Dec 12, 2017
a8f96bd
console: Add an "n items" API
cgwalters Dec 12, 2017
bb7dd4d
console: Limit progress bar to 20 columns max
cgwalters Dec 12, 2017
985ed1c
console: Drop unused current_text/current_percent
cgwalters Dec 12, 2017
96b1fd9
console: Avoid rendering too quickly
cgwalters Dec 12, 2017
6f1ee5d
console: make stdout_is_tty() public
jlebon Jan 10, 2018
0c82203
Include sys/mman.h when checking for memfd_create
Feb 17, 2018
03e16af
missing-syscalls: Use different name for copy_file_range
jlebon May 4, 2018
97b5c08
console: Drop newline on glnx_console_lock
cgwalters May 8, 2018
00ad6ee
Add g_autoptr support for GAsyncResult,GMount,GVolumeMonitor
mwleeds May 29, 2018
e1a78cf
Merge branch 'backport-autoptr-support' into 'master'
pwithnall May 29, 2018
7be2552
libglnx.m4: Include stdio.h for renameat2
cgwalters Jul 11, 2018
470af87
Merge branch 'renameat2-stdio' into 'master'
cgwalters Jul 13, 2018
c2dbe18
Fix docs for glnx_file_replace_contents()
owtaylor Nov 30, 2018
13e7b4f
Merge branch 'replace-contents-umask' into 'master'
cgwalters Nov 30, 2018
1e9b308
README: Update Contributing
cgwalters Nov 30, 2018
b1cb19b
shutil: Prefix error with path in rm_rf()
cgwalters Dec 6, 2018
e16bdc7
Merge branch 'shutil-rm-rf-errprefix' into 'master'
cgwalters Dec 7, 2018
0f53dc3
Add meson.build files
wjt Mar 28, 2019
80779a3
missing: Remove unused <uchar.h>
smcv May 1, 2019
5920f9f
Document using this as a Meson subproject
wjt Mar 28, 2019
04c11c7
Run the fdio test in its own temporary directory
smcv May 2, 2019
170b105
Add GitLab CI
wjt Mar 28, 2019
744bd18
meson: Define HAVE_DECL_FOO to 0 if foo isn't declared
smcv May 10, 2019
738ee7a
Make the Meson build work on older compilers
smcv May 2, 2019
4fca08e
CI: Target a Fedora stable release
smcv May 13, 2019
8f34033
Merge branch 'uchar' into 'master'
jlebon May 13, 2019
460400c
macros: Add TEMP_FAILURE_RETRY for musl
akiernan Sep 9, 2019
15c0646
Merge branch 'us-temp-failure-retry' into 'master'
cgwalters Sep 17, 2019
e8233c6
Add glnx_open_anonymous_tmpfile_full() allowing you to specify the di…
alexlarsson Oct 9, 2019
2eeb8a7
Merge branch 'anonymous-tmpfile-dir' into 'master'
cgwalters Oct 11, 2019
41ecc54
Merge branch 'meson-older-compilers' into 'master'
cgwalters Oct 11, 2019
0cf0955
fdio: Add glnx_tmpfile_reopen_rdonly()
cgwalters Oct 31, 2019
23f43fa
Merge branch 'reopen-rdonly' into 'master'
cgwalters Nov 4, 2019
1503eaa
build-sys: Add libglnx-testlib.c to Automake
cgwalters Nov 4, 2019
9d0711f
Merge branch 'testlib-automake' into 'master'
cgwalters Nov 4, 2019
46ba6b4
backports: Add a backport of g_clear_pointer()
smcv May 1, 2019
c8216c9
backport-autocleanups: Hide autocleanups for types we don't have
smcv May 1, 2019
3063c69
Make tests cope with older GLib
smcv May 2, 2019
5f3d352
Merge branch 'older-glibs' into 'master'
smcv Nov 11, 2019
bc9c31f
_GLNX_TEST_SCOPED_TEMP_DIR: Mark variable as G_GNUC_UNUSED
smcv Nov 11, 2019
a652ede
_GLNX_TEST_SCOPED_TEMP_DIR: Fix memory and fd leak
smcv Nov 11, 2019
70988f0
README: update link to libgsystem
wjt Nov 29, 2019
c316e51
Merge branch 'auto-temp-dir-unused' into 'master'
smcv Mar 15, 2020
bf851fb
Merge branch 'auto-temp-dir-leak' into 'master'
smcv Mar 15, 2020
fc9073e
Merge branch 'readme-libgsystem' into 'master'
smcv Jun 3, 2020
dbed5c5
fdio: Be const-correct for struct stat
smcv Jun 3, 2020
3c285a7
Merge branch 'wip/smcv/const-struct-stat' into 'master'
smcv Jun 9, 2020
3f38e98
libglnx.m4: Fix grammar in help string
mwleeds Jun 11, 2020
7e3a199
glnx-fdio: handle EOPNOTSUPP for copy_file_range
jlebon Jun 16, 2020
cd5a57e
Merge branch 'pr/cfr-nfs' into 'master'
cgwalters Jun 16, 2020
84b981a
Merge branch 'fix-wrpseudo-grammar' into 'master'
cgwalters Jun 16, 2020
de5d2ec
xattrs: Add better error prefixing
cgwalters Sep 9, 2020
5ef78bb
Merge branch 'err-prefix-xattr' into 'master'
cgwalters Sep 10, 2020
1ea9158
glnx-fdio: try $TMPDIR if /var/tmp doesn't exist
9999years Sep 23, 2020
a5b7669
glnx-fdio: use $TMPDIR if set
9999years Oct 1, 2020
1dd01d5
Merge branch 'tmpfile-dir' into 'master'
cgwalters Oct 2, 2020
013417e
Add GLNX_FILE_REPLACE_INCREASING_MTIME
alexlarsson Nov 2, 2020
493d399
Merge branch 'replace-increasing-mtime' into 'master'
alexlarsson Nov 3, 2020
efcacc4
fdio: Fix compilation via C++
cgwalters Nov 22, 2020
a8b4418
glnx_strjoina: Cast to result for C++ compatibility
cgwalters Nov 22, 2020
900caea
macros: Fix casting for C++ compatibility
cgwalters Dec 6, 2020
1345882
glnx_file_copy_at: Add GLNX_FILE_COPY_NOCHOWN
jlebon Feb 9, 2021
4c9055a
Merge branch 'pr/glnx-no-chown' into 'master'
cgwalters Feb 9, 2021
a0750a0
glnx-dirfd: Add a rewinddir() wrapper
smcv Apr 22, 2021
62f8ed6
console: Pacify `gcc -fanalyzer`
cgwalters Jun 28, 2021
59c02f9
Merge branch 'wip/smcv/rewinddir' into 'master'
cgwalters Jun 28, 2021
1f02e43
glnx-lockfile.h: Remove unused inclusion of config.h
smcv Jun 28, 2021
c306703
Include libglnx-config.h instead of config.h
smcv Apr 6, 2021
b7a2d4d
Merge branch 'console-staticanalysis-fix' into 'master'
cgwalters Jun 28, 2021
a4dcfe8
build: Use Meson built-in option c_std instead of -std=gnu99
smcv Jul 2, 2021
82e5b7d
xattrs: Fix possible double-free in `get_xattrs_impl`
jlebon Aug 3, 2021
ef502aa
Merge branch 'pr/cov-fix' into 'master'
cgwalters Aug 4, 2021
24231a9
Fall back if copy_file_range fails with EINVAL
Jan 24, 2022
586bdfe
fdio: Use a read/write loop until EOF if st_size is zero
smcv Jan 28, 2022
803adaf
Merge branch 'disable_copy_file_range_on_EINVAL--I3' into 'master'
smcv Jan 28, 2022
9fe002a
Merge branch 'wip/stdc99' into 'master'
mwleeds Feb 18, 2022
15d4c3a
Merge branch 'not-config-h' into 'master'
mwleeds Feb 18, 2022
a29f340
Merge branch 'wip/smcv/copy-pseudo-files' into 'master'
cgwalters Feb 18, 2022
81c6adb
Declare copyright and licensing using REUSE
smcv Jul 2, 2021
bc5d289
CI: Run `reuse lint` across the tree
smcv Jul 2, 2021
68191d8
Update copyright holder for Endless' contributions
smcv Jul 2, 2021
983a818
Merge branch 'wip/reuse' into 'master'
smcv Feb 19, 2022
b6ee0e2
tests: Don't copy extended attributes when testing pseudo-files
smcv Feb 22, 2022
88da8dd
Merge branch 'wip/noxattr' into 'master'
cgwalters Feb 22, 2022
b73a467
Add libglnx-config.h to CLEANFILES
mwleeds Mar 1, 2022
c71f7ae
Merge branch 'mwleeds/fix-config-h-clean' into 'master'
smcv Mar 1, 2022
b76cf45
meson: Automatically link libglnx-dependent objects to gio-unix
smcv Apr 21, 2022
eeea247
meson: Always build with hidden symbol visibility
smcv Apr 21, 2022
c500c36
tests: Build libglnx-testlib as a separate static library
smcv Apr 21, 2022
96ba9f4
tests: Optionally skip building and running the actual tests
smcv Apr 21, 2022
4d5b1fc
tests: Verify libglnx can work as a subproject
smcv Apr 21, 2022
238f7bf
fdio: Skip glnx_try_fallocate() if _GNU_SOURCE is not defined
smcv Apr 21, 2022
f8b7343
console: Mark an unused parameter as such
smcv Apr 24, 2022
2d007fa
fdio, xattrs: Mark unused cancellables as such
smcv Apr 24, 2022
d78121a
fdio: Make signedness of iterator consistent with limit
smcv Apr 24, 2022
f65b05f
fdio: Match signedness of length parameter
smcv Apr 24, 2022
4c51a54
tests: Make iterator signedness agree with limit
smcv Apr 24, 2022
7b26e39
tests: Make signedness of timestamp agree
smcv Apr 24, 2022
9f033ee
meson: Build with more warnings by default
smcv Apr 24, 2022
72e532d
Merge branch 'wip/smcv/subproject' into 'master'
mwleeds May 10, 2022
c59eb27
Merge branch 'wip/smcv/warnings' into 'master'
mwleeds May 10, 2022
af02572
build: Reduce default warning level from 3 to 2
smcv Jul 27, 2022
c5e1b29
backports: Backport g_info()
smcv Jul 27, 2022
7a2f26a
fdio: fix fd offset handling with `FICLONE`
jlebon Jul 29, 2022
26375b5
Merge branch 'pr/ficlone-fixes' into 'master'
cgwalters Aug 1, 2022
fabcdb3
backports: Backport G_SPAWN_DEFAULT
smcv Jul 27, 2022
b565872
backports: Backport G_OPTION_FLAG_NONE, G_OPTION_ENTRY_NULL
smcv Jul 27, 2022
29681b4
backports: Backport G_DBUS_METHOD_INVOCATION_HANDLED, _UNHANDLED
smcv Jul 27, 2022
9a0e6fd
testlib: Be compatible with ancient GLib by using glnx_close_fd
smcv Jul 27, 2022
5a60c0b
Move assertion/test utilities to a separate header
smcv Jul 2, 2022
c52b73d
Backport most of the test convenience helpers from GLib's GTest
smcv Jul 27, 2022
f780507
Merge branch 'wip/smcv/warnings' into 'master'
smcv Oct 10, 2022
45108f1
build: Explicitly disable warnings for non-ISO C features
smcv Oct 10, 2022
5e07281
Merge branch 'wip/smcv/easy-constants' into 'master'
smcv Oct 10, 2022
0b5d4a0
Merge branch 'wip/smcv/g-info' into 'master'
smcv Oct 10, 2022
cdef2bb
backports: Use #ifndef instead of GLIB_CHECK_VERSION
smcv Oct 10, 2022
2e46d5b
Merge branch 'wip/smcv/testing-helpers' into 'master'
smcv Oct 10, 2022
5bb5b7c
backports: Backport new NONE/DEFAULT constants from GLib 2.74
smcv Oct 10, 2022
15070ab
Merge branch 'wip/smcv/null-option-entry-ifndef' into 'master'
smcv Oct 10, 2022
f1e8534
Merge branch 'wip/smcv/2-74-constants' into 'master'
smcv Oct 10, 2022
8f2e676
Merge branch 'wip/smcv/warnings' into 'master'
wjt Oct 10, 2022
a91959e
backport-testutils: Add g_assert_true(), g_assert_false()
smcv Oct 10, 2022
416744a
tests: Ensure saveptr is NULL before first call to strtok_r()
smcv Oct 10, 2022
2290411
Merge branch 'wip/smcv/strtok-r' into 'master'
wjt Oct 10, 2022
e701578
Merge branch 'wip/smcv/assert-true-false' into 'master'
smcv Oct 10, 2022
8a29325
backports: Add a backport of g_memdup2()
smcv Oct 24, 2022
5275410
tests: Add a simple test for g_memdup2, from GLib
smcv Oct 24, 2022
4e44fd9
Merge branch 'wip/smcv/memdup2' into 'master'
cgwalters Nov 1, 2022
ea18312
backports: Add g_steal_fd, from GLib >= 2.70
smcv Nov 8, 2022
07e3e49
Merge branch 'wip/smcv/steal-fd' into 'master'
wjt Feb 27, 2023
52f66d4
backports: Add g_strv_equal from GLib >= 2.60
RyuzakiKK Mar 1, 2023
30b89b8
testutils: Add a backport of g_test_disable_crash_reporting()
smcv Jul 28, 2023
c02eb59
Merge branch 'wip/denittis/strv_equal' into 'master'
smcv Jul 28, 2023
54ad67d
Merge branch 'wip/smcv/disable-crash-reporting' into 'master'
smcv Aug 29, 2023
1bd99c1
build: Make tests depend on the helper required by one of them
smcv Aug 29, 2023
aff1eea
DOAP: Replace non-existing d-d-l mailing list with GNOME Discourse URL
aklapper Sep 18, 2023
c1e954e
Merge branch 'build-testing-helper' into 'master'
smcv Dec 14, 2023
79b809a
glnx-xattrs: Fix invalid argument to lsetxattr()
jlebon Jan 9, 2024
b415d04
Merge branch 'pr/fix-lsetxattrat' into 'master'
cgwalters Jan 10, 2024
6ada39c
backports: Add a backport of g_closefrom(), g_fdwalk_set_cloexec()
smcv Feb 9, 2024
c2c6c95
Merge branch 'wip/smcv/closefrom' into 'master'
cgwalters Feb 9, 2024
f2ff19d
build: Really check for close_range() as intended
smcv Feb 9, 2024
9d66aa7
missing: Add syscall number for close_range()
smcv Feb 9, 2024
debdea2
missing: Add a wrapper for close_range()
smcv Feb 9, 2024
1e6efc7
missing: Add flags for close_range()
smcv Feb 9, 2024
e4beedc
backports: Use glnx-missing.h to provide missing syscalls
smcv Feb 9, 2024
202b294
Merge branch 'wip/smcv/closefrom' into 'master'
cgwalters Feb 9, 2024
549d4a3
Remove libglnx submodule
bbhtt Oct 20, 2025
57eac39
Add 'subprojects/libglnx/' from commit '202b294e6079e23242e65e0426f86…
bbhtt Oct 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "libglnx"]
path = subprojects/libglnx
url = https://gitlab.gnome.org/GNOME/libglnx.git
[submodule "debugedit"]
path = subprojects/debugedit
url = https://sourceware.org/git/debugedit.git
1 change: 0 additions & 1 deletion subprojects/libglnx
Submodule libglnx deleted from 202b29
21 changes: 21 additions & 0 deletions subprojects/libglnx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2015 Colin Walters
# SPDX-License-Identifier: LGPL-2.1-or-later

# A path ostree writes to work around automake bug with
# subdir-objects
Makefile-libglnx.am.inc

libglnx-config.h

# Some standard bits
.deps
.libs
.dirstamp
*.typelib
*.la
*.lo
*.o
*.pyc
*.stamp
*~

41 changes: 41 additions & 0 deletions subprojects/libglnx/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2019 Endless OS Foundation LLC
# SPDX-License-Identifier: LGPL-2.0-or-later

image: registry.fedoraproject.org/fedora:30

stages:
- build

before_script:
- dnf install -y gcc git meson ninja-build "pkgconfig(gio-2.0)" "pkgconfig(gio-unix-2.0)" "pkgconfig(glib-2.0)" xz

build:
stage: build
script:
- meson _build .
- ninja -C _build
- meson test -C _build
# Run it again! This previously did not work.
- meson test -C _build
# Ensure that we can build as a subproject
- rm -fr _build/meson-dist
- meson dist -C _build
- mkdir -p tests/use-as-subproject/subprojects/libglnx
- tar --strip-components=1 -C tests/use-as-subproject/subprojects/libglnx -xf _build/meson-dist/*.tar.xz
- meson tests/use-as-subproject/_build tests/use-as-subproject
- ninja -C tests/use-as-subproject/_build
- meson test -C tests/use-as-subproject/_build
artifacts:
when: on_failure
name: "libglnx-${CI_COMMIT_REF_NAME}-${CI_JOB_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"

reuse:
stage: build
image:
name: fsfe/reuse:latest
entrypoint: [""]
before_script: []
script:
- reuse lint
3 changes: 3 additions & 0 deletions subprojects/libglnx/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This project's licensing is REUSE-compliant <https://reuse.software/>.
See individual files for full details of copyright and licensing,
and see LICENSES/*.txt for the license text.
174 changes: 174 additions & 0 deletions subprojects/libglnx/LICENSES/LGPL-2.0-or-later.txt

Large diffs are not rendered by default.

502 changes: 502 additions & 0 deletions subprojects/libglnx/LICENSES/LGPL-2.1-or-later.txt

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions subprojects/libglnx/LICENSES/LicenseRef-old-glib-tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
This work is provided "as is"; redistribution and modification
in whole or in part, in any medium, physical or electronic is
permitted without restriction.

This work is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

In no event shall the authors or contributors be liable for any
direct, indirect, incidental, special, exemplary, or consequential
damages (including, but not limited to, procurement of substitute
goods or services; loss of use, data, or profits; or business
interruption) however caused and on any theory of liability, whether
in contract, strict liability, or tort (including negligence or
otherwise) arising in any way out of the use of this software, even
if advised of the possibility of such damage.
90 changes: 90 additions & 0 deletions subprojects/libglnx/Makefile-libglnx.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright (C) 2015 Colin Walters <[email protected]>
# SPDX-License-Identifier: LGPL-2.0-or-later
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

EXTRA_DIST += \
$(libglnx_srcpath)/README.md \
$(libglnx_srcpath)/COPYING \
$(libglnx_srcpath)/LICENSES/LGPL-2.0-or-later.txt \
$(libglnx_srcpath)/LICENSES/LGPL-2.1-or-later.txt \
$(libglnx_srcpath)/libglnx.m4 \
$(NULL)

BUILT_SOURCES += $(top_builddir)/libglnx-config.h
CLEANFILES += $(top_builddir)/libglnx-config.h
$(top_builddir)/libglnx-config.h: Makefile.am
echo '#include "config.h"' > $@

libglnx_la_SOURCES = \
$(libglnx_srcpath)/glnx-macros.h \
$(libglnx_srcpath)/glnx-backport-autocleanups.h \
$(libglnx_srcpath)/glnx-backport-autoptr.h \
$(libglnx_srcpath)/glnx-backport-testutils.h \
$(libglnx_srcpath)/glnx-backport-testutils.c \
$(libglnx_srcpath)/glnx-backports.h \
$(libglnx_srcpath)/glnx-backports.c \
$(libglnx_srcpath)/glnx-local-alloc.h \
$(libglnx_srcpath)/glnx-local-alloc.c \
$(libglnx_srcpath)/glnx-errors.h \
$(libglnx_srcpath)/glnx-errors.c \
$(libglnx_srcpath)/glnx-console.h \
$(libglnx_srcpath)/glnx-console.c \
$(libglnx_srcpath)/glnx-dirfd.h \
$(libglnx_srcpath)/glnx-dirfd.c \
$(libglnx_srcpath)/glnx-fdio.h \
$(libglnx_srcpath)/glnx-fdio.c \
$(libglnx_srcpath)/glnx-lockfile.h \
$(libglnx_srcpath)/glnx-lockfile.c \
$(libglnx_srcpath)/glnx-missing-syscall.h \
$(libglnx_srcpath)/glnx-missing.h \
$(libglnx_srcpath)/glnx-xattrs.h \
$(libglnx_srcpath)/glnx-xattrs.c \
$(libglnx_srcpath)/glnx-shutil.h \
$(libglnx_srcpath)/glnx-shutil.c \
$(libglnx_srcpath)/libglnx.h \
$(libglnx_srcpath)/tests/libglnx-testlib.h \
$(NULL)

libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) -I$(builddir)
libglnx_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^glnx_" -no-undefined -export-dynamic
libglnx_la_LIBADD = $(libglnx_libs)

libglnx_tests = test-libglnx-xattrs test-libglnx-fdio test-libglnx-errors test-libglnx-macros test-libglnx-shutil
TESTS += $(libglnx_tests)

libglnx_testlib_sources = $(libglnx_srcpath)/tests/libglnx-testlib.c

check_PROGRAMS += $(libglnx_tests)
test_libglnx_xattrs_SOURCES = $(libglnx_testlib_sources) $(libglnx_srcpath)/tests/test-libglnx-xattrs.c
test_libglnx_xattrs_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
test_libglnx_xattrs_LDADD = $(libglnx_libs) libglnx.la

test_libglnx_fdio_SOURCES = $(libglnx_testlib_sources) $(libglnx_srcpath)/tests/test-libglnx-fdio.c
test_libglnx_fdio_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
test_libglnx_fdio_LDADD = $(libglnx_libs) libglnx.la

test_libglnx_errors_SOURCES = $(libglnx_testlib_sources) $(libglnx_srcpath)/tests/test-libglnx-errors.c
test_libglnx_errors_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
test_libglnx_errors_LDADD = $(libglnx_libs) libglnx.la

test_libglnx_macros_SOURCES = $(libglnx_testlib_sources) $(libglnx_srcpath)/tests/test-libglnx-macros.c
test_libglnx_macros_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
test_libglnx_macros_LDADD = $(libglnx_libs) libglnx.la

test_libglnx_shutil_SOURCES = $(libglnx_testlib_sources) $(libglnx_srcpath)/tests/test-libglnx-shutil.c
test_libglnx_shutil_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
test_libglnx_shutil_LDADD = $(libglnx_libs) libglnx.la
82 changes: 82 additions & 0 deletions subprojects/libglnx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
libglnx is the successor to [libgsystem](https://gitlab.gnome.org/Archive/libgsystem).

It is for modules which depend on both GLib and Linux, intended to be
used as a git submodule.

Features:

- File APIs which use `openat()` like APIs, but also take a `GCancellable`
to support dynamic cancellation
- APIs also have a `GError` parameter
- High level "shutil", somewhat inspired by Python's
- A "console" API for tty output
- A backport of the GLib cleanup macros for projects which can't yet take
a dependency on 2.40.

Why?
----

There are multiple projects which have a hard dependency on Linux and
GLib, such as NetworkManager, ostree, flatpak, etc. It makes sense
for them to be able to share Linux-specific APIs.

This module also contains some code taken from systemd, which has very
high quality LGPLv2+ shared library code, but most of the internal
shared library is private, and not namespaced.

One could also compare this project to gnulib; the salient differences
there are that at least some of this module is eventually destined for
inclusion in GLib.

Adding this to your project
---------------------------

## Meson

First, set up a Git submodule:

```
git submodule add https://gitlab.gnome.org/GNOME/libglnx subprojects/libglnx
```

Or a Git [subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt):

```
git remote add libglnx https://gitlab.gnome.org/GNOME/libglnx.git
git fetch libglnx
git subtree add -P subprojects/libglnx libglnx/master
```

Then, in your top-level `meson.build`:

```
libglnx_dep = subproject('libglnx').get_variable('libglnx_dep')
# now use libglnx_dep in your dependencies
```

Porting from libgsystem
-----------------------

For all of the filesystem access code, libglnx exposes only
fd-relative API, not `GFile*`. It does use `GCancellable` where
applicable.

For local allocation macros, you should start using the `g_auto`
macros from GLib. A backport is included in libglnx. There are a few
APIs not defined in GLib yet, such as `glnx_autofd`.

`gs_transfer_out_value` is replaced by `g_steal_pointer`.

Contributing
------------

Development happens in GNOME Gitlab: https://gitlab.gnome.org/GNOME/libglnx

(If you're seeing this on the Github mirror, we used to do development
on Github but that was before GNOME deployed Gitlab.)

<!--
Copyright 2015-2018 Colin Walters
Copyright 2019 Endless OS Foundation LLC
SPDX-License-Identifier: LGPL-2.1-or-later
-->
Loading