Deleted Added
full compact
bpf.c (40049) bpf.c (41086)
1/*
2 * Copyright (c) 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from the Stanford/CMU enet packet filter,
6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed
7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
8 * Berkeley Laboratory.

--- 23 unchanged lines hidden (view full) ---

32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)bpf.c 8.2 (Berkeley) 3/28/94
39 *
1/*
2 * Copyright (c) 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from the Stanford/CMU enet packet filter,
6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed
7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
8 * Berkeley Laboratory.

--- 23 unchanged lines hidden (view full) ---

32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)bpf.c 8.2 (Berkeley) 3/28/94
39 *
40 * $Id: bpf.c,v 1.43 1998/10/04 23:04:48 alex Exp $
40 * $Id: bpf.c,v 1.44 1998/10/08 00:32:08 alex Exp $
41 */
42
43#include "bpfilter.h"
44
45#if NBPFILTER > 0
46
47#ifndef __GNUC__
48#define inline

--- 7 unchanged lines hidden (view full) ---

56#include <sys/malloc.h>
57#include <sys/mbuf.h>
58#include <sys/time.h>
59#include <sys/proc.h>
60#include <sys/signalvar.h>
61#include <sys/filio.h>
62#include <sys/sockio.h>
63#include <sys/ttycom.h>
41 */
42
43#include "bpfilter.h"
44
45#if NBPFILTER > 0
46
47#ifndef __GNUC__
48#define inline

--- 7 unchanged lines hidden (view full) ---

56#include <sys/malloc.h>
57#include <sys/mbuf.h>
58#include <sys/time.h>
59#include <sys/proc.h>
60#include <sys/signalvar.h>
61#include <sys/filio.h>
62#include <sys/sockio.h>
63#include <sys/ttycom.h>
64#include <sys/filedesc.h>
64
65#if defined(sparc) && BSD < 199103
66#include <sys/stream.h>
67#endif
68#include <sys/poll.h>
69
70#include <sys/socket.h>
71#include <sys/vnode.h>

--- 302 unchanged lines hidden (view full) ---

374 dev_t dev;
375 int flags;
376 int fmt;
377 struct proc *p;
378{
379 register struct bpf_d *d = &bpf_dtab[minor(dev)];
380 register int s;
381
65
66#if defined(sparc) && BSD < 199103
67#include <sys/stream.h>
68#endif
69#include <sys/poll.h>
70
71#include <sys/socket.h>
72#include <sys/vnode.h>

--- 302 unchanged lines hidden (view full) ---

375 dev_t dev;
376 int flags;
377 int fmt;
378 struct proc *p;
379{
380 register struct bpf_d *d = &bpf_dtab[minor(dev)];
381 register int s;
382
383 funsetown(d->bd_sigio);
382 s = splimp();
383 if (d->bd_bif)
384 bpf_detachd(d);
385 splx(s);
386 bpf_freed(d);
387
388 return (0);
389}

--- 142 unchanged lines hidden (view full) ---

532 */
533static inline void
534bpf_wakeup(d)
535 register struct bpf_d *d;
536{
537 struct proc *p;
538
539 wakeup((caddr_t)d);
384 s = splimp();
385 if (d->bd_bif)
386 bpf_detachd(d);
387 splx(s);
388 bpf_freed(d);
389
390 return (0);
391}

--- 142 unchanged lines hidden (view full) ---

534 */
535static inline void
536bpf_wakeup(d)
537 register struct bpf_d *d;
538{
539 struct proc *p;
540
541 wakeup((caddr_t)d);
540 if (d->bd_async && d->bd_sig)
541 if (d->bd_pgid > 0)
542 gsignal (d->bd_pgid, d->bd_sig);
543 else if (p = pfind (-d->bd_pgid))
544 psignal (p, d->bd_sig);
542 if (d->bd_async && d->bd_sig && d->bd_sigio)
543 pgsigio(d->bd_sigio, d->bd_sig, 0);
545
546#if BSD >= 199103
547 selwakeup(&d->bd_sel);
548 /* XXX */
549 d->bd_sel.si_pid = 0;
550#else
551 if (d->bd_selproc) {
552 selwakeup(d->bd_selproc, (int)d->bd_selcoll);

--- 276 unchanged lines hidden (view full) ---

829
830 case FIONBIO: /* Non-blocking I/O */
831 break;
832
833 case FIOASYNC: /* Send signal on receive packets */
834 d->bd_async = *(int *)addr;
835 break;
836
544
545#if BSD >= 199103
546 selwakeup(&d->bd_sel);
547 /* XXX */
548 d->bd_sel.si_pid = 0;
549#else
550 if (d->bd_selproc) {
551 selwakeup(d->bd_selproc, (int)d->bd_selcoll);

--- 276 unchanged lines hidden (view full) ---

828
829 case FIONBIO: /* Non-blocking I/O */
830 break;
831
832 case FIOASYNC: /* Send signal on receive packets */
833 d->bd_async = *(int *)addr;
834 break;
835
837/* N.B. ioctl (FIOSETOWN) and fcntl (F_SETOWN) both end up doing the
838 equivalent of a TIOCSPGRP and hence end up here. *However* TIOCSPGRP's arg
839 is a process group if it's positive and a process id if it's negative. This
840 is exactly the opposite of what the other two functions want! Therefore
841 there is code in ioctl and fcntl to negate the arg before calling here. */
836 case FIOSETOWN:
837 error = fsetown(*(int *)addr, &d->bd_sigio);
838 break;
842
839
843 case TIOCSPGRP: /* Process or group to send signals to */
844 d->bd_pgid = *(int *)addr;
840 case FIOGETOWN:
841 *(int *)addr = fgetown(d->bd_sigio);
845 break;
846
842 break;
843
844 /* This is deprecated, FIOSETOWN should be used instead. */
845 case TIOCSPGRP:
846 error = fsetown(-(*(int *)addr), &d->bd_sigio);
847 break;
848
849 /* This is deprecated, FIOGETOWN should be used instead. */
847 case TIOCGPGRP:
850 case TIOCGPGRP:
848 *(int *)addr = d->bd_pgid;
851 *(int *)addr = -fgetown(d->bd_sigio);
849 break;
850
851 case BIOCSRSIG: /* Set receive signal */
852 {
853 u_int sig;
854
855 sig = *(u_int *)addr;
856

--- 455 unchanged lines hidden ---
852 break;
853
854 case BIOCSRSIG: /* Set receive signal */
855 {
856 u_int sig;
857
858 sig = *(u_int *)addr;
859

--- 455 unchanged lines hidden ---