{-# INCLUDE <sys/types.h> #-}
{-# INCLUDE <sys/mman.h> #-}
{-# INCLUDE <sys/fcntl.h> #-}
{-# LINE 1 "System/Posix/SharedMem.hsc" #-}
{-# OPTIONS -fffi #-}
{-# LINE 2 "System/Posix/SharedMem.hsc" #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  System.Posix.SharedMem
-- Copyright   :  (c) Daniel Franke 2007
-- License     :  BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer  :  libraries@haskell.org
-- Stability   :  experimental
-- Portability :  non-portable (requires POSIX)
--
-- POSIX shared memory support.
--
-----------------------------------------------------------------------------

module System.Posix.SharedMem
    (ShmOpenFlags(..), shmOpen, shmUnlink)
    where


{-# LINE 22 "System/Posix/SharedMem.hsc" #-}

{-# LINE 23 "System/Posix/SharedMem.hsc" #-}

{-# LINE 24 "System/Posix/SharedMem.hsc" #-}

import System.Posix.Types
import System.Posix.Error
import Foreign.C
import Data.Bits

data ShmOpenFlags = ShmOpenFlags 
    { shmReadWrite :: Bool,
      -- ^ If true, open the shm object read-write rather than read-only. 
      shmCreate :: Bool,
      -- ^ If true, create the shm object if it does not exist. 
      shmExclusive :: Bool,
      -- ^ If true, throw an exception if the shm object already exists.
      shmTrunc :: Bool
      -- ^ If true, wipe the contents of the shm object after opening it.
    }

-- | Open a shared memory object with the given name, flags, and mode.
shmOpen :: String -> ShmOpenFlags -> FileMode -> IO Fd

{-# LINE 62 "System/Posix/SharedMem.hsc" #-}
shmOpen = error "System.Posix.SharedMem:shm_open: not available"

{-# LINE 64 "System/Posix/SharedMem.hsc" #-}

-- | Delete the shared memory object with the given name.
shmUnlink :: String -> IO ()

{-# LINE 72 "System/Posix/SharedMem.hsc" #-}
shmUnlink = error "System.Posix.SharedMem:shm_unlink: not available"

{-# LINE 74 "System/Posix/SharedMem.hsc" #-}


{-# LINE 79 "System/Posix/SharedMem.hsc" #-}


{-# LINE 84 "System/Posix/SharedMem.hsc" #-}
