Project

General

Profile

Bug #4564 ยป 0001-properly-detect-truncate-ftruncate-and-ftello-existence.patch

luislavena (Luis Lavena), 04/10/2011 03:32 AM

View differences:

configure.in
1048 1048
		ac_cv_func_isnan=yes
1049 1049
		ac_cv_func_finite=yes
1050 1050
		ac_cv_func_link=yes
1051
		ac_cv_func_truncate=yes
1052 1051
		ac_cv_func_fseeko=yes
1053
		ac_cv_func_ftello=yes
1054 1052
		ac_cv_lib_crypt_crypt=no
1055 1053
		ac_cv_func_getpgrp_void=no
1056 1054
		ac_cv_func_memcmp_working=yes
......
1302 1300
  AC_LIBOBJ([signbit])
1303 1301
fi
1304 1302
AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall __syscall chroot getcwd eaccess\
1305
	      truncate ftruncate chsize times utimes utimensat fcntl lockf lstat\
1303
	      truncate ftruncate ftello chsize times utimes utimensat fcntl lockf lstat\
1306 1304
	      link symlink readlink readdir_r fsync fdatasync fchown posix_fadvise\
1307 1305
	      setitimer setruid seteuid setreuid setresuid setproctitle socketpair\
1308 1306
	      setrgid setegid setregid setresgid issetugid pause lchown lchmod\
include/ruby/win32.h
381 381
//
382 382

  
383 383
#define SUFFIX
384

  
385
#if !defined HAVE_FTRUNCATE
384 386
#define ftruncate rb_w32_ftruncate
385
extern int       truncate(const char *path, off_t length);
386
extern int       ftruncate(int fd, off_t length);
387
extern int       rb_w32_ftruncate(int fd, off_t length);
388
#endif
389

  
390
#if !defined HAVE_TRUNCATE
391
#define truncate rb_w32_truncate
392
extern int       rb_w32_truncate(const char *path, off_t length);
393
#endif
394

  
387 395
extern int       fseeko(FILE *stream, off_t offset, int whence);
388
extern off_t     ftello(FILE *stream);
396

  
397
#if !defined HAVE_FTELLO
398
#define ftello rb_w32_ftello
399
extern off_t     rb_w32_ftello(FILE *stream);
400
#endif
389 401

  
390 402
//
391 403
// stubs
win32/win32.c
4318 4318
}
4319 4319

  
4320 4320
int
4321
truncate(const char *path, off_t length)
4321
rb_w32_truncate(const char *path, off_t length)
4322 4322
{
4323 4323
    HANDLE h;
4324 4324
    int ret;
......
4344 4344
}
4345 4345

  
4346 4346
int
4347
ftruncate(int fd, off_t length)
4347
rb_w32_ftruncate(int fd, off_t length)
4348 4348
{
4349 4349
    HANDLE h;
4350 4350

  
......
4417 4417
}
4418 4418

  
4419 4419
off_t
4420
ftello(FILE *stream)
4420
rb_w32_ftello(FILE *stream)
4421 4421
{
4422 4422
    off_t pos;
4423 4423
    if (fgetpos(stream, (fpos_t *)&pos)) return (off_t)-1;