tty_mutex.c 659 B

123456789101112131415161718192021222324252627282930313233
  1. #include <linux/tty.h>
  2. #include <linux/module.h>
  3. #include <linux/kallsyms.h>
  4. #include <linux/semaphore.h>
  5. #include <linux/sched.h>
  6. /*
  7. * The 'big tty mutex'
  8. *
  9. * This mutex is taken and released by tty_lock() and tty_unlock(),
  10. * replacing the older big kernel lock.
  11. * It can no longer be taken recursively, and does not get
  12. * released implicitly while sleeping.
  13. *
  14. * Don't use in new code.
  15. */
  16. static DEFINE_MUTEX(big_tty_mutex);
  17. /*
  18. * Getting the big tty mutex.
  19. */
  20. void __lockfunc tty_lock(void)
  21. {
  22. mutex_lock(&big_tty_mutex);
  23. }
  24. EXPORT_SYMBOL(tty_lock);
  25. void __lockfunc tty_unlock(void)
  26. {
  27. mutex_unlock(&big_tty_mutex);
  28. }
  29. EXPORT_SYMBOL(tty_unlock);