On Mon, Jan 16, 2017 at 01:05:36PM -0600, Jordon wrote: > What is the ???official" way to pledge(2) a portable program? > > Put #ifdef __OpenBSD__ around the pledge call? > > Make an #ifndef __OpenBSD__ block that defined the function to always return > 0? > > Something better?
pledge() itself serves as good annotation of the subsets of POSIX used by a program, one option to avoid the #ifdef pollution is to detect if it's available first, otherwise: CPPFLAGS="$CPPFLAGS -D\"pledge(promises,paths)=0\"" Or similarly, in some header: #define pledge(promises,paths) 0 -Bryan.