aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h54
1 files changed, 46 insertions, 8 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index c75d886b0307..8780bd2a272a 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -255,9 +255,9 @@ struct tty_struct {
255 int count; 255 int count;
256 struct winsize winsize; /* termios mutex */ 256 struct winsize winsize; /* termios mutex */
257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
258 unsigned char warned:1;
259 unsigned char ctrl_status; /* ctrl_lock */ 258 unsigned char ctrl_status; /* ctrl_lock */
260 unsigned int receive_room; /* Bytes free for queue */ 259 unsigned int receive_room; /* Bytes free for queue */
260 int flow_change;
261 261
262 struct tty_struct *link; 262 struct tty_struct *link;
263 struct fasync_struct *fasync; 263 struct fasync_struct *fasync;
@@ -315,9 +315,25 @@ struct tty_file_private {
315#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 315#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
316#define TTY_HUPPED 18 /* Post driver->hangup() */ 316#define TTY_HUPPED 18 /* Post driver->hangup() */
317#define TTY_HUPPING 21 /* ->hangup() in progress */ 317#define TTY_HUPPING 21 /* ->hangup() in progress */
318#define TTY_LDISC_HALTED 22 /* Line discipline is halted */
318 319
319#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 320#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
320 321
322/* Values for tty->flow_change */
323#define TTY_THROTTLE_SAFE 1
324#define TTY_UNTHROTTLE_SAFE 2
325
326static inline void __tty_set_flow_change(struct tty_struct *tty, int val)
327{
328 tty->flow_change = val;
329}
330
331static inline void tty_set_flow_change(struct tty_struct *tty, int val)
332{
333 tty->flow_change = val;
334 smp_mb();
335}
336
321#ifdef CONFIG_TTY 337#ifdef CONFIG_TTY
322extern void console_init(void); 338extern void console_init(void);
323extern void tty_kref_put(struct tty_struct *tty); 339extern void tty_kref_put(struct tty_struct *tty);
@@ -400,6 +416,8 @@ extern int tty_write_room(struct tty_struct *tty);
400extern void tty_driver_flush_buffer(struct tty_struct *tty); 416extern void tty_driver_flush_buffer(struct tty_struct *tty);
401extern void tty_throttle(struct tty_struct *tty); 417extern void tty_throttle(struct tty_struct *tty);
402extern void tty_unthrottle(struct tty_struct *tty); 418extern void tty_unthrottle(struct tty_struct *tty);
419extern int tty_throttle_safe(struct tty_struct *tty);
420extern int tty_unthrottle_safe(struct tty_struct *tty);
403extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); 421extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
404extern void tty_driver_remove_tty(struct tty_driver *driver, 422extern void tty_driver_remove_tty(struct tty_driver *driver,
405 struct tty_struct *tty); 423 struct tty_struct *tty);
@@ -419,13 +437,28 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty);
419extern void tty_buffer_free_all(struct tty_port *port); 437extern void tty_buffer_free_all(struct tty_port *port);
420extern void tty_buffer_flush(struct tty_struct *tty); 438extern void tty_buffer_flush(struct tty_struct *tty);
421extern void tty_buffer_init(struct tty_port *port); 439extern void tty_buffer_init(struct tty_port *port);
422extern speed_t tty_get_baud_rate(struct tty_struct *tty);
423extern speed_t tty_termios_baud_rate(struct ktermios *termios); 440extern speed_t tty_termios_baud_rate(struct ktermios *termios);
424extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 441extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
425extern void tty_termios_encode_baud_rate(struct ktermios *termios, 442extern void tty_termios_encode_baud_rate(struct ktermios *termios,
426 speed_t ibaud, speed_t obaud); 443 speed_t ibaud, speed_t obaud);
427extern void tty_encode_baud_rate(struct tty_struct *tty, 444extern void tty_encode_baud_rate(struct tty_struct *tty,
428 speed_t ibaud, speed_t obaud); 445 speed_t ibaud, speed_t obaud);
446
447/**
448 * tty_get_baud_rate - get tty bit rates
449 * @tty: tty to query
450 *
451 * Returns the baud rate as an integer for this terminal. The
452 * termios lock must be held by the caller and the terminal bit
453 * flags may be updated.
454 *
455 * Locking: none
456 */
457static inline speed_t tty_get_baud_rate(struct tty_struct *tty)
458{
459 return tty_termios_baud_rate(&tty->termios);
460}
461
429extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 462extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
430extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 463extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
431extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); 464extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
@@ -502,6 +535,8 @@ extern int tty_port_carrier_raised(struct tty_port *port);
502extern void tty_port_raise_dtr_rts(struct tty_port *port); 535extern void tty_port_raise_dtr_rts(struct tty_port *port);
503extern void tty_port_lower_dtr_rts(struct tty_port *port); 536extern void tty_port_lower_dtr_rts(struct tty_port *port);
504extern void tty_port_hangup(struct tty_port *port); 537extern void tty_port_hangup(struct tty_port *port);
538extern void tty_port_tty_hangup(struct tty_port *port, bool check_clocal);
539extern void tty_port_tty_wakeup(struct tty_port *port);
505extern int tty_port_block_til_ready(struct tty_port *port, 540extern int tty_port_block_til_ready(struct tty_port *port,
506 struct tty_struct *tty, struct file *filp); 541 struct tty_struct *tty, struct file *filp);
507extern int tty_port_close_start(struct tty_port *port, 542extern int tty_port_close_start(struct tty_port *port,
@@ -526,8 +561,6 @@ extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty);
526extern void tty_ldisc_init(struct tty_struct *tty); 561extern void tty_ldisc_init(struct tty_struct *tty);
527extern void tty_ldisc_deinit(struct tty_struct *tty); 562extern void tty_ldisc_deinit(struct tty_struct *tty);
528extern void tty_ldisc_begin(void); 563extern void tty_ldisc_begin(void);
529/* This last one is just for the tty layer internals and shouldn't be used elsewhere */
530extern void tty_ldisc_enable(struct tty_struct *tty);
531 564
532 565
533/* n_tty.c */ 566/* n_tty.c */
@@ -542,8 +575,7 @@ extern void tty_audit_exit(void);
542extern void tty_audit_fork(struct signal_struct *sig); 575extern void tty_audit_fork(struct signal_struct *sig);
543extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); 576extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
544extern void tty_audit_push(struct tty_struct *tty); 577extern void tty_audit_push(struct tty_struct *tty);
545extern int tty_audit_push_task(struct task_struct *tsk, 578extern int tty_audit_push_current(void);
546 kuid_t loginuid, u32 sessionid);
547#else 579#else
548static inline void tty_audit_add_data(struct tty_struct *tty, 580static inline void tty_audit_add_data(struct tty_struct *tty,
549 unsigned char *data, size_t size, unsigned icanon) 581 unsigned char *data, size_t size, unsigned icanon)
@@ -561,8 +593,7 @@ static inline void tty_audit_fork(struct signal_struct *sig)
561static inline void tty_audit_push(struct tty_struct *tty) 593static inline void tty_audit_push(struct tty_struct *tty)
562{ 594{
563} 595}
564static inline int tty_audit_push_task(struct task_struct *tsk, 596static inline int tty_audit_push_current(void)
565 kuid_t loginuid, u32 sessionid)
566{ 597{
567 return 0; 598 return 0;
568} 599}
@@ -658,5 +689,12 @@ do { \
658 finish_wait(&wq, &__wait); \ 689 finish_wait(&wq, &__wait); \
659} while (0) 690} while (0)
660 691
692#ifdef CONFIG_PROC_FS
693extern void proc_tty_register_driver(struct tty_driver *);
694extern void proc_tty_unregister_driver(struct tty_driver *);
695#else
696static inline void proc_tty_register_driver(struct tty_driver *d) {}
697static inline void proc_tty_unregister_driver(struct tty_driver *d) {}
698#endif
661 699
662#endif 700#endif