29#include <sys/socket.h>
30#include "gdbsupport/gdb_sys_time.h"
32#include "gdbsupport/filestuff.h"
33#include "gdbsupport/pathstuff.h"
71 if (gdb_socketpair_cloexec (AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
73 if (gdb_socketpair_cloexec (AF_UNIX, SOCK_STREAM, 0, err_pdes) < 0)
96 if (fcntl (err_pdes[0], F_SETFL, O_NONBLOCK) == -1)
100 err_pdes[0] = err_pdes[1] = -1;
108 pid_t sid = setsid ();
110 signal (SIGINT, SIG_IGN);
112 signal (SIGINT, SIG_IGN);
117 if (pdes[1] != STDOUT_FILENO)
119 dup2 (pdes[1], STDOUT_FILENO);
122 dup2 (STDOUT_FILENO, STDIN_FILENO);
124 if (err_pdes[0] != -1)
127 dup2 (err_pdes[1], STDERR_FILENO);
133 const char *shellfile = get_shell ();
134 execl (shellfile, shellfile,
"-c",
name, (
char *) 0);
140 if (err_pdes[1] != -1)
150 signal (SIGPIPE, SIG_IGN);
169#define PIPE_CLOSE_TIMEOUT 5
174#define SIGTERM_TIMEOUT INT_MAX
178 wait_result = wait_to_die_with_timeout (state->
pid, &
status,
181 if (wait_result == -1)
183 kill (state->
pid, SIGTERM);
205 if (gdb_socketpair_cloexec (AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
210 signal (SIGPIPE, SIG_IGN);
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
void ser_base_async(struct serial *scb, int async_p)
void ser_base_print_tty_state(struct serial *scb, serial_ttystate ttystate, struct ui_file *stream)
void ser_base_raw(struct serial *scb)
int ser_base_set_tty_state(struct serial *scb, serial_ttystate ttystate)
serial_ttystate ser_base_get_tty_state(struct serial *scb)
int ser_base_drain_output(struct serial *scb)
int ser_base_send_break(struct serial *scb)
int ser_base_setbaudrate(struct serial *scb, int rate)
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
int ser_base_write(struct serial *scb, const void *buf, size_t count)
int ser_base_setstopbits(struct serial *scb, int num)
int ser_base_flush_output(struct serial *scb)
int ser_base_flush_input(struct serial *scb)
int ser_base_readchar(struct serial *scb, int timeout)
int ser_base_setparity(struct serial *scb, int parity)
void _initialize_ser_pipe()
int gdb_pipe(int pdes[2])
#define PIPE_CLOSE_TIMEOUT
static void pipe_close(struct serial *scb)
static const struct serial_ops pipe_ops
static int pipe_open(struct serial *scb, const char *name)
int ser_unix_write_prim(struct serial *scb, const void *buf, size_t len)
int ser_unix_read_prim(struct serial *scb, size_t count)
void serial_add_interface(const struct serial_ops *optable)