diff options
Diffstat (limited to 'sim')
-rw-r--r-- | sim/common/ChangeLog | 6 | ||||
-rw-r--r-- | sim/common/dv-sockser.c | 15 | ||||
-rw-r--r-- | sim/common/dv-sockser.h | 1 |
3 files changed, 18 insertions, 4 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 6cb313b..d6dc022 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,9 @@ +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. + 2010-10-07 Hans-Peter Nilsson <hp@axis.com> * callback.c (os_lseek): Call wrap on lseek result. 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 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 */ |