don't bother printing errors about re-enabling coredump failures.
[trinity.git] / regenerate.c
blob128257336c2f380e8c9007a031ea8d9fefdb5d9a
1 #include <unistd.h>
2 #include "files.h"
3 #include "log.h"
4 #include "maps.h"
5 #include "net.h"
6 #include "params.h"
7 #include "random.h"
8 #include "shm.h"
9 #include "trinity.h"
11 static void do_sso_sockets(void)
13 struct sockopt so = { 0, 0, 0, 0 };
14 unsigned int i;
16 for (i = 0; i < nr_sockets; i++) {
17 int fd;
19 fd = shm->sockets[i].fd;
20 sso_socket(&shm->sockets[i].triplet, &so, fd);
24 void regenerate(void)
26 if (no_files == TRUE) /* We don't regenerate sockets */
27 return;
29 /* we're about to exit. */
30 if (shm->spawn_no_more)
31 return;
33 shm->regenerating = TRUE;
35 sleep(1); /* give children time to finish with fds. */
37 shm->regenerate = 0;
39 output(0, "Regenerating random pages, fd's etc.\n");
41 regenerate_fds();
43 /* Do random setsockopts on all network sockets. */
44 do_sso_sockets();
46 destroy_shared_mappings();
47 setup_shared_mappings();
49 generate_random_page(page_rand);
51 shm->regenerating = FALSE;