January 27th, 2005


fd passing

Today's goal was to learn how file descriptor passing works in Unix.

I couldn't find a Perl module to do it so I set off writing it in C, with the hope to understand it well enough to implement it in Perl. So I wrote it in C, got it working, and started to implement it in Perl, quickly finding:


... which is exactly what I need. And reasonably portable. The act of writing it in C just led me down the road of knowing the right keywords to look for (namely "sendmsg"), which made me find this module, which led me to FDpasser.

The next goal is ripping out all the non-portable Linux::AIO code in Perlbal to instead do sync operations in child threads using fd passing.

I'm not the only one hating a cramped 32-bit address space!

Linus on address space issues:
So for example, 3GB of virtual space is enough for most things. In fact, just 1GB is plenty for 99% of all things. But some programs will break, and they can break in surprising ways. Like "my email indexing stopped working" - because my combined mailboxes are currently 2.8GB, and it slurps them all in in one go to speed things up.

(That wasn't a made-up-example, btw. I had to write this stupid email searcher for the SCO subpoena, and the fastest way was literally to index everything in memory. Thank gods for 64-bit address spaces, because I ended up avoiding having to be incredibly careful by just doing it on another machine instead).