summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/win32unix/stat.c')
-rw-r--r--otherlibs/win32unix/stat.c27
1 files changed, 27 insertions, 0 deletions
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);
+}