protobuf_grpc: google serializing and RPC library
protobuf : 3.9.3 grpc : 1.24.0 This a new version of the port with a vastly reduced port size. Issue #190
This commit is contained in:
1367
src/lib/grpc/files.list
Normal file
1367
src/lib/grpc/files.list
Normal file
File diff suppressed because it is too large
Load Diff
110
src/lib/grpc/patches/01_mutex.patch
Normal file
110
src/lib/grpc/patches/01_mutex.patch
Normal file
@@ -0,0 +1,110 @@
|
||||
commit b4f45e0fa3e07a91623b1039dfea8dfa77f792e0
|
||||
Author: Pirmin Duss <pirmin.duss@gapfruit.com>
|
||||
Date: Mon Sep 23 15:15:49 2019 +0200
|
||||
|
||||
mutex fixes
|
||||
|
||||
diff --git a/include/grpc/impl/codegen/sync_custom.h b/include/grpc/impl/codegen/sync_custom.h
|
||||
index 69b1bf6..dd0bb95 100644
|
||||
--- a/include/grpc/impl/codegen/sync_custom.h
|
||||
+++ b/include/grpc/impl/codegen/sync_custom.h
|
||||
@@ -21,15 +21,15 @@
|
||||
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
|
||||
-#include <grpc/impl/codegen/sync_generic.h>
|
||||
+#include <base/lock.h>
|
||||
|
||||
/* Users defining GPR_CUSTOM_SYNC need to define the following macros. */
|
||||
|
||||
#ifdef GPR_CUSTOM_SYNC
|
||||
|
||||
-typedef GPR_CUSTOM_MU_TYPE gpr_mu;
|
||||
-typedef GPR_CUSTOM_CV_TYPE gpr_cv;
|
||||
-typedef GPR_CUSTOM_ONCE_TYPE gpr_once;
|
||||
+typedef Genode::Lock gpr_mu;
|
||||
+typedef pthread_cond_t gpr_cv;
|
||||
+typedef pthread_once_t gpr_once;
|
||||
|
||||
#define GPR_ONCE_INIT GPR_CUSTOM_ONCE_INIT
|
||||
|
||||
diff --git a/include/grpcpp/impl/codegen/sync.h b/include/grpcpp/impl/codegen/sync.h
|
||||
index 146f182..d1a60cb 100644
|
||||
--- a/include/grpcpp/impl/codegen/sync.h
|
||||
+++ b/include/grpcpp/impl/codegen/sync.h
|
||||
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <mutex>
|
||||
+#include <base/lock.h>
|
||||
|
||||
#include <grpc/impl/codegen/log.h>
|
||||
#include <grpc/impl/codegen/sync.h>
|
||||
@@ -58,7 +59,7 @@ class Mutex {
|
||||
private:
|
||||
union {
|
||||
gpr_mu mu_;
|
||||
- std::mutex do_not_use_sth_;
|
||||
+ Genode::Lock do_not_use_sth_;
|
||||
#ifdef GPR_HAS_PTHREAD_H
|
||||
pthread_mutex_t do_not_use_pth_;
|
||||
#endif
|
||||
diff --git a/src/lib/grpc/src/cpp/server/external_connection_acceptor_impl.h b/src/lib/grpc/src/cpp/server/external_connection_acceptor_impl.h
|
||||
index b5bd935..e835bbf 100644
|
||||
--- a/src/cpp/server/external_connection_acceptor_impl.h
|
||||
+++ b/src/cpp/server/external_connection_acceptor_impl.h
|
||||
@@ -20,7 +20,7 @@
|
||||
#define SRC_CPP_SERVER_EXTERNAL_CONNECTION_ACCEPTOR_IMPL_H_
|
||||
|
||||
#include <memory>
|
||||
-#include <mutex>
|
||||
+#include <base/lock.h>
|
||||
|
||||
#include <grpc/impl/codegen/grpc_types.h>
|
||||
#include <grpcpp/security/server_credentials.h>
|
||||
@@ -60,7 +60,7 @@ class ExternalConnectionAcceptorImpl
|
||||
const grpc::string name_;
|
||||
std::shared_ptr<ServerCredentials> creds_;
|
||||
grpc_core::TcpServerFdHandler* handler_ = nullptr; // not owned
|
||||
- std::mutex mu_;
|
||||
+ Genode::Lock mu_;
|
||||
bool has_acceptor_ = false;
|
||||
bool started_ = false;
|
||||
bool shutdown_ = false;
|
||||
diff --git a/src/lib/grpc/src/cpp/server/external_connection_acceptor_impl.cc b/src/lib/grpc/src/cpp/server/external_connection_acceptor_impl.cc
|
||||
index 7f0e2dc..a788b0d 100644
|
||||
--- a/src/cpp/server/external_connection_acceptor_impl.cc
|
||||
+++ b/src/cpp/server/external_connection_acceptor_impl.cc
|
||||
@@ -52,7 +52,7 @@ ExternalConnectionAcceptorImpl::ExternalConnectionAcceptorImpl(
|
||||
|
||||
std::unique_ptr<experimental::ExternalConnectionAcceptor>
|
||||
ExternalConnectionAcceptorImpl::GetAcceptor() {
|
||||
- std::lock_guard<std::mutex> lock(mu_);
|
||||
+ std::lock_guard<Genode::Lock> lock(mu_);
|
||||
GPR_ASSERT(!has_acceptor_);
|
||||
has_acceptor_ = true;
|
||||
return std::unique_ptr<experimental::ExternalConnectionAcceptor>(
|
||||
@@ -61,7 +61,7 @@ ExternalConnectionAcceptorImpl::GetAcceptor() {
|
||||
|
||||
void ExternalConnectionAcceptorImpl::HandleNewConnection(
|
||||
experimental::ExternalConnectionAcceptor::NewConnectionParameters* p) {
|
||||
- std::lock_guard<std::mutex> lock(mu_);
|
||||
+ std::lock_guard<Genode::Lock> lock(mu_);
|
||||
if (shutdown_ || !started_) {
|
||||
// TODO(yangg) clean up.
|
||||
gpr_log(
|
||||
@@ -76,12 +76,12 @@ void ExternalConnectionAcceptorImpl::HandleNewConnection(
|
||||
}
|
||||
|
||||
void ExternalConnectionAcceptorImpl::Shutdown() {
|
||||
- std::lock_guard<std::mutex> lock(mu_);
|
||||
+ std::lock_guard<Genode::Lock> lock(mu_);
|
||||
shutdown_ = true;
|
||||
}
|
||||
|
||||
void ExternalConnectionAcceptorImpl::Start() {
|
||||
- std::lock_guard<std::mutex> lock(mu_);
|
||||
+ std::lock_guard<Genode::Lock> lock(mu_);
|
||||
GPR_ASSERT(!started_);
|
||||
GPR_ASSERT(has_acceptor_);
|
||||
GPR_ASSERT(!shutdown_);
|
||||
39
src/lib/grpc/patches/02_generated_includes.patch
Normal file
39
src/lib/grpc/patches/02_generated_includes.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
diff --git a/src/cpp/util/core_stats.h b/src/cpp/util/core_stats.h
|
||||
index 6366d7d..0f0e2ee 100644
|
||||
--- a/src/cpp/util/core_stats.h
|
||||
+++ b/src/cpp/util/core_stats.h
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef GRPC_INTERNAL_CPP_UTIL_CORE_STATS_H
|
||||
#define GRPC_INTERNAL_CPP_UTIL_CORE_STATS_H
|
||||
|
||||
-#include "src/proto/grpc/core/stats.pb.h"
|
||||
+#include "stats.pb.h"
|
||||
|
||||
#include "src/core/lib/debug/stats.h"
|
||||
|
||||
diff --git a/src/cpp/util/error_details.cc b/src/cpp/util/error_details.cc
|
||||
index a1aafcb..6be9390 100644
|
||||
--- a/src/cpp/util/error_details.cc
|
||||
+++ b/src/cpp/util/error_details.cc
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <grpcpp/support/error_details.h>
|
||||
|
||||
-#include "src/proto/grpc/status/status.pb.h"
|
||||
+#include "status.pb.h"
|
||||
|
||||
namespace grpc_impl {
|
||||
|
||||
diff --git a/src/cpp/ext/proto_server_reflection.h b/src/cpp/ext/proto_server_reflection.h
|
||||
index bf40c3c180..69f36c3e96 100644
|
||||
--- a/src/cpp/ext/proto_server_reflection.h
|
||||
+++ b/src/cpp/ext/proto_server_reflection.h
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <grpcpp/grpcpp.h>
|
||||
-#include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h"
|
||||
+#include "reflection.grpc.pb.h"
|
||||
|
||||
namespace grpc {
|
||||
|
||||
20
src/lib/grpc/patches/03_if_nametoindex.patch
Normal file
20
src/lib/grpc/patches/03_if_nametoindex.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
diff --git a/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc b/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
|
||||
index f1ba20dcec..0d94d79246 100644
|
||||
--- a/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
|
||||
+++ b/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
|
||||
@@ -29,13 +29,8 @@
|
||||
|
||||
#include <grpc/support/log.h>
|
||||
|
||||
-uint32_t grpc_if_nametoindex(char* name) {
|
||||
- uint32_t out = if_nametoindex(name);
|
||||
- if (out == 0) {
|
||||
- gpr_log(GPR_DEBUG, "if_nametoindex failed for name %s. errno %d", name,
|
||||
- errno);
|
||||
- }
|
||||
- return out;
|
||||
+uint32_t grpc_if_nametoindex(char*) {
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
#endif /* GRPC_IF_NAMETOINDEX == 1 && \
|
||||
152
src/lib/grpc/patches/04_socket_stuff.patch
Normal file
152
src/lib/grpc/patches/04_socket_stuff.patch
Normal file
@@ -0,0 +1,152 @@
|
||||
diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc
|
||||
index 47d9f51b09..66abe6982a 100644
|
||||
--- a/src/core/lib/iomgr/socket_utils_common_posix.cc
|
||||
+++ b/src/core/lib/iomgr/socket_utils_common_posix.cc
|
||||
@@ -70,21 +70,21 @@ grpc_error* grpc_set_socket_nonblocking(int fd, int non_blocking) {
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
-grpc_error* grpc_set_socket_no_sigpipe_if_possible(int fd) {
|
||||
-#ifdef GRPC_HAVE_SO_NOSIGPIPE
|
||||
- int val = 1;
|
||||
- int newval;
|
||||
- socklen_t intlen = sizeof(newval);
|
||||
- if (0 != setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val))) {
|
||||
- return GRPC_OS_ERROR(errno, "setsockopt(SO_NOSIGPIPE)");
|
||||
- }
|
||||
- if (0 != getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &newval, &intlen)) {
|
||||
- return GRPC_OS_ERROR(errno, "getsockopt(SO_NOSIGPIPE)");
|
||||
- }
|
||||
- if ((newval != 0) != (val != 0)) {
|
||||
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to set SO_NOSIGPIPE");
|
||||
- }
|
||||
-#endif
|
||||
+grpc_error* grpc_set_socket_no_sigpipe_if_possible(int /*fd*/) {
|
||||
+//#ifdef GRPC_HAVE_SO_NOSIGPIPE
|
||||
+// int val = 1;
|
||||
+// int newval;
|
||||
+// socklen_t intlen = sizeof(newval);
|
||||
+// if (0 != setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val))) {
|
||||
+// return GRPC_OS_ERROR(errno, "setsockopt(SO_NOSIGPIPE)");
|
||||
+// }
|
||||
+// if (0 != getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &newval, &intlen)) {
|
||||
+// return GRPC_OS_ERROR(errno, "getsockopt(SO_NOSIGPIPE)");
|
||||
+// }
|
||||
+// if ((newval != 0) != (val != 0)) {
|
||||
+// return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to set SO_NOSIGPIPE");
|
||||
+// }
|
||||
+//#endif
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
@@ -125,22 +125,22 @@ grpc_error* grpc_set_socket_rcvbuf(int fd, int buffer_size_bytes) {
|
||||
}
|
||||
|
||||
/* set a socket to close on exec */
|
||||
-grpc_error* grpc_set_socket_cloexec(int fd, int close_on_exec) {
|
||||
- int oldflags = fcntl(fd, F_GETFD, 0);
|
||||
- if (oldflags < 0) {
|
||||
- return GRPC_OS_ERROR(errno, "fcntl");
|
||||
- }
|
||||
-
|
||||
- if (close_on_exec) {
|
||||
- oldflags |= FD_CLOEXEC;
|
||||
- } else {
|
||||
- oldflags &= ~FD_CLOEXEC;
|
||||
- }
|
||||
-
|
||||
- if (fcntl(fd, F_SETFD, oldflags) != 0) {
|
||||
- return GRPC_OS_ERROR(errno, "fcntl");
|
||||
- }
|
||||
-
|
||||
+grpc_error* grpc_set_socket_cloexec(int /*fd*/, int /*close_on_exec*/) {
|
||||
+// int oldflags = fcntl(fd, F_GETFD, 0);
|
||||
+// if (oldflags < 0) {
|
||||
+// return GRPC_OS_ERROR(errno, "fcntl");
|
||||
+// }
|
||||
+//
|
||||
+// if (close_on_exec) {
|
||||
+// oldflags |= FD_CLOEXEC;
|
||||
+// } else {
|
||||
+// oldflags &= ~FD_CLOEXEC;
|
||||
+// }
|
||||
+//
|
||||
+// if (fcntl(fd, F_SETFD, oldflags) != 0) {
|
||||
+// return GRPC_OS_ERROR(errno, "fcntl");
|
||||
+// }
|
||||
+//
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
@@ -163,24 +163,24 @@ grpc_error* grpc_set_socket_reuse_addr(int fd, int reuse) {
|
||||
}
|
||||
|
||||
/* set a socket to reuse old addresses */
|
||||
-grpc_error* grpc_set_socket_reuse_port(int fd, int reuse) {
|
||||
+grpc_error* grpc_set_socket_reuse_port(int /*fd*/, int /*reuse*/) {
|
||||
#ifndef SO_REUSEPORT
|
||||
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"SO_REUSEPORT unavailable on compiling system");
|
||||
#else
|
||||
- int val = (reuse != 0);
|
||||
- int newval;
|
||||
- socklen_t intlen = sizeof(newval);
|
||||
- if (0 != setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val))) {
|
||||
- return GRPC_OS_ERROR(errno, "setsockopt(SO_REUSEPORT)");
|
||||
- }
|
||||
- if (0 != getsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &newval, &intlen)) {
|
||||
- return GRPC_OS_ERROR(errno, "getsockopt(SO_REUSEPORT)");
|
||||
- }
|
||||
- if ((newval != 0) != val) {
|
||||
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to set SO_REUSEPORT");
|
||||
- }
|
||||
-
|
||||
+// int val = (reuse != 0);
|
||||
+// int newval;
|
||||
+// socklen_t intlen = sizeof(newval);
|
||||
+// if (0 != setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val))) {
|
||||
+// return GRPC_OS_ERROR(errno, "setsockopt(SO_REUSEPORT)");
|
||||
+// }
|
||||
+// if (0 != getsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &newval, &intlen)) {
|
||||
+// return GRPC_OS_ERROR(errno, "getsockopt(SO_REUSEPORT)");
|
||||
+// }
|
||||
+// if ((newval != 0) != val) {
|
||||
+// return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to set SO_REUSEPORT");
|
||||
+// }
|
||||
+//
|
||||
return GRPC_ERROR_NONE;
|
||||
#endif
|
||||
}
|
||||
@@ -210,19 +210,19 @@ bool grpc_is_socket_reuse_port_supported() {
|
||||
}
|
||||
|
||||
/* disable nagle */
|
||||
-grpc_error* grpc_set_socket_low_latency(int fd, int low_latency) {
|
||||
- int val = (low_latency != 0);
|
||||
- int newval;
|
||||
- socklen_t intlen = sizeof(newval);
|
||||
- if (0 != setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val))) {
|
||||
- return GRPC_OS_ERROR(errno, "setsockopt(TCP_NODELAY)");
|
||||
- }
|
||||
- if (0 != getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &newval, &intlen)) {
|
||||
- return GRPC_OS_ERROR(errno, "getsockopt(TCP_NODELAY)");
|
||||
- }
|
||||
- if ((newval != 0) != val) {
|
||||
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to set TCP_NODELAY");
|
||||
- }
|
||||
+grpc_error* grpc_set_socket_low_latency(int /*fd*/, int /*low_latency*/) {
|
||||
+// int val = (low_latency != 0);
|
||||
+// int newval;
|
||||
+// socklen_t intlen = sizeof(newval);
|
||||
+// if (0 != setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val))) {
|
||||
+// return GRPC_OS_ERROR(errno, "setsockopt(TCP_NODELAY)");
|
||||
+// }
|
||||
+// if (0 != getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &newval, &intlen)) {
|
||||
+// return GRPC_OS_ERROR(errno, "getsockopt(TCP_NODELAY)");
|
||||
+// }
|
||||
+// if ((newval != 0) != val) {
|
||||
+// return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to set TCP_NODELAY");
|
||||
+// }
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
26
src/lib/grpc/patches/05_example.patch
Normal file
26
src/lib/grpc/patches/05_example.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
diff --git a/examples/cpp/helloworld/greeter_client.cc b/examples/cpp/helloworld/greeter_client.cc
|
||||
index 932583c84a..0fa38aac38 100644
|
||||
--- a/examples/cpp/helloworld/greeter_client.cc
|
||||
+++ b/examples/cpp/helloworld/greeter_client.cc
|
||||
@@ -77,7 +77,7 @@ int main(int argc, char** argv) {
|
||||
// localhost at port 50051). We indicate that the channel isn't authenticated
|
||||
// (use of InsecureChannelCredentials()).
|
||||
GreeterClient greeter(grpc::CreateChannel(
|
||||
- "localhost:50051", grpc::InsecureChannelCredentials()));
|
||||
+ "10.10.10.55:50051", grpc::InsecureChannelCredentials()));
|
||||
std::string user("world");
|
||||
std::string reply = greeter.SayHello(user);
|
||||
std::cout << "Greeter received: " << reply << std::endl;
|
||||
diff --git a/examples/cpp/helloworld/greeter_server.cc b/examples/cpp/helloworld/greeter_server.cc
|
||||
index f36ad906a2..03025b7920 100644
|
||||
--- a/examples/cpp/helloworld/greeter_server.cc
|
||||
+++ b/examples/cpp/helloworld/greeter_server.cc
|
||||
@@ -47,7 +47,7 @@ class GreeterServiceImpl final : public Greeter::Service {
|
||||
};
|
||||
|
||||
void RunServer() {
|
||||
- std::string server_address("0.0.0.0:50051");
|
||||
+ std::string server_address("10.10.10.55:50051");
|
||||
GreeterServiceImpl service;
|
||||
|
||||
ServerBuilder builder;
|
||||
12
src/lib/grpc/patches/06_if_indextoname.patch
Normal file
12
src/lib/grpc/patches/06_if_indextoname.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
diff --git a/third_party/genode/if_indextoname.c b/third_party/genode/if_indextoname.c
|
||||
new file mode 100644
|
||||
index 0000000000..9ea67cee0c
|
||||
--- /dev/null
|
||||
+++ b/third_party/genode/if_indextoname.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+char * if_indextoname(unsigned int ifindex, char *ifname)
|
||||
+{
|
||||
+ const char* name = "eth0";
|
||||
+ ifname = name;
|
||||
+ return ifname;
|
||||
+}
|
||||
38
src/lib/grpc/patches/07_send_recv.patch
Normal file
38
src/lib/grpc/patches/07_send_recv.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
commit e291dab98f94a0d510ec726af85680d018d2aadf
|
||||
Author: Pirmin Duss <pirmin.duss@gapfruit.com>
|
||||
Date: Mon Oct 28 10:58:58 2019 +0100
|
||||
|
||||
Fix for missing sendmsg and recvmsg in genode.
|
||||
|
||||
diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc
|
||||
index b6d1381298..f2d3ac5037 100644
|
||||
--- a/src/core/lib/iomgr/tcp_posix.cc
|
||||
+++ b/src/core/lib/iomgr/tcp_posix.cc
|
||||
@@ -464,7 +464,12 @@ static void tcp_do_read(grpc_tcp* tcp) {
|
||||
do {
|
||||
GPR_TIMER_SCOPE("recvmsg", 0);
|
||||
GRPC_STATS_INC_SYSCALL_READ();
|
||||
- read_bytes = recvmsg(tcp->fd, &msg, 0);
|
||||
+ read_bytes = 0;
|
||||
+ for (int i = 0; i < msg.msg_iovlen; i++)
|
||||
+ {
|
||||
+ auto iov = msg.msg_iov[i];
|
||||
+ read_bytes += read(tcp->fd, iov.iov_base, iov.iov_len);
|
||||
+ }
|
||||
} while (read_bytes < 0 && errno == EINTR);
|
||||
|
||||
/* We have read something in previous reads. We need to deliver those
|
||||
@@ -652,7 +657,12 @@ ssize_t tcp_send(int fd, const struct msghdr* msg) {
|
||||
do {
|
||||
/* TODO(klempner): Cork if this is a partial write */
|
||||
GRPC_STATS_INC_SYSCALL_WRITE();
|
||||
- sent_length = sendmsg(fd, msg, SENDMSG_FLAGS);
|
||||
+ sent_length = 0;
|
||||
+ for (int i = 0; i < msg->msg_iovlen; i++)
|
||||
+ {
|
||||
+ auto iov = msg->msg_iov[i];
|
||||
+ sent_length += write(fd, iov.iov_base, iov.iov_len);
|
||||
+ }
|
||||
} while (sent_length < 0 && errno == EINTR);
|
||||
return sent_length;
|
||||
}
|
||||
13
src/lib/grpc/patches/08_grpc_accept4.patch
Normal file
13
src/lib/grpc/patches/08_grpc_accept4.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
--- a/src/core/lib/iomgr/socket_utils_posix.cc
|
||||
+++ b/src/core/lib/iomgr/socket_utils_posix.cc
|
||||
@@ -42,11 +42,6 @@ int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock,
|
||||
if (flags < 0) goto close_and_error;
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) != 0) goto close_and_error;
|
||||
}
|
||||
- if (cloexec) {
|
||||
- flags = fcntl(fd, F_GETFD, 0);
|
||||
- if (flags < 0) goto close_and_error;
|
||||
- if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) != 0) goto close_and_error;
|
||||
- }
|
||||
}
|
||||
return fd;
|
||||
223
src/lib/protobuf/files.list
Normal file
223
src/lib/protobuf/files.list
Normal file
@@ -0,0 +1,223 @@
|
||||
protobuf-x.x.x/LICENSE
|
||||
protobuf-x.x.x/src/google/protobuf/generated_message_util.cc
|
||||
protobuf-x.x.x/src/google/protobuf/empty.proto
|
||||
protobuf-x.x.x/src/google/protobuf/struct.proto
|
||||
protobuf-x.x.x/src/google/protobuf/duration.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/repeated_field.cc
|
||||
protobuf-x.x.x/src/google/protobuf/generated_message_reflection.cc
|
||||
protobuf-x.x.x/src/google/protobuf/descriptor.h
|
||||
protobuf-x.x.x/src/google/protobuf/reflection.h
|
||||
protobuf-x.x.x/src/google/protobuf/wire_format_lite.h
|
||||
protobuf-x.x.x/src/google/protobuf/api.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/map_type_handler.h
|
||||
protobuf-x.x.x/src/google/protobuf/wire_format_lite.cc
|
||||
protobuf-x.x.x/src/google/protobuf/timestamp.proto
|
||||
protobuf-x.x.x/src/google/protobuf/empty.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/type.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/package_info.h
|
||||
protobuf-x.x.x/src/google/protobuf/port.h
|
||||
protobuf-x.x.x/src/google/protobuf/descriptor.cc
|
||||
protobuf-x.x.x/src/google/protobuf/any.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/implicit_weak_message.h
|
||||
protobuf-x.x.x/src/google/protobuf/field_mask.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/generated_message_table_driven.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/callback.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/stringprintf.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/port.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/status.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/bytestream.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/stringpiece.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/stringprintf.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/status.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/common.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/platform_macros.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/once.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/macros.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/time.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/status_macros.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/map_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/statusor.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/casts.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/logging.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/mathutil.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/stringpiece.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/common.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/statusor.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/time.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/substitute.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/mathlimits.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/structurally_valid.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/strutil.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/template_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/bytestream.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/int128.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/substitute.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/int128.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/strutil.cc
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/mathlimits.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/hash.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/stl_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/mutex.h
|
||||
protobuf-x.x.x/src/google/protobuf/stubs/fastmem.h
|
||||
protobuf-x.x.x/src/google/protobuf/timestamp.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/generated_message_table_driven_lite.h
|
||||
protobuf-x.x.x/src/google/protobuf/inlined_string_field.h
|
||||
protobuf-x.x.x/src/google/protobuf/descriptor.proto
|
||||
protobuf-x.x.x/src/google/protobuf/source_context.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/type.proto
|
||||
protobuf-x.x.x/src/google/protobuf/message.cc
|
||||
protobuf-x.x.x/src/google/protobuf/descriptor.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/any_lite.cc
|
||||
protobuf-x.x.x/src/google/protobuf/parse_context.cc
|
||||
protobuf-x.x.x/src/google/protobuf/has_bits.h
|
||||
protobuf-x.x.x/src/google/protobuf/any.cc
|
||||
protobuf-x.x.x/src/google/protobuf/map_field.h
|
||||
protobuf-x.x.x/src/google/protobuf/implicit_weak_message.cc
|
||||
protobuf-x.x.x/src/google/protobuf/map_entry.h
|
||||
protobuf-x.x.x/src/google/protobuf/any.h
|
||||
protobuf-x.x.x/src/google/protobuf/map.h
|
||||
protobuf-x.x.x/src/google/protobuf/parse_context.h
|
||||
protobuf-x.x.x/src/google/protobuf/generated_message_reflection.h
|
||||
protobuf-x.x.x/src/google/protobuf/port_undef.inc
|
||||
protobuf-x.x.x/src/google/protobuf/any.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/source_context.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/api.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/type.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/generated_enum_reflection.h
|
||||
protobuf-x.x.x/src/google/protobuf/wrappers.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/timestamp.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/wrappers.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/arena.cc
|
||||
protobuf-x.x.x/src/google/protobuf/reflection_internal.h
|
||||
protobuf-x.x.x/src/google/protobuf/struct.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/struct.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/message_lite.h
|
||||
protobuf-x.x.x/src/google/protobuf/arena_impl.h
|
||||
protobuf-x.x.x/src/google/protobuf/map_field.cc
|
||||
protobuf-x.x.x/src/google/protobuf/extension_set_inl.h
|
||||
protobuf-x.x.x/src/google/protobuf/any.proto
|
||||
protobuf-x.x.x/src/google/protobuf/metadata_lite.h
|
||||
protobuf-x.x.x/src/google/protobuf/metadata.h
|
||||
protobuf-x.x.x/src/google/protobuf/wrappers.proto
|
||||
protobuf-x.x.x/src/google/protobuf/map_entry_lite.h
|
||||
protobuf-x.x.x/src/google/protobuf/reflection_ops.cc
|
||||
protobuf-x.x.x/src/google/protobuf/message.h
|
||||
protobuf-x.x.x/src/google/protobuf/text_format.h
|
||||
protobuf-x.x.x/src/google/protobuf/map_field_inl.h
|
||||
protobuf-x.x.x/src/google/protobuf/text_format.cc
|
||||
protobuf-x.x.x/src/google/protobuf/wire_format.cc
|
||||
protobuf-x.x.x/src/google/protobuf/descriptor_database.cc
|
||||
protobuf-x.x.x/src/google/protobuf/duration.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/message_lite.cc
|
||||
protobuf-x.x.x/src/google/protobuf/unknown_field_set.h
|
||||
protobuf-x.x.x/src/google/protobuf/duration.proto
|
||||
protobuf-x.x.x/src/google/protobuf/service.h
|
||||
protobuf-x.x.x/src/google/protobuf/arena.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/type_resolver_util.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/time_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/field_mask_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/field_mask_util.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/time_util.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/package_info.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/json_util.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/json_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/type_resolver_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/field_comparator.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/field_comparator.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/json_format.proto
|
||||
protobuf-x.x.x/src/google/protobuf/util/json_format_proto3.proto
|
||||
protobuf-x.x.x/src/google/protobuf/util/type_resolver.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/message_differencer.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/delimited_message_util.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/message_differencer.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/delimited_message_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/json_escaping.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/error_listener.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/json_objectwriter.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/proto_writer.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/location_tracker.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/mock_error_listener.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/type_info.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/structured_objectwriter.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/json_escaping.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/error_listener.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/datapiece.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/type_info.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/field_mask_utility.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/proto_writer.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/default_value_objectwriter.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/protostream_objectwriter.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/object_writer.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/expecting_objectwriter.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/protostream_objectsource.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/protostream_objectsource.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/protostream_objectwriter.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/utility.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/field_mask_utility.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/default_value_objectwriter.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/constants.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/datapiece.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/json_objectwriter.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/object_location_tracker.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/json_stream_parser.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/json_stream_parser.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/utility.cc
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/object_source.h
|
||||
protobuf-x.x.x/src/google/protobuf/util/internal/object_writer.cc
|
||||
protobuf-x.x.x/src/google/protobuf/wire_format.h
|
||||
protobuf-x.x.x/src/google/protobuf/generated_message_table_driven_lite.cc
|
||||
protobuf-x.x.x/src/google/protobuf/empty.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/reflection_ops.h
|
||||
protobuf-x.x.x/src/google/protobuf/extension_set.h
|
||||
protobuf-x.x.x/src/google/protobuf/source_context.proto
|
||||
protobuf-x.x.x/src/google/protobuf/descriptor_database.h
|
||||
protobuf-x.x.x/src/google/protobuf/field_mask.pb.cc
|
||||
protobuf-x.x.x/src/google/protobuf/generated_message_table_driven.h
|
||||
protobuf-x.x.x/src/google/protobuf/generated_enum_util.cc
|
||||
protobuf-x.x.x/src/google/protobuf/port_def.inc
|
||||
protobuf-x.x.x/src/google/protobuf/extension_set_heavy.cc
|
||||
protobuf-x.x.x/src/google/protobuf/repeated_field.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/gzip_stream.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/printer.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/package_info.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/zero_copy_stream_impl.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/printer.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/zero_copy_stream.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/io_win32.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/zero_copy_stream.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/zero_copy_stream_impl_lite.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/strtod.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/strtod.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/zero_copy_stream_impl.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/coded_stream.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/io_win32.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/coded_stream.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/tokenizer.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/gzip_stream.cc
|
||||
protobuf-x.x.x/src/google/protobuf/io/coded_stream_inl.h
|
||||
protobuf-x.x.x/src/google/protobuf/io/tokenizer.h
|
||||
protobuf-x.x.x/src/google/protobuf/map_field_lite.h
|
||||
protobuf-x.x.x/src/google/protobuf/field_mask.proto
|
||||
protobuf-x.x.x/src/google/protobuf/descriptor.pb.h
|
||||
protobuf-x.x.x/src/google/protobuf/generated_message_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/generated_enum_util.h
|
||||
protobuf-x.x.x/src/google/protobuf/service.cc
|
||||
protobuf-x.x.x/src/google/protobuf/unknown_field_set.cc
|
||||
protobuf-x.x.x/src/google/protobuf/api.proto
|
||||
protobuf-x.x.x/src/google/protobuf/dynamic_message.cc
|
||||
protobuf-x.x.x/src/google/protobuf/extension_set.cc
|
||||
protobuf-x.x.x/src/google/protobuf/arenastring.h
|
||||
protobuf-x.x.x/src/google/protobuf/dynamic_message.h
|
||||
protobuf-x.x.x/examples/list_people.py
|
||||
protobuf-x.x.x/examples/add_person.go
|
||||
protobuf-x.x.x/examples/add_person.cc
|
||||
protobuf-x.x.x/examples/ListPeople.java
|
||||
protobuf-x.x.x/examples/addressbook.proto
|
||||
protobuf-x.x.x/examples/BUILD
|
||||
protobuf-x.x.x/examples/add_person.py
|
||||
protobuf-x.x.x/examples/AddPerson.java
|
||||
protobuf-x.x.x/examples/list_people.go
|
||||
protobuf-x.x.x/examples/README.md
|
||||
protobuf-x.x.x/examples/add_person.dart
|
||||
protobuf-x.x.x/examples/list_people.cc
|
||||
28
src/lib/protobuf/patches/01-mutex.patch
Normal file
28
src/lib/protobuf/patches/01-mutex.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
commit 3a55e1d3c8ab37fb14a9a2875db0e031044d4863
|
||||
Author: Pirmin Duss <pirmin.duss@gapfruit.com>
|
||||
Date: Mon Sep 23 16:16:57 2019 +0200
|
||||
|
||||
Mutex fixes
|
||||
|
||||
diff --git a/src/google/protobuf/stubs/mutex.h b/src/google/protobuf/stubs/mutex.h
|
||||
index a311889..967be6a 100644
|
||||
--- a/src/google/protobuf/stubs/mutex.h
|
||||
+++ b/src/google/protobuf/stubs/mutex.h
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifndef GOOGLE_PROTOBUF_STUBS_MUTEX_H_
|
||||
#define GOOGLE_PROTOBUF_STUBS_MUTEX_H_
|
||||
|
||||
-#include <mutex>
|
||||
+#include <base/lock.h>
|
||||
|
||||
#ifdef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
|
||||
|
||||
@@ -104,7 +104,7 @@ class PROTOBUF_EXPORT GOOGLE_PROTOBUF_CAPABILITY("mutex") WrappedMutex {
|
||||
|
||||
private:
|
||||
#ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
|
||||
- std::mutex mu_;
|
||||
+ Genode::Lock mu_;
|
||||
#else // ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
|
||||
CriticalSectionLock mu_;
|
||||
#endif // #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
|
||||
34
src/lib/protobuf/patches/02-run_once.patch
Normal file
34
src/lib/protobuf/patches/02-run_once.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
commit 420f5bb78bfd61825ad5d3bc52a27469f298d17b
|
||||
Author: Pirmin Duss <pirmin.duss@gapfruit.com>
|
||||
Date: Mon Sep 23 16:33:08 2019 +0200
|
||||
|
||||
run_once fix
|
||||
|
||||
diff --git a/src/google/protobuf/stubs/once.h b/src/google/protobuf/stubs/once.h
|
||||
index 070d36d..3602ee7 100644
|
||||
--- a/src/google/protobuf/stubs/once.h
|
||||
+++ b/src/google/protobuf/stubs/once.h
|
||||
@@ -31,19 +31,16 @@
|
||||
#ifndef GOOGLE_PROTOBUF_STUBS_ONCE_H__
|
||||
#define GOOGLE_PROTOBUF_STUBS_ONCE_H__
|
||||
|
||||
-#include <mutex>
|
||||
-#include <utility>
|
||||
-
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
namespace internal {
|
||||
|
||||
-using once_flag = std::once_flag;
|
||||
-template <typename... Args>
|
||||
-void call_once(Args&&... args ) {
|
||||
- std::call_once(std::forward<Args>(args)...);
|
||||
+using once_flag = int;
|
||||
+template <typename FN, typename... Args>
|
||||
+void call_once(once_flag, FN fn, Args&&... args ) {
|
||||
+ fn(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
45
src/lib/protobuf/patches/03-thread.patch
Normal file
45
src/lib/protobuf/patches/03-thread.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc
|
||||
index 36d7307..04a565b 100644
|
||||
--- a/src/google/protobuf/generated_message_util.cc
|
||||
+++ b/src/google/protobuf/generated_message_util.cc
|
||||
@@ -799,8 +799,8 @@ void InitSCCImpl(SCCInfoBase* scc) {
|
||||
// Either the default in case no initialization is running or the id of the
|
||||
// thread that is currently initializing.
|
||||
#ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
|
||||
- static std::atomic<std::thread::id> runner;
|
||||
- auto me = std::this_thread::get_id();
|
||||
+ static std::atomic<long long> runner = -1LL;
|
||||
+ auto me = 1LL;
|
||||
#else
|
||||
// This is a lightweight replacement for std::thread::id. std::thread does not
|
||||
// work on Windows XP SP2 with the latest VC++ libraries, because it utilizes
|
||||
@@ -811,20 +811,20 @@ void InitSCCImpl(SCCInfoBase* scc) {
|
||||
|
||||
// This will only happen because the constructor will call InitSCC while
|
||||
// constructing the default instance.
|
||||
- if (runner.load(std::memory_order_relaxed) == me) {
|
||||
- // Because we're in the process of constructing the default instance.
|
||||
- // We can be assured that we're already exploring this SCC.
|
||||
- GOOGLE_CHECK_EQ(scc->visit_status.load(std::memory_order_relaxed),
|
||||
- SCCInfoBase::kRunning);
|
||||
- return;
|
||||
- }
|
||||
+ if (runner.load(std::memory_order_relaxed) == me) {
|
||||
+ // Because we're in the process of constructing the default instance.
|
||||
+ // We can be assured that we're already exploring this SCC.
|
||||
+ GOOGLE_CHECK_EQ(scc->visit_status.load(std::memory_order_relaxed),
|
||||
+ SCCInfoBase::kRunning);
|
||||
+ return;
|
||||
+ }
|
||||
InitProtobufDefaults();
|
||||
mu.Lock();
|
||||
- runner.store(me, std::memory_order_relaxed);
|
||||
+ runner.store(me, std::memory_order_relaxed);
|
||||
InitSCC_DFS(scc);
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
|
||||
- runner.store(std::thread::id{}, std::memory_order_relaxed);
|
||||
+ runner.store(0, std::memory_order_relaxed);
|
||||
#else
|
||||
runner.store(-1, std::memory_order_relaxed);
|
||||
#endif // #ifndef GOOGLE_PROTOBUF_SUPPORT_WINDOWS_XP
|
||||
34
src/test/grpc/client/target.mk
Normal file
34
src/test/grpc/client/target.mk
Normal file
@@ -0,0 +1,34 @@
|
||||
GRPC_DIR := $(call select_from_ports,protobuf_grpc)/src/lib/grpc
|
||||
PROTO_DIR := $(GRPC_DIR)/examples/protos
|
||||
TARGET := grpc_client
|
||||
|
||||
LIBS := posix
|
||||
LIBS += protobuf
|
||||
LIBS += stdcxx
|
||||
LIBS += grpc
|
||||
LIBS += libc_pipe
|
||||
|
||||
CC_CXX_WARN_STRICT :=
|
||||
|
||||
PROTOC := /usr/local/genode/protobuf_grpc/current/bin/protoc
|
||||
GRPC_PLUGIN := /usr/local/genode/protobuf_grpc/current/bin/grpc_cpp_plugin
|
||||
|
||||
SRC_CC := greeter_client.cc
|
||||
SRC_CC += helloworld.pb.cc
|
||||
SRC_CC += helloworld.grpc.pb.cc
|
||||
|
||||
vpath greeter_client.cc $(GRPC_DIR)/examples/cpp/helloworld
|
||||
vpath helloworld.proto $(PROTO_DIR)
|
||||
|
||||
$(SRC_CC): helloworld.grpc.pb.h
|
||||
|
||||
helloworld.pb.h: helloworld.proto
|
||||
$(VERBOSE)$(PROTOC) --proto_path=$(PROTO_DIR) \
|
||||
--cpp_out=. \
|
||||
$<
|
||||
|
||||
helloworld.grpc.pb.h: helloworld.proto helloworld.pb.h
|
||||
$(VERBOSE)$(PROTOC) --plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
|
||||
--proto_path=$(PROTO_DIR) \
|
||||
--grpc_out=. \
|
||||
$<
|
||||
70
src/test/grpc/server/greeter_server.cc
Normal file
70
src/test/grpc/server/greeter_server.cc
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <grpcpp/grpcpp.h>
|
||||
|
||||
#ifdef BAZEL_BUILD
|
||||
#include "examples/protos/helloworld.grpc.pb.h"
|
||||
#else
|
||||
#include "helloworld.grpc.pb.h"
|
||||
#endif
|
||||
|
||||
#include "greeter_server.h"
|
||||
|
||||
using grpc::Server;
|
||||
using grpc::ServerBuilder;
|
||||
using grpc::ServerContext;
|
||||
using grpc::Status;
|
||||
using helloworld::HelloRequest;
|
||||
using helloworld::HelloReply;
|
||||
using helloworld::Greeter;
|
||||
|
||||
// Logic and data behind the server's behavior.
|
||||
class GreeterServiceImpl final : public Greeter::Service {
|
||||
Status SayHello(ServerContext* context, const HelloRequest* request,
|
||||
HelloReply* reply) override {
|
||||
printf("say hello\n");
|
||||
std::string prefix("Hello ");
|
||||
reply->set_message(prefix + request->name());
|
||||
return Status::OK;
|
||||
}
|
||||
};
|
||||
|
||||
void RunServer() {
|
||||
std::string server_address("10.10.10.55:50051");
|
||||
GreeterServiceImpl service;
|
||||
|
||||
ServerBuilder builder;
|
||||
// Listen on the given address without any authentication mechanism.
|
||||
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
|
||||
// Register "service" as the instance through which we'll communicate with
|
||||
// clients. In this case it corresponds to an *synchronous* service.
|
||||
builder.RegisterService(&service);
|
||||
// Finally assemble the server.
|
||||
std::unique_ptr<Server> server(builder.BuildAndStart());
|
||||
std::cout << "Server listening on " << server_address << std::endl;
|
||||
|
||||
// Wait for the server to shutdown. Note that some other thread must be
|
||||
// responsible for shutting down the server for this call to ever return.
|
||||
server->Wait();
|
||||
}
|
||||
|
||||
4
src/test/grpc/server/greeter_server.h
Normal file
4
src/test/grpc/server/greeter_server.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void RunServer();
|
||||
|
||||
50
src/test/grpc/server/main.cc
Normal file
50
src/test/grpc/server/main.cc
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <libc/component.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/log.h>
|
||||
#include <base/thread.h>
|
||||
#include "greeter_server.h"
|
||||
|
||||
enum { STACK_SIZE = 0xF000 };
|
||||
|
||||
namespace Grpc_server {
|
||||
using namespace Genode;
|
||||
|
||||
class Runner;
|
||||
class Server_main;
|
||||
}
|
||||
|
||||
class Grpc_server::Runner : public Thread
|
||||
{
|
||||
public:
|
||||
Runner(Env& env)
|
||||
: Thread(env, "runner", STACK_SIZE)
|
||||
{
|
||||
}
|
||||
|
||||
void entry() override
|
||||
{
|
||||
Libc::with_libc([] () {
|
||||
RunServer();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
class Grpc_server::Server_main
|
||||
{
|
||||
private:
|
||||
Env& _env;
|
||||
Runner _runner { _env };
|
||||
|
||||
public:
|
||||
Server_main(Env& env)
|
||||
: _env(env)
|
||||
{
|
||||
_runner.start();
|
||||
}
|
||||
};
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
static Grpc_server::Server_main main(env);
|
||||
}
|
||||
35
src/test/grpc/server/target.mk
Normal file
35
src/test/grpc/server/target.mk
Normal file
@@ -0,0 +1,35 @@
|
||||
GRPC_DIR := $(call select_from_ports,protobuf_grpc)/src/lib/grpc
|
||||
PROTO_DIR := $(GRPC_DIR)/examples/protos
|
||||
TARGET := grpc_server
|
||||
|
||||
LIBS += protobuf
|
||||
LIBS += stdcxx
|
||||
LIBS += grpc
|
||||
LIBS += libc_pipe
|
||||
LIBS += vfs
|
||||
LIBS += vfs_lwip
|
||||
|
||||
CC_CXX_WARN_STRICT :=
|
||||
|
||||
PROTOC := /usr/local/genode/protobuf_grpc/current/bin/protoc
|
||||
GRPC_PLUGIN := /usr/local/genode/protobuf_grpc/current/bin/grpc_cpp_plugin
|
||||
|
||||
SRC_CC := main.cc
|
||||
SRC_CC += greeter_server.cc
|
||||
SRC_CC += helloworld.pb.cc
|
||||
SRC_CC += helloworld.grpc.pb.cc
|
||||
|
||||
vpath helloworld.proto $(PROTO_DIR)
|
||||
|
||||
$(SRC_CC): helloworld.grpc.pb.h
|
||||
|
||||
helloworld.pb.h: helloworld.proto
|
||||
$(VERBOSE)$(PROTOC) --proto_path=$(PROTO_DIR) \
|
||||
--cpp_out=. \
|
||||
$<
|
||||
|
||||
helloworld.grpc.pb.h: helloworld.proto helloworld.pb.h
|
||||
$(VERBOSE)$(PROTOC) --plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
|
||||
--proto_path=$(PROTO_DIR) \
|
||||
--grpc_out=. \
|
||||
$<
|
||||
23
src/test/protobuf/add_person/target.mk
Normal file
23
src/test/protobuf/add_person/target.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
PROTOBUF_DIR := $(call select_from_ports,protobuf_grpc)/src/lib/grpc/third_party/protobuf
|
||||
|
||||
TARGET := add_person
|
||||
|
||||
LIBS := posix protobuf stdcxx
|
||||
|
||||
SRC_CC += add_person.cc \
|
||||
addressbook.pb.cc
|
||||
|
||||
PROTOC := /usr/local/genode/protobuf_grpc/current/bin/protoc
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
||||
|
||||
vpath add_person.cc $(PROTOBUF_DIR)/examples
|
||||
vpath addressbook.proto $(PROTOBUF_DIR)/examples
|
||||
|
||||
$(SRC_CC): addressbook.pb.h
|
||||
|
||||
addressbook.pb.h: addressbook.proto
|
||||
$(VERBOSE)$(PROTOC) --proto_path=$(PROTOBUF_DIR)/examples \
|
||||
--proto_path=$(PROTO_FILES_DIR) \
|
||||
--cpp_out=$(shell pwd) \
|
||||
$<
|
||||
23
src/test/protobuf/list_people/target.mk
Normal file
23
src/test/protobuf/list_people/target.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
PROTOBUF_DIR := $(call select_from_ports,protobuf_grpc)/src/lib/grpc/third_party/protobuf
|
||||
|
||||
TARGET := list_people
|
||||
|
||||
LIBS := posix protobuf stdcxx
|
||||
|
||||
SRC_CC += list_people.cc \
|
||||
addressbook.pb.cc
|
||||
|
||||
PROTOC := /usr/local/genode/protobuf_grpc/current/bin/protoc
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
||||
|
||||
vpath list_people.cc $(PROTOBUF_DIR)/examples
|
||||
vpath addressbook.proto $(PROTOBUF_DIR)/examples
|
||||
|
||||
$(SRC_CC): addressbook.pb.h
|
||||
|
||||
addressbook.pb.h: addressbook.proto
|
||||
$(VERBOSE)$(PROTOC) --proto_path=$(PROTOBUF_DIR)/examples \
|
||||
--proto_path=$(PROTO_FILES_DIR) \
|
||||
--cpp_out=$(shell pwd) \
|
||||
$<
|
||||
Reference in New Issue
Block a user