aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/iomgr
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/iomgr')
-rw-r--r--src/core/iomgr/endpoint.h4
-rw-r--r--src/core/iomgr/endpoint_pair_posix.c6
-rw-r--r--src/core/iomgr/endpoint_pair_windows.c8
-rw-r--r--src/core/iomgr/fd_posix.h4
-rw-r--r--src/core/iomgr/iocp_windows.c4
-rw-r--r--src/core/iomgr/iomgr_internal.h2
-rw-r--r--src/core/iomgr/iomgr_posix.c4
-rw-r--r--src/core/iomgr/iomgr_windows.c4
-rw-r--r--src/core/iomgr/pollset_windows.c2
-rw-r--r--src/core/iomgr/sockaddr_posix.h4
-rw-r--r--src/core/iomgr/sockaddr_win32.h2
-rw-r--r--src/core/iomgr/socket_utils_common_posix.c14
-rw-r--r--src/core/iomgr/socket_utils_linux.c4
-rw-r--r--src/core/iomgr/socket_utils_posix.h2
-rw-r--r--src/core/iomgr/socket_windows.c4
-rw-r--r--src/core/iomgr/socket_windows.h4
-rw-r--r--src/core/iomgr/tcp_client.h2
-rw-r--r--src/core/iomgr/tcp_client_windows.c6
-rw-r--r--src/core/iomgr/tcp_posix.c4
-rw-r--r--src/core/iomgr/tcp_server_posix.c33
-rw-r--r--src/core/iomgr/tcp_windows.c14
-rw-r--r--src/core/iomgr/timer.h4
-rw-r--r--src/core/iomgr/udp_server.c11
-rw-r--r--src/core/iomgr/unix_sockets_posix.c2
-rw-r--r--src/core/iomgr/wakeup_fd_nospecial.c4
-rw-r--r--src/core/iomgr/wakeup_fd_posix.c6
-rw-r--r--src/core/iomgr/workqueue.h4
27 files changed, 84 insertions, 78 deletions
diff --git a/src/core/iomgr/endpoint.h b/src/core/iomgr/endpoint.h
index 788f3ac5bc..b4be852e33 100644
--- a/src/core/iomgr/endpoint.h
+++ b/src/core/iomgr/endpoint.h
@@ -34,11 +34,11 @@
#ifndef GRPC_CORE_IOMGR_ENDPOINT_H
#define GRPC_CORE_IOMGR_ENDPOINT_H
-#include "src/core/iomgr/pollset.h"
-#include "src/core/iomgr/pollset_set.h"
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
#include <grpc/support/time.h>
+#include "src/core/iomgr/pollset.h"
+#include "src/core/iomgr/pollset_set.h"
/* An endpoint caps a streaming channel between two communicating processes.
Examples may be: a tcp socket, <stdin+stdout>, or some shared memory. */
diff --git a/src/core/iomgr/endpoint_pair_posix.c b/src/core/iomgr/endpoint_pair_posix.c
index f84b8441df..66d19a486c 100644
--- a/src/core/iomgr/endpoint_pair_posix.c
+++ b/src/core/iomgr/endpoint_pair_posix.c
@@ -42,14 +42,14 @@
#include <errno.h>
#include <fcntl.h>
#include <string.h>
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
-#include "src/core/iomgr/tcp_posix.h"
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/iomgr/tcp_posix.h"
+#include "src/core/support/string.h"
static void create_sockets(int sv[2]) {
int flags;
diff --git a/src/core/iomgr/endpoint_pair_windows.c b/src/core/iomgr/endpoint_pair_windows.c
index db9d092dca..2024f58143 100644
--- a/src/core/iomgr/endpoint_pair_windows.c
+++ b/src/core/iomgr/endpoint_pair_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,16 +34,16 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_WINSOCK_SOCKET
-#include "src/core/iomgr/sockaddr_utils.h"
#include "src/core/iomgr/endpoint_pair.h"
+#include "src/core/iomgr/sockaddr_utils.h"
#include <errno.h>
#include <fcntl.h>
#include <string.h>
-#include "src/core/iomgr/tcp_windows.h"
-#include "src/core/iomgr/socket_windows.h"
#include <grpc/support/log.h>
+#include "src/core/iomgr/socket_windows.h"
+#include "src/core/iomgr/tcp_windows.h"
static void create_sockets(SOCKET sv[2]) {
SOCKET svr_sock = INVALID_SOCKET;
diff --git a/src/core/iomgr/fd_posix.h b/src/core/iomgr/fd_posix.h
index a5c8ff1d9a..1993ada79f 100644
--- a/src/core/iomgr/fd_posix.h
+++ b/src/core/iomgr/fd_posix.h
@@ -34,11 +34,11 @@
#ifndef GRPC_CORE_IOMGR_FD_POSIX_H
#define GRPC_CORE_IOMGR_FD_POSIX_H
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/pollset.h"
#include <grpc/support/atm.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
+#include "src/core/iomgr/iomgr_internal.h"
+#include "src/core/iomgr/pollset.h"
typedef struct grpc_fd grpc_fd;
diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c
index fa87e5246b..37e277dcc1 100644
--- a/src/core/iomgr/iocp_windows.c
+++ b/src/core/iomgr/iocp_windows.c
@@ -37,15 +37,15 @@
#include <winsock2.h>
+#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_win32.h>
-#include <grpc/support/alloc.h>
#include <grpc/support/thd.h>
-#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/socket_windows.h"
+#include "src/core/iomgr/timer.h"
static ULONG g_iocp_kick_token;
static OVERLAPPED g_iocp_custom_overlap;
diff --git a/src/core/iomgr/iomgr_internal.h b/src/core/iomgr/iomgr_internal.h
index d06b068b1c..1cad3182ec 100644
--- a/src/core/iomgr/iomgr_internal.h
+++ b/src/core/iomgr/iomgr_internal.h
@@ -36,8 +36,8 @@
#include <stdbool.h>
-#include "src/core/iomgr/iomgr.h"
#include <grpc/support/sync.h>
+#include "src/core/iomgr/iomgr.h"
typedef struct grpc_iomgr_object {
char *name;
diff --git a/src/core/iomgr/iomgr_posix.c b/src/core/iomgr/iomgr_posix.c
index fecb7b9760..2f7f34746b 100644
--- a/src/core/iomgr/iomgr_posix.c
+++ b/src/core/iomgr/iomgr_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,9 +35,9 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/iomgr_posix.h"
#include "src/core/debug/trace.h"
#include "src/core/iomgr/fd_posix.h"
+#include "src/core/iomgr/iomgr_posix.h"
#include "src/core/iomgr/tcp_posix.h"
void grpc_iomgr_platform_init(void) {
diff --git a/src/core/iomgr/iomgr_windows.c b/src/core/iomgr/iomgr_windows.c
index 14775516bb..2d104130f7 100644
--- a/src/core/iomgr/iomgr_windows.c
+++ b/src/core/iomgr/iomgr_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,9 +39,9 @@
#include <grpc/support/log.h>
-#include "src/core/iomgr/socket_windows.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/iomgr.h"
+#include "src/core/iomgr/socket_windows.h"
/* Windows' io manager is going to be fully designed using IO completion
ports. All of what we're doing here is basically make sure that
diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c
index c7f30f435f..1a99224c80 100644
--- a/src/core/iomgr/pollset_windows.c
+++ b/src/core/iomgr/pollset_windows.c
@@ -38,8 +38,8 @@
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
-#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/iocp_windows.h"
+#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/pollset.h"
#include "src/core/iomgr/pollset_windows.h"
diff --git a/src/core/iomgr/sockaddr_posix.h b/src/core/iomgr/sockaddr_posix.h
index e4425ed735..a398096837 100644
--- a/src/core/iomgr/sockaddr_posix.h
+++ b/src/core/iomgr/sockaddr_posix.h
@@ -35,10 +35,10 @@
#define GRPC_CORE_IOMGR_SOCKADDR_POSIX_H
#include <arpa/inet.h>
+#include <netdb.h>
+#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
-#include <netinet/in.h>
-#include <netdb.h>
#include <unistd.h>
#endif /* GRPC_CORE_IOMGR_SOCKADDR_POSIX_H */
diff --git a/src/core/iomgr/sockaddr_win32.h b/src/core/iomgr/sockaddr_win32.h
index 7acb8f7f57..ef306e3cc3 100644
--- a/src/core/iomgr/sockaddr_win32.h
+++ b/src/core/iomgr/sockaddr_win32.h
@@ -36,6 +36,8 @@
#include <winsock2.h>
#include <ws2tcpip.h>
+
+// must be included after the above
#include <mswsock.h>
#endif /* GRPC_CORE_IOMGR_SOCKADDR_WIN32_H */
diff --git a/src/core/iomgr/socket_utils_common_posix.c b/src/core/iomgr/socket_utils_common_posix.c
index a9af594700..570daccc9e 100644
--- a/src/core/iomgr/socket_utils_common_posix.c
+++ b/src/core/iomgr/socket_utils_common_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,23 +38,23 @@
#include "src/core/iomgr/socket_utils_posix.h"
#include <arpa/inet.h>
-#include <limits.h>
+#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <stdio.h>
-#include <sys/types.h>
+#include <string.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/support/string.h"
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
+#include "src/core/iomgr/sockaddr_utils.h"
+#include "src/core/support/string.h"
/* set a socket to non blocking mode */
int grpc_set_socket_nonblocking(int fd, int non_blocking) {
diff --git a/src/core/iomgr/socket_utils_linux.c b/src/core/iomgr/socket_utils_linux.c
index a87625262b..e16885f231 100644
--- a/src/core/iomgr/socket_utils_linux.c
+++ b/src/core/iomgr/socket_utils_linux.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,8 +37,8 @@
#include "src/core/iomgr/socket_utils_posix.h"
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen,
int nonblock, int cloexec) {
diff --git a/src/core/iomgr/socket_utils_posix.h b/src/core/iomgr/socket_utils_posix.h
index b01e28b6f2..3908550380 100644
--- a/src/core/iomgr/socket_utils_posix.h
+++ b/src/core/iomgr/socket_utils_posix.h
@@ -34,8 +34,8 @@
#ifndef GRPC_CORE_IOMGR_SOCKET_UTILS_POSIX_H
#define GRPC_CORE_IOMGR_SOCKET_UTILS_POSIX_H
-#include <unistd.h>
#include <sys/socket.h>
+#include <unistd.h>
/* a wrapper for accept or accept4 */
int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen,
diff --git a/src/core/iomgr/socket_windows.c b/src/core/iomgr/socket_windows.c
index fafb7b6622..c1f419e273 100644
--- a/src/core/iomgr/socket_windows.c
+++ b/src/core/iomgr/socket_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,8 @@
#ifdef GPR_WINSOCK_SOCKET
#include <winsock2.h>
+
+// must be included after winsock2.h
#include <mswsock.h>
#include <grpc/support/alloc.h>
diff --git a/src/core/iomgr/socket_windows.h b/src/core/iomgr/socket_windows.h
index 8e50e7a953..6fe3c6e080 100644
--- a/src/core/iomgr/socket_windows.h
+++ b/src/core/iomgr/socket_windows.h
@@ -37,11 +37,11 @@
#include <grpc/support/port_platform.h>
#include <winsock2.h>
-#include <grpc/support/sync.h>
#include <grpc/support/atm.h>
+#include <grpc/support/sync.h>
-#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/iomgr/iomgr_internal.h"
/* This holds the data for an outstanding read or write on a socket.
The mutex to protect the concurrent access to that data is the one
diff --git a/src/core/iomgr/tcp_client.h b/src/core/iomgr/tcp_client.h
index 2e29833b70..c36f8de713 100644
--- a/src/core/iomgr/tcp_client.h
+++ b/src/core/iomgr/tcp_client.h
@@ -34,10 +34,10 @@
#ifndef GRPC_CORE_IOMGR_TCP_CLIENT_H
#define GRPC_CORE_IOMGR_TCP_CLIENT_H
+#include <grpc/support/time.h>
#include "src/core/iomgr/endpoint.h"
#include "src/core/iomgr/pollset_set.h"
#include "src/core/iomgr/sockaddr.h"
-#include <grpc/support/time.h>
/* Asynchronously connect to an address (specified as (addr, len)), and call
cb with arg and the completed connection when done (or call cb with arg and
diff --git a/src/core/iomgr/tcp_client_windows.c b/src/core/iomgr/tcp_client_windows.c
index 689c6f7b10..da83f7b79c 100644
--- a/src/core/iomgr/tcp_client_windows.c
+++ b/src/core/iomgr/tcp_client_windows.c
@@ -43,13 +43,13 @@
#include <grpc/support/slice_buffer.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/iocp_windows.h"
-#include "src/core/iomgr/tcp_client.h"
-#include "src/core/iomgr/tcp_windows.h"
#include "src/core/iomgr/sockaddr.h"
#include "src/core/iomgr/sockaddr_utils.h"
#include "src/core/iomgr/socket_windows.h"
+#include "src/core/iomgr/tcp_client.h"
+#include "src/core/iomgr/tcp_windows.h"
+#include "src/core/iomgr/timer.h"
typedef struct {
grpc_closure *on_done;
diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c
index f74eb3fe51..e8f73811ce 100644
--- a/src/core/iomgr/tcp_posix.c
+++ b/src/core/iomgr/tcp_posix.c
@@ -297,7 +297,7 @@ static flush_result tcp_flush(grpc_tcp *tcp) {
unwind_slice_idx = tcp->outgoing_slice_idx;
unwind_byte_idx = tcp->outgoing_byte_idx;
for (iov_size = 0; tcp->outgoing_slice_idx != tcp->outgoing_buffer->count &&
- iov_size != MAX_WRITE_IOVEC;
+ iov_size != MAX_WRITE_IOVEC;
iov_size++) {
iov[iov_size].iov_base =
GPR_SLICE_START_PTR(
@@ -446,7 +446,7 @@ static char *tcp_get_peer(grpc_endpoint *ep) {
}
static const grpc_endpoint_vtable vtable = {
- tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set,
+ tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set,
tcp_shutdown, tcp_destroy, tcp_get_peer};
grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size,
diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c
index 03dfddd925..74ee68a6f1 100644
--- a/src/core/iomgr/tcp_server_posix.c
+++ b/src/core/iomgr/tcp_server_posix.c
@@ -54,6 +54,11 @@
#include <sys/types.h>
#include <unistd.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+#include <grpc/support/sync.h>
+#include <grpc/support/time.h>
#include "src/core/iomgr/pollset_posix.h"
#include "src/core/iomgr/resolve_address.h"
#include "src/core/iomgr/sockaddr_utils.h"
@@ -61,11 +66,6 @@
#include "src/core/iomgr/tcp_posix.h"
#include "src/core/iomgr/unix_sockets_posix.h"
#include "src/core/support/string.h"
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-#include <grpc/support/sync.h>
-#include <grpc/support/time.h>
#define MIN_SAFE_ACCEPT_QUEUE_SIZE 100
@@ -486,7 +486,6 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
/* If we didn't get a dualstack socket, also listen on 0.0.0.0. */
if (port == 0 && sp != NULL) {
grpc_sockaddr_set_port((struct sockaddr *)&wild4, sp->port);
- sp2 = sp;
}
addr = (struct sockaddr *)&wild4;
addr_len = sizeof(wild4);
@@ -495,16 +494,18 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
fd = grpc_create_dualstack_socket(addr, SOCK_STREAM, 0, &dsmode);
if (fd < 0) {
gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno));
- }
- if (dsmode == GRPC_DSMODE_IPV4 &&
- grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) {
- addr = (struct sockaddr *)&addr4_copy;
- addr_len = sizeof(addr4_copy);
- }
- sp = add_socket_to_server(s, fd, addr, addr_len, port_index, fd_index);
- if (sp2 != NULL && sp != NULL) {
- sp2->sibling = sp;
- sp->is_sibling = 1;
+ } else {
+ if (dsmode == GRPC_DSMODE_IPV4 &&
+ grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) {
+ addr = (struct sockaddr *)&addr4_copy;
+ addr_len = sizeof(addr4_copy);
+ }
+ sp2 = sp;
+ sp = add_socket_to_server(s, fd, addr, addr_len, port_index, fd_index);
+ if (sp2 != NULL && sp != NULL) {
+ sp2->sibling = sp;
+ sp->is_sibling = 1;
+ }
}
done:
diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c
index 038e4158c8..9b1db5fa7e 100644
--- a/src/core/iomgr/tcp_windows.c
+++ b/src/core/iomgr/tcp_windows.c
@@ -44,12 +44,12 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/sockaddr.h"
#include "src/core/iomgr/sockaddr_utils.h"
#include "src/core/iomgr/socket_windows.h"
#include "src/core/iomgr/tcp_client.h"
+#include "src/core/iomgr/timer.h"
static int set_non_block(SOCKET sock) {
int status;
@@ -146,8 +146,8 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, bool success) {
grpc_winsocket_callback_info *info = &socket->read_info;
if (success) {
- if (socket->read_info.wsa_error != 0 && !tcp->shutting_down) {
- if (socket->read_info.wsa_error != WSAECONNRESET) {
+ if (info->wsa_error != 0 && !tcp->shutting_down) {
+ if (info->wsa_error != WSAECONNRESET) {
char *utf8_message = gpr_format_message(info->wsa_error);
gpr_log(GPR_ERROR, "ReadFile overlapped error: %s", utf8_message);
gpr_free(utf8_message);
@@ -306,7 +306,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
ok = true;
GPR_ASSERT(bytes_sent == tcp->write_slices->length);
} else {
- if (socket->read_info.wsa_error != WSAECONNRESET) {
+ if (info->wsa_error != WSAECONNRESET) {
char *utf8_message = gpr_format_message(info->wsa_error);
gpr_log(GPR_ERROR, "WSASend error: %s", utf8_message);
gpr_free(utf8_message);
@@ -382,9 +382,9 @@ static char *win_get_peer(grpc_endpoint *ep) {
return gpr_strdup(tcp->peer_string);
}
-static grpc_endpoint_vtable vtable = {win_read, win_write, win_add_to_pollset,
- win_add_to_pollset_set, win_shutdown,
- win_destroy, win_get_peer};
+static grpc_endpoint_vtable vtable = {
+ win_read, win_write, win_add_to_pollset, win_add_to_pollset_set,
+ win_shutdown, win_destroy, win_get_peer};
grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, char *peer_string) {
grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp));
diff --git a/src/core/iomgr/timer.h b/src/core/iomgr/timer.h
index 63505df427..1e2d1cbfbd 100644
--- a/src/core/iomgr/timer.h
+++ b/src/core/iomgr/timer.h
@@ -34,10 +34,10 @@
#ifndef GRPC_CORE_IOMGR_TIMER_H
#define GRPC_CORE_IOMGR_TIMER_H
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
+#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/iomgr/iomgr.h"
typedef struct grpc_timer {
gpr_timespec deadline;
diff --git a/src/core/iomgr/udp_server.c b/src/core/iomgr/udp_server.c
index efedd9f32e..174159170f 100644
--- a/src/core/iomgr/udp_server.c
+++ b/src/core/iomgr/udp_server.c
@@ -54,6 +54,12 @@
#include <sys/types.h>
#include <unistd.h>
+#include <grpc/grpc.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+#include <grpc/support/sync.h>
+#include <grpc/support/time.h>
#include "src/core/iomgr/fd_posix.h"
#include "src/core/iomgr/pollset_posix.h"
#include "src/core/iomgr/resolve_address.h"
@@ -61,11 +67,6 @@
#include "src/core/iomgr/socket_utils_posix.h"
#include "src/core/iomgr/unix_sockets_posix.h"
#include "src/core/support/string.h"
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/sync.h>
-#include <grpc/support/string_util.h>
-#include <grpc/support/time.h>
#define INIT_PORT_CAP 2
diff --git a/src/core/iomgr/unix_sockets_posix.c b/src/core/iomgr/unix_sockets_posix.c
index 480ff613f6..174a7e7abf 100644
--- a/src/core/iomgr/unix_sockets_posix.c
+++ b/src/core/iomgr/unix_sockets_posix.c
@@ -36,8 +36,8 @@
#ifdef GPR_HAVE_UNIX_SOCKET
#include <string.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <sys/un.h>
#include <grpc/support/alloc.h>
diff --git a/src/core/iomgr/wakeup_fd_nospecial.c b/src/core/iomgr/wakeup_fd_nospecial.c
index 78d763c103..7b2be9ed52 100644
--- a/src/core/iomgr/wakeup_fd_nospecial.c
+++ b/src/core/iomgr/wakeup_fd_nospecial.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,8 +40,8 @@
#ifdef GPR_POSIX_NO_SPECIAL_WAKEUP_FD
-#include "src/core/iomgr/wakeup_fd_posix.h"
#include <stddef.h>
+#include "src/core/iomgr/wakeup_fd_posix.h"
static int check_availability_invalid(void) { return 0; }
diff --git a/src/core/iomgr/wakeup_fd_posix.c b/src/core/iomgr/wakeup_fd_posix.c
index f40be081b0..07778c408e 100644
--- a/src/core/iomgr/wakeup_fd_posix.c
+++ b/src/core/iomgr/wakeup_fd_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,9 +35,9 @@
#ifdef GPR_POSIX_WAKEUP_FD
-#include "src/core/iomgr/wakeup_fd_posix.h"
-#include "src/core/iomgr/wakeup_fd_pipe.h"
#include <stddef.h>
+#include "src/core/iomgr/wakeup_fd_pipe.h"
+#include "src/core/iomgr/wakeup_fd_posix.h"
static const grpc_wakeup_fd_vtable *wakeup_fd_vtable = NULL;
int grpc_allow_specialized_wakeup_fd = 1;
diff --git a/src/core/iomgr/workqueue.h b/src/core/iomgr/workqueue.h
index 2ba1e5d9a2..2b923ba152 100644
--- a/src/core/iomgr/workqueue.h
+++ b/src/core/iomgr/workqueue.h
@@ -34,10 +34,10 @@
#ifndef GRPC_CORE_IOMGR_WORKQUEUE_H
#define GRPC_CORE_IOMGR_WORKQUEUE_H
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/iomgr/pollset.h"
#include "src/core/iomgr/closure.h"
#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/iomgr/iomgr.h"
+#include "src/core/iomgr/pollset.h"
#ifdef GPR_POSIX_SOCKET
#include "src/core/iomgr/workqueue_posix.h"