mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by mbed official

Committer:
AnnaBridge
Date:
Thu Nov 23 11:57:25 2017 +0000
Revision:
178:79309dc6340a
Parent:
175:af195413fb11
Child:
180:96ed750bd169
mbed-dev library. Release version 156

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 160:d5399cc887bb 1 /*
<> 160:d5399cc887bb 2 * mbed Microcontroller Library
<> 160:d5399cc887bb 3 * Copyright (c) 2006-2016 ARM Limited
<> 160:d5399cc887bb 4 *
<> 160:d5399cc887bb 5 * Licensed under the Apache License, Version 2.0 (the "License");
<> 160:d5399cc887bb 6 * you may not use this file except in compliance with the License.
<> 160:d5399cc887bb 7 * You may obtain a copy of the License at
<> 160:d5399cc887bb 8 *
<> 160:d5399cc887bb 9 * http://www.apache.org/licenses/LICENSE-2.0
<> 160:d5399cc887bb 10 *
<> 160:d5399cc887bb 11 * Unless required by applicable law or agreed to in writing, software
<> 160:d5399cc887bb 12 * distributed under the License is distributed on an "AS IS" BASIS,
<> 160:d5399cc887bb 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 160:d5399cc887bb 14 * See the License for the specific language governing permissions and
<> 160:d5399cc887bb 15 * limitations under the License.
<> 160:d5399cc887bb 16 *
<> 160:d5399cc887bb 17 */
<> 160:d5399cc887bb 18
<> 160:d5399cc887bb 19 #ifndef RETARGET_H
<> 160:d5399cc887bb 20 #define RETARGET_H
<> 160:d5399cc887bb 21
AnnaBridge 167:e84263d55307 22 #if __cplusplus
AnnaBridge 167:e84263d55307 23 #include <cstdio>
AnnaBridge 167:e84263d55307 24 #endif //__cplusplus
<> 160:d5399cc887bb 25 #include <stdint.h>
<> 160:d5399cc887bb 26 #include <stddef.h>
<> 160:d5399cc887bb 27
<> 160:d5399cc887bb 28 /* We can get the following standard types from sys/types for gcc, but we
<> 160:d5399cc887bb 29 * need to define the types ourselves for the other compilers that normally
<> 160:d5399cc887bb 30 * target embedded systems */
<> 160:d5399cc887bb 31 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
AnnaBridge 175:af195413fb11 32 typedef signed int ssize_t; ///< Signed size type, usually encodes negative errors
AnnaBridge 175:af195413fb11 33 typedef signed long off_t; ///< Offset in a data stream
AnnaBridge 175:af195413fb11 34 typedef unsigned int mode_t; ///< Mode for opening files
AnnaBridge 175:af195413fb11 35 typedef unsigned int dev_t; ///< Device ID type
AnnaBridge 175:af195413fb11 36 typedef unsigned long ino_t; ///< File serial number
AnnaBridge 175:af195413fb11 37 typedef unsigned int nlink_t; ///< Number of links to a file
AnnaBridge 175:af195413fb11 38 typedef unsigned int uid_t; ///< User ID
AnnaBridge 175:af195413fb11 39 typedef unsigned int gid_t; ///< Group ID
<> 160:d5399cc887bb 40
AnnaBridge 175:af195413fb11 41 #define O_RDONLY 0 ///< Open for reading
AnnaBridge 175:af195413fb11 42 #define O_WRONLY 1 ///< Open for writing
AnnaBridge 175:af195413fb11 43 #define O_RDWR 2 ///< Open for reading and writing
AnnaBridge 175:af195413fb11 44 #define O_CREAT 0x0200 ///< Create file if it does not exist
AnnaBridge 175:af195413fb11 45 #define O_TRUNC 0x0400 ///< Truncate file to zero length
AnnaBridge 175:af195413fb11 46 #define O_EXCL 0x0800 ///< Fail if file exists
AnnaBridge 175:af195413fb11 47 #define O_APPEND 0x0008 ///< Set file offset to end of file prior to each write
<> 160:d5399cc887bb 48
<> 160:d5399cc887bb 49 #define NAME_MAX 255 ///< Maximum size of a name in a file path
<> 160:d5399cc887bb 50
AnnaBridge 175:af195413fb11 51 #include <time.h>
AnnaBridge 175:af195413fb11 52
<> 160:d5399cc887bb 53 #else
AnnaBridge 175:af195413fb11 54
<> 160:d5399cc887bb 55 #include <sys/fcntl.h>
<> 160:d5399cc887bb 56 #include <sys/types.h>
<> 160:d5399cc887bb 57 #include <sys/syslimits.h>
AnnaBridge 175:af195413fb11 58
<> 160:d5399cc887bb 59 #endif
<> 160:d5399cc887bb 60
AnnaBridge 178:79309dc6340a 61 /** \addtogroup platform */
AnnaBridge 178:79309dc6340a 62 /** @{*/
AnnaBridge 178:79309dc6340a 63 /**
AnnaBridge 178:79309dc6340a 64 * \defgroup platform_retarget Retarget functions
AnnaBridge 178:79309dc6340a 65 * @{
AnnaBridge 178:79309dc6340a 66 */
<> 160:d5399cc887bb 67
<> 160:d5399cc887bb 68 /* DIR declarations must also be here */
<> 160:d5399cc887bb 69 #if __cplusplus
AnnaBridge 167:e84263d55307 70 namespace mbed {
AnnaBridge 178:79309dc6340a 71
AnnaBridge 167:e84263d55307 72 class FileHandle;
AnnaBridge 167:e84263d55307 73 class DirHandle;
AnnaBridge 167:e84263d55307 74 std::FILE *mbed_fdopen(FileHandle *fh, const char *mode);
AnnaBridge 178:79309dc6340a 75
AnnaBridge 167:e84263d55307 76 }
AnnaBridge 167:e84263d55307 77 typedef mbed::DirHandle DIR;
<> 161:2cc1468da177 78 #else
<> 161:2cc1468da177 79 typedef struct Dir DIR;
<> 161:2cc1468da177 80 #endif
<> 160:d5399cc887bb 81
<> 161:2cc1468da177 82 #if __cplusplus
<> 160:d5399cc887bb 83 extern "C" {
<> 161:2cc1468da177 84 #endif
<> 160:d5399cc887bb 85 DIR *opendir(const char*);
<> 160:d5399cc887bb 86 struct dirent *readdir(DIR *);
<> 160:d5399cc887bb 87 int closedir(DIR*);
<> 160:d5399cc887bb 88 void rewinddir(DIR*);
<> 160:d5399cc887bb 89 long telldir(DIR*);
<> 160:d5399cc887bb 90 void seekdir(DIR*, long);
<> 160:d5399cc887bb 91 int mkdir(const char *name, mode_t n);
<> 161:2cc1468da177 92 #if __cplusplus
<> 160:d5399cc887bb 93 };
<> 160:d5399cc887bb 94 #endif
<> 160:d5399cc887bb 95
<> 160:d5399cc887bb 96
<> 160:d5399cc887bb 97 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
<> 160:d5399cc887bb 98 /* The intent of this section is to unify the errno error values to match
<> 160:d5399cc887bb 99 * the POSIX definitions for the GCC_ARM, ARMCC and IAR compilers. This is
<> 160:d5399cc887bb 100 * necessary because the ARMCC/IAR errno.h, or sys/stat.h are missing some
<> 160:d5399cc887bb 101 * symbol definitions used by the POSIX filesystem API to return errno codes.
<> 160:d5399cc887bb 102 * Note also that ARMCC errno.h defines some symbol values differently from
<> 160:d5399cc887bb 103 * the GCC_ARM/IAR/standard POSIX definitions. The definitions guard against
AnnaBridge 175:af195413fb11 104 * this and future changes by changing the symbol definition as shown below.
AnnaBridge 175:af195413fb11 105 */
AnnaBridge 175:af195413fb11 106 #undef EPERM
AnnaBridge 175:af195413fb11 107 #define EPERM 1 /* Operation not permitted */
AnnaBridge 175:af195413fb11 108 #undef ENOENT
AnnaBridge 175:af195413fb11 109 #define ENOENT 2 /* No such file or directory */
AnnaBridge 175:af195413fb11 110 #undef ESRCH
AnnaBridge 175:af195413fb11 111 #define ESRCH 3 /* No such process */
AnnaBridge 175:af195413fb11 112 #undef EINTR
AnnaBridge 175:af195413fb11 113 #define EINTR 4 /* Interrupted system call */
AnnaBridge 175:af195413fb11 114 #undef EIO
AnnaBridge 175:af195413fb11 115 #define EIO 5 /* I/O error */
AnnaBridge 175:af195413fb11 116 #undef ENXIO
AnnaBridge 175:af195413fb11 117 #define ENXIO 6 /* No such device or address */
AnnaBridge 175:af195413fb11 118 #undef E2BIG
AnnaBridge 175:af195413fb11 119 #define E2BIG 7 /* Argument list too long */
AnnaBridge 175:af195413fb11 120 #undef ENOEXEC
AnnaBridge 175:af195413fb11 121 #define ENOEXEC 8 /* Exec format error */
AnnaBridge 175:af195413fb11 122 #undef EBADF
AnnaBridge 175:af195413fb11 123 #define EBADF 9 /* Bad file number */
AnnaBridge 175:af195413fb11 124 #undef ECHILD
AnnaBridge 175:af195413fb11 125 #define ECHILD 10 /* No child processes */
AnnaBridge 175:af195413fb11 126 #undef EAGAIN
AnnaBridge 175:af195413fb11 127 #define EAGAIN 11 /* Try again */
AnnaBridge 175:af195413fb11 128 #undef ENOMEM
AnnaBridge 175:af195413fb11 129 #define ENOMEM 12 /* Out of memory */
AnnaBridge 175:af195413fb11 130 #undef EACCES
AnnaBridge 175:af195413fb11 131 #define EACCES 13 /* Permission denied */
AnnaBridge 175:af195413fb11 132 #undef EFAULT
AnnaBridge 175:af195413fb11 133 #define EFAULT 14 /* Bad address */
AnnaBridge 175:af195413fb11 134 #undef ENOTBLK
AnnaBridge 175:af195413fb11 135 #define ENOTBLK 15 /* Block device required */
AnnaBridge 175:af195413fb11 136 #undef EBUSY
AnnaBridge 175:af195413fb11 137 #define EBUSY 16 /* Device or resource busy */
AnnaBridge 175:af195413fb11 138 #undef EEXIST
AnnaBridge 175:af195413fb11 139 #define EEXIST 17 /* File exists */
AnnaBridge 175:af195413fb11 140 #undef EXDEV
AnnaBridge 175:af195413fb11 141 #define EXDEV 18 /* Cross-device link */
AnnaBridge 175:af195413fb11 142 #undef ENODEV
AnnaBridge 175:af195413fb11 143 #define ENODEV 19 /* No such device */
AnnaBridge 175:af195413fb11 144 #undef ENOTDIR
AnnaBridge 175:af195413fb11 145 #define ENOTDIR 20 /* Not a directory */
AnnaBridge 175:af195413fb11 146 #undef EISDIR
AnnaBridge 175:af195413fb11 147 #define EISDIR 21 /* Is a directory */
AnnaBridge 175:af195413fb11 148 #undef EINVAL
AnnaBridge 175:af195413fb11 149 #define EINVAL 22 /* Invalid argument */
AnnaBridge 175:af195413fb11 150 #undef ENFILE
AnnaBridge 175:af195413fb11 151 #define ENFILE 23 /* File table overflow */
AnnaBridge 175:af195413fb11 152 #undef EMFILE
AnnaBridge 175:af195413fb11 153 #define EMFILE 24 /* Too many open files */
AnnaBridge 175:af195413fb11 154 #undef ENOTTY
AnnaBridge 175:af195413fb11 155 #define ENOTTY 25 /* Not a typewriter */
AnnaBridge 175:af195413fb11 156 #undef ETXTBSY
AnnaBridge 175:af195413fb11 157 #define ETXTBSY 26 /* Text file busy */
AnnaBridge 175:af195413fb11 158 #undef EFBIG
AnnaBridge 175:af195413fb11 159 #define EFBIG 27 /* File too large */
AnnaBridge 175:af195413fb11 160 #undef ENOSPC
AnnaBridge 175:af195413fb11 161 #define ENOSPC 28 /* No space left on device */
AnnaBridge 175:af195413fb11 162 #undef ESPIPE
AnnaBridge 175:af195413fb11 163 #define ESPIPE 29 /* Illegal seek */
AnnaBridge 175:af195413fb11 164 #undef EROFS
AnnaBridge 175:af195413fb11 165 #define EROFS 30 /* Read-only file system */
AnnaBridge 175:af195413fb11 166 #undef EMLINK
AnnaBridge 175:af195413fb11 167 #define EMLINK 31 /* Too many links */
AnnaBridge 175:af195413fb11 168 #undef EPIPE
AnnaBridge 175:af195413fb11 169 #define EPIPE 32 /* Broken pipe */
AnnaBridge 175:af195413fb11 170 #undef EDOM
AnnaBridge 175:af195413fb11 171 #define EDOM 33 /* Math argument out of domain of func */
AnnaBridge 175:af195413fb11 172 #undef ERANGE
AnnaBridge 175:af195413fb11 173 #define ERANGE 34 /* Math result not representable */
AnnaBridge 175:af195413fb11 174 #undef EDEADLK
AnnaBridge 175:af195413fb11 175 #define EDEADLK 35 /* Resource deadlock would occur */
AnnaBridge 175:af195413fb11 176 #undef ENAMETOOLONG
AnnaBridge 175:af195413fb11 177 #define ENAMETOOLONG 36 /* File name too long */
AnnaBridge 175:af195413fb11 178 #undef ENOLCK
AnnaBridge 175:af195413fb11 179 #define ENOLCK 37 /* No record locks available */
AnnaBridge 175:af195413fb11 180 #undef ENOSYS
AnnaBridge 175:af195413fb11 181 #define ENOSYS 38 /* Function not implemented */
AnnaBridge 175:af195413fb11 182 #undef ENOTEMPTY
AnnaBridge 175:af195413fb11 183 #define ENOTEMPTY 39 /* Directory not empty */
AnnaBridge 175:af195413fb11 184 #undef ELOOP
AnnaBridge 175:af195413fb11 185 #define ELOOP 40 /* Too many symbolic links encountered */
AnnaBridge 175:af195413fb11 186 #undef EWOULDBLOCK
AnnaBridge 175:af195413fb11 187 #define EWOULDBLOCK EAGAIN /* Operation would block */
AnnaBridge 175:af195413fb11 188 #undef ENOMSG
AnnaBridge 175:af195413fb11 189 #define ENOMSG 42 /* No message of desired type */
AnnaBridge 175:af195413fb11 190 #undef EIDRM
AnnaBridge 175:af195413fb11 191 #define EIDRM 43 /* Identifier removed */
AnnaBridge 175:af195413fb11 192 #undef ECHRNG
AnnaBridge 175:af195413fb11 193 #define ECHRNG 44 /* Channel number out of range */
AnnaBridge 175:af195413fb11 194 #undef EL2NSYNC
AnnaBridge 175:af195413fb11 195 #define EL2NSYNC 45 /* Level 2 not synchronized */
AnnaBridge 175:af195413fb11 196 #undef EL3HLT
AnnaBridge 175:af195413fb11 197 #define EL3HLT 46 /* Level 3 halted */
AnnaBridge 175:af195413fb11 198 #undef EL3RST
AnnaBridge 175:af195413fb11 199 #define EL3RST 47 /* Level 3 reset */
AnnaBridge 175:af195413fb11 200 #undef ELNRNG
AnnaBridge 175:af195413fb11 201 #define ELNRNG 48 /* Link number out of range */
AnnaBridge 175:af195413fb11 202 #undef EUNATCH
AnnaBridge 175:af195413fb11 203 #define EUNATCH 49 /* Protocol driver not attached */
AnnaBridge 175:af195413fb11 204 #undef ENOCSI
AnnaBridge 175:af195413fb11 205 #define ENOCSI 50 /* No CSI structure available */
AnnaBridge 175:af195413fb11 206 #undef EL2HLT
AnnaBridge 175:af195413fb11 207 #define EL2HLT 51 /* Level 2 halted */
AnnaBridge 175:af195413fb11 208 #undef EBADE
AnnaBridge 175:af195413fb11 209 #define EBADE 52 /* Invalid exchange */
AnnaBridge 175:af195413fb11 210 #undef EBADR
AnnaBridge 175:af195413fb11 211 #define EBADR 53 /* Invalid request descriptor */
AnnaBridge 175:af195413fb11 212 #undef EXFULL
AnnaBridge 175:af195413fb11 213 #define EXFULL 54 /* Exchange full */
AnnaBridge 175:af195413fb11 214 #undef ENOANO
AnnaBridge 175:af195413fb11 215 #define ENOANO 55 /* No anode */
AnnaBridge 175:af195413fb11 216 #undef EBADRQC
AnnaBridge 175:af195413fb11 217 #define EBADRQC 56 /* Invalid request code */
AnnaBridge 175:af195413fb11 218 #undef EBADSLT
AnnaBridge 175:af195413fb11 219 #define EBADSLT 57 /* Invalid slot */
AnnaBridge 175:af195413fb11 220 #undef EDEADLOCK
AnnaBridge 175:af195413fb11 221 #define EDEADLOCK EDEADLK /* Resource deadlock would occur */
AnnaBridge 175:af195413fb11 222 #undef EBFONT
AnnaBridge 175:af195413fb11 223 #define EBFONT 59 /* Bad font file format */
AnnaBridge 175:af195413fb11 224 #undef ENOSTR
AnnaBridge 175:af195413fb11 225 #define ENOSTR 60 /* Device not a stream */
AnnaBridge 175:af195413fb11 226 #undef ENODATA
AnnaBridge 175:af195413fb11 227 #define ENODATA 61 /* No data available */
AnnaBridge 175:af195413fb11 228 #undef ETIME
AnnaBridge 175:af195413fb11 229 #define ETIME 62 /* Timer expired */
AnnaBridge 175:af195413fb11 230 #undef ENOSR
AnnaBridge 175:af195413fb11 231 #define ENOSR 63 /* Out of streams resources */
AnnaBridge 175:af195413fb11 232 #undef ENONET
AnnaBridge 175:af195413fb11 233 #define ENONET 64 /* Machine is not on the network */
AnnaBridge 175:af195413fb11 234 #undef ENOPKG
AnnaBridge 175:af195413fb11 235 #define ENOPKG 65 /* Package not installed */
AnnaBridge 175:af195413fb11 236 #undef EREMOTE
AnnaBridge 175:af195413fb11 237 #define EREMOTE 66 /* Object is remote */
AnnaBridge 175:af195413fb11 238 #undef ENOLINK
AnnaBridge 175:af195413fb11 239 #define ENOLINK 67 /* Link has been severed */
AnnaBridge 175:af195413fb11 240 #undef EADV
AnnaBridge 175:af195413fb11 241 #define EADV 68 /* Advertise error */
AnnaBridge 175:af195413fb11 242 #undef ESRMNT
AnnaBridge 175:af195413fb11 243 #define ESRMNT 69 /* Srmount error */
AnnaBridge 175:af195413fb11 244 #undef ECOMM
AnnaBridge 175:af195413fb11 245 #define ECOMM 70 /* Communication error on send */
AnnaBridge 175:af195413fb11 246 #undef EPROTO
AnnaBridge 175:af195413fb11 247 #define EPROTO 71 /* Protocol error */
AnnaBridge 175:af195413fb11 248 #undef EMULTIHOP
AnnaBridge 175:af195413fb11 249 #define EMULTIHOP 72 /* Multihop attempted */
AnnaBridge 175:af195413fb11 250 #undef EDOTDOT
AnnaBridge 175:af195413fb11 251 #define EDOTDOT 73 /* RFS specific error */
AnnaBridge 175:af195413fb11 252 #undef EBADMSG
AnnaBridge 175:af195413fb11 253 #define EBADMSG 74 /* Not a data message */
AnnaBridge 175:af195413fb11 254 #undef EOVERFLOW
AnnaBridge 175:af195413fb11 255 #define EOVERFLOW 75 /* Value too large for defined data type */
AnnaBridge 175:af195413fb11 256 #undef ENOTUNIQ
AnnaBridge 175:af195413fb11 257 #define ENOTUNIQ 76 /* Name not unique on network */
AnnaBridge 175:af195413fb11 258 #undef EBADFD
AnnaBridge 175:af195413fb11 259 #define EBADFD 77 /* File descriptor in bad state */
AnnaBridge 175:af195413fb11 260 #undef EREMCHG
AnnaBridge 175:af195413fb11 261 #define EREMCHG 78 /* Remote address changed */
AnnaBridge 175:af195413fb11 262 #undef ELIBACC
AnnaBridge 175:af195413fb11 263 #define ELIBACC 79 /* Can not access a needed shared library */
AnnaBridge 175:af195413fb11 264 #undef ELIBBAD
AnnaBridge 175:af195413fb11 265 #define ELIBBAD 80 /* Accessing a corrupted shared library */
AnnaBridge 175:af195413fb11 266 #undef ELIBSCN
AnnaBridge 175:af195413fb11 267 #define ELIBSCN 81 /* .lib section in a.out corrupted */
AnnaBridge 175:af195413fb11 268 #undef ELIBMAX
AnnaBridge 175:af195413fb11 269 #define ELIBMAX 82 /* Attempting to link in too many shared libraries */
AnnaBridge 175:af195413fb11 270 #undef ELIBEXEC
AnnaBridge 175:af195413fb11 271 #define ELIBEXEC 83 /* Cannot exec a shared library directly */
AnnaBridge 175:af195413fb11 272 #undef EILSEQ
AnnaBridge 175:af195413fb11 273 #define EILSEQ 84 /* Illegal byte sequence */
AnnaBridge 175:af195413fb11 274 #undef ERESTART
AnnaBridge 175:af195413fb11 275 #define ERESTART 85 /* Interrupted system call should be restarted */
AnnaBridge 175:af195413fb11 276 #undef ESTRPIPE
AnnaBridge 175:af195413fb11 277 #define ESTRPIPE 86 /* Streams pipe error */
AnnaBridge 175:af195413fb11 278 #undef EUSERS
AnnaBridge 175:af195413fb11 279 #define EUSERS 87 /* Too many users */
AnnaBridge 175:af195413fb11 280 #undef ENOTSOCK
AnnaBridge 175:af195413fb11 281 #define ENOTSOCK 88 /* Socket operation on non-socket */
AnnaBridge 175:af195413fb11 282 #undef EDESTADDRREQ
AnnaBridge 175:af195413fb11 283 #define EDESTADDRREQ 89 /* Destination address required */
AnnaBridge 175:af195413fb11 284 #undef EMSGSIZE
AnnaBridge 175:af195413fb11 285 #define EMSGSIZE 90 /* Message too long */
AnnaBridge 175:af195413fb11 286 #undef EPROTOTYPE
AnnaBridge 175:af195413fb11 287 #define EPROTOTYPE 91 /* Protocol wrong type for socket */
AnnaBridge 175:af195413fb11 288 #undef ENOPROTOOPT
AnnaBridge 175:af195413fb11 289 #define ENOPROTOOPT 92 /* Protocol not available */
AnnaBridge 175:af195413fb11 290 #undef EPROTONOSUPPORT
AnnaBridge 175:af195413fb11 291 #define EPROTONOSUPPORT 93 /* Protocol not supported */
AnnaBridge 175:af195413fb11 292 #undef ESOCKTNOSUPPORT
AnnaBridge 175:af195413fb11 293 #define ESOCKTNOSUPPORT 94 /* Socket type not supported */
AnnaBridge 175:af195413fb11 294 #undef EOPNOTSUPP
AnnaBridge 175:af195413fb11 295 #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
AnnaBridge 175:af195413fb11 296 #undef EPFNOSUPPORT
AnnaBridge 175:af195413fb11 297 #define EPFNOSUPPORT 96 /* Protocol family not supported */
AnnaBridge 175:af195413fb11 298 #undef EAFNOSUPPORT
AnnaBridge 175:af195413fb11 299 #define EAFNOSUPPORT 97 /* Address family not supported by protocol */
AnnaBridge 175:af195413fb11 300 #undef EADDRINUSE
AnnaBridge 175:af195413fb11 301 #define EADDRINUSE 98 /* Address already in use */
AnnaBridge 175:af195413fb11 302 #undef EADDRNOTAVAIL
AnnaBridge 175:af195413fb11 303 #define EADDRNOTAVAIL 99 /* Cannot assign requested address */
AnnaBridge 175:af195413fb11 304 #undef ENETDOWN
AnnaBridge 175:af195413fb11 305 #define ENETDOWN 100 /* Network is down */
AnnaBridge 175:af195413fb11 306 #undef ENETUNREACH
AnnaBridge 175:af195413fb11 307 #define ENETUNREACH 101 /* Network is unreachable */
AnnaBridge 175:af195413fb11 308 #undef ENETRESET
AnnaBridge 175:af195413fb11 309 #define ENETRESET 102 /* Network dropped connection because of reset */
AnnaBridge 175:af195413fb11 310 #undef ECONNABORTED
AnnaBridge 175:af195413fb11 311 #define ECONNABORTED 103 /* Software caused connection abort */
AnnaBridge 175:af195413fb11 312 #undef ECONNRESET
AnnaBridge 175:af195413fb11 313 #define ECONNRESET 104 /* Connection reset by peer */
AnnaBridge 175:af195413fb11 314 #undef ENOBUFS
AnnaBridge 175:af195413fb11 315 #define ENOBUFS 105 /* No buffer space available */
AnnaBridge 175:af195413fb11 316 #undef EISCONN
AnnaBridge 175:af195413fb11 317 #define EISCONN 106 /* Transport endpoint is already connected */
AnnaBridge 175:af195413fb11 318 #undef ENOTCONN
AnnaBridge 175:af195413fb11 319 #define ENOTCONN 107 /* Transport endpoint is not connected */
AnnaBridge 175:af195413fb11 320 #undef ESHUTDOWN
AnnaBridge 175:af195413fb11 321 #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
AnnaBridge 175:af195413fb11 322 #undef ETOOMANYREFS
AnnaBridge 175:af195413fb11 323 #define ETOOMANYREFS 109 /* Too many references: cannot splice */
AnnaBridge 175:af195413fb11 324 #undef ETIMEDOUT
AnnaBridge 175:af195413fb11 325 #define ETIMEDOUT 110 /* Connection timed out */
AnnaBridge 175:af195413fb11 326 #undef ECONNREFUSED
AnnaBridge 175:af195413fb11 327 #define ECONNREFUSED 111 /* Connection refused */
AnnaBridge 175:af195413fb11 328 #undef EHOSTDOWN
AnnaBridge 175:af195413fb11 329 #define EHOSTDOWN 112 /* Host is down */
AnnaBridge 175:af195413fb11 330 #undef EHOSTUNREACH
AnnaBridge 175:af195413fb11 331 #define EHOSTUNREACH 113 /* No route to host */
AnnaBridge 175:af195413fb11 332 #undef EALREADY
AnnaBridge 175:af195413fb11 333 #define EALREADY 114 /* Operation already in progress */
AnnaBridge 175:af195413fb11 334 #undef EINPROGRESS
AnnaBridge 175:af195413fb11 335 #define EINPROGRESS 115 /* Operation now in progress */
AnnaBridge 175:af195413fb11 336 #undef ESTALE
AnnaBridge 175:af195413fb11 337 #define ESTALE 116 /* Stale NFS file handle */
AnnaBridge 175:af195413fb11 338 #undef EUCLEAN
AnnaBridge 175:af195413fb11 339 #define EUCLEAN 117 /* Structure needs cleaning */
AnnaBridge 175:af195413fb11 340 #undef ENOTNAM
AnnaBridge 175:af195413fb11 341 #define ENOTNAM 118 /* Not a XENIX named type file */
AnnaBridge 175:af195413fb11 342 #undef ENAVAIL
AnnaBridge 175:af195413fb11 343 #define ENAVAIL 119 /* No XENIX semaphores available */
AnnaBridge 175:af195413fb11 344 #undef EISNAM
AnnaBridge 175:af195413fb11 345 #define EISNAM 120 /* Is a named type file */
AnnaBridge 175:af195413fb11 346 #undef EREMOTEIO
AnnaBridge 175:af195413fb11 347 #define EREMOTEIO 121 /* Remote I/O error */
AnnaBridge 175:af195413fb11 348 #undef EDQUOT
AnnaBridge 175:af195413fb11 349 #define EDQUOT 122 /* Quota exceeded */
AnnaBridge 175:af195413fb11 350 #undef ENOMEDIUM
AnnaBridge 175:af195413fb11 351 #define ENOMEDIUM 123 /* No medium found */
AnnaBridge 175:af195413fb11 352 #undef EMEDIUMTYPE
AnnaBridge 175:af195413fb11 353 #define EMEDIUMTYPE 124 /* Wrong medium type */
AnnaBridge 175:af195413fb11 354 #undef ECANCELED
AnnaBridge 175:af195413fb11 355 #define ECANCELED 125 /* Operation Canceled */
AnnaBridge 175:af195413fb11 356 #undef ENOKEY
AnnaBridge 175:af195413fb11 357 #define ENOKEY 126 /* Required key not available */
AnnaBridge 175:af195413fb11 358 #undef EKEYEXPIRED
AnnaBridge 175:af195413fb11 359 #define EKEYEXPIRED 127 /* Key has expired */
AnnaBridge 175:af195413fb11 360 #undef EKEYREVOKED
AnnaBridge 175:af195413fb11 361 #define EKEYREVOKED 128 /* Key has been revoked */
AnnaBridge 175:af195413fb11 362 #undef EKEYREJECTED
AnnaBridge 175:af195413fb11 363 #define EKEYREJECTED 129 /* Key was rejected by service */
AnnaBridge 175:af195413fb11 364 #undef EOWNERDEAD
AnnaBridge 175:af195413fb11 365 #define EOWNERDEAD 130 /* Owner died */
AnnaBridge 175:af195413fb11 366 #undef ENOTRECOVERABLE
AnnaBridge 175:af195413fb11 367 #define ENOTRECOVERABLE 131 /* State not recoverable */
AnnaBridge 175:af195413fb11 368 #endif
<> 160:d5399cc887bb 369
AnnaBridge 175:af195413fb11 370 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
<> 160:d5399cc887bb 371 /* Missing stat.h defines.
<> 160:d5399cc887bb 372 * The following are sys/stat.h definitions not currently present in the ARMCC
<> 160:d5399cc887bb 373 * errno.h. Note, ARMCC errno.h defines some symbol values differing from
<> 160:d5399cc887bb 374 * GCC_ARM/IAR/standard POSIX definitions. Guard against this and future
AnnaBridge 175:af195413fb11 375 * changes by changing the symbol definition for filesystem use.
AnnaBridge 175:af195413fb11 376 */
AnnaBridge 175:af195413fb11 377 #define _IFMT 0170000 //< type of file
AnnaBridge 175:af195413fb11 378 #define _IFSOCK 0140000 //< socket
AnnaBridge 175:af195413fb11 379 #define _IFLNK 0120000 //< symbolic link
AnnaBridge 175:af195413fb11 380 #define _IFREG 0100000 //< regular
AnnaBridge 175:af195413fb11 381 #define _IFBLK 0060000 //< block special
AnnaBridge 175:af195413fb11 382 #define _IFDIR 0040000 //< directory
AnnaBridge 175:af195413fb11 383 #define _IFCHR 0020000 //< character special
AnnaBridge 175:af195413fb11 384 #define _IFIFO 0010000 //< fifo special
<> 160:d5399cc887bb 385
AnnaBridge 175:af195413fb11 386 #define S_IFMT _IFMT //< type of file
AnnaBridge 175:af195413fb11 387 #define S_IFSOCK _IFSOCK //< socket
AnnaBridge 175:af195413fb11 388 #define S_IFLNK _IFLNK //< symbolic link
AnnaBridge 175:af195413fb11 389 #define S_IFREG _IFREG //< regular
AnnaBridge 175:af195413fb11 390 #define S_IFBLK _IFBLK //< block special
AnnaBridge 175:af195413fb11 391 #define S_IFDIR _IFDIR //< directory
AnnaBridge 175:af195413fb11 392 #define S_IFCHR _IFCHR //< character special
AnnaBridge 175:af195413fb11 393 #define S_IFIFO _IFIFO //< fifo special
<> 160:d5399cc887bb 394
<> 160:d5399cc887bb 395 #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
AnnaBridge 175:af195413fb11 396 #define S_IRUSR 0000400 ///< read permission, owner
AnnaBridge 175:af195413fb11 397 #define S_IWUSR 0000200 ///< write permission, owner
AnnaBridge 175:af195413fb11 398 #define S_IXUSR 0000100 ///< execute/search permission, owner
<> 160:d5399cc887bb 399 #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
AnnaBridge 175:af195413fb11 400 #define S_IRGRP 0000040 ///< read permission, group
AnnaBridge 175:af195413fb11 401 #define S_IWGRP 0000020 ///< write permission, grougroup
AnnaBridge 175:af195413fb11 402 #define S_IXGRP 0000010 ///< execute/search permission, group
<> 160:d5399cc887bb 403 #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
AnnaBridge 175:af195413fb11 404 #define S_IROTH 0000004 ///< read permission, other
AnnaBridge 175:af195413fb11 405 #define S_IWOTH 0000002 ///< write permission, other
AnnaBridge 175:af195413fb11 406 #define S_IXOTH 0000001 ///< execute/search permission, other
AnnaBridge 175:af195413fb11 407
AnnaBridge 175:af195413fb11 408 /* Refer to sys/stat standard
AnnaBridge 175:af195413fb11 409 * Note: Not all fields may be supported by the underlying filesystem
AnnaBridge 175:af195413fb11 410 */
AnnaBridge 175:af195413fb11 411 struct stat {
AnnaBridge 175:af195413fb11 412 dev_t st_dev; ///< Device ID containing file
AnnaBridge 175:af195413fb11 413 ino_t st_ino; ///< File serial number
AnnaBridge 175:af195413fb11 414 mode_t st_mode; ///< Mode of file
AnnaBridge 175:af195413fb11 415 nlink_t st_nlink; ///< Number of links to file
AnnaBridge 175:af195413fb11 416
AnnaBridge 175:af195413fb11 417 uid_t st_uid; ///< User ID
AnnaBridge 175:af195413fb11 418 gid_t st_gid; ///< Group ID
AnnaBridge 175:af195413fb11 419
AnnaBridge 175:af195413fb11 420 off_t st_size; ///< Size of file in bytes
AnnaBridge 175:af195413fb11 421
AnnaBridge 175:af195413fb11 422 time_t st_atime; ///< Time of last access
AnnaBridge 175:af195413fb11 423 time_t st_mtime; ///< Time of last data modification
AnnaBridge 175:af195413fb11 424 time_t st_ctime; ///< Time of last status change
AnnaBridge 175:af195413fb11 425 };
<> 160:d5399cc887bb 426
<> 160:d5399cc887bb 427 #endif /* defined(__ARMCC_VERSION) || defined(__ICCARM__) */
<> 160:d5399cc887bb 428
<> 160:d5399cc887bb 429
<> 160:d5399cc887bb 430 /* The following are dirent.h definitions are declared here to garuntee
AnnaBridge 175:af195413fb11 431 * consistency where structure may be different with different toolchains
AnnaBridge 175:af195413fb11 432 */
<> 160:d5399cc887bb 433 struct dirent {
AnnaBridge 175:af195413fb11 434 char d_name[NAME_MAX+1]; ///< Name of file
AnnaBridge 175:af195413fb11 435 uint8_t d_type; ///< Type of file
<> 160:d5399cc887bb 436 };
<> 160:d5399cc887bb 437
<> 160:d5399cc887bb 438 enum {
AnnaBridge 175:af195413fb11 439 DT_UNKNOWN, ///< The file type could not be determined.
AnnaBridge 175:af195413fb11 440 DT_FIFO, ///< This is a named pipe (FIFO).
AnnaBridge 175:af195413fb11 441 DT_CHR, ///< This is a character device.
AnnaBridge 175:af195413fb11 442 DT_DIR, ///< This is a directory.
AnnaBridge 175:af195413fb11 443 DT_BLK, ///< This is a block device.
AnnaBridge 175:af195413fb11 444 DT_REG, ///< This is a regular file.
AnnaBridge 175:af195413fb11 445 DT_LNK, ///< This is a symbolic link.
AnnaBridge 175:af195413fb11 446 DT_SOCK, ///< This is a UNIX domain socket.
<> 160:d5399cc887bb 447 };
<> 160:d5399cc887bb 448
AnnaBridge 178:79309dc6340a 449 /**@}*/
AnnaBridge 178:79309dc6340a 450
AnnaBridge 178:79309dc6340a 451 /**@}*/
AnnaBridge 178:79309dc6340a 452
<> 160:d5399cc887bb 453 #endif /* RETARGET_H */