Merge pull request #16399 from jtattermusch/csharp_upgrading_examples

Upgrade C# examples to grpc1.14.1 and protobuf3.6.1
diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h
index 2b61a88..8d9bd83 100644
--- a/include/grpc/impl/codegen/port_platform.h
+++ b/include/grpc/impl/codegen/port_platform.h
@@ -282,6 +282,47 @@
 #else /* _LP64 */
 #define GPR_ARCH_32 1
 #endif /* _LP64 */
+#elif defined(__sun) && defined(__SVR4)
+#define GPR_PLATFORM_STRING "solaris"
+#define GPR_SOLARIS 1
+#define GPR_CPU_POSIX 1
+#define GPR_GCC_ATOMIC 1
+#define GPR_GCC_TLS 1
+#define GPR_POSIX_LOG 1
+#define GPR_POSIX_ENV 1
+#define GPR_POSIX_TMPFILE 1
+#define GPR_POSIX_STRING 1
+#define GPR_POSIX_SUBPROCESS 1
+#define GPR_POSIX_SYNC 1
+#define GPR_POSIX_TIME 1
+#define GPR_GETPID_IN_UNISTD_H 1
+#ifdef _LP64
+#define GPR_ARCH_64 1
+#else /* _LP64 */
+#define GPR_ARCH_32 1
+#endif /* _LP64 */
+#elif defined(_AIX)
+#define GPR_PLATFORM_STRING "aix"
+#ifndef _ALL_SOURCE
+#define _ALL_SOURCE
+#endif
+#define GPR_AIX 1
+#define GPR_CPU_POSIX 1
+#define GPR_GCC_ATOMIC 1
+#define GPR_GCC_TLS 1
+#define GPR_POSIX_LOG 1
+#define GPR_POSIX_ENV 1
+#define GPR_POSIX_TMPFILE 1
+#define GPR_POSIX_STRING 1
+#define GPR_POSIX_SUBPROCESS 1
+#define GPR_POSIX_SYNC 1
+#define GPR_POSIX_TIME 1
+#define GPR_GETPID_IN_UNISTD_H 1
+#ifdef _LP64
+#define GPR_ARCH_64 1
+#else /* _LP64 */
+#define GPR_ARCH_32 1
+#endif /* _LP64 */
 #elif defined(__native_client__)
 #define GPR_PLATFORM_STRING "nacl"
 #ifndef _BSD_SOURCE
diff --git a/include/grpcpp/opencensus.h b/include/grpcpp/opencensus.h
index 7e5d1df..07a1333 100644
--- a/include/grpcpp/opencensus.h
+++ b/include/grpcpp/opencensus.h
@@ -19,6 +19,12 @@
 #ifndef GRPCPP_OPENCENSUS_H
 #define GRPCPP_OPENCENSUS_H
 
+#ifndef GRPC_BAZEL_BUILD
+#error OpenCensus for gRPC is only supported when building with bazel.
+#endif
+
+#include "opencensus/trace/span.h"
+
 namespace grpc {
 // These symbols in this file will not be included in the binary unless
 // grpc_opencensus_plugin build target was added as a dependency. At the moment
@@ -36,6 +42,11 @@
 // ViewDescriptors below.
 void RegisterOpenCensusViewsForExport();
 
+class ServerContext;
+
+// Returns the tracing Span for the current RPC.
+::opencensus::trace::Span GetSpanFromServerContext(ServerContext* context);
+
 }  // namespace grpc
 
 #endif  // GRPCPP_OPENCENSUS_H
diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc
index b8fe017..0205363 100644
--- a/src/core/lib/iomgr/ev_posix.cc
+++ b/src/core/lib/iomgr/ev_posix.cc
@@ -59,7 +59,14 @@
 
 /** Default poll() function - a pointer so that it can be overridden by some
  *  tests */
+#ifndef GPR_AIX
 grpc_poll_function_type grpc_poll_function = poll;
+#else
+int aix_poll(struct pollfd fds[], nfds_t nfds, int timeout) {
+  return poll(fds, nfds, timeout);
+}
+grpc_poll_function_type grpc_poll_function = aix_poll;
+#endif
 
 grpc_wakeup_fd grpc_global_wakeup_fd;
 
diff --git a/src/core/lib/iomgr/port.h b/src/core/lib/iomgr/port.h
index 1d0ecff..066417b 100644
--- a/src/core/lib/iomgr/port.h
+++ b/src/core/lib/iomgr/port.h
@@ -140,6 +140,18 @@
 #define GRPC_POSIX_SOCKET 1
 #define GRPC_POSIX_SOCKETUTILS 1
 #define GRPC_POSIX_WAKEUP_FD 1
+#elif defined(GPR_SOLARIS)
+#define GRPC_HAVE_UNIX_SOCKET 1
+#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
+#define GRPC_POSIX_SOCKET 1
+#define GRPC_POSIX_SOCKETUTILS 1
+#define GRPC_POSIX_WAKEUP_FD 1
+#elif defined(GPR_AIX)
+#define GRPC_HAVE_UNIX_SOCKET 1
+#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
+#define GRPC_POSIX_SOCKET 1
+#define GRPC_POSIX_SOCKETUTILS 1
+#define GRPC_POSIX_WAKEUP_FD 1
 #elif defined(GPR_NACL)
 #define GRPC_HAVE_ARPA_NAMESER 1
 #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
diff --git a/src/cpp/ext/filters/census/grpc_plugin.h b/src/cpp/ext/filters/census/grpc_plugin.h
index 7ff2e7a..9e319cb 100644
--- a/src/cpp/ext/filters/census/grpc_plugin.h
+++ b/src/cpp/ext/filters/census/grpc_plugin.h
@@ -24,15 +24,11 @@
 #include "absl/strings/string_view.h"
 #include "include/grpcpp/opencensus.h"
 #include "opencensus/stats/stats.h"
-#include "opencensus/trace/span.h"
 
 namespace grpc {
 
 class ServerContext;
 
-// Returns the tracing Span for the current RPC.
-::opencensus::trace::Span GetSpanFromServerContext(ServerContext* context);
-
 // The tag keys set when recording RPC stats.
 ::opencensus::stats::TagKey ClientMethodTagKey();
 ::opencensus::stats::TagKey ClientStatusTagKey();
diff --git a/src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php b/src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php
index 7515a01..5423368 100644
--- a/src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php
+++ b/src/php/tests/unit_tests/PersistentChannelTests/PersistentChannelTest.php
@@ -270,7 +270,7 @@
 
   public function testPersistentChannelDefaultOutBound1()
   {
-      $this->channel1 = new Grpc\Channel('localhost:10011', []);
+      $this->channel1 = new Grpc\Channel('localhost:10004', []);
       // Make channel1 not IDLE.
       $this->channel1->getConnectivityState(true);
       $this->waitUntilNotIdle($this->channel1);
@@ -280,7 +280,7 @@
       // Since channel1 is CONNECTING, channel 2 will not be persisted
       $channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
         null);
-      $this->channel2 = new Grpc\Channel('localhost:10011',
+      $this->channel2 = new Grpc\Channel('localhost:10004',
           ['credentials' => $channel_credentials]);
       $channel2_info = $this->channel2->getChannelInfo();
       $this->assertEquals(GRPC\CHANNEL_IDLE, $channel2_info['connectivity_status']);
@@ -295,7 +295,7 @@
 
   public function testPersistentChannelDefaultOutBound2()
   {
-      $this->channel1 = new Grpc\Channel('localhost:10011', []);
+      $this->channel1 = new Grpc\Channel('localhost:10005', []);
       $channel1_info = $this->channel1->getChannelInfo();
       $this->assertEquals(GRPC\CHANNEL_IDLE, $channel1_info['connectivity_status']);
 
@@ -303,7 +303,7 @@
       // gRPC channel. channel2 will not be persisted
       $channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
         null);
-      $this->channel2 = new Grpc\Channel('localhost:10011',
+      $this->channel2 = new Grpc\Channel('localhost:10005',
           ['credentials' => $channel_credentials]);
       $channel2_info = $this->channel2->getChannelInfo();
       $this->assertEquals(GRPC\CHANNEL_IDLE, $channel2_info['connectivity_status']);
@@ -318,7 +318,7 @@
 
   public function testPersistentChannelDefaultOutBound3()
   {
-      $this->channel1 = new Grpc\Channel('localhost:10011', []);
+      $this->channel1 = new Grpc\Channel('localhost:10006', []);
       $channel1_info = $this->channel1->getChannelInfo();
       $this->assertEquals(GRPC\CHANNEL_IDLE, $channel1_info['connectivity_status']);
 
@@ -327,7 +327,7 @@
       // channel2 can be persisted.
       $channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
         null);
-      $this->channel2 = new Grpc\Channel('localhost:10011',
+      $this->channel2 = new Grpc\Channel('localhost:10006',
         ['credentials' => $channel_credentials]);
       $channel2_info = $this->channel2->getChannelInfo();
       $this->assertEquals(GRPC\CHANNEL_IDLE, $channel2_info['connectivity_status']);
@@ -342,7 +342,7 @@
 
   public function testPersistentChannelTwoUpperBound()
   {
-      $this->channel1 = new Grpc\Channel('localhost:10011', [
+      $this->channel1 = new Grpc\Channel('localhost:10007', [
           "grpc_target_persist_bound" => 2,
       ]);
       $channel1_info = $this->channel1->getChannelInfo();
@@ -351,7 +351,7 @@
       // Since channel1 is IDLE, channel 1 will be deleted
       $channel_credentials = Grpc\ChannelCredentials::createSsl(null, null,
           null);
-      $this->channel2 = new Grpc\Channel('localhost:10011',
+      $this->channel2 = new Grpc\Channel('localhost:10007',
           ['credentials' => $channel_credentials]);
       $channel2_info = $this->channel2->getChannelInfo();
       $this->assertEquals(GRPC\CHANNEL_IDLE, $channel2_info['connectivity_status']);