Skip to content

Commit ee1551a

Browse files
committed
Auto merge of #3512 - redox-os:redox_0.2.151, r=JohnTitor
redox: add openpty, login_tty, TIOCSCTTY, and organize functions The added items are used by terminal programs. I have organized some functions that were not sorted by header name. Sorting by header name makes it easier to keep this in sync with the Redox OS libc, `relibc`.
2 parents a2956cf + a6191c5 commit ee1551a

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

libc-test/semver/redox.txt

+3
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ TCGETS
145145
TCP_KEEPIDLE
146146
TCSETS
147147
TIOCGPGRP
148+
TIOCSCTTY
148149
TIOCSPGRP
149150
UTSLENGTH
150151
VDISCARD
@@ -207,11 +208,13 @@ getservbyport
207208
getservent
208209
killpg
209210
lockf
211+
login_tty
210212
madvise
211213
memalign
212214
nice
213215
open_memstream
214216
open_wmemstream
217+
openpty
215218
pipe2
216219
pthread_condattr_setclock
217220
qsort

src/unix/redox/mod.rs

+20-11
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ pub const FIOCLEX: ::c_ulong = 0x5451;
729729
pub const TCGETS: ::c_ulong = 0x5401;
730730
pub const TCSETS: ::c_ulong = 0x5402;
731731
pub const TCFLSH: ::c_ulong = 0x540B;
732+
pub const TIOCSCTTY: ::c_ulong = 0x540E;
732733
pub const TIOCGPGRP: ::c_ulong = 0x540F;
733734
pub const TIOCSPGRP: ::c_ulong = 0x5410;
734735
pub const TIOCGWINSZ: ::c_ulong = 0x5413;
@@ -1138,6 +1139,15 @@ extern "C" {
11381139
clock_id: ::clockid_t,
11391140
) -> ::c_int;
11401141

1142+
//pty.h
1143+
pub fn openpty(
1144+
amaster: *mut ::c_int,
1145+
aslave: *mut ::c_int,
1146+
name: *mut ::c_char,
1147+
termp: *const termios,
1148+
winp: *const ::winsize,
1149+
) -> ::c_int;
1150+
11411151
// pwd.h
11421152
pub fn getpwent() -> *mut passwd;
11431153
pub fn setpwent();
@@ -1173,9 +1183,15 @@ extern "C" {
11731183
pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
11741184

11751185
// stdlib.h
1186+
pub fn getsubopt(
1187+
optionp: *mut *mut c_char,
1188+
tokens: *const *mut c_char,
1189+
valuep: *mut *mut c_char,
1190+
) -> ::c_int;
11761191
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
11771192

11781193
// string.h
1194+
pub fn explicit_bzero(p: *mut ::c_void, len: ::size_t);
11791195
pub fn strlcat(dst: *mut ::c_char, src: *const ::c_char, siz: ::size_t) -> ::size_t;
11801196
pub fn strlcpy(dst: *mut ::c_char, src: *const ::c_char, siz: ::size_t) -> ::size_t;
11811197

@@ -1202,6 +1218,8 @@ extern "C" {
12021218
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
12031219

12041220
// sys/resource.h
1221+
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
1222+
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
12051223
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
12061224
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
12071225

@@ -1230,17 +1248,8 @@ extern "C" {
12301248
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
12311249
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
12321250

1233-
// strings.h
1234-
pub fn explicit_bzero(p: *mut ::c_void, len: ::size_t);
1235-
1236-
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
1237-
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
1238-
1239-
pub fn getsubopt(
1240-
optionp: *mut *mut c_char,
1241-
tokens: *const *mut c_char,
1242-
valuep: *mut *mut c_char,
1243-
) -> ::c_int;
1251+
// utmp.h
1252+
pub fn login_tty(fd: ::c_int) -> ::c_int;
12441253
}
12451254

12461255
cfg_if! {

0 commit comments

Comments
 (0)