Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
fchmodat2-compat.hh
1#include "store-config-private.hh"
2#include <cstdint>
3
4/*
5 * Determine the syscall number for `fchmodat2`.
6 *
7 * On most platforms this is 452. Exceptions can be found on
8 * a glibc git checkout via `rg --pcre2 'define __NR_fchmodat2 (?!452)'`.
9 *
10 * The problem is that glibc 2.39 and libseccomp 2.5.5 are needed to
11 * get the syscall number. However, a Nix built against nixpkgs 23.11
12 * (glibc 2.38) should still have the issue fixed without depending
13 * on the build environment.
14 *
15 * To achieve that, the macros below try to determine the platform and
16 * set the syscall number which is platform-specific, but
17 * in most cases 452.
18 *
19 * TODO: remove this when 23.11 is EOL and the entire (supported) ecosystem
20 * is on glibc 2.39.
21 */
22
23#if HAVE_SECCOMP
24# if defined(__alpha__)
25# define NIX_SYSCALL_FCHMODAT2 562
26# elif defined(__x86_64__) && SIZE_MAX == 0xFFFFFFFF // x32
27# define NIX_SYSCALL_FCHMODAT2 1073742276
28# elif defined(__mips__) && defined(__mips64) && defined(_ABIN64) // mips64/n64
29# define NIX_SYSCALL_FCHMODAT2 5452
30# elif defined(__mips__) && defined(__mips64) && defined(_ABIN32) // mips64/n32
31# define NIX_SYSCALL_FCHMODAT2 6452
32# elif defined(__mips__) && defined(_ABIO32) // mips32
33# define NIX_SYSCALL_FCHMODAT2 4452
34# else
35# define NIX_SYSCALL_FCHMODAT2 452
36# endif
37#endif // HAVE_SECCOMP