OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [gdbserver/] [hostio-errno.c] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Host file transfer support for gdbserver.
2
   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
3
 
4
   Contributed by CodeSourcery.
5
 
6
   This file is part of GDB.
7
 
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 2 of the License, or
11
   (at your option) any later version.
12
 
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
 
18
   You should have received a copy of the GNU General Public License
19
   along with this program; if not, write to the Free Software
20
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
   Boston, MA 02110-1301, USA.  */
22
 
23
/* This file implements the hostio_last_error target callback
24
   on top of errno.  */
25
 
26
#include <errno.h>
27
#include "server.h"
28
#include "gdb/fileio.h"
29
 
30
static int
31
errno_to_fileio_error (int error)
32
{
33
  switch (error)
34
    {
35
    case EPERM:
36
      return FILEIO_EPERM;
37
    case ENOENT:
38
      return FILEIO_ENOENT;
39
    case EINTR:
40
      return FILEIO_EINTR;
41
    case EIO:
42
      return FILEIO_EIO;
43
    case EBADF:
44
      return FILEIO_EBADF;
45
    case EACCES:
46
      return FILEIO_EACCES;
47
    case EFAULT:
48
      return FILEIO_EFAULT;
49
    case EBUSY:
50
      return FILEIO_EBUSY;
51
    case EEXIST:
52
      return FILEIO_EEXIST;
53
    case ENODEV:
54
      return FILEIO_ENODEV;
55
    case ENOTDIR:
56
      return FILEIO_ENOTDIR;
57
    case EISDIR:
58
      return FILEIO_EISDIR;
59
    case EINVAL:
60
      return FILEIO_EINVAL;
61
    case ENFILE:
62
      return FILEIO_ENFILE;
63
    case EMFILE:
64
      return FILEIO_EMFILE;
65
    case EFBIG:
66
      return FILEIO_EFBIG;
67
    case ENOSPC:
68
      return FILEIO_ENOSPC;
69
    case ESPIPE:
70
      return FILEIO_ESPIPE;
71
    case EROFS:
72
      return FILEIO_EROFS;
73
    case ENOSYS:
74
      return FILEIO_ENOSYS;
75
    case ENAMETOOLONG:
76
      return FILEIO_ENAMETOOLONG;
77
    }
78
 
79
  return FILEIO_EUNKNOWN;
80
}
81
 
82
void
83
hostio_last_error_from_errno (char *buf)
84
{
85
  int error = errno;
86
  int fileio_error = errno_to_fileio_error (error);
87
  sprintf (buf, "F-1,%x", fileio_error);
88
}

powered by: WebSVN 2.1.0

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