MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cnadd

Function cnadd

freebsd/kern/kern_cons.c:205–234  ·  view source on GitHub ↗

add a new physical console to back the virtual console */

Source from the content-addressed store, hash-verified

203
204/* add a new physical console to back the virtual console */
205int
206cnadd(struct consdev *cn)
207{
208 struct cn_device *cnd;
209 int i;
210
211 STAILQ_FOREACH(cnd, &cn_devlist, cnd_next)
212 if (cnd->cnd_cn == cn)
213 return (0);
214 for (i = 0; i < CNDEVTAB_SIZE; i++) {
215 cnd = &cn_devtab[i];
216 if (cnd->cnd_cn == NULL)
217 break;
218 }
219 if (cnd->cnd_cn != NULL)
220 return (ENOMEM);
221 cnd->cnd_cn = cn;
222 if (cn->cn_name[0] == '\0') {
223 /* XXX: it is unclear if/where this print might output */
224 printf("WARNING: console at %p has no name\n", cn);
225 }
226 STAILQ_INSERT_TAIL(&cn_devlist, cnd, cnd_next);
227 if (STAILQ_FIRST(&cn_devlist) == cnd)
228 ttyconsdev_select(cnd->cnd_cn->cn_name);
229
230 /* Add device to the active mask. */
231 cnavailable(cn, (cn->cn_flags & CN_FLAG_NOAVAIL) == 0);
232
233 return (0);
234}
235
236void
237cnremove(struct consdev *cn)

Callers 3

termcn_cnregisterFunction · 0.85
cninitFunction · 0.85
sysctl_kern_consoleFunction · 0.85

Calls 3

ttyconsdev_selectFunction · 0.85
cnavailableFunction · 0.85
printfFunction · 0.70

Tested by

no test coverage detected