diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-05-04 00:13:23 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-05-04 00:13:23 -0400 |
commit | 2dd8d5e1b8ba1118ff1782e96545cb8a2318592c (patch) | |
tree | 529419d70eedc4edbaae416c262806839ac3b630 | |
parent | b4560a6da918ce3b63e87a78a3a3956f514e24ce (diff) | |
download | musl-2dd8d5e1b8ba1118ff1782e96545cb8a2318592c.tar.gz musl-2dd8d5e1b8ba1118ff1782e96545cb8a2318592c.tar.xz musl-2dd8d5e1b8ba1118ff1782e96545cb8a2318592c.zip |
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.
-rw-r--r-- | include/aio.h | 13 | ||||
-rw-r--r-- | include/dirent.h | 10 | ||||
-rw-r--r-- | include/fcntl.h | 10 | ||||
-rw-r--r-- | include/ftw.h | 5 | ||||
-rw-r--r-- | include/glob.h | 5 | ||||
-rw-r--r-- | include/stdio.h | 12 | ||||
-rw-r--r-- | include/stdlib.h | 3 | ||||
-rw-r--r-- | include/unistd.h | 10 |
8 files changed, 68 insertions, 0 deletions
diff --git a/include/aio.h b/include/aio.h index f28ee369..ffb357c9 100644 --- a/include/aio.h +++ b/include/aio.h @@ -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 diff --git a/include/dirent.h b/include/dirent.h index 7b70abd4..d0a6b44e 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -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 diff --git a/include/fcntl.h b/include/fcntl.h index 24678b21..63f1bebc 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -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 diff --git a/include/ftw.h b/include/ftw.h index 9bb38c77..ffbddfa7 100644 --- a/include/ftw.h +++ b/include/ftw.h @@ -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 diff --git a/include/glob.h b/include/glob.h index 185912df..92ec7517 100644 --- a/include/glob.h +++ b/include/glob.h @@ -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 diff --git a/include/stdio.h b/include/stdio.h index dca8acc0..355f4259 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -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 diff --git a/include/stdlib.h b/include/stdlib.h index ed512f43..11331d95 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -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 } diff --git a/include/unistd.h b/include/unistd.h index 93098728..67d17c14 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -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 |