From 366af60a746782584a94c8a39bae25fadb28a9de Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Thu, 21 Sep 2006 13:57:34 +0000 Subject: Ajout de Unix.fstat et Unix.isatty git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7633 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- otherlibs/win32unix/stat.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'otherlibs/win32unix/stat.c') diff --git a/otherlibs/win32unix/stat.c b/otherlibs/win32unix/stat.c index a0ba3ca8d..313882a52 100644 --- a/otherlibs/win32unix/stat.c +++ b/otherlibs/win32unix/stat.c @@ -86,3 +86,30 @@ CAMLprim value unix_stat_64(value path) return stat_aux(1, &buf); } +CAMLprim value unix_fstat(value handle) +{ + int ret; + struct _stati64 buf; + + ret = _fstati64(win_CRT_fd_of_filedescr(handle), &buf); + if (ret == -1) uerror("fstat", Nothing); + if (buf.st_size > Max_long) { + win32_maperr(ERROR_ARITHMETIC_OVERFLOW); + uerror("fstat", Nothing); + } + return stat_aux(0, &buf); +} + +CAMLprim value unix_fstat_64(value handle) +{ + int ret; + struct _stati64 buf; + + ret = _fstati64(win_CRT_fd_of_filedescr(handle), &buf); + if (ret == -1) uerror("fstat", Nothing); + if (buf.st_size > Max_long) { + win32_maperr(ERROR_ARITHMETIC_OVERFLOW); + uerror("fstat", Nothing); + } + return stat_aux(1, &buf); +} -- cgit v1.2.3-70-g09d2