Solaris compatibility
Hello!
I had trouble compiling stud on Solaris (specifically a Joyent smartmachine) so I made a few patches that affect the Makefile and stud.c.
Notes on the patches:
Using fcntl() and O_NONBLOCK is more portable than ioctl and FIONBIO on Unix (See http://stackoverflow.com/questions/1150635/unix-nonblocking-i-o-o-nonblock-vs-fionbio#1151077 and also the libev source code). Apparently FIONBIO is the way to do it on Windows. I can change this to be inside a Solaris-specific #define if you'd like.
For the fclose()/fopen() -> freopen() change I was getting the following error from gcc:
stud.c:1812: error: lvalue required as left operand of assignment
For the USE_KEEPIDLE define, I wasn't sure if you'd rather this was defined in the Makefile or inside of stud.c itself. I can easily change it to your preference. Solaris doesn't let you tune the keep-alive interval per-socket, but does allow tuning it for the whole system via the ndd tool.
Let me know if there's any questions; I'm happy to have a conversation about these patches and make any changes you see fit.
Note: I haven't done any significant testing of it (other than one-off testing), so if you're worried about stability I can wait, do some more testing, then get back to you.
Cheers, ~stash
Any chance this will get merged?
good question would be quite interested in this too
me too