diff options
author | csjp <csjp@FreeBSD.org> | 2007-10-12 14:58:34 +0000 |
---|---|---|
committer | csjp <csjp@FreeBSD.org> | 2007-10-12 14:58:34 +0000 |
commit | e5337493b3cbc6784fb7bdc552b26c96921ea5df (patch) | |
tree | 8e7c300224e7a5325f085679585ace03dedd8988 /sys | |
parent | dd1d7df604ec28efea00bc1c45e7d5c5d32cc1d3 (diff) | |
download | FreeBSD-src-e5337493b3cbc6784fb7bdc552b26c96921ea5df.zip FreeBSD-src-e5337493b3cbc6784fb7bdc552b26c96921ea5df.tar.gz |
Make sure that we refresh the PID on read(2) and write(2) operations.
This fixes the process portion of the bpf(4) stats if the peer forks
into the background after it's opened the descriptor. This bug
results in the following behavior for netstat -B:
# netstat -B
Pid Netif Flags Recv Drop Match Sblen Hblen Command
netstat: kern.proc.pid failed: No such process
78023 em0 p--s-- 2237404 43119 2237404 13986 0 ??????
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/bpf.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 05682ff..7af9f3c 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -488,6 +488,7 @@ bpfread(struct cdev *dev, struct uio *uio, int ioflag) return (EINVAL); BPFD_LOCK(d); + d->bd_pid = curthread->td_proc->p_pid; if (d->bd_state == BPF_WAITING) callout_stop(&d->bd_callout); timed_out = (d->bd_state == BPF_TIMED_OUT); @@ -616,6 +617,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag) struct sockaddr dst; int error, hlen; + d->bd_pid = curthread->td_proc->p_pid; if (d->bd_bif == NULL) return (ENXIO); |