diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-11-16 19:10:29 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-11-16 19:10:29 +0000 |
commit | 6ab5626b08f37bc5b84c67d0f25e363e0ab0180e (patch) | |
tree | f0fb7655dd741470c3f88e3e4c8f625c01908232 /sim/common/dv-sockser.c | |
parent | 6fc6ea198c7feb48e378a490f5d227d625a340e4 (diff) | |
download | gdb-6ab5626b08f37bc5b84c67d0f25e363e0ab0180e.zip gdb-6ab5626b08f37bc5b84c67d0f25e363e0ab0180e.tar.gz gdb-6ab5626b08f37bc5b84c67d0f25e363e0ab0180e.tar.bz2 |
sim: dv-sockser: add a write buffer variant
Rather than having to bang out chunks of data one byte at a time over
the socket interface, add a write variant that accepts an arbitrarily
long buffer. This speeds things up considerably when we have many
chars to send out at once.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim/common/dv-sockser.c')
-rw-r--r-- | sim/common/dv-sockser.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c index b09d9c9..f6fd389 100644 --- a/sim/common/dv-sockser.c +++ b/sim/common/dv-sockser.c @@ -346,13 +346,14 @@ dv_sockser_status (SIM_DESC sd) } int -dv_sockser_write (SIM_DESC sd, unsigned char c) +dv_sockser_write_buffer (SIM_DESC sd, const unsigned char *buffer, + unsigned nr_bytes) { int n; if (! connected_p (sd)) return -1; - n = write (sockser_fd, &c, 1); + n = write (sockser_fd, buffer, nr_bytes); if (n == -1) { if (errno == EPIPE) @@ -362,9 +363,15 @@ dv_sockser_write (SIM_DESC sd, unsigned char c) } return -1; } - if (n != 1) + if (n != nr_bytes) return -1; - return 1; + return nr_bytes; +} + +int +dv_sockser_write (SIM_DESC sd, unsigned char c) +{ + return dv_sockser_write_buffer (sd, &c, 1); } int |