[Haskell-cafe] Unix gurus, help me please

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Jul 17 12:22:07 EDT 2006

On Mon, 2006-07-17 at 19:59 +0400, Bulat Ziganshin wrote:
> Hello Duncan,
> Monday, July 17, 2006, 6:18:49 PM, you wrote:
> >> - I include file io.h, but this particular system has "sys/io.h"
> > Are you sure you need sys/io.h? What are you using from it? As far as I
> > can see it doesn't define anything that you might want to use, just
> > functions for reading and writing bytes from/to the non-portable unix io
> > ports feature (aka /dev/port).
> yes, only this _commit really. and how should i import this fsync
> instead of _commit so that this import will work on all unix platforms
> (supported by ghc and other compilers)?
> is the following enough:
> foreign import ccall unsafe "unistd.h fsync"
>    c_commit :: CInt -> IO CInt

I think that should do. It's defined in POSIX.1b so you should be able
to rely on it being defined in that header file on all POSIX systems.

> ? or it's better to import it using HsBase.h?

Well that's GHC-only as far as I know.


More information about the Haskell-Cafe mailing list