/* Wrapper function for create_file_handler, so that the caller doesn't have to know implementation details about the use of poll vs. select. */ void add_file_handler (int fd, handler_func * proc, gdb_client_data client_data) { #ifdef HAVE_POLL struct pollfd fds; #endif if (use_poll) { #ifdef HAVE_POLL /* Check to see if poll () is usable. If not, we'll switch to use select. This can happen on systems like m68k-motorola-sys, `poll' cannot be used to wait for `stdin'. On m68k-motorola-sysv, tty's are not stream-based and not `poll'able. */ fds.fd = fd; fds.events = POLLIN; if (poll (&fds, 1, 0) == 1 && (fds.revents & POLLNVAL)) use_poll = 0; #else internal_error ("event-loop.c : use_poll without HAVE_POLL"); #endif /* HAVE_POLL */ } if (use_poll) { #ifdef HAVE_POLL create_file_handler (fd, POLLIN, proc, client_data); #else internal_error ("event-loop.c : use_poll without HAVE_POLL"); #endif } else create_file_handler (fd, GDB_READABLE | GDB_EXCEPTION, proc, client_data); }
void add_file_handler (gdb_fildes_t fd, handler_func *proc, gdb_client_data client_data) { create_file_handler (fd, GDB_READABLE | GDB_EXCEPTION, proc, client_data); }