summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>2001-06-15 20:45:01 +0000
committerjlemon <jlemon@FreeBSD.org>2001-06-15 20:45:01 +0000
commit0dbb10c226d48483c1c1c5d69068245f9f0a7e0d (patch)
treebc317f33e76daa22eb942c87dd623d71015f15c4 /sys/kern/sys_pipe.c
parentfc8bd4c1c0e394cc91cafe4d7f5168b7ad06ea59 (diff)
downloadFreeBSD-src-0dbb10c226d48483c1c1c5d69068245f9f0a7e0d.zip
FreeBSD-src-0dbb10c226d48483c1c1c5d69068245f9f0a7e0d.tar.gz
Correctly hook up the write kqfilter to pipes.
Submitted by: Niels Provos <provos@citi.umich.edu>
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 6c0e17e..4136532 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1242,7 +1242,7 @@ pipeclose(cpipe)
static int
pipe_kqfilter(struct file *fp, struct knote *kn)
{
- struct pipe *rpipe = (struct pipe *)kn->kn_fp->f_data;
+ struct pipe *cpipe = (struct pipe *)kn->kn_fp->f_data;
switch (kn->kn_filter) {
case EVFILT_READ:
@@ -1250,21 +1250,23 @@ pipe_kqfilter(struct file *fp, struct knote *kn)
break;
case EVFILT_WRITE:
kn->kn_fop = &pipe_wfiltops;
+ cpipe = cpipe->pipe_peer;
break;
default:
return (1);
}
-
- SLIST_INSERT_HEAD(&rpipe->pipe_sel.si_note, kn, kn_selnext);
+ kn->kn_hook = (caddr_t)cpipe;
+
+ SLIST_INSERT_HEAD(&cpipe->pipe_sel.si_note, kn, kn_selnext);
return (0);
}
static void
filt_pipedetach(struct knote *kn)
{
- struct pipe *rpipe = (struct pipe *)kn->kn_fp->f_data;
+ struct pipe *cpipe = (struct pipe *)kn->kn_hook;
- SLIST_REMOVE(&rpipe->pipe_sel.si_note, kn, knote, kn_selnext);
+ SLIST_REMOVE(&cpipe->pipe_sel.si_note, kn, knote, kn_selnext);
}
/*ARGSUSED*/
OpenPOWER on IntegriCloud