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#include <sys/types.h>
25
26class DescriptorLease;
27class ConsoleFile;
28int console_tcgetattr(const DescriptorLease& descriptor, struct termios* attributes);
29int console_tcsetattr(const DescriptorLease& descriptor, int action, struct termios* attributes);
30
31struct termios;
32struct winsize;
33
34struct vt_mode {
35 char mode;
36 char waitv;
37 short relsig;
38 short acqsig;
39 short frsig;
40};
41
42struct vt_stat {
43 unsigned short v_active;
44 unsigned short v_signal;
45 unsigned short v_state;
46};
47
48struct kbentry {
49 unsigned char kb_table;
50 unsigned char kb_index;
51 unsigned short kb_value;
52};
53
54// vt_mode modes
55#define VT_AUTO 0
56#define VT_PROCESS 1
57#define VT_ACKACQ 2
58
59int posix_tcgetattr(int fd, struct termios* p);
60int posix_tcsetattr(int fd, int optional_actions, struct termios* p);
61int console_getwinsize(File* file, struct winsize* buf);
62int console_setwinsize(File* file, const struct winsize* buf);
63int console_flush(File* file, void* what);
64
65int console_ptsname(int fd, char* buf);
66int console_ttyname(int fd, char* buf);
67
68int console_setctty(File* file, bool steal);
69int console_setctty(int fd, bool steal);
70int console_notty(int fd);
71
72// get the terminal's number (e.g. ptyp0 returns 0)
73unsigned int console_getptn(int fd);
74
75pid_t posix_tcgetpgrp(int fd);
76int posix_tcsetpgrp(int fd, pid_t pgid_id);
77
78#endif
Definition File.h:75