public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: dv-sockser: pass up connected state
@ 2010-03-31 11:43 Mike Frysinger
  2010-04-10  6:51 ` Mike Frysinger
  2010-04-13 15:52 ` Joel Brobecker
  0 siblings, 2 replies; 7+ messages in thread
From: Mike Frysinger @ 2010-03-31 11:43 UTC (permalink / raw)
  To: gdb-patches

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>

2010-03-31  Mike Frysinger  <vapier@gentoo.org>

	* dv-sockser.h (DV_SOCKSER_DISCONNECTED): Define.
	* dv-sockser.c (dv_sockser_status): Set DV_SOCKSER_DISCONNECTED
	initially.
---
 sim/common/dv-sockser.c |    3 ++-
 sim/common/dv-sockser.h |    5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c
index 03d49da..643ce34 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);
-- 
1.7.0.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sim: dv-sockser: pass up connected state
  2010-03-31 11:43 [PATCH] sim: dv-sockser: pass up connected state Mike Frysinger
@ 2010-04-10  6:51 ` Mike Frysinger
  2010-04-13 15:52 ` Joel Brobecker
  1 sibling, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2010-04-10  6:51 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: Text/Plain, Size: 332 bytes --]

On Wednesday 31 March 2010 07:43:31 Mike Frysinger wrote:
> 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.

ping ...
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sim: dv-sockser: pass up connected state
  2010-03-31 11:43 [PATCH] sim: dv-sockser: pass up connected state Mike Frysinger
  2010-04-10  6:51 ` Mike Frysinger
@ 2010-04-13 15:52 ` Joel Brobecker
  2010-04-13 21:09   ` [PATCH] sim: mn10300: convert to new sockser status code Mike Frysinger
  2010-04-13 21:16   ` [PATCH] sim: dv-sockser: pass up connected state Mike Frysinger
  1 sibling, 2 replies; 7+ messages in thread
From: Joel Brobecker @ 2010-04-13 15:52 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

> 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>
> 
> 2010-03-31  Mike Frysinger  <vapier@gentoo.org>
> 
> 	* dv-sockser.h (DV_SOCKSER_DISCONNECTED): Define.
> 	* dv-sockser.c (dv_sockser_status): Set DV_SOCKSER_DISCONNECTED
> 	initially.

This looks OK to me. Are you going to fix these ports next?

-- 
Joel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] sim: mn10300: convert to new sockser status code
  2010-04-13 15:52 ` Joel Brobecker
@ 2010-04-13 21:09   ` Mike Frysinger
  2010-04-19 14:48     ` Joel Brobecker
  2010-04-13 21:16   ` [PATCH] sim: dv-sockser: pass up connected state Mike Frysinger
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2010-04-13 21:09 UTC (permalink / raw)
  To: gdb-patches

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
2010-04-13  Mike Frysinger  <vapier@gentoo.org>

	* dv-mn103ser.c (sockser_addr, USE_SOCKSER_P): Delete
	(do_polling_event): Change USE_SOCKSER_P to dv_sockser_status.
	(read_status_reg): Likewise.
	(write_txb): Likewise.

 sim/mn10300/dv-mn103ser.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/sim/mn10300/dv-mn103ser.c b/sim/mn10300/dv-mn103ser.c
index 6ec8d27..b3e844d 100644
--- a/sim/mn10300/dv-mn103ser.c
+++ b/sim/mn10300/dv-mn103ser.c
@@ -74,11 +74,6 @@ enum serial_register_types {
 };
 
 
-/* Access dv-sockser state */
-extern char* sockser_addr;
-#define USE_SOCKSER_P (sockser_addr != NULL)
-
-
 #define NR_SERIAL_DEVS  3
 #define SIO_STAT_RRDY 0x0010
 
@@ -238,15 +233,17 @@ static void
 do_polling_event (struct hw *me,
 		  void *data)
 {
+  SIM_DESC sd = hw_system (me);
   struct mn103ser *serial = hw_data(me);
   long serial_reg = (long) data;
   char c;
-  int count;
+  int count, status;
 
-  if(USE_SOCKSER_P)
+  status = dv_sockser_status (sd);
+  if (!(status & DV_SOCKSER_DISCONNECTED))
     {
       int rd;
-      rd = dv_sockser_read (hw_system (me));
+      rd = dv_sockser_read (sd);
       if(rd != -1)
 	{
 	  c = (char) rd;
@@ -375,6 +372,9 @@ read_status_reg (struct hw *me,
 
   if ( (serial->device[serial_reg].status & SIO_STAT_RRDY) == 0 )
     {
+      SIM_DESC sd = hw_system (me);
+      int status;
+
       /* FIFO is empty */
       /* Kill current poll event */
       if ( NULL != serial->device[serial_reg].event )
@@ -383,10 +383,11 @@ read_status_reg (struct hw *me,
 	  serial->device[serial_reg].event = NULL;
 	}
 
-      if(USE_SOCKSER_P)
+      status = dv_sockser_status (sd);
+      if (!(status & DV_SOCKSER_DISCONNECTED))
 	{
 	  int rd;
-	  rd = dv_sockser_read (hw_system (me));
+	  rd = dv_sockser_read (sd);
 	  if(rd != -1)
 	    {
 	      c = (char) rd;
@@ -597,16 +598,20 @@ write_txb (struct hw *me,
 {
   if ( nr_bytes == 1 )
     {
+      SIM_DESC sd = hw_system (me);
+      int status;
+
       serial->device[serial_reg].txb = *(unsigned8 *)source;
 
-      if(USE_SOCKSER_P)
+      status = dv_sockser_status (sd);
+      if (!(status & DV_SOCKSER_DISCONNECTED))
 	{
-	  dv_sockser_write(hw_system (me), * (char*) source);
+	  dv_sockser_write(sd, * (char*) source);
 	}
       else
 	{
-	  sim_io_write_stdout(hw_system (me), (char *)source, 1);
-	  sim_io_flush_stdout(hw_system (me));
+	  sim_io_write_stdout(sd, (char *)source, 1);
+	  sim_io_flush_stdout(sd);
 	}
 
       hw_port_event (me, serial_reg+SERIAL0_SEND, 1);
-- 
1.7.0.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sim: dv-sockser: pass up connected state
  2010-04-13 15:52 ` Joel Brobecker
  2010-04-13 21:09   ` [PATCH] sim: mn10300: convert to new sockser status code Mike Frysinger
@ 2010-04-13 21:16   ` Mike Frysinger
  1 sibling, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2010-04-13 21:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

[-- Attachment #1: Type: Text/Plain, Size: 1434 bytes --]

On Tuesday 13 April 2010 11:51:47 Joel Brobecker wrote:
> > 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>
> > 
> > 2010-03-31  Mike Frysinger  <vapier@gentoo.org>
> > 
> > 	* dv-sockser.h (DV_SOCKSER_DISCONNECTED): Define.
> > 	* dv-sockser.c (dv_sockser_status): Set DV_SOCKSER_DISCONNECTED
> > 	initially.
> 
> This looks OK to me. Are you going to fix these ports next?

ive posted a fix for the mn10300 because it uses the information on the fly to 
flip between stdio and sockets.  the mips stuff isnt straight forward because 
it uses the info to determine how to create the default device tree (use the 
tcp or the stdio backend).  this new status code determines whether something 
is connected, not "did someone specify a command line option, even if it was 
invalid" which is what mips does atm.  timing wise, it isnt possible to 
specify the option and have someone connect before the device tree is created.

imo, the mips code should be done to flip between stdio/tcp on the fly, but if 
they really want to keep the current behavior, i think we might have to add 
another status bit like DV_SOCKSER_VALID_PEER.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sim: mn10300: convert to new sockser status code
  2010-04-13 21:09   ` [PATCH] sim: mn10300: convert to new sockser status code Mike Frysinger
@ 2010-04-19 14:48     ` Joel Brobecker
  2010-04-19 19:04       ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2010-04-19 14:48 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

Mike,

> 2010-04-13  Mike Frysinger  <vapier@gentoo.org>
> 
> 	* dv-mn103ser.c (sockser_addr, USE_SOCKSER_P): Delete
> 	(do_polling_event): Change USE_SOCKSER_P to dv_sockser_status.
> 	(read_status_reg): Likewise.
> 	(write_txb): Likewise.

This looks good to me.

Not sure if you are aware of this, but the procedure when you commit
a patch is to send a quick reply to the approval-email saying that
the patch is now in.  Otherwise, we don't know whether you applied it
or not (I'm not subscribed to the CVS notifications).

-- 
Joel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sim: mn10300: convert to new sockser status code
  2010-04-19 14:48     ` Joel Brobecker
@ 2010-04-19 19:04       ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2010-04-19 19:04 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

[-- Attachment #1: Type: Text/Plain, Size: 367 bytes --]

On Monday 19 April 2010 10:48:17 Joel Brobecker wrote:
> Not sure if you are aware of this, but the procedure when you commit
> a patch is to send a quick reply to the approval-email saying that
> the patch is now in.  Otherwise, we don't know whether you applied it
> or not (I'm not subscribed to the CVS notifications).

rgr, will do

ive committed this now
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-04-19 19:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-31 11:43 [PATCH] sim: dv-sockser: pass up connected state Mike Frysinger
2010-04-10  6:51 ` Mike Frysinger
2010-04-13 15:52 ` Joel Brobecker
2010-04-13 21:09   ` [PATCH] sim: mn10300: convert to new sockser status code Mike Frysinger
2010-04-19 14:48     ` Joel Brobecker
2010-04-19 19:04       ` Mike Frysinger
2010-04-13 21:16   ` [PATCH] sim: dv-sockser: pass up connected state Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).