Netbsd compatibility

See mailing list conversation with Thomas Klausner