Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164228116
D58386.id182420.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
944 B
Referenced Files
None
Subscribers
None
D58386.id182420.diff
View Options
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)
{
@@ -221,9 +230,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
Thu, Jul 30, 8:52 PM (2 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35381386
Default Alt Text
D58386.id182420.diff (944 B)
Attached To
Mode
D58386: pwait: Add a SIGINFO handler
Attached
Detach File
Event Timeline
Log In to Comment