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
21struct vt_mode {
22 __u8 mode; /* vt mode */
23 __u8 waitv; /* if set, hang on writes if not active */
24 __s16 relsig; /* signal to raise on release req */
25 __s16 acqsig; /* signal to raise on acquisition */
26 __s16 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
34struct vt_stat {
35 __u16 v_active; /* active vt */
36 __u16 v_signal; /* signal to send */
37 __u16 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
48struct vt_sizes {
49 __u16 v_rows; /* number of rows */
50 __u16 v_cols; /* number of columns */
51 __u16 v_scrollsize; /* number of lines of scrollback */
52};
53#define VT_RESIZE 0x5609 /* set kernel's idea of screensize */
54
55struct vt_consize {
56 __u16 v_rows; /* number of rows */
57 __u16 v_cols; /* number of columns */
58 __u16 v_vlin; /* number of pixel rows on screen */
59 __u16 v_clin; /* number of pixel rows per character */
60 __u16 v_vcol; /* number of pixel columns on screen */
61 __u16 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
68struct vt_event {
69 __u32 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 __u32 oldev; /* Old console */
76 __u32 newev; /* New console (if changing) */
77 __u32 pad[4]; /* Padding for expansion */
78};
79
80#define VT_WAITEVENT 0x560E /* Wait for an event */
81
82struct vt_setactivate {
83 __u32 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 */
90struct 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