mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-03 22:08:25 -04:00
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
This commit is contained in:
commit
40077f6f75
1 changed files with 15 additions and 0 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/resource.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
|
|
@ -40,6 +41,18 @@ isc_taskmgr_t *taskmgr = NULL;
|
|||
isc_nm_t *netmgr = NULL;
|
||||
unsigned int workers = -1;
|
||||
|
||||
static void
|
||||
adjustnofile(void) {
|
||||
struct rlimit rl;
|
||||
|
||||
if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
|
||||
if (rl.rlim_cur != rl.rlim_max) {
|
||||
rl.rlim_cur = rl.rlim_max;
|
||||
setrlimit(RLIMIT_NOFILE, &rl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
setup_mctx(void **state __attribute__((__unused__))) {
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
|
|
@ -107,6 +120,8 @@ int
|
|||
setup_netmgr(void **state __attribute__((__unused__))) {
|
||||
REQUIRE(loopmgr != NULL);
|
||||
|
||||
adjustnofile();
|
||||
|
||||
isc_netmgr_create(mctx, loopmgr, &netmgr);
|
||||
|
||||
return (0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue