portability to Debian's non-linux architectures

From: Peter Piwowarski <peterjpiwowarski_at_gmail.com>
Date: Mon, 07 Sep 2015 11:16:33 -0400
Debian has semi-official ports to two non-Linux kernels, FreeBSD's 
kernel and the GNU HURD (making three Debian architectures in total, 
kfreebsd-i386, kfreebsd-amd64, and hurd-i386). These are fairly strange 
systems from a portability perspective, since they behave a lot like 
"Linux" while having different kernels and unames. Unpatched sndio 
doesn't yet run on them, and local audio output will still not work, 
since they don't support ALSA except through insufficient compatibility 
layers, but I've managed to get sndio to build on them with a few patches.

The biggest problem is HURD, which does not define PATH_MAX. (yes, you 
read that correctly.) The choices there are to either turn a lot of 
PATH_MAX-sized static buffers into dynamic ones (the HURD people think 
that's the right way to go about it[1]), or to do something cheesy like:

#ifndef PATH_MAX
#define PATH_MAX your favorite bogus number
#endif

I have put together a patch taking the former course (but which I'm not 
absolutely certain is regression/leak free, more experienced eyes than 
mine would need to see it); the latter is pretty obvious. (My patch does 
not convert occurences of PATH_MAX in the ALSA backend, since that's 
Linux-specific. I have patches for that as well if that's considered 
helpful. I am also not a habitual KNF speaker; despite my proofreading 
efforts something may possibly have snuck through.)

The other major unsupported preprocessor symbol is SOCK_CLOEXEC, which 
the kFreeBSD architectures do not seem to define (though FreeBSD itself 
apparently does, or will do in the future). A trivial patch along the 
lines of the PATH_MAX thing above is attached.

Finally, there are changes to the uname check in configure that need to 
be made to detect these systems correctly, that patch is also attached.

I understand if this stuff (especially the PATH_MAX diff) isn't 
considered helpful in the official portable sndio tree, though I'll 
probably end up carrying some sort of portability goo in Debian 
packaging if this isn't merged. (not the PATH_MAX patch though, that's a 
bit much...)

[1] 
http://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL




Received on Mon Sep 07 2015 - 17:16:33 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 09 2022 - 16:23:46 CEST