comparison lib/portability.h @ 713:ff8a27d3ab8f

The headers of uClibc and older glibc got unhappy with O_DIRECTORY and some other stuff. Fix it up in portability.h.
author Rob Landley <rob@landley.net>
date Mon, 26 Nov 2012 23:24:07 -0600
parents 9fb5fe6eb13f
children fb17cd078e63
comparison
equal deleted inserted replaced
712:a950dd960593 713:ff8a27d3ab8f
17 17
18 // This isn't in the spec, but it's how we determine what we're using. 18 // This isn't in the spec, but it's how we determine what we're using.
19 19
20 #include <features.h> 20 #include <features.h>
21 21
22 #ifdef __GLIBC__ 22 #ifndef O_DIRECTORY
23 #define O_DIRECTORY 0200000
24 #endif
25
26 #if defined(__GLIBC__)
27 // "Function prototypes shall be provided." but aren't.
28 // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
29 char *crypt(const char *key, const char *salt);
30
23 // An SUSv4 function that glibc refuses to #define without crazy #defines, 31 // An SUSv4 function that glibc refuses to #define without crazy #defines,
24 // see http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html 32 // see http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html
25 #include <time.h> 33 #include <time.h>
26 char *strptime(const char *buf, const char *format, struct tm *tm); 34 char *strptime(const char *buf, const char *format, struct tm *tm);
27 // Another one. "Function prototypes shall be provided." but aren't. 35
28 // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html 36 // uClibc pretends to be glibc and copied a lot of its bugs, but has a few more
29 char *crypt(const char *key, const char *salt); 37 #if defined(__UCLIBC__)
30 // And again, from all the way back in posix-2001 38 #include <unistd.h>
31 struct tm *getdate(const char *string); 39 #include <stdio.h>
40 ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
32 41
33 // When building under obsolete glibc, hold its hand a bit. 42 // When building under obsolete glibc, hold its hand a bit.
34 43 #elif __GLIBC_MINOR__ < 10
35 #if __GLIBC_MINOR__ < 10 && !defined(__UCLIBC__)
36 #define AT_FDCWD -100 44 #define AT_FDCWD -100
37 #define AT_SYMLINK_NOFOLLOW 0x100 45 #define AT_SYMLINK_NOFOLLOW 0x100
38 #define AT_REMOVEDIR 0x200 46 #define AT_REMOVEDIR 0x200
39 int fstatat(int dirfd, const char *pathname, void *buf, int flags); 47 int fstatat(int dirfd, const char *pathname, void *buf, int flags);
40 int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz); 48 int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);