Line data Source code
1 : #define _GNU_SOURCE 2 : #include "../../shared/fd_config.h" 3 : #include "../../shared/fd_action.h" 4 : #include "../../platform/fd_sys_util.h" 5 : 6 : #include <sys/resource.h> 7 : 8 : void 9 : initialize_workspaces( config_t const * config ); 10 : 11 : void 12 : wksp_cmd_perm( args_t * args FD_PARAM_UNUSED, 13 : fd_cap_chk_t * chk, 14 0 : config_t const * config ) { 15 0 : ulong mlock_limit = 0UL; 16 0 : for( ulong i=0UL; i<config->topo.wksp_cnt; i++ ) { 17 0 : fd_topo_wksp_t const * wksp = &config->topo.workspaces[ i ]; 18 0 : mlock_limit = fd_ulong_max( mlock_limit, wksp->page_cnt * wksp->page_sz ); 19 0 : } 20 : /* One 4K page is used by the logging lock */ 21 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)`" ); 22 0 : } 23 : 24 : void 25 : wksp_cmd_fn( args_t * args FD_PARAM_UNUSED, 26 0 : config_t * config ) { 27 0 : initialize_workspaces( config ); 28 0 : fd_sys_util_exit_group( 0 ); 29 0 : } 30 : 31 : action_t fd_action_wksp = { 32 : .name = "wksp", 33 : .args = NULL, 34 : .fn = wksp_cmd_fn, 35 : .perm = wksp_cmd_perm, 36 : .description = "Initialize workspaces" 37 : };