Prevent swapping by locking procress's virtual address space into RAM
This commit is contained in:
parent
9f3e6f8659
commit
96a61cbac3
6
uvrrpd.c
6
uvrrpd.c
|
@ -24,6 +24,7 @@
|
|||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "uvrrpd.h"
|
||||
#include "vrrp.h"
|
||||
|
@ -125,6 +126,9 @@ int main(int argc, char *argv[])
|
|||
/* pidfile */
|
||||
pidfile(vrrp.vrid);
|
||||
|
||||
/* lock procress's virtual address space into RAM */
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
|
||||
/* process */
|
||||
set_bit(KEEP_GOING, ®);
|
||||
while (test_bit(KEEP_GOING, ®) && !vrrp_process(&vrrp, &vnet));
|
||||
|
@ -148,6 +152,8 @@ int main(int argc, char *argv[])
|
|||
ctrlfile_unlink();
|
||||
free(pidfile_name);
|
||||
|
||||
munlockall();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue