MCPcopy Create free account
hub / github.com/bloomberg/pystack / is_elf

Function is_elf

src/pystack/process.py:125–132  ·  view source on GitHub ↗

Return True if the given file is an ELF file

(filename: pathlib.Path)

Source from the content-addressed store, hash-verified

123
124
125def is_elf(filename: pathlib.Path) -> bool:
126 "Return True if the given file is an ELF file"
127 try:
128 elf_header = b"\x7fELF"
129 with open(filename, "br") as thefile:
130 return thefile.read(4) == elf_header
131 except OSError:
132 return False
133
134
135def get_thread_name(pid: int, tid: int) -> Optional[str]:

Callers 2

process_coreFunction · 0.90
test_elf_checkerFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_elf_checkerFunction · 0.72