X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fser-pipe.c;h=bca0e54e4bab95eb834e2229f6dc1d1ac228ccd2;hb=32fb0f22ebb44a89224f0d90394118198ccb144d;hp=a510bff8da397d15a9db315a25fbb0dde2085aed;hpb=abd8680d6efd97e7ba848a6392ee3ad72be18cd0;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c index a510bff8da..bca0e54e4b 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 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Cygnus Solutions. @@ -24,17 +24,18 @@ #include "serial.h" #include "ser-unix.h" +#include "gdb_vfork.h" + #include -#include "gdb_wait.h" #include #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); @@ -46,7 +47,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; @@ -64,6 +65,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. */ @@ -112,7 +117,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) @@ -120,7 +125,7 @@ pipe_close (serial_t scb) int pid = state->pid; close (scb->fd); scb->fd = -1; - free (state); + xfree (state); scb->state = NULL; kill (pid, SIGTERM); /* Might be useful to check that the child does die. */