os: Implement getpid() and waitpid().

pull/118/head
Paul Sokolovsky 2014-04-26 10:05:46 +03:00
rodzic 5ec9531764
commit 4835a37871
2 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -12,6 +12,8 @@ close_ = libc.func("i", "close", "i")
fork_ = libc.func("i", "fork", "")
pipe_ = libc.func("i", "pipe", "p")
_exit_ = libc.func("v", "_exit", "i")
getpid_ = libc.func("i", "getpid", "")
waitpid_ = libc.func("i", "waitpid", "ipi")
def check_error(ret):
@ -53,3 +55,12 @@ def pipe():
def _exit(n):
_exit_(n)
def getpid():
return getpid_()
def waitpid(pid, opts):
a = array.array('i', [0])
r = waitpid_(pid, a, opts)
check_error(r)
return (r, a[0])

Wyświetl plik

@ -1,7 +1,7 @@
from distutils.core import setup
setup(name='micropython-os',
version='0.0.3',
version='0.0.4',
description='os module for MicroPython',
url='https://github.com/micropython/micropython/issues/405',
author='MicroPython Developers',