micropython/unix
Paul Sokolovsky 0bb57bf5bf unix/modtime: sleep(): Automatically restart after receiving EINTR.
THis is required to deal well with signals, signals being the closest
analogue of hardware interrupts for POSIX. This is also CPython 3.5
compliant behavior (PEP 475).

The main problem implementing this is to figure out how much time was
spent in waiting so far/how much is remaining. It's well-known fact that
Linux updates select()'s timeout value when returning with EINTR to the
remaining wait time. Here's what POSIX-based standards say about this:
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html):

"Upon successful completion, the select() function may modify the object
pointed to by the timeout argument."

I.e. it allows to modify timeout value, but doesn't say how exactly it is
modified. And actually, it allows such modification only "upon successful
completion", which returning with EINTR error hardly is.

POSIX also allows to request automatic EINTR restart for system calls using
sigaction call with SA_RESTART flag, but here's what the same document says
about it:

"If SA_RESTART has been set for the interrupting signal, it is
implementation-defined whether the function restarts or returns with
[EINTR]."

In other words, POSIX doesn't leave room for both portable and efficient
handling of this matter, so the code just allows to manually select
Linux-compatible behavior with MICROPY_SELECT_REMAINING_TIME option,
or otherwise will just raise OSError. When systems with non-Linux behavior
are found, they can be handled separately.
2015-11-29 14:21:06 +02:00
..
.gitignore unix: Update .gitignore; now ignores coverage build. 2015-06-03 17:47:31 +01:00
Makefile unix: Use printf() implementation in terms of mp_printf(). 2015-11-22 00:44:41 +02:00
alloc.c unix: Add target to build "minimal" uPy interpreter. 2015-01-16 18:03:01 +00:00
coverage.c unix: Fix coverage build now that mp_plat_print uses write. 2015-10-15 00:23:03 +01:00
file.c py: Add stream_tell method, and use for unix and stmhal file tell. 2015-08-13 22:56:32 +01:00
gccollect.c unix/gccollect: Fallback to setjmp-based register fetching automatically. 2015-11-08 16:05:33 +02:00
input.c unix/input: Switch to POSIX I/O for history reading/writing. 2015-11-16 07:40:56 +02:00
input.h unix: Support readline history saving to file, improves interactive usage. 2015-03-13 21:46:19 +00:00
main.c unix/main: Get rid of perror() which uses stdio. 2015-11-23 00:10:38 +02:00
modffi.c unix/modffi: Mark 'O' type specifier as implemented. 2015-11-20 17:51:37 +02:00
modjni.c unix/modjni: Add missing get_jclass_name() function. 2015-11-11 16:43:27 +02:00
modos.c unix/modos: Remove duplicate level of #if MICROPY_PY_OS_STATVFS. 2015-11-26 17:46:26 +02:00
modsocket.c unix/modsocket: Use snprintf(), as defined by lib/utils/printf.c. 2015-11-21 17:21:49 +02:00
modtermios.c unix/modtermios: tcsetattr: If 0 passed for "when" param, treat as TCSANOW. 2015-10-13 00:37:55 +03:00
modtime.c unix/modtime: sleep(): Automatically restart after receiving EINTR. 2015-11-29 14:21:06 +02:00
moduselect.c unix/moduselect: poll.register(): Reuse freed entries in poll array. 2015-11-29 00:06:51 +02:00
mpconfigport.h unix/modtime: sleep(): Automatically restart after receiving EINTR. 2015-11-29 14:21:06 +02:00
mpconfigport.mk modussl: SSL socket wrapper module based on axTLS. 2015-10-06 18:10:39 +03:00
mpconfigport_fast.h unix: Include upip as fronzen modules inside the standard interpreter. 2015-06-02 01:32:07 +03:00
mpconfigport_minimal.h py: Add MICROPY_PY_BUILTINS_FILTER, disable for minimal ports. 2015-08-20 01:05:11 +03:00
mphalport.h unix: Add "uselect" module, with poll() function. 2015-11-17 00:35:57 +02:00
qstrdefsport.h unix/modsocket: Implement sockaddr() function to decode raw socket address. 2015-11-21 01:38:59 +02:00
unix_mphal.c unix/unix_mphal: Use size_t instead of mp_uint_t in stdout_tx_strn decls. 2015-11-27 14:03:53 +00:00