authorgravatar for motiejus@jakstys.ltMotiejus Jakštys <motiejus@jakstys.lt> 2023-03-28 20:30:06+03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-05 22:43:53-07:00
log9e76385afcc341f7366c733b28efb88f8bdd33d8
tree9a169fd1435033d4f697b0e8ea06467693414096
parentad34de32a86306daa55bdec713bbefc4afacb5b8

glibc patch: add backwards compatibility for some symbols

- `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.

1 files changed, 7 insertions(+), 0 deletions(-)

lib/libc/glibc/io/fcntl.h+7
......@@ -167,6 +167,10 @@ typedef __pid_t pid_t;
167167 effective IDs, not real IDs. */
168168#endif
169169
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
170174/* Do the file control operation described by CMD on FD.
171175 The remaining arguments are interpreted depending on CMD.
172176
......@@ -197,6 +201,9 @@ extern int __fcntl_time64 (int __fd, int __request, ...) __THROW;
197201# define fcntl __fcntl_time64
198202# endif
199203#endif
204#else /* glibc 2.27 or lower */
205extern int fcntl (int __fd, int __cmd, ...);
206#endif
200207
201208/* Open FILE and return a new file descriptor for it, or -1 on error.
202209 OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set