summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/unix')
-rw-r--r--otherlibs/unix/fchmod.c6
-rw-r--r--otherlibs/unix/fchown.c7
-rw-r--r--otherlibs/unix/ftruncate.c15
3 files changed, 21 insertions, 7 deletions
diff --git a/otherlibs/unix/fchmod.c b/otherlibs/unix/fchmod.c
index a6e8ee903..ba5e55721 100644
--- a/otherlibs/unix/fchmod.c
+++ b/otherlibs/unix/fchmod.c
@@ -21,7 +21,11 @@
CAMLprim value unix_fchmod(value fd, value perm)
{
- if (fchmod(Int_val(fd), Int_val(perm)) == -1) uerror("fchmod", Nothing);
+ int result;
+ caml_enter_blocking_section();
+ result = fchmod(Int_val(fd), Int_val(perm));
+ caml_leave_blocking_section();
+ if (result == -1) uerror("fchmod", Nothing);
return Val_unit;
}
diff --git a/otherlibs/unix/fchown.c b/otherlibs/unix/fchown.c
index 574d3c42b..71e827d76 100644
--- a/otherlibs/unix/fchown.c
+++ b/otherlibs/unix/fchown.c
@@ -19,8 +19,11 @@
CAMLprim value unix_fchown(value fd, value uid, value gid)
{
- if (fchown(Int_val(fd), Int_val(uid), Int_val(gid)) == -1)
- uerror("fchown", Nothing);
+ int result;
+ caml_enter_blocking_section();
+ result = fchown(Int_val(fd), Int_val(uid), Int_val(gid));
+ caml_leave_blocking_section();
+ if (result == -1) uerror("fchown", Nothing);
return Val_unit;
}
diff --git a/otherlibs/unix/ftruncate.c b/otherlibs/unix/ftruncate.c
index f539a6450..5b401fde0 100644
--- a/otherlibs/unix/ftruncate.c
+++ b/otherlibs/unix/ftruncate.c
@@ -24,15 +24,22 @@
CAMLprim value unix_ftruncate(value fd, value len)
{
- if (ftruncate(Int_val(fd), Long_val(len)) == -1)
- uerror("ftruncate", Nothing);
+ int result;
+ caml_enter_blocking_section();
+ result = ftruncate(Int_val(fd), Long_val(len));
+ caml_leave_blocking_section();
+ if (result == -1) uerror("ftruncate", Nothing);
return Val_unit;
}
CAMLprim value unix_ftruncate_64(value fd, value len)
{
- if (ftruncate(Int_val(fd), File_offset_val(len)) == -1)
- uerror("ftruncate", Nothing);
+ int result;
+ file_offset ofs = File_offset_val(len);
+ caml_enter_blocking_section();
+ result = ftruncate(Int_val(fd), ofs);
+ caml_leave_blocking_section();
+ if (result == -1) uerror("ftruncate", Nothing);
return Val_unit;
}