Browse thread
Re: mmap for O'Caml
- Juergen Pfitzenmaier
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Juergen Pfitzenmaier <pfitzen@i...> |
| 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