From: Juho Snellman Date: Mon, 12 Feb 2007 03:20:39 +0000 (+0000) Subject: 1.0.2.23: Clean up handling SB-POSIX functions with runtime wrappers X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=a7c186163e12d2c6348f8c579f74ca43872d10a9;p=sbcl.git 1.0.2.23: Clean up handling SB-POSIX functions with runtime wrappers * Thanks to Richard M Kreuter --- diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index bdfc14a..779759a 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -70,6 +70,15 @@ (declare (ignore args)) nil) +;;; Some systems may need C-level wrappers, which can live in the +;;; runtime (so that save-lisp-and-die can produce standalone +;;; executables). See REAL-C-NAME in macros.lisp for the use of this +;;; variable. +(eval-when (:compile-toplevel :load-toplevel) + (setf *c-functions-in-runtime* + '`(#+netbsd ,@("stat" "lstat" "fstat" "readdir" "opendir")))) + + ;;; filesystem access (defmacro define-call* (name &rest arguments) #-win32 `(define-call ,name ,@arguments) @@ -356,15 +365,12 @@ (syscall-error)) (alien-to-stat a-stat stat))))))) -;; Note: _stat, _lstat, and _fstat for NetBSD are provided in -;; src/runtime/bsd-os.c. See comments in that file -;; for an explanation. -- RMK 2006-10-15 -(define-stat-call #-(or win32 netbsd) "stat" #+(or win32 netbsd) "_stat" +(define-stat-call #-win32 "stat" #+win32 "_stat" pathname filename (function int c-string (* alien-stat))) #-win32 -(define-stat-call #-netbsd "lstat" #+netbsd "_lstat" +(define-stat-call "lstat" pathname filename (function int c-string (* alien-stat))) ;;; No symbolic links on Windows, so use stat @@ -374,7 +380,7 @@ (export (defun lstat (filename &optional stat) (if stat (stat filename stat) (stat filename))))) -(define-stat-call #-(or win32 netbsd) "fstat" #+(or win32 netbsd) "_fstat" +(define-stat-call #-win32 "fstat" #+win32 "_fstat" fd file-descriptor (function int int (* alien-stat))) diff --git a/contrib/sb-posix/macros.lisp b/contrib/sb-posix/macros.lisp index dd22a7c..018ff62 100644 --- a/contrib/sb-posix/macros.lisp +++ b/contrib/sb-posix/macros.lisp @@ -25,20 +25,29 @@ (let ((root (if (eql #\_ (char name 0)) (subseq name 1) name))) (intern (substitute #\- #\_ (string-upcase root)) :sb-posix))))) +;; Note: this variable is set in interface.lisp. defined here for +;; clarity and so the real-c-name compile as desired. +(defparameter *c-functions-in-runtime* nil) + (defun real-c-name (name) - (etypecase name - (list - (destructuring-bind (name &key c-name options) name - (if c-name - c-name - (cond #+largefile - ((or (eql options :largefile) - (member :largefile options)) - (format nil "~a_largefile" name)) - (t - name))))) - (string - name))) + (let ((maybe-name + (etypecase name + (list + (destructuring-bind (name &key c-name options) name + (if c-name + c-name + (cond #+largefile + ((or (eql options :largefile) + (member :largefile options)) + (format nil "~a_largefile" name)) + (t + name))))) + (string + name)))) + (if (member maybe-name *c-functions-in-runtime* + :test #'string=) + (format nil "_~A" maybe-name) + maybe-name))) (defmacro define-call-internally (lisp-name c-name return-type error-predicate &rest arguments) diff --git a/version.lisp-expr b/version.lisp-expr index 454e5cd..e515900 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.2.22" +"1.0.2.23"