Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163528742
D58386.id182438.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D58386.id182438.diff
View Options
diff --git a/bin/pwait/pwait.1 b/bin/pwait/pwait.1
--- a/bin/pwait/pwait.1
+++ b/bin/pwait/pwait.1
@@ -83,6 +83,18 @@
.Ql timeout
if the timer goes off earlier.
.El
+.Pp
+If
+.Nm
+receives
+.Dv SIGINFO
+(see the
+.Sy status
+argument for
+.Xr stty 1 )
+signal,
+a space-separated list of processes still being waited on is printed
+to the standard error output.
.Sh EXIT STATUS
The
.Nm
@@ -145,6 +157,7 @@
.Xr kill 1 ,
.Xr pkill 1 ,
.Xr ps 1 ,
+.Xr stty 1 ,
.Xr wait 1 ,
.Xr kqueue 2
.Sh NOTES
diff --git a/bin/pwait/pwait.c b/bin/pwait/pwait.c
--- a/bin/pwait/pwait.c
+++ b/bin/pwait/pwait.c
@@ -66,6 +66,15 @@
static struct pidtree pids = RB_INITIALIZER(&pids);
RB_GENERATE_STATIC(pidtree, pid, entry, pidcmp);
+static volatile sig_atomic_t siginfo;
+
+static void
+handler(int signo)
+{
+ if (signo == SIGINFO)
+ siginfo = 1;
+}
+
static void
usage(void)
{
@@ -227,9 +236,21 @@
}
}
ret = EX_OK;
+ signal(SIGINFO, handler);
+ setvbuf(stderr, NULL, _IOLBF, 0);
while ((ndone == 0 || !oflag) && ret == EX_OK && nleft > 0) {
n = kevent(kq, NULL, 0, e, nleft + tflag, NULL);
+ if (siginfo) {
+ p = RB_MIN(pidtree, &pids);
+ fprintf(stderr, "%d", p->pid);
+ while ((p = RB_NEXT(pidtree, &pids, p)) != NULL)
+ fprintf(stderr, " %d", p->pid);
+ fprintf(stderr, "\n");
+ siginfo = 0;
+ }
if (n == -1) {
+ if (errno == EINTR)
+ continue;
err(EX_OSERR, "kevent");
}
for (i = 0; i < n; i++) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 25, 4:26 AM (1 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35422375
Default Alt Text
D58386.id182438.diff (1 KB)
Attached To
Mode
D58386: pwait: Add a SIGINFO handler
Attached
Detach File
Event Timeline
Log In to Comment