diff options
author | Paul Green <Paul.Green@stratus.com> | 2002-01-21 18:27:00 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-01-22 16:46:48 +0000 |
commit | 7b2b351e8fdcd287739431e25ffed099b66cdee2 (patch) | |
tree | d3623ed182386393e0fbff60e55ca312c0573484 | |
parent | c68a00c0718023d4b3e2aa313bc06f7aa681515e (diff) | |
download | perl-7b2b351e8fdcd287739431e25ffed099b66cdee2.tar.gz |
Support truncate() in VOS port
Message-Id: <200201220428.XAA15304@mailhub1.stratus.com>
p4raw-id: //depot/perl@14376
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | hints/vos.sh | 10 | ||||
-rw-r--r-- | vos/vos.c | 22 | ||||
-rw-r--r-- | vos/vosish.h | 3 |
4 files changed, 35 insertions, 1 deletions
@@ -2437,6 +2437,7 @@ vos/install_perl.cm VOS command macro to install perl after building 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 diff --git a/hints/vos.sh b/hints/vos.sh index f4e97003b6..c06adba188 100644 --- a/hints/vos.sh +++ b/hints/vos.sh @@ -14,7 +14,8 @@ ccflags="-D_SVID_SOURCE -D_POSIX_C_SOURCE=199509L" # 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 @@ fflushNULL=define # 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 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; +} diff --git a/vos/vosish.h b/vos/vosish.h index cc5e4642e3..5befc6586a 100644 --- a/vos/vosish.h +++ b/vos/vosish.h @@ -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); |