Date: Sun, 3 Aug 2008 17:37:19 GMT From: Ed Schouten <ed@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 146544 for review Message-ID: <200808031737.m73HbJO8065922@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=146544 Change 146544 by ed@ed_flippo on 2008/08/03 17:36:53 Add a counter to store the number of null modem devices. Affected files ... .. //depot/projects/mpsafetty/sys/dev/nmdm/nmdm.c#4 edit Differences ... ==== //depot/projects/mpsafetty/sys/dev/nmdm/nmdm.c#4 (text+ko) ==== @@ -93,12 +93,16 @@ struct mtx ns_mtx; }; +static int nmdm_count = 0; + static struct nmdmsoftc * nmdm_alloc(unsigned long unit, struct ucred *cr) { struct nmdmsoftc *ns; struct tty *tp; + atomic_add_acq_int(&nmdm_count, 1); + ns = malloc(sizeof(*ns), M_NMDM, M_WAITOK|M_ZERO); mtx_init(&ns->ns_mtx, "nmdm", NULL, MTX_DEF); @@ -344,8 +348,9 @@ break; case MOD_UNLOAD: + if (nmdm_count != 0) + return (EBUSY); EVENTHANDLER_DEREGISTER(dev_clone, tag); - /* XXX: track counter! */ break; default:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808031737.m73HbJO8065922>