From Ben Katz mbed-dev library. Removed unnecessary target files to reduce the overall size by a factor of 10 to make it easier to import into the online IDE.

Dependents:   motor_driver motor_driver_screaming_fix

Committer:
saloutos
Date:
Thu Nov 26 04:08:56 2020 +0000
Revision:
0:083111ae2a11
first commit of leaned mbed dev lib

Who changed what in which revision?

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