summaryrefslogtreecommitdiff
path: root/guix/build/syscalls.scm
Commit message (Collapse)AuthorAge
* linux-container: Handle CLONE_NEWCGROUP and use it by default.Ryan Sundberg2022-01-05
| | | | | | | | | | Adds low-level support for launching Linux containers with cgroup namespaces. * gnu/build/linux-container.scm (%namespaces): Add 'cgroup. (namespaces->bit-mask): Handle it. * guix/build/syscalls.scm (CLONE_NEWCGROUP): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Merge branch 'master' into core-updates-frozenLudovic Courtès2021-11-23
|\
| * system: Add swap flags.Josselin Poiret2021-11-23
| | | | | | | | | | | | | | | | | | | | | | * gnu/system/file-systems.scm (swap-space)[priority, discard?]: Add them. * guix/build/syscalls.scm (SWAP_FLAG_PREFER, SWAP_FLAG_PRIO_MASK, SWAP_FLAG_PRIO_SHIFT, SWAP_FLAG_DISCARD): Add them. * gnu/build/file-systems.scm (swap-space->flags-bit-mask): Add it. * gnu/services/base.scm (swap-service-type): Use it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* | build: syscalls: Add a SET-CHILD-SUBREAPER! procedure.Maxim Cournoyer2021-11-20
|/ | | | | * guix/build/syscalls.scm (PR_SET_CHILD_SUBREAPER): New variable. (set-child-subreaper!): New procedure.
* syscalls: Gracefully handle failure to load libc's libutil.Ludovic Courtès2021-10-26
| | | | | | | | | | | | In particular, libutil is not found when running code on a statically-linked Guile. Reported by mahmooz on #guix. * guix/build/syscalls.scm (syscall->procedure): Add #:library parameter and honor it. (openpty, login-tty): Use 'syscall->procedure' instead of calling 'dynamic-link' directly.
* syscalls: Add 'openpty' and 'login-tty'.Ludovic Courtès2021-10-26
| | | | | * guix/build/syscalls.scm (openpty, login-pty): New procedures. * tests/syscalls.scm ("openpty", "openpty + login-tty"): New tests.
* syscalls: Deduplicate device number conversion.Tobias Geerinckx-Rice2021-09-23
| | | | | | | | | | | * guix/cpio.scm (device-number, device->major+minor): Move to, and subsequently import from, … * guix/build/syscalls.scm (device-number, device-number->major+minor): …here. Note the slight name change. (mounts): Replace 16-bit open code with a DEVICE-NUMBER call. * gnu/build/linux-boot.scm (device-number): Remove duplicate 16-bit implementation in favour of the one above. (resume-if-hibernated): Reuse DEVICE-NUMBER->MAJOR+MINOR.
* Revert "syscalls: 'terminal-dimension' ignores EPERM."Tobias Geerinckx-Rice2021-07-07
| | | | | This reverts commit 17a102332a253f0e3b1f511fa7bda2094264a77c. See <https://github.com/koverstreet/bcachefs/pull/277>.
* syscalls: Fix RNDADDTOENTCNT on powerpc64le-linux.Chris Marusich2021-03-23
| | | | | | | | | This fixes the failing test add-to-entropy-count in tests/syscalls.scm on powerpc64le-linux. * guix/build/syscalls.scm (RNDADDTOENTCNT): When %host-type starts with "powerpc64le", set this to #x80045201. Otherwise, set it to #x40045201 as before.
* syscalls: Fix clone on powerpc64le-linux.Chris Marusich2021-03-23
| | | | | | | This makes the clone procedure work correctly and fixes some test failures on powerpc64le-linux, including tests/containers.scm. * guix/build/syscalls.scm (clone): Add an entry for ppc64le.
* syscalls: mounts: Fix a matching bug.Chris Marusich2021-03-15
| | | | | | | | | | | | | | | | | | On some systems, the columns in /proc/self/mountinfo look like this: 23 28 0:21 / /proc rw,nosuid,nodev,noexec,relatime shared:11 - proc proc rw Before this change, the mounts procedure was written with the assumption that the type and source could always be found in columns 8 and 9, respectively. However, the proc(5) man page explains that there can be zero or more optional fields starting at column 7 (e.g., "shared:11" above), so this assumption is false in some situations. * guix/build/syscalls.scm (mounts): Update the match pattern to use ellipsis to match zero or more optional fields followed by a single hyphen. Remove the trailing ellipsis, since multiple ellipses are not allowed in the same level. The proc(5) man page indicates that there are no additional columns, so it is probably OK to match an exact number of columns at the end like this.
* syscalls: Define the ST_* constants and add 'statfs-flags->mount-flags'.Ludovic Courtès2021-03-10
| | | | | | | | | * guix/build/syscalls.scm (linux?): New variable. (define-statfs-flags): New macro. (ST_RDONLY, ST_NOSUID, ST_NODEV, ST_NOEXEC, ST_SYNCHRONOUS) (ST_MANDLOCK, ST_WRITE, ST_APPEND, ST_IMMUTABLE, ST_NOATIME) (ST_NODIRATIME, ST_RELATIME): New variables. (statfs-flags->mount-flags): New procedure.
* syscalls: Add 'mounts' and the <mount> record type.Ludovic Courtès2021-02-25
| | | | | | | | * guix/build/syscalls.scm (<mount>): New record type. (option-string->mount-flags, mount-flags) (octal-decode, mounts): New procedures. (mount-points): Rewrite in terms of 'mount'. * tests/syscalls.scm ("mounts"): New test.
* syscalls: Define MS_RELATIME.Ludovic Courtès2021-02-25
| | | | * guix/build/syscalls.scm (MS_RELATIME): New variable.
* syscalls: set-thread-name, thread-name: Fix thinko.Jan (janneke) Nieuwenhuizen2020-06-08
| | | | * guix/build/syscalls.scm (set-thread-name, thread-name): Oops, fix thinko.
* syscalls: set-thread-name, thread-name: Stub for the Hurd.Jan (janneke) Nieuwenhuizen2020-06-08
| | | | | | | | | | | | | | Avoid crash Backtrace: guix/build/syscalls.scm:405:8: In procedure prctl: Function not implemented because of missing prctl on the Hurd. * guix/build/syscalls.scm (set-thread-name, thread-name): Rename to ... (set-thread-name!/linux,thread-name/linux): ...this. (set-thread-name, thread-name): Swtich between linux implementation and or stub.
* syscalls: 'terminal-dimension' ignores EPERM.Ludovic Courtès2020-05-29
| | | | | | | | Fixes <https://bugs.gnu.org/41581>. Reported by Tobias Geerinckx-Rice <me@tobias.gr>. * guix/build/syscalls.scm (terminal-dimension): Add EPERM to the list of errno code for FALL-BACK.
* syscalls: Properly match %HOST-TYPE.Jesse Dowell2020-05-29
| | | | | | | | | | | | Fixes <https://bugs.gnu.org/41546>. Regression introduced in 0d371c633f7308cfde2432d6119d386a5c63198c. * guix/build/syscalls.scm (write-socket-address!) (read-socket-address): Use 'string-contains' instead of 'string-suffix?'. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: Adjust 'sockaddr-in', 'sockaddr-in6' structs for the Hurd.Jan (janneke) Nieuwenhuizen2020-05-15
| | | | | | | | | | * guix/build/syscalls.scm (sockaddr-in,sockaddr-in6): Rename to ... (sockaddr-in/linux, sockaddr-in6/linux): ... this. Rename introduced bindings as well. (write-socket-address!/linux,read-socket-address/linux): Rename from (write-socket-address!, read-socket-address): ... new switches between those and ... (write-socket-address!/hurd, read-socket-address/hurd): ... these new function.
* syscalls: Add 'getxattr'.Jan (janneke) Nieuwenhuizen2020-05-14
| | | | | * guix/build/syscalls.scm (getxattr): New procedure. * tests/syscalls.scm ("getxattr, setxattr"): Test it, together with setxattr.
* syscalls: Add 'setxattr'.Jan (janneke) Nieuwenhuizen2020-05-13
| | | | | | * guix/build/syscalls.scm (setxattr): New procedure. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: Add ioctl flags for the Hurd.Jan (janneke) Nieuwenhuizen2020-05-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use #include <stdio.h> #include <net/if.h> #include <hurd/ioctl.h> int main () { printf ("SIOCSIFFLAGS #x%x\n", SIOCSIFFLAGS); printf ("SIOCGIFADDR #x%x\n", SIOCGIFADDR); printf ("SIOCSIFADDR #x%x\n", SIOCSIFADDR); printf ("SIOCGIFNETMASK #x%x\n", SIOCGIFNETMASK); printf ("SIOCSIFNETMASK #x%x\n", SIOCSIFNETMASK); #if 0 printf ("SIOCADDRT #x%x\n", SIOCADDRT); printf ("SIOCDELRT #x%x\n", SIOCDELRT); #endif } to fill in some blanks. Adding and removing route apparently not supported. * guix/build/syscalls.scm (SIOCSIFFLAGS SIOCGIFADDR, SIOCSIFADDR, SIOCGIFNETMASK, SIOCSIFNETMASK):
* syscalls: 'define-c-struct' supports cross-compilation.Ludovic Courtès2020-05-05
| | | | | | | | | | Reported by Jan (janneke) Nieuwenhuizen <janneke@gnu.org>. Before that, we'd always use the 'sizeof' and 'alignof' value obtained from the host at macro-expansion time. * guix/build/syscalls.scm (sizeof*, alignof*): When the target word size differs from the host word size, emit a call to 'sizeof'/'alignof'.
* syscalls: Fix Linux detection in 'readdir*'.Julien Lepiller2020-04-20
| | | | | * guix/build/syscalls.scm (readdir*): Fix Linux detection for `arm-unknown-linux-gnueabihf'.
* syscalls: 'readdir*' chooses between the Linux and Hurd code at run time.Ludovic Courtès2020-04-16
| | | | | | | | | | | | | | | | | | | | Partly fixes <https://bugs.gnu.org/40574>. Reported by Jan Nieuwenhuizen <janneke@gnu.org>. Previously, we'd choose at expansion time whether to use the Hurd or the Linux variant, taking the cross-compilation target into account. This would lead to the wrong decision when (guix build syscalls) is evaluated while we're cross-compiling to GNU/Hurd. This is a followup to 1ab9e483391f8b62b873833ea71cb0074efa03e7. * guix/build/syscalls.scm (define-generic-identifier) (read-dirent-header, %struct-dirent-header, sizeof-dirent-header): Remove. (readdir*): Rename to... (readdir-procedure): ... this, and add parameters. (readdir*): Define as a call to 'readdir-procedure' as a function of %HOST-TYPE.
* syscalls: 'with-file-lock' re-grabs lock when reentering its dynamic extent.Ludovic Courtès2020-03-22
| | | | | | | * guix/build/syscalls.scm (call-with-file-lock) (call-with-file-lock/no-wait): Initialize PORT in the 'dynamic-wind' "in" handler. This allows us to re-enter a captured continuation and have the lock grabbed anew.
* syscalls: Pass the right 'throw' arguments in 'call-with-file-lock/no-wait'.Ludovic Courtès2020-01-19
| | | | | | | | Reported by Matt Wette <matt.wette@gmail.com> in <https://bugs.gnu.org/39194>. * guix/build/syscalls.scm (call-with-file-lock/no-wait): When re-throwing, pass KEY in addition to ARGS.
* file-systems: Add support for 'strict-atime' and 'lazy-time' flags.Guillaume Le Vaillant2019-12-07
| | | | | | | | | | * guix/build/syscalls.scm (MS_LAZYTIME): New variable. * gnu/build/file-systems.scm (mount-flags->bit-mask): Add match rules for 'strict-atime' and 'lazy-time'. * doc/guix.texi (File Systems): Add 'strict-atime' and 'lazy-time' to the list of supported flags. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* ui: 'with-profile-lock' keeps going upon ENOLCK.Ludovic Courtès2019-11-29
| | | | | | * guix/build/syscalls.scm (call-with-file-lock/no-wait): Really pass ARGS to HANDLER. Return #f when HANDLER is called. * guix/ui.scm (profile-lock-handler): Emit a mere warning upon ENOLCK.
* guix: Add file-locking with no wait.Julien Lepiller2019-11-08
| | | | | * guix/build/syscalls.scm (with-file-lock/no-wait): New procedure. (lock-file): Take a #:wait? key.
* syscalls: Add 'add-to-entropy-count'.Ludovic Courtès2019-10-05
| | | | | | * guix/build/syscalls.scm (RNDADDTOENTCNT): New variable. (add-to-entropy-count): New procedure. * tests/syscalls.scm ("add-to-entropy-count"): New test.
* syscalls: 'define-as-needed' does not re-export local variables.Ludovic Courtès2019-07-19
| | | | | | | | | Fixes <https://bugs.gnu.org/36723>. Reported by Timothy Sample <samplet@ngyro.com>. * guix/build/syscalls.scm (define-as-needed): Rewrite to use lower-level module primitives; define VARIABLE only if it's not already defined to avoid "re-exporting local variable" error.
* syscalls: Use 'define-as-needed' for 'AT_' constants introduced in Guile 2.2.5.Ludovic Courtès2019-07-15
| | | | | | * guix/build/syscalls.scm (AT_FDCWD, AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR) (AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, AT_EMPTY_PATH): Define using 'define-as-needed'.
* syscalls: Add 'terminal-rows'.Ludovic Courtès2019-06-27
| | | | | | | * guix/build/syscalls.scm (terminal-dimension): New procedure. (terminal-columns): Rewrite in terms of 'terminal-dimension'. (terminal-rows): New procedure. * tests/syscalls.scm ("terminal-rows"): New test.
* syscalls: 'with-lock-file' catches ENOSYS.Ludovic Courtès2019-06-05
| | | | | * guix/build/syscalls.scm (call-with-file-lock): Catch ENOSYS raised by 'lock-file'.
* syscalls: 'with-file-lock' expands to a call to 'call-with-file-lock'.Ludovic Courtès2019-06-05
| | | | | * guix/build/syscalls.scm (call-with-file-lock): New procedure. (with-file-lock): Expand to a call to 'call-with-file-lock'.
* syscalls: Add 'with-file-lock' macro.Ludovic Courtès2019-06-05
| | | | | | * guix/scripts/offload.scm (lock-file, unlock-file, with-file-lock): Move to... * guix/build/syscalls.scm: ... here.
* syscalls: Add 'arp-network-interface?'.Marius Bakke2019-05-09
| | | | | * guix/build/syscalls.scm (IFF_NOARP): New variable. (arp-network-interface?): New public procedure.
* guix: Fix typo in docstring.Tobias Geerinckx-Rice2019-04-30
| | | | * guix/build/syscalls.scm (device-in-use?)<docstring>: Fix typo.
* file-systems: Support the 'no-atime' flag.rendaw2019-04-29
| | | | | | | | | * guix/build/syscalls.scm (MS_NOATIME): New variable. * gnu/build/file-systems.scm (mount-flags->bit-mask): Support it. * doc/guix.texi (File Systems): Document it and add cross-references to the relevant documentation. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: 'device-in-use?' returns #f upon EINVAL.Ludovic Courtès2019-01-17
| | | | | | | This mirrors the behavior of the 'fdisk_device_is_used' function of util-linux. * guix/build/syscalls.scm (device-in-use?): Return #f upon EINVAL.
* syscalls: 'device-in-use?' does not create a port.Ludovic Courtès2019-01-17
| | | | | * guix/build/syscalls.scm (device-in-use?): Use 'open-fdes' rather than 'open-file'.
* build: syscalls: Add device-in-use?.Mathieu Othacehe2019-01-17
| | | | | | | | | This new procedure uses BLKRRPART to determine whether or not a device is busy. It is useful when a device does not appear as mounted but is maybe used by the kernel. This is the case with overlayfs lowerdir backend device for example. * guix/build/syscalls.scm (device-in-use?): New exported procedure.
* maint: Remove 'cond-expand' forms for Guile 2.0.Ludovic Courtès2019-01-09
| | | | | | | | | | | | | | | | | | | | | | Note: Leave 'cond-expand' forms used in the build-side modules that can run on %BOOTSTRAP-GUILE, which is currently Guile 2.0. * guix/build/compile.scm: Move 'use-modules' clause from 'cond-expand' to 'define-module' form. (%default-optimizations): Remove 'cond-expand'. * guix/build/download.scm (tls-wrap): Remove 'cond-expand'. * guix/build/syscalls.scm: Remove 'cond-expand' form around '%set-automatic-finalization-enabled?!' and 'without-automatic-finalization'. * guix/inferior.scm (port->inferior): Remove 'cond-expand'. * guix/scripts/pack.scm (wrapped-package)[build]: Remove 'cond-expand'. * guix/status.scm (build-event-output-port): Remove 'cond-expand'. * guix/store.scm (open-inet-socket): Remove 'cond-expand'. * guix/ui.scm (install-locale): Remove 'cond-expand'. * tests/status.scm ("current-build-output-port, UTF-8 + garbage"): Remove 'cond-expand'. * tests/store.scm ("current-build-output-port, UTF-8 + garbage"): Remove 'cond-expand'.
* syscalls: Report lack of a libc symbol as ENOSYS.Ludovic Courtès2018-09-10
| | | | | * guix/build/syscalls.scm (syscall->procedure): Throw to 'system-error with ENOSYS when NAME cannot be found.
* syscalls: Define AT_SYMLINK_NOFOLLOW et al.Ludovic Courtès2018-07-03
| | | | | | * guix/build/syscalls.scm (AT_FDCWD, AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR) (AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, AT_EMPTY_PATH): New variables. * tests/syscalls.scm ("utime with AT_SYMLINK_NOFOLLOW"): New test.
* build: Require Guile >= 2.0.13.Ludovic Courtès2018-02-26
| | | | | | | | | | | | | | | | | | * README, configure.ac, doc/guix.texi (Requirements): Increase minimum Guile version from 2.0.9 to 2.0.13. * config-daemon.ac: Remove use of 'GUIX_CHECK_UNBUFFERED_CBIP'. * m4/guix.m4 (GUIX_CHECK_UNBUFFERED_CBIP): Remove. * guix/build/download.scm (current-http-proxy): Remove. * guix/build/syscalls.scm (%libc-errno-pointer, errno): Remove. (syscall->procedure): Use #:return-errno unconditionally. * guix/hash.scm (open-sha256-input-port)[unbuffered]: Remove outdated comment. * guix/http-client.scm (when-guile<=2.0.5-or-otherwise-broken): Remove. <top level>: Remove 'when-guile<=2.0.5-or-otherwise-broken' block. * guix/scripts/substitute.scm (fetch): Remove 'guile-version>?' conditional. * tests/hash.scm (supports-unbuffered-cbip?): Remove. <top level>: Remove 'test-skip' call.
* syscalls: Define 'input-flags' for 'tcgetattr' and friends.Ludovic Courtès2017-12-06
| | | | * guix/build/syscalls.scm (input-flags): New macro.
* syscalls: clone: Define syscall-id for aarch64.Eric Bavier2017-10-09
| | | | * guix/build/syscalls.scm (clone): Define syscall-id for aarch64 machines.
* Merge branch 'master' into core-updatesLeo Famulari2017-07-23
|\