aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-04-13 20:58:54 +0000
committerMike Frysinger <vapier@gentoo.org>2010-04-13 20:58:54 +0000
commite8a761519bd9067830a80b554b8babcca09e42bd (patch)
tree27e8e23fdd00501a7bbfedc295bf451bdcf14a34 /sim/common
parent6f2bc2ee5d9d7c968de49810535e401ee0f6d8a7 (diff)
downloadgdb-e8a761519bd9067830a80b554b8babcca09e42bd.zip
gdb-e8a761519bd9067830a80b554b8babcca09e42bd.tar.gz
gdb-e8a761519bd9067830a80b554b8babcca09e42bd.tar.bz2
sim: dv-sockser: pass up connected state
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>
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/dv-sockser.c3
-rw-r--r--sim/common/dv-sockser.h5
3 files changed, 11 insertions, 3 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 2a386d7..eb58519 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@
2010-04-13 Mike Frysinger <vapier@gentoo.org>
+ * dv-sockser.h (DV_SOCKSER_DISCONNECTED): Define.
+ * dv-sockser.c (dv_sockser_status): Set DV_SOCKSER_DISCONNECTED
+ initially.
+
+2010-04-13 Mike Frysinger <vapier@gentoo.org>
+
* sim-hrw.c (sim_write): Add const to buf arg.
* sim-utils.h (sim_write_fn): Likewise.
diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c
index 1e530e2..a8626cd 100644
--- a/sim/common/dv-sockser.c
+++ b/sim/common/dv-sockser.c
@@ -298,7 +298,8 @@ dv_sockser_status (SIM_DESC sd)
fd_set readfds,writefds;
/* status to return if the socket isn't set up, or select fails */
- status = DV_SOCKSER_INPUT_EMPTY | DV_SOCKSER_OUTPUT_EMPTY;
+ status = DV_SOCKSER_INPUT_EMPTY | DV_SOCKSER_OUTPUT_EMPTY |
+ DV_SOCKSER_DISCONNECTED;
if (! connected_p (sd))
return status;
diff --git a/sim/common/dv-sockser.h b/sim/common/dv-sockser.h
index fc21b55..209cf46 100644
--- a/sim/common/dv-sockser.h
+++ b/sim/common/dv-sockser.h
@@ -20,8 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define DV_SOCKSER_H
/* bits in result of dev_sockser_status */
-#define DV_SOCKSER_INPUT_EMPTY 1
-#define DV_SOCKSER_OUTPUT_EMPTY 2
+#define DV_SOCKSER_INPUT_EMPTY 0x1
+#define DV_SOCKSER_OUTPUT_EMPTY 0x2
+#define DV_SOCKSER_DISCONNECTED 0x4
/* FIXME: later add a device ptr arg */
extern int dv_sockser_status (SIM_DESC);