summaryrefslogtreecommitdiff
path: root/chip/host/reboot.c
blob: c6eb83ce30610a2d37aa57688ca5db63694969c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Emulator self-reboot procedure */

#include <string.h>
#include <unistd.h>

#include "console.h"
#include "host_test.h"
#include "reboot.h"
#include "test_util.h"

#ifdef TEST_FUZZ
/* reboot breaks fuzzing, let's just not do it. */
void emulator_reboot(void)
{
	ccprints("Emulator would reboot here. Fuzzing: doing nothing.");
}
#else /* !TEST_FUZZ */
__attribute__((noreturn))
void emulator_reboot(void)
{
	char *argv[] = {strdup(__get_prog_name()), NULL};
	emulator_flush();
	execv(__get_prog_name(), argv);
	while (1)
		;
}
#endif /* !TEST_FUZZ */