mirror of
git://git.musl-libc.org/musl
synced 2024-11-23 10:03:56 +08:00
add support for ugly *64 functions with _LARGEFILE64_SOURCE
musl does not support legacy 32-bit-off_t whatsoever. off_t is always 64 bit, and correct programs that use off_t and the standard functions will just work out of the box. (on glibc, they would require -D_FILE_OFFSET_BITS=64 to work.) however, some programs instead define _LARGEFILE64_SOURCE and use alternate versions of all the standard types and functions with "64" appended to their names. we do not want code to actually get linked against these functions (it's ugly and inconsistent), so macros are used instead of prototypes with weak aliases in the library itself. eventually the weak aliases may be added at the library level for the sake of using code that was originally built against glibc, but the macros will still be the desired solution in the headers.
This commit is contained in:
parent
b4560a6da9
commit
2dd8d5e1b8
@ -48,6 +48,19 @@ int aio_fsync(int, struct aiocb *);
|
||||
|
||||
int lio_listio(int, struct aiocb *const [], int, struct sigevent *);
|
||||
|
||||
#ifdef _LARGEFILE64_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
|
||||
#defile lio_listio64 lio_listio
|
||||
#define off64_t off_t
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -50,6 +50,16 @@ int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int
|
||||
#define DTTOIF(x) ((x)<<12)
|
||||
#endif
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
#define dirent64 dirent
|
||||
#define readdir64 readdir
|
||||
#define readdir64_r readdir_r
|
||||
#define scandir64 scandir
|
||||
#define alphasort64 alphasort
|
||||
#define off64_t off_t
|
||||
#define ino64_t ino_t
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -88,6 +88,16 @@ int posix_fallocate(int, off_t, off_t);
|
||||
#define FNDELAY O_NDELAY
|
||||
#endif
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
#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
|
||||
|
@ -32,6 +32,11 @@ 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);
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
#define ftw64 ftw
|
||||
#define nftw64 nftw
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -34,6 +34,11 @@ void globfree(glob_t *);
|
||||
#define GLOB_NOMATCH 3
|
||||
#define GLOB_NOSYS 4
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
#define glob64 glob
|
||||
#define globfree64 globfree
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -167,6 +167,18 @@ char *fgets_unlocked(char *, int, FILE *);
|
||||
int fputs_unlocked(const char *, FILE *);
|
||||
#endif
|
||||
|
||||
#ifdef _LARGEFILE64_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
|
||||
|
@ -139,6 +139,9 @@ char *fcvt(double, int, int *, int *);
|
||||
char *gcvt(double, int, char *);
|
||||
#endif
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
#define mkstemp64 mkstemp
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -168,6 +168,16 @@ void endusershell(void);
|
||||
char *getusershell(void);
|
||||
#endif
|
||||
|
||||
#ifdef _LARGEFILE64_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 _XOPEN_VERSION 700
|
||||
#define _XOPEN_UNIX 1
|
||||
#define _XOPEN_ENH_I18N 1
|
||||
|
Loading…
Reference in New Issue
Block a user