Change 14376 by jhi@alpha on 2002/01/22 16:46:48

        Subject: [PATCH] Support truncate() in VOS port
        From: [EMAIL PROTECTED]
        Date: Mon, 21 Jan 02 23:27 est
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

.... //depot/perl/MANIFEST#719 edit
.... //depot/perl/hints/vos.sh#7 edit
.... //depot/perl/vos/vos.c#1 add
.... //depot/perl/vos/vosish.h#9 edit

Differences ...

==== //depot/perl/MANIFEST#719 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST.~1~   Tue Jan 22 10:00:05 2002
+++ perl/MANIFEST       Tue Jan 22 10:00:05 2002
@@ -2437,6 +2437,7 @@
 vos/Makefile                   A helper for maintaining the config.*.* in UNIX
 vos/perl.bind                  VOS bind control file
 vos/test_vos_dummies.c         Test program for "vos_dummies.c"
+vos/vos.c                      VOS emulations for missing POSIX functions
 vos/vosish.h                   VOS-specific header file
 vos/vos_dummies.c              Wrappers to soak up undefined functions
 warnings.h                     The warning numbers

==== //depot/perl/hints/vos.sh#7 (text) ====
Index: perl/hints/vos.sh
--- perl/hints/vos.sh.~1~       Tue Jan 22 10:00:05 2002
+++ perl/hints/vos.sh   Tue Jan 22 10:00:05 2002
@@ -14,7 +14,8 @@
 
 # Make command.
 make="/system/gnu_library/bin/gmake"
-_make="/system/gnu_library/bin/gmake"
+# indented to not put it into config.sh
+  _make="/system/gnu_library/bin/gmake"
 
 # Architecture name
 archname="hppa1.1"
@@ -74,3 +75,10 @@
 
 # VOS has a link() function but it is a dummy.
 d_link="undef"
+
+# VOS does not have truncate() but we supply one in vos.c
+d_truncate="define"
+archobjs="vos.o"
+
+# Help gmake find vos.c
+test -h vos.c || ln -s vos/vos.c vos.c

==== //depot/perl/vos/vosish.h#9 (text) ====
Index: perl/vos/vosish.h
--- perl/vos/vosish.h.~1~       Tue Jan 22 10:00:05 2002
+++ perl/vos/vosish.h   Tue Jan 22 10:00:05 2002
@@ -6,3 +6,6 @@
 
 /* The following declaration is an avoidance for posix-950. */
 extern int ioctl (int fd, int request, ...);
+
+/* Specify a prototype for truncate() since we are supplying one. */
+extern int truncate (const char *path, off_t len);

==== //depot/perl/vos/vos.c#1 (text) ====
Index: perl/vos/vos.c
--- perl/vos/vos.c.~1~  Tue Jan 22 10:00:05 2002
+++ perl/vos/vos.c      Tue Jan 22 10:00:05 2002
@@ -0,0 +1,22 @@
+/* Beginning of modification history */
+/* Written 02-01-02 by Nick Ing-Simmons ([EMAIL PROTECTED]) */
+/* 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;
+}
End of Patch.

Reply via email to