GDB (API)
|
00001 /* Hosted File I/O interface definitions, for GDB, the GNU Debugger. 00002 00003 Copyright 2003-2013 Free Software Foundation, Inc. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00017 00018 #ifndef GDB_FILEIO_H_ 00019 #define GDB_FILEIO_H_ 00020 00021 /* The following flags are defined to be independent of the host 00022 as well as the target side implementation of these constants. 00023 All constants are defined with a leading FILEIO_ in the name 00024 to allow the usage of these constants together with the 00025 corresponding implementation dependent constants in one module. */ 00026 00027 /* open(2) flags */ 00028 #define FILEIO_O_RDONLY 0x0 00029 #define FILEIO_O_WRONLY 0x1 00030 #define FILEIO_O_RDWR 0x2 00031 #define FILEIO_O_APPEND 0x8 00032 #define FILEIO_O_CREAT 0x200 00033 #define FILEIO_O_TRUNC 0x400 00034 #define FILEIO_O_EXCL 0x800 00035 #define FILEIO_O_SUPPORTED (FILEIO_O_RDONLY | FILEIO_O_WRONLY| \ 00036 FILEIO_O_RDWR | FILEIO_O_APPEND| \ 00037 FILEIO_O_CREAT | FILEIO_O_TRUNC| \ 00038 FILEIO_O_EXCL) 00039 00040 /* mode_t bits */ 00041 #define FILEIO_S_IFREG 0100000 00042 #define FILEIO_S_IFDIR 040000 00043 #define FILEIO_S_IFCHR 020000 00044 #define FILEIO_S_IRUSR 0400 00045 #define FILEIO_S_IWUSR 0200 00046 #define FILEIO_S_IXUSR 0100 00047 #define FILEIO_S_IRWXU 0700 00048 #define FILEIO_S_IRGRP 040 00049 #define FILEIO_S_IWGRP 020 00050 #define FILEIO_S_IXGRP 010 00051 #define FILEIO_S_IRWXG 070 00052 #define FILEIO_S_IROTH 04 00053 #define FILEIO_S_IWOTH 02 00054 #define FILEIO_S_IXOTH 01 00055 #define FILEIO_S_IRWXO 07 00056 #define FILEIO_S_SUPPORTED (FILEIO_S_IFREG|FILEIO_S_IFDIR| \ 00057 FILEIO_S_IRWXU|FILEIO_S_IRWXG| \ 00058 FILEIO_S_IRWXO) 00059 00060 /* lseek(2) flags */ 00061 #define FILEIO_SEEK_SET 0 00062 #define FILEIO_SEEK_CUR 1 00063 #define FILEIO_SEEK_END 2 00064 00065 /* errno values */ 00066 #define FILEIO_EPERM 1 00067 #define FILEIO_ENOENT 2 00068 #define FILEIO_EINTR 4 00069 #define FILEIO_EIO 5 00070 #define FILEIO_EBADF 9 00071 #define FILEIO_EACCES 13 00072 #define FILEIO_EFAULT 14 00073 #define FILEIO_EBUSY 16 00074 #define FILEIO_EEXIST 17 00075 #define FILEIO_ENODEV 19 00076 #define FILEIO_ENOTDIR 20 00077 #define FILEIO_EISDIR 21 00078 #define FILEIO_EINVAL 22 00079 #define FILEIO_ENFILE 23 00080 #define FILEIO_EMFILE 24 00081 #define FILEIO_EFBIG 27 00082 #define FILEIO_ENOSPC 28 00083 #define FILEIO_ESPIPE 29 00084 #define FILEIO_EROFS 30 00085 #define FILEIO_ENOSYS 88 00086 #define FILEIO_ENAMETOOLONG 91 00087 #define FILEIO_EUNKNOWN 9999 00088 00089 /* limits */ 00090 #define FILEIO_INT_MIN -2147483648L 00091 #define FILEIO_INT_MAX 2147483647L 00092 #define FILEIO_UINT_MAX 4294967295UL 00093 #define FILEIO_LONG_MIN -9223372036854775808LL 00094 #define FILEIO_LONG_MAX 9223372036854775807LL 00095 #define FILEIO_ULONG_MAX 18446744073709551615ULL 00096 00097 /* Integral types as used in protocol. */ 00098 #if 0 00099 typedef __int32_t fio_int_t; 00100 typedef __uint32_t fio_uint_t, fio_mode_t, fio_time_t; 00101 typedef __int64_t fio_long_t; 00102 typedef __uint64_t fio_ulong_t; 00103 #endif 00104 00105 #define FIO_INT_LEN 4 00106 #define FIO_UINT_LEN 4 00107 #define FIO_MODE_LEN 4 00108 #define FIO_TIME_LEN 4 00109 #define FIO_LONG_LEN 8 00110 #define FIO_ULONG_LEN 8 00111 00112 typedef char fio_int_t[FIO_INT_LEN]; 00113 typedef char fio_uint_t[FIO_UINT_LEN]; 00114 typedef char fio_mode_t[FIO_MODE_LEN]; 00115 typedef char fio_time_t[FIO_TIME_LEN]; 00116 typedef char fio_long_t[FIO_LONG_LEN]; 00117 typedef char fio_ulong_t[FIO_ULONG_LEN]; 00118 00119 /* Struct stat as used in protocol. For complete independence 00120 of host/target systems, it's defined as an array with offsets 00121 to the members. */ 00122 00123 struct fio_stat { 00124 fio_uint_t fst_dev; 00125 fio_uint_t fst_ino; 00126 fio_mode_t fst_mode; 00127 fio_uint_t fst_nlink; 00128 fio_uint_t fst_uid; 00129 fio_uint_t fst_gid; 00130 fio_uint_t fst_rdev; 00131 fio_ulong_t fst_size; 00132 fio_ulong_t fst_blksize; 00133 fio_ulong_t fst_blocks; 00134 fio_time_t fst_atime; 00135 fio_time_t fst_mtime; 00136 fio_time_t fst_ctime; 00137 }; 00138 00139 struct fio_timeval { 00140 fio_time_t ftv_sec; 00141 fio_long_t ftv_usec; 00142 }; 00143 00144 #endif /* GDB_FILEIO_H_ */