File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,22 @@ typedef struct ipc_mapped_handle_cache_t {
54
54
55
55
ipc_mapped_handle_cache_global_t * IPC_MAPPED_CACHE_GLOBAL = NULL ;
56
56
57
+ // Returns value of the UMF_MAX_OPENED_IPC_HANDLES environment variable
58
+ // or 0 if it is not set.
59
+ static size_t umfIpcCacheGlobalInitMaxOpenedHandles (void ) {
60
+ const char * max_size_str = getenv ("UMF_MAX_OPENED_IPC_HANDLES" );
61
+ if (max_size_str ) {
62
+ char * endptr ;
63
+ size_t max_size = strtoul (max_size_str , & endptr , 10 );
64
+ if (* endptr == '\0' ) {
65
+ return max_size ;
66
+ }
67
+ LOG_ERR ("Invalid value of UMF_MAX_OPENED_IPC_HANDLES: %s" ,
68
+ max_size_str );
69
+ }
70
+ return 0 ;
71
+ }
72
+
57
73
umf_result_t umfIpcCacheGlobalInit (void ) {
58
74
umf_result_t ret = UMF_RESULT_SUCCESS ;
59
75
ipc_mapped_handle_cache_global_t * cache_global =
@@ -78,8 +94,7 @@ umf_result_t umfIpcCacheGlobalInit(void) {
78
94
goto err_mutex_destroy ;
79
95
}
80
96
81
- // TODO: make max_size configurable via environment variable
82
- cache_global -> max_size = 0 ;
97
+ cache_global -> max_size = umfIpcCacheGlobalInitMaxOpenedHandles ();
83
98
cache_global -> cur_size = 0 ;
84
99
cache_global -> lru_list = NULL ;
85
100
You can’t perform that action at this time.
0 commit comments