From e45c73e66fc18d27bdf5797876fbeb07786a4af1 Mon Sep 17 00:00:00 2001
From: Jimmy Tang
Date: Tue, 22 Mar 2011 22:24:07 +0000
Subject: [PATCH] Touch up Makefile to depend on StatFS.hs
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 08e2f59..4ae8392 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ SysConfig.hs: configure.hs TestConfig.hs
hsc2hs $<
perl -i -pe 's/^{-# INCLUDE.*//' $@
-$(bins): SysConfig.hs Touch.hs
+$(bins): SysConfig.hs Touch.hs StatFS.hs
$(GHCMAKE) $@
git-annex.1: doc/git-annex.mdwn
--
1.7.4.1
StatFS.hs never gets depended on and compiled, the makefile was just missing something
Thanks, done! Interested to hear if StatFS.hs works on OSX (no warning) or is a no-op (with warning). --Joey
for now it gives a warning, it looks like it should be easy enough to add OSX support, I guess it's a case of just digging around documentation to find the equivalent calls/headers. I'll give it a go at making this feature work on OSX and get back to you.
jtang@exia:~/develop/git-annex $ make hsc2hs StatFS.hsc StatFS.hsc:85:2: warning: #warning free space checking code not available for this OS StatFS.hsc:85:2: warning: #warning free space checking code not available for this OS StatFS.hsc:85:2: warning: #warning free space checking code not available for this OS
Just did some minor digging around and checking, this seems to satisfy the compilers etc... I have yet to confirm that it really is working as expected. Also it might be better to check for a darwin operating system instead of apple I think, though I don't know of any one really using a pure darwin OS. But for now it works (I think)
Alternatively, you can just load it up in ghci and see if it reports numbers that make sense:
joey@gnu:~/src/git-annex>make StatFS.hs hsc2hs StatFS.hsc perl -i -pe 's/^{-# INCLUDE.*//' StatFS.hs joey@gnu:~/src/git-annex>ghci StatFS.hs GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. [1 of 1] Compiling StatFS ( StatFS.hs, interpreted ) Ok, modules loaded: StatFS. *StatFS> s <- getFileSystemStats "." Loading package bytestring-0.9.1.5 ... linking ... done. *StatFS> s Just (FileSystemStats {fsStatBlockSize = 4096, fsStatBlockCount = 7427989, fsStatByteCount = 30425042944, fsStatBytesFree = 2528489472, fsStatBytesAvailable = 2219384832, fsStatBytesUsed = 27896553472})Ok, well it looks like it isn't doing anything useful at all.
jtang@x00:~/develop/git-annex $ make StatFS.hs hsc2hs StatFS.hsc perl -i -pe 's/^{-# INCLUDE.*//' StatFS.hs jtang@x00:~/develop/git-annex $ ghci StatFS.hs GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. [1 of 1] Compiling StatFS ( StatFS.hs, interpreted ) Ok, modules loaded: StatFS. *StatFS> s <- getFileSystemStats "." Loading package bytestring-0.9.1.7 ... linking ... done. *StatFS> s Just (FileSystemStats {fsStatBlockSize = 0, fsStatBlockCount = 1048576, fsStatByteCount = 0, fsStatBytesFree = 0, fsStatBytesAvailable = 0, fsStatBytesUsed = 0}) *StatFS> s <- getFileSystemStats "/" *StatFS> s Just (FileSystemStats {fsStatBlockSize = 0, fsStatBlockCount = 1048576, fsStatByteCount = 0, fsStatBytesFree = 0, fsStatBytesAvailable = 0, fsStatBytesUsed = 0}) *StatFS>Actually I may have just been stupid and should have read the man page on statfs...
yields this...
jtang@x00:~/develop/git-annex $ ghci StatFS.hs GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. [1 of 1] Compiling StatFS ( StatFS.hs, interpreted ) Ok, modules loaded: StatFS. *StatFS> s <- getFileSystemStats "." Loading package bytestring-0.9.1.7 ... linking ... done. *StatFS> s Just (FileSystemStats {fsStatBlockSize = 4096, fsStatBlockCount = 244106668, fsStatByteCount = 999860912128, fsStatBytesFree = 423097798656, fsStatBytesAvailable = 422835654656, fsStatBytesUsed = 576763113472}) *StatFS>we could just stick another if defined (APPLE) instead of what I previously had and it looks like it will do the right thing on OSX.
I forgot to mention that the statfs64 stuff in OSX seems to be deprecated, see http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/statfs64.2.html
on a slightly different note, is anonymous pushing to the "wiki" over git allowed? I'd prefer to be able to edit stuff inline for updating some of my own comments if I can :P
Try the changes I've pushed to use statfs64 on apple.
There is actually a standardized statvfs that I'd rather use, but after the last time that I tried going with the POSIX option first only to find it was not broadly implemented, I was happy to find some already existing code that worked for some OSs.
(While ikiwiki supports anonymous git push, it's a feature we have not rolled out on Branchable.com yet, and anyway, ikiwiki disallows editing existing comments that way. I would, however, be happy to git pull changes from somewhere.)