aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-02 07:46:55 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-02 07:52:49 -0800
commite1a03a61c214086897a85c364d19b87cc900511a (patch)
tree0e30d904017fdbf7a9d1d2d4302fb235f20a2079 /src/core
parentc8fd2d1c01f81c4a4f8a6b8a239e0f809fd1001d (diff)
Make _posix usage match 'the rules'
Also fix log_posix to get things compiling.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/iomgr/wakeup_fd.h59
-rw-r--r--src/core/iomgr/wakeup_fd_nospecial.c4
-rw-r--r--src/core/iomgr/wakeup_fd_pipe.c4
-rw-r--r--src/core/iomgr/wakeup_fd_pipe.h4
-rw-r--r--src/core/iomgr/wakeup_fd_posix.c8
-rw-r--r--src/core/iomgr/wakeup_fd_posix.h33
-rw-r--r--src/core/support/log_posix.c2
7 files changed, 35 insertions, 79 deletions
diff --git a/src/core/iomgr/wakeup_fd.h b/src/core/iomgr/wakeup_fd.h
deleted file mode 100644
index 2c6f79608d..0000000000
--- a/src/core/iomgr/wakeup_fd.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER 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.
- *
- */
-
-#ifndef __GRPC_INTERNAL_IOMGR_WAKEUP_FD_H_
-#define __GRPC_INTERNAL_IOMGR_WAKEUP_FD_H_
-
-typedef struct grpc_wakeup_fd_info grpc_wakeup_fd_info;
-
-typedef struct grpc_wakeup_fd_vtable {
- void (*create)(grpc_wakeup_fd_info *fd_info);
- void (*consume)(grpc_wakeup_fd_info *fd_info);
- void (*wakeup)(grpc_wakeup_fd_info *fd_info);
- void (*destroy)(grpc_wakeup_fd_info *fd_info);
- /* Must be called before calling any other functions */
- int (*check_availability)(void);
-} grpc_wakeup_fd_vtable;
-
-/* Private structures; don't access their fields directly outside of wakeup fd
- * code. */
-struct grpc_wakeup_fd_info {
- int read_fd;
- int write_fd;
-};
-
-/* Defined in some specialized implementation's .c file, or by
- * wakeup_fd_nospecial.c if no such implementation exists. */
-extern const grpc_wakeup_fd_vtable specialized_wakeup_fd_vtable;
-
-#endif /* __GRPC_INTERNAL_IOMGR_WAKEUP_FD_POSIX_H_ */
diff --git a/src/core/iomgr/wakeup_fd_nospecial.c b/src/core/iomgr/wakeup_fd_nospecial.c
index c98c117188..c1038bf379 100644
--- a/src/core/iomgr/wakeup_fd_nospecial.c
+++ b/src/core/iomgr/wakeup_fd_nospecial.c
@@ -40,14 +40,14 @@
#ifdef GPR_POSIX_NO_SPECIAL_WAKEUP_FD
-#include "src/core/iomgr/wakeup_fd.h"
+#include "src/core/iomgr/wakeup_fd_posix.h"
#include <stddef.h>
static int check_availability_invalid(void) {
return 0;
}
-const grpc_wakeup_fd_vtable specialized_wakeup_fd_vtable = {
+const grpc_wakeup_fd_vtable grpc_specialized_wakeup_fd_vtable = {
NULL, NULL, NULL, NULL, check_availability_invalid
};
diff --git a/src/core/iomgr/wakeup_fd_pipe.c b/src/core/iomgr/wakeup_fd_pipe.c
index 63be51133e..f895478990 100644
--- a/src/core/iomgr/wakeup_fd_pipe.c
+++ b/src/core/iomgr/wakeup_fd_pipe.c
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_WAKEUP_FD
-#include "src/core/iomgr/wakeup_fd.h"
+#include "src/core/iomgr/wakeup_fd_posix.h"
#include <errno.h>
#include <string.h>
@@ -90,7 +90,7 @@ static int pipe_check_availability(void) {
return 1;
}
-const grpc_wakeup_fd_vtable pipe_wakeup_fd_vtable = {
+const grpc_wakeup_fd_vtable grpc_pipe_wakeup_fd_vtable = {
pipe_create, pipe_consume, pipe_wakeup, pipe_destroy, pipe_check_availability
};
diff --git a/src/core/iomgr/wakeup_fd_pipe.h b/src/core/iomgr/wakeup_fd_pipe.h
index 8e2ed85885..a2fcde5b55 100644
--- a/src/core/iomgr/wakeup_fd_pipe.h
+++ b/src/core/iomgr/wakeup_fd_pipe.h
@@ -34,8 +34,8 @@
#ifndef __GRPC_INTERNAL_IOMGR_WAKEUP_FD_PIPE_H_
#define __GRPC_INTERNAL_IOMGR_WAKEUP_FD_PIPE_H_
-#include "src/core/iomgr/wakeup_fd.h"
+#include "src/core/iomgr/wakeup_fd_posix.h"
-extern grpc_wakeup_fd_vtable pipe_wakeup_fd_vtable;
+extern grpc_wakeup_fd_vtable grpc_pipe_wakeup_fd_vtable;
#endif /* __GRPC_INTERNAL_IOMGR_WAKEUP_FD_PIPE_H_ */
diff --git a/src/core/iomgr/wakeup_fd_posix.c b/src/core/iomgr/wakeup_fd_posix.c
index f495fb1fd7..d3cc3ec570 100644
--- a/src/core/iomgr/wakeup_fd_posix.c
+++ b/src/core/iomgr/wakeup_fd_posix.c
@@ -42,15 +42,15 @@
static const grpc_wakeup_fd_vtable *wakeup_fd_vtable = NULL;
void grpc_wakeup_fd_global_init(void) {
- if (specialized_wakeup_fd_vtable.check_availability()) {
- wakeup_fd_vtable = &specialized_wakeup_fd_vtable;
+ if (grpc_specialized_wakeup_fd_vtable.check_availability()) {
+ wakeup_fd_vtable = &grpc_specialized_wakeup_fd_vtable;
} else {
- wakeup_fd_vtable = &pipe_wakeup_fd_vtable;
+ wakeup_fd_vtable = &grpc_pipe_wakeup_fd_vtable;
}
}
void grpc_wakeup_fd_global_init_force_fallback(void) {
- wakeup_fd_vtable = &pipe_wakeup_fd_vtable;
+ wakeup_fd_vtable = &grpc_pipe_wakeup_fd_vtable;
}
void grpc_wakeup_fd_global_destroy(void) {
diff --git a/src/core/iomgr/wakeup_fd_posix.h b/src/core/iomgr/wakeup_fd_posix.h
index 3aed98ff59..322e219394 100644
--- a/src/core/iomgr/wakeup_fd_posix.h
+++ b/src/core/iomgr/wakeup_fd_posix.h
@@ -62,25 +62,40 @@
#ifndef __GRPC_INTERNAL_IOMGR_WAKEUP_FD_POSIX_H_
#define __GRPC_INTERNAL_IOMGR_WAKEUP_FD_POSIX_H_
-#include "src/core/iomgr/wakeup_fd.h"
-
void grpc_wakeup_fd_global_init(void);
void grpc_wakeup_fd_global_destroy(void);
+/* Force using the fallback implementation. This is intended for testing
+ * purposes only.*/
+void grpc_wakeup_fd_global_init_force_fallback(void);
+
+typedef struct grpc_wakeup_fd_info grpc_wakeup_fd_info;
+
+typedef struct grpc_wakeup_fd_vtable {
+ void (*create)(grpc_wakeup_fd_info *fd_info);
+ void (*consume)(grpc_wakeup_fd_info *fd_info);
+ void (*wakeup)(grpc_wakeup_fd_info *fd_info);
+ void (*destroy)(grpc_wakeup_fd_info *fd_info);
+ /* Must be called before calling any other functions */
+ int (*check_availability)(void);
+} grpc_wakeup_fd_vtable;
+
+/* Private structures; don't access their fields directly outside of wakeup fd
+ * code. */
+struct grpc_wakeup_fd_info {
+ int read_fd;
+ int write_fd;
+};
+
+#define GRPC_WAKEUP_FD_GET_READ_FD(fd_info) ((fd_info)->read_fd)
void grpc_wakeup_fd_create(grpc_wakeup_fd_info *fd_info);
void grpc_wakeup_fd_consume_wakeup(grpc_wakeup_fd_info *fd_info);
void grpc_wakeup_fd_wakeup(grpc_wakeup_fd_info *fd_info);
void grpc_wakeup_fd_destroy(grpc_wakeup_fd_info *fd_info);
-#define GRPC_WAKEUP_FD_GET_READ_FD(fd_info) ((fd_info)->read_fd)
-
-/* Force using the fallback implementation. This is intended for testing
- * purposes only.*/
-void grpc_wakeup_fd_global_init_force_fallback(void);
-
/* Defined in some specialized implementation's .c file, or by
* wakeup_fd_nospecial.c if no such implementation exists. */
-extern const grpc_wakeup_fd_vtable specialized_wakeup_fd_vtable;
+extern const grpc_wakeup_fd_vtable grpc_specialized_wakeup_fd_vtable;
#endif /* __GRPC_INTERNAL_IOMGR_WAKEUP_FD_POSIX_H_ */
diff --git a/src/core/support/log_posix.c b/src/core/support/log_posix.c
index 1292c9e8c3..ab2d2e5a74 100644
--- a/src/core/support/log_posix.c
+++ b/src/core/support/log_posix.c
@@ -64,7 +64,7 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
va_end(args);
if (ret < 0) {
message = NULL;
- } else if (ret <= sizeof(buf) - 1) {
+ } else if ((size_t)ret <= sizeof(buf) - 1) {
message = buf;
} else {
message = allocated = gpr_malloc(ret + 1);