Re: mmap for O'Caml

From: Juergen Pfitzenmaier (pfitzen@informatik.uni-tuebingen.de)
Date: Sat Dec 11 1999 - 01:39:14 MET


Date: Sat, 11 Dec 1999 01:39:14 +0100 (MET)
From: Juergen Pfitzenmaier <pfitzen@informatik.uni-tuebingen.de>
Message-Id: <199912110039.BAA21102@sunstroke.informatik.uni-tuebingen.de>
To: caml-list@inria.fr
Subject: Re: mmap for O'Caml

John Prevost wrote:
> As far as I can tell, there's no way to find out whether a given fd is
> open read only or read-write or even write-only without actually
> trying to read or write it. This means I can't detect at mmap time
> that something's wrong. So my options are:

POSIX has functions stat and fstat. They write info about a file
in a struct stat. One member of the struct is st_mode. You can
use macros like S_IWUSR to check if the owner of the file has
write permission. See man 2 stat for details.

Oooh, this means using C code and not OCaml, but that should be
no problem. You are already using C for your mmap stuff.

I would really like to see some work on using/writing a DB with OCaml
(anyone with an interface for DB/2 out of the box ?) so I look forward
to your project.

pfitzen



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:29 MET