Skip to content

Commit 04fae4b

Browse files
committed
armv7 PSVita OS support via newlib
1 parent e4cccf9 commit 04fae4b

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

src/unix/newlib/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,9 @@ cfg_if! {
730730
} else if #[cfg(target_os = "horizon")] {
731731
mod horizon;
732732
pub use self::horizon::*;
733+
} else if #[cfg(target_os = "vita")] {
734+
mod vita;
735+
pub use self::vita::*;
733736
} else if #[cfg(target_arch = "arm")] {
734737
mod arm;
735738
pub use self::arm::*;

src/unix/newlib/vita/mod.rs

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
pub type clock_t = ::c_long;
2+
3+
pub type c_char = i8;
4+
pub type wchar_t = u32;
5+
6+
pub type c_long = i32;
7+
pub type c_ulong = u32;
8+
9+
s! {
10+
pub struct sockaddr {
11+
pub sa_family: ::sa_family_t,
12+
pub sa_data: [::c_char; 14],
13+
}
14+
15+
pub struct sockaddr_in6 {
16+
pub sin6_family: ::sa_family_t,
17+
pub sin6_port: ::in_port_t,
18+
pub sin6_flowinfo: u32,
19+
pub sin6_addr: ::in6_addr,
20+
pub sin6_scope_id: u32,
21+
}
22+
23+
pub struct sockaddr_in {
24+
pub sin_family: ::sa_family_t,
25+
pub sin_port: ::in_port_t,
26+
pub sin_addr: ::in_addr,
27+
pub sin_zero: [u8; 8],
28+
}
29+
30+
pub struct sockaddr_un {
31+
pub sun_len: ::c_uchar,
32+
pub sun_family: ::sa_family_t,
33+
pub sun_path: [::c_char; 104usize],
34+
}
35+
36+
pub struct sockaddr_storage {
37+
pub ss_family: ::sa_family_t,
38+
pub __ss_padding: [u8; 26],
39+
}
40+
41+
42+
pub struct sched_param {
43+
pub sched_priority: ::c_int,
44+
}
45+
}
46+
47+
pub const AF_UNIX: ::c_int = 1;
48+
pub const AF_INET6: ::c_int = 23;
49+
50+
pub const FIONBIO: ::c_ulong = 0x8004667e;
51+
52+
pub const POLLIN: ::c_short = 1;
53+
pub const POLLPRI: ::c_short = 2;
54+
pub const POLLOUT: ::c_short = 4;
55+
pub const POLLERR: ::c_short = 8;
56+
pub const POLLHUP: ::c_short = 16;
57+
pub const POLLNVAL: ::c_short = 32;
58+
59+
pub const RTLD_DEFAULT: *mut ::c_void = 0 as *mut ::c_void;
60+
61+
pub const SOL_SOCKET: ::c_int = 0xffff;
62+
63+
pub const MSG_OOB: ::c_int = 0x1;
64+
pub const MSG_PEEK: ::c_int = 0x2;
65+
pub const MSG_DONTROUTE: ::c_int = 0x4;
66+
pub const MSG_WAITALL: ::c_int = 0x8;
67+
pub const MSG_DONTWAIT: ::c_int = 0x10;
68+
pub const MSG_NOSIGNAL: ::c_int = 0x20;
69+
pub const MSG_TRUNC: ::c_int = 0x0100;
70+
pub const MSG_CTRUNC: ::c_int = 0x0200;
71+
72+
pub const UTIME_OMIT: c_long = -1;
73+
pub const AT_FDCWD: ::c_int = -2;
74+
75+
pub const O_DIRECTORY: ::c_int = 0x200000;
76+
pub const O_NOFOLLOW: ::c_int = 0x100000;
77+
78+
pub const AT_EACCESS: ::c_int = 1;
79+
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 2;
80+
pub const AT_SYMLINK_FOLLOW: ::c_int = 4;
81+
pub const AT_REMOVEDIR: ::c_int = 8;
82+
83+
pub const SIGHUP: ::c_int = 1;
84+
pub const SIGINT: ::c_int = 2;
85+
pub const SIGQUIT: ::c_int = 3;
86+
pub const SIGILL: ::c_int = 4;
87+
pub const SIGTRAP: ::c_int = 5;
88+
pub const SIGABRT: ::c_int = 6;
89+
pub const SIGEMT: ::c_int = 7;
90+
pub const SIGFPE: ::c_int = 8;
91+
pub const SIGKILL: ::c_int = 9;
92+
pub const SIGBUS: ::c_int = 10;
93+
pub const SIGSEGV: ::c_int = 11;
94+
pub const SIGSYS: ::c_int = 12;
95+
pub const SIGPIPE: ::c_int = 13;
96+
pub const SIGALRM: ::c_int = 14;
97+
pub const SIGTERM: ::c_int = 15;
98+
99+
pub const EAI_BADFLAGS: ::c_int = -1;
100+
pub const EAI_NONAME: ::c_int = -2;
101+
pub const EAI_AGAIN: ::c_int = -3;
102+
pub const EAI_FAIL: ::c_int = -4;
103+
pub const EAI_NODATA: ::c_int = -5;
104+
pub const EAI_FAMILY: ::c_int = -6;
105+
pub const EAI_SOCKTYPE: ::c_int = -7;
106+
pub const EAI_SERVICE: ::c_int = -8;
107+
pub const EAI_ADDRFAMILY: ::c_int = -9;
108+
pub const EAI_MEMORY: ::c_int = -10;
109+
pub const EAI_SYSTEM: ::c_int = -11;
110+
pub const EAI_OVERFLOW: ::c_int = -12;
111+
112+
pub const _SC_PAGESIZE: ::c_int = 8;
113+
pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 51;
114+
pub const PTHREAD_STACK_MIN: ::size_t = 200;
115+
116+
extern "C" {
117+
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
118+
pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
119+
pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
120+
121+
pub fn pthread_create(
122+
native: *mut ::pthread_t,
123+
attr: *const ::pthread_attr_t,
124+
f: extern "C" fn(_: *mut ::c_void) -> *mut ::c_void,
125+
value: *mut ::c_void,
126+
) -> ::c_int;
127+
128+
pub fn pthread_attr_getschedparam(
129+
attr: *const ::pthread_attr_t,
130+
param: *mut sched_param,
131+
) -> ::c_int;
132+
133+
pub fn pthread_attr_setschedparam(
134+
attr: *mut ::pthread_attr_t,
135+
param: *const sched_param,
136+
) -> ::c_int;
137+
138+
pub fn pthread_attr_getprocessorid_np(
139+
attr: *const ::pthread_attr_t,
140+
processor_id: *mut ::c_int,
141+
) -> ::c_int;
142+
143+
pub fn pthread_attr_setprocessorid_np(
144+
attr: *mut ::pthread_attr_t,
145+
processor_id: ::c_int,
146+
) -> ::c_int;
147+
148+
pub fn pthread_getschedparam(
149+
native: ::pthread_t,
150+
policy: *mut ::c_int,
151+
param: *mut ::sched_param,
152+
) -> ::c_int;
153+
154+
pub fn pthread_setschedparam(
155+
native: ::pthread_t,
156+
policy: ::c_int,
157+
param: *const ::sched_param,
158+
) -> ::c_int;
159+
160+
pub fn pthread_condattr_getclock(
161+
attr: *const ::pthread_condattr_t,
162+
clock_id: *mut ::clockid_t,
163+
) -> ::c_int;
164+
165+
pub fn pthread_condattr_setclock(
166+
attr: *mut ::pthread_condattr_t,
167+
clock_id: ::clockid_t,
168+
) -> ::c_int;
169+
170+
pub fn pthread_getprocessorid_np() -> ::c_int;
171+
}
172+
173+
pub use crate::unix::newlib::generic::{sigset_t, stat};

0 commit comments

Comments
 (0)