[vlc-commits] compat: Add pathconf for NaCl
Dennis Hamester
git at videolan.org
Tue Mar 28 15:39:45 CEST 2017
vlc | branch: master | Dennis Hamester <dennis.hamester at startmail.com> | Wed Mar 22 09:58:59 2017 +0100| [6ebc87da747027a914df21356c0cc433361a43b9] | committer: Jean-Baptiste Kempf
compat: Add pathconf for NaCl
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6ebc87da747027a914df21356c0cc433361a43b9
---
compat/pathconf.c | 38 ++++++++++++++++++++++++++++++++++++++
configure.ac | 2 +-
include/vlc_fixups.h | 4 ++++
3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/compat/pathconf.c b/compat/pathconf.c
new file mode 100644
index 0000000..af78759
--- /dev/null
+++ b/compat/pathconf.c
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * pathconf.c: POSIX pathconf() replacement
+ *****************************************************************************
+ * Copyright (C) 2017 VLC authors and VideoLAN
+ *
+ * Authors: Dennis Hamester <dhamester at jusst.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <vlc_common.h>
+
+#ifdef __native_client__
+long pathconf (const char *path, int name)
+{
+ VLC_UNUSED(path);
+ VLC_UNUSED(name);
+ return -1;
+}
+#else
+# error pathconf not implemented on your platform!
+#endif
diff --git a/configure.ac b/configure.ac
index 32e94f6..d18ca1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -595,7 +595,7 @@ need_libc=false
dnl Check for usual libc functions
AC_CHECK_FUNCS([daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime tdestroy uselocale])
-AC_REPLACE_FUNCS([atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tfind timegm timespec_get strverscmp])
+AC_REPLACE_FUNCS([atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tfind timegm timespec_get strverscmp pathconf])
AC_REPLACE_FUNCS([gettimeofday])
AC_CHECK_FUNC(fdatasync,,
[AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index 8d14808..55f51c2 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -250,6 +250,10 @@ pid_t getpid (void) VLC_NOTHROW;
int fsync (int fd);
#endif
+#ifndef HAVE_PATHCONF
+long pathconf (const char *path, int name);
+#endif
+
/* dirent.h */
#ifndef HAVE_DIRFD
int (dirfd) (DIR *);
More information about the vlc-commits
mailing list