From: Juho Snellman Date: Thu, 2 Nov 2006 12:10:40 +0000 (+0000) Subject: 0.9.18.23: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=fb74305b25abda75d42b397aba1cec829dbc8d91;p=sbcl.git 0.9.18.23: 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) --- diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index 6460052..427efb1 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -312,11 +312,15 @@ (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 @@ -325,7 +329,8 @@ (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))) diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index 10c2fd4..d4f8574 100644 --- a/src/runtime/bsd-os.c +++ b/src/runtime/bsd-os.c @@ -48,6 +48,7 @@ os_vm_size_t os_vm_page_size; #include #include #include +#include /* 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__ diff --git a/version.lisp-expr b/version.lisp-expr index 7c29fd9..60600a0 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".) -"0.9.18.22" +"0.9.18.23"