This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] s/serial_t/struct serial */ *.h *.c


FYI,

This zaps all remaining references to `serial_t'.  I'll commit this in a 
day or so.

	Andrew
2001-07-10  Andrew Cagney  <ac131313@redhat.com>

	* serial.h (typedef serial_t): Delete. Replace all references to
	serial_t with `struct serial *'.
	* serial.c: Update.
	* nindy-share/ttyflush.c: Update.
	* nindy-share/ttyflush.c: Update.
	* nindy-share/Onindy.c: Update.
	* nindy-share/nindy.c: Update.
	* remote-rdp.c: Update.
	* remote-sds.c: Update.
	* remote-st.c: Update.
	* remote-nindy.c: Update.
	* remote-mips.c: Update.
	* remote-e7000.c: Update.
	* remote-os9k.c: Update.
	* remote-nrom.c: Update.
	* remote-es.c: Update.
	* remote-array.c: Update.
	* ocd.c: Update.
	* mon960-rom.c: Update.
	* dsrec.c: Update.
	* inflow.c: Update.
	* ser-e7kpc.c: Update.
	* sparclet-rom.c: Update.
	* srec.h: Update.
	* ser-tcp.c: Update.
	* ser-go32.c: Update.
	* sparcl-tdep.c: Update.
	* w89k-rom.c: Update.
	* utils.c: Update.
	* sh3-rom.c: Update.
	* remote.c: Update.
	* ser-pipe.c: Update.
	* ser-unix.c: Update.
	* ser-unix.h: Update.
	* xmodem.c: Update.
	* xmodem.h: Update.

Index: dsrec.c
===================================================================
RCS file: /cvs/src/src/gdb/dsrec.c,v
retrieving revision 1.9
diff -p -r1.9 dsrec.c
*** dsrec.c	2001/03/28 21:42:31	1.9
--- dsrec.c	2001/07/10 23:14:06
*************** static int make_srec (char *srec, CORE_A
*** 33,51 ****
  		      int flags);
  
  /* Download an executable by converting it to S records.  DESC is a
!    serial_t to send the data to.  FILE is the name of the file to be
!    loaded.  LOAD_OFFSET is the offset into memory to load data into.
!    It is usually specified by the user and is useful with the a.out
!    file format.  MAXRECSIZE is the length in chars of the largest
!    S-record the host can accomodate.  This is measured from the
!    starting `S' to the last char of the checksum.  FLAGS is various
!    random flags, and HASHMARK is non-zero to cause a `#' to be
     printed out for each record loaded.  WAITACK, if non-NULL, is a
!    function that waits for an acknowledgement after each S-record,
!    and returns non-zero if the ack is read correctly.  */
  
  void
! load_srec (serial_t desc, const char *file, bfd_vma load_offset, int maxrecsize,
  	   int flags, int hashmark, int (*waitack) (void))
  {
    bfd *abfd;
--- 33,52 ----
  		      int flags);
  
  /* Download an executable by converting it to S records.  DESC is a
!    `struct serial *' to send the data to.  FILE is the name of the
!    file to be loaded.  LOAD_OFFSET is the offset into memory to load
!    data into.  It is usually specified by the user and is useful with
!    the a.out file format.  MAXRECSIZE is the length in chars of the
!    largest S-record the host can accomodate.  This is measured from
!    the starting `S' to the last char of the checksum.  FLAGS is
!    various random flags, and HASHMARK is non-zero to cause a `#' to be
     printed out for each record loaded.  WAITACK, if non-NULL, is a
!    function that waits for an acknowledgement after each S-record, and
!    returns non-zero if the ack is read correctly.  */
  
  void
! load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
! 	   int maxrecsize,
  	   int flags, int hashmark, int (*waitack) (void))
  {
    bfd *abfd;
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.9
diff -p -r1.9 inflow.c
*** inflow.c	2001/05/04 04:15:25	1.9
--- inflow.c	2001/07/10 23:14:06
*************** static void terminal_ours_1 (int);
*** 70,76 ****
  
  /* Record terminal status separately for debugger and inferior.  */
  
! static serial_t stdin_serial;
  
  /* TTY state for the inferior.  We save it whenever the inferior stops, and
     restore it when it resumes.  */
--- 70,76 ----
  
  /* Record terminal status separately for debugger and inferior.  */
  
! static struct serial *stdin_serial;
  
  /* TTY state for the inferior.  We save it whenever the inferior stops, and
     restore it when it resumes.  */
Index: mon960-rom.c
===================================================================
RCS file: /cvs/src/src/gdb/mon960-rom.c,v
retrieving revision 1.5
diff -p -r1.5 mon960-rom.c
*** mon960-rom.c	2001/05/04 04:15:25	1.5
--- mon960-rom.c	2001/07/10 23:14:06
*************** mon960_load_gen (char *filename, int fro
*** 53,59 ****
  #else
  
  static void
! mon960_load (serial_t desc, char *file, int hashmark)
  {
    bfd *abfd;
    asection *s;
--- 53,59 ----
  #else
  
  static void
! mon960_load (struct serial *desc, char *file, int hashmark)
  {
    bfd *abfd;
    asection *s;
Index: ocd.c
===================================================================
RCS file: /cvs/src/src/gdb/ocd.c,v
retrieving revision 1.16
diff -p -r1.16 ocd.c
*** ocd.c	2001/05/04 04:15:26	1.16
--- ocd.c	2001/07/10 23:14:06
*************** static int remote_timeout = 2;
*** 83,89 ****
  /* Descriptor for I/O to remote machine.  Initialize it to NULL so that
     ocd_open knows that we don't have a file open when the program
     starts.  */
! static serial_t ocd_desc = NULL;
  
  void
  ocd_error (char *s, int error_code)
--- 83,89 ----
  /* Descriptor for I/O to remote machine.  Initialize it to NULL so that
     ocd_open knows that we don't have a file open when the program
     starts.  */
! static struct serial *ocd_desc = NULL;
  
  void
  ocd_error (char *s, int error_code)
Index: remote-array.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-array.c,v
retrieving revision 1.15
diff -p -r1.15 remote-array.c
*** remote-array.c	2001/06/29 04:41:20	1.15
--- remote-array.c	2001/07/10 23:14:07
*************** static int timeout = 30;
*** 90,96 ****
   * Descriptor for I/O to remote machine.  Initialize it to NULL so that
   * array_open knows that we don't have a file open when the program starts.
   */
! serial_t array_desc = NULL;
  
  /*
   * this array of registers need to match the indexes used by GDB. The
--- 90,96 ----
   * Descriptor for I/O to remote machine.  Initialize it to NULL so that
   * array_open knows that we don't have a file open when the program starts.
   */
! struct serial *array_desc = NULL;
  
  /*
   * this array of registers need to match the indexes used by GDB. The
*************** array_wait (ptid_t ptid, struct target_w
*** 694,700 ****
    int old_timeout = timeout;
    int result, i;
    char c;
!   serial_t tty_desc;
    serial_ttystate ttystate;
  
    debuglogs (1, "array_wait (), printing extraneous text.");
--- 694,700 ----
    int old_timeout = timeout;
    int result, i;
    char c;
!   struct serial *tty_desc;
    serial_ttystate ttystate;
  
    debuglogs (1, "array_wait (), printing extraneous text.");
Index: remote-e7000.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-e7000.c,v
retrieving revision 1.22
diff -p -r1.22 remote-e7000.c
*** remote-e7000.c	2001/06/10 16:25:51	1.22
--- remote-e7000.c	2001/07/10 23:14:07
*************** static void expect_prompt (void);
*** 115,121 ****
  static int e7000_parse_device (char *args, char *dev_name, int baudrate);
  /* Variables. */
  
! static serial_t e7000_desc;
  
  /* Allow user to chose between using hardware breakpoints or memory. */
  static int use_hard_breakpoints = 0;	/* use sw breakpoints by default */
--- 115,121 ----
  static int e7000_parse_device (char *args, char *dev_name, int baudrate);
  /* Variables. */
  
! static struct serial *e7000_desc;
  
  /* Allow user to chose between using hardware breakpoints or memory. */
  static int use_hard_breakpoints = 0;	/* use sw breakpoints by default */
Index: remote-es.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-es.c,v
retrieving revision 1.16
diff -p -r1.16 remote-es.c
*** remote-es.c	2001/05/04 04:15:26	1.16
--- remote-es.c	2001/07/10 23:14:07
*************** static int m68020;
*** 231,237 ****
     es1800_open knows that we don't have a file open when the program
     starts.  */
  
! static serial_t es1800_desc = NULL;
  
  #define	PBUFSIZ	1000
  #define HDRLEN sizeof("@.BAAAAAAAA=$VV\r")
--- 231,237 ----
     es1800_open knows that we don't have a file open when the program
     starts.  */
  
! static struct serial *es1800_desc = NULL;
  
  #define	PBUFSIZ	1000
  #define HDRLEN sizeof("@.BAAAAAAAA=$VV\r")
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.21
diff -p -r1.21 remote-mips.c
*** remote-mips.c	2001/05/04 04:15:26	1.21
--- remote-mips.c	2001/07/10 23:14:08
*************** static int mips_receive_wait = 5;
*** 362,371 ****
  static int mips_need_reply = 0;
  
  /* Handle used to access serial I/O stream.  */
! static serial_t mips_desc;
  
  /* UDP handle used to download files to target.  */
! static serial_t udp_desc;
  static int udp_in_use;
  
  /* TFTP filename used to download files to DDB board, in the form
--- 362,371 ----
  static int mips_need_reply = 0;
  
  /* Handle used to access serial I/O stream.  */
! static struct serial *mips_desc;
  
  /* UDP handle used to download files to target.  */
! static struct serial *udp_desc;
  static int udp_in_use;
  
  /* TFTP filename used to download files to DDB board, in the form
*************** device is attached to the target board (
*** 1540,1546 ****
  
    /* Open and initialize the serial port.  */
    mips_desc = SERIAL_OPEN (serial_port_name);
!   if (mips_desc == (serial_t) NULL)
      perror_with_name (serial_port_name);
  
    if (baud_rate != -1)
--- 1540,1546 ----
  
    /* Open and initialize the serial port.  */
    mips_desc = SERIAL_OPEN (serial_port_name);
!   if (mips_desc == NULL)
      perror_with_name (serial_port_name);
  
    if (baud_rate != -1)
Index: remote-nindy.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-nindy.c,v
retrieving revision 1.16
diff -p -r1.16 remote-nindy.c
*** remote-nindy.c	2001/05/04 04:15:26	1.16
--- remote-nindy.c	2001/07/10 23:14:08
*************** char *nindy_ttyname;		/* name of tty to 
*** 141,147 ****
  #define FALSE	0
  
  /* From nindy-share/nindy.c.  */
! extern serial_t nindy_serial;
  
  static int have_regs = 0;	/* 1 iff regs read since i960 last halted */
  static int regs_changed = 0;	/* 1 iff regs were modified since last read */
--- 141,147 ----
  #define FALSE	0
  
  /* From nindy-share/nindy.c.  */
! extern struct serial *nindy_serial;
  
  static int have_regs = 0;	/* 1 iff regs read since i960 last halted */
  static int regs_changed = 0;	/* 1 iff regs were modified since last read */
*************** nindy_resume (ptid_t ptid, int step, enu
*** 277,283 ****
  struct clean_up_tty_args
  {
    serial_ttystate state;
!   serial_t serial;
  };
  static struct clean_up_tty_args tty_args;
  
--- 277,283 ----
  struct clean_up_tty_args
  {
    serial_ttystate state;
!   struct serial *serial;
  };
  static struct clean_up_tty_args tty_args;
  
Index: remote-nrom.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-nrom.c,v
retrieving revision 1.7
diff -p -r1.7 remote-nrom.c
*** remote-nrom.c	2001/04/14 19:23:02	1.7
--- remote-nrom.c	2001/07/10 23:14:08
*************** static void nrom_passthru (char *, int);
*** 46,53 ****
  
  /* We talk to the NetROM over these sockets.  */
  
! static serial_t load_desc = NULL;
! static serial_t ctrl_desc = NULL;
  
  static int load_port = DEFAULT_NETROM_LOAD_PORT;
  static int control_port = DEFAULT_NETROM_CONTROL_PORT;
--- 46,53 ----
  
  /* We talk to the NetROM over these sockets.  */
  
! static struct serial *load_desc = NULL;
! static struct serial *ctrl_desc = NULL;
  
  static int load_port = DEFAULT_NETROM_LOAD_PORT;
  static int control_port = DEFAULT_NETROM_CONTROL_PORT;
*************** nrom_kill (void)
*** 97,107 ****
    nrom_close (0);
  }
  
! static serial_t
  open_socket (char *name, int port)
  {
    char sockname[100];
!   serial_t desc;
  
    sprintf (sockname, "%s:%d", name, port);
    desc = SERIAL_OPEN (sockname);
--- 97,107 ----
    nrom_close (0);
  }
  
! static struct serial *
  open_socket (char *name, int port)
  {
    char sockname[100];
!   struct serial *desc;
  
    sprintf (sockname, "%s:%d", name, port);
    desc = SERIAL_OPEN (sockname);
Index: remote-os9k.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-os9k.c,v
retrieving revision 1.14
diff -p -r1.14 remote-os9k.c
*** remote-os9k.c	2001/05/04 04:15:26	1.14
--- remote-os9k.c	2001/07/10 23:14:09
*************** static int tty_xoff = 0;
*** 80,86 ****
  static int timeout = 10;
  static int is_trace_mode = 0;
  /* Descriptor for I/O to remote machine.  Initialize it to NULL */
! static serial_t monitor_desc = NULL;
  
  static CORE_ADDR bufaddr = 0;
  static int buflen = 0;
--- 80,86 ----
  static int timeout = 10;
  static int is_trace_mode = 0;
  /* Descriptor for I/O to remote machine.  Initialize it to NULL */
! static struct serial *monitor_desc = NULL;
  
  static CORE_ADDR bufaddr = 0;
  static int buflen = 0;
Index: remote-rdp.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-rdp.c,v
retrieving revision 1.17
diff -p -r1.17 remote-rdp.c
*** remote-rdp.c	2001/05/04 04:15:26	1.17
--- remote-rdp.c	2001/07/10 23:14:09
***************
*** 55,61 ****
  #endif
  
  extern struct target_ops remote_rdp_ops;
! static serial_t io;
  static host_callback *callback = &default_callback;
  
  struct
--- 55,61 ----
  #endif
  
  extern struct target_ops remote_rdp_ops;
! static struct serial *io;
  static host_callback *callback = &default_callback;
  
  struct
Index: remote-sds.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sds.c,v
retrieving revision 1.16
diff -p -r1.16 remote-sds.c
*** remote-sds.c	2001/06/28 03:40:27	1.16
--- remote-sds.c	2001/07/10 23:14:09
*************** static int sds_timeout = 2;
*** 127,133 ****
     that sds_open knows that we don't have a file open when the program
     starts.  */
  
! static serial_t sds_desc = NULL;
  
  /* This limit comes from the monitor.  */
  
--- 127,133 ----
     that sds_open knows that we don't have a file open when the program
     starts.  */
  
! static struct serial *sds_desc = NULL;
  
  /* This limit comes from the monitor.  */
  
Index: remote-st.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-st.c,v
retrieving revision 1.13
diff -p -r1.13 remote-st.c
*** remote-st.c	2001/05/12 21:05:59	1.13
--- remote-st.c	2001/07/10 23:14:09
*************** static int timeout = 24;
*** 61,67 ****
     st2000_open knows that we don't have a file open when the program
     starts.  */
  
! static serial_t st2000_desc;
  
  /* Send data to stdebug.  Works just like printf. */
  
--- 61,67 ----
     st2000_open knows that we don't have a file open when the program
     starts.  */
  
! static struct serial *st2000_desc;
  
  /* Send data to stdebug.  Works just like printf. */
  
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.56
diff -p -r1.56 remote.c
*** remote.c	2001/06/14 19:27:45	1.56
--- remote.c	2001/07/10 23:14:10
*************** static int remote_break;
*** 240,246 ****
  /* Descriptor for I/O to remote machine.  Initialize it to NULL so that
     remote_open knows that we don't have a file open when the program
     starts.  */
! static serial_t remote_desc = NULL;
  
  /* This is set by the target (thru the 'S' message)
     to denote that the target is in kernel mode.  */
--- 240,246 ----
  /* Descriptor for I/O to remote machine.  Initialize it to NULL so that
     remote_open knows that we don't have a file open when the program
     starts.  */
! static struct serial *remote_desc = NULL;
  
  /* This is set by the target (thru the 'S' message)
     to denote that the target is in kernel mode.  */
*************** static void *async_client_context;
*** 5669,5675 ****
  static serial_event_ftype remote_async_serial_handler;
  
  static void
! remote_async_serial_handler (serial_t scb, void *context)
  {
    /* Don't propogate error information up to the client.  Instead let
       the client find out about the error by querying the target.  */
--- 5669,5675 ----
  static serial_event_ftype remote_async_serial_handler;
  
  static void
! remote_async_serial_handler (struct serial *scb, void *context)
  {
    /* Don't propogate error information up to the client.  Instead let
       the client find out about the error by querying the target.  */
Index: ser-e7kpc.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-e7kpc.c,v
retrieving revision 1.6
diff -p -r1.6 ser-e7kpc.c
*** ser-e7kpc.c	2001/06/10 16:25:51	1.6
--- ser-e7kpc.c	2001/07/10 23:14:10
***************
*** 33,46 ****
  #include <sys/dos.h>
  #endif
  
! static int e7000pc_open (serial_t scb, const char *name);
! static void e7000pc_raw (serial_t scb);
! static int e7000pc_readchar (serial_t scb, int timeout);
! static int e7000pc_setbaudrate (serial_t scb, int rate);
! static int e7000pc_write (serial_t scb, const char *str, int len);
! static void e7000pc_close (serial_t scb);
! static serial_ttystate e7000pc_get_tty_state (serial_t scb);
! static int e7000pc_set_tty_state (serial_t scb, serial_ttystate state);
  
  #define OFF_DPD 	0x0000
  #define OFF_DDP 	0x1000
--- 33,46 ----
  #include <sys/dos.h>
  #endif
  
! static int e7000pc_open (struct serial *scb, const char *name);
! static void e7000pc_raw (struct serial *scb);
! static int e7000pc_readchar (struct serial *scb, int timeout);
! static int e7000pc_setbaudrate (struct serial *scb, int rate);
! static int e7000pc_write (struct serial *scb, const char *str, int len);
! static void e7000pc_close (struct serial *scb);
! static serial_ttystate e7000pc_get_tty_state (struct serial *scb);
! static int e7000pc_set_tty_state (struct serial *scb, serial_ttystate state);
  
  #define OFF_DPD 	0x0000
  #define OFF_DDP 	0x1000
*************** dosasync_write (int fd, const char *buf,
*** 291,297 ****
  }
  
  static int
! e7000pc_open (serial_t scb, const char *name)
  {
    if (strncasecmp (name, "pc", 2) != 0)
      {
--- 291,297 ----
  }
  
  static int
! e7000pc_open (struct serial *scb, const char *name)
  {
    if (strncasecmp (name, "pc", 2) != 0)
      {
*************** e7000pc_open (serial_t scb, const char *
*** 308,326 ****
  }
  
  static int
! e7000pc_noop (serial_t scb)
  {
    return 0;
  }
  
  static void
! e7000pc_raw (serial_t scb)
  {
    /* Always in raw mode */
  }
  
  static int
! e7000pc_readchar (serial_t scb, int timeout)
  {
    char buf;
  
--- 308,326 ----
  }
  
  static int
! e7000pc_noop (struct serial *scb)
  {
    return 0;
  }
  
  static void
! e7000pc_raw (struct serial *scb)
  {
    /* Always in raw mode */
  }
  
  static int
! e7000pc_readchar (struct serial *scb, int timeout)
  {
    char buf;
  
*************** struct e7000pc_ttystate
*** 345,351 ****
     vector.  Someday, they may do something real... */
  
  static serial_ttystate
! e7000pc_get_tty_state (serial_t scb)
  {
    struct e7000pc_ttystate *state;
  
--- 345,351 ----
     vector.  Someday, they may do something real... */
  
  static serial_ttystate
! e7000pc_get_tty_state (struct serial *scb)
  {
    struct e7000pc_ttystate *state;
  
*************** e7000pc_get_tty_state (serial_t scb)
*** 355,374 ****
  }
  
  static int
! e7000pc_set_tty_state (serial_t scb, serial_ttystate ttystate)
  {
    return 0;
  }
  
  static int
! e7000pc_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate,
  			       serial_ttystate old_ttystate)
  {
    return 0;
  }
  
  static void
! e7000pc_print_tty_state (serial_t scb,
  			 serial_ttystate ttystate,
  			 struct ui_file *stream)
  {
--- 355,375 ----
  }
  
  static int
! e7000pc_set_tty_state (struct serial *scb, serial_ttystate ttystate)
  {
    return 0;
  }
  
  static int
! e7000pc_noflush_set_tty_state (struct serial *scb,
! 			       serial_ttystate new_ttystate,
  			       serial_ttystate old_ttystate)
  {
    return 0;
  }
  
  static void
! e7000pc_print_tty_state (struct serial *scb,
  			 serial_ttystate ttystate,
  			 struct ui_file *stream)
  {
*************** e7000pc_print_tty_state (serial_t scb,
*** 377,395 ****
  }
  
  static int
! e7000pc_setbaudrate (serial_t scb, int rate)
  {
    return 0;
  }
  
  static int
! e7000pc_setstopbits (serial_t scb, int rate)
  {
    return 0;
  }
  
  static int
! e7000pc_write (serial_t scb, const char *str, int len)
  {
    dosasync_write (scb->fd, str, len);
  
--- 378,396 ----
  }
  
  static int
! e7000pc_setbaudrate (struct serial *scb, int rate)
  {
    return 0;
  }
  
  static int
! e7000pc_setstopbits (struct serial *scb, int rate)
  {
    return 0;
  }
  
  static int
! e7000pc_write (struct serial *scb, const char *str, int len)
  {
    dosasync_write (scb->fd, str, len);
  
*************** e7000pc_write (serial_t scb, const char 
*** 397,403 ****
  }
  
  static void
! e7000pc_close (serial_t scb)
  {
  }
  
--- 398,404 ----
  }
  
  static void
! e7000pc_close (struct serial *scb)
  {
  }
  
Index: ser-go32.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-go32.c,v
retrieving revision 1.11
diff -p -r1.11 ser-go32.c
*** ser-go32.c	2001/06/10 16:25:51	1.11
--- ser-go32.c	2001/07/10 23:14:11
*************** ports[4] =
*** 228,241 ****
    }
  };
  
! static int dos_open (serial_t scb, const char *name);
! static void dos_raw (serial_t scb);
! static int dos_readchar (serial_t scb, int timeout);
! static int dos_setbaudrate (serial_t scb, int rate);
! static int dos_write (serial_t scb, const char *str, int len);
! static void dos_close (serial_t scb);
! static serial_ttystate dos_get_tty_state (serial_t scb);
! static int dos_set_tty_state (serial_t scb, serial_ttystate state);
  static int dos_baudconv (int rate);
  
  #define inb(p,a)	inportb((p)->base + (a))
--- 228,241 ----
    }
  };
  
! static int dos_open (struct serial *scb, const char *name);
! static void dos_raw (struct serial *scb);
! static int dos_readchar (struct serial *scb, int timeout);
! static int dos_setbaudrate (struct serial *scb, int rate);
! static int dos_write (struct serial *scb, const char *str, int len);
! static void dos_close (struct serial *scb);
! static serial_ttystate dos_get_tty_state (struct serial *scb);
! static int dos_set_tty_state (struct serial *scb, serial_ttystate state);
  static int dos_baudconv (int rate);
  
  #define inb(p,a)	inportb((p)->base + (a))
*************** dos_unhookirq (struct intrupt *intr)
*** 453,459 ****
  
  
  static int
! dos_open (serial_t scb, const char *name)
  {
    struct dos_ttystate *port;
    int fd, i;
--- 453,459 ----
  
  
  static int
! dos_open (struct serial *scb, const char *name)
  {
    struct dos_ttystate *port;
    int fd, i;
*************** ok:
*** 558,564 ****
  
  
  static void
! dos_close (serial_t scb)
  {
    struct dos_ttystate *port;
    struct intrupt *intrupt;
--- 558,564 ----
  
  
  static void
! dos_close (struct serial *scb)
  {
    struct dos_ttystate *port;
    struct intrupt *intrupt;
*************** dos_close (serial_t scb)
*** 600,618 ****
  
  
  static int
! dos_noop (serial_t scb)
  {
    return 0;
  }
  
  static void
! dos_raw (serial_t scb)
  {
    /* Always in raw mode */
  }
  
  static int
! dos_readchar (serial_t scb, int timeout)
  {
    struct dos_ttystate *port = &ports[scb->fd];
    long then;
--- 600,618 ----
  
  
  static int
! dos_noop (struct serial *scb)
  {
    return 0;
  }
  
  static void
! dos_raw (struct serial *scb)
  {
    /* Always in raw mode */
  }
  
  static int
! dos_readchar (struct serial *scb, int timeout)
  {
    struct dos_ttystate *port = &ports[scb->fd];
    long then;
*************** dos_readchar (serial_t scb, int timeout)
*** 630,636 ****
  
  
  static serial_ttystate
! dos_get_tty_state (serial_t scb)
  {
    struct dos_ttystate *port = &ports[scb->fd];
    struct dos_ttystate *state;
--- 630,636 ----
  
  
  static serial_ttystate
! dos_get_tty_state (struct serial *scb)
  {
    struct dos_ttystate *port = &ports[scb->fd];
    struct dos_ttystate *state;
*************** dos_get_tty_state (serial_t scb)
*** 654,660 ****
  }
  
  static int
! dos_set_tty_state (serial_t scb, serial_ttystate ttystate)
  {
    struct dos_ttystate *state;
  
--- 654,660 ----
  }
  
  static int
! dos_set_tty_state (struct serial *scb, serial_ttystate ttystate)
  {
    struct dos_ttystate *state;
  
*************** dos_set_tty_state (serial_t scb, serial_
*** 664,670 ****
  }
  
  static int
! dos_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate,
  			   serial_ttystate old_ttystate)
  {
    struct dos_ttystate *state;
--- 664,670 ----
  }
  
  static int
! dos_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate,
  			   serial_ttystate old_ttystate)
  {
    struct dos_ttystate *state;
*************** dos_noflush_set_tty_state (serial_t scb,
*** 675,681 ****
  }
  
  static int
! dos_flush_input (serial_t scb)
  {
    struct dos_ttystate *port = &ports[scb->fd];
    disable ();
--- 675,681 ----
  }
  
  static int
! dos_flush_input (struct serial *scb)
  {
    struct dos_ttystate *port = &ports[scb->fd];
    disable ();
*************** dos_flush_input (serial_t scb)
*** 687,693 ****
  }
  
  static void
! dos_print_tty_state (serial_t scb, serial_ttystate ttystate,
  		     struct ui_file *stream)
  {
    /* Nothing to print */
--- 687,693 ----
  }
  
  static void
! dos_print_tty_state (struct serial *scb, serial_ttystate ttystate,
  		     struct ui_file *stream)
  {
    /* Nothing to print */
*************** dos_baudconv (int rate)
*** 718,724 ****
  
  
  static int
! dos_setbaudrate (serial_t scb, int rate)
  {
    struct dos_ttystate *port = &ports[scb->fd];
  
--- 718,724 ----
  
  
  static int
! dos_setbaudrate (struct serial *scb, int rate)
  {
    struct dos_ttystate *port = &ports[scb->fd];
  
*************** dos_setbaudrate (serial_t scb, int rate)
*** 750,756 ****
  }
  
  static int
! dos_setstopbits (serial_t scb, int num)
  {
    struct dos_ttystate *port = &ports[scb->fd];
    unsigned char cfcr;
--- 750,756 ----
  }
  
  static int
! dos_setstopbits (struct serial *scb, int num)
  {
    struct dos_ttystate *port = &ports[scb->fd];
    unsigned char cfcr;
*************** dos_setstopbits (serial_t scb, int num)
*** 777,783 ****
  }
  
  static int
! dos_write (serial_t scb, const char *str, int len)
  {
    volatile struct dos_ttystate *port = &ports[scb->fd];
    int fifosize = port->fifo ? 16 : 1;
--- 777,783 ----
  }
  
  static int
! dos_write (struct serial *scb, const char *str, int len)
  {
    volatile struct dos_ttystate *port = &ports[scb->fd];
    int fifosize = port->fifo ? 16 : 1;
*************** dos_write (serial_t scb, const char *str
*** 818,824 ****
  
  
  static int
! dos_sendbreak (serial_t scb)
  {
    volatile struct dos_ttystate *port = &ports[scb->fd];
    unsigned char cfcr;
--- 818,824 ----
  
  
  static int
! dos_sendbreak (struct serial *scb)
  {
    volatile struct dos_ttystate *port = &ports[scb->fd];
    unsigned char cfcr;
*************** static struct serial_ops dos_ops =
*** 856,862 ****
    dos_setbaudrate,
    dos_setstopbits,
    dos_noop,			/* wait for output to drain */
!   (void (*)(serial_t, int))NULL	/* change into async mode */
  };
  
  
--- 856,862 ----
    dos_setbaudrate,
    dos_setstopbits,
    dos_noop,			/* wait for output to drain */
!   (void (*)(struct serial *, int))NULL	/* change into async mode */
  };
  
  
Index: ser-pipe.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-pipe.c,v
retrieving revision 1.10
diff -p -r1.10 ser-pipe.c
*** ser-pipe.c	2001/04/08 18:26:03	1.10
--- ser-pipe.c	2001/07/10 23:14:14
***************
*** 34,41 ****
  
  #include <signal.h>
  
! static int pipe_open (serial_t scb, const char *name);
! static void pipe_close (serial_t scb);
  
  extern void _initialize_ser_pipe (void);
  
--- 34,41 ----
  
  #include <signal.h>
  
! static int pipe_open (struct serial *scb, const char *name);
! static void pipe_close (struct serial *scb);
  
  extern void _initialize_ser_pipe (void);
  
*************** struct pipe_state
*** 47,53 ****
  /* Open up a raw pipe */
  
  static int
! pipe_open (serial_t scb, const char *name)
  {
  #if !HAVE_SOCKETPAIR
    return -1;
--- 47,53 ----
  /* Open up a raw pipe */
  
  static int
! pipe_open (struct serial *scb, const char *name)
  {
  #if !HAVE_SOCKETPAIR
    return -1;
*************** pipe_open (serial_t scb, const char *nam
*** 117,123 ****
  }
  
  static void
! pipe_close (serial_t scb)
  {
    struct pipe_state *state = scb->state;
    if (state != NULL)
--- 117,123 ----
  }
  
  static void
! pipe_close (struct serial *scb)
  {
    struct pipe_state *state = scb->state;
    if (state != NULL)
Index: ser-tcp.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-tcp.c,v
retrieving revision 1.5
diff -p -r1.5 ser-tcp.c
*** ser-tcp.c	2001/06/10 16:25:51	1.5
--- ser-tcp.c	2001/07/10 23:14:14
***************
*** 34,48 ****
  #include <signal.h>
  #include "gdb_string.h"
  
! static int tcp_open (serial_t scb, const char *name);
! static void tcp_close (serial_t scb);
  
  void _initialize_ser_tcp (void);
  
  /* Open up a raw tcp socket */
  
  static int
! tcp_open (serial_t scb, const char *name)
  {
    char *port_str;
    int port;
--- 34,48 ----
  #include <signal.h>
  #include "gdb_string.h"
  
! static int tcp_open (struct serial *scb, const char *name);
! static void tcp_close (struct serial *scb);
  
  void _initialize_ser_tcp (void);
  
  /* Open up a raw tcp socket */
  
  static int
! tcp_open (struct serial *scb, const char *name)
  {
    char *port_str;
    int port;
*************** tcp_open (serial_t scb, const char *name
*** 122,128 ****
  }
  
  static void
! tcp_close (serial_t scb)
  {
    if (scb->fd < 0)
      return;
--- 122,128 ----
  }
  
  static void
! tcp_close (struct serial *scb)
  {
    if (scb->fd < 0)
      return;
Index: ser-unix.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-unix.c,v
retrieving revision 1.13
diff -p -r1.13 ser-unix.c
*** ser-unix.c	2001/05/11 18:34:13	1.13
--- ser-unix.c	2001/07/10 23:14:14
*************** struct hardwire_ttystate
*** 64,95 ****
    };
  #endif /* sgtty */
  
! static int hardwire_open (serial_t scb, const char *name);
! static void hardwire_raw (serial_t scb);
! static int wait_for (serial_t scb, int timeout);
! static int hardwire_readchar (serial_t scb, int timeout);
! static int do_hardwire_readchar (serial_t scb, int timeout);
! static int generic_readchar (serial_t scb, int timeout, int (*do_readchar) (serial_t scb, int timeout));
  static int rate_to_code (int rate);
! static int hardwire_setbaudrate (serial_t scb, int rate);
! static void hardwire_close (serial_t scb);
! static int get_tty_state (serial_t scb, struct hardwire_ttystate * state);
! static int set_tty_state (serial_t scb, struct hardwire_ttystate * state);
! static serial_ttystate hardwire_get_tty_state (serial_t scb);
! static int hardwire_set_tty_state (serial_t scb, serial_ttystate state);
! static int hardwire_noflush_set_tty_state (serial_t, serial_ttystate,
! 						   serial_ttystate);
! static void hardwire_print_tty_state (serial_t, serial_ttystate, struct ui_file *);
! static int hardwire_drain_output (serial_t);
! static int hardwire_flush_output (serial_t);
! static int hardwire_flush_input (serial_t);
! static int hardwire_send_break (serial_t);
! static int hardwire_setstopbits (serial_t, int);
  
! static int do_unix_readchar (serial_t scb, int timeout);
  static timer_handler_func push_event;
  static handler_func fd_event;
! static void reschedule (serial_t scb);
  
  void _initialize_ser_hardwire (void);
  
--- 64,100 ----
    };
  #endif /* sgtty */
  
! static int hardwire_open (struct serial *scb, const char *name);
! static void hardwire_raw (struct serial *scb);
! static int wait_for (struct serial *scb, int timeout);
! static int hardwire_readchar (struct serial *scb, int timeout);
! static int do_hardwire_readchar (struct serial *scb, int timeout);
! static int generic_readchar (struct serial *scb, int timeout,
! 			     int (*do_readchar) (struct serial *scb,
! 						 int timeout));
  static int rate_to_code (int rate);
! static int hardwire_setbaudrate (struct serial *scb, int rate);
! static void hardwire_close (struct serial *scb);
! static int get_tty_state (struct serial *scb,
! 			  struct hardwire_ttystate * state);
! static int set_tty_state (struct serial *scb,
! 			  struct hardwire_ttystate * state);
! static serial_ttystate hardwire_get_tty_state (struct serial *scb);
! static int hardwire_set_tty_state (struct serial *scb, serial_ttystate state);
! static int hardwire_noflush_set_tty_state (struct serial *, serial_ttystate,
! 					   serial_ttystate);
! static void hardwire_print_tty_state (struct serial *, serial_ttystate,
! 				      struct ui_file *);
! static int hardwire_drain_output (struct serial *);
! static int hardwire_flush_output (struct serial *);
! static int hardwire_flush_input (struct serial *);
! static int hardwire_send_break (struct serial *);
! static int hardwire_setstopbits (struct serial *, int);
  
! static int do_unix_readchar (struct serial *scb, int timeout);
  static timer_handler_func push_event;
  static handler_func fd_event;
! static void reschedule (struct serial *scb);
  
  void _initialize_ser_hardwire (void);
  
*************** extern int (*ui_loop_hook) (int);
*** 98,104 ****
  /* Open up a real live device for serial I/O */
  
  static int
! hardwire_open (serial_t scb, const char *name)
  {
    scb->fd = open (name, O_RDWR);
    if (scb->fd < 0)
--- 103,109 ----
  /* Open up a real live device for serial I/O */
  
  static int
! hardwire_open (struct serial *scb, const char *name)
  {
    scb->fd = open (name, O_RDWR);
    if (scb->fd < 0)
*************** hardwire_open (serial_t scb, const char 
*** 108,114 ****
  }
  
  static int
! get_tty_state (serial_t scb, struct hardwire_ttystate *state)
  {
  #ifdef HAVE_TERMIOS
    if (tcgetattr (scb->fd, &state->termios) < 0)
--- 113,119 ----
  }
  
  static int
! get_tty_state (struct serial *scb, struct hardwire_ttystate *state)
  {
  #ifdef HAVE_TERMIOS
    if (tcgetattr (scb->fd, &state->termios) < 0)
*************** get_tty_state (serial_t scb, struct hard
*** 138,144 ****
  }
  
  static int
! set_tty_state (serial_t scb, struct hardwire_ttystate *state)
  {
  #ifdef HAVE_TERMIOS
    if (tcsetattr (scb->fd, TCSANOW, &state->termios) < 0)
--- 143,149 ----
  }
  
  static int
! set_tty_state (struct serial *scb, struct hardwire_ttystate *state)
  {
  #ifdef HAVE_TERMIOS
    if (tcsetattr (scb->fd, TCSANOW, &state->termios) < 0)
*************** set_tty_state (serial_t scb, struct hard
*** 168,174 ****
  }
  
  static serial_ttystate
! hardwire_get_tty_state (serial_t scb)
  {
    struct hardwire_ttystate *state;
  
--- 173,179 ----
  }
  
  static serial_ttystate
! hardwire_get_tty_state (struct serial *scb)
  {
    struct hardwire_ttystate *state;
  
*************** hardwire_get_tty_state (serial_t scb)
*** 181,187 ****
  }
  
  static int
! hardwire_set_tty_state (serial_t scb, serial_ttystate ttystate)
  {
    struct hardwire_ttystate *state;
  
--- 186,192 ----
  }
  
  static int
! hardwire_set_tty_state (struct serial *scb, serial_ttystate ttystate)
  {
    struct hardwire_ttystate *state;
  
*************** hardwire_set_tty_state (serial_t scb, se
*** 191,197 ****
  }
  
  static int
! hardwire_noflush_set_tty_state (serial_t scb,
  				serial_ttystate new_ttystate,
  				serial_ttystate old_ttystate)
  {
--- 196,202 ----
  }
  
  static int
! hardwire_noflush_set_tty_state (struct serial *scb,
  				serial_ttystate new_ttystate,
  				serial_ttystate old_ttystate)
  {
*************** hardwire_noflush_set_tty_state (serial_t
*** 224,230 ****
  }
  
  static void
! hardwire_print_tty_state (serial_t scb,
  			  serial_ttystate ttystate,
  			  struct ui_file *stream)
  {
--- 229,235 ----
  }
  
  static void
! hardwire_print_tty_state (struct serial *scb,
  			  serial_ttystate ttystate,
  			  struct ui_file *stream)
  {
*************** hardwire_print_tty_state (serial_t scb,
*** 282,288 ****
  /* Wait for the output to drain away, as opposed to flushing (discarding) it */
  
  static int
! hardwire_drain_output (serial_t scb)
  {
  #ifdef HAVE_TERMIOS
    return tcdrain (scb->fd);
--- 287,293 ----
  /* Wait for the output to drain away, as opposed to flushing (discarding) it */
  
  static int
! hardwire_drain_output (struct serial *scb)
  {
  #ifdef HAVE_TERMIOS
    return tcdrain (scb->fd);
*************** hardwire_drain_output (serial_t scb)
*** 311,317 ****
  }
  
  static int
! hardwire_flush_output (serial_t scb)
  {
  #ifdef HAVE_TERMIOS
    return tcflush (scb->fd, TCOFLUSH);
--- 316,322 ----
  }
  
  static int
! hardwire_flush_output (struct serial *scb)
  {
  #ifdef HAVE_TERMIOS
    return tcflush (scb->fd, TCOFLUSH);
*************** hardwire_flush_output (serial_t scb)
*** 328,334 ****
  }
  
  static int
! hardwire_flush_input (serial_t scb)
  {
    ser_unix_flush_input (scb);
  
--- 333,339 ----
  }
  
  static int
! hardwire_flush_input (struct serial *scb)
  {
    ser_unix_flush_input (scb);
  
*************** hardwire_flush_input (serial_t scb)
*** 347,353 ****
  }
  
  static int
! hardwire_send_break (serial_t scb)
  {
  #ifdef HAVE_TERMIOS
    return tcsendbreak (scb->fd, 0);
--- 352,358 ----
  }
  
  static int
! hardwire_send_break (struct serial *scb)
  {
  #ifdef HAVE_TERMIOS
    return tcsendbreak (scb->fd, 0);
*************** hardwire_send_break (serial_t scb)
*** 377,383 ****
  }
  
  static void
! hardwire_raw (serial_t scb)
  {
    struct hardwire_ttystate state;
  
--- 382,388 ----
  }
  
  static void
! hardwire_raw (struct serial *scb)
  {
    struct hardwire_ttystate state;
  
*************** hardwire_raw (serial_t scb)
*** 432,438 ****
     an overflowed timer is unnecessary. */
  
  static int
! wait_for (serial_t scb, int timeout)
  {
  #ifdef HAVE_SGTTY
    while (1)
--- 437,443 ----
     an overflowed timer is unnecessary. */
  
  static int
! wait_for (struct serial *scb, int timeout)
  {
  #ifdef HAVE_SGTTY
    while (1)
*************** wait_for (serial_t scb, int timeout)
*** 553,559 ****
     that. */
  
  static int
! do_hardwire_readchar (serial_t scb, int timeout)
  {
    int status, delta;
    int detach = 0;
--- 558,564 ----
     that. */
  
  static int
! do_hardwire_readchar (struct serial *scb, int timeout)
  {
    int status, delta;
    int detach = 0;
*************** do_hardwire_readchar (serial_t scb, int 
*** 621,627 ****
  }
  
  static int
! hardwire_readchar (serial_t scb, int timeout)
  {
    return generic_readchar (scb, timeout, do_hardwire_readchar);
  }
--- 626,632 ----
  }
  
  static int
! hardwire_readchar (struct serial *scb, int timeout)
  {
    return generic_readchar (scb, timeout, do_hardwire_readchar);
  }
*************** rate_to_code (int rate)
*** 772,778 ****
  }
  
  static int
! hardwire_setbaudrate (serial_t scb, int rate)
  {
    struct hardwire_ttystate state;
    int baud_code = rate_to_code (rate);
--- 777,783 ----
  }
  
  static int
! hardwire_setbaudrate (struct serial *scb, int rate)
  {
    struct hardwire_ttystate state;
    int baud_code = rate_to_code (rate);
*************** hardwire_setbaudrate (serial_t scb, int 
*** 811,817 ****
  }
  
  static int
! hardwire_setstopbits (serial_t scb, int num)
  {
    struct hardwire_ttystate state;
    int newbit;
--- 816,822 ----
  }
  
  static int
! hardwire_setstopbits (struct serial *scb, int num)
  {
    struct hardwire_ttystate state;
    int newbit;
*************** hardwire_setstopbits (serial_t scb, int 
*** 854,860 ****
  }
  
  static void
! hardwire_close (serial_t scb)
  {
    if (scb->fd < 0)
      return;
--- 859,865 ----
  }
  
  static void
! hardwire_close (struct serial *scb)
  {
    if (scb->fd < 0)
      return;
*************** hardwire_close (serial_t scb)
*** 867,886 ****
  /* Generic operations used by all UNIX/FD based serial interfaces. */
  
  serial_ttystate
! ser_unix_nop_get_tty_state (serial_t scb)
  {
    /* allocate a dummy */
    return (serial_ttystate) XMALLOC (int);
  }
  
  int
! ser_unix_nop_set_tty_state (serial_t scb, serial_ttystate ttystate)
  {
    return 0;
  }
  
  void
! ser_unix_nop_raw (serial_t scb)
  {
    return;			/* Always in raw mode */
  }
--- 872,891 ----
  /* Generic operations used by all UNIX/FD based serial interfaces. */
  
  serial_ttystate
! ser_unix_nop_get_tty_state (struct serial *scb)
  {
    /* allocate a dummy */
    return (serial_ttystate) XMALLOC (int);
  }
  
  int
! ser_unix_nop_set_tty_state (struct serial *scb, serial_ttystate ttystate)
  {
    return 0;
  }
  
  void
! ser_unix_nop_raw (struct serial *scb)
  {
    return;			/* Always in raw mode */
  }
*************** ser_unix_nop_raw (serial_t scb)
*** 889,895 ****
     otherwise SERIAL_TIMEOUT or SERIAL_ERROR. */
  
  int
! ser_unix_wait_for (serial_t scb, int timeout)
  {
    while (1)
      {
--- 894,900 ----
     otherwise SERIAL_TIMEOUT or SERIAL_ERROR. */
  
  int
! ser_unix_wait_for (struct serial *scb, int timeout)
  {
    while (1)
      {
*************** ser_unix_wait_for (serial_t scb, int tim
*** 934,940 ****
     dead, or -3 for any other error (see errno in that case). */
  
  static int
! do_unix_readchar (serial_t scb, int timeout)
  {
    int status;
    int delta;
--- 939,945 ----
     dead, or -3 for any other error (see errno in that case). */
  
  static int
! do_unix_readchar (struct serial *scb, int timeout)
  {
    int status;
    int delta;
*************** do_unix_readchar (serial_t scb, int time
*** 1025,1032 ****
     will be called. */
  
  static int
! generic_readchar (serial_t scb, int timeout,
! 		  int (do_readchar) (serial_t scb, int timeout))
  {
    int ch;
    if (scb->bufcnt > 0)
--- 1030,1037 ----
     will be called. */
  
  static int
! generic_readchar (struct serial *scb, int timeout,
! 		  int (do_readchar) (struct serial *scb, int timeout))
  {
    int ch;
    if (scb->bufcnt > 0)
*************** generic_readchar (serial_t scb, int time
*** 1063,1075 ****
  }
  
  int
! ser_unix_readchar (serial_t scb, int timeout)
  {
    return generic_readchar (scb, timeout, do_unix_readchar);
  }
  
  int
! ser_unix_nop_noflush_set_tty_state (serial_t scb,
  				    serial_ttystate new_ttystate,
  				    serial_ttystate old_ttystate)
  {
--- 1068,1080 ----
  }
  
  int
! ser_unix_readchar (struct serial *scb, int timeout)
  {
    return generic_readchar (scb, timeout, do_unix_readchar);
  }
  
  int
! ser_unix_nop_noflush_set_tty_state (struct serial *scb,
  				    serial_ttystate new_ttystate,
  				    serial_ttystate old_ttystate)
  {
*************** ser_unix_nop_noflush_set_tty_state (seri
*** 1077,1083 ****
  }
  
  void
! ser_unix_nop_print_tty_state (serial_t scb, 
  			      serial_ttystate ttystate,
  			      struct ui_file *stream)
  {
--- 1082,1088 ----
  }
  
  void
! ser_unix_nop_print_tty_state (struct serial *scb, 
  			      serial_ttystate ttystate,
  			      struct ui_file *stream)
  {
*************** ser_unix_nop_print_tty_state (serial_t s
*** 1086,1104 ****
  }
  
  int
! ser_unix_nop_setbaudrate (serial_t scb, int rate)
  {
    return 0;			/* Never fails! */
  }
  
  int
! ser_unix_nop_setstopbits (serial_t scb, int num)
  {
    return 0;			/* Never fails! */
  }
  
  int
! ser_unix_write (serial_t scb, const char *str, int len)
  {
    int cc;
  
--- 1091,1109 ----
  }
  
  int
! ser_unix_nop_setbaudrate (struct serial *scb, int rate)
  {
    return 0;			/* Never fails! */
  }
  
  int
! ser_unix_nop_setstopbits (struct serial *scb, int num)
  {
    return 0;			/* Never fails! */
  }
  
  int
! ser_unix_write (struct serial *scb, const char *str, int len)
  {
    int cc;
  
*************** ser_unix_write (serial_t scb, const char
*** 1115,1127 ****
  }
  
  int
! ser_unix_nop_flush_output (serial_t scb)
  {
    return 0;
  }
  
  int
! ser_unix_flush_input (serial_t scb)
  {
    if (scb->bufcnt >= 0)
      {
--- 1120,1132 ----
  }
  
  int
! ser_unix_nop_flush_output (struct serial *scb)
  {
    return 0;
  }
  
  int
! ser_unix_flush_input (struct serial *scb)
  {
    if (scb->bufcnt >= 0)
      {
*************** ser_unix_flush_input (serial_t scb)
*** 1134,1146 ****
  }
  
  int
! ser_unix_nop_send_break (serial_t scb)
  {
    return 0;
  }
  
  int
! ser_unix_nop_drain_output (serial_t scb)
  {
    return 0;
  }
--- 1139,1151 ----
  }
  
  int
! ser_unix_nop_send_break (struct serial *scb)
  {
    return 0;
  }
  
  int
! ser_unix_nop_drain_output (struct serial *scb)
  {
    return 0;
  }
*************** enum {
*** 1177,1183 ****
     scheduled task is only changed when needed. */
  
  static void
! reschedule (serial_t scb)
  {
    if (SERIAL_IS_ASYNC_P (scb))
      {
--- 1182,1188 ----
     scheduled task is only changed when needed. */
  
  static void
! reschedule (struct serial *scb)
  {
    if (SERIAL_IS_ASYNC_P (scb))
      {
*************** reschedule (serial_t scb)
*** 1244,1250 ****
  static void
  fd_event (int error, void *context)
  {
!   serial_t scb = context;
    if (error != 0)
      {
        scb->bufcnt = SERIAL_ERROR;
--- 1249,1255 ----
  static void
  fd_event (int error, void *context)
  {
!   struct serial *scb = context;
    if (error != 0)
      {
        scb->bufcnt = SERIAL_ERROR;
*************** fd_event (int error, void *context)
*** 1286,1292 ****
  static void
  push_event (void *context)
  {
!   serial_t scb = context;
    scb->async_state = NOTHING_SCHEDULED; /* Timers are one-off */
    scb->async_handler (scb, scb->async_context);
    /* re-schedule */
--- 1291,1297 ----
  static void
  push_event (void *context)
  {
!   struct serial *scb = context;
    scb->async_state = NOTHING_SCHEDULED; /* Timers are one-off */
    scb->async_handler (scb, scb->async_context);
    /* re-schedule */
*************** push_event (void *context)
*** 1296,1302 ****
  /* Put the SERIAL device into/out-of ASYNC mode.  */
  
  void
! ser_unix_async (serial_t scb,
  		int async_p)
  {
    if (async_p)
--- 1301,1307 ----
  /* Put the SERIAL device into/out-of ASYNC mode.  */
  
  void
! ser_unix_async (struct serial *scb,
  		int async_p)
  {
    if (async_p)
Index: ser-unix.h
===================================================================
RCS file: /cvs/src/src/gdb/ser-unix.h,v
retrieving revision 1.1.1.3
diff -p -r1.1.1.3 ser-unix.h
*** ser-unix.h	2000/02/02 00:21:10	1.1.1.3
--- ser-unix.h	2001/07/10 23:14:14
***************
*** 26,48 ****
  
  /* Generic UNIX/FD functions */
  
! extern int ser_unix_nop_flush_output (serial_t scb);
! extern int ser_unix_flush_input (serial_t scb);
! extern int ser_unix_nop_send_break (serial_t scb);
! extern void ser_unix_nop_raw (serial_t scb);
! extern serial_ttystate ser_unix_nop_get_tty_state (serial_t scb);
! extern int ser_unix_nop_set_tty_state (serial_t scb, serial_ttystate ttystate);
! extern void ser_unix_nop_print_tty_state (serial_t scb, serial_ttystate ttystate, struct ui_file *stream);
! extern int ser_unix_nop_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate);
! extern int ser_unix_nop_setbaudrate (serial_t scb, int rate);
! extern int ser_unix_nop_setstopbits (serial_t scb, int rate);
! extern int ser_unix_nop_drain_output (serial_t scb);
  
! extern int ser_unix_wait_for (serial_t scb, int timeout);
! extern int ser_unix_readchar (serial_t scb, int timeout);
  
! extern int ser_unix_write (serial_t scb, const char *str, int len);
  
! extern void ser_unix_async (serial_t scb, int async_p);
  
  #endif
--- 26,53 ----
  
  /* Generic UNIX/FD functions */
  
! extern int ser_unix_nop_flush_output (struct serial *scb);
! extern int ser_unix_flush_input (struct serial *scb);
! extern int ser_unix_nop_send_break (struct serial *scb);
! extern void ser_unix_nop_raw (struct serial *scb);
! extern serial_ttystate ser_unix_nop_get_tty_state (struct serial *scb);
! extern int ser_unix_nop_set_tty_state (struct serial *scb,
! 				       serial_ttystate ttystate);
! extern void ser_unix_nop_print_tty_state (struct serial *scb,
! 					  serial_ttystate ttystate,
! 					  struct ui_file *stream);
! extern int ser_unix_nop_noflush_set_tty_state (struct serial *scb,
! 					       serial_ttystate new_ttystate,
! 					       serial_ttystate old_ttystate);
! extern int ser_unix_nop_setbaudrate (struct serial *scb, int rate);
! extern int ser_unix_nop_setstopbits (struct serial *scb, int rate);
! extern int ser_unix_nop_drain_output (struct serial *scb);
  
! extern int ser_unix_wait_for (struct serial *scb, int timeout);
! extern int ser_unix_readchar (struct serial *scb, int timeout);
  
! extern int ser_unix_write (struct serial *scb, const char *str, int len);
  
! extern void ser_unix_async (struct serial *scb, int async_p);
  
  #endif
Index: serial.c
===================================================================
RCS file: /cvs/src/src/gdb/serial.c,v
retrieving revision 1.10
diff -p -r1.10 serial.c
*** serial.c	2001/07/09 14:38:49	1.10
--- serial.c	2001/07/10 23:14:14
*************** static struct serial_ops *serial_ops_lis
*** 38,48 ****
  
  /* This is the last serial stream opened.  Used by connect command. */
  
! static serial_t last_serial_opened = NULL;
  
  /* Pointer to list of scb's. */
  
! static serial_t scb_base;
  
  /* Non-NULL gives filename which contains a recording of the remote session,
     suitable for playback by gdbserver. */
--- 38,48 ----
  
  /* This is the last serial stream opened.  Used by connect command. */
  
! static struct serial *last_serial_opened = NULL;
  
  /* Pointer to list of scb's. */
  
! static struct serial *scb_base;
  
  /* Non-NULL gives filename which contains a recording of the remote session,
     suitable for playback by gdbserver. */
*************** static const char *serial_logbase = logb
*** 63,69 ****
  #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
  
  
- 
  static int serial_current_type = 0;
  
  /* Log char CH of type CHTYPE, with TIMEOUT */
--- 63,68 ----
*************** serial_add_interface (struct serial_ops 
*** 172,181 ****
  
  /* Open up a device or a network socket, depending upon the syntax of NAME. */
  
! serial_t
  serial_open (const char *name)
  {
!   serial_t scb;
    struct serial_ops *ops;
    const char *open_name = name;
  
--- 171,180 ----
  
  /* Open up a device or a network socket, depending upon the syntax of NAME. */
  
! struct serial *
  serial_open (const char *name)
  {
!   struct serial *scb;
    struct serial_ops *ops;
    const char *open_name = name;
  
*************** serial_open (const char *name)
*** 239,248 ****
    return scb;
  }
  
! serial_t
  serial_fdopen (const int fd)
  {
!   serial_t scb;
    struct serial_ops *ops;
  
    for (scb = scb_base; scb; scb = scb->next)
--- 238,247 ----
    return scb;
  }
  
! struct serial *
  serial_fdopen (const int fd)
  {
!   struct serial *scb;
    struct serial_ops *ops;
  
    for (scb = scb_base; scb; scb = scb->next)
*************** serial_fdopen (const int fd)
*** 281,289 ****
  }
  
  static void
! do_serial_close (serial_t scb, int really_close)
  {
!   serial_t tmp_scb;
  
    last_serial_opened = NULL;
  
--- 280,288 ----
  }
  
  static void
! do_serial_close (struct serial *scb, int really_close)
  {
!   struct serial *tmp_scb;
  
    last_serial_opened = NULL;
  
*************** do_serial_close (serial_t scb, int reall
*** 333,351 ****
  }
  
  void
! serial_close (serial_t scb)
  {
    do_serial_close (scb, 1);
  }
  
  void
! serial_un_fdopen (serial_t scb)
  {
    do_serial_close (scb, 0);
  }
  
  int
! serial_readchar (serial_t scb, int timeout)
  {
    int ch;
  
--- 332,350 ----
  }
  
  void
! serial_close (struct serial *scb)
  {
    do_serial_close (scb, 1);
  }
  
  void
! serial_un_fdopen (struct serial *scb)
  {
    do_serial_close (scb, 0);
  }
  
  int
! serial_readchar (struct serial *scb, int timeout)
  {
    int ch;
  
*************** serial_readchar (serial_t scb, int timeo
*** 376,382 ****
  }
  
  int
! serial_write (serial_t scb, const char *str, int len)
  {
    if (serial_logfp != NULL)
      {
--- 375,381 ----
  }
  
  int
! serial_write (struct serial *scb, const char *str, int len)
  {
    if (serial_logfp != NULL)
      {
*************** serial_write (serial_t scb, const char *
*** 394,400 ****
  }
  
  void
! serial_printf (serial_t desc, const char *format,...)
  {
    va_list args;
    char *buf;
--- 393,399 ----
  }
  
  void
! serial_printf (struct serial *desc, const char *format,...)
  {
    va_list args;
    char *buf;
*************** serial_printf (serial_t desc, const char
*** 408,432 ****
  }
  
  int
! serial_drain_output (serial_t scb)
  {
    return scb->ops->drain_output (scb);
  }
  
  int
! serial_flush_output (serial_t scb)
  {
    return scb->ops->flush_output (scb);
  }
  
  int
! serial_flush_input (serial_t scb)
  {
    return scb->ops->flush_input (scb);
  }
  
  int
! serial_send_break (serial_t scb)
  {
    if (serial_logfp != NULL)
      serial_logchar (serial_logfp, 'w', SERIAL_BREAK, 0);
--- 407,431 ----
  }
  
  int
! serial_drain_output (struct serial *scb)
  {
    return scb->ops->drain_output (scb);
  }
  
  int
! serial_flush_output (struct serial *scb)
  {
    return scb->ops->flush_output (scb);
  }
  
  int
! serial_flush_input (struct serial *scb)
  {
    return scb->ops->flush_input (scb);
  }
  
  int
! serial_send_break (struct serial *scb)
  {
    if (serial_logfp != NULL)
      serial_logchar (serial_logfp, 'w', SERIAL_BREAK, 0);
*************** serial_send_break (serial_t scb)
*** 435,459 ****
  }
  
  void
! serial_raw (serial_t scb)
  {
    scb->ops->go_raw (scb);
  }
  
  serial_ttystate
! serial_get_tty_state (serial_t scb)
  {
    return scb->ops->get_tty_state (scb);
  }
  
  int
! serial_set_tty_state (serial_t scb, serial_ttystate ttystate)
  {
    return scb->ops->set_tty_state (scb, ttystate);
  }
  
  void
! serial_print_tty_state (serial_t scb,
  			serial_ttystate ttystate,
  			struct ui_file *stream)
  {
--- 434,458 ----
  }
  
  void
! serial_raw (struct serial *scb)
  {
    scb->ops->go_raw (scb);
  }
  
  serial_ttystate
! serial_get_tty_state (struct serial *scb)
  {
    return scb->ops->get_tty_state (scb);
  }
  
  int
! serial_set_tty_state (struct serial *scb, serial_ttystate ttystate)
  {
    return scb->ops->set_tty_state (scb, ttystate);
  }
  
  void
! serial_print_tty_state (struct serial *scb,
  			serial_ttystate ttystate,
  			struct ui_file *stream)
  {
*************** serial_print_tty_state (serial_t scb,
*** 461,467 ****
  }
  
  int
! serial_noflush_set_tty_state (serial_t scb,
  			      serial_ttystate new_ttystate,
  			      serial_ttystate old_ttystate)
  {
--- 460,466 ----
  }
  
  int
! serial_noflush_set_tty_state (struct serial *scb,
  			      serial_ttystate new_ttystate,
  			      serial_ttystate old_ttystate)
  {
*************** serial_noflush_set_tty_state (serial_t s
*** 469,499 ****
  }
  
  int
! serial_setbaudrate (serial_t scb, int rate)
  {
    return scb->ops->setbaudrate (scb, rate);
  }
  
  int
! serial_setstopbits (serial_t scb, int num)
  {
    return scb->ops->setstopbits (scb, num);
  }
  
  int
! serial_can_async_p (serial_t scb)
  {
    return (scb->ops->async != NULL);
  }
  
  int
! serial_is_async_p (serial_t scb)
  {
    return (scb->ops->async != NULL) && (scb->async_handler != NULL);
  }
  
  void
! serial_async (serial_t scb,
  	      serial_event_ftype *handler,
  	      void *context)
  {
--- 468,498 ----
  }
  
  int
! serial_setbaudrate (struct serial *scb, int rate)
  {
    return scb->ops->setbaudrate (scb, rate);
  }
  
  int
! serial_setstopbits (struct serial *scb, int num)
  {
    return scb->ops->setstopbits (scb, num);
  }
  
  int
! serial_can_async_p (struct serial *scb)
  {
    return (scb->ops->async != NULL);
  }
  
  int
! serial_is_async_p (struct serial *scb)
  {
    return (scb->ops->async != NULL) && (scb->async_handler != NULL);
  }
  
  void
! serial_async (struct serial *scb,
  	      serial_event_ftype *handler,
  	      void *context)
  {
*************** serial_async (serial_t scb,
*** 506,512 ****
  }
  
  int
! deprecated_serial_fd (serial_t scb)
  {
    /* FIXME: should this output a warning that deprecated code is being
       called? */
--- 505,511 ----
  }
  
  int
! deprecated_serial_fd (struct serial *scb)
  {
    /* FIXME: should this output a warning that deprecated code is being
       called? */
*************** deprecated_serial_fd (serial_t scb)
*** 519,541 ****
  }
  
  void
! serial_debug (serial_t scb, int debug_p)
  {
    scb->debug_p = debug_p;
  }
  
  int
! serial_debug_p (serial_t scb)
  {
    return scb->debug_p || global_serial_debug_p;
  }
  
  
  #if 0
! /*
!    The connect command is #if 0 because I hadn't thought of an elegant
!    way to wait for I/O on two serial_t's simultaneously.  Two solutions
!    came to mind:
  
     1) Fork, and have have one fork handle the to user direction,
     and have the other hand the to target direction.  This
--- 518,539 ----
  }
  
  void
! serial_debug (struct serial *scb, int debug_p)
  {
    scb->debug_p = debug_p;
  }
  
  int
! serial_debug_p (struct serial *scb)
  {
    return scb->debug_p || global_serial_debug_p;
  }
  
  
  #if 0
! /* The connect command is #if 0 because I hadn't thought of an elegant
!    way to wait for I/O on two `struct serial *'s simultaneously.  Two
!    solutions came to mind:
  
     1) Fork, and have have one fork handle the to user direction,
     and have the other hand the to target direction.  This
*************** serial_debug_p (serial_t scb)
*** 545,557 ****
     the target side can both be waited on via the same
     mechanism.  This may not be true for DOS, if GDB is
     talking to the target via a TCP socket.
!    -grossman, 8 Jun 93
!  */
  
  /* Connect the user directly to the remote system.  This command acts just like
     the 'cu' or 'tip' command.  Use <CR>~. or <CR>~^D to break out.  */
  
! static serial_t tty_desc;	/* Controlling terminal */
  
  static void
  cleanup_tty (serial_ttystate ttystate)
--- 543,554 ----
     the target side can both be waited on via the same
     mechanism.  This may not be true for DOS, if GDB is
     talking to the target via a TCP socket.
!    -grossman, 8 Jun 93 */
  
  /* Connect the user directly to the remote system.  This command acts just like
     the 'cu' or 'tip' command.  Use <CR>~. or <CR>~^D to break out.  */
  
! static struct serial *tty_desc;	/* Controlling terminal */
  
  static void
  cleanup_tty (serial_ttystate ttystate)
*************** connect_command (char *args, int fromtty
*** 568,574 ****
    int c;
    char cur_esc = 0;
    serial_ttystate ttystate;
!   serial_t port_desc;		/* TTY port */
  
    dont_repeat ();
  
--- 565,571 ----
    int c;
    char cur_esc = 0;
    serial_ttystate ttystate;
!   struct serial *port_desc;		/* TTY port */
  
    dont_repeat ();
  
Index: serial.h
===================================================================
RCS file: /cvs/src/src/gdb/serial.h,v
retrieving revision 1.4
diff -p -r1.4 serial.h
*** serial.h	2001/07/09 14:38:49	1.4
--- serial.h	2001/07/10 23:14:14
***************
*** 30,57 ****
  
  typedef void *serial_ttystate;
  struct serial;
- typedef struct serial *serial_t;
  
! /* Try to open NAME.  Returns a new serial_t on success, NULL on
!    failure. */
  
! extern serial_t serial_open (const char *name);
  #define SERIAL_OPEN(NAME) serial_open(NAME)
  
  /* Open a new serial stream using a file handle.  */
  
! extern serial_t serial_fdopen (const int fd);
  #define SERIAL_FDOPEN(FD) serial_fdopen(FD)
  
! /* Push out all buffers, close the device and destroy SERIAL_T. */
  
! extern void serial_close (serial_t);
  #define SERIAL_CLOSE(SERIAL_T) serial_close ((SERIAL_T))
  
! /* Push out all buffers and destroy SERIAL_T without closing the
!    device.  */
  
! extern void serial_un_fdopen (serial_t scb);
  #define SERIAL_UN_FDOPEN(SERIAL_T) serial_un_fdopen ((SERIAL_T))
  
  /* Read one char from the serial device with TIMEOUT seconds to wait
--- 30,55 ----
  
  typedef void *serial_ttystate;
  struct serial;
  
! /* Try to open NAME.  Returns a new `struct serial *' on success, NULL
!    on failure. */
  
! extern struct serial *serial_open (const char *name);
  #define SERIAL_OPEN(NAME) serial_open(NAME)
  
  /* Open a new serial stream using a file handle.  */
  
! extern struct serial *serial_fdopen (const int fd);
  #define SERIAL_FDOPEN(FD) serial_fdopen(FD)
  
! /* Push out all buffers, close the device and destroy SCB. */
  
! extern void serial_close (struct serial *scb);
  #define SERIAL_CLOSE(SERIAL_T) serial_close ((SERIAL_T))
  
! /* Push out all buffers and destroy SCB without closing the device.  */
  
! extern void serial_un_fdopen (struct serial *scb);
  #define SERIAL_UN_FDOPEN(SERIAL_T) serial_un_fdopen ((SERIAL_T))
  
  /* Read one char from the serial device with TIMEOUT seconds to wait
*************** enum serial_rc {
*** 70,119 ****
  			   things like the line dropping dead. */
  };
  
! extern int serial_readchar (serial_t scb, int timeout);
  #define SERIAL_READCHAR(SERIAL_T, TIMEOUT) serial_readchar ((SERIAL_T), (TIMEOUT))
  
! /* Write LEN chars from STRING to the port SERIAL_T.  Returns 0 for
     success, non-zero for failure.  */
  
! extern int serial_write (serial_t scb, const char *str, int len);
  #define SERIAL_WRITE(SERIAL_T, STRING,LEN)  serial_write (SERIAL_T, STRING, LEN)
  
  /* Write a printf style string onto the serial port. */
  
! extern void serial_printf (serial_t desc, const char *,...) ATTR_FORMAT (printf, 2, 3);
  
  /* Allow pending output to drain. */
  
! extern int serial_drain_output (serial_t);
  #define SERIAL_DRAIN_OUTPUT(SERIAL_T) serial_drain_output ((SERIAL_T))
  
  /* Flush (discard) pending output.  Might also flush input (if this
     system can't flush only output).  */
  
! extern int serial_flush_output (serial_t);
  #define SERIAL_FLUSH_OUTPUT(SERIAL_T) serial_flush_output ((SERIAL_T))
  
  /* Flush pending input.  Might also flush output (if this system can't
     flush only input).  */
  
! extern int serial_flush_input (serial_t);
  #define SERIAL_FLUSH_INPUT(SERIAL_T) serial_flush_input ((SERIAL_T))
  
  /* Send a break between 0.25 and 0.5 seconds long.  */
  
! extern int serial_send_break (serial_t scb);
  #define SERIAL_SEND_BREAK(SERIAL_T) serial_send_break (SERIAL_T)
  
  /* Turn the port into raw mode. */
  
! extern void serial_raw (serial_t scb);
  #define SERIAL_RAW(SERIAL_T) serial_raw ((SERIAL_T))
  
  /* Return a pointer to a newly malloc'd ttystate containing the state
     of the tty.  */
  
! extern serial_ttystate serial_get_tty_state (serial_t scb);
  #define SERIAL_GET_TTY_STATE(SERIAL_T) serial_get_tty_state ((SERIAL_T))
  
  /* Set the state of the tty to TTYSTATE.  The change is immediate.
--- 68,117 ----
  			   things like the line dropping dead. */
  };
  
! extern int serial_readchar (struct serial *scb, int timeout);
  #define SERIAL_READCHAR(SERIAL_T, TIMEOUT) serial_readchar ((SERIAL_T), (TIMEOUT))
  
! /* Write LEN chars from STRING to the port SCB.  Returns 0 for
     success, non-zero for failure.  */
  
! extern int serial_write (struct serial *scb, const char *str, int len);
  #define SERIAL_WRITE(SERIAL_T, STRING,LEN)  serial_write (SERIAL_T, STRING, LEN)
  
  /* Write a printf style string onto the serial port. */
  
! extern void serial_printf (struct serial *desc, const char *,...) ATTR_FORMAT (printf, 2, 3);
  
  /* Allow pending output to drain. */
  
! extern int serial_drain_output (struct serial *);
  #define SERIAL_DRAIN_OUTPUT(SERIAL_T) serial_drain_output ((SERIAL_T))
  
  /* Flush (discard) pending output.  Might also flush input (if this
     system can't flush only output).  */
  
! extern int serial_flush_output (struct serial *);
  #define SERIAL_FLUSH_OUTPUT(SERIAL_T) serial_flush_output ((SERIAL_T))
  
  /* Flush pending input.  Might also flush output (if this system can't
     flush only input).  */
  
! extern int serial_flush_input (struct serial *);
  #define SERIAL_FLUSH_INPUT(SERIAL_T) serial_flush_input ((SERIAL_T))
  
  /* Send a break between 0.25 and 0.5 seconds long.  */
  
! extern int serial_send_break (struct serial *scb);
  #define SERIAL_SEND_BREAK(SERIAL_T) serial_send_break (SERIAL_T)
  
  /* Turn the port into raw mode. */
  
! extern void serial_raw (struct serial *scb);
  #define SERIAL_RAW(SERIAL_T) serial_raw ((SERIAL_T))
  
  /* Return a pointer to a newly malloc'd ttystate containing the state
     of the tty.  */
  
! extern serial_ttystate serial_get_tty_state (struct serial *scb);
  #define SERIAL_GET_TTY_STATE(SERIAL_T) serial_get_tty_state ((SERIAL_T))
  
  /* Set the state of the tty to TTYSTATE.  The change is immediate.
*************** extern serial_ttystate serial_get_tty_st
*** 121,134 ****
     Returns 0 for success, negative value for error (in which case
     errno contains the error).  */
  
! extern int serial_set_tty_state (serial_t scb, serial_ttystate ttystate);
  #define SERIAL_SET_TTY_STATE(SERIAL_T, TTYSTATE) serial_set_tty_state ((SERIAL_T), (TTYSTATE))
  
  /* printf_filtered a user-comprehensible description of ttystate on
     the specified STREAM. FIXME: At present this sends output to the
     default stream - GDB_STDOUT. */
  
! extern void serial_print_tty_state (serial_t scb, serial_ttystate ttystate, struct ui_file *);
  #define SERIAL_PRINT_TTY_STATE(SERIAL_T, TTYSTATE, STREAM) serial_print_tty_state ((SERIAL_T), (TTYSTATE), (STREAM))
  
  /* Set the tty state to NEW_TTYSTATE, where OLD_TTYSTATE is the
--- 119,132 ----
     Returns 0 for success, negative value for error (in which case
     errno contains the error).  */
  
! extern int serial_set_tty_state (struct serial *scb, serial_ttystate ttystate);
  #define SERIAL_SET_TTY_STATE(SERIAL_T, TTYSTATE) serial_set_tty_state ((SERIAL_T), (TTYSTATE))
  
  /* printf_filtered a user-comprehensible description of ttystate on
     the specified STREAM. FIXME: At present this sends output to the
     default stream - GDB_STDOUT. */
  
! extern void serial_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *);
  #define SERIAL_PRINT_TTY_STATE(SERIAL_T, TTYSTATE, STREAM) serial_print_tty_state ((SERIAL_T), (TTYSTATE), (STREAM))
  
  /* Set the tty state to NEW_TTYSTATE, where OLD_TTYSTATE is the
*************** extern void serial_print_tty_state (seri
*** 137,150 ****
     This means that we never switch in or out of raw mode, even if
     NEW_TTYSTATE specifies a switch.  */
  
! extern int serial_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate);
  #define SERIAL_NOFLUSH_SET_TTY_STATE(SERIAL_T, NEW_TTYSTATE, OLD_TTYSTATE) \
  serial_noflush_set_tty_state ((SERIAL_T), (NEW_TTYSTATE), (OLD_TTYSTATE))
  
  /* Set the baudrate to the decimal value supplied.  Returns 0 for
     success, -1 for failure.  */
  
! extern int serial_setbaudrate (serial_t scb, int rate);
  #define SERIAL_SETBAUDRATE(SERIAL_T, RATE) serial_setbaudrate ((SERIAL_T), (RATE))
  
  /* Set the number of stop bits to the value specified.  Returns 0 for
--- 135,148 ----
     This means that we never switch in or out of raw mode, even if
     NEW_TTYSTATE specifies a switch.  */
  
! extern int serial_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate);
  #define SERIAL_NOFLUSH_SET_TTY_STATE(SERIAL_T, NEW_TTYSTATE, OLD_TTYSTATE) \
  serial_noflush_set_tty_state ((SERIAL_T), (NEW_TTYSTATE), (OLD_TTYSTATE))
  
  /* Set the baudrate to the decimal value supplied.  Returns 0 for
     success, -1 for failure.  */
  
! extern int serial_setbaudrate (struct serial *scb, int rate);
  #define SERIAL_SETBAUDRATE(SERIAL_T, RATE) serial_setbaudrate ((SERIAL_T), (RATE))
  
  /* Set the number of stop bits to the value specified.  Returns 0 for
*************** extern int serial_setbaudrate (serial_t 
*** 154,180 ****
  #define SERIAL_1_AND_A_HALF_STOPBITS 2	/* 1.5 bits, snicker... */
  #define SERIAL_2_STOPBITS 3
  
! extern int serial_setstopbits (serial_t scb, int num);
  #define SERIAL_SETSTOPBITS(SERIAL_T, NUM) serial_setstopbits ((SERIAL_T), (NUM))
  
  /* Asynchronous serial interface: */
  
  /* Can the serial device support asynchronous mode? */
  
! extern int serial_can_async_p (serial_t scb);
  #define SERIAL_CAN_ASYNC_P(SERIAL_T) serial_can_async_p ((SERIAL_T))
  
  /* Has the serial device been put in asynchronous mode? */
  
! extern int serial_is_async_p (serial_t scb);
  #define SERIAL_IS_ASYNC_P(SERIAL_T) serial_is_async_p ((SERIAL_T))
  
  /* For ASYNC enabled devices, register a callback and enable
     asynchronous mode.  To disable asynchronous mode, register a NULL
     callback. */
  
! typedef void (serial_event_ftype) (serial_t scb, void *context);
! extern void serial_async (serial_t scb, serial_event_ftype *handler, void *context);
  #define SERIAL_ASYNC(SERIAL_T, HANDLER, CONTEXT) serial_async ((SERIAL_T), (HANDLER), (CONTEXT)) 
  
  /* Provide direct access to the underlying FD (if any) used to
--- 152,178 ----
  #define SERIAL_1_AND_A_HALF_STOPBITS 2	/* 1.5 bits, snicker... */
  #define SERIAL_2_STOPBITS 3
  
! extern int serial_setstopbits (struct serial *scb, int num);
  #define SERIAL_SETSTOPBITS(SERIAL_T, NUM) serial_setstopbits ((SERIAL_T), (NUM))
  
  /* Asynchronous serial interface: */
  
  /* Can the serial device support asynchronous mode? */
  
! extern int serial_can_async_p (struct serial *scb);
  #define SERIAL_CAN_ASYNC_P(SERIAL_T) serial_can_async_p ((SERIAL_T))
  
  /* Has the serial device been put in asynchronous mode? */
  
! extern int serial_is_async_p (struct serial *scb);
  #define SERIAL_IS_ASYNC_P(SERIAL_T) serial_is_async_p ((SERIAL_T))
  
  /* For ASYNC enabled devices, register a callback and enable
     asynchronous mode.  To disable asynchronous mode, register a NULL
     callback. */
  
! typedef void (serial_event_ftype) (struct serial *scb, void *context);
! extern void serial_async (struct serial *scb, serial_event_ftype *handler, void *context);
  #define SERIAL_ASYNC(SERIAL_T, HANDLER, CONTEXT) serial_async ((SERIAL_T), (HANDLER), (CONTEXT)) 
  
  /* Provide direct access to the underlying FD (if any) used to
*************** extern void serial_async (serial_t scb, 
*** 182,188 ****
     deprecated. Will call internal_error() if the operation isn't
     applicable to the current serial device. */
  
! extern int deprecated_serial_fd (serial_t scb);
  #define DEPRECATED_SERIAL_FD(SERIAL_T) deprecated_serial_fd ((SERIAL_T))
  
  /* Trace/debug mechanism.
--- 180,186 ----
     deprecated. Will call internal_error() if the operation isn't
     applicable to the current serial device. */
  
! extern int deprecated_serial_fd (struct serial *scb);
  #define DEPRECATED_SERIAL_FD(SERIAL_T) deprecated_serial_fd ((SERIAL_T))
  
  /* Trace/debug mechanism.
*************** extern int deprecated_serial_fd (serial_
*** 190,199 ****
     SERIAL_DEBUG() enables/disables internal debugging.
     SERIAL_DEBUG_P() indicates the current debug state. */
  
! extern void serial_debug (serial_t scb, int debug_p);
  #define SERIAL_DEBUG(SERIAL_T, DEBUG_P) serial_debug ((SERIAL_T), (DEBUG_P))
  
! extern int serial_debug_p (serial_t scb);
  #define SERIAL_DEBUG_P(SERIAL_T) serial_debug_p ((SERIAL_T))
  
  
--- 188,197 ----
     SERIAL_DEBUG() enables/disables internal debugging.
     SERIAL_DEBUG_P() indicates the current debug state. */
  
! extern void serial_debug (struct serial *scb, int debug_p);
  #define SERIAL_DEBUG(SERIAL_T, DEBUG_P) serial_debug ((SERIAL_T), (DEBUG_P))
  
! extern int serial_debug_p (struct serial *scb);
  #define SERIAL_DEBUG_P(SERIAL_T) serial_debug_p ((SERIAL_T))
  
  
*************** struct serial
*** 215,221 ****
  				   still need to wait for this many
  				   more seconds.  */
      char *name;			/* The name of the device or host */
!     struct serial *next;	/* Pointer to the next serial_t */
      int refcnt;			/* Number of pointers to this block */
      int debug_p;		/* Trace this serial devices operation. */
      int async_state;		/* Async internal state. */
--- 213,219 ----
  				   still need to wait for this many
  				   more seconds.  */
      char *name;			/* The name of the device or host */
!     struct serial *next;	/* Pointer to the next `struct serial *' */
      int refcnt;			/* Number of pointers to this block */
      int debug_p;		/* Trace this serial devices operation. */
      int async_state;		/* Async internal state. */
*************** struct serial_ops
*** 227,254 ****
    {
      char *name;
      struct serial_ops *next;
!     int (*open) (serial_t, const char *name);
!     void (*close) (serial_t);
!     int (*readchar) (serial_t, int timeout);
!     int (*write) (serial_t, const char *str, int len);
      /* Discard pending output */
!     int (*flush_output) (serial_t);
      /* Discard pending input */
!     int (*flush_input) (serial_t);
!     int (*send_break) (serial_t);
!     void (*go_raw) (serial_t);
!     serial_ttystate (*get_tty_state) (serial_t);
!     int (*set_tty_state) (serial_t, serial_ttystate);
!     void (*print_tty_state) (serial_t, serial_ttystate, struct ui_file *);
!     int (*noflush_set_tty_state) (serial_t, serial_ttystate, serial_ttystate);
!     int (*setbaudrate) (serial_t, int rate);
!     int (*setstopbits) (serial_t, int num);
      /* Wait for output to drain */
!     int (*drain_output) (serial_t);
      /* Change the serial device into/out of asynchronous mode, call
         the specified function when ever there is something
         interesting. */
!     void (*async) (serial_t scb, int async_p);
    };
  
  /* Add a new serial interface to the interface list */
--- 225,254 ----
    {
      char *name;
      struct serial_ops *next;
!     int (*open) (struct serial *, const char *name);
!     void (*close) (struct serial *);
!     int (*readchar) (struct serial *, int timeout);
!     int (*write) (struct serial *, const char *str, int len);
      /* Discard pending output */
!     int (*flush_output) (struct serial *);
      /* Discard pending input */
!     int (*flush_input) (struct serial *);
!     int (*send_break) (struct serial *);
!     void (*go_raw) (struct serial *);
!     serial_ttystate (*get_tty_state) (struct serial *);
!     int (*set_tty_state) (struct serial *, serial_ttystate);
!     void (*print_tty_state) (struct serial *, serial_ttystate,
! 			     struct ui_file *);
!     int (*noflush_set_tty_state) (struct serial *, serial_ttystate,
! 				  serial_ttystate);
!     int (*setbaudrate) (struct serial *, int rate);
!     int (*setstopbits) (struct serial *, int num);
      /* Wait for output to drain */
!     int (*drain_output) (struct serial *);
      /* Change the serial device into/out of asynchronous mode, call
         the specified function when ever there is something
         interesting. */
!     void (*async) (struct serial *scb, int async_p);
    };
  
  /* Add a new serial interface to the interface list */
Index: sh3-rom.c
===================================================================
RCS file: /cvs/src/src/gdb/sh3-rom.c,v
retrieving revision 1.9
diff -p -r1.9 sh3-rom.c
*** sh3-rom.c	2001/05/09 17:51:01	1.9
--- sh3-rom.c	2001/07/10 23:14:14
***************
*** 28,34 ****
  #include "arch-utils.h"
  #include "regcache.h"
  
! static serial_t parallel;
  static int parallel_in_use;
  
  static void sh3_open (char *args, int from_tty);
--- 28,34 ----
  #include "arch-utils.h"
  #include "regcache.h"
  
! static struct serial *parallel;
  static int parallel_in_use;
  
  static void sh3_open (char *args, int from_tty);
*************** sh3_supply_register (char *regname, int 
*** 120,126 ****
  }
  
  static void
! sh3_load (serial_t desc, char *file, int hashmark)
  {
    if (parallel_in_use)
      {
--- 120,126 ----
  }
  
  static void
! sh3_load (struct serial *desc, char *file, int hashmark)
  {
    if (parallel_in_use)
      {
Index: sparcl-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcl-tdep.c,v
retrieving revision 1.12
diff -p -r1.12 sparcl-tdep.c
*** sparcl-tdep.c	2001/03/06 08:21:17	1.12
--- sparcl-tdep.c	2001/07/10 23:14:14
***************
*** 38,51 ****
  static struct target_ops sparclite_ops;
  
  static char *remote_target_name = NULL;
! static serial_t remote_desc = NULL;
  static int serial_flag;
  #ifdef HAVE_SOCKETS
  static int udp_fd = -1;
  #endif
  
! static serial_t open_tty (char *name);
! static int send_resp (serial_t desc, char c);
  static void close_tty (void * ignore);
  #ifdef HAVE_SOCKETS
  static int recv_udp_buf (int fd, unsigned char *buf, int len, int timeout);
--- 38,51 ----
  static struct target_ops sparclite_ops;
  
  static char *remote_target_name = NULL;
! static struct serial *remote_desc = NULL;
  static int serial_flag;
  #ifdef HAVE_SOCKETS
  static int udp_fd = -1;
  #endif
  
! static struct serial *open_tty (char *name);
! static int send_resp (struct serial *desc, char c);
  static void close_tty (void * ignore);
  #ifdef HAVE_SOCKETS
  static int recv_udp_buf (int fd, unsigned char *buf, int len, int timeout);
*************** sparclite_stopped_data_address (void)
*** 259,268 ****
      return 0;
  }
  
! static serial_t
  open_tty (char *name)
  {
!   serial_t desc;
  
    desc = SERIAL_OPEN (name);
    if (!desc)
--- 259,268 ----
      return 0;
  }
  
! static struct serial *
  open_tty (char *name)
  {
!   struct serial *desc;
  
    desc = SERIAL_OPEN (name);
    if (!desc)
*************** open_tty (char *name)
*** 287,293 ****
  /* Read a single character from the remote end, masking it down to 7 bits. */
  
  static int
! readchar (serial_t desc, int timeout)
  {
    int ch;
    char s[10];
--- 287,293 ----
  /* Read a single character from the remote end, masking it down to 7 bits. */
  
  static int
! readchar (struct serial *desc, int timeout)
  {
    int ch;
    char s[10];
*************** readchar (serial_t desc, int timeout)
*** 313,319 ****
  }
  
  static void
! debug_serial_write (serial_t desc, char *buf, int len)
  {
    char s[10];
  
--- 313,319 ----
  }
  
  static void
! debug_serial_write (struct serial *desc, char *buf, int len)
  {
    char s[10];
  
*************** debug_serial_write (serial_t desc, char 
*** 331,337 ****
  
  
  static int
! send_resp (serial_t desc, char c)
  {
    debug_serial_write (desc, &c, 1);
    return readchar (desc, remote_timeout);
--- 331,337 ----
  
  
  static int
! send_resp (struct serial *desc, char c)
  {
    debug_serial_write (desc, &c, 1);
    return readchar (desc, remote_timeout);
Index: sparclet-rom.c
===================================================================
RCS file: /cvs/src/src/gdb/sparclet-rom.c,v
retrieving revision 1.6
diff -p -r1.6 sparclet-rom.c
*** sparclet-rom.c	2001/03/06 08:21:17	1.6
--- sparclet-rom.c	2001/07/10 23:14:15
*************** sparclet_supply_register (char *regname,
*** 105,111 ****
  }
  
  static void
! sparclet_load (serial_t desc, char *file, int hashmark)
  {
    bfd *abfd;
    asection *s;
--- 105,111 ----
  }
  
  static void
! sparclet_load (struct serial *desc, char *file, int hashmark)
  {
    bfd *abfd;
    asection *s;
Index: srec.h
===================================================================
RCS file: /cvs/src/src/gdb/srec.h,v
retrieving revision 1.3
diff -p -r1.3 srec.h
*** srec.h	2001/03/06 08:21:17	1.3
--- srec.h	2001/07/10 23:14:15
***************
*** 18,24 ****
     Foundation, Inc., 59 Temple Place - Suite 330,
     Boston, MA 02111-1307, USA.  */
  
! void load_srec (serial_t desc, const char *file, bfd_vma load_offset,
  		int maxrecsize, int flags, int hashmark,
  		int (*waitack) (void));
  
--- 18,24 ----
     Foundation, Inc., 59 Temple Place - Suite 330,
     Boston, MA 02111-1307, USA.  */
  
! void load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
  		int maxrecsize, int flags, int hashmark,
  		int (*waitack) (void));
  
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.42
diff -p -r1.42 utils.c
*** utils.c	2001/07/08 20:42:15	1.42
--- utils.c	2001/07/10 23:14:41
*************** print_sys_errmsg (char *string, int errc
*** 825,831 ****
  void
  quit (void)
  {
!   serial_t gdb_stdout_serial = serial_fdopen (1);
  
    target_terminal_ours ();
  
--- 825,831 ----
  void
  quit (void)
  {
!   struct serial *gdb_stdout_serial = serial_fdopen (1);
  
    target_terminal_ours ();
  
Index: w89k-rom.c
===================================================================
RCS file: /cvs/src/src/gdb/w89k-rom.c,v
retrieving revision 1.5
diff -p -r1.5 w89k-rom.c
*** w89k-rom.c	2001/03/06 08:21:18	1.5
--- w89k-rom.c	2001/07/10 23:14:41
*************** static int hashmark = 1;	/* flag set by 
*** 160,166 ****
  extern struct monitor_ops w89k_cmds;	/* fwd decl */
  
  static void
! w89k_load (serial_t desc, char *file, int hashmark)
  {
    bfd *abfd;
    asection *s;
--- 160,166 ----
  extern struct monitor_ops w89k_cmds;	/* fwd decl */
  
  static void
! w89k_load (struct serial *desc, char *file, int hashmark)
  {
    bfd *abfd;
    asection *s;
Index: xmodem.c
===================================================================
RCS file: /cvs/src/src/gdb/xmodem.c,v
retrieving revision 1.4
diff -p -r1.4 xmodem.c
*** xmodem.c	2001/03/06 08:21:18	1.4
--- xmodem.c	2001/07/10 23:14:41
*************** static int blknum;		/* XMODEM block numb
*** 36,42 ****
  static int crcflag;		/* Sez we are using CRC's instead of cksums */
  
  static int
! readchar (serial_t desc, int timeout)
  {
    int c;
  
--- 36,42 ----
  static int crcflag;		/* Sez we are using CRC's instead of cksums */
  
  static int
! readchar (struct serial *desc, int timeout)
  {
    int c;
  
*************** docrc (unsigned char *p, int len)
*** 109,115 ****
     send NAK or CRC request.  */
  
  int
! xmodem_init_xfer (serial_t desc)
  {
    int c;
    int i;
--- 109,115 ----
     send NAK or CRC request.  */
  
  int
! xmodem_init_xfer (struct serial *desc)
  {
    int c;
    int i;
*************** xmodem_init_xfer (serial_t desc)
*** 160,166 ****
   */
  
  void
! xmodem_send_packet (serial_t desc, unsigned char *packet, int len, int hashmark)
  {
    int i;
    int retries;
--- 160,166 ----
   */
  
  void
! xmodem_send_packet (struct serial *desc, unsigned char *packet, int len, int hashmark)
  {
    int i;
    int retries;
*************** xmodem_send_packet (serial_t desc, unsig
*** 246,252 ****
  /* Finish off the transfer.  Send out the EOT, and wait for an ACK.  */
  
  void
! xmodem_finish_xfer (serial_t desc)
  {
    int retries;
  
--- 246,252 ----
  /* Finish off the transfer.  Send out the EOT, and wait for an ACK.  */
  
  void
! xmodem_finish_xfer (struct serial *desc)
  {
    int retries;
  
Index: xmodem.h
===================================================================
RCS file: /cvs/src/src/gdb/xmodem.h,v
retrieving revision 1.3
diff -p -r1.3 xmodem.h
*** xmodem.h	2001/03/06 08:21:18	1.3
--- xmodem.h	2001/07/10 23:14:41
***************
*** 18,27 ****
     Foundation, Inc., 59 Temple Place - Suite 330,
     Boston, MA 02111-1307, USA.  */
  
! int xmodem_init_xfer (serial_t desc);
! void send_xmodem_packet (serial_t desc, unsigned char *packet, int len,
  			 int hashmark);
! void xmodem_finish_xfer (serial_t desc);
  
  #define XMODEM_DATASIZE	128	/* The data size is ALWAYS 128 */
  #define XMODEM_1KDATASIZE 1024	/* Unless it's 1024!!! */
--- 18,27 ----
     Foundation, Inc., 59 Temple Place - Suite 330,
     Boston, MA 02111-1307, USA.  */
  
! int xmodem_init_xfer (struct serial *desc);
! void send_xmodem_packet (struct serial *desc, unsigned char *packet, int len,
  			 int hashmark);
! void xmodem_finish_xfer (struct serial *desc);
  
  #define XMODEM_DATASIZE	128	/* The data size is ALWAYS 128 */
  #define XMODEM_1KDATASIZE 1024	/* Unless it's 1024!!! */
Index: nindy-share/Onindy.c
===================================================================
RCS file: /cvs/src/src/gdb/nindy-share/Onindy.c,v
retrieving revision 1.2
diff -p -r1.2 Onindy.c
*** Onindy.c	2000/02/09 09:04:27	1.2
--- Onindy.c	2001/07/10 23:15:01
***************
*** 58,64 ****
  extern int quiet;	/* 1 => stifle unnecessary messages */
  
  /* tty connected to 960/NINDY board.  */
! extern serial_t nindy_serial;
  
  static OninStrGet();
  
--- 58,64 ----
  extern int quiet;	/* 1 => stifle unnecessary messages */
  
  /* tty connected to 960/NINDY board.  */
! extern struct serial *nindy_serial;
  
  static OninStrGet();
  
Index: nindy-share/nindy.c
===================================================================
RCS file: /cvs/src/src/gdb/nindy-share/nindy.c,v
retrieving revision 1.2
diff -p -r1.2 nindy.c
*** nindy.c	2000/02/09 09:04:27	1.2
--- nindy.c	2001/07/10 23:15:01
***************
*** 89,95 ****
  #define TIMEOUT		-1
  
  int quiet = 0;	/* 1 => stifle unnecessary messages */
! serial_t nindy_serial;
  
  static int old_nindy = 0; /* 1 => use old (hex) communication protocol */
  static ninStrGet();
--- 89,95 ----
  #define TIMEOUT		-1
  
  int quiet = 0;	/* 1 => stifle unnecessary messages */
! struct serial *nindy_serial;
  
  static int old_nindy = 0; /* 1 => use old (hex) communication protocol */
  static ninStrGet();
*************** parse_baudrate(s)
*** 514,520 ****
  
  static int
  try_baudrate (serial, brp)
!      serial_t serial;
       struct baudrate *brp;
  {
    unsigned char c;
--- 514,520 ----
  
  static int
  try_baudrate (serial, brp)
!      struct serial *serial;
       struct baudrate *brp;
  {
    unsigned char c;
*************** try_baudrate (serial, brp)
*** 540,546 ****
   ******************************************************************************/
  static
  autobaud( serial, brp )
!      serial_t serial;
       struct baudrate *brp;
  {
    int i;
--- 540,546 ----
   ******************************************************************************/
  static
  autobaud( serial, brp )
!      struct serial *serial;
       struct baudrate *brp;
  {
    int i;
Index: nindy-share/ttyflush.c
===================================================================
RCS file: /cvs/src/src/gdb/nindy-share/ttyflush.c,v
retrieving revision 1.2
diff -p -r1.2 ttyflush.c
*** ttyflush.c	2001/06/10 16:25:51	1.2
--- ttyflush.c	2001/07/10 23:15:01
***************
*** 27,33 ****
  
  int
  tty_flush (serial)
!      serial_t serial;
  {
    while (1)
      {
--- 27,33 ----
  
  int
  tty_flush (serial)
!      struct serial *serial;
  {
    while (1)
      {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]