Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit 40077f6

Browse files
committed
Merge branch '3764-adjust-descriptors-for-some-unit-tests' into 'main'
Resolve "Adjust descriptor limit for some unit tests" Closes #3764 See merge request isc-projects/bind9!7294
2 parents 5bcfd46 + cdcd605 commit 40077f6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/libtest/isc.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <signal.h>
1818
#include <stdbool.h>
1919
#include <stdlib.h>
20+
#include <sys/resource.h>
2021
#include <time.h>
2122

2223
#include <isc/buffer.h>
@@ -40,6 +41,18 @@ isc_taskmgr_t *taskmgr = NULL;
4041
isc_nm_t *netmgr = NULL;
4142
unsigned int workers = -1;
4243

44+
static void
45+
adjustnofile(void) {
46+
struct rlimit rl;
47+
48+
if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
49+
if (rl.rlim_cur != rl.rlim_max) {
50+
rl.rlim_cur = rl.rlim_max;
51+
setrlimit(RLIMIT_NOFILE, &rl);
52+
}
53+
}
54+
}
55+
4356
int
4457
setup_mctx(void **state __attribute__((__unused__))) {
4558
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
@@ -107,6 +120,8 @@ int
107120
setup_netmgr(void **state __attribute__((__unused__))) {
108121
REQUIRE(loopmgr != NULL);
109122

123+
adjustnofile();
124+
110125
isc_netmgr_create(mctx, loopmgr, &netmgr);
111126

112127
return (0);

0 commit comments

Comments
 (0)