t

Fork of mbed-dev by mbed official

Committer:
AnnaBridge
Date:
Wed Nov 08 13:50:44 2017 +0000
Revision:
178:d650f5d4c87a
Parent:
176:af195413fb11
This updates the lib to the mbed lib v 155

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