aboutsummaryrefslogtreecommitdiff
path: root/lib/libprocstat
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2025-03-15 00:28:07 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2025-03-24 02:24:14 +0000
commitba2fb6b367fd513ea5812a496254d3a05ec380b8 (patch)
tree43647bde19500cfbf968ee692f69f4eaf7d4fcde /lib/libprocstat
parentfe8ece34b446e92218a283ce5a7754784b6c53c1 (diff)
Diffstat (limited to 'lib/libprocstat')
-rw-r--r--lib/libprocstat/core.c60
-rw-r--r--lib/libprocstat/core.h2
2 files changed, 49 insertions, 13 deletions
diff --git a/lib/libprocstat/core.c b/lib/libprocstat/core.c
index c02ab9511af7..83aabc50cc30 100644
--- a/lib/libprocstat/core.c
+++ b/lib/libprocstat/core.c
@@ -61,18 +61,54 @@ static struct psc_type_info {
unsigned int n_type;
int structsize;
} psc_type_info[PSC_TYPE_MAX] = {
- { .n_type = NT_PROCSTAT_PROC, .structsize = sizeof(struct kinfo_proc) },
- { .n_type = NT_PROCSTAT_FILES, .structsize = sizeof(struct kinfo_file) },
- { .n_type = NT_PROCSTAT_VMMAP, .structsize = sizeof(struct kinfo_vmentry) },
- { .n_type = NT_PROCSTAT_GROUPS, .structsize = sizeof(gid_t) },
- { .n_type = NT_PROCSTAT_UMASK, .structsize = sizeof(u_short) },
- { .n_type = NT_PROCSTAT_RLIMIT, .structsize = sizeof(struct rlimit) * RLIM_NLIMITS },
- { .n_type = NT_PROCSTAT_OSREL, .structsize = sizeof(int) },
- { .n_type = NT_PROCSTAT_PSSTRINGS, .structsize = sizeof(vm_offset_t) },
- { .n_type = NT_PROCSTAT_PSSTRINGS, .structsize = sizeof(vm_offset_t) },
- { .n_type = NT_PROCSTAT_PSSTRINGS, .structsize = sizeof(vm_offset_t) },
- { .n_type = NT_PROCSTAT_AUXV, .structsize = sizeof(Elf_Auxinfo) },
- { .n_type = NT_PTLWPINFO, .structsize = sizeof(struct ptrace_lwpinfo) },
+ [PSC_TYPE_PROC] = {
+ .n_type = NT_PROCSTAT_PROC,
+ .structsize = sizeof(struct kinfo_proc)
+ },
+ [PSC_TYPE_FILES] = {
+ .n_type = NT_PROCSTAT_FILES,
+ .structsize = sizeof(struct kinfo_file)
+ },
+ [PSC_TYPE_VMMAP] = {
+ .n_type = NT_PROCSTAT_VMMAP,
+ .structsize = sizeof(struct kinfo_vmentry)
+ },
+ [PSC_TYPE_GROUPS] = {
+ .n_type = NT_PROCSTAT_GROUPS,
+ .structsize = sizeof(gid_t)
+ },
+ [PSC_TYPE_UMASK] = {
+ .n_type = NT_PROCSTAT_UMASK,
+ .structsize = sizeof(u_short)
+ },
+ [PSC_TYPE_RLIMIT] = {
+ .n_type = NT_PROCSTAT_RLIMIT,
+ .structsize = sizeof(struct rlimit) * RLIM_NLIMITS
+ },
+ [PSC_TYPE_OSREL] = {
+ .n_type = NT_PROCSTAT_OSREL,
+ .structsize = sizeof(int)
+ },
+ [PSC_TYPE_PSSTRINGS] = {
+ .n_type = NT_PROCSTAT_PSSTRINGS,
+ .structsize = sizeof(vm_offset_t)
+ },
+ [PSC_TYPE_ARGV] = {
+ .n_type = NT_PROCSTAT_PSSTRINGS,
+ .structsize = sizeof(vm_offset_t)
+ },
+ [PSC_TYPE_ENVV] = {
+ .n_type = NT_PROCSTAT_PSSTRINGS,
+ .structsize = sizeof(vm_offset_t)
+ },
+ [PSC_TYPE_AUXV] = {
+ .n_type = NT_PROCSTAT_AUXV,
+ .structsize = sizeof(Elf_Auxinfo)
+ },
+ [PSC_TYPE_PTLWPINFO] = {
+ .n_type = NT_PTLWPINFO,
+ .structsize = sizeof(struct ptrace_lwpinfo)
+ },
};
static bool core_offset(struct procstat_core *core, off_t offset);
diff --git a/lib/libprocstat/core.h b/lib/libprocstat/core.h
index d6cb60dc9e25..8f6aa40192da 100644
--- a/lib/libprocstat/core.h
+++ b/lib/libprocstat/core.h
@@ -31,7 +31,7 @@
#define _CORE_H
enum psc_type {
- PSC_TYPE_PROC,
+ PSC_TYPE_PROC = 0,
PSC_TYPE_FILES,
PSC_TYPE_VMMAP,
PSC_TYPE_GROUPS,