From 6548750bc1ca4d832afed1744cdc7133b232c6f2 Mon Sep 17 00:00:00 2001 From: Jim Wise Date: Tue, 17 Jan 2012 11:14:41 -0500 Subject: [PATCH] Add patches from Aymeric Vincent to fix sb-posix on recentish NetBSD. There is some possibility that this will break one of the sb-posix tests on FreeBSD: The "rmdir" patch needs some input from FreeBSD users. "rmdir /" returns EBUSY on NetBSD. Given the recent commit 2a9b33fc45842ec0335fef2988e07337ae8f1fc7 on october, 17. 2011, it looks like OpenBSD and Darwin return EISDIR, but it's clearly not the case of NetBSD with a (usual) FFS file system. In short, either sbcl is currently broken on FreeBSD wrt the rmdir test and my patch will fix it, or my patch will break it and we need to include freebsd in the list of OSes producing EISDIR upon "rmdir /". --- contrib/sb-posix/interface.lisp | 5 +++-- contrib/sb-posix/posix-tests.lisp | 4 ++-- src/runtime/bsd-os.c | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index f8eef1f..bf408a0 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -743,8 +743,9 @@ not supported." result))) (export 'utime :sb-posix) (defun utime (filename &optional access-time modification-time) - (let ((fun (extern-alien "utime" (function int (c-string :not-null t) - (* alien-utimbuf)))) + (let ((fun (extern-alien #-netbsd "utime" #+netbsd "_utime" + (function int (c-string :not-null t) + (* alien-utimbuf)))) (name (filename filename))) (if (not (and access-time modification-time)) (alien-funcall fun name nil) diff --git a/contrib/sb-posix/posix-tests.lisp b/contrib/sb-posix/posix-tests.lisp index 776cbbc..13bb23d 100644 --- a/contrib/sb-posix/posix-tests.lisp +++ b/contrib/sb-posix/posix-tests.lisp @@ -174,7 +174,7 @@ (typep (sb-posix:syscall-errno c) '(member - #+bsd + #+(or darwin openbsd) #.sb-posix:eisdir #+win32 #.sb-posix::eacces @@ -182,7 +182,7 @@ #.sb-posix::enotempty #+sunos #.sb-posix::einval - #-(or bsd win32 sunos) + #-(or darwin openbsd win32 sunos) #.sb-posix::ebusy)))) t) (deftest rmdir.error.4 diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index aa3ae3d..5e6eb52 100644 --- a/src/runtime/bsd-os.c +++ b/src/runtime/bsd-os.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "sbcl.h" @@ -342,6 +343,12 @@ _readdir(DIR *dirp) return readdir(dirp); } +int +_utime(const char *file, const struct utimbuf *timep) +{ + return utime(file, timep); +} + /* Used in sb-bsd-sockets. */ int _socket(int domain, int type, int protocol) -- 1.7.10.4