Re: Cannot find a working 64-bit integer type on Illumos
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tomas Vondra <tomas@vondra.me>, Peter Eisentraut <peter@eisentraut.org>,
Heikki Linnakangas <hlinnaka@iki.fi>, Japin Li <japinli@hotmail.com>,
Andres Freund <andres@anarazel.de>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-12-04T19:41:19Z
Lists: pgsql-hackers
Also ... grison and turaco are emitting warnings that were
not there a couple of days ago:
grison | 2024-12-04 17:10:09 | reconstruct.c:701:33: warning: passing argument 2 of 'copy_file_range' from incompatible pointer type [-Wincompatible-pointer-types]
turaco | 2024-12-04 16:15:11 | reconstruct.c:701:61: warning: passing argument 2 of 'copy_file_range' from incompatible pointer type [-Wincompatible-pointer-types]
The code they are complaining about is from ac8110155 ("Allow using
copy_file_range in write_reconstructed_file") back in April:
off_t off = offsetmap[i];
...
wb = copy_file_range(s->fd, &off, wfd, NULL, BLCKSZ - nwritten, 0);
Now, on my Linux box "man copy_file_range" saith
ssize_t copy_file_range(int fd_in, loff_t *off_in,
int fd_out, loff_t *off_out,
size_t len, unsigned int flags);
So apparently, "off_t" was the same as "loff_t" before 962da900a,
but it no longer is the same on 32-bit machines. (In any case,
if all machines that have copy_file_range define it like this,
perhaps we ought to be declaring this variable as loff_t not off_t?)
Digging a bit deeper, the full warning report is
reconstruct.c: In function "write_reconstructed_file":
reconstruct.c:701:33: warning: passing argument 2 of "copy_file_range" from incompatible pointer type [-Wincompatible-pointer-types]
wb = copy_file_range(s->fd, &off, wfd, NULL, BLCKSZ - nwritten, 0);
^~~~
In file included from reconstruct.c:15:
/usr/include/unistd.h:1107:49: note: expected "__off64_t *" {aka "long long int *"} but argument is of type "off_t *" {aka "long int *"}
ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
~~~~~~~~~~~^~~~~~~~
Since these are 32-bit machines, "long int" is 32 bits (confirmed from
their configure results), which means "off_t" is only 32 bits, which
really sounds quite broken. I thought it was 64 bits pretty much
everywhere nowadays. Did 962da900a cause that? Maybe that explains
the Perl library compatibility problems these machines are reporting?
regards, tom lane
Commits
-
Move pg_int64 back to postgres_ext.h
- e56a601e0678 19 (unreleased) landed
- 409543da5411 18.0 landed
-
pgbench: Make set_random_seed() 64-bit everywhere.
- 53a2a1564ae4 18.0 landed
-
Use PRI?64 instead of "ll?" in format strings (continued).
- a0ed19e0a9ef 18.0 landed
-
Fix order of -I switches for building pg_regress.o.
- f186f90e55b7 17.5 landed
- cb36f8ec2124 18.0 landed
-
libpq: Deprecate pg_int64.
- 3c86223c9982 18.0 landed
-
Use PRI*64 instead of "ll*" in format strings (minimal trial)
- 15a79c73111f 18.0 landed
-
Fix header inclusion order in c.h.
- 71cb352904c1 18.0 landed
-
Use <stdint.h> and <inttypes.h> for c.h integers.
- 962da900ac8f 18.0 landed
-
Remove traces of BeOS.
- a2d9a9b95ad9 18.0 landed
-
More correct way to check for existence of types, which allows to specify
- 15abc7788e66 7.2.1 cited