git: c1e5a7fdad63 - main - ps(1): find_varentry() to take a name instead of a VAR
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 28 Apr 2025 12:23:23 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=c1e5a7fdad631458768fc45a82b4d43bade8d0c8
commit c1e5a7fdad631458768fc45a82b4d43bade8d0c8
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-02-28 09:25:31 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-04-28 11:56:27 +0000
ps(1): find_varentry() to take a name instead of a VAR
The only information that find_varentry() needs and uses is
a keyword/var name. The rest of the fields in the passed VAR are
unused.
Changing its signature will ease introducing new calls to
find_varentry() in subsequent commits, as there no VAR object will exist
to be passed but just a name.
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49609
---
bin/ps/extern.h | 2 +-
bin/ps/keyword.c | 2 +-
bin/ps/ps.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bin/ps/extern.h b/bin/ps/extern.h
index 48c452aeb844..45b5969f3911 100644
--- a/bin/ps/extern.h
+++ b/bin/ps/extern.h
@@ -50,7 +50,7 @@ int donlist(void);
char *elapsed(KINFO *, VARENT *);
char *elapseds(KINFO *, VARENT *);
char *emulname(KINFO *, VARENT *);
-VARENT *find_varentry(VAR *);
+VARENT *find_varentry(const char *);
const char *fmt_argv(char **, char *, char *, size_t);
double getpcpu(const KINFO *);
char *jailname(KINFO *, VARENT *);
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 72fe9e183aac..59011c906175 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -287,7 +287,7 @@ parsefmt(const char *p, struct velisthead *const var_list,
* get on with our lives if this VAR is already
* represented in the list.
*/
- vent = find_varentry(v);
+ vent = find_varentry(v->name);
if (vent != NULL)
continue;
}
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index a5ae43b7fad1..2a94b4c37f31 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1180,12 +1180,12 @@ init_list(struct listinfo *inf, addelem_rtn artn, int elemsize,
}
VARENT *
-find_varentry(VAR *v)
+find_varentry(const char *name)
{
struct varent *vent;
STAILQ_FOREACH(vent, &varlist, next_ve) {
- if (strcmp(vent->var->name, v->name) == 0)
+ if (strcmp(vent->var->name, name) == 0)
return vent;
}
return NULL;