Added forgotten with-resources-aligned to delete-directory,

read-symlink, set-file-times, and open-directory-stream.
This commit is contained in:
mainzelm 2003-02-07 13:01:54 +00:00
parent 93439648aa
commit 921bb20f23
2 changed files with 33 additions and 13 deletions

View File

@ -119,3 +119,16 @@
(list cwd-resource euid-resource egid-resource) (list cwd-resource euid-resource egid-resource)
(lambda () (lambda ()
(%rename-file old-fname new-fname)))))) (%rename-file old-fname new-fname))))))
(define (read-symlink path)
(with-resources-aligned
(list cwd-resource euid-resource egid-resource)
(lambda ()
(%read-symlink path))))
(define (delete-directory path)
(with-resources-aligned
(list cwd-resource euid-resource egid-resource)
(lambda ()
(%delete-directory path))))

View File

@ -243,11 +243,11 @@
(fname (ensure-file-name-is-nondirectory path))) (fname (ensure-file-name-is-nondirectory path)))
(%%create-directory fname mode))) (%%create-directory fname mode)))
(import-os-error-syscall read-symlink (path) "scsh_readlink") (import-os-error-syscall %read-symlink (path) "scsh_readlink")
(import-os-error-syscall %rename-file (old-name new-name) "scsh_rename") (import-os-error-syscall %rename-file (old-name new-name) "scsh_rename")
(import-os-error-syscall delete-directory (path) "scsh_rmdir") (import-os-error-syscall %delete-directory (path) "scsh_rmdir")
(import-os-error-syscall %utime (path ac m) "scm_utime") (import-os-error-syscall %utime (path ac m) "scm_utime")
@ -256,15 +256,18 @@
;;; (SET-FILE-TIMES path [access-time mod-time]) ;;; (SET-FILE-TIMES path [access-time mod-time])
(define (set-file-times path . maybe-times) (define (set-file-times path . maybe-times)
(if (pair? maybe-times) (with-resources-aligned
(let* ((access-time (real->exact-integer (car maybe-times))) (list cwd-resource euid-resource egid-resource)
(mod-time (if (pair? (cddr maybe-times)) (lambda ()
(error "Too many arguments to set-file-times/errno" (if (pair? maybe-times)
(cons path maybe-times)) (let* ((access-time (real->exact-integer (car maybe-times)))
(real->exact-integer (cadr maybe-times))))) (mod-time (if (pair? (cddr maybe-times))
(%utime path access-time (error "Too many arguments to set-file-times/errno"
mod-time )) (cons path maybe-times))
(%utime-now path))) (real->exact-integer (cadr maybe-times)))))
(%utime path access-time
mod-time ))
(%utime-now path)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; STAT ;;; STAT
@ -575,8 +578,12 @@
(define-record-resumer type/directory-stream #f) (define-record-resumer type/directory-stream #f)
(define (open-directory-stream name) (define (open-directory-stream name)
(let ((dir (make-directory-stream name (let ((dir (make-directory-stream
(open-dir name)))) name
(with-resources-aligned
(list cwd-resource euid-resource egid-resource)
(lambda ()
(open-dir name))))))
(add-finalizer! dir close-directory-stream) (add-finalizer! dir close-directory-stream)
dir)) dir))