fault.system

Process state storage for residual file descriptors.

ports manages the set of file descriptors that are intended to be kept across process images. This module is normally used exclusively by daemon processes that wish to update their process image without having to discard listening sockets.

os
import

typing
import

kernel
import

_state
data

_state = {}

close
function

close(identifier)

Close the ports associated with the identifier and remove them from storage.

restore
function
None

restore(identifier, ports)

Add ports to the set using the identifier presuming that the ports are properly configured. Used by daemon processes after performing exec to refresh the process image.

install
function
None

install(identifier, ports)

Add the ports to the set making sure that they are properly configured to persist across process images.

If a sequence of ports is already installed with the identifier, it will be extended.

allocate
function
typing.Mapping[str, kernel.Ports]

allocate()

Return the full set of installed ports for use within a worker process and remove the installed ports from process the global data.