This lets ports assume that the dv-sockser API is always available if
they want to. This way we don't have to do an abort at configure time
and it makes the resulting code a bit simpler.
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
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>
gdb/
* ser-tcp.c (net_open): Check error return from socket() call by its
equality to -1 not by it being negative.
(net_close): Likewise.
gdb/gdbserver/
* gdbreplay.c (remote_open): Check error return from socket() call by
its equality to -1 not by it being negative.
* remote-utils.c (remote_open): Likewise.
sim/arm/
* communicate.c (MYread_char): Check error return from accept() call
by its equality to -1 not by it being negative.
(MYread_charwait): Likewise.
* main.c (main): Likewise for both socket() and accept() calls.
sim/common/
* dv-sockser.c (dv_sockser_init): Check error return from socket()
call by its equality to -1 not by it being negative.
(connected_p): Likewise for accept() call.
sim/cris/
* dv-rv.c (hw_rv_init_socket): Check error return from socket() call
by its equality to -1 not by it being negative.
(hw_rv_write): Likewise.
(hw_rv_handle_incoming): Likewise.
(hw_rv_poll_once): Likewise.
* rvdummy.c (setupsocket): Likewise.
(main): Likewise for accept() call as returned from setupsocket().
sim/m32c/
* main.c (setup_tcp_console): Check error return from socket() call
by its equality to -1 not by it being negative.
A few ports rely on internal dv-sockser state in order to detect whether
a connection has been made (look for 'extern sockser_addr'). Rather than
continuing that tradition, extend the existing status function to return
the socket connection status.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The sim code has a lot of static initializer for options and devices, but
since they aren't using newer struct style, they have to specify a value
for every option otherwise gcc spits a lot of warnings about "missing
initializer". So add NULL/0 stubs for pointers/values.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The accept() function takes a socklen_t, not an int. Using an int causes:
dv-sockser.c: In function 'connected_p':
dv-sockser.c:273: warning: pointer targets in passing argument 3
of 'accept' differ in signedness
So use the same socklen_t detection code as gdb and convert the accept().