The Pedigree Project  0.1
console-syscalls.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef CONSOLE_SYSCALLS_H
21 #define CONSOLE_SYSCALLS_H
22 
23 #include "modules/system/vfs/File.h"
24 
25 #include <sys/types.h>
26 
27 struct termios;
28 struct winsize;
29 
30 struct vt_mode
31 {
32  char mode;
33  char waitv;
34  short relsig;
35  short acqsig;
36  short frsig;
37 };
38 
39 struct vt_stat
40 {
41  unsigned short v_active;
42  unsigned short v_signal;
43  unsigned short v_state;
44 };
45 
46 struct kbentry
47 {
48  unsigned char kb_table;
49  unsigned char kb_index;
50  unsigned short kb_value;
51 };
52 
53 // vt_mode modes
54 #define VT_AUTO 0
55 #define VT_PROCESS 1
56 #define VT_ACKACQ 2
57 
58 int posix_tcgetattr(int fd, struct termios *p);
59 int posix_tcsetattr(int fd, int optional_actions, struct termios *p);
60 int console_getwinsize(File *file, struct winsize *buf);
61 int console_setwinsize(File *file, const struct winsize *buf);
62 int console_flush(File *file, void *what);
63 
64 int console_ptsname(int fd, char *buf);
65 int console_ttyname(int fd, char *buf);
66 
67 int console_setctty(File *file, bool steal);
68 int console_setctty(int fd, bool steal);
69 int console_notty(int fd);
70 
71 // get the terminal's number (e.g. ptyp0 returns 0)
72 unsigned int console_getptn(int fd);
73 
74 pid_t posix_tcgetpgrp(int fd);
75 int posix_tcsetpgrp(int fd, pid_t pgid_id);
76 
77 #endif
Definition: File.h:66