Line data Source code
1 : #define _GNU_SOURCE 2 : #include "../../shared/fd_config.h" 3 : #include "../../shared/fd_sys_util.h" 4 : 5 : #include <sys/resource.h> 6 : 7 : void 8 : initialize_workspaces( config_t const * config ); 9 : 10 : void 11 : wksp_cmd_perm( args_t * args FD_PARAM_UNUSED, 12 : fd_cap_chk_t * chk, 13 0 : config_t const * config ) { 14 0 : ulong mlock_limit = 0UL; 15 0 : for( ulong i=0UL; i<config->topo.wksp_cnt; i++ ) { 16 0 : fd_topo_wksp_t const * wksp = &config->topo.workspaces[ i ]; 17 0 : mlock_limit = fd_ulong_max( mlock_limit, wksp->page_cnt * wksp->page_sz ); 18 0 : } 19 : /* One 4K page is used by the logging lock */ 20 0 : fd_cap_chk_raise_rlimit( chk, "wksp", RLIMIT_MEMLOCK, mlock_limit+4096UL, "call `rlimit(2)` to increase `RLIMIT_MEMLOCK` so all memory can be locked with `mlock(2)`" ); 21 0 : } 22 : 23 : void 24 : wksp_cmd_fn( args_t * args FD_PARAM_UNUSED, 25 0 : config_t * config ) { 26 0 : initialize_workspaces( config ); 27 0 : fd_sys_util_exit_group( 0 ); 28 0 : }