X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Funix.lisp;h=b1193bf7fec735e4260ac7ec50590293d4797e7d;hb=25e76ec2b1083ac6a4bba42af7ad7b5a8239f2b8;hp=00351346f4680a86c57aa0bf0be19651961372b6;hpb=0d669e68a1ffbea42af6216f2ae8c7d7ca12ffb6;p=sbcl.git diff --git a/src/code/unix.lisp b/src/code/unix.lisp index 0035134..b1193bf 100644 --- a/src/code/unix.lisp +++ b/src/code/unix.lisp @@ -282,22 +282,22 @@ ;; pointer is used. On a system which doesn't support that ;; extension, it'll have to be rewritten somehow. ;; - ;; SunOS provides almost as useful an extension: if given a null + ;; SunOS and OSF/1 provide almost as useful an extension: if given a null ;; buffer pointer, it will automatically allocate size space. The ;; KLUDGE in this solution arises because we have just read off ;; PATH_MAX+1 from the Solaris header files and stuck it in here as ;; a constant. Going the grovel_headers route doesn't seem to be ;; helpful, either, as Solaris doesn't export PATH_MAX from ;; unistd.h. - #!-(or linux openbsd freebsd sunos) (,stub,) - #!+(or linux openbsd freebsd sunos) + #!-(or linux openbsd freebsd sunos osf1) (,stub,) + #!+(or linux openbsd freebsd sunos osf1) (or (newcharstar-string (alien-funcall (extern-alien "getcwd" (function (* char) (* char) size-t)) nil #!+(or linux openbsd freebsd) 0 - #!+sunos 1025)) + #!+(or sunos osf1) 1025)) (simple-perror "getcwd"))) ;;; Return the Unix current directory as a SIMPLE-STRING terminated @@ -348,6 +348,14 @@ uid)) (error "found no match for Unix uid=~S" uid))) +;;; Return the namestring of the home directory, being careful to +;;; include a trailing #\/ +(defun uid-homedir (uid) + (or (newcharstar-string (alien-funcall (extern-alien "uid_homedir" + (function (* char) int)) + uid)) + (error "failed to resolve home directory for Unix uid=~S" uid))) + ;;; Invoke readlink(2) on the file name specified by PATH. Return ;;; (VALUES LINKSTRING NIL) on success, or (VALUES NIL ERRNO) on ;;; failure.