xref: /linux/include/uapi/linux/vt.h (revision 378ec25aec5a8444879f8696d580c94950a1f1df)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_LINUX_VT_H
3 #define _UAPI_LINUX_VT_H
4 
5 #include <linux/ioctl.h>
6 #include <linux/types.h>
7 
8 /*
9  * These constants are also useful for user-level apps (e.g., VC
10  * resizing).
11  */
12 #define MIN_NR_CONSOLES 1       /* must be at least 1 */
13 #define MAX_NR_CONSOLES	63	/* serial lines start at 64 */
14 		/* Note: the ioctl VT_GETSTATE does not work for
15 		   consoles 16 and higher (since it returns a short) */
16 
17 /* 0x56 is 'V', to avoid collision with termios and kd */
18 
19 #define VT_OPENQRY	0x5600	/* find available vt */
20 
21 struct vt_mode {
22 	char mode;		/* vt mode */
23 	char waitv;		/* if set, hang on writes if not active */
24 	short relsig;		/* signal to raise on release req */
25 	short acqsig;		/* signal to raise on acquisition */
26 	short frsig;		/* unused (set to 0) */
27 };
28 #define VT_GETMODE	0x5601	/* get mode of active vt */
29 #define VT_SETMODE	0x5602	/* set mode of active vt */
30 #define		VT_AUTO		0x00	/* auto vt switching */
31 #define		VT_PROCESS	0x01	/* process controls switching */
32 #define		VT_ACKACQ	0x02	/* acknowledge switch */
33 
34 struct vt_stat {
35 	unsigned short v_active;	/* active vt */
36 	unsigned short v_signal;	/* signal to send */
37 	unsigned short v_state;		/* vt bitmask */
38 };
39 #define VT_GETSTATE	0x5603	/* get global vt state info */
40 #define VT_SENDSIG	0x5604	/* signal to send to bitmask of vts */
41 
42 #define VT_RELDISP	0x5605	/* release display */
43 
44 #define VT_ACTIVATE	0x5606	/* make vt active */
45 #define VT_WAITACTIVE	0x5607	/* wait for vt active */
46 #define VT_DISALLOCATE	0x5608  /* free memory associated to vt */
47 
48 struct vt_sizes {
49 	unsigned short v_rows;		/* number of rows */
50 	unsigned short v_cols;		/* number of columns */
51 	unsigned short v_scrollsize;	/* number of lines of scrollback */
52 };
53 #define VT_RESIZE	0x5609	/* set kernel's idea of screensize */
54 
55 struct vt_consize {
56 	unsigned short v_rows;	/* number of rows */
57 	unsigned short v_cols;	/* number of columns */
58 	unsigned short v_vlin;	/* number of pixel rows on screen */
59 	unsigned short v_clin;	/* number of pixel rows per character */
60 	unsigned short v_vcol;	/* number of pixel columns on screen */
61 	unsigned short v_ccol;	/* number of pixel columns per character */
62 };
63 #define VT_RESIZEX      0x560A  /* set kernel's idea of screensize + more */
64 #define VT_LOCKSWITCH   0x560B  /* disallow vt switching */
65 #define VT_UNLOCKSWITCH 0x560C  /* allow vt switching */
66 #define VT_GETHIFONTMASK 0x560D  /* return hi font mask */
67 
68 struct vt_event {
69 	unsigned int event;
70 #define VT_EVENT_SWITCH		0x0001	/* Console switch */
71 #define VT_EVENT_BLANK		0x0002	/* Screen blank */
72 #define VT_EVENT_UNBLANK	0x0004	/* Screen unblank */
73 #define VT_EVENT_RESIZE		0x0008	/* Resize display */
74 #define VT_MAX_EVENT		0x000F
75 	unsigned int oldev;		/* Old console */
76 	unsigned int newev;		/* New console (if changing) */
77 	unsigned int pad[4];		/* Padding for expansion */
78 };
79 
80 #define VT_WAITEVENT	0x560E	/* Wait for an event */
81 
82 struct vt_setactivate {
83 	unsigned int console;
84 	struct vt_mode mode;
85 };
86 
87 #define VT_SETACTIVATE	0x560F	/* Activate and set the mode of a console */
88 
89 /* get console size and cursor position */
90 struct vt_consizecsrpos {
91 	__u16 con_rows;		/* number of console rows */
92 	__u16 con_cols;		/* number of console columns */
93 	__u16 csr_row;		/* current cursor's row */
94 	__u16 csr_col;		/* current cursor's column */
95 };
96 #define VT_GETCONSIZECSRPOS	_IOR('V', 0x10, struct vt_consizecsrpos)
97 
98 #endif /* _UAPI_LINUX_VT_H */
99