From 25e6fee27f4a293728dd15b659170e7b9c7db9bc Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 27 Sep 2022 15:04:05 -0400 Subject: [PATCH] remove LFS64 programming interfaces (macro-only) from _GNU_SOURCE these badly pollute the namespace with macros whenever _GNU_SOURCE is defined, which is always the case with g++, and especially tends to interfere with C++ constructs. as our implementation of these was macro-only, their removal cannot affect any existing binaries. at the source level, portable software should be prepared for them not to exist. for now, they are left in place with explicit _LARGEFILE64_SOURCE. this provides an easy temporary path for integrators/distributions to get packages building again right away if they break while working on a proper, upstreamable fix. the intent is that this be a very short-term measure and that the macros be removed entirely in the next release cycle. --- include/aio.h | 2 +- include/dirent.h | 2 +- include/fcntl.h | 2 +- include/ftw.h | 2 +- include/glob.h | 2 +- include/stdio.h | 2 +- include/stdlib.h | 2 +- include/sys/mman.h | 2 +- include/sys/resource.h | 2 +- include/sys/sendfile.h | 2 +- include/sys/stat.h | 2 +- include/sys/statfs.h | 2 +- include/sys/statvfs.h | 2 +- include/sys/types.h | 2 +- include/sys/uio.h | 2 +- include/unistd.h | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/aio.h b/include/aio.h index 453c41b7..a938fcad 100644 --- a/include/aio.h +++ b/include/aio.h @@ -49,7 +49,7 @@ int aio_fsync(int, struct aiocb *); int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict); -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define aiocb64 aiocb #define aio_read64 aio_read #define aio_write64 aio_write diff --git a/include/dirent.h b/include/dirent.h index 650ecf64..2d8fffb2 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -56,7 +56,7 @@ int getdents(int, struct dirent *, size_t); int versionsort(const struct dirent **, const struct dirent **); #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define dirent64 dirent #define readdir64 readdir #define readdir64_r readdir_r diff --git a/include/fcntl.h b/include/fcntl.h index b664cdc4..515f255d 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -195,7 +195,7 @@ ssize_t tee(int, int, size_t, unsigned); #define loff_t off_t #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define F_GETLK64 F_GETLK #define F_SETLK64 F_SETLK #define F_SETLKW64 F_SETLKW diff --git a/include/ftw.h b/include/ftw.h index b15c062a..d0445e8a 100644 --- a/include/ftw.h +++ b/include/ftw.h @@ -29,7 +29,7 @@ struct FTW { int ftw(const char *, int (*)(const char *, const struct stat *, int), int); int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int); -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define ftw64 ftw #define nftw64 nftw #endif diff --git a/include/glob.h b/include/glob.h index 4a562a20..fed06745 100644 --- a/include/glob.h +++ b/include/glob.h @@ -39,7 +39,7 @@ void globfree(glob_t *); #define GLOB_NOMATCH 3 #define GLOB_NOSYS 4 -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define glob64 glob #define globfree64 globfree #define glob64_t glob_t diff --git a/include/stdio.h b/include/stdio.h index d1ed01f0..cb858618 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -205,7 +205,7 @@ typedef struct _IO_cookie_io_functions_t { FILE *fopencookie(void *, const char *, cookie_io_functions_t); #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define tmpfile64 tmpfile #define fopen64 fopen #define freopen64 freopen diff --git a/include/stdlib.h b/include/stdlib.h index b507ca33..b117a452 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *); #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define mkstemp64 mkstemp #define mkostemp64 mkostemp #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) diff --git a/include/sys/mman.h b/include/sys/mman.h index 80a3baae..3d5d0f9c 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -141,7 +141,7 @@ int mincore (void *, size_t, unsigned char *); int shm_open (const char *, int, mode_t); int shm_unlink (const char *); -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define mmap64 mmap #define off64_t off_t #endif diff --git a/include/sys/resource.h b/include/sys/resource.h index 3068328d..e8bfbe1f 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -95,7 +95,7 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *); #define RLIM_NLIMITS RLIMIT_NLIMITS -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define RLIM64_INFINITY RLIM_INFINITY #define RLIM64_SAVED_CUR RLIM_SAVED_CUR #define RLIM64_SAVED_MAX RLIM_SAVED_MAX diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h index e7570d8e..253a041b 100644 --- a/include/sys/sendfile.h +++ b/include/sys/sendfile.h @@ -10,7 +10,7 @@ extern "C" { ssize_t sendfile(int, int, off_t *, size_t); -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define sendfile64 sendfile #define off64_t off_t #endif diff --git a/include/sys/stat.h b/include/sys/stat.h index 10d446c4..e6d0049c 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -98,7 +98,7 @@ int lchmod(const char *, mode_t); #define S_IEXEC S_IXUSR #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define stat64 stat #define fstat64 fstat #define lstat64 lstat diff --git a/include/sys/statfs.h b/include/sys/statfs.h index 6f4c6230..7a2e11cd 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -18,7 +18,7 @@ typedef struct __fsid_t { int statfs (const char *, struct statfs *); int fstatfs (int, struct statfs *); -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define statfs64 statfs #define fstatfs64 fstatfs #define fsblkcnt64_t fsblkcnt_t diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h index 793490b6..57a6b806 100644 --- a/include/sys/statvfs.h +++ b/include/sys/statvfs.h @@ -42,7 +42,7 @@ int fstatvfs (int, struct statvfs *); #define ST_NODIRATIME 2048 #define ST_RELATIME 4096 -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define statvfs64 statvfs #define fstatvfs64 fstatvfs #define fsblkcnt64_t fsblkcnt_t diff --git a/include/sys/types.h b/include/sys/types.h index 0c35541d..3363374f 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -71,7 +71,7 @@ typedef unsigned long long u_quad_t; #include #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define blkcnt64_t blkcnt_t #define fsblkcnt64_t fsblkcnt_t #define fsfilcnt64_t fsfilcnt_t diff --git a/include/sys/uio.h b/include/sys/uio.h index 00f73a2f..90e5939e 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -29,7 +29,7 @@ ssize_t writev (int, const struct iovec *, int); #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ssize_t preadv (int, const struct iovec *, int, off_t); ssize_t pwritev (int, const struct iovec *, int, off_t); -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define preadv64 preadv #define pwritev64 pwritev #define off64_t off_t diff --git a/include/unistd.h b/include/unistd.h index 0e8149e4..5bc7f798 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -198,7 +198,7 @@ ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned); pid_t gettid(void); #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#if defined(_LARGEFILE64_SOURCE) #define lseek64 lseek #define pread64 pread #define pwrite64 pwrite