From 2423585b1de50dd2daea8478318e94ff80e0e6ec Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 19 Jul 2021 15:03:38 +0100 Subject: [PATCH] bin/ps: Avoid function name conflict with libc uname() This prevents ps from being built with address sanitizer instrumentation. Reviewed By: trasz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31048 --- bin/ps/extern.h | 2 +- bin/ps/keyword.c | 2 +- bin/ps/print.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ps/extern.h b/bin/ps/extern.h index 723d7fcb85dd..ea4362eeadd9 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -86,7 +86,7 @@ char *tdev(KINFO *, VARENT *); char *tdnam(KINFO *, VARENT *); char *tname(KINFO *, VARENT *); char *ucomm(KINFO *, VARENT *); -char *uname(KINFO *, VARENT *); +char *username(KINFO *, VARENT *); char *upr(KINFO *, VARENT *); char *usertime(KINFO *, VARENT *); char *vsize(KINFO *, VARENT *); diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 2a8382a2273e..e78cf984e455 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -222,7 +222,7 @@ static VAR var[] = { {"upr", "UPR", NULL, "user-priority", 0, upr, 0, CHAR, NULL, 0}, {"uprocp", "UPROCP", NULL, "process-address", 0, kvar, KOFF(ki_paddr), KPTR, "lx", 0}, - {"user", "USER", NULL, "user", LJUST, uname, 0, CHAR, NULL, 0}, + {"user", "USER", NULL, "user", LJUST, username, 0, CHAR, NULL, 0}, {"usertime", "USERTIME", NULL, "user-time", USER, usertime, 0, CHAR, NULL, 0}, {"usrpri", "", "upr", NULL, 0, NULL, 0, CHAR, NULL, 0}, diff --git a/bin/ps/print.c b/bin/ps/print.c index 3d3a543c8a5d..2b61c6b0a15a 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -311,7 +311,7 @@ upr(KINFO *k, VARENT *ve __unused) #undef scalepri char * -uname(KINFO *k, VARENT *ve __unused) +username(KINFO *k, VARENT *ve __unused) { return (strdup(user_from_uid(k->ki_p->ki_uid, 0)));