caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Bernd Kuhls <bernd.kuhls@informatik.uni-oldenburg.de>
To: caml-list@inria.fr
Subject: Re: How to find out free diskspace?
Date: Thu, 21 Jul 2005 17:52:21 +0200	[thread overview]
Message-ID: <dbog81$stu$1@sea.gmane.org> (raw)
In-Reply-To: <20050701181950.GA2557@furbychan.cocan.org>

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?

#ifdef HAVE_SYS_PARAM_H
#  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
#endif
#ifdef HAVE_SYS_VFS_H
#  include <sys/vfs.h>
#  define HAVE_STATS 1
#endif

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

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

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


  parent reply	other threads:[~2005-07-21 15:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-01 16:28 Bernd Kuhls
2005-07-01 18:06 ` [Caml-list] " Sylvain LE GALL
2005-07-01 18:19 ` Richard Jones
2005-07-03 11:54   ` Damien Doligez
2005-07-03 12:35     ` Richard Jones
2005-07-21 15:52   ` Bernd Kuhls [this message]
2005-07-21 16:18     ` [Caml-list] " Stephane Glondu
2005-07-22 12:46       ` Bernd Kuhls
2005-07-22 14:10         ` [Caml-list] " Eric Cooper
2005-07-22 17:40       ` Bernd Kuhls

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='dbog81$stu$1@sea.gmane.org' \
    --to=bernd.kuhls@informatik.uni-oldenburg.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).