aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-09-11 12:59:46 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-09-11 12:59:46 -0700
commit8648c0551fabb7ee49606d1157f95818704c7065 (patch)
tree2d1e2df58e0062aa53e059fcacea9002c1f8b191 /src/core
parentf29a38820735c332f1d16c5ae4b91e332a0ca5cc (diff)
parentebc7ef268ca9536af6a4c5be1c80bcc79665d4e9 (diff)
Merge branch 'immolating-conversion' of github.com:ctiller/grpc into immolating-conversion
Diffstat (limited to 'src/core')
-rw-r--r--src/core/iomgr/pollset_multipoller_with_poll_posix.c3
-rw-r--r--src/core/iomgr/tcp_posix.c10
-rw-r--r--src/core/support/cpu_posix.c8
-rw-r--r--src/core/support/log_posix.c2
-rw-r--r--src/core/support/time_posix.c4
5 files changed, 17 insertions, 10 deletions
diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c
index f1bc60ba4e..cae260cab0 100644
--- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c
+++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c
@@ -101,7 +101,8 @@ static void multipoll_with_poll_pollset_maybe_work(
gpr_timespec now, int allow_synchronous_callback) {
int timeout;
int r;
- size_t i, j, pfd_count, fd_count;
+ size_t i, j, fd_count;
+ nfds_t pfd_count;
pollset_hdr *h;
/* TODO(ctiller): inline some elements to avoid an allocation */
grpc_fd_watcher *watchers;
diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c
index 81f04494eb..68f469c368 100644
--- a/src/core/iomgr/tcp_posix.c
+++ b/src/core/iomgr/tcp_posix.c
@@ -61,6 +61,12 @@
#define SENDMSG_FLAGS 0
#endif
+#ifdef GPR_MSG_IOVLEN_TYPE
+typedef GPR_MSG_IOVLEN_TYPE msg_iovlen_type;
+#else
+typedef size_t msg_iovlen_type;
+#endif
+
int grpc_tcp_trace = 0;
typedef struct {
@@ -68,7 +74,7 @@ typedef struct {
grpc_fd *em_fd;
int fd;
int finished_edge;
- size_t iov_size; /* Number of slices to allocate per read attempt */
+ msg_iovlen_type iov_size; /* Number of slices to allocate per read attempt */
size_t slice_size;
gpr_refcount refcount;
@@ -265,7 +271,7 @@ static grpc_endpoint_op_status tcp_read(grpc_endpoint *ep,
static grpc_endpoint_op_status tcp_flush(grpc_tcp *tcp) {
struct msghdr msg;
struct iovec iov[MAX_WRITE_IOVEC];
- size_t iov_size;
+ msg_iovlen_type iov_size;
ssize_t sent_length;
size_t sending_length;
size_t trailing;
diff --git a/src/core/support/cpu_posix.c b/src/core/support/cpu_posix.c
index 99484e37fb..55d92c0555 100644
--- a/src/core/support/cpu_posix.c
+++ b/src/core/support/cpu_posix.c
@@ -44,11 +44,11 @@
static __thread char magic_thread_local;
-static int ncpus = 0;
+static long ncpus = 0;
static void init_ncpus() {
ncpus = sysconf(_SC_NPROCESSORS_ONLN);
- if (ncpus < 1) {
+ if (ncpus < 1 || ncpus > GPR_UINT32_MAX) {
gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1");
ncpus = 1;
}
@@ -57,7 +57,7 @@ static void init_ncpus() {
unsigned gpr_cpu_num_cores(void) {
static gpr_once once = GPR_ONCE_INIT;
gpr_once_init(&once, init_ncpus);
- return ncpus;
+ return (unsigned)ncpus;
}
/* This is a cheap, but good enough, pointer hash for sharding things: */
@@ -71,7 +71,7 @@ unsigned gpr_cpu_current_cpu(void) {
most code that's using this is using it to shard across work queues though,
so here we use thread identity instead to achieve a similar though not
identical effect */
- return shard_ptr(&magic_thread_local);
+ return (unsigned)shard_ptr(&magic_thread_local);
}
#endif /* GPR_CPU_POSIX */
diff --git a/src/core/support/log_posix.c b/src/core/support/log_posix.c
index 940ee20f15..021c4666d4 100644
--- a/src/core/support/log_posix.c
+++ b/src/core/support/log_posix.c
@@ -62,7 +62,7 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
} else if ((size_t)ret <= sizeof(buf) - 1) {
message = buf;
} else {
- message = allocated = gpr_malloc(ret + 1);
+ message = allocated = gpr_malloc((size_t)ret + 1);
va_start(args, format);
vsnprintf(message, ret + 1, format, args);
va_end(args);
diff --git a/src/core/support/time_posix.c b/src/core/support/time_posix.c
index a274400243..dcecff0d05 100644
--- a/src/core/support/time_posix.c
+++ b/src/core/support/time_posix.c
@@ -108,8 +108,8 @@ gpr_timespec gpr_now(gpr_clock_type clock) {
break;
case GPR_CLOCK_MONOTONIC:
now_dbl = (mach_absolute_time() - g_time_start) * g_time_scale;
- now.tv_sec = now_dbl * 1e-9;
- now.tv_nsec = now_dbl - now.tv_sec * 1e9;
+ now.tv_sec = (time_t)(now_dbl * 1e-9);
+ now.tv_nsec = (int)(now_dbl - ((double)now.tv_sec) * 1e9);
break;
case GPR_CLOCK_PRECISE:
gpr_precise_clock_now(&now);