The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=4e06e622b1070b618ecb37afa5ba5876f913a682
commit 4e06e622b1070b618ecb37afa5ba5876f913a682 Author: Bryan Drewery <[email protected]> AuthorDate: 2025-10-10 18:00:35 +0000 Commit: Dag-Erling Smørgrav <[email protected]> CommitDate: 2025-10-30 10:38:18 +0000 pwait: Avoid calling getpid(2) for each proc. (cherry picked from commit ab4abce6c2c2091a3b9ea1f38cbef94ee7a68090) --- bin/pwait/pwait.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/pwait/pwait.c b/bin/pwait/pwait.c index b402328849ef..b2fea04c1b72 100644 --- a/bin/pwait/pwait.c +++ b/bin/pwait/pwait.c @@ -65,6 +65,7 @@ main(int argc, char *argv[]) char *end, *s; double timeout; long pid; + pid_t mypid; int i, kq, n, nleft, opt, status; bool oflag, tflag, verbose; @@ -138,6 +139,7 @@ main(int argc, char *argv[]) err(EX_OSERR, "malloc"); } nleft = 0; + mypid = getpid(); for (n = 0; n < argc; n++) { s = argv[n]; /* Undocumented Solaris compat */ @@ -150,7 +152,7 @@ main(int argc, char *argv[]) warnx("%s: bad process id", s); continue; } - if (pid == getpid()) { + if (pid == mypid) { warnx("%s: skipping my own pid", s); continue; }
