X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fser-pipe.c;h=58a77b654b61fdce1279de9c23d90cc034b3de13;hb=b2182ed226dfa161296df892b2f12650d67c0ba0;hp=41fb083d5ce74fb0db0544ec6a7470674c158a21;hpb=27b82ed26e4c5d8012bc78a194a50417e324e87a;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c index 41fb083d5c..58a77b654b 100644 --- a/gdb/ser-pipe.c +++ b/gdb/ser-pipe.c @@ -1,5 +1,5 @@ /* Serial interface for a pipe to a separate program - Copyright 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Cygnus Solutions. @@ -17,26 +17,26 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "defs.h" #include "serial.h" +#include "ser-base.h" #include "ser-unix.h" #include "gdb_vfork.h" #include -#include "gdb_wait.h" #include #include #include #include "gdb_string.h" -#include "signals.h" +#include -static int pipe_open (serial_t scb, const char *name); -static void pipe_close (serial_t scb); +static int pipe_open (struct serial *scb, const char *name); +static void pipe_close (struct serial *scb); extern void _initialize_ser_pipe (void); @@ -48,7 +48,7 @@ struct pipe_state /* Open up a raw pipe */ static int -pipe_open (serial_t scb, const char *name) +pipe_open (struct serial *scb, const char *name) { #if !HAVE_SOCKETPAIR return -1; @@ -66,6 +66,10 @@ pipe_open (serial_t scb, const char *name) if (socketpair (AF_UNIX, SOCK_STREAM, 0, pdes) < 0) return -1; + /* Create the child process to run the command in. Note that the + apparent call to vfork() below *might* actually be a call to + fork() due to the fact that autoconf will ``#define vfork fork'' + on certain platforms. */ pid = vfork (); /* Error. */ @@ -95,7 +99,7 @@ pipe_open (serial_t scb, const char *name) for (old = pidlist; old; old = old->next) close (fileno (old->fp)); /* don't allow a flush */ #endif - execl ("/bin/sh", "sh", "-c", name, NULL); + execl ("/bin/sh", "sh", "-c", name, (char *) 0); _exit (127); } @@ -114,7 +118,7 @@ pipe_open (serial_t scb, const char *name) } static void -pipe_close (serial_t scb) +pipe_close (struct serial *scb) { struct pipe_state *state = scb->state; if (state != NULL) @@ -135,24 +139,26 @@ void _initialize_ser_pipe (void) { struct serial_ops *ops = XMALLOC (struct serial_ops); - memset (ops, sizeof (struct serial_ops), 0); + memset (ops, 0, sizeof (struct serial_ops)); ops->name = "pipe"; ops->next = 0; ops->open = pipe_open; ops->close = pipe_close; - ops->readchar = ser_unix_readchar; - ops->write = ser_unix_write; - ops->flush_output = ser_unix_nop_flush_output; - ops->flush_input = ser_unix_flush_input; - ops->send_break = ser_unix_nop_send_break; - ops->go_raw = ser_unix_nop_raw; - ops->get_tty_state = ser_unix_nop_get_tty_state; - ops->set_tty_state = ser_unix_nop_set_tty_state; - ops->print_tty_state = ser_unix_nop_print_tty_state; - ops->noflush_set_tty_state = ser_unix_nop_noflush_set_tty_state; - ops->setbaudrate = ser_unix_nop_setbaudrate; - ops->setstopbits = ser_unix_nop_setstopbits; - ops->drain_output = ser_unix_nop_drain_output; - ops->async = ser_unix_async; + ops->readchar = ser_base_readchar; + ops->write = ser_base_write; + ops->flush_output = ser_base_flush_output; + ops->flush_input = ser_base_flush_input; + ops->send_break = ser_base_send_break; + ops->go_raw = ser_base_raw; + ops->get_tty_state = ser_base_get_tty_state; + ops->set_tty_state = ser_base_set_tty_state; + ops->print_tty_state = ser_base_print_tty_state; + ops->noflush_set_tty_state = ser_base_noflush_set_tty_state; + ops->setbaudrate = ser_base_setbaudrate; + ops->setstopbits = ser_base_setstopbits; + ops->drain_output = ser_base_drain_output; + ops->async = ser_base_async; + ops->read_prim = ser_unix_read_prim; + ops->write_prim = ser_unix_write_prim; serial_add_interface (ops); }