From 58f07bae9540e81791b2ed039ba4c630fadf0af1 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 20 Aug 2010 18:49:20 +0000 Subject: * serial.h (gdb_pipe, serial_pipe): Declare. * serial.c (serial_interface_lookup): Take a const char pointer. (serial_fdopen): Rename to ... (serial_fdopen_ops): ... this. Add an OPS parameter and use it. Call the OPS' fdopen function if there is one. (serial_fdopen): Rewrite as wrapper to serial_fdopen_ops. (serial_pipe): New. (struct serial_ops) : New field. * ser-mingw.c (free_pipe_state): (free_pipe_state): Close output on non-pex pipes. (pipe_windows_fdopen): New. (gdb_pipe): New. (_initialize_ser_windows): Register pipe_windows_fdopen. * ser-go32.c (gdb_pipe): New. * ser-pipe.c (pipe_close): Close file descriptor even if there's no state pointer. (pipe_ops): Delete. (gdb_pipe): New. --- gdb/serial.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gdb/serial.h') diff --git a/gdb/serial.h b/gdb/serial.h index 7690501..d9ef684 100644 --- a/gdb/serial.h +++ b/gdb/serial.h @@ -56,6 +56,19 @@ extern struct serial *serial_fdopen (const int fd); extern void serial_close (struct serial *scb); +/* Create a pipe, and put the read end in files[0], and the write end + in filde[1]. Returns 0 for success, negative value for error (in + which case errno contains the error). */ + +extern int gdb_pipe (int fildes[2]); + +/* Create a pipe with each end wrapped in a `struct serial' interface. + Put the read end in scbs[0], and the write end in scbs[1]. Returns + 0 for success, negative value for error (in which case errno + contains the error). */ + +extern int serial_pipe (struct serial *scbs[2]); + /* Push out all buffers and destroy SCB without closing the device. */ extern void serial_un_fdopen (struct serial *scb); @@ -222,6 +235,7 @@ struct serial_ops struct serial_ops *next; int (*open) (struct serial *, const char *name); void (*close) (struct serial *); + int (*fdopen) (struct serial *, int fd); int (*readchar) (struct serial *, int timeout); int (*write) (struct serial *, const char *str, int len); /* Discard pending output */ -- cgit v1.1