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 {
5454
5555ipc_mapped_handle_cache_global_t * IPC_MAPPED_CACHE_GLOBAL = NULL ;
5656
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+
5773umf_result_t umfIpcCacheGlobalInit (void ) {
5874 umf_result_t ret = UMF_RESULT_SUCCESS ;
5975 ipc_mapped_handle_cache_global_t * cache_global =
@@ -78,8 +94,7 @@ umf_result_t umfIpcCacheGlobalInit(void) {
7894 goto err_mutex_destroy ;
7995 }
8096
81- // TODO: make max_size configurable via environment variable
82- cache_global -> max_size = 0 ;
97+ cache_global -> max_size = umfIpcCacheGlobalInitMaxOpenedHandles ();
8398 cache_global -> cur_size = 0 ;
8499 cache_global -> lru_list = NULL ;
85100
You can’t perform that action at this time.
0 commit comments