Re: flush file buffer, etc

From: Markus Mottl (
Date: Wed Sep 01 1999 - 13:02:14 MET DST

From: Markus Mottl <>
Message-Id: <>
Subject: Re: flush file buffer, etc
To: (Xavier Leroy)
Date: Wed, 1 Sep 1999 12:02:14 +0100 (MET DST)
In-Reply-To: <> from "Xavier Leroy" at Aug 31, 99 09:32:05 pm

> > How do I flush a Unix.file_descr?

> On the other hand, if you want to really commit the writes to the hard
> disk, there is no function in the Unix module for this. But I'm not
> even sure there exists a standardized Unix system call to do this.

Maybe "fsync" would be appropriate. According to the man page this system
call conforms to POSIX.1b (formerly POSIX.4).

> > Deterimine if a file_descr isatty?
> Your best bet is to make isatty() available in Caml. The following C
> wrapper and Caml declaration are all you need:

Another solution, which works with the existing library, would be
to simply call "tcgetattr fd" and catch the possibly resulting error


  try ignore (tcgetattr fd) with Unix_error (ENOTTY,_,_) -> ...

Markus Mottl

Markus Mottl,,

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