|
From: Nicholas N. <nj...@ca...> - 2004-02-15 15:36:02
|
CVS commit by nethercote:
This patch fixes getrlimit(RLIMIT_FILENO) to return VG_(max_fd) as the soft
limit for file descriptors to try and prevent the target programming realising
that the reserved file descriptors exist. It also appears to fix
sysconf(_SC_OPEN_MAX) so that must be going through the same system call.
M +3 -0 coregrind/vg_syscalls.c 1.86
M +3 -1 none/tests/Makefile.am 1.25
--- valgrind/coregrind/vg_syscalls.c #1.85:1.86
@@ -2488,4 +2488,7 @@ POST(getrlimit)
if (res == 0)
VG_TRACK( post_mem_write, arg2, sizeof(struct rlimit) );
+
+ if (res == 0 && arg1 == VKI_RLIMIT_NOFILE)
+ ((struct rlimit *)arg2)->rlim_cur = VG_(max_fd);
}
--- valgrind/none/tests/Makefile.am #1.24:1.25
@@ -8,4 +8,5 @@
bt_literal.stderr.exp bt_literal.stdout.exp \
bt_literal.vgtest \
+ closeall.stderr.exp closeall.vgtest \
coolo_sigaction.stderr.exp \
coolo_sigaction.stdout.exp coolo_sigaction.vgtest \
@@ -53,5 +54,5 @@
check_PROGRAMS = \
- args bitfield1 bt_everything bt_literal coolo_strlen \
+ args bitfield1 bt_everything bt_literal closeall coolo_strlen \
cpuid dastest discard exec-sigmask floored fork fpu_lazy_eflags \
fucomip insn_basic insn_cmov insn_mmx insn_mmxext insn_sse insn_sse2 \
@@ -70,4 +71,5 @@
bt_everything_SOURCES = bt_everything.c
bt_literal_SOURCES = bt_literal.c
+closeall_SOURCES = closeall.c
cpuid_SOURCES = cpuid_c.c cpuid_s.s
coolo_strlen_SOURCES = coolo_strlen.c
|