[Toybox] [PATCH] macOS: remove glibc 2.10 workarounds.

enh enh at google.com
Thu Nov 29 12:48:25 PST 2018


The only part of this I actually need for macOS is to remove __APPLE__
from the getdelim/getline workaround, but if we're following the usual
"seven year rule", glibc 2.10 is dead to us anyway, and we should just
remove all of this.
---
 lib/portability.h | 44 +-------------------------------------------
 1 file changed, 1 insertion(+), 43 deletions(-)

diff --git a/lib/portability.h b/lib/portability.h
index e6b542c4..a74d66d5 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -91,43 +91,7 @@ static inline char *basename(char *path) { return
__xpg_basename(path); }

 #include <string.h>
 char *strcasestr(const char *haystack, const char *needle);
-
-// When building under obsolete glibc (Ubuntu 8.04-ish), hold its hand a bit.
-#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10
-#define fstatat fstatat64
-int fstatat64(int dirfd, const char *pathname, void *buf, int flags);
-int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);
-char *stpcpy(char *dest, const char *src);
-#include <sys/stat.h>
-int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);
-int openat(int dirfd, const char *pathname, int flags, ...);
-#include <dirent.h>
-DIR *fdopendir(int fd);
-#include <unistd.h>
-int fchownat(int dirfd, const char *pathname,
-                    uid_t owner, gid_t group, int flags);
-int isblank(int c);
-int unlinkat(int dirfd, const char *pathname, int flags);
-#include <stdio.h>
-ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
-
-// Straight from posix-2008, things old glibc had but didn't prototype
-
-int faccessat(int fd, const char *path, int amode, int flag);
-int linkat(int fd1, const char *path1, int fd2, const char *path2, int flag);
-int mkdirat(int fd, const char *path, mode_t mode);
-int symlinkat(const char *path1, int fd, const char *path2);
-int mknodat(int fd, const char *path, mode_t mode, dev_t dev);
-#include <sys/time.h>
-int futimens(int fd, const struct timespec times[2]);
-int utimensat(int fd, const char *path, const struct timespec
times[2], int flag);
-
-#ifndef MNT_DETACH
-#define MNT_DETACH 2
-#endif
-#endif // Old glibc
-
-#endif // glibc in general
+#endif // defined(glibc)

 #if !defined(__GLIBC__)
 // POSIX basename.
@@ -175,12 +139,6 @@ int clearenv(void);
 #define SWAP_LE64(x) (x)
 #endif

-#if defined(__APPLE__) \
-    || (defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 10)
-ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
-ssize_t getline(char **lineptr, size_t *n, FILE *stream);
-#endif
-
 // Linux headers not listed by POSIX or LSB
 #include <sys/mount.h>
 #include <sys/swap.h>
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-macOS-remove-glibc-2.10-workarounds.patch
Type: text/x-patch
Size: 2889 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20181129/b07be52d/attachment-0001.bin>


More information about the Toybox mailing list