MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / lwp_tty_delete

Function lwp_tty_delete

components/lwp/terminal/tty_device.c:417–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417void lwp_tty_delete(lwp_tty_t tp)
418{
419 /*
420 * ttyydev_leave() usually frees the i/o queues earlier, but it is
421 * not always called between queue allocation and here. The queues
422 * may be allocated by ioctls on a pty control device without the
423 * corresponding pty slave device ever being open, or after it is
424 * closed.
425 */
426 ttyinq_free(&tp->t_inq);
427 ttyoutq_free(&tp->t_outq);
428 rt_wqueue_wakeup_all(&tp->t_inpoll, (void *)POLLHUP);
429 rt_wqueue_wakeup_all(&tp->t_outpoll, (void *)POLLHUP);
430
431#ifdef USING_BSD_POLL
432 knlist_destroy(&tp->t_inpoll.si_note);
433 knlist_destroy(&tp->t_outpoll.si_note);
434#endif
435
436 cv_destroy(&tp->t_inwait);
437 cv_destroy(&tp->t_outwait);
438 cv_destroy(&tp->t_bgwait);
439 cv_destroy(&tp->t_dcdwait);
440 cv_destroy(&tp->t_outserwait);
441
442 if (tp->t_mtx == &tp->t_mtxobj)
443 rt_mutex_detach(&tp->t_mtxobj);
444 ttydevsw_free(tp);
445 rt_device_unregister(&tp->parent);
446 rt_free(tp);
447}
448
449/*
450 * Report on state of foreground process group.

Callers 3

pts_allocFunction · 0.85
tty_rel_freeFunction · 0.85

Calls 7

ttyinq_freeFunction · 0.85
ttyoutq_freeFunction · 0.85
rt_wqueue_wakeup_allFunction · 0.85
rt_mutex_detachFunction · 0.85
ttydevsw_freeFunction · 0.85
rt_device_unregisterFunction · 0.85
rt_freeFunction · 0.85

Tested by

no test coverage detected