Skip to content

Porting to FreeBSD 9.1

John P. Hartmann edited this page Dec 16, 2013 · 4 revisions

This article is a travelogue of my travails with FreeBSD 9.1 and Hyperion.

First of all, this is not a new port.
The FreeBSD ports collection contains a 3.09 level port that at least builds and brings up the console interface.

The FreeBSD port includes patches to cope with various deficiencies the original package has. By far the largest patch is to configure.ac.

Thus to make FreeBSD build Hyperion right out of he box requires changes to the repository, but changes are also needed to cope with non-portable constructs that have sneaked in since the 3.09 fork.

Readers who have leanings towards political correctness are advised to avert their eyes.

Blow-by-blow acount.

This is the list of modules and stuff I had to deal with. Essentially in the sequence they were discovered by fixing one thing and then slugging on to the next error.

configure.ac

The configuration of IPv6 was severely broken; also for OS/X, though OS/X could configure with less change than FreeBSD; still, the FreeBSD changes did not break OS/X.

hscutil.c

Portability issue with setcockopt() second argument caused compile error. Fixed by following the man page.

hostinfo.c

Lots of undefined mib names. Fixed by making the calls conditional on the manifest constants being defined in the preprocessor sense. This would break if the mib names became an enum, as they ought to be, but the whole module is futile.

hthreads.c

ENOTRECOVERABLE and EOWNERDEAD are not defined in FreeBSD 9.1. This module also has trouble with printf() strings since thread IDs are not integers, but pointers.

hmacros.h

For systems that have no gettid() but do have syscall() the band aid is to try the system call SYS_gettid.

hmacros.h:793:  #define  gettid()         ((pid_t)(syscall(SYS_gettid)))

This is the most outrageous piece of code I've ever seen.