GDB (API)
/home/stan/gdb/src/gdb/posix-hdep.c
Go to the documentation of this file.
00001 /* Host support routines for MinGW, for GDB, the GNU debugger.
00002 
00003    Copyright (C) 2006-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #include "defs.h"
00021 #include "event-loop.h"
00022 
00023 #include "gdb_string.h"
00024 
00025 #include "gdb_select.h"
00026 
00027 /* The strerror() function can return NULL for errno values that are
00028    out of range.  Provide a "safe" version that always returns a
00029    printable string.  */
00030 
00031 char *
00032 safe_strerror (int errnum)
00033 {
00034   char *msg;
00035 
00036   msg = strerror (errnum);
00037   if (msg == NULL)
00038     {
00039       static char buf[32];
00040 
00041       xsnprintf (buf, sizeof buf, "(undocumented errno %d)", errnum);
00042       msg = buf;
00043     }
00044   return (msg);
00045 }
00046 
00047 /* Wrapper for select.  Nothing special needed on POSIX platforms.  */
00048 
00049 int
00050 gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
00051             struct timeval *timeout)
00052 {
00053   return select (n, readfds, writefds, exceptfds, timeout);
00054 }
00055 
00056 /* Wrapper for the body of signal handlers.  Nothing special needed on
00057    POSIX platforms.  */
00058 
00059 void
00060 gdb_call_async_signal_handler (struct async_signal_handler *handler,
00061                                int immediate_p)
00062 {
00063   if (immediate_p)
00064     call_async_signal_handler (handler);
00065   else
00066     mark_async_signal_handler (handler);
00067 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines