diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-02-21 12:49:42 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-02-21 14:30:47 -0500 |
commit | 799d22461a932aace890d61a82186e0d64de0ee8 (patch) | |
tree | 76c7b261ed71f78c40b944f4b1ea7e480532b670 /src | |
parent | 3f9c1697dca0b4964f1f5ba624d361d4e0e53051 (diff) | |
download | postgresql-799d22461a932aace890d61a82186e0d64de0ee8.tar.gz postgresql-799d22461a932aace890d61a82186e0d64de0ee8.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 9 | ||||
-rw-r--r-- | src/include/port.h | 13 | ||||
-rw-r--r-- | src/include/port/win32_port.h | 1 | ||||
-rw-r--r-- | src/port/fseeko.c | 84 | ||||
-rw-r--r-- | src/tools/msvc/Mkvcbuild.pm | 2 |
5 files changed, 4 insertions, 105 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 77bf9edaba4..15900ffc249 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -3872,15 +3872,6 @@ checkSeek(FILE *fp) { 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) diff --git a/src/include/port.h b/src/include/port.h index 2767cf0fc32..3f5f90fa007 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -331,13 +331,9 @@ extern int gettimeofday(struct timeval *tp, struct timezone *tzp); * 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]); @@ -349,11 +345,6 @@ extern void pg_srand48(long seed); 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 diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h index ec0e3d5a371..91ec01468e8 100644 --- a/src/include/port/win32_port.h +++ b/src/include/port/win32_port.h @@ -193,6 +193,7 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *oval * 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) diff --git a/src/port/fseeko.c b/src/port/fseeko.c deleted file mode 100644 index 02c1bcd2514..00000000000 --- a/src/port/fseeko.c +++ /dev/null @@ -1,84 +0,0 @@ -/*------------------------------------------------------------------------- - * - * 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 diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index a43e31c60eb..6a1435f4566 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -94,7 +94,7 @@ sub mkvcbuild $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 |