aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/sys
diff options
context:
space:
mode:
authorFenrirWolf <[email protected]>2018-06-10 11:49:19 -0600
committerGitHub <[email protected]>2018-06-10 11:49:19 -0600
commit49041a4e56a4cab33ae7889537d33670e8b012fb (patch)
tree0c931e8716200f9aa8c7daef47b62474d0285d5c /ctr-std/src/sys
parentMerge pull request #69 from FenrirWolf/libctru-1.5.0 (diff)
parentFixes according to Fenrir's review (diff)
downloadctru-rs-49041a4e56a4cab33ae7889537d33670e8b012fb.tar.xz
ctru-rs-49041a4e56a4cab33ae7889537d33670e8b012fb.zip
Merge pull request #68 from linouxis9/master
Update for latest nightly 2018-05-06
Diffstat (limited to 'ctr-std/src/sys')
-rw-r--r--ctr-std/src/sys/unix/ext/raw.rs15
-rw-r--r--ctr-std/src/sys/unix/fs.rs34
-rw-r--r--ctr-std/src/sys/unix/mod.rs2
-rw-r--r--ctr-std/src/sys/unix/net.rs2
-rw-r--r--ctr-std/src/sys/unix/os.rs4
5 files changed, 25 insertions, 32 deletions
diff --git a/ctr-std/src/sys/unix/ext/raw.rs b/ctr-std/src/sys/unix/ext/raw.rs
index 7e4a439..a51f5c1 100644
--- a/ctr-std/src/sys/unix/ext/raw.rs
+++ b/ctr-std/src/sys/unix/ext/raw.rs
@@ -18,16 +18,11 @@
definitions")]
#![allow(deprecated, warnings)]
+#[allow(missing_docs)]
#[stable(feature = "raw_ext", since = "1.1.0")] pub type uid_t = u32;
+
+#[allow(missing_docs)]
#[stable(feature = "raw_ext", since = "1.1.0")] pub type gid_t = u32;
-#[stable(feature = "raw_ext", since = "1.1.0")] pub type pid_t = i32;
-#[doc(inline)]
-#[stable(feature = "pthread_t", since = "1.8.0")]
-pub use sys::platform::raw::pthread_t;
-#[doc(inline)]
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub use sys::platform::raw::{dev_t, ino_t, mode_t, nlink_t, off_t, blksize_t};
-#[doc(inline)]
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub use sys::platform::raw::{blkcnt_t, time_t};
+#[allow(missing_docs)]
+#[stable(feature = "raw_ext", since = "1.1.0")] pub type pid_t = i32;
diff --git a/ctr-std/src/sys/unix/fs.rs b/ctr-std/src/sys/unix/fs.rs
index f30b270..9dba863 100644
--- a/ctr-std/src/sys/unix/fs.rs
+++ b/ctr-std/src/sys/unix/fs.rs
@@ -177,7 +177,7 @@ impl Iterator for ReadDir {
}
}
- let name = (*entry_ptr).d_name.as_ptr();
+ let name = (*entry_ptr).d_name.as_ptr() as *const _;
let namelen = libc::strlen(name) as usize;
let ret = DirEntry {
@@ -261,7 +261,7 @@ impl DirEntry {
fn name_bytes(&self) -> &[u8] {
unsafe {
- CStr::from_ptr(self.entry.d_name.as_ptr()).to_bytes()
+ CStr::from_ptr(self.entry.d_name.as_ptr() as *const _).to_bytes()
}
}
}
@@ -338,7 +338,7 @@ impl File {
opts.get_creation_mode()? |
(opts.custom_flags as c_int & !libc::O_ACCMODE);
let fd = cvt_r(|| unsafe {
- open64(path.as_ptr(), flags, opts.mode as c_int)
+ open64(path.as_ptr() as *const _, flags, opts.mode as c_int)
})?;
let fd = FileDesc::new(fd);
@@ -439,7 +439,7 @@ impl DirBuilder {
pub fn mkdir(&self, p: &Path) -> io::Result<()> {
let p = cstr(p)?;
- cvt(unsafe { libc::mkdir(p.as_ptr(), self.mode) })?;
+ cvt(unsafe { libc::mkdir(p.as_ptr() as *const _, self.mode) })?;
Ok(())
}
@@ -475,7 +475,7 @@ impl fmt::Debug for File {
// alternatives. If a better method is invented, it should be used
// instead.
let mut buf = vec![0;libc::PATH_MAX as usize];
- let n = unsafe { libc::fcntl(fd, libc::F_GETPATH, buf.as_ptr()) };
+ let n = unsafe { libc::fcntl(fd, libc::F_GETPATH, buf.as_ptr() as *const _) };
if n == -1 {
return None;
}
@@ -528,7 +528,7 @@ pub fn readdir(p: &Path) -> io::Result<ReadDir> {
let root = Arc::new(p.to_path_buf());
let p = cstr(p)?;
unsafe {
- let ptr = libc::opendir(p.as_ptr());
+ let ptr = libc::opendir(p.as_ptr() as *const _);
if ptr.is_null() {
Err(Error::last_os_error())
} else {
@@ -539,26 +539,26 @@ pub fn readdir(p: &Path) -> io::Result<ReadDir> {
pub fn unlink(p: &Path) -> io::Result<()> {
let p = cstr(p)?;
- cvt(unsafe { libc::unlink(p.as_ptr()) })?;
+ cvt(unsafe { libc::unlink(p.as_ptr() as *const _) })?;
Ok(())
}
pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
let old = cstr(old)?;
let new = cstr(new)?;
- cvt(unsafe { libc::rename(old.as_ptr(), new.as_ptr()) })?;
+ cvt(unsafe { libc::rename(old.as_ptr() as *const _, new.as_ptr() as *const _) })?;
Ok(())
}
pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {
let p = cstr(p)?;
- cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) })?;
+ cvt_r(|| unsafe { libc::chmod(p.as_ptr() as *const _, perm.mode) })?;
Ok(())
}
pub fn rmdir(p: &Path) -> io::Result<()> {
let p = cstr(p)?;
- cvt(unsafe { libc::rmdir(p.as_ptr()) })?;
+ cvt(unsafe { libc::rmdir(p.as_ptr() as *const _) })?;
Ok(())
}
@@ -585,7 +585,7 @@ fn remove_dir_all_recursive(path: &Path) -> io::Result<()> {
pub fn readlink(p: &Path) -> io::Result<PathBuf> {
let c_path = cstr(p)?;
- let p = c_path.as_ptr();
+ let p = c_path.as_ptr() as *const _;
let mut buf = Vec::with_capacity(256);
@@ -612,14 +612,14 @@ pub fn readlink(p: &Path) -> io::Result<PathBuf> {
pub fn symlink(src: &Path, dst: &Path) -> io::Result<()> {
let src = cstr(src)?;
let dst = cstr(dst)?;
- cvt(unsafe { libc::symlink(src.as_ptr(), dst.as_ptr()) })?;
+ cvt(unsafe { libc::symlink(src.as_ptr() as *const _, dst.as_ptr() as *const _) })?;
Ok(())
}
pub fn link(src: &Path, dst: &Path) -> io::Result<()> {
let src = cstr(src)?;
let dst = cstr(dst)?;
- cvt(unsafe { libc::link(src.as_ptr(), dst.as_ptr()) })?;
+ cvt(unsafe { libc::link(src.as_ptr() as *const _, dst.as_ptr() as *const _) })?;
Ok(())
}
@@ -627,7 +627,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
let p = cstr(p)?;
let mut stat: stat64 = unsafe { mem::zeroed() };
cvt(unsafe {
- stat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
+ stat64(p.as_ptr() as *const _, &mut stat as *mut _ as *mut _)
})?;
Ok(FileAttr { stat: stat })
}
@@ -636,7 +636,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
let p = cstr(p)?;
let mut stat: stat64 = unsafe { mem::zeroed() };
cvt(unsafe {
- lstat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
+ lstat64(p.as_ptr() as *const _, &mut stat as *mut _ as *mut _)
})?;
Ok(FileAttr { stat: stat })
}
@@ -645,11 +645,11 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
let path = CString::new(p.as_os_str().as_bytes())?;
let buf;
unsafe {
- let r = libc::realpath(path.as_ptr(), ptr::null_mut());
+ let r = libc::realpath(path.as_ptr() as *const _, ptr::null_mut());
if r.is_null() {
return Err(io::Error::last_os_error())
}
- buf = CStr::from_ptr(r).to_bytes().to_vec();
+ buf = CStr::from_ptr(r as *const _).to_bytes().to_vec();
libc::free(r as *mut _);
}
Ok(PathBuf::from(OsString::from_vec(buf)))
diff --git a/ctr-std/src/sys/unix/mod.rs b/ctr-std/src/sys/unix/mod.rs
index 11be366..829f6f0 100644
--- a/ctr-std/src/sys/unix/mod.rs
+++ b/ctr-std/src/sys/unix/mod.rs
@@ -13,8 +13,6 @@
use io::{self, ErrorKind};
use libc;
-#[cfg(any(dox, target_os = "linux", target_os = "horizon"))] pub use os::linux as platform;
-
pub use self::rand::hashmap_random_keys;
pub use libc::strlen;
diff --git a/ctr-std/src/sys/unix/net.rs b/ctr-std/src/sys/unix/net.rs
index a056aec..94f757d 100644
--- a/ctr-std/src/sys/unix/net.rs
+++ b/ctr-std/src/sys/unix/net.rs
@@ -59,7 +59,7 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> {
}
let detail = unsafe {
- str::from_utf8(CStr::from_ptr(libc::gai_strerror(err)).to_bytes()).unwrap()
+ str::from_utf8(CStr::from_ptr(libc::gai_strerror(err) as *const _).to_bytes()).unwrap()
.to_owned()
};
Err(io::Error::new(io::ErrorKind::Other,
diff --git a/ctr-std/src/sys/unix/os.rs b/ctr-std/src/sys/unix/os.rs
index 5de756d..3a944dc 100644
--- a/ctr-std/src/sys/unix/os.rs
+++ b/ctr-std/src/sys/unix/os.rs
@@ -61,7 +61,7 @@ pub fn getcwd() -> io::Result<PathBuf> {
unsafe {
let ptr = buf.as_mut_ptr() as *mut libc::c_char;
if !libc::getcwd(ptr, buf.capacity()).is_null() {
- let len = CStr::from_ptr(buf.as_ptr() as *const libc::c_char).to_bytes().len();
+ let len = CStr::from_ptr(buf.as_ptr() as *const _).to_bytes().len();
buf.set_len(len);
buf.shrink_to_fit();
return Ok(PathBuf::from(OsString::from_vec(buf)));
@@ -85,7 +85,7 @@ pub fn chdir(p: &path::Path) -> io::Result<()> {
let p: &OsStr = p.as_ref();
let p = CString::new(p.as_bytes())?;
unsafe {
- match libc::chdir(p.as_ptr()) == (0 as c_int) {
+ match libc::chdir(p.as_ptr() as *const _) == (0 as c_int) {
true => Ok(()),
false => Err(io::Error::last_os_error()),
}