Print this page
8368 remove warlock leftovers from usr/src/uts


  96  * ......
  97  * n:   virtual console #n      /dev/vt/n               Alt + Fn
  98  *
  99  * Note that vtdaemon is running on /dev/vt/1 (minor=1),
 100  * which is not available to end users.
 101  *
 102  */
 103 
 104 #define VT_DAEMON_MINOR 1
 105 #define VT_IS_DAEMON(minor)     ((minor) == VT_DAEMON_MINOR)
 106 
 107 extern void     wc_get_size(vc_state_t *pvc);
 108 extern boolean_t consconfig_console_is_tipline(void);
 109 
 110 
 111 minor_t vc_last_console = VT_MINOR_INVALID;     /* the last used console */
 112 volatile uint_t vc_target_console;              /* arg (1..n) */
 113 
 114 static volatile minor_t vc_inuse_max_minor = 0;
 115 static list_t vc_waitactive_list;
 116 _NOTE(SCHEME_PROTECTS_DATA("D_MTPERMOD protected data", vc_target_console))
 117 _NOTE(SCHEME_PROTECTS_DATA("D_MTPERMOD protected data", vc_last_console))
 118 _NOTE(SCHEME_PROTECTS_DATA("D_MTPERMOD protected data", vc_inuse_max_minor))
 119 _NOTE(SCHEME_PROTECTS_DATA("D_MTPERMOD protected data", vc_waitactive_list))
 120 
 121 static int vt_pending_vtno = -1;
 122 kmutex_t vt_pending_vtno_lock;
 123 _NOTE(MUTEX_PROTECTS_DATA(vt_pending_vtno_lock, vt_pending_vtno))
 124 
 125 static int vt_activate(uint_t vt_no, cred_t *credp);
 126 static void vt_copyout(queue_t *qp, mblk_t *mp, mblk_t *tmp, uint_t size);
 127 static void vt_copyin(queue_t *qp, mblk_t *mp, uint_t size);
 128 static void vt_iocnak(queue_t *qp, mblk_t *mp, int error);
 129 static void vt_iocack(queue_t *qp, mblk_t *mp);
 130 
 131 static uint_t vt_minor2arg(minor_t minor);
 132 static minor_t vt_arg2minor(uint_t arg);
 133 
 134 /*
 135  * If the system console is directed to tipline, consider /dev/vt/0 as
 136  * not being used.
 137  * For other VT, if it is opened and tty is initialized, consider it
 138  * as being used.
 139  */
 140 #define VT_IS_INUSE(id)                                         \
 141         (((vt_minor2vc(id))->vc_flags & WCS_ISOPEN) &&           \
 142         ((vt_minor2vc(id))->vc_flags & WCS_INIT) &&              \
 143         (id != 0 || !consconfig_console_is_tipline()))


1330 vc_avl_compare(const void *first, const void *second)
1331 {
1332         const vc_state_t *vcptr1 = first;
1333         const vc_state_t *vcptr2 = second;
1334 
1335         if (vcptr1->vc_minor < vcptr2->vc_minor)
1336                 return (-1);
1337 
1338         if (vcptr1->vc_minor == vcptr2->vc_minor)
1339                 return (0);
1340 
1341         return (1);
1342 }
1343 
1344 /*
1345  * Only called from wc init().
1346  */
1347 void
1348 vt_init(void)
1349 {
1350 #ifdef  __lock_lint
1351         ASSERT(NO_COMPETING_THREADS);
1352 #endif
1353 
1354         avl_create(&vc_avl_root, vc_avl_compare, sizeof (vc_state_t),
1355             offsetof(vc_state_t, vc_avl_node));
1356 
1357         list_create(&vc_waitactive_list, sizeof (vc_waitactive_msg_t),
1358             offsetof(vc_waitactive_msg_t, wa_list_node));
1359 
1360         mutex_init(&vc_lock, NULL, MUTEX_DRIVER, NULL);
1361         mutex_init(&vt_pending_vtno_lock, NULL, MUTEX_DRIVER, NULL);
1362 }


  96  * ......
  97  * n:   virtual console #n      /dev/vt/n               Alt + Fn
  98  *
  99  * Note that vtdaemon is running on /dev/vt/1 (minor=1),
 100  * which is not available to end users.
 101  *
 102  */
 103 
 104 #define VT_DAEMON_MINOR 1
 105 #define VT_IS_DAEMON(minor)     ((minor) == VT_DAEMON_MINOR)
 106 
 107 extern void     wc_get_size(vc_state_t *pvc);
 108 extern boolean_t consconfig_console_is_tipline(void);
 109 
 110 
 111 minor_t vc_last_console = VT_MINOR_INVALID;     /* the last used console */
 112 volatile uint_t vc_target_console;              /* arg (1..n) */
 113 
 114 static volatile minor_t vc_inuse_max_minor = 0;
 115 static list_t vc_waitactive_list;




 116 
 117 static int vt_pending_vtno = -1;
 118 kmutex_t vt_pending_vtno_lock;

 119 
 120 static int vt_activate(uint_t vt_no, cred_t *credp);
 121 static void vt_copyout(queue_t *qp, mblk_t *mp, mblk_t *tmp, uint_t size);
 122 static void vt_copyin(queue_t *qp, mblk_t *mp, uint_t size);
 123 static void vt_iocnak(queue_t *qp, mblk_t *mp, int error);
 124 static void vt_iocack(queue_t *qp, mblk_t *mp);
 125 
 126 static uint_t vt_minor2arg(minor_t minor);
 127 static minor_t vt_arg2minor(uint_t arg);
 128 
 129 /*
 130  * If the system console is directed to tipline, consider /dev/vt/0 as
 131  * not being used.
 132  * For other VT, if it is opened and tty is initialized, consider it
 133  * as being used.
 134  */
 135 #define VT_IS_INUSE(id)                                         \
 136         (((vt_minor2vc(id))->vc_flags & WCS_ISOPEN) &&           \
 137         ((vt_minor2vc(id))->vc_flags & WCS_INIT) &&              \
 138         (id != 0 || !consconfig_console_is_tipline()))


1325 vc_avl_compare(const void *first, const void *second)
1326 {
1327         const vc_state_t *vcptr1 = first;
1328         const vc_state_t *vcptr2 = second;
1329 
1330         if (vcptr1->vc_minor < vcptr2->vc_minor)
1331                 return (-1);
1332 
1333         if (vcptr1->vc_minor == vcptr2->vc_minor)
1334                 return (0);
1335 
1336         return (1);
1337 }
1338 
1339 /*
1340  * Only called from wc init().
1341  */
1342 void
1343 vt_init(void)
1344 {




1345         avl_create(&vc_avl_root, vc_avl_compare, sizeof (vc_state_t),
1346             offsetof(vc_state_t, vc_avl_node));
1347 
1348         list_create(&vc_waitactive_list, sizeof (vc_waitactive_msg_t),
1349             offsetof(vc_waitactive_msg_t, wa_list_node));
1350 
1351         mutex_init(&vc_lock, NULL, MUTEX_DRIVER, NULL);
1352         mutex_init(&vt_pending_vtno_lock, NULL, MUTEX_DRIVER, NULL);
1353 }