blob: b17936d6b600552a1a2dbb95d5d6f3c2aa89de9c (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
*/
/*
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <sys/epoll.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
*/
#include <signal.h>
#include <rte_lcore.h>
#include <rte_power.h>
#include <rte_debug.h>
#include "vm_power_cli_guest.h"
static void
sig_handler(int signo)
{
printf("Received signal %d, exiting...\n", signo);
unsigned lcore_id;
RTE_LCORE_FOREACH(lcore_id) {
rte_power_exit(lcore_id);
}
}
int
main(int argc, char **argv)
{
int ret;
unsigned lcore_id;
ret = rte_eal_init(argc, argv);
if (ret < 0)
rte_panic("Cannot init EAL\n");
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
rte_power_set_env(PM_ENV_KVM_VM);
RTE_LCORE_FOREACH(lcore_id) {
rte_power_init(lcore_id);
}
run_cli(NULL);
return 0;
}
|