summaryrefslogtreecommitdiff
path: root/vos/vos.c
diff options
context:
space:
mode:
authorPaul Green <Paul.Green@stratus.com>2002-01-21 18:27:00 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-22 16:46:48 +0000
commit4673b3b2ab5893fa7397bc2e9faf4702afebb0d0 (patch)
treed3623ed182386393e0fbff60e55ca312c0573484 /vos/vos.c
parent57e461aaa4775066199c6fde2fe9ec4535cbda3d (diff)
downloadperl-4673b3b2ab5893fa7397bc2e9faf4702afebb0d0.tar.gz
Support truncate() in VOS port
Message-Id: <200201220428.XAA15304@mailhub1.stratus.com> p4raw-id: //depot/perl@14376
Diffstat (limited to 'vos/vos.c')
-rw-r--r--vos/vos.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/vos/vos.c b/vos/vos.c
new file mode 100644
index 0000000000..c3566d4a8e
--- /dev/null
+++ b/vos/vos.c
@@ -0,0 +1,22 @@
+/* Beginning of modification history */
+/* Written 02-01-02 by Nick Ing-Simmons (nick@ing-simmons.net) */
+/* End of modification history */
+
+/* VOS doesn't supply a truncate function, so we build one up
+ from the available POSIX functions. */
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+int
+truncate(const char *path, off_t len)
+{
+ int fd = open(path,O_WRONLY);
+ int code = -1;
+ if (fd >= 0) {
+ code = ftruncate(fd,len);
+ close(fd);
+ }
+ return code;
+}