Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167465605
D55053.id170984.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
D55053.id170984.diff
View Options
diff --git a/usr.bin/diff/pr.h b/usr.bin/diff/pr.h
--- a/usr.bin/diff/pr.h
+++ b/usr.bin/diff/pr.h
@@ -28,8 +28,7 @@
struct pr {
int ostdout;
- int kq;
- struct kevent *e;
+ int pidfd;
};
struct pr *start_pr(char *file1, char *file2);
diff --git a/usr.bin/diff/pr.c b/usr.bin/diff/pr.c
--- a/usr.bin/diff/pr.c
+++ b/usr.bin/diff/pr.c
@@ -28,6 +28,7 @@
#include <sys/wait.h>
#include <err.h>
+#include <errno.h>
#include <paths.h>
#include <signal.h>
#include <stdio.h>
@@ -72,7 +73,7 @@
execl(_PATH_PR, _PATH_PR, "-h", header, (char *)0);
_exit(127);
default:
-
+ pr->pidfd = pr_pd;
/* parent */
if (pfd[1] != STDOUT_FILENO) {
pr->ostdout = dup(STDOUT_FILENO);
@@ -82,14 +83,6 @@
close(pfd[0]);
rewind(stdout);
free(header);
- pr->kq = kqueue();
- if (pr->kq == -1)
- err(2, "kqueue");
- pr->e = xmalloc(sizeof(struct kevent));
- EV_SET(pr->e, pr_pd, EVFILT_PROCDESC, EV_ADD, NOTE_EXIT, 0,
- NULL);
- if (kevent(pr->kq, pr->e, 1, NULL, 0, NULL) == -1)
- err(2, "kevent");
}
return (pr);
}
@@ -109,10 +102,10 @@
dup2(pr->ostdout, STDOUT_FILENO);
close(pr->ostdout);
}
- if (kevent(pr->kq, NULL, 0, pr->e, 1, NULL) == -1)
- err(2, "kevent");
- wstatus = pr->e[0].data;
- close(pr->kq);
+ while (pdwait(pr->pidfd, &wstatus, WEXITED, NULL, NULL) == -1) {
+ if (errno != EINTR)
+ err(2, "pdwait");
+ }
free(pr);
if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) != 0)
errx(2, "pr exited abnormally");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 22, 11:11 PM (8 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37113938
Default Alt Text
D55053.id170984.diff (1 KB)
Attached To
Mode
D55053: diff: use pdwait(2) instead of homemade one
Attached
Detach File
Event Timeline
Log In to Comment