release the lock in ftruncate, fchown, and fchmod
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14425 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
d78c1fe671
commit
67f7b37a7d
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue