Android Hardware Abstraction Layer
|int(*||init )(const struct memtrack_module *module)|
|int(*||getMemory )(const struct memtrack_module *module, pid_t pid, int type, struct memtrack_record *records, size_t *num_records)|
Every hardware module must have a data structure named HAL_MODULE_INFO_SYM and the fields of this data structure must begin with hw_module_t followed by module specific information.
|int(* getMemory)(const struct memtrack_module *module, pid_t pid, int type, struct memtrack_record *records, size_t *num_records)|
(*getMemory)() expects an array of record objects and populates up to *num_record structures with the sizes of memory plus associated flags for that memory. It also updates *num_records with the total number of records it could return if *num_records was large enough when passed in. Returning records with size 0 is expected, the number of records should not vary between calls to getMemory for the same memory type, even for different pids.
The caller will often call getMemory for a type and pid with *num_records == 0 to determine how many records to allocate room for, this case should be a fast-path in the HAL, returning a constant and not querying any kernel files. If *num_records passed in is 0, then records may be NULL.
This function must be thread-safe, it may get called from multiple threads at the same time.
Returns 0 on success, -ENODEV if the type is not supported, -errno on other errors.
|int(* init)(const struct memtrack_module *module)|