diff options
Diffstat (limited to 'src/libsystem/proc.c')
-rw-r--r-- | src/libsystem/proc.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/libsystem/proc.c b/src/libsystem/proc.c index 6a3d3df..49ddfde 100644 --- a/src/libsystem/proc.c +++ b/src/libsystem/proc.c @@ -89,7 +89,7 @@ int proc_pid_of(const char *pname) { if (r < 0) continue; - if (strneq(pname, comm, TASK_COMM_LEN-1)) + if (strneq(pname, comm, TASK_COMM_LEN - 1)) return atoi(de->d_name); } @@ -130,9 +130,7 @@ static int add_smap_to_smaps(struct smaps *maps, struct smap *map) { maps->n_map++; - maps->maps = (struct smap **)realloc( - maps->maps, - sizeof(struct smap *) * maps->n_map); + maps->maps = (struct smap **) realloc(maps->maps, sizeof(struct smap *) * maps->n_map); if (!maps->maps) return -ENOMEM; @@ -189,8 +187,7 @@ int proc_pid_get_smaps(pid_t pid, struct smaps **maps, enum smap_mask mask) { goto on_error; } - n = sscanf(buf, "%x-%x %ms %*s %*s %*s %ms", - &map->start, &map->end, &map->mode, &map->name); + n = sscanf(buf, "%x-%x %ms %*s %*s %*s %ms", &map->start, &map->end, &map->mode, &map->name); if (n == 3 && !map->name) map->name = strdup("[anon]"); @@ -214,8 +211,7 @@ int proc_pid_get_smaps(pid_t pid, struct smaps **maps, enum smap_mask mask) { break; } - if ((*buf >= '0' && *buf <= '9') || - (*buf >= 'a' && *buf <= 'f')) { + if ((*buf >= '0' && *buf <= '9') || (*buf >= 'a' && *buf <= 'f')) { get_line = false; break; } @@ -314,8 +310,7 @@ int proc_get_meminfo(struct meminfo *mi, enum meminfo_mask mask) { return -errno; if (remain_mask & MEMINFO_MASK_MEM_AVAILABLE) - remain_mask |= (MEMINFO_MASK_MEM_FREE | - MEMINFO_MASK_CACHED); + remain_mask |= (MEMINFO_MASK_MEM_FREE | MEMINFO_MASK_CACHED); while (remain_mask) { unsigned int v = 0; @@ -350,8 +345,7 @@ int proc_get_meminfo(struct meminfo *mi, enum meminfo_mask mask) { } if (remain_mask & MEMINFO_MASK_MEM_AVAILABLE) { - mi->value[MEMINFO_ID_MEM_AVAILABLE] = - mi->value[MEMINFO_ID_MEM_FREE] + mi->value[MEMINFO_ID_MEM_AVAILABLE] = mi->value[MEMINFO_ID_MEM_FREE] + mi->value[MEMINFO_ID_CACHED]; } |