X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fbsd-os.c;h=1b013969f35b1baeb3d11697ff5bd6f97f33f584;hb=fb76e3acd8b8a53cdadaa65bce1d090d99e004a0;hp=cfd7c31343794519cde76c4f1f0a61242c282007;hpb=8e9908b6f79b7bb52a281cfcbf0712d4b914f3cf;p=sbcl.git diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index cfd7c31..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__ @@ -406,7 +427,20 @@ os_get_runtime_executable_path() return NULL; return copied_string(path); } -#else /* Not DARWIN or FREEBSD */ +#elif defined(LISP_FEATURE_NETBSD) +char * +os_get_runtime_executable_path() +{ + struct stat sb; + char *path = strdup("/proc/curproc/file"); + if (path && ((stat(path, &sb)) == 0)) + return path; + else { + fprintf(stderr, "Couldn't stat /proc/curproc/file; is /proc mounted?\n"); + return NULL; + } +} +#else /* Not DARWIN or FREEBSD or NETBSD */ char * os_get_runtime_executable_path() {