Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redox: add openpty, login_tty, TIOCSCTTY, and organize functions #3512

Merged
merged 1 commit into from Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions libc-test/semver/redox.txt
Expand Up @@ -145,6 +145,7 @@ TCGETS
TCP_KEEPIDLE
TCSETS
TIOCGPGRP
TIOCSCTTY
TIOCSPGRP
UTSLENGTH
VDISCARD
Expand Down Expand Up @@ -207,11 +208,13 @@ getservbyport
getservent
killpg
lockf
login_tty
madvise
memalign
nice
open_memstream
open_wmemstream
openpty
pipe2
pthread_condattr_setclock
qsort
Expand Down
31 changes: 20 additions & 11 deletions src/unix/redox/mod.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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! {
Expand Down