summaryrefslogtreecommitdiff
path: root/src/mongo/platform
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2018-06-04 10:40:41 -0400
committerAndrew Morrow <acm@mongodb.com>2018-07-17 15:31:15 -0400
commitd175ae80e6af61f9f37bdebbde3b2b5115ae2a9f (patch)
tree491b4c6d5ca985c4a31f2819b35d4d6a0683e631 /src/mongo/platform
parent1c0bce5f9792f0f6d4f26cd041a0c60c0398bd5e (diff)
downloadmongo-d175ae80e6af61f9f37bdebbde3b2b5115ae2a9f.tar.gz
SERVER-36147 Add basic support for targeting emscripten
Diffstat (limited to 'src/mongo/platform')
-rw-r--r--src/mongo/platform/pause.h5
-rw-r--r--src/mongo/platform/random.cpp3
-rw-r--r--src/mongo/platform/stack_locator_emscripten.cpp29
3 files changed, 36 insertions, 1 deletions
diff --git a/src/mongo/platform/pause.h b/src/mongo/platform/pause.h
index 5003de534a8..64aa6c16a2b 100644
--- a/src/mongo/platform/pause.h
+++ b/src/mongo/platform/pause.h
@@ -67,6 +67,11 @@
#define MONGO_YIELD_CORE_FOR_SMT() __asm__ volatile("rd %%ccr, %%g0" ::: "memory")
+#elif defined(__EMSCRIPTEN__)
+
+// TODO: What should this be?
+#define MONGO_YIELD_CORE_FOR_SMT()
+
#else
#error "No processor pause implementation for this architecture."
#endif
diff --git a/src/mongo/platform/random.cpp b/src/mongo/platform/random.cpp
index 910fac54b72..839fb3aa3b8 100644
--- a/src/mongo/platform/random.cpp
+++ b/src/mongo/platform/random.cpp
@@ -147,7 +147,8 @@ std::unique_ptr<SecureRandom> SecureRandom::create() {
return stdx::make_unique<WinSecureRandom>();
}
-#elif defined(__linux__) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) || \
+ defined(__EMSCRIPTEN__)
class InputStreamSecureRandom : public SecureRandom {
public:
diff --git a/src/mongo/platform/stack_locator_emscripten.cpp b/src/mongo/platform/stack_locator_emscripten.cpp
new file mode 100644
index 00000000000..adebcbe933c
--- /dev/null
+++ b/src/mongo/platform/stack_locator_emscripten.cpp
@@ -0,0 +1,29 @@
+/**
+ * Copyright (C) 2018 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "stack_locator_pthread_getattr_np.cpp"