Merging in 2.0.2.
This commit is contained in:
@@ -49,11 +49,6 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
#include <time.h>
|
||||
#include <test161/test161.h>
|
||||
|
||||
#define TEST_DURATION 10
|
||||
#define LOCAL_SUCCESS "SUCCESS"
|
||||
|
||||
static volatile int pid;
|
||||
|
||||
@@ -62,40 +57,8 @@ main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
time_t start_time_s, time_now_s;
|
||||
unsigned long start_time_ns, time_now_ns;
|
||||
__time(&start_time_s, &start_time_ns);
|
||||
int parent_pid = getpid();
|
||||
int did_print = 0;
|
||||
int iters = 0;
|
||||
|
||||
// Do not remove!
|
||||
// We need to cause page faults on the static secprintf buffers so the
|
||||
// pages are available when we print success. With on-demand page allocation,
|
||||
// we will probably be out of pages by the time we try to print success.
|
||||
secprintf(SECRET, "!!< Starting Forkbbbboooommmmbbbb >!!", "/testbin/forkbomb");
|
||||
|
||||
// And now for the success string
|
||||
printf("This should print %s after 10s\n", LOCAL_SUCCESS);
|
||||
|
||||
while (1) {
|
||||
fork();
|
||||
// Only parent gets to print
|
||||
if(getpid() == parent_pid) {
|
||||
TEST161_LPROGRESS(0);
|
||||
if (iters > 0 && iters % 20 == 0) {
|
||||
putchar('\n');
|
||||
}
|
||||
iters++;
|
||||
|
||||
__time(&time_now_s, &time_now_ns);
|
||||
if (time_now_s - start_time_s > TEST_DURATION && !did_print) {
|
||||
did_print = 1;
|
||||
// We need to print this using secprintf so that it uses
|
||||
// the same page we warmed up earlier.
|
||||
secprintf(SECRET, LOCAL_SUCCESS, "/testbin/forkbomb");
|
||||
}
|
||||
}
|
||||
|
||||
pid = getpid();
|
||||
|
||||
|
Reference in New Issue
Block a user