From 365feb397b8129901b6ece60a99859fd144485ea Mon Sep 17 00:00:00 2001 From: jailbird777 Date: Thu, 17 Jun 2021 18:15:11 -0500 Subject: [PATCH] Remove unneeded ugly hack for 32-bit Solaris - The official Sun/Oracle solution is to use the extendedFILE(5) mechanism, which works around the limitation. https://docs.oracle.com/cd/E18752_01/html/816-5175/extendedfile-5.html - Add a quick HOWTO to the README.md --- README.md | 7 ++++++- librb/src/commio.c | 32 -------------------------------- 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 17657d22..644646f4 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,12 @@ These are known issues and workarounds for various platforms. fix this you must: `sysctl net.inet6.ip6.v6only=0` * **Solaris**: you may have to set your `PATH` to include `/usr/gnu/bin` and `/usr/gnu/sbin` before `/usr/bin` - and `/usr/sbin`. Solaris's default tools don't seem to play nicely with the configure script. + and `/usr/sbin`. Solaris's default tools don't seem to play nicely with the configure script. When running + as a 32-bit binary, it should be started as: + + ```bash + ulimit -n 4095 ; LD_PRELOAD_32=/usr/lib/extendedFILE.so.1 ./solanum + ``` # building diff --git a/librb/src/commio.c b/librb/src/commio.c index 6b5a6b4d..ec8f6609 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -123,30 +123,6 @@ free_fds(void) } } -/* 32bit solaris is kinda slow and stdio only supports fds < 256 - * so we got to do this crap below. - * (BTW Fuck you Sun, I hate your guts and I hope you go bankrupt soon) - */ - -#if defined (__SVR4) && defined (__sun) -static void -rb_fd_hack(int *fd) -{ - int newfd; - if(*fd > 256 || *fd < 0) - return; - if((newfd = fcntl(*fd, F_DUPFD, 256)) != -1) - { - close(*fd); - *fd = newfd; - } - return; -} -#else -#define rb_fd_hack(fd) -#endif - - /* close_all_connections() can be used *before* the system come up! */ static void @@ -577,8 +553,6 @@ static void rb_accept_tryaccept(rb_fde_t *F, void *data __attribute__((unused))) return; } - rb_fd_hack(&new_fd); - new_F = rb_open(new_fd, RB_FD_SOCKET | (F->type & RB_FD_INHERIT_TYPES), "Incoming Connection"); if(new_F == NULL) @@ -892,9 +866,6 @@ rb_socketpair(int family, int sock_type, int proto, rb_fde_t **F1, rb_fde_t **F2 #endif return -1; - rb_fd_hack(&nfd[0]); - rb_fd_hack(&nfd[1]); - *F1 = rb_open(nfd[0], RB_FD_SOCKET, note); *F2 = rb_open(nfd[1], RB_FD_SOCKET, note); @@ -944,8 +915,6 @@ rb_pipe(rb_fde_t **F1, rb_fde_t **F2, const char *desc) } if(pipe(fd) == -1) return -1; - rb_fd_hack(&fd[0]); - rb_fd_hack(&fd[1]); *F1 = rb_open(fd[0], RB_FD_PIPE, desc); *F2 = rb_open(fd[1], RB_FD_PIPE, desc); @@ -1000,7 +969,6 @@ rb_socket(int family, int sock_type, int proto, const char *note) * XXX !!! -- adrian */ fd = socket(family, sock_type, proto); - rb_fd_hack(&fd); if(rb_unlikely(fd < 0)) return NULL; /* errno will be passed through, yay.. */