From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA19313 for caml-redistribution; Sun, 12 Dec 1999 23:07:05 +0100 (MET) 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 BAA16785 for ; Sat, 11 Dec 1999 01:39:33 +0100 (MET) Received: from sunstroke.informatik.uni-tuebingen.de (sunstroke.Informatik.Uni-Tuebingen.De [134.2.11.25]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id BAA12185 for ; Sat, 11 Dec 1999 01:39:32 +0100 (MET) Received: (from pfitzen@localhost) by sunstroke.informatik.uni-tuebingen.de (8.9.1a/8.9.1) id BAA21102 for caml-list@inria.fr; Sat, 11 Dec 1999 01:39:14 +0100 (MET) Date: Sat, 11 Dec 1999 01:39:14 +0100 (MET) From: Juergen Pfitzenmaier Message-Id: <199912110039.BAA21102@sunstroke.informatik.uni-tuebingen.de> To: caml-list@inria.fr Subject: Re: mmap for O'Caml Sender: weis 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