summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/StatFS.hsc
diff options
context:
space:
mode:
authorJose A Ortega Ruiz <jao@gnu.org>2010-02-14 04:08:23 +0100
committerJose A Ortega Ruiz <jao@gnu.org>2010-02-14 04:08:23 +0100
commit7d4d754f92a3c0f78f4adc474392013749d85972 (patch)
tree30e8a2c92e646d1e29ab5c277f9347371da63ea0 /Plugins/Monitors/StatFS.hsc
parent79791681b96a24cfb7c60c9ef2e444246ad0d77f (diff)
downloadxmobar-7d4d754f92a3c0f78f4adc474392013749d85972.tar.gz
xmobar-7d4d754f92a3c0f78f4adc474392013749d85972.tar.bz2
Less resource hungry top monitors
Ignore-this: 920f60d81166f87370d20d779ed738c9 darcs-hash:20100214030823-748be-bde07719a3b3658a63bb1b687fec6c4c74b1f566.gz
Diffstat (limited to 'Plugins/Monitors/StatFS.hsc')
-rw-r--r--Plugins/Monitors/StatFS.hsc9
1 files changed, 4 insertions, 5 deletions
diff --git a/Plugins/Monitors/StatFS.hsc b/Plugins/Monitors/StatFS.hsc
index ad3b659..9c1972c 100644
--- a/Plugins/Monitors/StatFS.hsc
+++ b/Plugins/Monitors/StatFS.hsc
@@ -15,12 +15,12 @@
{-# LANGUAGE CPP, ForeignFunctionInterface, EmptyDataDecls #-}
-module Plugins.Monitors.StatFS (FileSystemStats(..), getFileSystemStats) where
+module Plugins.Monitors.StatFS ( FileSystemStats(..)
+ , getFileSystemStats ) where
import Foreign
import Foreign.C.Types
import Foreign.C.String
-import Foreign.Storable
import Data.ByteString (useAsCString)
import Data.ByteString.Char8 (pack)
@@ -54,9 +54,8 @@ getFileSystemStats path =
allocaBytes (#size struct statfs) $ \vfs ->
useAsCString (pack path) $ \cpath -> do
res <- c_statfs cpath vfs
- case res of
- -1 -> return Nothing
- _ -> do
+ if res == -1 then return Nothing
+ else do
bsize <- (#peek struct statfs, f_bsize) vfs
bcount <- (#peek struct statfs, f_blocks) vfs
bfree <- (#peek struct statfs, f_bfree) vfs