Skip to content

Commit fbfe4cc

Browse files
committed
PS Vita std support
1 parent 43082bf commit fbfe4cc

File tree

17 files changed

+236
-24
lines changed

17 files changed

+236
-24
lines changed

backtrace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 8ad84ca5ad88ade697637387e7cb4d7c3cf4bde8
1+
Subproject commit 4245978ca8169c40c088ff733825e4527f7b914c

std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
1515
panic_unwind = { path = "../panic_unwind", optional = true }
1616
panic_abort = { path = "../panic_abort" }
1717
core = { path = "../core" }
18-
libc = { version = "0.2.142", default-features = false, features = ['rustc-dep-of-std'] }
18+
libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'] }
1919
compiler_builtins = { version = "0.1.91" }
2020
profiler_builtins = { path = "../profiler_builtins", optional = true }
2121
unwind = { path = "../unwind" }

std/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ fn main() {
3434
|| target.contains("espidf")
3535
|| target.contains("solid")
3636
|| target.contains("nintendo-3ds")
37+
|| target.contains("vita")
3738
|| target.contains("nto")
3839
{
3940
// These platforms don't have any special requirements.

std/src/os/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ pub mod redox;
137137
pub mod solaris;
138138
#[cfg(target_os = "solid_asp3")]
139139
pub mod solid;
140+
#[cfg(target_os = "vita")]
141+
pub mod vita;
140142
#[cfg(target_os = "vxworks")]
141143
pub mod vxworks;
142144
#[cfg(target_os = "watchos")]

std/src/os/unix/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ mod platform {
7373
pub use crate::os::redox::*;
7474
#[cfg(target_os = "solaris")]
7575
pub use crate::os::solaris::*;
76+
#[cfg(target_os = "vita")]
77+
pub use crate::os::vita::*;
7678
#[cfg(target_os = "vxworks")]
7779
pub use crate::os::vxworks::*;
7880
#[cfg(target_os = "watchos")]

std/src/os/vita/fs.rs

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#![stable(feature = "metadata_ext", since = "1.1.0")]
2+
3+
use crate::fs::Metadata;
4+
use crate::sys_common::AsInner;
5+
6+
/// OS-specific extensions to [`fs::Metadata`].
7+
///
8+
/// [`fs::Metadata`]: crate::fs::Metadata
9+
#[stable(feature = "metadata_ext", since = "1.1.0")]
10+
pub trait MetadataExt {
11+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
12+
fn st_dev(&self) -> u64;
13+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
14+
fn st_ino(&self) -> u64;
15+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
16+
fn st_mode(&self) -> u32;
17+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
18+
fn st_nlink(&self) -> u64;
19+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
20+
fn st_uid(&self) -> u32;
21+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
22+
fn st_gid(&self) -> u32;
23+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
24+
fn st_rdev(&self) -> u64;
25+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
26+
fn st_size(&self) -> u64;
27+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
28+
fn st_atime(&self) -> i64;
29+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
30+
fn st_atime_nsec(&self) -> i64;
31+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
32+
fn st_mtime(&self) -> i64;
33+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
34+
fn st_mtime_nsec(&self) -> i64;
35+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
36+
fn st_ctime(&self) -> i64;
37+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
38+
fn st_ctime_nsec(&self) -> i64;
39+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
40+
fn st_blksize(&self) -> u64;
41+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
42+
fn st_blocks(&self) -> u64;
43+
}
44+
45+
#[stable(feature = "metadata_ext", since = "1.1.0")]
46+
impl MetadataExt for Metadata {
47+
fn st_dev(&self) -> u64 {
48+
self.as_inner().as_inner().st_dev as u64
49+
}
50+
fn st_ino(&self) -> u64 {
51+
self.as_inner().as_inner().st_ino as u64
52+
}
53+
fn st_mode(&self) -> u32 {
54+
self.as_inner().as_inner().st_mode as u32
55+
}
56+
fn st_nlink(&self) -> u64 {
57+
self.as_inner().as_inner().st_nlink as u64
58+
}
59+
fn st_uid(&self) -> u32 {
60+
self.as_inner().as_inner().st_uid as u32
61+
}
62+
fn st_gid(&self) -> u32 {
63+
self.as_inner().as_inner().st_gid as u32
64+
}
65+
fn st_rdev(&self) -> u64 {
66+
self.as_inner().as_inner().st_rdev as u64
67+
}
68+
fn st_size(&self) -> u64 {
69+
self.as_inner().as_inner().st_size as u64
70+
}
71+
fn st_atime(&self) -> i64 {
72+
self.as_inner().as_inner().st_atime as i64
73+
}
74+
fn st_atime_nsec(&self) -> i64 {
75+
0
76+
}
77+
fn st_mtime(&self) -> i64 {
78+
self.as_inner().as_inner().st_mtime as i64
79+
}
80+
fn st_mtime_nsec(&self) -> i64 {
81+
0
82+
}
83+
fn st_ctime(&self) -> i64 {
84+
self.as_inner().as_inner().st_ctime as i64
85+
}
86+
fn st_ctime_nsec(&self) -> i64 {
87+
0
88+
}
89+
fn st_blksize(&self) -> u64 {
90+
self.as_inner().as_inner().st_blksize as u64
91+
}
92+
fn st_blocks(&self) -> u64 {
93+
self.as_inner().as_inner().st_blocks as u64
94+
}
95+
}

std/src/os/vita/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! Definitions for vita
2+
3+
#![stable(feature = "raw_ext", since = "1.1.0")]
4+
5+
pub mod fs;
6+
pub(crate) mod raw;

std/src/os/vita/raw.rs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//! vita raw type definitions
2+
3+
#![stable(feature = "raw_ext", since = "1.1.0")]
4+
#![deprecated(
5+
since = "1.8.0",
6+
note = "these type aliases are no longer supported by \
7+
the standard library, the `libc` crate on \
8+
crates.io should be used instead for the correct \
9+
definitions"
10+
)]
11+
#![allow(deprecated)]
12+
13+
use crate::os::raw::c_long;
14+
use crate::os::unix::raw::{gid_t, uid_t};
15+
16+
#[stable(feature = "pthread_t", since = "1.8.0")]
17+
pub type pthread_t = libc::pthread_t;
18+
19+
#[stable(feature = "raw_ext", since = "1.1.0")]
20+
pub type blkcnt_t = libc::blkcnt_t;
21+
22+
#[stable(feature = "raw_ext", since = "1.1.0")]
23+
pub type blksize_t = libc::blksize_t;
24+
#[stable(feature = "raw_ext", since = "1.1.0")]
25+
pub type dev_t = libc::dev_t;
26+
#[stable(feature = "raw_ext", since = "1.1.0")]
27+
pub type ino_t = libc::ino_t;
28+
#[stable(feature = "raw_ext", since = "1.1.0")]
29+
pub type mode_t = libc::mode_t;
30+
#[stable(feature = "raw_ext", since = "1.1.0")]
31+
pub type nlink_t = libc::nlink_t;
32+
#[stable(feature = "raw_ext", since = "1.1.0")]
33+
pub type off_t = libc::off_t;
34+
35+
#[stable(feature = "raw_ext", since = "1.1.0")]
36+
pub type time_t = libc::time_t;
37+
38+
#[repr(C)]
39+
#[derive(Clone)]
40+
#[stable(feature = "raw_ext", since = "1.1.0")]
41+
pub struct stat {
42+
#[stable(feature = "raw_ext", since = "1.1.0")]
43+
pub st_dev: dev_t,
44+
#[stable(feature = "raw_ext", since = "1.1.0")]
45+
pub st_ino: ino_t,
46+
#[stable(feature = "raw_ext", since = "1.1.0")]
47+
pub st_mode: mode_t,
48+
#[stable(feature = "raw_ext", since = "1.1.0")]
49+
pub st_nlink: nlink_t,
50+
#[stable(feature = "raw_ext", since = "1.1.0")]
51+
pub st_uid: uid_t,
52+
#[stable(feature = "raw_ext", since = "1.1.0")]
53+
pub st_gid: gid_t,
54+
#[stable(feature = "raw_ext", since = "1.1.0")]
55+
pub st_rdev: dev_t,
56+
#[stable(feature = "raw_ext", since = "1.1.0")]
57+
pub st_size: off_t,
58+
#[stable(feature = "raw_ext", since = "1.1.0")]
59+
pub st_atime: time_t,
60+
#[stable(feature = "raw_ext", since = "1.1.0")]
61+
pub st_mtime: time_t,
62+
#[stable(feature = "raw_ext", since = "1.1.0")]
63+
pub st_ctime: time_t,
64+
#[stable(feature = "raw_ext", since = "1.1.0")]
65+
pub st_blksize: blksize_t,
66+
#[stable(feature = "raw_ext", since = "1.1.0")]
67+
pub st_blocks: blkcnt_t,
68+
#[stable(feature = "raw_ext", since = "1.1.0")]
69+
pub st_spare4: [c_long; 2usize],
70+
}

std/src/sys/unix/alloc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ cfg_if::cfg_if! {
5959
target_os = "redox",
6060
target_os = "solaris",
6161
target_os = "espidf",
62-
target_os = "horizon"
62+
target_os = "horizon",
63+
target_os = "vita",
6364
))] {
6465
#[inline]
6566
unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {

std/src/sys/unix/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ mod imp {
265265
}
266266
}
267267

268-
#[cfg(target_os = "espidf")]
268+
#[cfg(any(target_os = "espidf", target_os = "vita"))]
269269
mod imp {
270270
use super::Args;
271271

0 commit comments

Comments
 (0)