def to_handle(cffi_ptr) -> Pointer[NativeFunction]: pointer_int = int(ffi.cast('ssize_t', cffi_ptr)) # TODO we're just making up a memory mapping that this pointer is inside; # we should figure out the actual mapping, and the size for that matter. mapping = MemoryMapping(task, near.MemoryMapping(pointer_int, 0, 1), far.File()) return Pointer(mapping, NullGateway(), NativeFunctionSerializer(), StaticAllocation())
async def malloc( self, size: int, alignment: int) -> t.Tuple[MemoryMapping, AllocationInterface]: self.allocations.append((size, alignment)) return ( MemoryMapping(t.cast(Task, None), near.MemoryMapping(0, size, 4096), far.File()), NullAllocation(size), )