aboutsummaryrefslogtreecommitdiff
path: root/lib/portability.h
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-11-26 23:24:07 -0600
committerRob Landley <rob@landley.net>2012-11-26 23:24:07 -0600
commit9f8217ce73762c0ac4eea8e7ab2120ca6eb1361d (patch)
treedda127959ba48ecd23af0982c0c56bd96b585076 /lib/portability.h
parent6cf0a115451d6d5ead94860f0731040dc2293db0 (diff)
downloadtoybox-9f8217ce73762c0ac4eea8e7ab2120ca6eb1361d.tar.gz
The headers of uClibc and older glibc got unhappy with O_DIRECTORY and some other stuff. Fix it up in portability.h.
Diffstat (limited to 'lib/portability.h')
-rw-r--r--lib/portability.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/portability.h b/lib/portability.h
index 1b5667ce..4903de11 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -19,20 +19,28 @@
#include <features.h>
-#ifdef __GLIBC__
+#ifndef O_DIRECTORY
+#define O_DIRECTORY 0200000
+#endif
+
+#if defined(__GLIBC__)
+// "Function prototypes shall be provided." but aren't.
+// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
+char *crypt(const char *key, const char *salt);
+
// An SUSv4 function that glibc refuses to #define without crazy #defines,
// see http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html
#include <time.h>
char *strptime(const char *buf, const char *format, struct tm *tm);
-// Another one. "Function prototypes shall be provided." but aren't.
-// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
-char *crypt(const char *key, const char *salt);
-// And again, from all the way back in posix-2001
-struct tm *getdate(const char *string);
-// When building under obsolete glibc, hold its hand a bit.
+// uClibc pretends to be glibc and copied a lot of its bugs, but has a few more
+#if defined(__UCLIBC__)
+#include <unistd.h>
+#include <stdio.h>
+ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
-#if __GLIBC_MINOR__ < 10 && !defined(__UCLIBC__)
+// When building under obsolete glibc, hold its hand a bit.
+#elif __GLIBC_MINOR__ < 10
#define AT_FDCWD -100
#define AT_SYMLINK_NOFOLLOW 0x100
#define AT_REMOVEDIR 0x200