From: Markus Mottl <mottl@miss.wu-wien.ac.at>
Message-Id: <199909011002.MAA32699@miss.wu-wien.ac.at>
Subject: Re: flush file buffer, etc
To: Xavier.Leroy@inria.fr (Xavier Leroy)
Date: Wed, 1 Sep 1999 12:02:14 +0100 (MET DST)
In-Reply-To: <19990831213205.60338@pauillac.inria.fr> from "Xavier Leroy" at Aug 31, 99 09:32:05 pm
> > How do I flush a Unix.file_descr?
[snip]
> 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
"ENOTTY".
E.g.:
try ignore (tcgetattr fd) with Unix_error (ENOTTY,_,_) -> ...
Regards,
Markus Mottl
-- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET