ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
posix.h
Go to the documentation of this file.
1 
27 #ifndef _POSIX_H_
28 #define _POSIX_H_
29 
30 #define POSIX
31 
33 #undef EDOM
34 #undef ERANGE
35 
36 #ifdef ESP8266
37 #undef strerror_r
39 #endif
40 
41 // =============================================
45 typedef uint32_t dev_t; /*< dev_t for this architecture */
46 typedef uint32_t ino_t; /*< ino_t for this architecture */
47 typedef uint32_t mode_t; /*< mode_t for this architecture */
48 typedef uint32_t nlink_t; /*< nlink_t for this architecture */
49 typedef uint16_t uid_t; /*< uid_t for this architecture */
50 typedef uint16_t gid_t; /*< gid_t for this architecture */
51 typedef uint32_t off_t; /*< off_t for this architecture */
52 typedef uint32_t blkcnt_t; /*< blkcnt_t for this architecture */
53 typedef uint32_t blksize_t; /*< blksize_t for this architecture */
54 typedef uint32_t time_t; /*< time_t for this architecture */
55 typedef int32_t ssize_t; /*< ssize_t for this architecture */
56 // =============================================
57 
58 // =============================================
59 
60 // @brief posix errno values
62 {
63  EOK, /*< 0 NO ERROR */
64  EPERM, /*< 1 Operation not permitted */
65  ENOENT, /*< 2 No such file or directory */
66  ESRCH, /*< 3 No such process */
67  EINTR, /*< 4 Interrupted system call */
68  EIO, /*< 5 I/O error */
69  ENXIO, /*< 6 No such device or address */
70  E2BIG, /*< 7 Argument list too long */
71  ENOEXEC, /*< 8 Exec format error */
72  EBADF, /*< 9 Bad file number */
73  ECHILD, /*< 10 No child processes */
74  EAGAIN, /*< 11 Try again */
75  ENOMEM, /*< 12 Out of memory */
76  EACCES, /*< 13 Permission denied */
77  EFAULT, /*< 14 Bad address */
78  ENOTBLK, /*< 15 Block device required */
79  EBUSY, /*< 16 Device or resource busy */
80  EEXIST, /*< 17 File exists */
81  EXDEV, /*< 18 Cross-device link */
82  ENODEV, /*< 19 No such device */
83  ENOTDIR, /*< 20 Not a directory */
84  EISDIR, /*< 21 Is a directory */
85  EINVAL, /*< 22 Invalid argument */
86  ENFILE, /*< 23 File table overflow */
87  EMFILE, /*< 24 Too many open files */
88  ENOTTY, /*< 25 Not a typewriter */
89  ETXTBSY, /*< 26 Text file busy */
90  EFBIG, /*< 27 File too large */
91  ENOSPC, /*< 28 No space left on device */
92  ESPIPE, /*< 29 Illegal seek */
93  EROFS, /*< 30 Read-only file system */
94  EMLINK, /*< 31 Too many links */
95  EPIPE, /*< 32 Broken pipe */
96  EDOM, /*< 33 Math argument out of domain of func */
97  ERANGE, /*< 34 Math result not representable */
98  EBADMSG /*< 35 Bad Message */
99 };
100 // =============================================
101 
105 struct stat
106 {
107  dev_t st_dev; /*< ID of device containing file */
108  ino_t st_ino; /*< inode number */
109  mode_t st_mode; /*< protection */
110  nlink_t st_nlink; /*< number of hard links */
111  uid_t st_uid; /*< user ID of owner */
112  gid_t st_gid; /*< group ID of owner */
113  dev_t st_rdev; /*< device ID (if special file) */
114  off_t st_size; /*< total size, in bytes */
115  blksize_t st_blksize;/*< blocksize for filesystem I/O */
116  blkcnt_t st_blocks; /*< number of 512B blocks allocated */
117  time_t st_atime; /*< time of last access */
118  time_t st_mtime; /*< time of last modification */
119  time_t st_ctime; /*< time of last status change */
120 };
121 
124 typedef struct utimbuf
125 {
126  time_t actime; /* access time */
127  time_t modtime; /* modification time */
128 } utime_t;
129 
130 #if _USE_LFN != 0
131 #define MAX_NAME_LEN _MAX_LFN
132 #else
133 #define MAX_NAME_LEN 13
134 #endif
135 
136 struct dirent {
137 #if 0 // unsupported
138  ino_t d_ino; /* inode number */
139  off_t d_off; /* not an offset; see NOTES */
140  unsigned short d_reclen; /* length of this record */
141  unsigned char d_type; /* type of file; not supported
142  by all filesystem types */
143 #endif
144  char d_name[MAX_NAME_LEN]; /* filename */
145 };
146 
147 typedef struct dirent dirent_t;
148 
149 #
150 
153 #define lstat stat
154 // =============================================
156 struct __file {
157  char *buf; /* buffer pointer */
158  unsigned char unget; /* ungetc() buffer */
159  uint8_t flags; /* flags, see below */
160 #define __SRD 0x0001 /* OK to read */
161 #define __SWR 0x0002 /* OK to write */
162 #define __SSTR 0x0004 /* this is an sprintf/snprintf string */
163 #define __SPGM 0x0008 /* fmt string is in progmem */
164 #define __SERR 0x0010 /* found error */
165 #define __SEOF 0x0020 /* found EOF */
166 #define __SUNGET 0x040 /* ungetc() happened */
167 #define __SMALLOC 0x80 /* handle is malloc()ed */
168 #if 0
169  /* possible future extensions, will require uint16_t flags */
170  #define __SRW 0x0100 /* open for reading & writing */
171  #define __SLBF 0x0200 /* line buffered */
172  #define __SNBF 0x0400 /* unbuffered */
173  #define __SMBF 0x0800 /* buf is from malloc */
174 #endif
175  int size; /* size of buffer */
176  int len; /* characters read or written so far */
177  int (*put)(char, struct __file *); /* write one char to device */
178  int (*get)(struct __file *); /* read one char from device */
179 // FIXME add all low level functions here like _open, _close, ... like newlib does
180  void *udata; /* User defined and accessible data. */
181 };
182 // =============================================
186 #define O_ACCMODE 00000003 /*< read, write, read-write modes */
187 #define O_RDONLY 00000000 /*< Read only */
188 #define O_WRONLY 00000001 /*< Write only */
189 #define O_RDWR 00000002 /*< Read/Write */
190 #define O_CREAT 00000100 /*< Create file only if it does not exist */
191 #define O_EXCL 00000200 /*< O_CREAT option, Create fails if file exists
192 */
193 #define O_NOCTTY 00000400 /*< @todo */
194 #define O_TRUNC 00001000 /*< Truncate if exists */
195 #define O_APPEND 00002000 /*< All writes are to EOF */
196 #define O_NONBLOCK 00004000 /*< @todo */
197 #define O_BINARY 00000004 /*< Binary */
198 #define O_TEXT 00000004 /*< Text End Of Line translation */
199 
201 #define S_IFMT 0170000 /*< These bits determine file type. */
202 #define S_IFDIR 0040000 /*< Directory. */
203 #define S_IFCHR 0020000 /*< Character device. */
204 #define S_IFBLK 0060000 /*< Block device. */
205 #define S_IFREG 0100000 /*< Regular file. */
206 #define S_IFIFO 0010000 /*< FIFO. */
207 #define S_IFLNK 0120000 /*< Symbolic link. */
208 #define S_IFSOCK 0140000 /*< Socket. */
209 #define S_IREAD 0400 /*< Read by owner. */
210 #define S_IWRITE 0200 /*< Write by owner. */
211 #define S_IEXEC 0100 /*< Execute by owner. */
212 
214 #define S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
215 #define S_ISDIR(mode) S_ISTYPE((mode), S_IFDIR)
216 #define S_ISCHR(mode) S_ISTYPE((mode), S_IFCHR)
217 #define S_ISBLK(mode) S_ISTYPE((mode), S_IFBLK)
218 #define S_ISREG(mode) S_ISTYPE((mode), S_IFREG)
219 
220 //@brief POSIX File permissions, see fstat and stat
221 #define S_IRUSR S_IREAD /*< Read by owner. */
222 #define S_IWUSR S_IWRITE /*< Write by owner. */
223 #define S_IXUSR S_IEXEC /*< Execute by owner. */
224 #define S_IRWXU (S_IREAD|S_IWRITE|S_IEXEC) /*< Read,Write,Execute by owner */
225 
226 #define S_IRGRP (S_IRUSR >> 3) /*< Read by group. */
227 #define S_IWGRP (S_IWUSR >> 3) /*< Write by group. */
228 #define S_IXGRP (S_IXUSR >> 3) /*< Execute by group. */
229 #define S_IRWXG (S_IRWXU >> 3) /*< Read,Write,Execute by user */
230 
231 #define S_IROTH (S_IRGRP >> 3) /*< Read by others. */
232 #define S_IWOTH (S_IWGRP >> 3) /*< Write by others. */
233 #define S_IXOTH (S_IXGRP >> 3) /*< Execute by others. */
234 #define S_IRWXO (S_IRWXG >> 3) /*< Read,Write,Execute by other */
235 // =============================================
236 
238 #define modecmp(str, pat) (strcmp(str, pat) == 0 ? 1: 0)
239 
240 // =============================================
242 #define FATFS_R (S_IRUSR | S_IRGRP | S_IROTH) /*< FatFs Read perms */
243 #define FATFS_W (S_IWUSR | S_IWGRP | S_IWOTH) /*< FatFs Write perms */
244 #define FATFS_X (S_IXUSR | S_IXGRP | S_IXOTH) /*< FatFs Execute perms */
245 
246 // =============================================
248 #define EOF (-1)
249 
251 #define SEEK_SET 0
252 #define SEEK_CUR 1
253 #define SEEK_END 2
254 
255 // =============================================
257 typedef struct __file FILE;
258 
260 #define MAX_FILES 16
261 extern FILE *__iob[MAX_FILES];
262 
264 #undef stdin
265 #undef stdout
266 #undef stderr
267 
268 // Hard coded stdin,stdout and stderr locations
269 #define stdin (__iob[0])
270 #define stdout (__iob[1])
271 #define stderr (__iob[2])
272 
273 // =============================================
274 //#define IO_MACROS
275 #ifdef IO_MACROS
276 #define putc(__c, __stream) fputc(__c, __stream)
280 #define getc(__stream) fgetc(__stream)
281 
284 #define putchar(__c) fputc(__c,stdout)
285 
286 #define puts(__str) fputs(__str,stdout)
287 #endif
288 
289 // =============================================
291 #define fdev_set_udata(stream, u) do { (stream)->udata = u; } while(0)
292 #define fdev_get_udata(stream) ((stream)->udata)
293 
295 #define _FDEV_EOF (-1)
296 #define _FDEV_ERR (-2)
297 //@brief device read/write flags
298 #define _FDEV_SETUP_READ __SRD
299 #define _FDEV_SETUP_WRITE __SWR
300 #define _FDEV_SETUP_RW (__SRD|__SWR)
302 // =============================================
303 
304 
305 /* posix.c */
306 MEMSPACE int isatty ( int fileno );
307 MEMSPACE int fgetc ( FILE *stream );
308 MEMSPACE int fputc ( int c , FILE *stream );
309 #ifndef IO_MACROS
310 MEMSPACE int getchar ( void );
311 MEMSPACE int putchar ( int c );
312 #endif
313 MEMSPACE int ungetc ( int c , FILE *stream );
314 #ifndef IO_MACROS
315 MEMSPACE int putc ( int c , FILE *stream );
316 #endif
317 MEMSPACE char *fgets ( char *str , int size , FILE *stream );
318 MEMSPACE int fputs ( const char *str , FILE *stream );
319 #ifndef IO_MACROS
320 MEMSPACE int puts ( const char *str );
321 #endif
322 MEMSPACE int feof ( FILE *stream );
323 MEMSPACE int fgetpos ( FILE *stream , size_t *pos );
324 MEMSPACE int fseek ( FILE *stream , long offset , int whence );
325 MEMSPACE int fsetpos ( FILE *stream , size_t *pos );
326 MEMSPACE long ftell ( FILE *stream );
327 MEMSPACE off_t lseek ( int fileno , off_t position , int whence );
328 MEMSPACE void rewind ( FILE *stream );
329 MEMSPACE int close ( int fileno );
330 MEMSPACE int fileno ( FILE *stream );
332 MEMSPACE FILE *fopen ( const char *path , const char *mode );
333 MEMSPACE size_t fread ( void *ptr , size_t size , size_t nmemb , FILE *stream );
334 MEMSPACE int ftruncate ( int fd , off_t length );
335 MEMSPACE size_t fwrite ( const void *ptr , size_t size , size_t nmemb , FILE *stream );
336 MEMSPACE int open ( const char *pathname , int flags );
337 MEMSPACE ssize_t read ( int fd , const void *buf , size_t count );
338 MEMSPACE void sync ( void );
339 MEMSPACE int syncfs ( int fd );
340 MEMSPACE int truncate ( const char *path , off_t length );
341 MEMSPACE ssize_t write ( int fd , const void *buf , size_t count );
342 MEMSPACE int fclose ( FILE *stream );
343 MEMSPACE void dump_stat ( struct stat *sp );
344 
345 #if 0
346 MEMSPACE int fstat ( int fd , struct stat *buf );
347 #endif
348 
349 MEMSPACE char *mctime ( time_t timev );
350 MEMSPACE int stat ( char *name , struct stat *buf );
351 MEMSPACE char *basename ( char *str );
352 MEMSPACE char *baseext ( char *str );
353 MEMSPACE int chdir ( const char *pathname );
354 MEMSPACE int chmod ( const char *pathname , mode_t mode );
355 MEMSPACE int dirname ( char *str );
356 MEMSPACE int utime(const char *filename, const struct utimbuf *times);
357 
358 #if 0
359 MEMSPACE int fchmod ( int fd , mode_t mode );
360 #endif
361 
362 MEMSPACE char *getcwd ( char *pathname , int len );
363 MEMSPACE int mkdir ( const char *pathname , mode_t mode );
364 MEMSPACE int rename ( const char *oldpath , const char *newpath );
365 MEMSPACE int rmdir ( const char *pathname );
366 MEMSPACE int unlink ( const char *pathname );
367 int closedir ( DIR *dirp );
368 DIR *opendir ( const char *pathdir );
369 struct dirent *readdir ( DIR *dirp );
370 MEMSPACE void clrerror ( FILE *stream );
371 MEMSPACE int ferror ( FILE *stream );
372 MEMSPACE void perror ( const char *s );
373 MEMSPACE char WEAK_ATR *strerror ( int errnum );
374 MEMSPACE char *strerror_r ( int errnum , char *buf , size_t buflen );
375 MEMSPACE FILE *fdevopen ( int (*put )(char ,FILE *), int (*get )(FILE *));
376 MEMSPACE int mkfs(char *name );
377 MEMSPACE int fatfs_getc ( FILE *stream );
378 MEMSPACE int fatfs_putc ( char c , FILE *stream );
379 MEMSPACE int fatfs_to_errno ( FRESULT Result );
380 MEMSPACE int fatfs_to_fileno ( FIL *fh );
385 MEMSPACE int new_file_descriptor ( void );
386 MEMSPACE int posix_fopen_modes_to_open ( const char *mode );
387 
388 MEMSPACE int fprintf(FILE *fp, const char *format, ...);
389 
390 
391 // =============================================
392 #endif //_POSIX_H_
Definition: posix.h:87
struct dirent * readdir(DIR *dirp)
Definition: posix.c:1755
int int32_t
MEMSPACE int fatfs_to_fileno(FIL *fh)
Convert FatFS file handle to POSIX fileno. NOT POSIX.
Definition: posix.c:2190
uint16_t uid_t
Definition: posix.h:49
Definition: posix.h:81
MEMSPACE int dirname(char *str)
POSIX directory name of a filename. Return the index of the last &#39;/&#39; character.
Definition: posix.c:1551
MEMSPACE int fsetpos(FILE *stream, size_t *pos)
POSIX set position of file stream.
Definition: posix.c:571
blkcnt_t st_blocks
Definition: posix.h:116
MEMSPACE FILE * fdevopen(int(*put)(char, FILE *), int(*get)(FILE *))
Device open functions.
Definition: posix.c:1876
MEMSPACE int fputc(int c, FILE *stream)
Put a byte to TTY device or FatFs file stream open() or fopen() sets stream->put = fatfs_outc() for F...
Definition: posix.c:278
MEMSPACE int fileno(FILE *stream)
Convert POSIX stream pointer to POSIX fileno (index of __iob[])
Definition: posix.c:724
unsigned short uint16_t
Definition: send.c:18
MEMSPACE void unix_time_to_fat(time_t epoch, uint16_t *date, uint16_t *time)
Convert Linux POSIX time_t to FAT32 date and time. NOT POSIX.
Definition: posix.c:2252
FILE * __iob[MAX_FILES]
POSIX fileno to POSIX FILE stream table.
Definition: posix.c:139
Definition: posix.h:96
MEMSPACE void rewind(FILE *stream)
POSIX rewind file to the beginning.
Definition: posix.c:666
DIR * opendir(const char *pathdir)
Definition: posix.c:1736
MEMSPACE int mkfs(char *name)
Formt SD card.
Definition: posix.c:1922
Definition: posix.h:88
time_t st_ctime
Definition: posix.h:119
Definition: posix.h:85
MEMSPACE int feof(FILE *stream)
feof reports if the stream is at EOF
Definition: posix.c:505
MEMSPACE char * strerror_r(int errnum, char *buf, size_t buflen)
POSIX strerror_r() - convert POSIX errno to text with user message.
Definition: posix.c:1857
Definition: posix.h:79
MEMSPACE int chmod(const char *pathname, mode_t mode)
POSIX chmod function - change file access permission Unfortunately file f_open modes and f_chmod mode...
Definition: posix.c:1513
uint32_t dev_t
make sure we use our EDOM and ERANGE values
Definition: posix.h:45
Definition: posix.h:67
uint32_t off_t
Definition: posix.h:51
uint32_t mode_t
Definition: posix.h:47
MEMSPACE int fclose(FILE *stream)
POSIX close a file stream.
Definition: posix.c:1239
MEMSPACE int rename(const char *oldpath, const char *newpath)
POSIX rename a file by name.
Definition: posix.c:1648
Definition: posix.h:84
MEMSPACE char * getcwd(char *pathname, int len)
POSIX get current working directory.
Definition: posix.c:1596
struct utimbuf utime_t
POSIX utimbuf structure.
dev_t st_dev
Definition: posix.h:107
Definition: posix.h:66
unsigned int uint32_t
Definition: send.c:19
MEMSPACE int new_file_descriptor(void)
Allocate a POSIX FILE descriptor. NOT POSIX.
Definition: posix.c:2355
Definition: posix.h:76
int32_t ssize_t
Definition: posix.h:55
MEMSPACE char * mctime(time_t timev)
Display Ascii formatted time from timev seconds NOT POSIX.
Definition: posix.c:1323
FILE type structure.
Definition: posix.h:156
MEMSPACE int fputs(const char *str, FILE *stream)
put a string to stdout See fdevopen() sets stream->put get for TTY devices
Definition: posix.c:457
MEMSPACE int putc(int c, FILE *stream)
Put a character to a stream See fdevopen() sets stream->put get for TTY devices.
Definition: posix.c:401
MEMSPACE int syncfs(int fd)
POSIX Sync pending file changes and metadata for specified fileno.
Definition: posix.c:1096
MEMSPACE int puts(const char *str)
put a string to stdout See fdevopen() sets stream->put get for TTY devices
Definition: posix.c:480
#define MAX_FILES
Maximum number of POSIX file handles.
Definition: posix.h:260
Definition: posix.h:136
MEMSPACE FIL * fileno_to_fatfs(int fileno)
Convert POSIX fileno to FatFS handle NOT POSIX.
Definition: posix.c:2276
MEMSPACE off_t lseek(int fileno, off_t position, int whence)
POSIX seek to file position.
Definition: posix.c:617
dev_t st_rdev
Definition: posix.h:113
MEMSPACE int fatfs_getc(FILE *stream)
Private FatFs function called by fgetc() to get a byte from file stream FIXME buffer this function ca...
Definition: posix.c:1984
Definition: posix.h:89
MEMSPACE int ftruncate(int fd, off_t length)
POSIX truncate open file to length.
Definition: posix.c:827
MEMSPACE int ungetc(int c, FILE *stream)
Un-Get byte from a TTY device or FatFs file stream.
Definition: posix.c:368
MEMSPACE void dump_stat(struct stat *sp)
Display struct stat, from POSIX stat(0 or fstat(), in ASCII. NOT POSIX.
Definition: posix.c:1260
MEMSPACE void clrerror(FILE *stream)
clrerror resets stream EOF and error flags
Definition: posix.c:1786
MEMSPACE void sync(void)
POSIX Sync all pending file changes and metadata on ALL files.
Definition: posix.c:1069
char * buf
Definition: posix.h:157
MEMSPACE time_t time(time_t *t)
Return second from epoch - POSIX function.
Definition: time.c:843
MEMSPACE int fatfs_putc(char c, FILE *stream)
Private FatFs function called by fputc() to put a byte from file stream NOT POSIX open() assigns stre...
Definition: posix.c:2074
MEMSPACE FILE * fileno_to_stream(int fileno)
Convert POSIX fileno to POSIX FILE stream pointer. NOT POSIX.
Definition: posix.c:754
nlink_t st_nlink
Definition: posix.h:110
POSIX utimbuf structure.
Definition: posix.h:124
MEMSPACE int chdir(const char *pathname)
POSIX change directory.
Definition: posix.c:1488
MEMSPACE char * basename(char *str)
POSIX Basename of filename.
Definition: posix.c:1446
Definition: ff.h:184
Definition: posix.h:72
Definition: posix.h:94
MEMSPACE int putchar(int c)
put a character to stdout See fdevopen() sets stream->put get for TTY devices
Definition: posix.c:351
uint32_t time_t
type of EPOCH result.
Definition: time.h:35
Definition: posix.h:78
time_t actime
Definition: posix.h:126
MEMSPACE int fgetc(FILE *stream)
Get byte from a TTY device or FatFs file stream open() or fopen() sets stream->get = fatfs_getc() for...
Definition: posix.c:216
int len
Definition: posix.h:176
Definition: posix.h:69
unsigned char unget
Definition: posix.h:158
MEMSPACE int fatfs_to_errno(FRESULT Result)
Convert FafFs error result to POSIX errno. NOT POSIX.
Definition: posix.c:2114
MEMSPACE int mkdir(const char *pathname, mode_t mode)
POSIX make a directory.
Definition: posix.c:1619
Definition: posix.h:75
FRESULT
Definition: ff.h:220
mode_t st_mode
Definition: posix.h:109
Definition: posix.h:91
MEMSPACE size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
POSIX read nmemb elements from buf, size bytes each, to the stream fd.
Definition: posix.c:803
uint32_t time_t
Definition: posix.h:54
Definition: posix.h:90
MEMSPACE char WEAK_ATR * strerror(int errnum)
POSIX strerror() - convert POSIX errno to text with user message.
Definition: posix.c:1840
Definition: posix.h:74
MEMSPACE int stat(char *name, struct stat *buf)
POSIX stat - get file status of named file.
Definition: posix.c:1344
Definition: posix.h:64
Definition: posix.h:71
MEMSPACE FILE * fopen(const char *path, const char *mode)
POSIX Open a file with path name and ascii file mode string.
Definition: posix.c:782
uint32_t blkcnt_t
Definition: posix.h:52
Definition: posix.h:97
Definition: posix.h:82
POSIX stat structure.
Definition: posix.h:105
MEMSPACE int isatty(int fileno)
Test POSIX fileno if it is a Serial Console/TTY.
Definition: posix.c:196
MEMSPACE int fgetpos(FILE *stream, size_t *pos)
POSIX get position of file stream.
Definition: posix.c:522
uint32_t ino_t
Definition: posix.h:46
time_t modtime
Definition: posix.h:127
MEMSPACE int ferror(FILE *stream)
ferror reports if the stream has an error flag set
Definition: posix.c:1798
Definition: posix.h:63
MEMSPACE char * baseext(char *str)
File extention of a file name. NOT POSIX.
Definition: posix.c:1466
MEMSPACE int open(const char *pathname, int flags)
POSIX Open a file with integer mode flags.
Definition: posix.c:895
ino_t st_ino
Definition: posix.h:108
MEMSPACE int fprintf(FILE *fp, const char *format,...)
fprintf function Example user defined printf function using fputc for I/O This method allows I/O to d...
Definition: posix.c:2484
#define MEMSPACE
Definition: cpu.h:25
Definition: posix.h:86
Definition: posix.h:92
Definition: posix.h:83
uint16_t gid_t
Definition: posix.h:50
uint32_t nlink_t
Definition: posix.h:48
MEMSPACE ssize_t read(int fd, const void *buf, size_t count)
POSIX read count bytes from *buf to fileno fd.
Definition: posix.c:1006
MEMSPACE int close(int fileno)
POSIX Close a file with fileno handel.
Definition: posix.c:685
#define WEAK_ATR
Definition: stringsup.h:33
Definition: posix.h:70
time_t st_atime
Definition: posix.h:117
MEMSPACE int unlink(const char *pathname)
POSIX delete a file.
Definition: posix.c:1693
Definition: posix.h:93
MEMSPACE int posix_fopen_modes_to_open(const char *mode)
Convert POSIX fopen mode to POSIX open mode flags. NOT POSIX.
Definition: posix.c:2418
Definition: ff.h:161
Definition: posix.h:73
Definition: posix.h:68
Definition: posix.h:65
MEMSPACE void perror(const char *s)
POSIX perror() - convert POSIX errno to text with user message.
Definition: posix.c:1814
off_t st_size
Definition: posix.h:114
unsigned char uint8_t
Definition: send.c:17
POSIX_errno
Definition: posix.h:61
uint8_t flags
Definition: posix.h:159
MEMSPACE ssize_t write(int fd, const void *buf, size_t count)
POSIX Write count bytes from *buf to fileno fd.
Definition: posix.c:1180
MEMSPACE int utime(const char *filename, const struct utimbuf *times)
Set Modification and Access time of a file.
Definition: posix.c:1407
uint32_t blksize_t
Definition: posix.h:53
blksize_t st_blksize
Definition: posix.h:115
Definition: posix.h:80
MEMSPACE int free_file_descriptor(int fileno)
Free POSIX fileno FILE descriptor. NOT POSIX.
Definition: posix.c:2311
MEMSPACE int truncate(const char *path, off_t length)
POSIX truncate named file to length.
Definition: posix.c:1142
time_t st_mtime
Definition: posix.h:118
#define MAX_NAME_LEN
Definition: posix.h:133
MEMSPACE int getchar(void)
functions normally defined as macros
Definition: posix.c:336
MEMSPACE int fseek(FILE *stream, long offset, int whence)
POSIX seek to file possition.
Definition: posix.c:545
uid_t st_uid
Definition: posix.h:111
MEMSPACE size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
POSIX write nmemb elements from buf, size bytes each, to the stream fd.
Definition: posix.c:868
Definition: posix.h:77
Definition: posix.h:95
int closedir(DIR *dirp)
POSIX closedir.
Definition: posix.c:1717
MEMSPACE char * fgets(char *str, int size, FILE *stream)
get a string from stdin See fdevopen() sets stream->put get for TTY devices
Definition: posix.c:420
MEMSPACE time_t fat_time_to_unix(uint16_t date, uint16_t time)
Convert FatFs file date and time to POSIX epoch seconds. NOT POSIX.
Definition: posix.c:2227
MEMSPACE long ftell(FILE *stream)
POSIX file position of open stream.
Definition: posix.c:585
MEMSPACE int rmdir(const char *pathname)
POSIX delete a directory.
Definition: posix.c:1671
gid_t st_gid
Definition: posix.h:112
int size
Definition: posix.h:175
void * udata
Definition: posix.h:180
Definition: posix.h:98