summaryrefslogtreecommitdiffstatshomepage
path: root/unix
Commit message (Collapse)AuthorAge
* unix: Implement uos.dupterm(). Conditional on MICROPY_PY_OS_DUPTERM.Paul Sokolovsky2015-12-28
|
* unix/unix_mphal: Raise KeyboardInterrupt straight from signal handler.Paul Sokolovsky2015-12-23
| | | | | | | | POSIX doesn't guarantee something like that to work, but it works on any system with careful signal implementation. Roughly, the requirement is that signal handler is executed in the context of the process, its main thread, etc. This is true for Linux. Also tested to work without issues on MacOSX.
* unix: Properly cancel REPL input when Ctrl-C is pressed.Damien George2015-12-22
|
* unix: machine_mem improvementsDave Hylands2015-12-18
| | | | | | This basically introduces the MICROPY_MACHINE_MEM_GET_READ_ADDR and MICROPY_MACHINE_MEM_GET_WRITE_ADDR macros. If one of them is not defined, then a default identity function is provided.
* ports: Rename "machine" module to "umachine".Paul Sokolovsky2015-12-18
| | | | | | | | To let unix port implement "machine" functionality on Python level, and keep consistent naming in other ports (baremetal ports will use magic module "symlinking" to still load it on "import machine"). Fixes #1701.
* windows: Make keyboard_interrupt_obj available, it's standard feature.Paul Sokolovsky2015-12-18
|
* unix/unix_mphal: Just consistently set sigaction.sa_flags to 0.Paul Sokolovsky2015-12-18
|
* unix/unix_mphal: Properly initialize struct sigaction.Paul Sokolovsky2015-12-17
| | | | | | This solves long-standing non-deterministic bug, which manifested itself on x86 32-bit (at least of reported cases) - segfault on Ctrl+C (i.e. SIGINT).
* unix: Change define logic of _DIRENT_HAVE_D_INO to match other macros.Damien George2015-12-16
|
* unix: Add FreeDos targetpohmelie2015-12-16
|
* unix/modos: Fix silly bugs in ilistdir tuple creation.Damien George2015-12-16
|
* unix/modos: Allow to configure use of d_ino using _DIRENT_HAVE_D_INO.Damien George2015-12-16
| | | | Ports will need to #define _DIRENT_HAVE_D_INO (0) to disable d_ino use.
* uos: Add errno() function to get/set errno value.Paul Sokolovsky2015-12-16
|
* unix/modos: Implement ilistdir().Paul Sokolovsky2015-12-14
| | | | | | | | | | | | ilistdir() returns iterator which yields triples of (name, type, ino) where ino is inode number for entry's data, type of entry (file/dir/etc.), and name of file/dir. listdir() can be easily implemented in terms of this iterator (which is otherwise more efficient in terms of memory use and may save expensive call to stat() for each returned entry). CPython has os.scandir() which also returns an iterator, but it yields more complex objects of DirEntry type. scandir() can also be easily implemented in terms of ilistdir().
* unix/modtime: Add strftime() function (only single argument is supported).Paul Sokolovsky2015-12-14
| | | | Following "don't rely on FFI for basic functionality" approach.
* unix/moduselect: Make configurable with MICROPY_PY_USELECT.Paul Sokolovsky2015-12-13
|
* unix: Move modmachine into unix directoryDave Hylands2015-12-13
| | | | | This leaves behind the common functionality in extmod/machine_mem.c which can be used by all ports.
* unix: Rename "_os" module to "uos" for consistency with baremetal ports.Paul Sokolovsky2015-12-12
|
* unix/moduselect: Implement "one-shot" flag for poll.poll().Paul Sokolovsky2015-12-11
| | | | | | | | | After an I/O event is triggered for fd, event flags are automatically reset, so no further events are reported until new event flags are set. This is an optimization for uasyncio, required to account for coroutine semantics: each coroutine issues explicit read/write async call, and once that trigger, no events should be reported to coroutine, unless it again explicitly requests it. One-shot mode saves one linear scan over the poll array.
* unix/modtermios: DJGPP appears to have unicode-capable cc_t type.Paul Sokolovsky2015-12-09
| | | | | At least it's defined as "unsiged". We don't try to support unicode still, but at least apply workaround for DJGPP build.
* unix/modtermios: Provide B57600 and B115200 constants only if defined.Paul Sokolovsky2015-12-09
|
* unix/main: mp_verbose_flag available only if MICROPY_DEBUG_PRINTERS is true.Paul Sokolovsky2015-12-07
| | | | Not available for minimal build for example.
* py: Add MICROPY_PY_BUILTINS_MIN_MAX, disable for minimal ports.pohmelie2015-12-07
|
* unix/moduselect: register(): Allow to call with duplicate file descriptor.Paul Sokolovsky2015-12-05
| | | | | | | | | | | Per CPython docs, "Registering a file descriptor that’s already registered is not an error, and has the same effect as registering the descriptor exactly once." https://docs.python.org/3/library/select.html#select.poll.register That's somewhat ambiguous, what's implemented here is that if fd si not yet registered, it is registered. Otherwise, the effect is equivalent to modify() method.
* unix/main: Check pending exception at the end of code block execution.Paul Sokolovsky2015-12-04
| | | | | | Usually this checking is done by VM on jump instructions, but for linear sequences of instructions and builtin functions this won't happen. Particular target of this change is long-running builtin functions like time.sleep().
* unix/mpconfigport: Typo fix in comment.Paul Sokolovsky2015-12-03
|
* unix/mpconfigport.h: For MICROPY_NO_ALLOCA=1, don't even include alloca.h.Paul Sokolovsky2015-12-02
|
* unix/modtime: sleep(): Return early if KeyboardInterrupt is pendingPaul Sokolovsky2015-12-02
| | | | | | As set by signal handler. This assumes that exception will be raised somewhere else, which so far doesn't happen for single function call. Still, it makes sense to handle that in some common place.
* unix/moduselect: Support growing of poll array.Paul Sokolovsky2015-11-30
|
* py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George2015-11-29
| | | | | | | | | This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
* py: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George2015-11-29
|
* unix/modtime: Unbreak Windows build after changes to check select() result.Paul Sokolovsky2015-11-29
|
* unix/modtime: sleep(): Automatically restart after receiving EINTR.Paul Sokolovsky2015-11-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* unix/moduselect: poll.register(): Reuse freed entries in poll array.Paul Sokolovsky2015-11-29
|
* unix/moduselect: Fix bug in poll.poll() scanning loop.Paul Sokolovsky2015-11-28
|
* unix/unix_mphal: Use size_t instead of mp_uint_t in stdout_tx_strn decls.Damien George2015-11-27
|
* unix/modos: Remove duplicate level of #if MICROPY_PY_OS_STATVFS.Paul Sokolovsky2015-11-26
|
* unix/main: Get rid of perror() which uses stdio.Paul Sokolovsky2015-11-23
|
* unix: Use printf() implementation in terms of mp_printf().Paul Sokolovsky2015-11-22
| | | | | | In other words, unix port now uses overriden printf(), instead of using libc's. This should remove almost all dependency on libc stdio (which is bloated).
* unix/modsocket: Use snprintf(), as defined by lib/utils/printf.c.Paul Sokolovsky2015-11-21
|
* py/emitglue: Host definition of mp_verbose_flag.Paul Sokolovsky2015-11-21
| | | | | This may not seem like the ideal place, but is actually the only place in py/ where it gets referenced, so is just right.
* unix/modsocket: Implement sockaddr() function to decode raw socket address.Paul Sokolovsky2015-11-21
| | | | | | | | Return tuple of (address_family, net_addr, [port, [extra_data]]). net_addr is still raw network address as bytes object, but suitable for passing to inet_ntop() function. At the very least, sockaddr() will separate address family value from binary socket address (and currently, only AF_INET family is decoded).
* unix/modsocket: Removed dangling references to sockaddr_in_type.Paul Sokolovsky2015-11-20
|
* unix/modffi: Mark 'O' type specifier as implemented.Paul Sokolovsky2015-11-20
|
* unix/moduselect: Initialise variable so can compile in non-debug mode.Damien George2015-11-20
|
* unix: Add "uselect" module, with poll() function.Paul Sokolovsky2015-11-17
| | | | Underlyingly, uses standard POSIX poll() for portability.
* unix/input: Switch to POSIX I/O for history reading/writing.Paul Sokolovsky2015-11-16
|
* unix/modos: getenv(): Handle non-existing envvar correctly.Paul Sokolovsky2015-11-14
|
* unix/modos: Add Windows workaround for mkdir().Paul Sokolovsky2015-11-14
|
* unix/modos: Add mkdir().Paul Sokolovsky2015-11-13
| | | | Dependency of upip.