Skip to content

Commit

Permalink
remove LFS64 programming interfaces (macro-only) from _GNU_SOURCE
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
richfelker committed Oct 19, 2022
1 parent 246f1c8 commit 25e6fee
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion include/aio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/ftw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/glob.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion include/sys/mman.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/sendfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/statfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/statvfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ typedef unsigned long long u_quad_t;
#include <sys/select.h>
#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
Expand Down
2 changes: 1 addition & 1 deletion include/sys/uio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 25e6fee

Please sign in to comment.