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

Function tty_rel_free

freebsd/kern/tty.c:1139–1168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1137}
1138
1139static void
1140tty_rel_free(struct tty *tp)
1141{
1142 struct cdev *dev;
1143
1144 tty_assert_locked(tp);
1145
1146#define TF_ACTIVITY (TF_GONE|TF_OPENED|TF_HOOK|TF_OPENCLOSE)
1147 if (tp->t_sessioncnt != 0 || (tp->t_flags & TF_ACTIVITY) != TF_GONE) {
1148 /* TTY is still in use. */
1149 tty_unlock(tp);
1150 return;
1151 }
1152
1153 /* Stop asynchronous I/O. */
1154 funsetown(&tp->t_sigio);
1155
1156 /* TTY can be deallocated. */
1157 dev = tp->t_dev;
1158 tp->t_dev = NULL;
1159 tty_unlock(tp);
1160
1161 if (dev != NULL) {
1162 sx_xlock(&tty_list_sx);
1163 TAILQ_REMOVE(&tty_list, tp, t_list);
1164 tty_list_count--;
1165 sx_xunlock(&tty_list_sx);
1166 destroy_dev_sched_cb(dev, tty_dealloc, tp);
1167 }
1168}
1169
1170void
1171tty_rel_pgrp(struct tty *tp, struct pgrp *pg)

Callers 4

ttydev_leaveFunction · 0.85
tty_rel_sessFunction · 0.85
tty_rel_goneFunction · 0.85
ttyhook_unregisterFunction · 0.85

Calls 2

funsetownFunction · 0.85
destroy_dev_sched_cbFunction · 0.85

Tested by

no test coverage detected