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 * $FreeBSD: head/sys/net/bpf.c 66067 2000-09-19 10:28:44Z phk $
41 */
42
43#include "bpf.h"
44
45#ifndef __GNUC__
46#define inline
47#else
48#define inline __inline
--- 309 unchanged lines hidden (view full) ---
358
359 d = dev->si_drv1;
360 /*
361 * Each minor can be opened by only one process. If the requested
362 * minor is in use, return EBUSY.
363 */
364 if (d)
365 return (EBUSY);
366 make_dev(&bpf_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600,
367 "bpf%d", dev2unit(dev));
368 MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK);
369 bzero(d, sizeof(*d));
370 dev->si_drv1 = d;
371 d->bd_bufsize = bpf_bufsize;
372 d->bd_sig = SIGIO;
373 d->bd_seesent = 1;
374
375 return (0);
--- 997 unchanged lines hidden (view full) ---
1373 dev_t *dev;
1374{
1375 int u;
1376
1377 if (*dev != NODEV)
1378 return;
1379 if (dev_stdclone(name, NULL, "bpf", &u) != 1)
1380 return;
1381 *dev = make_dev(&bpf_cdevsw, unit2minor(u), UID_ROOT, GID_WHEEL, 0600,
1382 "bpf%d", u);
1383 (*dev)->si_flags |= SI_CHEAPCLONE;
1384 return;
1385}
1386
1387static void
1388bpf_drvinit(unused)
1389 void *unused;
1390{
1391
--- 53 unchanged lines hidden ---
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 * $FreeBSD: head/sys/net/bpf.c 66067 2000-09-19 10:28:44Z phk $
41 */
42
43#include "bpf.h"
44
45#ifndef __GNUC__
46#define inline
47#else
48#define inline __inline
--- 309 unchanged lines hidden (view full) ---
358
359 d = dev->si_drv1;
360 /*
361 * Each minor can be opened by only one process. If the requested
362 * minor is in use, return EBUSY.
363 */
364 if (d)
365 return (EBUSY);
366 make_dev(&bpf_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600,
367 "bpf%d", dev2unit(dev));
368 MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK);
369 bzero(d, sizeof(*d));
370 dev->si_drv1 = d;
371 d->bd_bufsize = bpf_bufsize;
372 d->bd_sig = SIGIO;
373 d->bd_seesent = 1;
374
375 return (0);
--- 997 unchanged lines hidden (view full) ---
1373 dev_t *dev;
1374{
1375 int u;
1376
1377 if (*dev != NODEV)
1378 return;
1379 if (dev_stdclone(name, NULL, "bpf", &u) != 1)
1380 return;
1381 *dev = make_dev(&bpf_cdevsw, unit2minor(u), UID_ROOT, GID_WHEEL, 0600,
1382 "bpf%d", u);
1383 (*dev)->si_flags |= SI_CHEAPCLONE;
1384 return;
1385}
1386
1387static void
1388bpf_drvinit(unused)
1389 void *unused;
1390{
1391
--- 53 unchanged lines hidden ---