From ccea821befc96a2c5e0c64b1a18eef0f31abe0a7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 10 Nov 2014 18:14:20 +0100 Subject: syscalls: Add 'mount-points'. * guix/build/syscalls.scm (mount-points): New procedure. * tests/syscalls.scm ("mount-points"): New test. --- guix/build/syscalls.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'guix') diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 7e5245fcc6..9765820836 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -31,6 +31,7 @@ MS_MOVE mount umount + mount-points swapon swapoff processes @@ -166,6 +167,18 @@ constants from ." (when update-mtab? (remove-from-mtab target)))))) +(define (mount-points) + "Return the mounts points for currently mounted file systems." + (call-with-input-file "/proc/mounts" + (lambda (port) + (let loop ((result '())) + (let ((line (read-line port))) + (if (eof-object? line) + (reverse result) + (match (string-tokenize line) + ((source mount-point _ ...) + (loop (cons mount-point result)))))))))) + (define swapon (let* ((ptr (dynamic-func "swapon" (dynamic-link))) (proc (pointer->procedure int ptr (list '* int)))) -- cgit v1.2.3