openbsd is apparently among the last operating systems to require sys/types.h before sys/socket.h. posix doesn't require this and it runs contrary to current recommendations i think, so it's just one more weird thing to deal with when trying to get something to compile.
i haven't really tested this, i'm just throwing it out there. Index: socket.h =================================================================== RCS file: /home/tedu/cvs/src/sys/sys/socket.h,v retrieving revision 1.70 diff -u -r1.70 socket.h --- socket.h 5 Jul 2010 22:20:22 -0000 1.70 +++ socket.h 20 Nov 2010 01:59:58 -0000 @@ -40,6 +40,8 @@ */ #include <machine/param.h> +#include <sys/types.h> + /* * Definitions related to sockets: types, address families, options. */