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

Function ctty_clone

freebsd/kern/tty_tty.c:60–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60static void
61ctty_clone(void *arg, struct ucred *cred, char *name, int namelen,
62 struct cdev **dev)
63{
64 struct proc *p;
65
66 if (*dev != NULL)
67 return;
68 if (strcmp(name, "tty"))
69 return;
70 p = curproc;
71 sx_sunlock(&clone_drain_lock);
72 sx_slock(&proctree_lock);
73 sx_slock(&clone_drain_lock);
74 dev_lock();
75 if (!(p->p_flag & P_CONTROLT))
76 *dev = ctty;
77 else if (p->p_session->s_ttyvp == NULL)
78 *dev = ctty;
79 else if (p->p_session->s_ttyvp->v_type == VBAD ||
80 p->p_session->s_ttyvp->v_rdev == NULL) {
81 /* e.g. s_ttyvp was revoked */
82 *dev = ctty;
83 } else
84 *dev = p->p_session->s_ttyvp->v_rdev;
85 dev_refl(*dev);
86 dev_unlock();
87 sx_sunlock(&proctree_lock);
88}
89
90static void
91ctty_drvinit(void *unused)

Callers

nothing calls this directly

Calls 4

strcmpFunction · 0.85
dev_lockFunction · 0.85
dev_reflFunction · 0.85
dev_unlockFunction · 0.85

Tested by

no test coverage detected