]> git.sesse.net Git - vlc/blobdiff - include/vlc_fixups.h
vlc_memalign(): osx 10.5 doesn't have posix_memalign()
[vlc] / include / vlc_fixups.h
index 3d931af1a25125b5de6135af4b910f3dbb8acd89..dee3dbd397dc3fdce3429085857dfc31afca7aa7 100644 (file)
@@ -50,8 +50,7 @@ typedef struct
 
 #if !defined (HAVE_STRLCPY) || \
     !defined (HAVE_STRNDUP) || \
-    !defined (HAVE_STRNLEN) || \
-    !defined (HAVE_GETCWD)
+    !defined (HAVE_STRNLEN)
 # include <stddef.h> /* size_t */
 #endif
 
@@ -65,7 +64,8 @@ typedef struct
 # include <sys/types.h> /* ssize_t, pid_t */
 #endif
 
-#ifndef HAVE_DIRFD
+#if !defined (HAVE_DIRFD) || \
+    !defined (HAVE_FDOPENDIR)
 # include <dirent.h>
 #endif
 
@@ -78,6 +78,16 @@ extern "C" {
 int asprintf (char **, const char *, ...);
 #endif
 
+#ifndef HAVE_FLOCKFILE
+void flockfile (FILE *);
+int ftrylockfile (FILE *);
+void funlockfile (FILE *);
+int getc_unlocked (FILE *);
+int getchar_unlocked (void);
+int putc_unlocked (int, FILE *);
+int putchar_unlocked (int);
+#endif
+
 #ifndef HAVE_GETDELIM
 ssize_t getdelim (char **, size_t *, int, FILE *);
 ssize_t getline (char **, size_t *, FILE *);
@@ -163,19 +173,26 @@ struct tm *localtime_r (const time_t *, struct tm *);
 #endif
 
 /* unistd.h */
-#ifndef HAVE_GETCWD
-char *getcwd (char *buf, size_t size);
-#endif
-
 #ifndef HAVE_GETPID
 pid_t getpid (void);
 #endif
 
+#ifndef HAVE_FSYNC
+int fsync (int fd);
+#endif
+
 /* dirent.h */
 #ifndef HAVE_DIRFD
+#ifdef __APPLE__
+#undef dirfd
+#endif
 int dirfd (DIR *);
 #endif
 
+#ifndef HAVE_FDOPENDIR
+DIR *fdopendir (int);
+#endif
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
@@ -240,7 +257,7 @@ void swab (const void *, void *, ssize_t);
 # define inet_ntop vlc_inet_ntop
 #endif
 
-#ifndef HAVE_POLL
+#ifndef HAVE_STRUCT_POLLFD
 enum
 {
     POLLIN=1,
@@ -257,7 +274,8 @@ struct pollfd
     unsigned events;
     unsigned revents;
 };
-
+#endif
+#ifndef HAVE_POLL
 # define poll(a, b, c) vlc_poll(a, b, c)
 #elif defined (HAVE_MAEMO)
 # include <poll.h>
@@ -265,6 +283,20 @@ struct pollfd
 int vlc_poll (struct pollfd *, unsigned, int);
 #endif
 
+#ifndef HAVE_IF_NAMEINDEX
+#include <errno.h>
+struct if_nameindex
+{
+    unsigned if_index;
+    char    *if_name;
+};
+# ifndef HAVE_IF_NAMETOINDEX
+#  define if_nametoindex(name)   atoi(name)
+# endif
+# define if_nameindex()         (errno = ENOBUFS, NULL)
+# define if_freenameindex(list) (void)0
+#endif
+
 /* search.h */
 #ifndef HAVE_SEARCH_H
 typedef struct entry {
@@ -313,4 +345,8 @@ long nrand48 (unsigned short subi[3]);
 char *tempnam(const char *, const char *);
 #endif // ANDROID
 
+#ifdef __OS2__
+# undef HAVE_FORK   /* Implementation of fork() is imperfect on OS/2 */
+#endif
+
 #endif /* !LIBVLC_FIXUPS_H */