OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [gdb/] [gdbserver/] [hostio-errno.c] - Diff between revs 157 and 223

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
/* Host file transfer support for gdbserver.
/* Host file transfer support for gdbserver.
   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 
 
   Contributed by CodeSourcery.
   Contributed by CodeSourcery.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.  */
   Boston, MA 02110-1301, USA.  */
 
 
/* This file implements the hostio_last_error target callback
/* This file implements the hostio_last_error target callback
   on top of errno.  */
   on top of errno.  */
 
 
#include <errno.h>
#include <errno.h>
#include "server.h"
#include "server.h"
#include "gdb/fileio.h"
#include "gdb/fileio.h"
 
 
static int
static int
errno_to_fileio_error (int error)
errno_to_fileio_error (int error)
{
{
  switch (error)
  switch (error)
    {
    {
    case EPERM:
    case EPERM:
      return FILEIO_EPERM;
      return FILEIO_EPERM;
    case ENOENT:
    case ENOENT:
      return FILEIO_ENOENT;
      return FILEIO_ENOENT;
    case EINTR:
    case EINTR:
      return FILEIO_EINTR;
      return FILEIO_EINTR;
    case EIO:
    case EIO:
      return FILEIO_EIO;
      return FILEIO_EIO;
    case EBADF:
    case EBADF:
      return FILEIO_EBADF;
      return FILEIO_EBADF;
    case EACCES:
    case EACCES:
      return FILEIO_EACCES;
      return FILEIO_EACCES;
    case EFAULT:
    case EFAULT:
      return FILEIO_EFAULT;
      return FILEIO_EFAULT;
    case EBUSY:
    case EBUSY:
      return FILEIO_EBUSY;
      return FILEIO_EBUSY;
    case EEXIST:
    case EEXIST:
      return FILEIO_EEXIST;
      return FILEIO_EEXIST;
    case ENODEV:
    case ENODEV:
      return FILEIO_ENODEV;
      return FILEIO_ENODEV;
    case ENOTDIR:
    case ENOTDIR:
      return FILEIO_ENOTDIR;
      return FILEIO_ENOTDIR;
    case EISDIR:
    case EISDIR:
      return FILEIO_EISDIR;
      return FILEIO_EISDIR;
    case EINVAL:
    case EINVAL:
      return FILEIO_EINVAL;
      return FILEIO_EINVAL;
    case ENFILE:
    case ENFILE:
      return FILEIO_ENFILE;
      return FILEIO_ENFILE;
    case EMFILE:
    case EMFILE:
      return FILEIO_EMFILE;
      return FILEIO_EMFILE;
    case EFBIG:
    case EFBIG:
      return FILEIO_EFBIG;
      return FILEIO_EFBIG;
    case ENOSPC:
    case ENOSPC:
      return FILEIO_ENOSPC;
      return FILEIO_ENOSPC;
    case ESPIPE:
    case ESPIPE:
      return FILEIO_ESPIPE;
      return FILEIO_ESPIPE;
    case EROFS:
    case EROFS:
      return FILEIO_EROFS;
      return FILEIO_EROFS;
    case ENOSYS:
    case ENOSYS:
      return FILEIO_ENOSYS;
      return FILEIO_ENOSYS;
    case ENAMETOOLONG:
    case ENAMETOOLONG:
      return FILEIO_ENAMETOOLONG;
      return FILEIO_ENAMETOOLONG;
    }
    }
 
 
  return FILEIO_EUNKNOWN;
  return FILEIO_EUNKNOWN;
}
}
 
 
void
void
hostio_last_error_from_errno (char *buf)
hostio_last_error_from_errno (char *buf)
{
{
  int error = errno;
  int error = errno;
  int fileio_error = errno_to_fileio_error (error);
  int fileio_error = errno_to_fileio_error (error);
  sprintf (buf, "F-1,%x", fileio_error);
  sprintf (buf, "F-1,%x", fileio_error);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.