{-# LINE 1 "src/unix/System/Uname.hsc" #-}
module System.Uname
( getRelease
)
where
import Foreign
import Foreign.C
getRelease :: IO String
getRelease :: IO String
getRelease = do
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca forall a b. (a -> b) -> a -> b
$ \ Ptr Utsname
ptr ->
do forall a. (Eq a, Num a) => String -> IO a -> IO ()
throwErrnoIfMinus1_ String
"uname" forall a b. (a -> b) -> a -> b
$ Ptr Utsname -> IO CInt
uname Ptr Utsname
ptr
CString -> IO String
peekCString forall a b. (a -> b) -> a -> b
$ Ptr Utsname -> CString
release Ptr Utsname
ptr
foreign import ccall unsafe "haskell_uname"
uname :: Ptr Utsname -> IO CInt
data Utsname
instance Storable Utsname where
sizeOf :: Utsname -> Int
sizeOf = forall a b. a -> b -> a
const (Int
390)
{-# LINE 37 "src/unix/System/Uname.hsc" #-}
alignment = const 1
{-# LINE 38 "src/unix/System/Uname.hsc" #-}
poke = error "Storable Utsname: peek: unsupported operation"
peek :: Ptr Utsname -> IO Utsname
peek = forall a. HasCallStack => String -> a
error String
"Storable Utsname: poke: unsupported operation"
release :: Ptr Utsname -> CString
release :: Ptr Utsname -> CString
release = ((\Ptr Utsname
hsc_ptr -> Ptr Utsname
hsc_ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
130))
{-# LINE 43 "src/unix/System/Uname.hsc" #-}