| author | |
| committer | |
| log | b40943e253c079ec3de1b149dd2ef0ccc3da38a4 |
| tree | e017fb02218974cb4d9cde29f9017fa5b721afe7 |
| parent | f9c9ae84c6c0773ab8dc710cae3ce9024ca1e91c |
- `fcntl` was renamed to `fcntl64` in glibc 2.28 (see #9485)
- `res_{,n}{search,query,querydomain}` became "their own" symbols since
glibc 2.34: they were prefixed with `__` before.
This PR makes it possible to use `fcntl` with glibc 2.27 or older and
the `res_*` functions with glibc 2.33 or older.
These patches will become redundant with universal-headers and can be
dropped. But we have to do with what we have now.3 files changed, 37 insertions(+), 0 deletions(-)
lib/libc/glibc/io/fcntl.h+7| ... | ... | @@ -167,6 +167,10 @@ typedef __pid_t pid_t; |
| 167 | 167 | 					 effective IDs, not real IDs. */ |
| 168 | 168 | #endif |
| 169 | 169 | |
| 170 | ||
| 171 | /* fcntl was a simple symbol until glibc 2.27 inclusive. glibc 2.28 onwards | |
| 172 | * re-defines it to fcntl64 (via #define) if _FILE_OFFSET_BITS == 64. */ | |
| 173 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2 | |
| 170 | 174 | /* Do the file control operation described by CMD on FD. |
| 171 | 175 | The remaining arguments are interpreted depending on CMD. |
| 172 | 176 | |
| ... | ... | @@ -197,6 +201,9 @@ extern int __fcntl_time64 (int __fd, int __request, ...) __THROW; |
| 197 | 201 | # define fcntl __fcntl_time64 |
| 198 | 202 | # endif |
| 199 | 203 | #endif |
| 204 | #else /* glibc 2.27 or lower */ | |
| 205 | extern int fcntl (int __fd, int __cmd, ...); | |
| 206 | #endif | |
| 200 | 207 | |
| 201 | 208 | /* Open FILE and return a new file descriptor for it, or -1 on error. |
| 202 | 209 | OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set |
lib/libc/include/generic-glibc/fcntl.h+8| ... | ... | @@ -167,6 +167,11 @@ typedef __pid_t pid_t; |
| 167 | 167 | 					 effective IDs, not real IDs. */ |
| 168 | 168 | #endif |
| 169 | 169 | |
| 170 | ||
| 171 | /* fcntl was a simple symbol until glibc 2.27 inclusive. | |
| 172 | * glibc 2.28 onwards converted it to a macro when compiled with | |
| 173 | * USE_LARGEFILE64. */ | |
| 174 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2 | |
| 170 | 175 | /* Do the file control operation described by CMD on FD. |
| 171 | 176 | The remaining arguments are interpreted depending on CMD. |
| 172 | 177 | |
| ... | ... | @@ -197,6 +202,9 @@ extern int __fcntl_time64 (int __fd, int __request, ...) __THROW; |
| 197 | 202 | # define fcntl __fcntl_time64 |
| 198 | 203 | # endif |
| 199 | 204 | #endif |
| 205 | #else /* glibc 2.27 or lower */ | |
| 206 | extern int fcntl (int __fd, int __cmd, ...); | |
| 207 | #endif | |
| 200 | 208 | |
| 201 | 209 | /* Open FILE and return a new file descriptor for it, or -1 on error. |
| 202 | 210 | OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set |
lib/libc/include/generic-glibc/resolv.h+22| ... | ... | @@ -170,6 +170,28 @@ __END_DECLS |
| 170 | 170 | #define res_init		__res_init |
| 171 | 171 | #define res_isourserver		__res_isourserver |
| 172 | 172 | |
| 173 | /* In glibc 2.33 and earlier res_search, res_nsearch, res_query, res_nquery, | |
| 174 | * res_querydomain, res_nquerydomain were #define'd to __res_search, | |
| 175 | * __res_nsearch, etc. glibc 2.34 onwards removes the macros and exposes the | |
| 176 | * symbols directly. New glibc exposes compat symbols with underscores for | |
| 177 | * backwards compatibility. Applications linked to glibc 2.34+ are expected | |
| 178 | * to use the non-underscored symbols. | |
| 179 | * | |
| 180 | * It will be enough to bring the macros back when compiling against the older | |
| 181 | * glibc versions. | |
| 182 | * | |
| 183 | * See glibc commit ea9878ec271c791880fcbbe519d70c42f8113750. | |
| 184 | */ | |
| 185 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 34) | |
| 186 | #define res_search __res_search | |
| 187 | #define res_nsearch __res_nsearch | |
| 188 | #define res_query __res_query | |
| 189 | #define res_nquery __res_nquery | |
| 190 | #define res_querydomain __res_querydomain | |
| 191 | #define res_nquerydomain __res_nquerydomain | |
| 192 | #endif | |
| 193 | /* end glibc compat hacks */ | |
| 194 | ||
| 173 | 195 | #ifdef _LIBC |
| 174 | 196 | # define __RESOLV_DEPRECATED |
| 175 | 197 | # define __RESOLV_DEPRECATED_MSG(msg) |