windows: Make unistd.h more posix compatible
- add SEEK_XXX definitions, this fixes missing definition in py/stream.c - move R_OK from realpath.c and add W_OK/F_OK defintions - move STDXXX_FILENO definitions from mpconfigport for consistency
This commit is contained in:
parent
bdd78c31b6
commit
3179d23cee
@ -186,9 +186,6 @@ void msec_sleep(double msec);
|
|||||||
#define restrict
|
#define restrict
|
||||||
#define inline __inline
|
#define inline __inline
|
||||||
#define alignof(t) __alignof(t)
|
#define alignof(t) __alignof(t)
|
||||||
#define STDIN_FILENO 0
|
|
||||||
#define STDOUT_FILENO 1
|
|
||||||
#define STDERR_FILENO 2
|
|
||||||
#define PATH_MAX MICROPY_ALLOC_PATH_MAX
|
#define PATH_MAX MICROPY_ALLOC_PATH_MAX
|
||||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||||
|
@ -26,3 +26,15 @@
|
|||||||
|
|
||||||
// There's no unistd.h, but this is the equivalent
|
// There's no unistd.h, but this is the equivalent
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
|
#define F_OK 0
|
||||||
|
#define W_OK 2
|
||||||
|
#define R_OK 4
|
||||||
|
|
||||||
|
#define STDIN_FILENO 0
|
||||||
|
#define STDOUT_FILENO 1
|
||||||
|
#define STDERR_FILENO 2
|
||||||
|
|
||||||
|
#define SEEK_CUR 1
|
||||||
|
#define SEEK_END 2
|
||||||
|
#define SEEK_SET 0
|
||||||
|
@ -26,11 +26,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <io.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifndef R_OK
|
|
||||||
#define R_OK 4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Make sure a path only has forward slashes.
|
// Make sure a path only has forward slashes.
|
||||||
char *to_unix_path(char *p) {
|
char *to_unix_path(char *p) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user