Skip to content

Commit 04213bb

Browse files
committed
Merge pull request rust-lang#202 from kamalmarhubi/openpty
apple: Add openpty(3) and forkpty(3)
2 parents b47bc67 + 89a7700 commit 04213bb

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ fn main() {
121121
cfg.header("mach-o/dyld.h");
122122
cfg.header("mach/mach_time.h");
123123
cfg.header("malloc/malloc.h");
124+
cfg.header("util.h");
124125
if target.starts_with("x86") {
125126
cfg.header("crt_externs.h");
126127
}

src/unix/bsd/apple/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,15 @@ extern {
927927
len: *mut ::off_t,
928928
hdtr: *mut ::sf_hdtr,
929929
flags: ::c_int) -> ::c_int;
930+
pub fn openpty(amaster: *mut ::c_int,
931+
aslave: *mut ::c_int,
932+
name: *mut ::c_char,
933+
termp: *mut termios,
934+
winp: *mut ::winsize) -> ::c_int;
935+
pub fn forkpty(amaster: *mut ::c_int,
936+
name: *mut ::c_char,
937+
termp: *mut termios,
938+
winp: *mut ::winsize) -> ::pid_t;
930939
}
931940

932941
cfg_if! {

src/unix/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ s! {
9999
pub events: ::c_short,
100100
pub revents: ::c_short,
101101
}
102+
103+
pub struct winsize {
104+
pub ws_row: ::c_ushort,
105+
pub ws_col: ::c_ushort,
106+
pub ws_xpixel: ::c_ushort,
107+
pub ws_ypixel: ::c_ushort,
108+
}
102109
}
103110

104111
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;

0 commit comments

Comments
 (0)