Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 May 2025 19:51:31 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 2a9ebb5da226 - stable/14 - ps(1): find_varentry() to take a name instead of a VAR
Message-ID:  <202505011951.541JpVOh067276@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=2a9ebb5da2263958474b75187895520627b37335

commit 2a9ebb5da2263958474b75187895520627b37335
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-02-28 09:25:31 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-05-01 19:37:02 +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
    
    (cherry picked from commit c1e5a7fdad631458768fc45a82b4d43bade8d0c8)
---
 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 45485c77732e..94140f26d435 100644
--- a/bin/ps/extern.h
+++ b/bin/ps/extern.h
@@ -52,7 +52,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 9b733e0416ba..21330ed9e2ac 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -293,7 +293,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 deb24c4785cb..14dea797a7f7 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1205,12 +1205,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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505011951.541JpVOh067276>