From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4507CBB91 for ; Thu, 21 Jul 2005 17:51:17 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6LFpG83002998 for ; Thu, 21 Jul 2005 17:51:16 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA16446 for ; Thu, 21 Jul 2005 17:51:15 +0200 (MET DST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6LFpFs2031720 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 21 Jul 2005 17:51:15 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DvdK5-0004on-Mp for caml-list@inria.fr; Thu, 21 Jul 2005 17:50:57 +0200 Received: from sunray.offis.uni-oldenburg.de ([134.106.52.65]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 21 Jul 2005 17:50:57 +0200 Received: from bernd.kuhls by sunray.offis.uni-oldenburg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 21 Jul 2005 17:50:57 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Bernd Kuhls Subject: Re: How to find out free diskspace? Date: Thu, 21 Jul 2005 17:52:21 +0200 Message-ID: References: <20050701181950.GA2557@furbychan.cocan.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: sunray.offis.uni-oldenburg.de User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050721) X-Accept-Language: en-us, en In-Reply-To: <20050701181950.GA2557@furbychan.cocan.org> Sender: news X-Miltered: at concorde with ID 42DFC474.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42DFC473.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bernd:01 bernd:01 ocaml:01 ifdef:01 ifdef:01 struct:01 buf:01 struct:01 buf:01 camlparam:01 alloc:01 ...:98 wrote:01 functions:01 define:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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 # if (defined(__FreeBSD__) && __FreeBSD_version >= 503001) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) # include # define HAVE_STATS 1 # endif #endif #ifdef HAVE_SYS_VFS_H # include # 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