Skip to content

Commit 57ba80c

Browse files
committed
Implement basic RLIMIT_NOFILE
1 parent 7c3a3f4 commit 57ba80c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/tinykvm/linux/system_calls.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,18 @@ void Machine::setup_linux_system_calls()
11051105
}
11061106
regs.rax = 0;
11071107
break;
1108+
case 7: // RLIMIT_NOFILE
1109+
if (oldptr != 0x0)
1110+
{
1111+
struct rlimit64 lim{};
1112+
lim.rlim_cur = 4096;
1113+
lim.rlim_max = 4096;
1114+
SYSPRINT("prlimit64: current nofile limit 0x%llX max 0x%llX\n",
1115+
lim.rlim_cur, lim.rlim_max);
1116+
cpu.machine().copy_to_guest(oldptr, &lim, sizeof(lim));
1117+
}
1118+
regs.rax = 0;
1119+
break;
11081120
default:
11091121
regs.rax = -ENOSYS;
11101122
}

0 commit comments

Comments
 (0)