1 /*-------------------------------------------------------------------------
4 * 64-bit versions of fseeko/ftello()
6 * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
13 *-------------------------------------------------------------------------
17 * We have to use the native defines here because configure hasn't
28 * On NetBSD, off_t and fpos_t are the same. Standards
29 * say off_t is an arithmetic type, but not necessarily integral,
30 * while fpos_t might be neither.
34 fseeko(FILE *stream, off_t offset, int whence)
42 if (fgetpos(stream, &floc) != 0)
45 if (fsetpos(stream, &floc) != 0)
50 if (fsetpos(stream, &offset) != 0)
55 fflush(stream); /* force writes to fd for stat() */
56 if (fstat(fileno(stream), &filestat) != 0)
58 floc = filestat.st_size;
60 if (fsetpos(stream, &floc) != 0)
79 if (fgetpos(stream, &floc) != 0)