Build lmkd as C++
am: 43f3d2b190
Change-Id: I372c6b437070c09952dc4c84863db324d4aad912
This commit is contained in:
commit
9309a1b376
|
|
@ -13,7 +13,7 @@ cc_defaults {
|
||||||
cc_binary {
|
cc_binary {
|
||||||
name: "lmkd",
|
name: "lmkd",
|
||||||
|
|
||||||
srcs: ["lmkd.c"],
|
srcs: ["lmkd.cpp"],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libcutils",
|
"libcutils",
|
||||||
"liblog",
|
"liblog",
|
||||||
|
|
@ -33,7 +33,7 @@ cc_binary {
|
||||||
|
|
||||||
cc_library_static {
|
cc_library_static {
|
||||||
name: "libstatslogc",
|
name: "libstatslogc",
|
||||||
srcs: ["statslog.c"],
|
srcs: ["statslog.cpp"],
|
||||||
cflags: [
|
cflags: [
|
||||||
"-Wall",
|
"-Wall",
|
||||||
"-Werror",
|
"-Werror",
|
||||||
|
|
@ -47,7 +47,7 @@ cc_library_static {
|
||||||
|
|
||||||
cc_library_static {
|
cc_library_static {
|
||||||
name: "liblmkd_utils",
|
name: "liblmkd_utils",
|
||||||
srcs: ["liblmkd_utils.c"],
|
srcs: ["liblmkd_utils.cpp"],
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libcutils",
|
"libcutils",
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ cc_library_headers {
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libpsi",
|
name: "libpsi",
|
||||||
srcs: ["psi.c"],
|
srcs: ["psi.cpp"],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"liblog"
|
"liblog"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,7 @@ static char *reread_file(struct reread_data *data) {
|
||||||
|
|
||||||
if (data->fd == -1) {
|
if (data->fd == -1) {
|
||||||
/* First-time buffer initialization */
|
/* First-time buffer initialization */
|
||||||
if (!buf && (buf = malloc(buf_size)) == NULL) {
|
if (!buf && (buf = static_cast<char*>(malloc(buf_size))) == nullptr) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -626,7 +626,7 @@ static char *reread_file(struct reread_data *data) {
|
||||||
* Since we are reading /proc files we can't use fstat to find out
|
* Since we are reading /proc files we can't use fstat to find out
|
||||||
* the real size of the file. Double the buffer size and keep retrying.
|
* the real size of the file. Double the buffer size and keep retrying.
|
||||||
*/
|
*/
|
||||||
if ((new_buf = realloc(buf, buf_size * 2)) == NULL) {
|
if ((new_buf = static_cast<char*>(realloc(buf, buf_size * 2))) == nullptr) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -818,13 +818,13 @@ static struct proc *pid_lookup(int pid) {
|
||||||
return procp;
|
return procp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adjslot_insert(struct adjslot_list *head, struct adjslot_list *new)
|
static void adjslot_insert(struct adjslot_list *head, struct adjslot_list *new_element)
|
||||||
{
|
{
|
||||||
struct adjslot_list *next = head->next;
|
struct adjslot_list *next = head->next;
|
||||||
new->prev = head;
|
new_element->prev = head;
|
||||||
new->next = next;
|
new_element->next = next;
|
||||||
next->prev = new;
|
next->prev = new_element;
|
||||||
head->next = new;
|
head->next = new_element;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adjslot_remove(struct adjslot_list *old)
|
static void adjslot_remove(struct adjslot_list *old)
|
||||||
|
|
@ -1123,7 +1123,7 @@ static void cmd_procprio(LMKD_CTRL_PACKET packet, int field_count, struct ucred
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
procp = calloc(1, sizeof(struct proc));
|
procp = static_cast<struct proc*>(calloc(1, sizeof(struct proc)));
|
||||||
if (!procp) {
|
if (!procp) {
|
||||||
// Oh, the irony. May need to rebuild our state.
|
// Oh, the irony. May need to rebuild our state.
|
||||||
return;
|
return;
|
||||||
|
|
@ -2415,7 +2415,6 @@ static void mp_event_common(int data, uint32_t events, struct polling_params *po
|
||||||
unsigned long long evcount;
|
unsigned long long evcount;
|
||||||
int64_t mem_usage, memsw_usage;
|
int64_t mem_usage, memsw_usage;
|
||||||
int64_t mem_pressure;
|
int64_t mem_pressure;
|
||||||
enum vmpressure_level lvl;
|
|
||||||
union meminfo mi;
|
union meminfo mi;
|
||||||
struct zoneinfo zi;
|
struct zoneinfo zi;
|
||||||
struct timespec curr_tm;
|
struct timespec curr_tm;
|
||||||
|
|
@ -2443,12 +2442,12 @@ static void mp_event_common(int data, uint32_t events, struct polling_params *po
|
||||||
* and upgrade to the highest priority one. By reading
|
* and upgrade to the highest priority one. By reading
|
||||||
* eventfd we also reset the event counters.
|
* eventfd we also reset the event counters.
|
||||||
*/
|
*/
|
||||||
for (lvl = VMPRESS_LEVEL_LOW; lvl < VMPRESS_LEVEL_COUNT; lvl++) {
|
for (int lvl = VMPRESS_LEVEL_LOW; lvl < VMPRESS_LEVEL_COUNT; lvl++) {
|
||||||
if (mpevfd[lvl] != -1 &&
|
if (mpevfd[lvl] != -1 &&
|
||||||
TEMP_FAILURE_RETRY(read(mpevfd[lvl],
|
TEMP_FAILURE_RETRY(read(mpevfd[lvl],
|
||||||
&evcount, sizeof(evcount))) > 0 &&
|
&evcount, sizeof(evcount))) > 0 &&
|
||||||
evcount > 0 && lvl > level) {
|
evcount > 0 && lvl > level) {
|
||||||
level = lvl;
|
level = static_cast<vmpressure_level>(lvl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -292,7 +292,7 @@ struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t ui
|
||||||
|
|
||||||
static void proc_insert(struct proc* procp) {
|
static void proc_insert(struct proc* procp) {
|
||||||
if (!pidhash) {
|
if (!pidhash) {
|
||||||
pidhash = calloc(PIDHASH_SZ, sizeof(*pidhash));
|
pidhash = static_cast<struct proc**>(calloc(PIDHASH_SZ, sizeof(*pidhash)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int hval = pid_hashfn(procp->pid);
|
int hval = pid_hashfn(procp->pid);
|
||||||
|
|
@ -336,7 +336,7 @@ void stats_store_taskname(int pid, const char* taskname) {
|
||||||
}
|
}
|
||||||
stats_remove_taskname(pid);
|
stats_remove_taskname(pid);
|
||||||
}
|
}
|
||||||
procp = malloc(sizeof(struct proc));
|
procp = static_cast<struct proc*>(malloc(sizeof(struct proc)));
|
||||||
procp->pid = pid;
|
procp->pid = pid;
|
||||||
strncpy(procp->taskname, taskname, LINE_MAX - 1);
|
strncpy(procp->taskname, taskname, LINE_MAX - 1);
|
||||||
procp->taskname[LINE_MAX - 1] = '\0';
|
procp->taskname[LINE_MAX - 1] = '\0';
|
||||||
Loading…
Reference in New Issue