>From aac73f06584ea256eec7724d95622f09f30385bd 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 public headers 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. --- include/aio.h | 13 ------------- include/dirent.h | 12 ------------ include/fcntl.h | 14 -------------- include/ftw.h | 5 ----- include/glob.h | 6 ------ include/stdio.h | 12 ------------ include/stdlib.h | 9 --------- include/sys/mman.h | 5 ----- include/sys/resource.h | 10 ---------- include/sys/sendfile.h | 5 ----- include/sys/stat.h | 12 ------------ include/sys/statfs.h | 7 ------- include/sys/statvfs.h | 7 ------- include/sys/types.h | 8 -------- include/sys/uio.h | 5 ----- include/unistd.h | 10 ---------- 16 files changed, 140 deletions(-) diff --git a/include/aio.h b/include/aio.h index 453c41b7..c5198938 100644 --- a/include/aio.h +++ b/include/aio.h @@ -49,19 +49,6 @@ 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) -#define aiocb64 aiocb -#define aio_read64 aio_read -#define aio_write64 aio_write -#define aio_error64 aio_error -#define aio_return64 aio_return -#define aio_cancel64 aio_cancel -#define aio_suspend64 aio_suspend -#define aio_fsync64 aio_fsync -#define lio_listio64 lio_listio -#define off64_t off_t -#endif - #if _REDIR_TIME64 __REDIR(aio_suspend, __aio_suspend_time64); #endif diff --git a/include/dirent.h b/include/dirent.h index 650ecf64..7ec7cf69 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -56,18 +56,6 @@ int getdents(int, struct dirent *, size_t); int versionsort(const struct dirent **, const struct dirent **); #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define dirent64 dirent -#define readdir64 readdir -#define readdir64_r readdir_r -#define scandir64 scandir -#define alphasort64 alphasort -#define versionsort64 versionsort -#define off64_t off_t -#define ino64_t ino_t -#define getdents64 getdents -#endif - #ifdef __cplusplus } #endif diff --git a/include/fcntl.h b/include/fcntl.h index b664cdc4..3494fde4 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -195,20 +195,6 @@ ssize_t tee(int, int, size_t, unsigned); #define loff_t off_t #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define F_GETLK64 F_GETLK -#define F_SETLK64 F_SETLK -#define F_SETLKW64 F_SETLKW -#define flock64 flock -#define open64 open -#define openat64 openat -#define creat64 creat -#define lockf64 lockf -#define posix_fadvise64 posix_fadvise -#define posix_fallocate64 posix_fallocate -#define off64_t off_t -#endif - #ifdef __cplusplus } #endif diff --git a/include/ftw.h b/include/ftw.h index b15c062a..dfb7db93 100644 --- a/include/ftw.h +++ b/include/ftw.h @@ -29,11 +29,6 @@ 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) -#define ftw64 ftw -#define nftw64 nftw -#endif - #ifdef __cplusplus } #endif diff --git a/include/glob.h b/include/glob.h index 4a562a20..718bef44 100644 --- a/include/glob.h +++ b/include/glob.h @@ -39,12 +39,6 @@ void globfree(glob_t *); #define GLOB_NOMATCH 3 #define GLOB_NOSYS 4 -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define glob64 glob -#define globfree64 globfree -#define glob64_t glob_t -#endif - #ifdef __cplusplus } #endif diff --git a/include/stdio.h b/include/stdio.h index d1ed01f0..67acad1e 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -205,18 +205,6 @@ typedef struct _IO_cookie_io_functions_t { FILE *fopencookie(void *, const char *, cookie_io_functions_t); #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define tmpfile64 tmpfile -#define fopen64 fopen -#define freopen64 freopen -#define fseeko64 fseeko -#define ftello64 ftello -#define fgetpos64 fgetpos -#define fsetpos64 fsetpos -#define fpos64_t fpos_t -#define off64_t off_t -#endif - #ifdef __cplusplus } #endif diff --git a/include/stdlib.h b/include/stdlib.h index b507ca33..6f6b708c 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -163,15 +163,6 @@ 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) -#define mkstemp64 mkstemp -#define mkostemp64 mkostemp -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#define mkstemps64 mkstemps -#define mkostemps64 mkostemps -#endif -#endif - #ifdef __cplusplus } #endif diff --git a/include/sys/mman.h b/include/sys/mman.h index 80a3baae..facab648 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -141,11 +141,6 @@ 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) -#define mmap64 mmap -#define off64_t off_t -#endif - #ifdef __cplusplus } #endif diff --git a/include/sys/resource.h b/include/sys/resource.h index 3068328d..d4c2f688 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -95,16 +95,6 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *); #define RLIM_NLIMITS RLIMIT_NLIMITS -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define RLIM64_INFINITY RLIM_INFINITY -#define RLIM64_SAVED_CUR RLIM_SAVED_CUR -#define RLIM64_SAVED_MAX RLIM_SAVED_MAX -#define getrlimit64 getrlimit -#define setrlimit64 setrlimit -#define rlimit64 rlimit -#define rlim64_t rlim_t -#endif - #if _REDIR_TIME64 __REDIR(getrusage, __getrusage_time64); #endif diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h index e7570d8e..7273aed1 100644 --- a/include/sys/sendfile.h +++ b/include/sys/sendfile.h @@ -10,11 +10,6 @@ extern "C" { ssize_t sendfile(int, int, off_t *, size_t); -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define sendfile64 sendfile -#define off64_t off_t -#endif - #ifdef __cplusplus } #endif diff --git a/include/sys/stat.h b/include/sys/stat.h index 10d446c4..cdd2a455 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -98,18 +98,6 @@ int lchmod(const char *, mode_t); #define S_IEXEC S_IXUSR #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define stat64 stat -#define fstat64 fstat -#define lstat64 lstat -#define fstatat64 fstatat -#define blkcnt64_t blkcnt_t -#define fsblkcnt64_t fsblkcnt_t -#define fsfilcnt64_t fsfilcnt_t -#define ino64_t ino_t -#define off64_t off_t -#endif - #if _REDIR_TIME64 __REDIR(stat, __stat_time64); __REDIR(fstat, __fstat_time64); diff --git a/include/sys/statfs.h b/include/sys/statfs.h index 6f4c6230..bcdb0d17 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -18,13 +18,6 @@ typedef struct __fsid_t { int statfs (const char *, struct statfs *); int fstatfs (int, struct statfs *); -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define statfs64 statfs -#define fstatfs64 fstatfs -#define fsblkcnt64_t fsblkcnt_t -#define fsfilcnt64_t fsfilcnt_t -#endif - #ifdef __cplusplus } #endif diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h index 793490b6..12f5f695 100644 --- a/include/sys/statvfs.h +++ b/include/sys/statvfs.h @@ -42,13 +42,6 @@ int fstatvfs (int, struct statvfs *); #define ST_NODIRATIME 2048 #define ST_RELATIME 4096 -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define statvfs64 statvfs -#define fstatvfs64 fstatvfs -#define fsblkcnt64_t fsblkcnt_t -#define fsfilcnt64_t fsfilcnt_t -#endif - #ifdef __cplusplus } #endif diff --git a/include/sys/types.h b/include/sys/types.h index 0c35541d..71a27bb3 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -71,14 +71,6 @@ typedef unsigned long long u_quad_t; #include #endif -#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) -#define blkcnt64_t blkcnt_t -#define fsblkcnt64_t fsblkcnt_t -#define fsfilcnt64_t fsfilcnt_t -#define ino64_t ino_t -#define off64_t off_t -#endif - #ifdef __cplusplus } #endif diff --git a/include/sys/uio.h b/include/sys/uio.h index 00f73a2f..fb228c6b 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -29,11 +29,6 @@ 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) -#define preadv64 preadv -#define pwritev64 pwritev -#define off64_t off_t -#endif #endif #ifdef _GNU_SOURCE diff --git a/include/unistd.h b/include/unistd.h index 0e8149e4..20f5eb35 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -198,16 +198,6 @@ 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) -#define lseek64 lseek -#define pread64 pread -#define pwrite64 pwrite -#define truncate64 truncate -#define ftruncate64 ftruncate -#define lockf64 lockf -#define off64_t off_t -#endif - #define POSIX_CLOSE_RESTART 0 #define _XOPEN_VERSION 700 -- 2.21.0