* ldlang.c (wild): Tidy default_common_section loop.
[binutils.git] / include / gdb / fileio.h
blobd84478103e2adf9f0252dee9be630eac5883072b
1 /* Hosted File I/O interface definitions, for GDB, the GNU Debugger.
3 Copyright 2003 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 02111-1307, USA. */
20 #ifndef GDB_FILEIO_H_
21 #define GDB_FILEIO_H_
23 /* The following flags are defined to be independent of the host
24 as well as the target side implementation of these constants.
25 All constants are defined with a leading FILEIO_ in the name
26 to allow the usage of these constants together with the
27 corresponding implementation dependent constants in one module. */
29 /* open(2) flags */
30 #define FILEIO_O_RDONLY 0x0
31 #define FILEIO_O_WRONLY 0x1
32 #define FILEIO_O_RDWR 0x2
33 #define FILEIO_O_APPEND 0x8
34 #define FILEIO_O_CREAT 0x200
35 #define FILEIO_O_TRUNC 0x400
36 #define FILEIO_O_EXCL 0x800
37 #define FILEIO_O_SUPPORTED (FILEIO_O_RDONLY | FILEIO_O_WRONLY| \
38 FILEIO_O_RDWR | FILEIO_O_APPEND| \
39 FILEIO_O_CREAT | FILEIO_O_TRUNC| \
40 FILEIO_O_EXCL)
42 /* mode_t bits */
43 #define FILEIO_S_IFREG 0100000
44 #define FILEIO_S_IFDIR 040000
45 #define FILEIO_S_IFCHR 020000
46 #define FILEIO_S_IRUSR 0400
47 #define FILEIO_S_IWUSR 0200
48 #define FILEIO_S_IXUSR 0100
49 #define FILEIO_S_IRWXU 0700
50 #define FILEIO_S_IRGRP 040
51 #define FILEIO_S_IWGRP 020
52 #define FILEIO_S_IXGRP 010
53 #define FILEIO_S_IRWXG 070
54 #define FILEIO_S_IROTH 04
55 #define FILEIO_S_IWOTH 02
56 #define FILEIO_S_IXOTH 01
57 #define FILEIO_S_IRWXO 07
58 #define FILEIO_S_SUPPORTED (FILEIO_S_IFREG|FILEIO_S_IFDIR| \
59 FILEIO_S_IRWXU|FILEIO_S_IRWXG| \
60 FILEIO_S_IRWXO)
62 /* lseek(2) flags */
63 #define FILEIO_SEEK_SET 0
64 #define FILEIO_SEEK_CUR 1
65 #define FILEIO_SEEK_END 2
67 /* errno values */
68 #define FILEIO_EPERM 1
69 #define FILEIO_ENOENT 2
70 #define FILEIO_EINTR 4
71 #define FILEIO_EIO 5
72 #define FILEIO_EBADF 9
73 #define FILEIO_EACCES 13
74 #define FILEIO_EFAULT 14
75 #define FILEIO_EBUSY 16
76 #define FILEIO_EEXIST 17
77 #define FILEIO_ENODEV 19
78 #define FILEIO_ENOTDIR 20
79 #define FILEIO_EISDIR 21
80 #define FILEIO_EINVAL 22
81 #define FILEIO_ENFILE 23
82 #define FILEIO_EMFILE 24
83 #define FILEIO_EFBIG 27
84 #define FILEIO_ENOSPC 28
85 #define FILEIO_ESPIPE 29
86 #define FILEIO_EROFS 30
87 #define FILEIO_ENOSYS 88
88 #define FILEIO_ENAMETOOLONG 91
89 #define FILEIO_EUNKNOWN 9999
91 /* limits */
92 #define FILEIO_INT_MIN -2147483648L
93 #define FILEIO_INT_MAX 2147483647L
94 #define FILEIO_UINT_MAX 4294967295UL
95 #define FILEIO_LONG_MIN -9223372036854775808LL
96 #define FILEIO_LONG_MAX 9223372036854775807LL
97 #define FILEIO_ULONG_MAX 18446744073709551615ULL
99 /* Integral types as used in protocol. */
100 #if 0
101 typedef __int32_t fio_int_t;
102 typedef __uint32_t fio_uint_t, fio_mode_t, fio_time_t;
103 typedef __int64_t fio_long_t;
104 typedef __uint64_t fio_ulong_t;
105 #endif
107 #define FIO_INT_LEN 4
108 #define FIO_UINT_LEN 4
109 #define FIO_MODE_LEN 4
110 #define FIO_TIME_LEN 4
111 #define FIO_LONG_LEN 8
112 #define FIO_ULONG_LEN 8
114 typedef char fio_int_t[FIO_INT_LEN];
115 typedef char fio_uint_t[FIO_UINT_LEN];
116 typedef char fio_mode_t[FIO_MODE_LEN];
117 typedef char fio_time_t[FIO_TIME_LEN];
118 typedef char fio_long_t[FIO_LONG_LEN];
119 typedef char fio_ulong_t[FIO_ULONG_LEN];
121 /* Struct stat as used in protocol. For complete independence
122 of host/target systems, it's defined as an array with offsets
123 to the members. */
125 struct fio_stat {
126 fio_uint_t fst_dev;
127 fio_uint_t fst_ino;
128 fio_mode_t fst_mode;
129 fio_uint_t fst_nlink;
130 fio_uint_t fst_uid;
131 fio_uint_t fst_gid;
132 fio_uint_t fst_rdev;
133 fio_ulong_t fst_size;
134 fio_ulong_t fst_blksize;
135 fio_ulong_t fst_blocks;
136 fio_time_t fst_atime;
137 fio_time_t fst_mtime;
138 fio_time_t fst_ctime;
141 struct fio_timeval {
142 fio_time_t ftv_sec;
143 fio_long_t ftv_usec;
146 #endif /* GDB_FILEIO_H_ */