1.0.1.32: More syscall wrappers on NetBSD, to work around C preprocessor abuse
authorJuho Snellman <jsnell@iki.fi>
Fri, 19 Jan 2007 00:07:26 +0000 (00:07 +0000)
committerJuho Snellman <jsnell@iki.fi>
Fri, 19 Jan 2007 00:07:26 +0000 (00:07 +0000)
        * socket, dirent (patch from Richard Kreuter)

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

diff --git a/NEWS b/NEWS
index 5be2eb0..475452a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ changes in sbcl-1.0.2 relative to sbcl-1.0.1:
   * bug fix: ATANH returned incorrect results on win32 (thanks to Pierre Mai)  
   * bug fix: SBCL works on Linux/ppc systems with a kernel configured to use
     65k pages (thanks to David Woodhouse)
+  * bug fix: fix SB-POSIX dirent and socket on NetBSD (thanks to Richard Kreuter)
 
 changes in sbcl-1.0.1 relative to sbcl-1.0:
   * new platform: FreeBSD/x86-64, including support for threading.
index 19aa609..0b80a64 100644 (file)
                       ((* t) control "void *" "msg_control")
                       (integer controllen "socklen_t" "msg_controllen")
                       (integer flags "int" "msg_flags")))
- (:function socket ("socket" int
+ (:function socket (#-netbsd "socket" #+netbsd "_socket" int
                     (domain int)
                     (type int)
                     (protocol int)))
index 6d6d72c..bdfc14a 100644 (file)
 (define-call "rename" int minusp (oldpath filename) (newpath filename))
 (define-call* "rmdir" int minusp (pathname filename))
 (define-call* "unlink" int minusp (pathname filename))
-(define-call "opendir" (* t) null-alien (pathname filename))
-(define-call ("readdir" :options :largefile) (* dirent)
+(define-call #-netbsd "opendir" #+netbsd "_opendir"
+    (* t) null-alien (pathname filename))
+(define-call (#-netbsd "readdir" #+netbsd "_readdir" :options :largefile)
+  (* dirent)
   ;; readdir() has the worst error convention in the world.  It's just
   ;; too painful to support.  (return is NULL _and_ errno "unchanged"
   ;; is not an error, it's EOF).
index 6d16790..1b01396 100644 (file)
@@ -52,7 +52,8 @@ os_vm_size_t os_vm_page_size;
 #include <sys/sysctl.h>
 #include <string.h>
 #include <sys/stat.h> /* For the stat-family wrappers. */
-
+#include <dirent.h>   /* For the opendir()/readdir() wrappers */
+#include <sys/socket.h> /* For the socket() wrapper */
 static void netbsd_init();
 #endif /* __NetBSD__ */
 
@@ -327,24 +328,44 @@ The system may fail to start.\n",
     }
 }
 
-/* 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));
+/* Various routines in NetBSD's C library are compatibility wrappers
+   for old versions. Programs must be processed by the C toolchain in
+   order to get up-to-date definitions of such routines. */
+/* The stat-family, opendir, and readdir are used only in sb-posix, as
+   of 2007-01-16. -- 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
+_lstat(const char *path, struct stat *sb)
+{
+    return lstat(path, sb);
 }
-
-int _fstat(int fd, struct stat *sb) {
-  return (fstat(fd, sb));
+int
+_fstat(int fd, struct stat *sb)
+{
+    return fstat(fd, sb);
 }
 
+DIR *
+_opendir(const char *filename)
+{
+    return opendir(filename);
+}
+struct dirent *
+_readdir(DIR *dirp)
+{
+    return readdir(dirp);
+}
 
+/* Used in sb-bsd-sockets. */
+int
+_socket(int domain, int type, int protocol)
+{
+    return socket(domain, type, protocol);
+}
 #endif /* __NetBSD__ */
 
 #ifdef __FreeBSD__
index 1a0b215..09affdb 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".)
-"1.0.1.31"
+"1.0.1.32"