Use _FILE_OFFSET_BITS=64 instead of _LARGEFILE64_SOURCE everywhere

Allows using more portable function/type names while still using 64-bit
values on 32-bit glibc systems.

Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/193
Signed-off-by: Sertonix <sertonix@posteo.net>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Sertonix
2025-10-28 09:28:33 +01:00
committed by Jan Höppner
parent b1e4f6f331
commit 805a4d4408
4 changed files with 6 additions and 8 deletions

View File

@@ -7,7 +7,6 @@
* it under the terms of the MIT license. See LICENSE for details.
*/
#define _LARGEFILE64_SOURCE /* needed for unistd.h */
#define _FILE_OFFSET_BITS 64 /* needed for unistd.h */
#include <ctype.h>
@@ -1887,7 +1886,7 @@ static void dasdview_view_standard(dasdview_info_t *info)
/* seek in SEEK_STEP steps */
for (i = 1; i <= j; i++) {
rc = lseek64(fd, SEEK_STEP, SEEK_CUR);
rc = lseek(fd, SEEK_STEP, SEEK_CUR);
if (rc == -1) {
printf("*** rc: %d (%d) ***\n", rc, errno);
printf("*** j: %llu ***\n", j);

View File

@@ -128,7 +128,7 @@ static int envblk_update(struct zipl_envblk *zeb)
if (fs_map(zeb->mfd.fd, zeb->offset, &blknr, zeb->size) != 0)
goto error_close;
if (lseek64(dev_fd, blknr * (uint64_t)zeb->size, SEEK_SET) < 0) {
if (lseek(dev_fd, blknr * (off_t)zeb->size, SEEK_SET) < 0) {
error_reason(strerror(errno));
goto error_close;
}

View File

@@ -37,7 +37,8 @@ endif
libs = $(rootdir)/libutil/libutil.a
ALL_CFLAGS += -DKMS_PLUGIN_LOCATION=\"$(ZKEYKMSPLUGINDIR)\"
ALL_CFLAGS += -DKMS_PLUGIN_LOCATION=\"$(ZKEYKMSPLUGINDIR)\" \
-D_FILE_OFFSET_BITS=64
detect-libcryptsetup.dep:
echo "#include <libcryptsetup.h>" > detect-libcryptsetup.dep

View File

@@ -8,8 +8,6 @@
* it under the terms of the MIT license. See LICENSE for details.
*/
#define _LARGEFILE64_SOURCE
#include <ctype.h>
#include <dlfcn.h>
#include <err.h>
@@ -547,10 +545,10 @@ static int keyfile_seek(int fd, size_t bytes)
{
size_t next_read;
ssize_t bytes_r;
off64_t r;
off_t r;
char *tmp;
r = lseek64(fd, bytes, SEEK_CUR);
r = lseek(fd, bytes, SEEK_CUR);
if (r > 0)
return 0;
if (r < 0 && errno != ESPIPE)