(define-call "sync" void never-fails)
(define-call "truncate" int minusp (pathname filename) (length sb-posix::off-t))
(define-call "unlink" int minusp (pathname filename))
+(define-call "mkstemp" int minusp (template c-string))
(define-call-internally ioctl-without-arg "ioctl" int minusp (fd file-descriptor) (cmd int))
(define-call-internally ioctl-with-int-arg "ioctl" int minusp (fd file-descriptor) (cmd int) (arg int))
;;; 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))
+ (= (sb-sys:sap-int res) #.(1- (expt 2 sb-vm::n-machine-word-bits))))
(addr sap-or-nil) (length unsigned) (prot unsigned)
(flags unsigned) (fd file-descriptor) (offset sb-posix::off-t))
(syscall-error))
(setf termios (alien-to-termios a-termios termios))))
termios)
+
+;;; environment
+
+(export 'sb-posix::getenv :sb-posix)
+(defun sb-posix::getenv (name)
+ (let ((r (alien-funcall
+ (extern-alien "getenv" (function (* char) c-string))
+ name)))
+ (declare (type (alien (* char)) r))
+ (unless (null-alien r)
+ (cast r c-string))))
+(define-call "putenv" int minusp (string c-string))