17
17
#include "memory_provider_internal.h"
18
18
#include "provider/provider_tracking.h"
19
19
20
+ // TODO flag - IPC?
20
21
umf_result_t
21
22
umfGetMemoryPropertiesHandle (const void * ptr ,
22
23
umf_memory_properties_handle_t * props_handle ) {
23
24
24
- LOG_DEBUG ("umfGetMemoryPropertiesHandle: ptr=%p, props_handle=%p" , ptr ,
25
- props_handle );
25
+ // LOG_DEBUG("umfGetMemoryPropertiesHandle: ptr=%p, props_handle=%p", ptr,
26
+ // props_handle);
26
27
27
28
if (props_handle == NULL ) {
28
29
return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
29
30
}
30
31
31
32
tracker_alloc_info_t * info = NULL ;
32
33
umf_result_t ret = umfMemoryTrackerGetAllocInfo (ptr , & info );
33
- if (ret != UMF_RESULT_SUCCESS ) {
34
- return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
34
+
35
+ if (ret == UMF_RESULT_SUCCESS ) {
36
+ * props_handle = & info -> props ;
37
+ //LOG_DEBUG("umfGetMemoryPropertiesHandle: props_handle=%p, id=%" PRIu64,
38
+ // *props_handle, (*props_handle)->id);
39
+ return UMF_RESULT_SUCCESS ;
35
40
}
36
41
37
- * props_handle = & info -> props ;
42
+ // try to get IPC info
43
+ umf_ipc_info_t ipc_info ;
44
+ ret = umfMemoryTrackerGetIpcInfo (ptr , & ipc_info );
45
+ if (ret != UMF_RESULT_SUCCESS ) {
46
+ LOG_ERR ("Failed to get memory properties handle for ptr=%p" , ptr );
47
+ return ret ;
48
+ }
38
49
39
- LOG_DEBUG ("umfGetMemoryPropertiesHandle: props_handle=%p, id=%" PRIu64 ,
40
- * props_handle , (* props_handle )-> id );
50
+ * props_handle = ipc_info .props ;
51
+ //LOG_DEBUG(
52
+ // "umfGetMemoryPropertiesHandle (IPC info): props_handle=%p, id=%" PRIu64,
53
+ // *props_handle, (*props_handle)->id);
41
54
42
55
return UMF_RESULT_SUCCESS ;
43
56
}
@@ -46,20 +59,24 @@ umf_result_t umfGetMemoryProperty(umf_memory_properties_handle_t props_handle,
46
59
umf_memory_property_id_t memory_property_id ,
47
60
size_t max_property_size , void * value ) {
48
61
62
+ /*
49
63
LOG_DEBUG("umfGetMemoryProperty: props_handle=%p, memory_property_id=%d, "
50
64
"max_property_size=%zu, value=%p",
51
65
props_handle, memory_property_id, max_property_size, value);
66
+ */
52
67
53
68
if ((value == NULL ) || (props_handle == NULL ) || (max_property_size == 0 )) {
54
69
return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
55
70
}
56
71
57
72
umf_memory_provider_t * provider = props_handle -> provider ;
58
73
74
+ /*
59
75
LOG_DEBUG("umfGetMemoryProperty: provider=%p", provider);
60
76
LOG_DEBUG("dereferencing value...");
61
77
62
78
LOG_DEBUG("value: %zu", *(size_t *)value);
79
+ */
63
80
64
81
switch (memory_property_id ) {
65
82
case UMF_MEMORY_PROPERTY_INVALID :
0 commit comments