From 8ac04a07bef481085c338f34e458ee7f04defc47 Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Fri, 19 Jan 2007 00:07:26 +0000 Subject: [PATCH] 1.0.1.32: More syscall wrappers on NetBSD, to work around C preprocessor abuse * socket, dirent (patch from Richard Kreuter) --- NEWS | 1 + contrib/sb-bsd-sockets/constants.lisp | 2 +- contrib/sb-posix/interface.lisp | 6 ++-- src/runtime/bsd-os.c | 49 +++++++++++++++++++++++---------- version.lisp-expr | 2 +- 5 files changed, 42 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 5be2eb0..475452a 100644 --- 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. diff --git a/contrib/sb-bsd-sockets/constants.lisp b/contrib/sb-bsd-sockets/constants.lisp index 19aa609..0b80a64 100644 --- a/contrib/sb-bsd-sockets/constants.lisp +++ b/contrib/sb-bsd-sockets/constants.lisp @@ -152,7 +152,7 @@ ((* 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))) diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index 6d6d72c..bdfc14a 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -106,8 +106,10 @@ (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). diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index 6d16790..1b01396 100644 --- a/src/runtime/bsd-os.c +++ b/src/runtime/bsd-os.c @@ -52,7 +52,8 @@ os_vm_size_t os_vm_page_size; #include #include #include /* For the stat-family wrappers. */ - +#include /* For the opendir()/readdir() wrappers */ +#include /* 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__ diff --git a/version.lisp-expr b/version.lisp-expr index 1a0b215..09affdb 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.1.31" +"1.0.1.32" -- 1.7.10.4