| 58 | } |
| 59 | |
| 60 | static void |
| 61 | ctty_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 | |
| 90 | static void |
| 91 | ctty_drvinit(void *unused) |
nothing calls this directly
no test coverage detected