mkpath() – `mkdir -p’ alike in C for UNIX

Most people are probably familiar with the UNIX utility, mkdir(1). The mkdir utility makes directories (surprise surprise). There is a matching mkdir(2) system call available in the POSIX standard C library. The usage is pretty straightforward – how ever, the command-line executable, mkdir(1), supports a useful option -p to “create intermediate directories [...]

OpenBSD’s omalloc: Bug and buffer overflow detection

For quite a long time now, OpenBSD has, among numerous exploit mitigation techniques, had a very strict mmap()-based malloc() implementation. Recently re-written by Otto Moerbeek, it is even harsher now. I find that this feature makes OpenBSD one of the best platforms to develop C programs on. If you have a [...]

sys/queue.h sucks on Linux

I was vaguely aware that the copy of sys/queue.h on Linux systems was old. However, I’d forgotten it actually lacks some important features of the modern version shipped with BSD systems. There is a very common pattern of usage with linked lists, which the Linux version of queue.h doesn’t support too easily – [...]

Unworkable 0.4 released

I have just tagged, packaged and announced version 0.4 of my BitTorrent implementation, Unworkable.
Here are the release notes:

Implemented sending peer keep-alives.
Trace log now contains timestamps.
Make us more tolerant of intermittent tracker failures.
Added support for Arch Linux.
Fixed an off-by-four bug which could cause segfaults on some platforms.
Fix zero padding in peer id generation.
Overall code reduction and [...]

Decoupled Python GUI Construction, or BitTorrent visualisation

While in general I appreciate very simple, no-nonsense user interfaces for applications that work efficiently on the console and so can be used via SSH, there are times when increased visualisation is very useful.
Specifically with regard to my BitTorrent client, Unworkable, the default user interface is exceedingly simple. Inspired by the ubiquitous scp program [...]

Unworkable 0.3 released

I have just tagged, packaged and announced version 0.3 of my BitTorrent implementation, Unworkable. My goal with Unworkable is to make releases frequently – hopefully twice a month or so – with incremental improvements each release. The hope is that each release should be of a higher quality than the last. Therefore [...]

Porting software from OpenBSD to Windows

Just committed the bits for Unworkable to build under Windows, using Cygwin. The code changes were pretty minimal – specifically, Cygwin lacks getaddrinfo() – however this was a relatively simple matter of bundling the KAME implementation (which is BSD licensed) in the source tree and building and linking with that if it wasn’t [...]

Porting software from OpenBSD to Linux II

I wrote the other day about porting software to Linux. I talked about some of the differences between the platforms in terms of the implementation of some well-known C library functions, and hinted at some other incompatibilities. Well, now I’m going to write about some of the other issues I encountered.

There are a [...]

Faster BitTorrent, or, SHA1 is slow

This weekend I have been concentrating on improving the performance of my BitTorrent implementation. I somewhat believe in the mantra “premature optimisation is the root of all evil”, or at least, I’m not too worried about making everything super fast the first time around. Asynchronous network programs are complicated enough to write that [...]

Porting software from OpenBSD to Linux

I have been making very good progress with my BitTorrent implementation recently. However, I have felt the need to make it compile out of the box under systems other than OpenBSD. The first system I have ported to is Linux, specifically Ubuntu 7.10. In doing the port, I found some interesting differences [...]