History log of /freebsd-current/bin/pwait/pwait.c
Revision Date Author Comments
# e043f372 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# bbff3a72 21-Jan-2021 Alexander V. Chernikov <melifaro@FreeBSD.org>

Fix typo in pwait.c introduced in 5bdce6ff546e

Reported by: kevans


# 5bdce6ff 21-Jan-2021 Alexander V. Chernikov <melifaro@FreeBSD.org>

Remove deadlock in rc caused by pwait waiting for itself.

The following situation can trigger the deadlock:
1) Long time ago a_service was started through rc.d
2) We want to restart a_service and issue service a_service restart
3) rc.subr reads current process PID (via file or process),
sends TERM signal and runs pwait with PID harvested
4) a_service process dies very quickly so it's PID becomes available.
It is possible that while original process was running,
PID counter overflowed and pwait got assigned a_service's PID.

This patch ignores pid(s) to wait that are equal to pwait PID.

Reported by: Dan McGregor, Boris Lytochkin
Submitted by: Boris Lytochkin <lytboris at gmail.com>
Reviewed By: 0mp
MFC after: 2 weeks
PR: 218598
Differential Revision: https://reviews.freebsd.org/D28240


# 778ac8d3 02-Feb-2020 Xin LI <delphij@FreeBSD.org>

Remove unused include.

MFC after: 2 weeks


# d731a314 01-Feb-2020 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Restore previous usage presentation (without "pwait: " prefix).

Pointed out by: jilles


# 96773547 26-Jan-2020 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Style changes, mostly usage of braces around single line statements -
it is safer and allowed for some time now by style(9).

Sponsored by: Fudo Security


# 2362bc2c 26-Jan-2020 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Implement -o flag which tells pwait(1) to exit if any of the given processes
has terminated.

Sponsored by: Fudo Security


# 5e2e2222 26-Jan-2020 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Don't setup a timeout if we are exiting.

Sponsored by: Fudo Security


# 3f50bbaf 26-Jan-2020 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Check for duplicated PID without using additional variable.

Sponsored by: Fudo Security


# 532b3f47 26-Jan-2020 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Be consistent with using sysexits(3) codes.
- Turn fprintf()+exit() into errx().

Sponsored by: Fudo Security


# b06b52ba 07-Mar-2017 Bryan Drewery <bdrewery@FreeBSD.org>

pwait: Add a -t flag to specify a timeout before exiting, and tests.

The exit status will be 124, as the timeout(1) utility uses.

Reviewed by: jilles
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9697


# f3de285b 16-Jan-2013 Xin LI <delphij@FreeBSD.org>

Use a different way to silence clang analyzer as done in r245494 by
explicitly telling the compiler that we are on the exit route.

X-MFC: together with r245494


# 28e46575 15-Jan-2013 Eitan Adler <eadler@FreeBSD.org>

Free memory before exiting in order to silence a warning from the clang
static analyzer

Approved by: cperciva
MFC after: 3 days


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 7a8c2427 23-Dec-2009 Jilles Tjoelker <jilles@FreeBSD.org>

MFC r199458: Add pwait utility, which waits for any process to terminate.

This is similar to the Solaris utility of the same name.

Some use cases:
* rc.subr's wait_for_pids
* interactive use, e.g. to shut down the computer when some task is done
even if the task is already running


# 0e5e4167 17-Nov-2009 Jilles Tjoelker <jilles@FreeBSD.org>

Add pwait utility, which waits for any process to terminate.

This is similar to the Solaris utility of the same name.

Some use cases:
* rc.subr's wait_for_pids
* interactive use, e.g. to shut down the computer when some task is done
even if the task is already running

Discussed on: hackers@