1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-21 04:06:46 +00:00

sysutils/jail_exporter: fix build on ARM / POWER

Merge upstream commits:
3e65e8a490
0442527eb9
This commit is contained in:
Piotr Kubaj 2021-04-16 09:30:27 +00:00
parent 22a47a0e04
commit 78d8f6ea6e
3 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,29 @@
--- cargo-crates/jail-0.1.1/src/param.rs.orig 2021-04-16 09:13:39 UTC
+++ cargo-crates/jail-0.1.1/src/param.rs
@@ -640,7 +640,7 @@ pub fn get(jid: i32, name: &str) -> Result<Value, Jail
)
};
- let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut i8) }
+ let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut libc::c_char) }
.to_string_lossy()
.to_string();
@@ -676,7 +676,7 @@ pub fn get(jid: i32, name: &str) -> Result<Value, Jail
Type::S32 => Ok(Value::S32(LittleEndian::read_i32(&value))),
Type::U32 => Ok(Value::U32(LittleEndian::read_u32(&value))),
Type::String => Ok(Value::String({
- unsafe { CStr::from_ptr(value.as_ptr() as *mut i8) }
+ unsafe { CStr::from_ptr(value.as_ptr() as *mut libc::c_char) }
.to_string_lossy()
.into_owned()
})),
@@ -807,7 +807,7 @@ pub fn set(jid: i32, name: &str, value: Value) -> Resu
)
};
- let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut i8) }
+ let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut libc::c_char) }
.to_string_lossy()
.to_string();

View File

@ -0,0 +1,38 @@
--- cargo-crates/jail-0.1.1/src/sys.rs.orig 2021-04-16 09:14:49 UTC
+++ cargo-crates/jail-0.1.1/src/sys.rs
@@ -113,7 +113,7 @@ pub fn jail_create(
)
};
- let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut i8) }
+ let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut libc::c_char) }
.to_string_lossy()
.to_string();
@@ -171,7 +171,7 @@ pub fn jail_clearpersist(jid: i32) -> Result<(), JailE
)
};
- let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut i8) }
+ let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut libc::c_char) }
.to_string_lossy()
.to_string();
@@ -213,7 +213,7 @@ pub fn jail_getid(name: &str) -> Result<i32, JailError
)
};
- let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut i8) }
+ let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut libc::c_char) }
.to_string_lossy()
.to_string();
@@ -248,7 +248,7 @@ pub fn jail_nextjid(lastjid: i32) -> Result<i32, JailE
)
};
- let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut i8) }
+ let err = unsafe { CStr::from_ptr(errmsg.as_ptr() as *mut libc::c_char) }
.to_string_lossy()
.to_string();

View File

@ -0,0 +1,20 @@
--- cargo-crates/rctl-0.1.0/src/lib.rs.orig 2021-04-16 09:16:09 UTC
+++ cargo-crates/rctl-0.1.0/src/lib.rs
@@ -1825,7 +1825,7 @@ fn rctl_api_wrapper<S: Into<String>>(
loop {
// Unsafe C call to get the jail resource usage.
- if unsafe { api(inbuf.as_ptr(), inputlen, outbuf.as_mut_ptr(), outbuf.len()) } != 0 {
+ if unsafe { api(inbuf.as_ptr(), inputlen, outbuf.as_mut_ptr() as *mut libc::c_char, outbuf.len()) } != 0 {
let err = io::Error::last_os_error();
match err.raw_os_error() {
@@ -1850,7 +1850,7 @@ fn rctl_api_wrapper<S: Into<String>>(
// If everything went well, convert the return C string in the outbuf
// back into an easily usable Rust string and return.
- break Ok(unsafe { CStr::from_ptr(outbuf.as_ptr() as *mut i8) }
+ break Ok(unsafe { CStr::from_ptr(outbuf.as_ptr() as *mut libc::c_char) }
.to_string_lossy()
.into());
}