kopia lustrzana https://github.com/micropython/micropython-lib
os: Implement getpid() and waitpid().
rodzic
5ec9531764
commit
4835a37871
11
os/os.py
11
os/os.py
|
@ -12,6 +12,8 @@ close_ = libc.func("i", "close", "i")
|
||||||
fork_ = libc.func("i", "fork", "")
|
fork_ = libc.func("i", "fork", "")
|
||||||
pipe_ = libc.func("i", "pipe", "p")
|
pipe_ = libc.func("i", "pipe", "p")
|
||||||
_exit_ = libc.func("v", "_exit", "i")
|
_exit_ = libc.func("v", "_exit", "i")
|
||||||
|
getpid_ = libc.func("i", "getpid", "")
|
||||||
|
waitpid_ = libc.func("i", "waitpid", "ipi")
|
||||||
|
|
||||||
|
|
||||||
def check_error(ret):
|
def check_error(ret):
|
||||||
|
@ -53,3 +55,12 @@ def pipe():
|
||||||
|
|
||||||
def _exit(n):
|
def _exit(n):
|
||||||
_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])
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
setup(name='micropython-os',
|
setup(name='micropython-os',
|
||||||
version='0.0.3',
|
version='0.0.4',
|
||||||
description='os module for MicroPython',
|
description='os module for MicroPython',
|
||||||
url='https://github.com/micropython/micropython/issues/405',
|
url='https://github.com/micropython/micropython/issues/405',
|
||||||
author='MicroPython Developers',
|
author='MicroPython Developers',
|
||||||
|
|
Ładowanie…
Reference in New Issue