Re: pledge(2) binding for Haskell

2016-01-29 Thread Matthias Kilian
Hi, (and sorry for the delay) On Sat, Jan 23, 2016 at 11:31:00PM +0100, Karel Gardas wrote: > > Well, it's of course more elegant, but it would also mean that > > everytime a new pledge promise will be introduced or an existing > > one removed, this type has to be changed. I don't know how stable

Re: pledge(2) binding for Haskell

2016-01-23 Thread Karel Gardas
Hello, I've thought it would be nice if Haskell type checker would work into our strength. Attached patch defines algebraic data type Promise and use this for calling pledge sys call. The patch also provides two version of Promise to string conversion function. One is explicit and another is

Re: pledge(2) binding for Haskell

2016-01-23 Thread Karel Gardas
Hi Kili, On Sat, Jan 23, 2016 at 10:54 PM, Matthias Kilian wrote: > Well, it's of course more elegant, but it would also mean that > everytime a new pledge promise will be introduced or an existing > one removed, this type has to be changed. I don't know how stable > the

Re: pledge(2) binding for Haskell

2016-01-23 Thread Matthias Kilian
Hi Karel, On Sat, Jan 23, 2016 at 02:31:52PM +0100, Karel Gardas wrote: > I've thought it would be nice if Haskell type checker would work into > our strength. Attached patch defines algebraic data type Promise and > use this for calling pledge sys call. The patch also provides two > version of

Re: pledge(2) binding for Haskell

2016-01-19 Thread Sebastien Marie
On Tue, Jan 19, 2016 at 09:09:49AM +0100, Matthias Kilian wrote: > Add a binding to pledge(2) to package 'unix'. Just a question, as I am unsure by just reading the code. > Index: files/Process.hsc > === > RCS file:

Re: pledge(2) binding for Haskell

2016-01-19 Thread Sebastien Marie
On Tue, Jan 19, 2016 at 09:29:58AM +0100, Sebastien Marie wrote: > > char *empty = {NULL}; > pledge("stdio rpath", empty); > should be better with an array of char *, sorry. char *empty[] = { NULL }; pledge("stdio rpath", empty); -- Sebastien Marie

pledge(2) binding for Haskell

2016-01-19 Thread Matthias Kilian
Add a binding to pledge(2) to package 'unix'. To use it: - run ghc with -package unix - import System.OpenBSD.Process ( pledge ) - call the pledge function as needed. It returns an IO () computation, which will throw an exception in case of an error. Notes: - I'll also merge the -main and

Re: pledge(2) binding for Haskell

2016-01-19 Thread Matthias Kilian
On Tue, Jan 19, 2016 at 08:22:54PM +0100, Matthias Kilian wrote: > Below is a hopefully correct and more complete diff. Again without > bump because I'll also merge -main and -doc. Famous last words. I missed the plist changes. Will send a new diff later (at the moment i'm rebuilding ghc). Ciao,

Re: pledge(2) binding for Haskell

2016-01-19 Thread Matthias Kilian
Hi, On Tue, Jan 19, 2016 at 09:29:58AM +0100, Sebastien Marie wrote: > Just a question, as I am unsure by just reading the code. [...] > > +pledge :: String -> [FilePath] -> IO () > > Shouldn't be: > > pledge :: String -> Maybe [FilePath] -> IO () > > in order to differenciate passing not

Re: pledge(2) binding for Haskell

2016-01-19 Thread Matthias Kilian
On Tue, Jan 19, 2016 at 08:43:17PM +0100, Matthias Kilian wrote: > > Below is a hopefully correct and more complete diff. Again without > > bump because I'll also merge -main and -doc. > > Famous last words. I missed the plist changes. Will send a new diff > later (at the moment i'm rebuilding

Re: pledge(2) binding for Haskell

2016-01-19 Thread Aaron Bieber
Matthias Kilian writes: > Add a binding to pledge(2) to package 'unix'. > > To use it: > > - run ghc with -package unix > > - import System.OpenBSD.Process ( pledge ) > > - call the pledge function as needed. It returns an IO () computation, > which will throw an exception in case of an error.