* [PATCH] sim: dv-sockser: add a write buffer variant
@ 2010-11-16 2:45 Mike Frysinger
2010-11-16 16:08 ` Frank Ch. Eigler
0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2010-11-16 2:45 UTC (permalink / raw)
To: gdb-patches
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>
2010-11-16 Mike Frysinger <vapier@gentoo.org>
* dv-sockser.c (dv_sockser_write_buffer): New function.
(dv_sockser_write): Rewrite to use dv_sockser_write_buffer.
* dv-sockser.h (dv_sockser_write_buffer): New prototype.
---
sim/common/dv-sockser.c | 15 +++++++++++----
sim/common/dv-sockser.h | 1 +
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c
index 640f869..647237d 100644
--- a/sim/common/dv-sockser.c
+++ b/sim/common/dv-sockser.c
@@ -347,13 +347,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)
@@ -363,9 +364,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
diff --git a/sim/common/dv-sockser.h b/sim/common/dv-sockser.h
index 209cf46..0ad071a 100644
--- a/sim/common/dv-sockser.h
+++ b/sim/common/dv-sockser.h
@@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* FIXME: later add a device ptr arg */
extern int dv_sockser_status (SIM_DESC);
int dv_sockser_write (SIM_DESC, unsigned char);
+int dv_sockser_write_buffer (SIM_DESC, const unsigned char *, unsigned);
int dv_sockser_read (SIM_DESC);
#endif /* DV_SOCKSER_H */
--
1.7.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sim: dv-sockser: add a write buffer variant
2010-11-16 2:45 [PATCH] sim: dv-sockser: add a write buffer variant Mike Frysinger
@ 2010-11-16 16:08 ` Frank Ch. Eigler
2010-11-16 19:12 ` Mike Frysinger
0 siblings, 1 reply; 3+ messages in thread
From: Frank Ch. Eigler @ 2010-11-16 16:08 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches
Mike Frysinger <vapier@gentoo.org> writes:
> [...]
This series of patches all look fine to me.
- FChE
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sim: dv-sockser: add a write buffer variant
2010-11-16 16:08 ` Frank Ch. Eigler
@ 2010-11-16 19:12 ` Mike Frysinger
0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2010-11-16 19:12 UTC (permalink / raw)
To: Frank Ch. Eigler; +Cc: gdb-patches
[-- Attachment #1: Type: Text/Plain, Size: 453 bytes --]
On Tuesday, November 16, 2010 11:08:03 Frank Ch. Eigler wrote:
> Mike Frysinger <vapier@gentoo.org> writes:
> > [...]
>
> This series of patches all look fine to me.
sorry, but what patches exactly ? ive committed this one now, but to be
clear, you're also OK with these two:
sim: profile: fix building with --disable-sim-profile
sim: cast away hw/device differences
but maybe you also meant this beast ?
sim: bfin: new port
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-16 19:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-16 2:45 [PATCH] sim: dv-sockser: add a write buffer variant Mike Frysinger
2010-11-16 16:08 ` Frank Ch. Eigler
2010-11-16 19:12 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox