English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
How to find out free diskspace?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-07-21 (15:51)
From: Bernd Kuhls <bernd.kuhls@i...>
Subject: Re: How to find out free diskspace?
Richard Jones wrote:
> ---------------------------------------------------------------- statfs_c.c

Hi Richard,

thanks for you code. It is working nicely here. I made some adjustments
to it so it works now on Linux, Solaris/Sparc, FreeBSD and OpenBSD.

The only thing missing is how to return "-1" values to Ocaml when the 
stats functions are not available on that machine?

#  include <sys/param.h>
#  if (defined(__FreeBSD__) && __FreeBSD_version >= 503001) || 
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
#    include <sys/mount.h>
#    define HAVE_STATS 1
#  endif
#  include <sys/vfs.h>
#  define HAVE_STATS 1

static value
#if ((defined (sun) || defined (__sun__)))
copy_statfs (struct statvfs *buf)
copy_statfs (struct statfs *buf)

+  CAMLparam0 ();
+  CAMLlocal2 (bufv, v);
+  bufv = caml_alloc (11, 0);
... (lots of your code)

The code for "ifndef HAVE_STATS" is still lacking, how should it look like?

When this is finished and working I will post the complete code here.

Greetings, Bernd