py/mpconfig.h: Add MICROPY_STREAMS_POSIX_API setting.

To filter out even prototypes of mp_stream_posix_*() functions, which
require POSIX types like ssize_t & off_t, which may be not available in
some ports.
This commit is contained in:
Paul Sokolovsky
2016-07-30 20:05:56 +03:00
parent 58d9d85a56
commit 61e77a4e88
5 changed files with 13 additions and 1 deletions

View File

@@ -84,11 +84,13 @@ mp_uint_t mp_stream_rw(mp_obj_t stream, void *buf, mp_uint_t size, int *errcode,
void mp_stream_write_adaptor(void *self, const char *buf, size_t len);
#if MICROPY_STREAMS_POSIX_API
// Functions with POSIX-compatible signatures
ssize_t mp_stream_posix_write(mp_obj_t stream, const void *buf, size_t len);
ssize_t mp_stream_posix_read(mp_obj_t stream, void *buf, size_t len);
off_t mp_stream_posix_lseek(mp_obj_t stream, off_t offset, int whence);
int mp_stream_posix_fsync(mp_obj_t stream);
#endif
#if MICROPY_STREAMS_NON_BLOCK
#define mp_is_nonblocking_error(errno) ((errno) == EAGAIN || (errno) == EWOULDBLOCK)