summaryrefslogtreecommitdiffstats
path: root/server/snd_worker.c
diff options
context:
space:
mode:
authorDan McGee <dpmcgee@gmail.com>2012-02-16 23:30:13 -0600
committerAlon Levy <alevy@redhat.com>2012-02-21 10:20:47 +0200
commit016bc7513f0e758162d136476b8faa7e7832a60b (patch)
tree350fbff22a8a19fce2ff1e2f1d26ac75c64acf85 /server/snd_worker.c
parentbdfd6c234bca76232f4bac308fc21321ebba7f1a (diff)
downloadspice-016bc7513f0e758162d136476b8faa7e7832a60b.tar.gz
spice-016bc7513f0e758162d136476b8faa7e7832a60b.tar.xz
spice-016bc7513f0e758162d136476b8faa7e7832a60b.zip
Use standard IOV_MAX definition where applicable
This is provided by <limits.h> on all platforms as long as _XOPEN_SOURCE is defined. On Linux, this is 1024, on Solaris, this is 16, and on any other platform, we now respect the value supported by the OS. Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Diffstat (limited to 'server/snd_worker.c')
-rw-r--r--server/snd_worker.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 0e93a6fc..aa1ceb76 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -21,6 +21,7 @@
#include <fcntl.h>
#include <errno.h>
+#include <limits.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
@@ -36,7 +37,9 @@
#include "generated_marshallers.h"
#include "demarshallers.h"
-#define MAX_SEND_VEC 100
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
#define RECIVE_BUF_SIZE (16 * 1024 * 2)
@@ -262,7 +265,7 @@ static int snd_send_data(SndChannel *channel)
}
for (;;) {
- struct iovec vec[MAX_SEND_VEC];
+ struct iovec vec[IOV_MAX];
int vec_size;
if (!n) {
@@ -276,7 +279,7 @@ static int snd_send_data(SndChannel *channel)
}
vec_size = spice_marshaller_fill_iovec(channel->send_data.marshaller,
- vec, MAX_SEND_VEC, channel->send_data.pos);
+ vec, IOV_MAX, channel->send_data.pos);
n = reds_stream_writev(channel->stream, vec, vec_size);
if (n == -1) {
switch (errno) {