@@ -18,11 +18,12 @@ use std::time::Duration;
1818use sysdefs:: constants:: err_const:: { get_errno, handle_errno, syscall_error, Errno , VERBOSE } ;
1919use sysdefs:: constants:: fs_const:: { STDERR_FILENO , STDIN_FILENO , STDOUT_FILENO } ;
2020use sysdefs:: constants:: lind_platform_const:: {
21- RAWPOSIX_CAGEID , UNUSED_ARG , UNUSED_ID , UNUSED_NAME , WASMTIME_CAGEID ,
21+ MAX_LINEAR_MEMORY_SIZE , RAWPOSIX_CAGEID , UNUSED_ARG , UNUSED_ID , UNUSED_NAME , WASMTIME_CAGEID ,
2222} ;
2323use sysdefs:: constants:: sys_const:: {
24- DEFAULT_GID , DEFAULT_UID , EXIT_SUCCESS , ITIMER_REAL , SIGCHLD , SIGKILL , SIGSTOP , SIG_BLOCK ,
25- SIG_SETMASK , SIG_UNBLOCK , WNOHANG ,
24+ DEFAULT_GID , DEFAULT_UID , EXIT_SUCCESS , ITIMER_REAL , RLIMIT_AS , RLIMIT_DATA , RLIMIT_NOFILE ,
25+ RLIMIT_RSS , RLIMIT_STACK , SIGCHLD , SIGKILL , SIGSTOP , SIG_BLOCK , SIG_SETMASK , SIG_UNBLOCK ,
26+ WNOHANG ,
2627} ;
2728use sysdefs:: data:: fs_struct:: { ITimerVal , Rlimit , SigactionStruct } ;
2829use sysdefs:: logging:: lind_debug_panic;
@@ -1196,16 +1197,18 @@ pub extern "C" fn prlimit64_syscall(
11961197 Err ( e) => return syscall_error ( e, "prlimit64" , "bad address" ) ,
11971198 } ;
11981199 match resource {
1199- 3 => {
1200- // RLIMIT_STACK: 8MiB
1200+ RLIMIT_STACK => {
12011201 old_limit. rlim_cur = 8 * 1024 * 1024 ;
12021202 old_limit. rlim_max = 8 * 1024 * 1024 ;
12031203 }
1204- 7 => {
1205- // RLIMIT_NOFILE: 1024
1204+ RLIMIT_NOFILE => {
12061205 old_limit. rlim_cur = 1024 ;
12071206 old_limit. rlim_max = 1024 ;
12081207 }
1208+ RLIMIT_DATA | RLIMIT_RSS | RLIMIT_AS => {
1209+ old_limit. rlim_cur = MAX_LINEAR_MEMORY_SIZE as u32 ;
1210+ old_limit. rlim_max = MAX_LINEAR_MEMORY_SIZE as u32 ;
1211+ }
12091212 _ => {
12101213 lind_debug_panic ( & format ! ( "prlimit64: unsupported resource {}" , resource) ) ;
12111214 old_limit. rlim_cur = 0 ;
0 commit comments