diff --git a/compat/flockfile.c b/compat/flockfile.c index 1db85a23a1..f3c4fff284 100644 --- a/compat/flockfile.c +++ b/compat/flockfile.c @@ -54,17 +54,6 @@ int putc_unlocked (int c, FILE *stream) { return _putc_nolock (c, stream); } - -#elif defined __native_client__ -void flockfile (FILE *stream) -{ - _flockfile(stream); -} - -void funlockfile (FILE *stream) -{ - _funlockfile(stream); -} #else # error flockfile not implemented on your platform! #endif diff --git a/compat/getpid.c b/compat/getpid.c index d6275e7df3..5645d50bb4 100644 --- a/compat/getpid.c +++ b/compat/getpid.c @@ -31,8 +31,6 @@ pid_t getpid (void) { #if defined (_WIN32) return (pid_t) GetCurrentProcessId (); -#elif defined (__native_client__) - return 1; #else # error Unimplemented! #endif diff --git a/compat/pathconf.c b/compat/pathconf.c deleted file mode 100644 index 34f990ab19..0000000000 --- a/compat/pathconf.c +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - * pathconf.c: POSIX pathconf() replacement - ***************************************************************************** - * Copyright (C) 2017 VLC authors and VideoLAN - * - * Authors: Dennis Hamester - * - * 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 -#endif - -#include - -#ifdef __native_client__ -long pathconf (const char *path, int name) -{ - VLC_UNUSED(path); - VLC_UNUSED(name); - return -1; -} -#elif defined(_WIN32) -/* Windows does not have pathconf, but that is OK */ -#else -# error pathconf not implemented on your platform! -#endif diff --git a/compat/recvmsg.c b/compat/recvmsg.c index 1c348fcee2..d110232f1e 100644 --- a/compat/recvmsg.c +++ b/compat/recvmsg.c @@ -83,85 +83,6 @@ ssize_t recvmsg(int fd, struct msghdr *msg, int flags) return -1; } -#elif defined __native_client__ -#include -#include -#include -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_SYS_UIO_H -#include -#endif - -ssize_t recvmsg(int fd, struct msghdr *msg, int flags) -{ - if (msg->msg_controllen != 0) - { - errno = ENOSYS; - return -1; - } - - if ((msg->msg_iovlen <= 0) || (msg->msg_iovlen > IOV_MAX)) - { - errno = EMSGSIZE; - return -1; - } - - size_t full_size = 0; - for (int i = 0; i < msg->msg_iovlen; ++i) - full_size += msg->msg_iov[i].iov_len; - - if (full_size > SSIZE_MAX) { - errno = EINVAL; - return -1; - } - - /** - * We always allocate here, because whether recv/recvfrom allow NULL message - * or not is unspecified. - */ - char *data = malloc(full_size ? full_size : 1); - if (!data) { - errno = ENOMEM; - return -1; - } - - ssize_t res; - if (msg->msg_name) - res = recvfrom(fd, data, full_size, flags, msg->msg_name, &msg->msg_namelen); - else - res = recv(fd, data, full_size, flags); - - if (res > 0) { - size_t left; - if ((size_t)res <= full_size) { - left = res; - msg->msg_flags = 0; - } - else { - left = full_size; - msg->msg_flags = MSG_TRUNC; - } - - const char *src = data; - for (int i = 0; (i < msg->msg_iovlen) && (left > 0); ++i) - { - size_t to_copy = msg->msg_iov[i].iov_len; - if (to_copy > left) - to_copy = left; - - memcpy(msg->msg_iov[i].iov_base, src, to_copy); - src += to_copy; - left -= to_copy; - } - } - - free(data); - return res; -} - #else #error recvmsg not implemented on your platform! #endif diff --git a/compat/sendmsg.c b/compat/sendmsg.c index 0b08ce0942..3b5a6c42fd 100644 --- a/compat/sendmsg.c +++ b/compat/sendmsg.c @@ -73,67 +73,6 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) return -1; } -#elif defined __native_client__ -#include -#include -#include -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_SYS_UIO_H -#include -#endif - -ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) -{ - if (msg->msg_controllen != 0) - { - errno = ENOSYS; - return -1; - } - - if ((msg->msg_iovlen <= 0) || (msg->msg_iovlen > IOV_MAX)) - { - errno = EMSGSIZE; - return -1; - } - - size_t full_size = 0; - for (int i = 0; i < msg->msg_iovlen; ++i) - full_size += msg->msg_iov[i].iov_len; - - if (full_size > SSIZE_MAX) { - errno = EINVAL; - return -1; - } - - /** - * We always allocate here, because whether send/sento allow NULL message or - * not is unspecified. - */ - char *data = malloc(full_size ? full_size : 1); - if (!data) { - errno = ENOMEM; - return -1; - } - - size_t tmp = 0; - for (int i = 0; i < msg->msg_iovlen; ++i) { - memcpy(data + tmp, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len); - tmp += msg->msg_iov[i].iov_len; - } - - ssize_t res; - if (msg->msg_name) - res = sendto(fd, data, full_size, flags, msg->msg_name, msg->msg_namelen); - else - res = send(fd, data, full_size, flags); - - free(data); - return res; -} - #else #error sendmsg not implemented on your platform! #endif diff --git a/compat/sigwait.c b/compat/sigwait.c deleted file mode 100644 index e5a082d2d6..0000000000 --- a/compat/sigwait.c +++ /dev/null @@ -1,49 +0,0 @@ -/***************************************************************************** - * sigwait.c: POSIX sigwait() replacement - ***************************************************************************** - * Copyright © 2017 VLC authors and VideoLAN - * - * Author: Julian Scheel - * - * 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 -#endif - -#ifdef __native_client__ -/* NaCl has no working sigwait, but SIGPIPE, for which vlc uses sigwait - * currently, is never generated in NaCl. So for SIGPIPE it's safe to instantly - * return, for all others run into an assertion. */ - -#include -#include - -int sigwait(const sigset_t *set, int *sig) -{ - sigset_t s = *set; - if (sigemptyset(&s)) - return 0; - assert(sigismember(&s, SIGPIPE)); - sigdelset(&s, SIGPIPE); - assert(sigemptyset(&s)); - - *sig = SIGPIPE; - return 0; -} -#else -# error sigwait not implemented on your platform! -#endif diff --git a/configure.ac b/configure.ac index f3c1eb1be1..14516e576f 100644 --- a/configure.ac +++ b/configure.ac @@ -388,13 +388,6 @@ __attribute__((visibility("default"))) int foo() { return my_array[0]; } X86ASMFLAGS="-f aout" X86ASMDEFS="-DARCH_X86_32=1 -DARCH_X86_64=0 -DPREFIX" ;; - *nacl*) - SYS=nacl - AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition]) - AC_LIBOBJ([sigwait]) - AC_LIBOBJ([recvmsg]) - AC_LIBOBJ([sendmsg]) - ;; *emscripten*) SYS=emscripten # tdestroy() is a GNU extension @@ -722,7 +715,7 @@ need_libc=false dnl Check for usual libc functions AC_CHECK_FUNCS([accept4 dup3 fcntl flock fstatat fstatvfs fork getmntent_r getenv getpwuid_r isatty memalign mkostemp mmap open_memstream newlocale pipe2 posix_fadvise setlocale stricmp uselocale wordexp]) -AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir flockfile fsync getdelim getpid lfind lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf]) +AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir flockfile fsync getdelim getpid lfind lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp]) 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 0e73e853da..1911057dbf 100644 --- a/include/vlc_fixups.h +++ b/include/vlc_fixups.h @@ -33,7 +33,7 @@ /* C++11 says there's no need to define __STDC_*_MACROS when including * inttypes.h and stdint.h. */ -#if defined (__cplusplus) && (defined(__MINGW32__) || defined(__UCLIBC__) || defined(__native_client__)) +#if defined (__cplusplus) && (defined(__MINGW32__) || defined(__UCLIBC__)) # ifndef __STDC_FORMAT_MACROS # define __STDC_FORMAT_MACROS 1 # endif @@ -121,15 +121,6 @@ extern "C" { # define VLC_NOTHROW #endif -/* signal.h */ -#if !defined(HAVE_SIGWAIT) && defined(__native_client__) -/* NaCl does not define sigwait in signal.h. We need to include it here to - * define sigwait, because sigset_t is allowed to be either an integral or a - * struct. */ -#include -int sigwait(const sigset_t *set, int *sig); -#endif - /* stddef.h */ #if !defined (__cplusplus) && !defined (HAVE_MAX_ALIGN_T) typedef struct { @@ -269,10 +260,6 @@ 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 *); @@ -324,10 +311,6 @@ void *aligned_alloc(size_t, size_t); #define aligned_free(ptr) free(ptr) #endif -#if defined(__native_client__) && defined(__cplusplus) -# define HAVE_USELOCALE -#endif - #if !defined(HAVE_NEWLOCALE) && defined(HAVE_CXX_LOCALE_T) && defined(__cplusplus) # include # define HAVE_NEWLOCALE @@ -393,11 +376,6 @@ int inet_pton(int, const char *, void *); const char *inet_ntop(int, const void *, char *, socklen_t); #endif -/* NaCl has a broken netinet/tcp.h, so TCP_NODELAY is not set */ -#if defined(__native_client__) && !defined( HAVE_NETINET_TCP_H ) -# define TCP_NODELAY 1 -#endif - #ifndef HAVE_STRUCT_POLLFD enum {