errno (sb-int:strerror errno))))))
(defun syscall-error ()
- (error 'sb-posix::syscall-error :errno (get-errno)))
+ (error 'sb-posix:syscall-error :errno (get-errno)))
;;; filesystem access
(define-call "fchown" int minusp (fd file-descriptor)
(owner sb-posix::uid-t) (group sb-posix::gid-t))
(define-call "link" int minusp (oldpath filename) (newpath filename))
+;;; no lchown on Darwin
+#-darwin
(define-call "lchown" int minusp (pathname filename)
(owner sb-posix::uid-t) (group sb-posix::gid-t))
(define-call "mkdir" int minusp (pathname filename) (mode sb-posix::mode-t))
(define-call "symlink" int minusp (oldpath filename) (newpath filename))
(define-call "unlink" int minusp (pathname filename))
-
+(define-call "opendir" (* t) null-alien (pathname filename))
+(define-call "readdir" (* t)
+ ;; readdir() has the worst error convention in the world. It's just
+ ;; too painful to support. (return is NULL _and_ errno "unchanged"
+ ;; is not an error, it's EOF).
+ not
+ (dir (* t)))
+(define-call "closedir" int minusp (dir (* t)))
+
;;; uid, gid
(define-call "geteuid" sb-posix::uid-t not) ;"always successful", it says
-(define-call "getresuid" sb-posix::uid-t not)
+#+linux (define-call "getresuid" sb-posix::uid-t not)
(define-call "getuid" sb-posix::uid-t not)
(define-call "seteuid" int minusp (uid sb-posix::uid-t))
#+linux (define-call "setfsuid" int minusp (uid sb-posix::uid-t))
(define-call "setreuid" int minusp
(ruid sb-posix::uid-t) (euid sb-posix::uid-t))
-(define-call "setresuid" int minusp
+#+linux (define-call "setresuid" int minusp
(ruid sb-posix::uid-t) (euid sb-posix::uid-t)
(suid sb-posix::uid-t))
(define-call "setuid" int minusp (uid sb-posix::uid-t))
(define-call "getegid" sb-posix::gid-t not)
(define-call "getgid" sb-posix::gid-t not)
-(define-call "getresgid" sb-posix::gid-t not)
+#+linux (define-call "getresgid" sb-posix::gid-t not)
(define-call "setegid" int minusp (gid sb-posix::gid-t))
#+linux (define-call "setfsgid" int minusp (gid sb-posix::gid-t))
(define-call "setgid" int minusp (gid sb-posix::gid-t))
(define-call "setregid" int minusp
(rgid sb-posix::gid-t) (egid sb-posix::gid-t))
-(define-call "setresgid" int minusp
+#+linux (define-call "setresgid" int minusp
(rgid sb-posix::gid-t)
(egid sb-posix::gid-t) (sgid sb-posix::gid-t))
(define-call "setpgid" int minusp
(pid sb-posix::pid-t) (pgid sb-posix::pid-t))
(define-call "setpgrp" int minusp)
+
+;;; mmap, msync
+(define-call "mmap" sb-sys:system-area-pointer
+ ;; KLUDGE: #XFFFFFFFF is (void *)-1, which is the charming return
+ ;; value of mmap on failure. Except on 64 bit systems ...
+ (lambda (res)
+ (= (sb-sys:sap-int res) #-alpha #XFFFFFFFF #+alpha #xffffffffffffffff))
+ (addr sap-or-nil) (length unsigned) (prot unsigned)
+ (flags unsigned) (fd file-descriptor) (offset sb-posix::off-t))
+
+(define-call "munmap" int minusp
+ (start sb-sys:system-area-pointer) (length unsigned))
+
+(define-call "msync" int minusp
+ (addr sb-sys:system-area-pointer) (length unsigned) (flags int))
+
+(define-call "getpagesize" int minusp)
+