13 #include <sys/utsname.h>
18 -- | @'uname' name@ stores nul-terminated strings of information
19 -- identifying the current system info to the structure referenced
23 -- > import Foreign.Marshal
25 -- > sysName :: IO String
26 -- > sysName = alloca $ \ ptr ->
27 -- > do throwErrnoIfMinus1_ "uname" $ uname ptr
28 -- > peekCString $ sysname ptr
30 foreign import ccall unsafe "sys/utsname.h uname"
31 uname :: Ptr Utsname -> IO CInt
35 instance Storable Utsname where
36 sizeOf = const #size struct utsname
38 poke = error "Storable Utsname: peek: unsupported operation"
39 peek = error "Storable Utsname: poke: unsupported operation"
41 sysname :: Ptr Utsname -> CString
42 sysname = (#ptr struct utsname, sysname)
44 nodename :: Ptr Utsname -> CString
45 nodename = (#ptr struct utsname, nodename)
47 release :: Ptr Utsname -> CString
48 release = (#ptr struct utsname, release)
50 version :: Ptr Utsname -> CString
51 version = (#ptr struct utsname, version)
53 machine :: Ptr Utsname -> CString
54 machine = (#ptr struct utsname, machine)