hackery: Story of CRT suckage! Be amazed!
So here I am, sitting at my PC last night trying to port
Luke's ftp client to Win32. It uses a lot of Unixisms,
including signals (to emulate overlapped I/O and to do
basic threading), pipes (popen), fork, termios/termcap,
lots of directory stuff, and arpa/* and inet/* and so on.
So here I am working with MS's C runtime (CRT) which sucks
just so bad. select() is essentially broken (64 file
descriptors, anyone?), pipes don't exist, signals don't
exist (and no way to really trap them), termios/termcap
doesn't exist, fork doesn't work the way you'd expect, and
unless it's in the Standard C library, there's no arpa/* or
Coupled with that, the Visual C++ compiler ignores
blah blah blah
and attempts to pre-process stuff it is supposed to ignore.
So I'm basically hacking away code, so there's no chance of
keeping this from being anything but a complete fork.
I don't want to use cygwin or gcc for win32 as I'm aiming
for a high performance port.
So, I basically look at the guts of Luke's program. It's
about 2000 lines of Crufty C code. I'm thinking that a new
port, with just the guts of Luke's code will the way
This allows me to use overlapped I/O (which is a fancy way
of saying "asynchronous" I/O). NT reads blocks < 8 kb in
blocking mode regardless of overlapped or not, and that
works out okay anyway as we want to chuff it down a
(slower) network socket. So I only am considering
overlapped I/O for the network side. This has a greater
chance of being able to work on the 9x kernel (which I care
about >< this much). On platforms that do not support
overlapped I/O (most Unixes), this can be changed back to
be blocking network I/O and just put back in the signal
handlers to perform cleanups and rate limiting.
It also allows me to rejig the old code that is truly
crufty, and if I keep presentation, MI transport and MD
transport (ipv4/nt ipv4/unix ipv6/nt ipv6/unix) seperate,
the result will be a portable, probably smaller, definitely
more robust client.
How many more kids have to die before the US takes action
on small arms in the community?
Two separate school shootings today so far, luckily the one
in the US didn't kill the person shot in the head, but the
one in Brazil did. But being shot in the head is not fun,
and I bet that person will be scarred for life, both
emotionally and physically.
This tragedy must stop NOW!