0.9.0.7:
[sbcl.git] / contrib / sb-posix / interface.lisp
index bf9498e..aca0e7d 100644 (file)
 
 ;;; 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))