WebKit Bugzilla
Attachment 370358 Details for
Bug 197961
: [PlayStation] Don't call fcntl.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197961-20190521170436.patch (text/plain), 15.20 KB, created by
Ross Kirsling
on 2019-05-21 17:04:37 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ross Kirsling
Created:
2019-05-21 17:04:37 PDT
Size:
15.20 KB
patch
obsolete
>Subversion Revision: 245535 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index aef85d901c13f7361c4dcdeaf4881b9adf958f8b..b70d638d254cd9eede3419a46c80089293f24367 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,14 @@ >+2019-05-21 Ross Kirsling <ross.kirsling@sony.com> >+ >+ [PlayStation] Don't call fcntl. >+ https://bugs.webkit.org/show_bug.cgi?id=197961 >+ >+ Reviewed by Fujii Hironori. >+ >+ * inspector/remote/socket/posix/RemoteInspectorSocketPOSIX.cpp: >+ (Inspector::Socket::setup): >+ Use WTF::setCloseOnExec and WTF::setNonBlock. >+ > 2019-05-20 Carlos Garcia Campos <cgarcia@igalia.com> > > [GLIB] Crash when instantiating a js object registered with jsc_context_register_class on window object cleared >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 03850356f37d2b4345f3f7a9c6775b810dfe0353..6e4326d7b188618bfa145d55539e2291bb088aff 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,23 @@ >+2019-05-21 Ross Kirsling <ross.kirsling@sony.com> >+ >+ [PlayStation] Don't call fcntl. >+ https://bugs.webkit.org/show_bug.cgi?id=197961 >+ >+ Reviewed by Fujii Hironori. >+ >+ * wtf/PlatformGTK.cmake: >+ * wtf/PlatformJSCOnly.cmake: >+ * wtf/PlatformPlayStation.cmake: >+ * wtf/PlatformWPE.cmake: >+ * wtf/UniStdExtras.h: >+ * wtf/playstation/UniStdExtrasPlayStation.cpp: Added. >+ (WTF::setCloseOnExec): >+ (WTF::dupCloseOnExec): >+ (WTF::setNonBlock): >+ * wtf/unix/UniStdExtrasUnix.cpp: Renamed from Source/WTF/wtf/UniStdExtras.cpp. >+ (WTF::setNonBlock): >+ Move UniStdExtras to unix/, add a PlayStation version that doesn't use fcntl, add an abstraction for O_NONBLOCK. >+ > 2019-05-20 Carlos Garcia Campos <cgarcia@igalia.com> > > [GLIB] Repeating timer is not stopped when stop is called from the callback >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index e4af44cf2e98d772ceaf15135958a8fa1ef349c2..ce9c52e3b1e6f66528e55490d897cf357a7bddec 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,14 @@ >+2019-05-21 Ross Kirsling <ross.kirsling@sony.com> >+ >+ [PlayStation] Don't call fcntl. >+ https://bugs.webkit.org/show_bug.cgi?id=197961 >+ >+ Reviewed by Fujii Hironori. >+ >+ * Platform/IPC/unix/ConnectionUnix.cpp: >+ (IPC::Connection::open): >+ Use WTF::setNonBlock. >+ > 2019-05-20 Per Arne Vollan <pvollan@apple.com> > > [macOS] STP can't launch any WebContent processes >diff --git a/Source/JavaScriptCore/inspector/remote/socket/posix/RemoteInspectorSocketPOSIX.cpp b/Source/JavaScriptCore/inspector/remote/socket/posix/RemoteInspectorSocketPOSIX.cpp >index 9a25a684ed1370e11cdb045baa2e2fd68fe8cd80..7037c4af6b69af56bc218277d03dfc0211dd9ba8 100644 >--- a/Source/JavaScriptCore/inspector/remote/socket/posix/RemoteInspectorSocketPOSIX.cpp >+++ b/Source/JavaScriptCore/inspector/remote/socket/posix/RemoteInspectorSocketPOSIX.cpp >@@ -34,6 +34,7 @@ > #include <sys/socket.h> > #include <sys/un.h> > #include <unistd.h> >+#include <wtf/UniStdExtras.h> > > namespace Inspector { > >@@ -138,9 +139,8 @@ Optional<std::array<PlatformSocketType, 2>> createPair() > > void setup(PlatformSocketType socket) > { >- fcntl(socket, F_SETFD, FD_CLOEXEC); >- int flags = fcntl(socket, F_GETFL, 0); >- fcntl(socket, F_SETFL, flags | O_NONBLOCK); >+ setCloseOnExec(socket); >+ setNonBlock(socket); > > setsockopt(socket, SOL_SOCKET, SO_RCVBUF, &BufferSize, sizeof(BufferSize)); > setsockopt(socket, SOL_SOCKET, SO_SNDBUF, &BufferSize, sizeof(BufferSize)); >diff --git a/Source/WTF/wtf/PlatformGTK.cmake b/Source/WTF/wtf/PlatformGTK.cmake >index 297d0fa2c78f3961b0f4c3e17193fba6e5e4a3f5..60b37bd96b22828f88c1f2e89eb0b00dccbc3d98 100644 >--- a/Source/WTF/wtf/PlatformGTK.cmake >+++ b/Source/WTF/wtf/PlatformGTK.cmake >@@ -17,8 +17,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux") > endif () > > list(APPEND WTF_SOURCES >- UniStdExtras.cpp >- > generic/MainThreadGeneric.cpp > generic/WorkQueueGeneric.cpp > >@@ -35,6 +33,7 @@ list(APPEND WTF_SOURCES > > unix/CPUTimeUnix.cpp > unix/LanguageUnix.cpp >+ unix/UniStdExtrasUnix.cpp > ) > > if (CMAKE_SYSTEM_NAME MATCHES "Linux") >diff --git a/Source/WTF/wtf/PlatformJSCOnly.cmake b/Source/WTF/wtf/PlatformJSCOnly.cmake >index 5392beb023ef64876ee58d637f8bee0e01088bba..0dae0ab9505b731d64c4f49780318395acd0c5ca 100644 >--- a/Source/WTF/wtf/PlatformJSCOnly.cmake >+++ b/Source/WTF/wtf/PlatformJSCOnly.cmake >@@ -29,8 +29,6 @@ if (WIN32) > ) > else () > list(APPEND WTF_SOURCES >- UniStdExtras.cpp >- > generic/MainThreadGeneric.cpp > > posix/FileSystemPOSIX.cpp >@@ -40,6 +38,7 @@ else () > text/unix/TextBreakIteratorInternalICUUnix.cpp > > unix/LanguageUnix.cpp >+ unix/UniStdExtrasUnix.cpp > ) > if (WTF_OS_FUCHSIA) > list(APPEND WTF_SOURCES >diff --git a/Source/WTF/wtf/PlatformPlayStation.cmake b/Source/WTF/wtf/PlatformPlayStation.cmake >index 932b2a3da72507e45ce1ab6a61cc4d334ad9d7c0..ddfe68a513802bb5b9f481e2dd9fb41f42baec22 100644 >--- a/Source/WTF/wtf/PlatformPlayStation.cmake >+++ b/Source/WTF/wtf/PlatformPlayStation.cmake >@@ -5,6 +5,8 @@ list(APPEND WTF_SOURCES > generic/RunLoopGeneric.cpp > generic/WorkQueueGeneric.cpp > >+ playstation/UniStdExtrasPlayStation.cpp >+ > posix/FileSystemPOSIX.cpp > posix/OSAllocatorPOSIX.cpp > posix/ThreadingPOSIX.cpp >diff --git a/Source/WTF/wtf/PlatformWPE.cmake b/Source/WTF/wtf/PlatformWPE.cmake >index 7787cfef5b2e311ae884b5916d8bf45a2a7c04fa..ab273e7c39f7d77f1fe4145643524bab70b24843 100644 >--- a/Source/WTF/wtf/PlatformWPE.cmake >+++ b/Source/WTF/wtf/PlatformWPE.cmake >@@ -11,8 +11,6 @@ list(APPEND WTF_PUBLIC_HEADERS > ) > > list(APPEND WTF_SOURCES >- UniStdExtras.cpp >- > generic/MainThreadGeneric.cpp > generic/MemoryFootprintGeneric.cpp > generic/WorkQueueGeneric.cpp >@@ -33,6 +31,7 @@ list(APPEND WTF_SOURCES > > unix/CPUTimeUnix.cpp > unix/LanguageUnix.cpp >+ unix/UniStdExtrasUnix.cpp > ) > > list(APPEND WTF_LIBRARIES >diff --git a/Source/WTF/wtf/UniStdExtras.cpp b/Source/WTF/wtf/UniStdExtras.cpp >deleted file mode 100644 >index aa34ab4bd01f3bbcc22cdfcdc0c21f43a83df1a9..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/UniStdExtras.cpp >+++ /dev/null >@@ -1,67 +0,0 @@ >-/* >- * Copyright (C) 2016 Igalia S.L. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include <wtf/UniStdExtras.h> >- >-#include <fcntl.h> >- >-namespace WTF { >- >-bool setCloseOnExec(int fileDescriptor) >-{ >- int returnValue = -1; >- do { >- int flags = fcntl(fileDescriptor, F_GETFD); >- if (flags != -1) >- returnValue = fcntl(fileDescriptor, F_SETFD, flags | FD_CLOEXEC); >- } while (returnValue == -1 && errno == EINTR); >- >- return returnValue != -1; >-} >- >-int dupCloseOnExec(int fileDescriptor) >-{ >- int duplicatedFileDescriptor = -1; >-#ifdef F_DUPFD_CLOEXEC >- while ((duplicatedFileDescriptor = fcntl(fileDescriptor, F_DUPFD_CLOEXEC, 0)) == -1 && errno == EINTR) { } >- if (duplicatedFileDescriptor != -1) >- return duplicatedFileDescriptor; >- >-#endif >- >- while ((duplicatedFileDescriptor = dup(fileDescriptor)) == -1 && errno == EINTR) { } >- if (duplicatedFileDescriptor == -1) >- return -1; >- >- if (!setCloseOnExec(duplicatedFileDescriptor)) { >- closeWithRetry(duplicatedFileDescriptor); >- return -1; >- } >- >- return duplicatedFileDescriptor; >-} >- >-} // namespace WTF >diff --git a/Source/WTF/wtf/UniStdExtras.h b/Source/WTF/wtf/UniStdExtras.h >index b6736e37ed58463b8aa6e981f7b28fa1437838f3..b79dfe7dcfef7175ed961a6ec262854ee1664da0 100644 >--- a/Source/WTF/wtf/UniStdExtras.h >+++ b/Source/WTF/wtf/UniStdExtras.h >@@ -50,10 +50,13 @@ inline int closeWithRetry(int fileDescriptor) > return ret; > } > >+WTF_EXPORT_PRIVATE bool setNonBlock(int fileDescriptor); >+ > } // namespace WTF > > using WTF::closeWithRetry; >-using WTF::setCloseOnExec; > using WTF::dupCloseOnExec; >+using WTF::setCloseOnExec; >+using WTF::setNonBlock; > > #endif // UniStdExtras_h >diff --git a/Source/WTF/wtf/playstation/UniStdExtrasPlayStation.cpp b/Source/WTF/wtf/playstation/UniStdExtrasPlayStation.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..91021c21b3fca42ae599902332fecf8821589ef4 >--- /dev/null >+++ b/Source/WTF/wtf/playstation/UniStdExtrasPlayStation.cpp >@@ -0,0 +1,55 @@ >+/* >+ * Copyright (C) 2019 Sony Interactive Entertainment Inc. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include <wtf/UniStdExtras.h> >+ >+#include <sys/socket.h> >+ >+namespace WTF { >+ >+bool setCloseOnExec(int) >+{ >+ return true; >+} >+ >+int dupCloseOnExec(int fileDescriptor) >+{ >+ int duplicatedFileDescriptor = -1; >+ >+ while ((duplicatedFileDescriptor = dup(fileDescriptor)) == -1 && errno == EINTR) { } >+ if (duplicatedFileDescriptor == -1) >+ return -1; >+ >+ return duplicatedFileDescriptor; >+} >+ >+bool setNonBlock(int fileDescriptor) >+{ >+ int nonBlocking = 1; >+ return setsockopt(fileDescriptor, SOL_SOCKET, SO_NBIO, &nonBlocking, sizeof(int)) != -1; >+} >+ >+} // namespace WTF >diff --git a/Source/WTF/wtf/unix/UniStdExtrasUnix.cpp b/Source/WTF/wtf/unix/UniStdExtrasUnix.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..115f770ebba0c51189a8c082404f9e2917073dd4 >--- /dev/null >+++ b/Source/WTF/wtf/unix/UniStdExtrasUnix.cpp >@@ -0,0 +1,77 @@ >+/* >+ * Copyright (C) 2016 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include <wtf/UniStdExtras.h> >+ >+#include <fcntl.h> >+ >+namespace WTF { >+ >+bool setCloseOnExec(int fileDescriptor) >+{ >+ int returnValue = -1; >+ do { >+ int flags = fcntl(fileDescriptor, F_GETFD); >+ if (flags != -1) >+ returnValue = fcntl(fileDescriptor, F_SETFD, flags | FD_CLOEXEC); >+ } while (returnValue == -1 && errno == EINTR); >+ >+ return returnValue != -1; >+} >+ >+int dupCloseOnExec(int fileDescriptor) >+{ >+ int duplicatedFileDescriptor = -1; >+#ifdef F_DUPFD_CLOEXEC >+ while ((duplicatedFileDescriptor = fcntl(fileDescriptor, F_DUPFD_CLOEXEC, 0)) == -1 && errno == EINTR) { } >+ if (duplicatedFileDescriptor != -1) >+ return duplicatedFileDescriptor; >+ >+#endif >+ >+ while ((duplicatedFileDescriptor = dup(fileDescriptor)) == -1 && errno == EINTR) { } >+ if (duplicatedFileDescriptor == -1) >+ return -1; >+ >+ if (!setCloseOnExec(duplicatedFileDescriptor)) { >+ closeWithRetry(duplicatedFileDescriptor); >+ return -1; >+ } >+ >+ return duplicatedFileDescriptor; >+} >+ >+bool setNonBlock(int fileDescriptor) >+{ >+ int returnValue = -1; >+ >+ int flags = fcntl(fileDescriptor, F_GETFL, 0); >+ while ((returnValue = fcntl(fileDescriptor, F_SETFL, flags | O_NONBLOCK)) == -1 && errno == EINTR) { } >+ >+ return returnValue != -1; >+} >+ >+} // namespace WTF >diff --git a/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp b/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp >index 4f3ab14608b4bfd2e65a04102c4d48ac5c6ad656..63b6be7271e4458839505aa915e3873f8514dedd 100644 >--- a/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp >+++ b/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp >@@ -331,12 +331,9 @@ void Connection::readyReadHandler() > > bool Connection::open() > { >- int flags = fcntl(m_socketDescriptor, F_GETFL, 0); >- while (fcntl(m_socketDescriptor, F_SETFL, flags | O_NONBLOCK) == -1) { >- if (errno != EINTR) { >- ASSERT_NOT_REACHED(); >- return false; >- } >+ if (!setNonBlock(m_socketDescriptor)) { >+ ASSERT_NOT_REACHED(); >+ return false; > } > > RefPtr<Connection> protectedThis(this);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197961
:
370062
|
370357
| 370358