repositories
/
deb_libnfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SOCKET: Use recv/send for all socket io on all platforms
[deb_libnfs.git]
/
lib
/
socket.c
diff --git
a/lib/socket.c
b/lib/socket.c
index 413ebbe4c8e4009cca6f0ccbc506a5a02b657014..6f626529be9a2c3d6c7b982a648e9edf806d2e2d 100644
(file)
--- a/
lib/socket.c
+++ b/
lib/socket.c
@@
-18,7
+18,6
@@
#include "win32_compat.h"
#else
#include <unistd.h>
#include "win32_compat.h"
#else
#include <unistd.h>
-#include <poll.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@@
-28,14
+27,21
@@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+
+#ifdef AROS
+#include "aros_compat.h"
+#endif
+
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
-#include <rpc/rpc.h>
-#include <rpc/xdr.h>
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
@@
-43,6
+49,7
@@
#include <sys/sockio.h>
#endif
#include <sys/types.h>
#include <sys/sockio.h>
#endif
#include <sys/types.h>
+#include "libnfs-zdr.h"
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-private.h"
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-private.h"
@@
-97,7
+104,7
@@
int rpc_which_events(struct rpc_context *rpc)
static int rpc_write_to_socket(struct rpc_context *rpc)
{
static int rpc_write_to_socket(struct rpc_context *rpc)
{
- int
64
_t count;
+ int
32
_t count;
assert(rpc->magic == RPC_CONTEXT_MAGIC);
assert(rpc->magic == RPC_CONTEXT_MAGIC);
@@
-111,11
+118,7
@@
static int rpc_write_to_socket(struct rpc_context *rpc)
total = rpc->outqueue->outdata.size;
total = rpc->outqueue->outdata.size;
-#if defined(WIN32)
count = send(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written, 0);
count = send(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written, 0);
-#else
- count = write(rpc->fd, rpc->outqueue->outdata.data + rpc->outqueue->written, total - rpc->outqueue->written);
-#endif
if (count == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
return 0;
if (count == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
return 0;
@@
-140,7
+143,9
@@
static int rpc_read_from_socket(struct rpc_context *rpc)
int available;
int size;
int pdu_size;
int available;
int size;
int pdu_size;
- int64_t count;
+ int32_t count;
+
+ assert(rpc->magic == RPC_CONTEXT_MAGIC);
assert(rpc->magic == RPC_CONTEXT_MAGIC);
assert(rpc->magic == RPC_CONTEXT_MAGIC);
@@
-193,11
+198,7
@@
static int rpc_read_from_socket(struct rpc_context *rpc)
if (rpc->inpos < 4) {
size = 4 - rpc->inpos;
if (rpc->inpos < 4) {
size = 4 - rpc->inpos;
-#if defined(WIN32)
count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
-#else
- count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);
-#endif
if (count == -1) {
if (errno == EINTR) {
return 0;
if (count == -1) {
if (errno == EINTR) {
return 0;
@@
-233,11
+234,7
@@
static int rpc_read_from_socket(struct rpc_context *rpc)
size = rpc->insize - rpc->inpos;
}
size = rpc->insize - rpc->inpos;
}
-#if defined(WIN32)
count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
count = recv(rpc->fd, rpc->inbuf + rpc->inpos, size, 0);
-#else
- count = read(rpc->fd, rpc->inbuf + rpc->inpos, size);
-#endif
if (count == -1) {
if (errno == EINTR) {
return 0;
if (count == -1) {
if (errno == EINTR) {
return 0;