Add termios constant for VDISABLE
_POSIX_VDISABLE is an extension that disables terminal special characters. See: * redox-os/termios!3 * redox-os/base!27
This commit is contained in:
@@ -6,6 +6,7 @@ pub const O_RDWR: c_int = 0x0002;
|
||||
pub const O_ACCMODE: c_int = 0x0003;
|
||||
pub const O_CREAT: c_int = 0x0040;
|
||||
pub const O_EXCL: c_int = 0x0080;
|
||||
pub const O_NOCTTY: c_int = 0x0100;
|
||||
pub const O_TRUNC: c_int = 0x0200;
|
||||
pub const O_APPEND: c_int = 0x0400;
|
||||
pub const O_NONBLOCK: c_int = 0x0800;
|
||||
|
||||
@@ -5,10 +5,8 @@ use crate::{
|
||||
};
|
||||
|
||||
pub(super) unsafe fn openpty(name: &mut [u8]) -> Result<(c_int, c_int), ()> {
|
||||
const O_NOCTTY: c_int = 0x100;
|
||||
|
||||
//TODO: wrap in auto-close struct
|
||||
let master = fcntl::open(c"/dev/ptmx".as_ptr(), fcntl::O_RDWR | O_NOCTTY, 0);
|
||||
let master = fcntl::open(c"/dev/ptmx".as_ptr(), fcntl::O_RDWR | fcntl::O_NOCTTY, 0);
|
||||
if master < 0 {
|
||||
return Err(());
|
||||
}
|
||||
@@ -40,7 +38,7 @@ pub(super) unsafe fn openpty(name: &mut [u8]) -> Result<(c_int, c_int), ()> {
|
||||
|
||||
let slave = fcntl::open(
|
||||
cursor.get_ref().as_ptr() as *const c_char,
|
||||
fcntl::O_RDWR | O_NOCTTY,
|
||||
fcntl::O_RDWR | fcntl::O_NOCTTY,
|
||||
0,
|
||||
);
|
||||
if slave < 0 {
|
||||
|
||||
@@ -111,3 +111,7 @@ pub const NOFLSH: usize = 0o000_200;
|
||||
pub const TOSTOP: usize = 0o000_400;
|
||||
pub const IEXTEN: usize = 0o100_000;
|
||||
/* } c_lflag */
|
||||
|
||||
// POSIX extensions
|
||||
/// Sentinel value to disable a control char.
|
||||
pub const _POSIX_VDISABLE: u8 = 0;
|
||||
|
||||
@@ -104,3 +104,7 @@ pub const NOFLSH: usize = 0x8000_0000;
|
||||
pub const TOSTOP: usize = 0x0040_0000;
|
||||
pub const IEXTEN: usize = 0x0000_0400;
|
||||
/* } c_lflag */
|
||||
|
||||
// POSIX extensions
|
||||
/// Sentinel value to disable a control char.
|
||||
pub const _POSIX_VDISABLE: u8 = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
header::errno,
|
||||
header::{errno, termios::_POSIX_VDISABLE},
|
||||
platform::{self, types::*},
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ pub const _PC_PATH_MAX: c_int = 4;
|
||||
pub const _PC_PIPE_BUF: c_int = 5;
|
||||
pub const _PC_CHOWN_RESTRICTED: c_int = 6;
|
||||
pub const _PC_NO_TRUNC: c_int = 7;
|
||||
/// Check if file (terminal) supports disabling control chars (CC)
|
||||
pub const _PC_VDISABLE: c_int = 8;
|
||||
pub const _PC_SYNC_IO: c_int = 9;
|
||||
pub const _PC_ASYNC_IO: c_int = 10;
|
||||
@@ -36,7 +37,7 @@ fn pc(name: c_int) -> c_long {
|
||||
_PC_PIPE_BUF => 4096,
|
||||
_PC_CHOWN_RESTRICTED => 1,
|
||||
_PC_NO_TRUNC => 1,
|
||||
_PC_VDISABLE => 0,
|
||||
_PC_VDISABLE => _POSIX_VDISABLE.into(),
|
||||
_PC_SYNC_IO => 1,
|
||||
_PC_ASYNC_IO => -1,
|
||||
_PC_PRIO_IO => -1,
|
||||
|
||||
Reference in New Issue
Block a user