Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Apr 2021 09:30:30 GMT
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 78d8f6ea6e10 - main - sysutils/jail_exporter: fix build on ARM / POWER
Message-ID:  <202104160930.13G9UUNi073599@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=78d8f6ea6e108276959181649b5d074cb37e4e74

commit 78d8f6ea6e108276959181649b5d074cb37e4e74
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2021-04-16 09:30:27 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2021-04-16 09:30:27 +0000

    sysutils/jail_exporter: fix build on ARM / POWER
    
    Merge upstream commits:
    https://github.com/fubarnetes/libjail-rs/commit/3e65e8a490e5760ab977341a0a07aca349e9740c
    https://github.com/fubarnetes/rctl/commit/0442527eb98cdb66df810f6fb1ed95be1fc1184f
---
 .../patch-cargo-crates_jail-0.1.1_src_param.rs     | 29 +++++++++++++++++
 .../files/patch-cargo-crates_jail-0.1.1_src_sys.rs | 38 ++++++++++++++++++++++
 .../files/patch-cargo-crates_rctl-0.1.0_src_lib.rs | 20 ++++++++++++
 3 files changed, 87 insertions(+)

diff --git a/sysutils/jail_exporter/files/patch-cargo-crates_jail-0.1.1_src_param.rs b/sysutils/jail_exporter/files/patch-cargo-crates_jail-0.1.1_src_param.rs
new file mode 100644
index 000000000000..0c523dbd5bca
--- /dev/null
+++ b/sysutils/jail_exporter/files/patch-cargo-crates_jail-0.1.1_src_param.rs
@@ -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();
+ 
diff --git a/sysutils/jail_exporter/files/patch-cargo-crates_jail-0.1.1_src_sys.rs b/sysutils/jail_exporter/files/patch-cargo-crates_jail-0.1.1_src_sys.rs
new file mode 100644
index 000000000000..7ca344440c25
--- /dev/null
+++ b/sysutils/jail_exporter/files/patch-cargo-crates_jail-0.1.1_src_sys.rs
@@ -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();
+ 
diff --git a/sysutils/jail_exporter/files/patch-cargo-crates_rctl-0.1.0_src_lib.rs b/sysutils/jail_exporter/files/patch-cargo-crates_rctl-0.1.0_src_lib.rs
new file mode 100644
index 000000000000..40be14553ae5
--- /dev/null
+++ b/sysutils/jail_exporter/files/patch-cargo-crates_rctl-0.1.0_src_lib.rs
@@ -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());
+     }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104160930.13G9UUNi073599>