O'Reilly logo

FreeBSD Device Drivers by Joseph Kong

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code Analysis

Example 6-1 provides a terse, source-level overview of nmdm(4).

Example 6-1. nmdm.c

#include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/tty.h> #include <sys/conf.h> #include <sys/eventhandler.h> #include <sys/limits.h> #include <sys/serial.h> #include <sys/malloc.h> #include <sys/queue.h> #include <sys/taskqueue.h> #include <sys/lock.h> #include <sys/mutex.h> MALLOC_DEFINE(M_NMDM, "nullmodem", "nullmodem data structures"); struct nmdm_part { struct tty *np_tty; struct nmdm_part *np_other; struct task np_task; struct callout np_callout; int np_dcd; int np_rate; u_long np_quota; int np_credits; u_long np_accumulator; #define QS 8 /* Quota shift. */ }; struct nmdm_softc { struct ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required