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

Function ttyconsdev_open

freebsd/kern/tty.c:2174–2198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2172 */
2173
2174static int
2175ttyconsdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
2176{
2177 struct tty *tp;
2178
2179 /* System has no console device. */
2180 if (dev_console_filename == NULL)
2181 return (ENXIO);
2182
2183 /* Look up corresponding TTY by device name. */
2184 sx_slock(&tty_list_sx);
2185 TAILQ_FOREACH(tp, &tty_list, t_list) {
2186 if (strcmp(dev_console_filename, tty_devname(tp)) == 0) {
2187 dev_console->si_drv1 = tp;
2188 break;
2189 }
2190 }
2191 sx_sunlock(&tty_list_sx);
2192
2193 /* System console has no TTY associated. */
2194 if (dev_console->si_drv1 == NULL)
2195 return (ENXIO);
2196
2197 return (ttydev_open(dev, oflags, devtype, td));
2198}
2199
2200static int
2201ttyconsdev_write(struct cdev *dev, struct uio *uio, int ioflag)

Callers

nothing calls this directly

Calls 2

strcmpFunction · 0.85
ttydev_openFunction · 0.85

Tested by

no test coverage detected