MCPcopy Index your code
hub / github.com/RustPython/RustPython / getpid

Function getpid

crates/vm/src/stdlib/os.rs:1555–1565  ·  view source on GitHub ↗
(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

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 {

Callers 11

register_segmentMethod · 0.90
destroy_segmentMethod · 0.90
__del__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__del__Method · 0.90
__call__Method · 0.85
is_pty_childFunction · 0.85
get_number_of_os_threadsFunction · 0.85
warn_if_multi_threadedFunction · 0.85
handle_exit_exceptionMethod · 0.85

Calls 2

idFunction · 0.85
new_intMethod · 0.45

Tested by

no test coverage detected