summaryrefslogtreecommitdiff
path: root/guix/build/syscalls.scm
Commit message (Collapse)AuthorAge
...
| * syscalls: Add network-interface-running?Danny Milosavljevic2017-07-12
| | | | | | | | | | | | | | | | * guix/build/syscalls.scm (network-interface-running?): New variable. Export it. * tests/syscalls.scm: Add test. Co-authored-by: John Darrington <jmd@gnu.org>
* | syscalls: Delay resolution of "scm_set_automatic_finalization_enabled".Ludovic Courtès2017-07-18
|/ | | | | * guix/build/syscalls.scm (%set-automatic-finalization-enabled?!) [guile-2.2]: Wrap in 'delay'.
* syscalls: Adjust 'dirent64' struct for GNU/Hurd.Ludovic Courtès2017-07-10
| | | | | | | | | | | | | Reported by rennes@openmailbox.org. * guix/build/syscalls.scm (file-type->symbol): New procedure. (%struct-dirent-header): Rename to... (%struct-dirent-header/linux): ... this. Rename introduced bindings as well. (%struct-dirent-header/hurd): New C struct. (define-generic-identifier): New macro. (read-dirent-header, %struct-dirent-header, sizeof-dirent-header): Define in terms of 'define-generic-identifier'.
* syscalls: 'opendir*' error message shows the file name.Ludovic Courtès2017-06-18
| | | | | * guix/build/syscalls.scm (opendir*): Add NAME to the 'system-error' message.
* syscalls: Add 'scandir*'.Ludovic Courtès2017-06-16
| | | | | | | | | * guix/build/syscalls.scm (%struct-dirent-header): New C struct. (string->pointer/utf-8, pointer->string/utf-8): New procedures. (opendir*, closedir*, readdir*, scandir*): New procedures. * tests/syscalls.scm ("scandir*, ENOENT") ("scandir*, ASCII file names", "scandir*, UTF-8 file names") ("scandir*, properties): New tests.
* syscalls: Provide 'free-disk-space'.Ludovic Courtès2017-06-02
| | | | | | * guix/build/syscalls.scm (free-disk-space): New procedure. * guix/scripts/gc.scm (guix-gc)[ensure-free-space]: Use it instead of 'statfs'.
* syscalls: Add 'thread-name' and 'set-thread-name'.Ludovic Courtès2017-05-28
| | | | | | | * guix/build/syscalls.scm (PR_SET_NAME, PR_GET_NAME) (%max-thread-name-length): New variables. (%prctl, set-thread-name, thread-name): New procedures. * tests/syscalls.scm ("set-thread-name"): New test.
* syscalls: Add load-linux-module.Mathieu Othacehe2017-04-11
| | | | | | | * guix/build/syscalls.scm (load-linux-module): New procedure. Reimplemented from guile-linux-syscalls.patch. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: Use define-as-needed for network-interface syscalls.Mathieu Othacehe2017-04-11
| | | | | | | | | | * guix/build/syscalls.scm (network-interface-flags): Use define-as-needed macro and remove from export list. (set-network-interface-flags): Ditto. (set-network-interface-address): Ditto. (IFF_UP, IFF_BROADCAST and IFF_LOOPBACK): Ditto. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: Use define-as-needed for mount and umount.Mathieu Othacehe2017-04-11
| | | | | | | | * guix/build/syscalls.scm (mount): Use define-as-needed macro and remove from export list. (umount): Ditto. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: Add reboot.Mathieu Othacehe2017-04-11
| | | | | | | | | * guix/build/syscalls.scm (define-as-needed): New macro. (reboot): New procedure. Reimplemented from guile-linux-syscalls.patch. (RB_AUTOBOOT, ..., RB_KEXEC): New flags copied from static Guile patch. Co-Authored-By: Ludovic Courtès <ludo@gnu.org> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: Allow mount and umount use from static Guile.Mathieu Othacehe2017-04-07
| | | | | | | | | | * guix/build/syscalls.scm (mount): Use Guile core mount if called from static Guile, otherwise use FFI based mount implementation. (umount): Ditto. This allows to use (guix build syscalls) from a module independently of calling context. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: Adjust 'clone' to Guile 2.2.Ludovic Courtès2017-03-15
| | | | | | | | | | | | | | | | | | | Before that, something like: (call-with-container (lambda () (match (primitive-fork) …))) would hang in 'primitive-fork' as the child process (the one started in the container) would try to pthread_join the finalization thread in 'stop_finalization_thread' in libguile, not knowing that this thread is nonexistent. * guix/build/syscalls.scm (%set-automatic-finalization-enabled?!): New procedure. (without-automatic-finalization): New macro. (clone): Wrap PROC call in 'without-automatic-finalization'.
* syscalls: Adjust 'define-bits' to macro literal semantics of 2.2.Ludovic Courtès2017-03-12
| | | | | | * guix/build/syscalls.scm (define-bits): Do not define NAMES... as top-level variables since that prevents literal matches in 2.2. Instead, determine constant values at expansion time.
* syscalls: Export 'read-utmpx'.Ludovic Courtès2017-01-24
| | | | | | * guix/build/syscalls.scm (read-utmpx-from-port): New procedure. * tests/syscalls.scm ("read-utmpx, EOF") ("read-utmpx"): New tests.
* syscalls: Add utmpx procedures and data structure.Ludovic Courtès2017-01-19
| | | | | | | * guix/build/syscalls.scm (<utmpx-entry>): New record type. (%utmpx): New C struct. (login-type): New bits. (setutxent, endutxent, getutxent, utmpx-entries): New procedures.
* syscalls: Extract 'bytes->string'.Ludovic Courtès2017-01-19
| | | | | * guix/build/syscalls.scm (bytes->string): New procedure. (bytevector->string-list): Use it.
* syscalls: 'terminal-columns' swallows ENOSYS.Ludovic Courtès2017-01-01
| | | | * guix/build/syscalls.scm (terminal-columns): Catch ENOSYS.
* syscalls: Add 'add-network-route/gateway' and 'delete-network-route'.Ludovic Courtès2016-11-21
| | | | | | | | | * guix/build/syscalls.scm (SIOCADDRT, SIOCDELRT): New variables. (%rtentry): New C struct. (RTF_UP, RTF_GATEWAY, %sockaddr-any): New variables. (add-network-route/gateway, delete-network-route): New procedures. * tests/syscalls.scm ("add-network-route/gateway") ("delete-network-route"): New tests.
* syscalls: Add 'c-struct-field-offset'.Ludovic Courtès2016-11-21
| | | | | | * guix/build/syscalls.scm (define-c-struct-macro): New macro. (define-c-struct): Use it. (c-struct-field-offset): New macro.
* syscalls: 'configure-network-interface' has a #:netmask parameter.Ludovic Courtès2016-11-17
| | | | | * guix/build/syscalls.scm (configure-network-interface): Add #:netmask keyword parameter and honor it.
* syscalls: Add bindings for SIOCGIFNETMASK and SIOCSIFNETMASK.Ludovic Courtès2016-11-16
| | | | | | | | | * guix/build/syscalls.scm (SIOCGIFNETMASK, SIOCSIFNETMASK): New variables. (set-network-interface-netmask, network-interface-netmask): New procedures. * tests/syscalls.scm ("network-interface-netmask lo") ("set-network-interface-netmask"): New tests.
* syscalls: Use 'define-c-struct' for 'struct ifconf'.Ludovic Courtès2016-11-16
| | | | | | | | * guix/build/syscalls.scm (ifconf-struct): Remove. (%ifconf-struct): New C struct. (network-interface-names): Use 'make-bytevector' and 'write-ifconf!' instead of 'make-c-struct', and 'read-ifconf' instead of 'parse-c-struct'.
* syscalls: C struct writer correctly handles pointer fields.Ludovic Courtès2016-11-16
| | | | * guix/build/syscalls.scm (write-type): Add case for '*.
* syscalls: Use #:return-errno? when it is available.Ludovic Courtès2016-09-06
| | | | | | | | | | | | * guix/build/syscalls.scm (errno): Do not export. (syscall->procedure): Change to return a procedure that returns both the value and errno. Use #:return-errno? where available. (mount, umount, swapon, swapoff, mkdtemp!, fdatasync, statfs) (clone, setns, pivot-root, fcntl-flock, network-interface-names) (network-interface-flags, set-network-interface-flags) (set-network-interface-address, network-interface-address): (network-interfaces, tcgetattr, tcsetattr, terminal-window-size): Adjust accordingly using 'let-values'.
* file-systems: Always use (guix build syscalls).Ludovic Courtès2016-09-05
| | | | | | | | | | * gnu/build/file-systems.scm: Use (guix build syscalls) unconditionally. Override the 'mount' and 'umount' bindings when (guile) provides them. (MS_RDONLY, MS_NOSUID, MS_NODEV, MS_NOEXEC, MS_REMOUNT) (MS_BIND, MS_MOVE): Remove. * guix/build/syscalls.scm (%libc-errno-pointer): Add 'false-if-exception' around 'dynamic-func'.
* syscalls: Use 'syscall->procedure' everywhere.Ludovic Courtès2016-06-13
| | | | | * guix/build/syscalls.scm (mkdtemp!, setns, %ioctl, network-interfaces): (free-ifaddrs): Use 'syscall->procedure'.
* utils: 'with-atomic-file-output' calls 'fdatasync'.Ludovic Courtès2016-06-13
| | | | | | | | | Suggested by Danny Milosavljevic <dannym@scratchpost.org> at <https://lists.gnu.org/archive/html/guix-devel/2016-06/msg00456.html>. * guix/build/syscalls.scm (fdatasync): New procedure. * guix/utils.scm (with-atomic-file-output): Use it. Use 'close-port' instead of 'close'.
* syscalls: Use 'define-c-struct' for 'fcntl-flock'.Ludovic Courtès2016-05-06
| | | | | | * guix/build/syscalls.scm (%struct-flock): Use 'define-c-struct'. (fcntl-flock): Use 'write-flock!' and 'make-bytevector' instead of 'make-c-struct'.
* utils: Move 'fcntl-flock' to (guix build syscalls).Ludovic Courtès2016-05-06
| | | | | | | | | | | * guix/utils.scm (%struct-flock, F_SETLKW, F_SETLK, F_xxLCK) (fcntl-flock): Move to... * guix/build/syscalls.scm: ... here. New variables. * guix/nar.scm: Adjust imports accordingly. * tests/utils.scm ("fcntl-flock wait", "fcntl-flock non-blocking"): Move to... * tests/syscalls.scm: ... here. New tests. (temp-file): New variable.
* syscalls: Wrap TCSA* constants in 'tcsetattr-action' macro.Ludovic Courtès2016-05-03
| | | | | | | * guix/build/syscalls.scm (tcsetattr-action): New macro. (TCSANOW, TCSADRAIN, TCSAFLUSH): Remove. (tcsetattr): Adjust docstring accordingly. * tests/syscalls.scm ("tcsetattr"): Adjust accordingly.
* syscalls: Add 'tcgetattr' and 'tcsetattr' bindings.Ludovic Courtès2016-05-02
| | | | | | | | | | | * guix/build/syscalls.scm (bits->symbols-body, define-bits) (local-flags): New macros. (TCSANOW, TCSADRAIN, TCSAFLUSH): New variables. (<termios>): New record type. (%termios): New C structure. (tcgetattr, tcsetattr): New procedures. * tests/syscalls.scm ("tcgetattr ENOTTY", "tcgetattr") ("tcsetattr"): New tests.
* syscalls: Implement arrays in 'define-c-struct' and use it.Ludovic Courtès2016-05-02
| | | | | | | | | | * guix/build/syscalls.scm (sizeof*, alignof*, write-type, read-type): Add support for (array ...) forms. * guix/build/syscalls.scm (<file-system>)[spare0, spare1]: Remove. [spare]: New field. * guix/build/syscalls.scm (%statfs)[identifier]: Change to (array int 2). [spare0, spare1]: Remove. [spare]: New field.
* syscalls: 'statfs' explicitly binds 'statfs64'.Ludovic Courtès2016-04-30
| | | | * guix/build/syscalls.scm (statfs): Explicitly bind "statfs64".
* syscalls: statfs: Add missing 'mount-flags' field of 'struct statfs'.Ludovic Courtès2016-04-30
| | | | | | * guix/build/syscalls.scm (<file-system>)[mount-flags]: New field. [spare2]: Remove. (%statfs): Likewise.
* syscalls: 'terminal-columns' catches EINVAL on the TIOCGWINSZ ioctl.Ludovic Courtès2016-04-25
| | | | | | | Reported by Mark H Weaver <mhw@netris.org>. * guix/build/syscalls.scm (terminal-columns): Tolerate EINVAL. * tests/syscalls.scm ("terminal-window-size ENOTTY"): Likewise.
* syscalls: Add 'statfs'.Ludovic Courtès2016-04-25
| | | | | | | * guix/build/syscalls.scm (<file-system>): New record type. (fsword): New macro. (%statfs): New C struct. (statfs): New procedure.
* syscalls: 'define-c-struct' computes the struct size.Ludovic Courtès2016-04-25
| | | | | | | | * guix/build/syscalls.scm (struct-alignment, struct-size): New macros. (define-c-struct): Add 'size' parameter and honor it. (sockaddr-in, sockaddr-in6, ifaddrs, winsize): Adjust accordingly. (%struct-ifaddrs-type, %sizeof-ifaddrs, winsize-struct): Remove. (terminal-window-size): Use 'make-bytevector' instead of 'make-c-struct'.
* syscalls: Second argument of packed-struct read is now optional.Ludovic Courtès2016-04-25
| | | | | | * guix/build/syscalls.scm (define-c-struct)[read]: OFFSET defaults to 0. (unfold-interface-list): Remove second argument to 'read-ifaddrs'. (terminal-window-size): Remove second argument to 'read-winsize'.
* syscalls: Move code around [NFC].Ludovic Courtès2016-04-25
| | | | * guix/build/syscalls.scm: Move packed structure handling to the top.
* syscalls: If a syscall is not available, defer the error.Mark H Weaver2016-04-18
| | | | | | | | * guix/build/syscalls.scm (syscall->procedure): New procedure. (mount, umount, swapon, swapoff, clone, pivot-root): Use it. (clone): Add case for nonexistent syscall id. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* syscalls: 'terminal-columns' ignores non-file ports.Ludovic Courtès2016-04-16
| | | | | | * guix/build/syscalls.scm (terminal-columns): Call 'terminal-window-size' only when PORT is a file port. * tests/syscalls.scm ("terminal-columns non-file port"): New test.
* syscalls: Add TIOCGWINSZ bindings.Ludovic Courtès2016-04-15
| | | | | | | | * guix/build/syscalls.scm (TIOCGWINSZ): New macro. (<window-size>): New record type. (winsize): New C struct. (winsize-struct): New variable. (terminal-window-size, terminal-columns): New procedures.
* syscalls: <interface> printer correctly handles lack of sockaddr.Ludovic Courtès2016-03-25
| | | | | | | | Reported by Danny Milosavljevic <dannym@scratchpost.org> in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22612#16>. * guix/build/syscalls.scm (write-interface): Check whether ADDRESS is true.
* syscalls: 'all-network-interface-names' accepts non-alphanumeric characters.Ludovic Courtès2016-02-03
| | | | | | | | This fixes interfaces with a dash or other characters being ignored. Suggested by Jookia <166291@gmail.com>. * guix/build/syscalls.scm (%interface-line): Use [[:graph:]] instead of [[:alnum:]].
* syscalls: Fix ABI mismatch for 'clone'.Ludovic Courtès2015-10-17
| | | | | | | | Fixes <http://bugs.gnu.org/21694>. * guix/build/syscalls.scm (clone): Change 'syscall' parameter types to LONG, UNSIGNED-LONG, or '*; make sure it has 6 parameters. Adjust caller accordingly.
* build: container: Use the same clone flags as fork(3).David Thompson2015-09-07
| | | | | | | | | | | | The intent is to make 'clone' behave a lot more like 'primitive-fork', which calls clone(2) with SIGCHLD, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID flags. Notably, running 'clone' at the REPL without these flags would break the REPL beyond repair. * guix/build/syscalls.scm (CLONE_CHILD_CLEARTID, CLONE_CHILD_SETTID): New variables. * gnu/build/linux-container.scm (namespaces->bit-mask): Add CLONE_CHILD_CLEARTID and CLONE_CHILD_SETTID to bit mask.
* build: syscalls: Properly handle clone errors.David Thompson2015-09-05
| | | | * guix/build/syscalls.scm (clone): Catch -1 return value and throw error.
* syscalls: setns: Skip binding if there is no such C function.David Thompson2015-08-17
| | | | | | | | On systems with a glibc prior to 2.14, the 'setns' function is not available. Thanks to Eric Bavier for reporting the issue. * guix/build/syscalls.scm (setns): Wrap with 'false-if-exception'.
* syscalls: Add 'network-interfaces', which wraps libc's 'getifaddrs'.Ludovic Courtès2015-07-25
| | | | | | | | | | | | Based on discussions with Rohan Prinja <rohan.prinja@gmail.com>. * guix/build/syscalls.scm (<interface>): New record type. (write-interface, values->interface, unfold-interface-list, network-interfaces, free-ifaddrs): New procedures. (ifaddrs): New C struct. (%struct-ifaddrs-type, %sizeof-ifaddrs): New macros. * tests/syscalls.scm ("network-interfaces returns one or more interfaces", "network-interfaces returns \"lo\""): New tests.