diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 5cd136922..0d1039496 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,8 +1,14 @@ -2004-07-10 Danny Smith +2004-07-11 Danny Smith + + * include/unistd.h (ftruncate): Add inline definition. + * mingwex/ftruncate.c: New file. + * mingwex/Makefile.in: Add ftruncate.o to libmingwex.a. + +2004-07-10 Danny Smith * include/time.h: Do not include sys/types.h. -2004-07-02 Danny Smith +2004-07-02 Danny Smith * mingwex/Makefile.in (MATH_DISTFILES): Remove pow.c, (MATH_OBJS): Remove pow,o. diff --git a/winsup/mingw/include/unistd.h b/winsup/mingw/include/unistd.h index 37682e579..f3a54495e 100644 --- a/winsup/mingw/include/unistd.h +++ b/winsup/mingw/include/unistd.h @@ -14,4 +14,20 @@ #include #undef __UNISTD_GETOPT__ +#ifdef __cplusplus +extern "C" { +#endif + +/* This is defined as a real library function to allow autoconf + to verify its existence. */ +int ftruncate(int, off_t); +__CRT_INLINE int ftruncate(int __fd, off_t __length) +{ + return _chsize (__fd, __length); +} + +#ifdef __cplusplus +} +#endif + #endif /* _UNISTD_H */ diff --git a/winsup/mingw/mingwex/Makefile.in b/winsup/mingw/mingwex/Makefile.in index 6853ca32d..1369de60d 100644 --- a/winsup/mingw/mingwex/Makefile.in +++ b/winsup/mingw/mingwex/Makefile.in @@ -29,8 +29,8 @@ DISTFILES = Makefile.in configure configure.in \ _Exit.c atoll.c dirent.c feclearexcept.c fegetenv.c \ fegetexceptflag.c fegetround.c feholdexcept.c feraiseexcept.c \ fesetenv.c fesetexceptflag.c fesetround.c fetestexcept.c \ - feupdateenv.c fwide.c getopt.c imaxabs.c imaxdiv.c ldtoa.c \ - lltoa.c lltow.c mbsinit.c mingw-fseek.c sitest.c strtof.c \ + feupdateenv.c ftruncate.c fwide.c getopt.c imaxabs.c imaxdiv.c \ + ldtoa.c lltoa.c lltow.c mbsinit.c mingw-fseek.c sitest.c strtof.c \ strtoimax.c strtold.c strtoumax.c testwmem.c ulltoa.c ulltow.c \ wcstof.c wcstoimax.c wcstold.c wcstoumax.c wdirent.c wmemchr.c \ wmemcmp.c wmemcpy.c wmemmove.c wmemset.c wtoll.c @@ -147,7 +147,7 @@ FENV_OBJS = fesetround.o fegetround.o \ feclearexcept.o feholdexcept.o fegetexceptflag.o \ feraiseexcept.o fetestexcept.o fesetexceptflag.o POSIX_OBJS = \ - dirent.o wdirent.o getopt.o + dirent.o wdirent.o getopt.o ftruncate.o REPLACE_OBJS = \ mingw-fseek.o COMPLEX_OBJS = \ diff --git a/winsup/mingw/mingwex/ftruncate.c b/winsup/mingw/mingwex/ftruncate.c new file mode 100755 index 000000000..fdb62951a --- /dev/null +++ b/winsup/mingw/mingwex/ftruncate.c @@ -0,0 +1,5 @@ +#include +int ftruncate(int __fd, off_t __length) +{ + return _chsize (__fd, __length); +}