X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fbsd-os.c;h=0bca439361f08c2c28e8120babb20c5176703183;hb=15d6e7c9a2c3234f95dfe278046fa2fee1b0c007;hp=5965596292718464526398ae320977d82dba80e1;hpb=01044af1b8d69fc3899dc0417064c1512223223d;p=sbcl.git diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index 5965596..0bca439 100644 --- a/src/runtime/bsd-os.c +++ b/src/runtime/bsd-os.c @@ -37,12 +37,12 @@ #include /* #include */ #include "validate.h" - os_vm_size_t os_vm_page_size; #ifdef __NetBSD__ #include +#include #include static void netbsd_init(); @@ -231,16 +231,38 @@ os_install_interrupt_handlers(void) #ifdef __NetBSD__ static void netbsd_init() { - struct rlimit rl; + struct rlimit rl; + int mib[2], osrev; + size_t len; + + /* Are we running on a sufficiently functional kernel? */ + mib[0] = CTL_KERN; + mib[1] = KERN_OSREV; + + len = sizeof(osrev); + sysctl(mib, 2, &osrev, &len, NULL, 0); - /* NetBSD counts mmap()ed space against the process's data size limit, - * so yank it up. This might be a nasty thing to do? */ - getrlimit (RLIMIT_DATA, &rl); - rl.rlim_cur = 1073741824; - if (setrlimit (RLIMIT_DATA, &rl) < 0) { - fprintf (stderr, "RUNTIME WARNING: unable to raise process data size limit to 1GB (%s). The system may fail to start.\n", - strerror(errno)); - } + /* If we're older than 2.0... */ + if (osrev < 200000000) { + fprintf(stderr, "osrev = %d (needed at least 200000000).\n", osrev); + lose("NetBSD kernel too old to run sbcl.\n"); + } + + /* NetBSD counts mmap()ed space against the process's data size limit, + * so yank it up. This might be a nasty thing to do? */ + getrlimit (RLIMIT_DATA, &rl); + /* Amazingly for such a new port, the provenance and meaning of + this number are unknown. It might just mean REALLY_BIG_LIMIT, + or possibly it should be calculated from dynamic space size. + -- CSR, 2004-04-08 */ + rl.rlim_cur = 1073741824; + if (setrlimit (RLIMIT_DATA, &rl) < 0) { + fprintf (stderr, + "RUNTIME WARNING: unable to raise process data size limit:\n\ + %s.\n\ +The system may fail to start.\n", + strerror(errno)); + } } #endif /* __NetBSD__ */