synapse.lib.platforms package

Home for platform specific code such as thishost info.

all platform modules must be importable from any platform.

( guard any platform specific code with appropriate conditionals )

Submodules

synapse.lib.platforms.common module

synapse.lib.platforms.common.daemonize()[source]

For unix platforms, form a new process group using fork().

synapse.lib.platforms.common.getLibC()[source]

Return a ctypes reference to libc

synapse.lib.platforms.common.getTempDir()[source]
synapse.lib.platforms.common.getVolInfo(*paths)[source]

Retrieve volume usage info for the given path.

synapse.lib.platforms.common.inet_ntop(afam, byts)[source]
synapse.lib.platforms.common.inet_pton(afam, text)[source]
synapse.lib.platforms.common.initHostInfo()[source]
synapse.lib.platforms.common.setProcName(name)[source]

Set the process title/name for process listing.

synapse.lib.platforms.darwin module

synapse.lib.platforms.darwin.initHostInfo()[source]

synapse.lib.platforms.freebsd module

synapse.lib.platforms.freebsd.initHostInfo()[source]

synapse.lib.platforms.linux module

synapse.lib.platforms.linux.getAvailableMemory()[source]

Returns the available memory of the system

synapse.lib.platforms.linux.getCurrentLockedMemory()[source]

Return the amount of memory this process has locked

synapse.lib.platforms.linux.getFileMappedRegion(filename)[source]

Return a tuple of address and length of a particular file memory mapped into this process

synapse.lib.platforms.linux.getMaxLockedMemory()[source]

Returns the maximum amount of memory this process can lock

synapse.lib.platforms.linux.getSysctls()[source]
synapse.lib.platforms.linux.getTotalMemory()[source]

Get the total amount of memory in the system.

Notes

This attempts to get information from cgroup data before falling back to /proc/meminfo data.

Returns:

The number of bytes of memory available in the system.

Return type:

int

synapse.lib.platforms.linux.initHostInfo()[source]
synapse.lib.platforms.linux.maximizeMaxLockedMemory()[source]

Remove any discretionary (i.e. soft) limits

synapse.lib.platforms.linux.mlock(address, length)[source]

Lock a chunk of memory to prevent it from being swapped out, raising an OSError on error

synapse.lib.platforms.linux.mmap(address, length, prot, flags, fd, offset)[source]

A simple mmap context manager that releases the GIL while mapping and unmapping. It raises an OSError on error

synapse.lib.platforms.linux.munlock(address, length)[source]

Unlock a chunk of memory, raising an OSError on error

synapse.lib.platforms.windows module

synapse.lib.platforms.windows.daemonize()[source]
synapse.lib.platforms.windows.getLibC()[source]

Override to account for python on windows not being able to find libc sometimes…

synapse.lib.platforms.windows.initHostInfo()[source]
class synapse.lib.platforms.windows.sockaddr[source]

Bases: Structure

ipv4

Structure/Union member

ipv6

Structure/Union member

sa_family

Structure/Union member