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
This commit is contained in:
jailbird777 2021-06-17 18:15:11 -05:00 committed by Ed Kellett
parent 2f42f7c045
commit 365feb397b
2 changed files with 6 additions and 33 deletions

View file

@ -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

View 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.. */