From 89a7700e23a0849af488349603e8753a7915603f Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Sat, 27 Feb 2016 14:58:43 -0500 Subject: [PATCH] apple: Add openpty(3) and forkpty(3) --- libc-test/build.rs | 1 + src/unix/bsd/apple/mod.rs | 9 +++++++++ src/unix/mod.rs | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 2c0d5853..6475db57 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -121,6 +121,7 @@ fn main() { cfg.header("mach-o/dyld.h"); cfg.header("mach/mach_time.h"); cfg.header("malloc/malloc.h"); + cfg.header("util.h"); if target.starts_with("x86") { cfg.header("crt_externs.h"); } diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 3d96ed93..ec0fe7c1 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -927,6 +927,15 @@ extern { len: *mut ::off_t, hdtr: *mut ::sf_hdtr, flags: ::c_int) -> ::c_int; + pub fn openpty(amaster: *mut ::c_int, + aslave: *mut ::c_int, + name: *mut ::c_char, + termp: *mut termios, + winp: *mut ::winsize) -> ::c_int; + pub fn forkpty(amaster: *mut ::c_int, + name: *mut ::c_char, + termp: *mut termios, + winp: *mut ::winsize) -> ::pid_t; } cfg_if! { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 6176402f..3ffb3b79 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -99,6 +99,13 @@ s! { pub events: ::c_short, pub revents: ::c_short, } + + pub struct winsize { + pub ws_row: ::c_ushort, + pub ws_col: ::c_ushort, + pub ws_xpixel: ::c_ushort, + pub ws_ypixel: ::c_ushort, + } } pub const SIG_DFL: sighandler_t = 0 as sighandler_t;