📄 rpcrt4_ros.diff
字号:
Index: rpc_transport.c
===================================================================
--- rpc_transport.c (revision 27793)
+++ rpc_transport.c (working copy)
@@ -56,9 +56,6 @@
#include <sys/poll.h> #endif -#include <winsock2.h>-#include <ws2tcpip.h>- #include "windef.h" #include "winbase.h" #include "winnls.h"@@ -76,8 +73,6 @@
#include "rpc_server.h" #include "epm_towers.h" -#include "unix_func.h"- #ifndef SOL_TCP # define SOL_TCP IPPROTO_TCP #endif@@ -781,7 +776,7 @@
/* RPC depends on having minimal latency so disable the Nagle algorithm */ val = 1;- setsockopt(sock, SOL_TCP, TCP_NODELAY, (char *)&val, sizeof(val));+ setsockopt(sock, SOL_TCP, TCP_NODELAY, &val, sizeof(val)); tcpc->sock = sock; @@ -804,7 +799,6 @@
struct addrinfo *ai_cur; struct addrinfo hints; RpcConnection *first_connection = NULL;- u_long blocking; TRACE("(%p, %s)\n", protseq, endpoint); @@ -855,7 +849,7 @@
{ WARN("bind failed: %s\n", strerror(errno)); close(sock);- if (errno == WSAEADDRINUSE)+ if (errno == EADDRINUSE) status = RPC_S_DUPLICATE_ENDPOINT; else status = RPC_S_CANT_CREATE_ENDPOINT;@@ -884,8 +878,7 @@
* race-condition (poll() says it is readable, connection drops, * and accept() blocks until the next connection comes...) */- blocking = 1;- ret = ioctlsocket(sock, FIONBIO, &blocking);+ ret = fcntl(sock, F_SETFL, O_NONBLOCK); if (ret < 0) { WARN("couldn't make socket non-blocking, error %d\n", ret);@@ -928,7 +921,6 @@
int ret; struct sockaddr_in address; socklen_t addrsize;- u_long blocking; RpcConnection_tcp *server = (RpcConnection_tcp*) old_conn; RpcConnection_tcp *client = (RpcConnection_tcp*) new_conn; @@ -940,8 +932,7 @@
return RPC_S_OUT_OF_RESOURCES; } /* reset to blocking behaviour */- blocking = 0;- ret = ioctlsocket(ret, FIONBIO, &blocking);+ fcntl(ret, F_SETFL, 0); client->sock = ret; TRACE("Accepted a new TCP connection\n"); return RPC_S_OK;@@ -1125,12 +1116,10 @@
if (ps) { int fds[2];- u_long blocking; if (!socketpair(PF_UNIX, SOCK_DGRAM, 0, fds)) {- blocking = 1;- ioctlsocket(fds[0], FIONBIO, &blocking);- ioctlsocket(fds[1], FIONBIO, &blocking);+ fcntl(fds[0], F_SETFL, O_NONBLOCK);+ fcntl(fds[1], F_SETFL, O_NONBLOCK); ps->mgr_event_rcv = fds[0]; ps->mgr_event_snd = fds[1]; }@@ -1211,7 +1200,7 @@
if (!poll_info) return -1;-+ ret = poll(poll_info, count, -1); if (ret < 0) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -