diff --git a/debian/changelog b/debian/changelog index 3f52e81..12f2771 100644 diff --git a/debian/control b/debian/control index 01dc720..ebfd440 100644 diff --git a/debian/rules b/debian/rules index 3916ceb..cfe4413 100755 diff --git a/make-config.sh b/make-config.sh index fcdd9f9..275ce4d 100644 --- a/make-config.sh +++ b/make-config.sh @@ -29,7 +29,7 @@ case `uname` in ;; *BSD) case `uname` in - FreeBSD) + *FreeBSD) sbcl_os="freebsd" ;; OpenBSD) diff --git a/src/runtime/GNUmakefile b/src/runtime/GNUmakefile index a08cb55..b4c4589 100644 --- a/src/runtime/GNUmakefile +++ b/src/runtime/GNUmakefile @@ -58,7 +58,7 @@ LIBS = ${OS_LIBS} -lm targets: $(TARGET) sbcl.nm $(TARGET): $(OBJS) - $(CC) ${LINKFLAGS} -o $@ $^ $(LIBS) + $(CC) ${LINKFLAGS} -o $@ $^ $(LIBS) -ldl sbcl.nm: $(TARGET) $(NM) $(TARGET) | $(GREP) -v " [FUw] " > ,$@ diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index 1b1db92..94465e7 100644 --- a/src/runtime/bsd-os.c +++ b/src/runtime/bsd-os.c @@ -57,7 +57,7 @@ os_vm_size_t os_vm_page_size; static void netbsd_init(); #endif /* __NetBSD__ */ -#ifdef __FreeBSD__ +#if defined LISP_FEATURE_FREEBSD #include #if defined(LISP_FEATURE_SB_THREAD) && !defined(LISP_FEATURE_SB_PTHREAD_FUTEX) #include @@ -86,7 +86,7 @@ os_init(char *argv[], char *envp[]) #ifdef __NetBSD__ netbsd_init(); -#elif defined(__FreeBSD__) +#elif defined(LISP_FEATURE_FREEBSD) freebsd_init(); #elif defined(__OpenBSD__) openbsd_init(); @@ -99,7 +99,7 @@ os_context_sigmask_addr(os_context_t *context) /* (Unlike most of the other context fields that we access, the * signal mask field is a field of the basic, outermost context * struct itself both in FreeBSD 4.0 and in OpenBSD 2.6.) */ -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(LISP_FEATURE_DARWIN) +#if defined(LISP_FEATURE_FREEBSD) || defined(__NetBSD__) || defined(LISP_FEATURE_DARWIN) return &context->uc_sigmask; #elif defined (__OpenBSD__) return &context->sc_mask; @@ -232,7 +232,7 @@ os_install_interrupt_handlers(void) mach_error_memory_fault_handler); #else undoably_install_low_level_interrupt_handler(SIG_MEMORY_FAULT, -#ifdef LISP_FEATURE_FREEBSD +#if defined(LISP_FEATURE_FREEBSD) && !defined(__GLIBC__) (__siginfohandler_t *) #endif memory_fault_handler); @@ -348,8 +348,10 @@ _socket(int domain, int type, int protocol) } #endif /* __NetBSD__ */ -#ifdef __FreeBSD__ +#if defined(LISP_FEATURE_FREEBSD) +#ifndef __GLIBC__ extern int getosreldate(void); +#endif int sig_memory_fault; @@ -357,10 +359,14 @@ static void freebsd_init() { /* Memory fault signal on FreeBSD was changed from SIGBUS to * SIGSEGV. */ +#ifdef __GLIBC__ + sig_memory_fault = SIGBUS; +#else if (getosreldate() < 700004) sig_memory_fault = SIGBUS; else sig_memory_fault = SIGSEGV; +#endif /* Quote from sbcl-devel (NIIMI Satoshi): "Some OSes, like FreeBSD * 4.x with GENERIC kernel, does not enable SSE support even on @@ -432,7 +438,9 @@ os_get_runtime_executable_path(int external) { char path[PATH_MAX + 1]; +#ifndef __GLIBC__ if (getosreldate() >= 600024) { +#endif /* KERN_PROC_PATHNAME is available */ size_t len = PATH_MAX + 1; int mib[4]; @@ -443,6 +451,7 @@ os_get_runtime_executable_path(int external) mib[3] = -1; if (sysctl(mib, 4, &path, &len, NULL, 0) != 0) return NULL; +#ifndef __GLIBC__ } else { int size; size = readlink("/proc/curproc/file", path, sizeof(path) - 1); @@ -450,6 +459,7 @@ os_get_runtime_executable_path(int external) return NULL; path[size] = '\0'; } +#endif if (strcmp(path, "unknown") == 0) return NULL; return copied_string(path); diff --git a/src/runtime/bsd-os.h b/src/runtime/bsd-os.h index 880c5f7..bac4fd1 100644 --- a/src/runtime/bsd-os.h +++ b/src/runtime/bsd-os.h @@ -9,7 +9,7 @@ * files for more information. */ -#ifdef __FreeBSD__ +#if defined(LISP_FEATURE_FREEBSD) #include #endif @@ -27,12 +27,12 @@ typedef vsize_t os_vm_size_t; #elif defined __OpenBSD__ typedef size_t os_vm_size_t; #else -typedef vm_size_t os_vm_size_t; +typedef size_t os_vm_size_t; #endif typedef off_t os_vm_offset_t; typedef int os_vm_prot_t; -#if defined __FreeBSD__ +#if defined(LISP_FEATURE_FREEBSD) /* Note: The man page for sigaction(2) in FreeBSD 4.0 says that this * is an mcontext_t, but according to comments by Raymond Wiker in the * original FreeBSD port of SBCL, that's wrong, it's actually a diff --git a/src/runtime/run-program.c b/src/runtime/run-program.c index d1d98e6..6fff859 100644 --- a/src/runtime/run-program.c +++ b/src/runtime/run-program.c @@ -73,7 +73,7 @@ int spawn(char *program, char *argv[], int sin, int sout, int serr, setsid(); #elif defined(LISP_FEATURE_DARWIN) setpgid(0, getpid()); -#elif defined(SVR4) || defined(__linux__) || defined(__osf__) +#elif defined(SVR4) || defined(__linux__) || defined(__osf__) || defined(__GLIBC__) setpgrp(); #else setpgrp(0, getpid()); diff --git a/src/runtime/x86-64-arch.c b/src/runtime/x86-64-arch.c index bc25a9e..3b0e8e9 100644 --- a/src/runtime/x86-64-arch.c +++ b/src/runtime/x86-64-arch.c @@ -68,7 +68,7 @@ context_eflags_addr(os_context_t *context) * we need to do this nasty absolute index magic number thing * instead. */ return &context->uc_mcontext.gregs[17]; -#elif defined __FreeBSD__ +#elif defined LISP_FEATURE_FREEBSD return &context->uc_mcontext.mc_rflags; #elif defined LISP_FEATURE_DARWIN return CONTEXT_ADDR_FROM_STEM(rflags); diff --git a/src/runtime/x86-64-assem.S b/src/runtime/x86-64-assem.S index c29aceb..daa047d 100644 --- a/src/runtime/x86-64-assem.S +++ b/src/runtime/x86-64-assem.S @@ -25,7 +25,7 @@ #include "genesis/thread.h" /* Minimize conditionalization for different OS naming schemes. */ -#if defined __linux__ || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __sun +#if defined __linux__ || defined LISP_FEATURE_FREEBSD || defined __OpenBSD__ || defined __NetBSD__ || defined __sun #define GNAME(var) var #else #define GNAME(var) _##var @@ -33,7 +33,7 @@ /* Get the right type of alignment. Linux, FreeBSD and OpenBSD * want alignment in bytes. */ -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined __NetBSD__ || defined(__sun) +#if defined(__linux__) || defined LISP_FEATURE_FREEBSD || defined(__OpenBSD__) || defined __NetBSD__ || defined(__sun) #define align_4byte 4 #define align_8byte 8 #define align_16byte 16 diff --git a/src/runtime/x86-64-bsd-os.h b/src/runtime/x86-64-bsd-os.h index 9db3ae7..036f47b 100644 --- a/src/runtime/x86-64-bsd-os.h +++ b/src/runtime/x86-64-bsd-os.h @@ -16,7 +16,7 @@ static inline os_context_t *arch_os_get_context(void **void_context) * store signal context information, but at least they tend to use the * same stems to name the structure fields, so by using this macro we * can share a fair amount of code between different variants. */ -#if defined __FreeBSD__ +#if defined LISP_FEATURE_FREEBSD #define CONTEXT_ADDR_FROM_STEM(stem) &context->uc_mcontext.mc_ ## stem #elif defined(__OpenBSD__) #define CONTEXT_ADDR_FROM_STEM(stem) &context->sc_ ## stem diff --git a/tools-for-build/ldso-stubs.lisp b/tools-for-build/ldso-stubs.lisp index 1164a5c..58f4ba9 100644 --- a/tools-for-build/ldso-stubs.lisp +++ b/tools-for-build/ldso-stubs.lisp @@ -241,6 +241,7 @@ ldso_stub__ ## fct: ; \\ "getsockname" "gettimeofday" "getuid" + "grantpt" "hypot" "ioctl" "isatty" @@ -262,6 +263,7 @@ ldso_stub__ ## fct: ; \\ "pipe" "poll" "pow" + "ptsname" "read" "readdir" "readlink" @@ -293,8 +295,10 @@ ldso_stub__ ## fct: ; \\ "ttyname" #!-hpux "tzname" "unlink" + "unlockpt" "utimes" "wait3" + "waitpid" "write") ;; These aren't needed on the X86 because they're microcoded into the ;; FPU, so the Lisp VOPs can implement them directly without having to