(vm: &VirtualMachine)
| 1553 | |
| 1554 | #[pyfunction] |
| 1555 | fn getpid(vm: &VirtualMachine) -> PyObjectRef { |
| 1556 | let pid = if cfg!(target_arch = "wasm32") { |
| 1557 | // Return an arbitrary value, greater than 1 which is special. |
| 1558 | // The value 42 is picked from wasi-libc |
| 1559 | // https://github.com/WebAssembly/wasi-libc/blob/wasi-sdk-21/libc-bottom-half/getpid/getpid.c |
| 1560 | 42 |
| 1561 | } else { |
| 1562 | std::process::id() |
| 1563 | }; |
| 1564 | vm.ctx.new_int(pid).into() |
| 1565 | } |
| 1566 | |
| 1567 | #[pyfunction] |
| 1568 | fn cpu_count(vm: &VirtualMachine) -> PyObjectRef { |
no test coverage detected