Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 799d224

Browse files
committed
Assume that we have functional, 64-bit fseeko()/ftello().
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
1 parent 3f9c169 commit 799d224

File tree

7 files changed

+11
-141
lines changed

7 files changed

+11
-141
lines changed

configure

+4-26
Original file line numberDiff line numberDiff line change
@@ -15169,30 +15169,9 @@ _ACEOF
1516915169

1517015170
fi
1517115171

15172-
ac_fn_c_check_func "$LINENO" "fseeko" "ac_cv_func_fseeko"
15173-
if test "x$ac_cv_func_fseeko" = xyes; then :
15174-
$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
15175-
15176-
else
15177-
case " $LIBOBJS " in
15178-
*" fseeko.$ac_objext "* ) ;;
15179-
*) LIBOBJS="$LIBOBJS fseeko.$ac_objext"
15180-
;;
15181-
esac
15182-
15183-
fi
15184-
15185-
15186-
case $host_os in
15187-
# NetBSD uses a custom fseeko/ftello built on fsetpos/fgetpos
15188-
# Mingw uses macros to access Win32 API calls
15189-
netbsd*|mingw*)
15190-
15191-
$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
15192-
15193-
ac_cv_func_fseeko=yes;;
15194-
*)
15195-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
15172+
# We require 64-bit fseeko() to be available, but run this check anyway
15173+
# in case it finds that _LARGEFILE_SOURCE has to be #define'd for that.
15174+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
1519615175
$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
1519715176
if ${ac_cv_sys_largefile_source+:} false; then :
1519815177
$as_echo_n "(cached) " >&6
@@ -15259,8 +15238,7 @@ if test $ac_cv_sys_largefile_source != unknown; then
1525915238
$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
1526015239

1526115240
fi
15262-
;;
15263-
esac
15241+
1526415242

1526515243
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
1526615244
# by calling it, 2009-04-02

configure.in

+3-10
Original file line numberDiff line numberDiff line change
@@ -1660,16 +1660,9 @@ PGAC_CHECK_BUILTIN_FUNC([__builtin_clz], [unsigned int x])
16601660
PGAC_CHECK_BUILTIN_FUNC([__builtin_ctz], [unsigned int x])
16611661
PGAC_CHECK_BUILTIN_FUNC([__builtin_popcount], [unsigned int x])
16621662

1663-
AC_REPLACE_FUNCS(fseeko)
1664-
case $host_os in
1665-
# NetBSD uses a custom fseeko/ftello built on fsetpos/fgetpos
1666-
# Mingw uses macros to access Win32 API calls
1667-
netbsd*|mingw*)
1668-
AC_DEFINE(HAVE_FSEEKO, 1, [Define to 1 because replacement version used.])
1669-
ac_cv_func_fseeko=yes;;
1670-
*)
1671-
AC_FUNC_FSEEKO;;
1672-
esac
1663+
# We require 64-bit fseeko() to be available, but run this check anyway
1664+
# in case it finds that _LARGEFILE_SOURCE has to be #define'd for that.
1665+
AC_FUNC_FSEEKO
16731666

16741667
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
16751668
# by calling it, 2009-04-02

src/bin/pg_dump/pg_backup_archiver.c

-9
Original file line numberDiff line numberDiff line change
@@ -3872,15 +3872,6 @@ checkSeek(FILE *fp)
38723872
{
38733873
pgoff_t tpos;
38743874

3875-
/*
3876-
* If pgoff_t is wider than long, we must have "real" fseeko and not an
3877-
* emulation using fseek. Otherwise report no seek capability.
3878-
*/
3879-
#ifndef HAVE_FSEEKO
3880-
if (sizeof(pgoff_t) > sizeof(long))
3881-
return false;
3882-
#endif
3883-
38843875
/* Check that ftello works on this file */
38853876
tpos = ftello(fp);
38863877
if (tpos < 0)

src/include/port.h

+2-11
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,9 @@ extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
331331
* When necessary, these routines are provided by files in src/port/.
332332
*/
333333

334-
/* WIN32 handled in port/win32_port.h */
335-
#ifndef WIN32
334+
/* Type to use with fseeko/ftello */
335+
#ifndef WIN32 /* WIN32 is handled in port/win32_port.h */
336336
#define pgoff_t off_t
337-
#ifdef __NetBSD__
338-
extern int fseeko(FILE *stream, off_t offset, int whence);
339-
extern off_t ftello(FILE *stream);
340-
#endif
341337
#endif
342338

343339
extern double pg_erand48(unsigned short xseed[3]);
@@ -349,11 +345,6 @@ extern void pg_srand48(long seed);
349345
extern int fls(int mask);
350346
#endif
351347

352-
#ifndef HAVE_FSEEKO
353-
#define fseeko(a, b, c) fseek(a, b, c)
354-
#define ftello(a) ftell(a)
355-
#endif
356-
357348
#ifndef HAVE_GETPEEREID
358349
/* On Windows, Perl might have incompatible definitions of uid_t and gid_t. */
359350
#ifndef PLPERL_HAVE_UID_GID

src/include/port/win32_port.h

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *oval
193193
* with 64-bit offsets.
194194
*/
195195
#define pgoff_t __int64
196+
196197
#ifdef _MSC_VER
197198
#define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin)
198199
#define ftello(stream) _ftelli64(stream)

src/port/fseeko.c

-84
This file was deleted.

src/tools/msvc/Mkvcbuild.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ sub mkvcbuild
9494
$solution = CreateSolution($vsVersion, $config);
9595

9696
our @pgportfiles = qw(
97-
chklocale.c explicit_bzero.c fls.c fseeko.c getpeereid.c getrusage.c inet_aton.c random.c
97+
chklocale.c explicit_bzero.c fls.c getpeereid.c getrusage.c inet_aton.c random.c
9898
srandom.c getaddrinfo.c gettimeofday.c inet_net_ntop.c kill.c open.c
9999
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
100100
dirent.c dlopen.c getopt.c getopt_long.c

0 commit comments

Comments
 (0)