0.9.18.23:
authorJuho Snellman <jsnell@iki.fi>
Thu, 2 Nov 2006 12:10:40 +0000 (12:10 +0000)
committerJuho Snellman <jsnell@iki.fi>
Thu, 2 Nov 2006 12:10:40 +0000 (12:10 +0000)
        Fix SB-POSIX:STAT and friends on NetBSD. (Patch by Richard
        Kreuter, sbcl-devel "Request for advice re sb-posix:stat on
        NetBSD" on 2006-10-15)

contrib/sb-posix/interface.lisp
src/runtime/bsd-os.c
version.lisp-expr

index 6460052..427efb1 100644 (file)
               (syscall-error))
             (alien-to-stat a-stat stat)))))))
 
-(define-stat-call #-win32 "stat" #+win32 "_stat" pathname filename
+;; 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" 
+                  pathname filename
                   (function int c-string (* alien-stat)))
 
 #-win32
-(define-stat-call "lstat" pathname filename
+(define-stat-call #-netbsd "lstat" #+netbsd "_lstat" pathname filename
                   (function int c-string (* alien-stat)))
 ;;; No symbolic links on Windows, so use stat
 #+win32
   (export (defun lstat (filename &optional stat)
             (if stat (stat filename stat) (stat filename)))))
 
-(define-stat-call #-win32 "fstat" #+win32 "_fstat" fd file-descriptor
+(define-stat-call #-(or win32 netbsd) "fstat" #+(or win32 netbsd) "_fstat"
+                  fd file-descriptor
                   (function int int (* alien-stat)))
 
 
index 10c2fd4..d4f8574 100644 (file)
@@ -48,6 +48,7 @@ os_vm_size_t os_vm_page_size;
 #include <sys/resource.h>
 #include <sys/sysctl.h>
 #include <string.h>
+#include <sys/stat.h> /* For the stat-family wrappers. */
 
 static void netbsd_init();
 #endif /* __NetBSD__ */
@@ -311,6 +312,25 @@ The system may fail to start.\n",
                  strerror(errno));
     }
 }
+
+/* The stat() routines in NetBSD's C library are compatibility
+   wrappers for some very old version of the stat buffer structure.
+   Programs must be processed by the C toolchain in order to get an
+   up-to-date definition of the stat() routine.  These wrappers are
+   used only in sb-posix, as of 2006-10-15. -- RMK */
+int _stat(const char *path, struct stat *sb) {
+  return (stat(path, sb));
+}
+
+int _lstat(const char *path, struct stat *sb) {
+  return (lstat(path, sb));
+}
+
+int _fstat(int fd, struct stat *sb) {
+  return (fstat(fd, sb));
+}
+
+
 #endif /* __NetBSD__ */
 
 #ifdef __FreeBSD__
index 7c29fd9..60600a0 100644 (file)
@@ -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".)
-"0.9.18.22"
+"0.9.18.23"