Implement a dummy sgtty

This commit is contained in:
jD91mZM2
2018-07-29 07:55:19 +02:00
parent 65cbd40fce
commit e7e9d57db5
11 changed files with 85 additions and 6 deletions
Generated
+10
View File
@@ -337,6 +337,7 @@ dependencies = [
"pwd 0.1.0",
"semaphore 0.1.0",
"setjmp 0.1.0",
"sgtty 0.1.0",
"signal 0.1.0",
"stdio 0.1.0",
"stdlib 0.1.0",
@@ -419,6 +420,15 @@ dependencies = [
name = "setjmp"
version = "0.1.0"
[[package]]
name = "sgtty"
version = "0.1.0"
dependencies = [
"cbindgen 0.5.2",
"platform 0.1.0",
"sys_ioctl 0.1.0",
]
[[package]]
name = "signal"
version = "0.1.0"
+1
View File
@@ -29,6 +29,7 @@ platform = { path = "src/platform" }
pwd = { path = "src/pwd" }
semaphore = { path = "src/semaphore" }
setjmp = { path = "src/setjmp" }
sgtty = { path = "src/sgtty" }
signal = { path = "src/signal" }
stdio = { path = "src/stdio" }
stdlib = { path = "src/stdlib" }
+1
View File
@@ -19,6 +19,7 @@ pub extern crate netinet;
pub extern crate pwd;
pub extern crate semaphore;
pub extern crate setjmp;
pub extern crate sgtty;
pub extern crate signal;
pub extern crate stdio;
pub extern crate stdlib;
+11
View File
@@ -0,0 +1,11 @@
[package]
name = "sgtty"
version = "0.1.0"
authors = ["jD91mZM2 <me@krake.one>"]
[build-dependencies]
cbindgen = { path = "../../cbindgen" }
[dependencies]
platform = { path = "../platform" }
sys_ioctl = { path = "../sys_ioctl" }
+11
View File
@@ -0,0 +1,11 @@
extern crate cbindgen;
use std::{env, fs};
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
fs::create_dir_all("../../target/include").expect("failed to create include directory");
cbindgen::generate(crate_dir)
.expect("failed to generate bindings")
.write_to_file("../../target/include/sgtty.h");
}
+7
View File
@@ -0,0 +1,7 @@
sys_includes = ["sys/ioctl.h"]
include_guard = "_SGTTY_H"
style = "Tag"
language = "C"
[enum]
prefix_with_name = true
+20
View File
@@ -0,0 +1,20 @@
//! sgtty implementation that won't work on redox because no ioctl
#![no_std]
extern crate platform;
extern crate sys_ioctl;
use core::fmt::Write;
use platform::types::*;
use sys_ioctl::*;
#[no_mangle]
pub extern "C" fn gtty(fd: c_int, out: *mut sgttyb) -> c_int {
writeln!(
platform::FileWriter(2),
"unimplemented: gtty({}, {:p})",
fd,
out
);
-1
}
+1 -1
View File
@@ -6,5 +6,5 @@ authors = ["jD91mZM2 <me@krake.one>"]
[build-dependencies]
cbindgen = { path = "../../cbindgen" }
[target.'cfg(target_os = "linux")'.dependencies]
[dependencies]
platform = { path = "../platform" }
+7 -1
View File
@@ -1,7 +1,13 @@
sys_includes = []
include_guard = "_IOCTL_H"
language = "C"
style = "Tag"
# WORKAROUND:
# sgtty is used by another header, and cbindgen doesn't prefix that with `struct` :|
style = "Both"
[enum]
prefix_with_name = true
[export]
include = ["sgttyb", "winsize"]
+15 -3
View File
@@ -2,11 +2,23 @@
#![no_std]
extern crate platform;
use platform::types::*;
// This is used from sgtty
#[repr(C)]
pub struct sgttyb {
sg_ispeed: c_char,
sg_ospeed: c_char,
sg_erase: c_char,
sg_kill: c_char,
sg_flags: c_ushort
}
#[cfg(target_os = "linux")]
pub mod inner {
extern crate platform;
use self::platform::types::*;
use ::*;
#[repr(C)]
pub struct winsize {
+1 -1
View File
@@ -1,6 +1,6 @@
sys_includes = ["sys/types.h", "sys/resource.h"]
include_guard = "_SYS_WAIT_H"
style = "Tag"
style = "Type"
trailer = "#include <bits/sys/wait.h>"
language = "C"