Windows has this, and so do all other live platforms according to the
buildfarm, so remove the configure probe and src/port/ substitution.
Keep the probe that detects whether _LARGEFILE_SOURCE has to be
defined to get that, though ... that seems to be still relevant in
some places.
This is part of a series of commits to get rid of no-longer-relevant
configure checks and dead src/port/ code. I'm committing them separately
to make it easier to back out individual changes if they prove less
portable than I expect.
Discussion: https://postgr.es/m/15379.
1582221614@sss.pgh.pa.us
fi
-ac_fn_c_check_func "$LINENO" "fseeko" "ac_cv_func_fseeko"
-if test "x$ac_cv_func_fseeko" = xyes; then :
- $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
-
-else
- case " $LIBOBJS " in
- *" fseeko.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS fseeko.$ac_objext"
- ;;
-esac
-
-fi
-
-
-case $host_os in
- # NetBSD uses a custom fseeko/ftello built on fsetpos/fgetpos
- # Mingw uses macros to access Win32 API calls
- netbsd*|mingw*)
-
-$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
-
- ac_cv_func_fseeko=yes;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+# We require 64-bit fseeko() to be available, but run this check anyway
+# in case it finds that _LARGEFILE_SOURCE has to be #define'd for that.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
if ${ac_cv_sys_largefile_source+:} false; then :
$as_echo_n "(cached) " >&6
$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
fi
-;;
-esac
+
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
# by calling it, 2009-04-02
PGAC_CHECK_BUILTIN_FUNC([__builtin_ctz], [unsigned int x])
PGAC_CHECK_BUILTIN_FUNC([__builtin_popcount], [unsigned int x])
-AC_REPLACE_FUNCS(fseeko)
-case $host_os in
- # NetBSD uses a custom fseeko/ftello built on fsetpos/fgetpos
- # Mingw uses macros to access Win32 API calls
- netbsd*|mingw*)
- AC_DEFINE(HAVE_FSEEKO, 1, [Define to 1 because replacement version used.])
- ac_cv_func_fseeko=yes;;
- *)
- AC_FUNC_FSEEKO;;
-esac
+# We require 64-bit fseeko() to be available, but run this check anyway
+# in case it finds that _LARGEFILE_SOURCE has to be #define'd for that.
+AC_FUNC_FSEEKO
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
# by calling it, 2009-04-02
{
pgoff_t tpos;
- /*
- * If pgoff_t is wider than long, we must have "real" fseeko and not an
- * emulation using fseek. Otherwise report no seek capability.
- */
-#ifndef HAVE_FSEEKO
- if (sizeof(pgoff_t) > sizeof(long))
- return false;
-#endif
-
/* Check that ftello works on this file */
tpos = ftello(fp);
if (tpos < 0)
* When necessary, these routines are provided by files in src/port/.
*/
-/* WIN32 handled in port/win32_port.h */
-#ifndef WIN32
+/* Type to use with fseeko/ftello */
+#ifndef WIN32 /* WIN32 is handled in port/win32_port.h */
#define pgoff_t off_t
-#ifdef __NetBSD__
-extern int fseeko(FILE *stream, off_t offset, int whence);
-extern off_t ftello(FILE *stream);
-#endif
#endif
extern double pg_erand48(unsigned short xseed[3]);
extern int fls(int mask);
#endif
-#ifndef HAVE_FSEEKO
-#define fseeko(a, b, c) fseek(a, b, c)
-#define ftello(a) ftell(a)
-#endif
-
#ifndef HAVE_GETPEEREID
/* On Windows, Perl might have incompatible definitions of uid_t and gid_t. */
#ifndef PLPERL_HAVE_UID_GID
* with 64-bit offsets.
*/
#define pgoff_t __int64
+
#ifdef _MSC_VER
#define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin)
#define ftello(stream) _ftelli64(stream)
+++ /dev/null
-/*-------------------------------------------------------------------------
- *
- * fseeko.c
- * 64-bit versions of fseeko/ftello()
- *
- * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- * src/port/fseeko.c
- *
- *-------------------------------------------------------------------------
- */
-
-/*
- * We have to use the native defines here because configure hasn't
- * completed yet.
- */
-#ifdef __NetBSD__
-
-#include "c.h"
-
-#include <sys/stat.h>
-
-
-/*
- * On NetBSD, off_t and fpos_t are the same. Standards
- * say off_t is an arithmetic type, but not necessarily integral,
- * while fpos_t might be neither.
- */
-
-int
-fseeko(FILE *stream, off_t offset, int whence)
-{
- off_t floc;
- struct stat filestat;
-
- switch (whence)
- {
- case SEEK_CUR:
- if (fgetpos(stream, &floc) != 0)
- goto failure;
- floc += offset;
- if (fsetpos(stream, &floc) != 0)
- goto failure;
- return 0;
- break;
- case SEEK_SET:
- if (fsetpos(stream, &offset) != 0)
- return -1;
- return 0;
- break;
- case SEEK_END:
- fflush(stream); /* force writes to fd for stat() */
- if (fstat(fileno(stream), &filestat) != 0)
- goto failure;
- floc = filestat.st_size;
- floc += offset;
- if (fsetpos(stream, &floc) != 0)
- goto failure;
- return 0;
- break;
- default:
- errno = EINVAL;
- return -1;
- }
-
-failure:
- return -1;
-}
-
-
-off_t
-ftello(FILE *stream)
-{
- off_t floc;
-
- if (fgetpos(stream, &floc) != 0)
- return -1;
- return floc;
-}
-
-#endif
$solution = CreateSolution($vsVersion, $config);
our @pgportfiles = qw(
- chklocale.c explicit_bzero.c fls.c fseeko.c getpeereid.c getrusage.c inet_aton.c random.c
+ chklocale.c explicit_bzero.c fls.c getpeereid.c getrusage.c inet_aton.c random.c
srandom.c getaddrinfo.c gettimeofday.c inet_net_ntop.c kill.c open.c
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
dirent.c dlopen.c getopt.c getopt_long.c