gdb/posix-hdep.c - gdb

Functions defined

Source code

  1. /* Host support routines for MinGW, for GDB, the GNU debugger.

  2.    Copyright (C) 2006-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #include "defs.h"
  15. #include "event-loop.h"

  16. #include "gdb_select.h"

  17. /* The strerror() function can return NULL for errno values that are
  18.    out of range.  Provide a "safe" version that always returns a
  19.    printable string.  */

  20. char *
  21. safe_strerror (int errnum)
  22. {
  23.   char *msg;

  24.   msg = strerror (errnum);
  25.   if (msg == NULL)
  26.     {
  27.       static char buf[32];

  28.       xsnprintf (buf, sizeof buf, "(undocumented errno %d)", errnum);
  29.       msg = buf;
  30.     }
  31.   return (msg);
  32. }

  33. /* Wrapper for select.  Nothing special needed on POSIX platforms.  */

  34. int
  35. gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
  36.             struct timeval *timeout)
  37. {
  38.   return select (n, readfds, writefds, exceptfds, timeout);
  39. }

  40. /* Wrapper for the body of signal handlers.  Nothing special needed on
  41.    POSIX platforms.  */

  42. void
  43. gdb_call_async_signal_handler (struct async_signal_handler *handler,
  44.                                int immediate_p)
  45. {
  46.   if (immediate_p)
  47.     call_async_signal_handler (handler);
  48.   else
  49.     mark_async_signal_handler (handler);
  50. }