Conditionally add OpenBSD's pledge(2) call -- but to which library?

Matthias Kilian kili at outback.escape.de
Wed Nov 11 21:01:32 UTC 2015


Hi,

I'd like to add the (OpenBSD only) pledge(2) call to some library in
our (OpenBSD's) ghc port. See

http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/pledge.2?query=pledge

and

http://www.openbsd.org/papers/hackfest2015-pledge/index.html

for some information of what this is about (and Linux people, please
don't feel too offended by that second one ;-))

I'd to this as a patch to ghc in our port, but I'd like to eventually
submit a patch to include it (conditionally, only on OpenBSD for
now) upstream. But I need some hints *where* to include it.

At the moment, I'm considering the unix package (bundled with ghc),
and therein, the module System.Posix.Unistd. Even if pledge(2)
obviously isn't Posix, it's all about stripping down an API which
in large parts conforms to Posix to some subset.

Would this be acceptable? Or should I use something like
System.OpenBSD.Unistd? In any case, client application using it
would always either need some #ifdef or would get patches local to
the OpenBSD ports tree.

So, any thoughts about this?

Please note: just writing a separate package for this wouldn't help
much (for OpenBSD ports), because it would require changing cabal
dependencies for every client application in addition to other
source code patches.

Ciao,
	Kili


More information about the Libraries mailing list