]> jfr.im git - solanum.git/commitdiff
Remove unneeded ugly hack for 32-bit Solaris
authorjailbird777 <redacted>
Thu, 17 Jun 2021 23:15:11 +0000 (18:15 -0500)
committerEd Kellett <redacted>
Sat, 26 Jun 2021 15:22:08 +0000 (16:22 +0100)
- 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
librb/src/commio.c

index 17657d228f1525103c720560a40996c3027f82c1..644646f49ac1c450a6dcc9af7233466cc879e7e9 100644 (file)
--- 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
 
index 6b5a6b4d91279ad285b47d7af2d6a59c327b2f20..ec8f6609dd4db9837572c7921a1fed559f710ae2 100644 (file)
@@ -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.. */