mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-09 11:58:16 +00:00
protocols: only build RLimit impls on Linux
The current version of the oci-spec crate compiles RLimit structs only for Linux and Solaris. Until this is fixed upstream, add compilation conditions to the type converters for the affected structs. Fixes: #10071 Signed-off-by: Markus Rudy <mr@edgeless.systems>
This commit is contained in:
parent
091a410b96
commit
df5e6e65b5
@ -97,6 +97,8 @@ impl From<oci::LinuxCapabilities> for grpc::LinuxCapabilities {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(burgerdev): remove condition here and below after upgrading to oci_spec > 0.7.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
impl From<oci::PosixRlimit> for grpc::POSIXRlimit {
|
impl From<oci::PosixRlimit> for grpc::POSIXRlimit {
|
||||||
fn from(from: oci::PosixRlimit) -> Self {
|
fn from(from: oci::PosixRlimit) -> Self {
|
||||||
grpc::POSIXRlimit {
|
grpc::POSIXRlimit {
|
||||||
@ -118,6 +120,7 @@ impl From<oci::Process> for grpc::Process {
|
|||||||
Env: option_vec_to_vec(from.env()),
|
Env: option_vec_to_vec(from.env()),
|
||||||
Cwd: from.cwd().display().to_string(),
|
Cwd: from.cwd().display().to_string(),
|
||||||
Capabilities: from_option(from.capabilities().clone()),
|
Capabilities: from_option(from.capabilities().clone()),
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
Rlimits: from_option_vec(from.rlimits().clone()),
|
Rlimits: from_option_vec(from.rlimits().clone()),
|
||||||
NoNewPrivileges: from.no_new_privileges().unwrap_or_default(),
|
NoNewPrivileges: from.no_new_privileges().unwrap_or_default(),
|
||||||
ApparmorProfile: from
|
ApparmorProfile: from
|
||||||
@ -993,6 +996,7 @@ impl From<grpc::Linux> for oci::Linux {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
impl From<grpc::POSIXRlimit> for oci::PosixRlimit {
|
impl From<grpc::POSIXRlimit> for oci::PosixRlimit {
|
||||||
fn from(proto: grpc::POSIXRlimit) -> Self {
|
fn from(proto: grpc::POSIXRlimit) -> Self {
|
||||||
oci::PosixRlimitBuilder::default()
|
oci::PosixRlimitBuilder::default()
|
||||||
@ -1078,6 +1082,8 @@ impl From<grpc::Process> for oci::Process {
|
|||||||
} else {
|
} else {
|
||||||
process.set_capabilities(None);
|
process.set_capabilities(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
if !from.Rlimits().is_empty() {
|
if !from.Rlimits().is_empty() {
|
||||||
process.set_rlimits(Some(
|
process.set_rlimits(Some(
|
||||||
from.Rlimits().iter().cloned().map(|r| r.into()).collect(),
|
from.Rlimits().iter().cloned().map(|r| r.into()).collect(),
|
||||||
|
Loading…
Reference in New Issue
Block a user