LCOV - code coverage report
Current view: top level - tty - tty_mutex.c (source / functions) Coverage Total Hit
Test: TTY Combined Coverage Lines: 51.9 % 27 14
Test Date: 2025-08-26 15:45:50 Functions: 66.7 % 6 4

            Line data    Source code
       1              : // SPDX-License-Identifier: GPL-2.0
       2              : #include <linux/tty.h>
       3              : #include <linux/module.h>
       4              : #include <linux/kallsyms.h>
       5              : #include <linux/semaphore.h>
       6              : #include <linux/sched.h>
       7              : #include "tty.h"
       8              : 
       9              : /* Legacy tty mutex glue */
      10              : 
      11              : /*
      12              :  * Getting the big tty mutex.
      13              :  */
      14              : 
      15           12 : void tty_lock(struct tty_struct *tty)
      16              : {
      17           12 :         tty_kref_get(tty);
      18           12 :         mutex_lock(&tty->legacy_mutex);
      19           12 : }
      20              : EXPORT_SYMBOL(tty_lock);
      21              : 
      22            0 : int tty_lock_interruptible(struct tty_struct *tty)
      23              : {
      24            0 :         int ret;
      25              : 
      26            0 :         tty_kref_get(tty);
      27            0 :         ret = mutex_lock_interruptible(&tty->legacy_mutex);
      28            0 :         if (ret)
      29            0 :                 tty_kref_put(tty);
      30            0 :         return ret;
      31            0 : }
      32              : 
      33           12 : void tty_unlock(struct tty_struct *tty)
      34              : {
      35           12 :         mutex_unlock(&tty->legacy_mutex);
      36           12 :         tty_kref_put(tty);
      37           12 : }
      38              : EXPORT_SYMBOL(tty_unlock);
      39              : 
      40            6 : void tty_lock_slave(struct tty_struct *tty)
      41              : {
      42            6 :         if (tty && tty != tty->link)
      43            0 :                 tty_lock(tty);
      44            6 : }
      45              : 
      46            6 : void tty_unlock_slave(struct tty_struct *tty)
      47              : {
      48            6 :         if (tty && tty != tty->link)
      49            0 :                 tty_unlock(tty);
      50            6 : }
      51              : 
      52            0 : void tty_set_lock_subclass(struct tty_struct *tty)
      53              : {
      54            0 :         lockdep_set_subclass(&tty->legacy_mutex, TTY_LOCK_SLAVE);
      55            0 : }
        

Generated by: LCOV version 2.0-1