Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177634542
D61608.1794904584.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61608.1794904584.diff
View Options
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -3142,15 +3142,26 @@
KQ_UNLOCK(kq1);
}
+enum klist_which {
+ KLIST_FD,
+ KLIST_HASH,
+};
+
+static struct klist *
+kqueue_list(struct kqueue *kq, enum klist_which which, int i)
+{
+ return (which == KLIST_FD ? &kq->kq_knlist[i] : &kq->kq_knhash[i]);
+}
+
static void
-kqueue_fork_copy_list(struct klist *knlist, struct knote *marker,
+kqueue_fork_copy_list(enum klist_which which, int i, struct knote *marker,
struct kqueue *kq, struct kqueue *kq1, struct proc *p1,
struct filedesc *fdp)
{
struct knote *kn;
KQ_OWNED(kq);
- kn = SLIST_FIRST(knlist);
+ kn = SLIST_FIRST(kqueue_list(kq, which, i));
while (kn != NULL) {
MPASS(kn->kn_kq == kq);
if ((kn->kn_status & (KN_DETACHED | KN_MARKER)) != 0 ||
@@ -3166,7 +3177,7 @@
kn_leave_flux(kn);
kn = SLIST_NEXT(marker, kn_link);
/* XXXKIB switch kn_link to LIST? */
- SLIST_REMOVE(knlist, marker, knote, kn_link);
+ SLIST_REMOVE(kqueue_list(kq, which, i), marker, knote, kn_link);
}
}
@@ -3190,13 +3201,12 @@
KQ_LOCK(kq);
for (i = 0; i < kq->kq_knlistsize; i++) {
- kqueue_fork_copy_list(&kq->kq_knlist[i], &marker, kq, kq1,
- p1, fdp);
+ kqueue_fork_copy_list(KLIST_FD, i, &marker, kq, kq1, p1, fdp);
}
if (kq->kq_knhashmask != 0) {
for (i = 0; i <= kq->kq_knhashmask; i++) {
- kqueue_fork_copy_list(&kq->kq_knhash[i], &marker, kq,
- kq1, p1, fdp);
+ kqueue_fork_copy_list(KLIST_HASH, i, &marker, kq, kq1,
+ p1, fdp);
}
}
kqueue_release(kq, 1);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 17, 8:36 AM (3 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41791464
Default Alt Text
D61608.1794904584.diff (1 KB)
Attached To
Mode
D61608: kqueue: Fix a race between kqueue_fork_copy_list() and kqueue_expand()
Attached
Detach File
Event Timeline