summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/ftruncate.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/unix/ftruncate.c')
-rw-r--r--otherlibs/unix/ftruncate.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/otherlibs/unix/ftruncate.c b/otherlibs/unix/ftruncate.c
new file mode 100644
index 000000000..769ff86fb
--- /dev/null
+++ b/otherlibs/unix/ftruncate.c
@@ -0,0 +1,18 @@
+#include <mlvalues.h>
+#include "unix.h"
+
+#ifdef HAS_TRUNCATE
+
+value unix_ftruncate(fd, len) /* ML */
+ value fd, len;
+{
+ if (ftruncate(Int_val(fd), Long_val(len)) == -1)
+ uerror("ftruncate", Nothing);
+ return Val_unit;
+}
+
+#else
+
+value unix_ftruncate() { invalid_argument("ftruncate not implemented"); }
+
+#endif