From a6191c5f6f4e1a737eff83728173e2939211a6d2 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 3 Jan 2024 10:04:15 -0700 Subject: [PATCH] redox: add openpty, login_tty, TIOCSCTTY, and organize functions --- libc-test/semver/redox.txt | 3 +++ src/unix/redox/mod.rs | 31 ++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/libc-test/semver/redox.txt b/libc-test/semver/redox.txt index 5f85e1aa7f3d4..80095a09f5345 100644 --- a/libc-test/semver/redox.txt +++ b/libc-test/semver/redox.txt @@ -145,6 +145,7 @@ TCGETS TCP_KEEPIDLE TCSETS TIOCGPGRP +TIOCSCTTY TIOCSPGRP UTSLENGTH VDISCARD @@ -207,11 +208,13 @@ getservbyport getservent killpg lockf +login_tty madvise memalign nice open_memstream open_wmemstream +openpty pipe2 pthread_condattr_setclock qsort diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 915fc2c4780e2..19315c3872c88 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -729,6 +729,7 @@ pub const FIOCLEX: ::c_ulong = 0x5451; pub const TCGETS: ::c_ulong = 0x5401; pub const TCSETS: ::c_ulong = 0x5402; pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCSCTTY: ::c_ulong = 0x540E; pub const TIOCGPGRP: ::c_ulong = 0x540F; pub const TIOCSPGRP: ::c_ulong = 0x5410; pub const TIOCGWINSZ: ::c_ulong = 0x5413; @@ -1138,6 +1139,15 @@ extern "C" { clock_id: ::clockid_t, ) -> ::c_int; + //pty.h + pub fn openpty( + amaster: *mut ::c_int, + aslave: *mut ::c_int, + name: *mut ::c_char, + termp: *const termios, + winp: *const ::winsize, + ) -> ::c_int; + // pwd.h pub fn getpwent() -> *mut passwd; pub fn setpwent(); @@ -1173,9 +1183,15 @@ extern "C" { pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; // stdlib.h + pub fn getsubopt( + optionp: *mut *mut c_char, + tokens: *const *mut c_char, + valuep: *mut *mut c_char, + ) -> ::c_int; pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void; // string.h + pub fn explicit_bzero(p: *mut ::c_void, len: ::size_t); pub fn strlcat(dst: *mut ::c_char, src: *const ::c_char, siz: ::size_t) -> ::size_t; pub fn strlcpy(dst: *mut ::c_char, src: *const ::c_char, siz: ::size_t) -> ::size_t; @@ -1202,6 +1218,8 @@ extern "C" { pub fn shm_unlink(name: *const ::c_char) -> ::c_int; // sys/resource.h + pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; @@ -1230,17 +1248,8 @@ extern "C" { pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; - // strings.h - pub fn explicit_bzero(p: *mut ::c_void, len: ::size_t); - - pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; - pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; - - pub fn getsubopt( - optionp: *mut *mut c_char, - tokens: *const *mut c_char, - valuep: *mut *mut c_char, - ) -> ::c_int; + // utmp.h + pub fn login_tty(fd: ::c_int) -> ::c_int; } cfg_if! {