23#include "gdbsupport/event-loop.h"
25#include "gdbsupport/gdb_select.h"
26#include "gdbsupport/gdb_sys_time.h"
79 delete_file_handler (scb->
fd);
80 next_state = create_timer (0,
push_event, scb);
86 add_file_handler (scb->
fd,
fd_event, scb,
"serial");
91 next_state = create_timer (0,
push_event, scb);
98 add_file_handler (scb->
fd,
fd_event, scb,
"serial");
162 else if (scb->
bufcnt == 0)
173 while (nr < 0 && errno == EINTR);
221 fd_set readfds, exceptfds;
232 FD_ZERO (&exceptfds);
233 FD_SET (scb->
fd, &readfds);
234 FD_SET (scb->
fd, &exceptfds);
248 else if (errno == EINTR)
280 to_read = (num_bytes < to_read) ? num_bytes : to_read;
286 if ((s == -1) || (s == 0 && !close_fd))
289 if (s == 0 && close_fd)
293 delete_file_handler (scb->
error_fd);
306 while ((newline = strstr (current,
"\n")) != NULL)
311 current = newline + 1;
349 delta = (timeout == 0 ? 0 : 1);
376 else if (timeout == 0)
395 while (
status < 0 && errno == EINTR);
428 int (do_readchar) (
struct serial *scb,
int timeout))
444 ch = do_readchar (scb, timeout);
477 const char *str = (
const char *) buf;
611 delete_file_handler (scb->
fd);
621 delete_file_handler (scb->
error_fd);
int(* deprecated_ui_loop_hook)(int signo)
int interruptible_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
ssize_t read(int fd, void *buf, size_t count)
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)
static void ser_base_read_error_fd(struct serial *scb, int close_fd)
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)
static handler_func fd_event
int ser_base_setbaudrate(struct serial *scb, int rate)
static int ser_base_wait_for(struct serial *scb, int timeout)
serial_ttystate ser_base_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
static int do_ser_base_readchar(struct serial *scb, int timeout)
static timer_handler_func push_event
static void reschedule(struct serial *scb)
int generic_readchar(struct serial *scb, int timeout, int(do_readchar)(struct serial *scb, int timeout))
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)
static void handle_error_fd(int error, gdb_client_data client_data)
int ser_base_flush_input(struct serial *scb)
static void run_async_handler_and_reschedule(struct serial *scb)
int ser_base_readchar(struct serial *scb, int timeout)
int ser_base_setparity(struct serial *scb, int parity)
int serial_is_open(struct serial *scb)
void serial_ref(struct serial *scb)
void serial_unref(struct serial *scb)
static const char * parity
int serial_is_async_p(struct serial *scb)
int serial_debug_p(struct serial *scb)
int(* avail)(struct serial *scb, int fd)
int(* read_prim)(struct serial *scb, size_t count)
int(* write_prim)(struct serial *scb, const void *buf, size_t count)
serial_event_ftype * async_handler
unsigned char buf[BUFSIZ]
const struct serial_ops * ops
void gdb_printf(struct ui_file *stream, const char *format,...)
void gdb_puts(const char *linebuffer, struct ui_file *stream)