!26 fix build error on loongarch64

From: @zhangwenlong01
Reviewed-by: @jingwoo
Signed-off-by: @jingwoo
This commit is contained in:
openeuler-ci-bot 2024-10-31 11:16:15 +00:00 committed by xuxuepeng
commit 7d53cec95b
13 changed files with 1725 additions and 135 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,65 +0,0 @@
From 513a33a6432b3737d3b27d8276e32ebcadfcbeda Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Fri, 12 May 2023 17:12:55 +0800
Subject: [PATCH] add loongarch64 support for prost-build
---
...-loongarch64-support-for-prost-build.patch | 24 +++++++++++++++++++
vendor/prost-build/.cargo-checksum.json | 2 +-
vendor/prost-build/build.rs | 1 +
3 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 0001-add-loongarch64-support-for-prost-build.patch
diff --git a/0001-add-loongarch64-support-for-prost-build.patch b/0001-add-loongarch64-support-for-prost-build.patch
new file mode 100644
index 0000000..bdf12ba
--- /dev/null
+++ b/0001-add-loongarch64-support-for-prost-build.patch
@@ -0,0 +1,24 @@
+From ec95826dbb862419b631f8ac1b638fab1c40604c Mon Sep 17 00:00:00 2001
+From: Wenlong Zhang <zhangwenlong@loongson.cn>
+Date: Fri, 12 May 2023 17:12:55 +0800
+Subject: [PATCH] add loongarch64 support for prost-build
+
+---
+ vendor/prost-build/build.rs | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/vendor/prost-build/build.rs b/vendor/prost-build/build.rs
+index 6f3b0bf..24014b4 100644
+--- a/vendor/prost-build/build.rs
++++ b/vendor/prost-build/build.rs
+@@ -48,6 +48,7 @@ fn bundled_protoc() -> Option<PathBuf> {
+ ("linux", "x86") => "protoc-linux-x86_32",
+ ("linux", "x86_64") => "protoc-linux-x86_64",
+ ("linux", "aarch64") => "protoc-linux-aarch_64",
++ ("linux", "loongarch64") => "protoc-linux-loongarch_64",
+ ("macos", "x86_64") => "protoc-osx-x86_64",
+ ("windows", _) => "protoc-win32.exe",
+ _ => return None,
+--
+2.33.0
+
diff --git a/vendor/prost-build/.cargo-checksum.json b/vendor/prost-build/.cargo-checksum.json
index 8ec5939..30a17af 100644
--- a/vendor/prost-build/.cargo-checksum.json
+++ b/vendor/prost-build/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"520efe6811357bda5521ddf64e5093cdbf2e185c97ffc4a70c5c7d33c272e39c","README.md":"094d454ce347d8fbd4c70e6f79f082e7b6dfa4c9dbb381e5639037b88462c5d1","build.rs":"dcb015749ac7e222dc227982f2889519e328c4f6ccf48c09bc369c4216151af9","src/ast.rs":"c577e41ee140d8d2414cda49bf9b098d821a0a34f16cda7be45f2cec72f8edd5","src/code_generator.rs":"f957be408e3e795c5c59bf41af0ea742797569ca0e2c4fbbd4680d405e2ce4fe","src/extern_paths.rs":"a634f7ee45ae6e1d6d12ff3e9956f5244bdd4f7c5ff7bca6895b5dbb905bbc33","src/ident.rs":"bf6d6294f4ab6626632ba1e0f96b7acdc080cbb0b345619a0f07a9e6bcd3c0ae","src/lib.rs":"03cb4e8cb1188ee327595126884d8c778bbc22acca10f445f84ab89431810faf","src/message_graph.rs":"a21dbdc600e928fd9cbf8cbfbb90c685d12d0cf49d7972495d445e459a91f1fc","src/smoke_test.proto":"05068c3db3f1df2d5737eaaec730e42e3e58eb1d533df630fcb3dc138c7d8c9b","third-party/protobuf/LICENSE":"af67c58de2e18677a0b8cb5fffbe2232aabb8eb2930e8cd684769cef3d74a262","third-party/protobuf/README.md":"678126b0e9bc281ccff096d37726167e54ed8a53b8970b525104ed888ad54b7d","third-party/protobuf/include/google/protobuf/any.proto":"fbf886b5d2f6ac6872acfd61b2ab60f0abe1ecd8f359ed2e2b1276295ec5529a","third-party/protobuf/include/google/protobuf/api.proto":"dc01037a072410e5f7cd08c52fb6415acd6707b59ace2dfb4df878a6e016f9b8","third-party/protobuf/include/google/protobuf/compiler/plugin.proto":"63881dd80d7ddc345d5cc4dd495f6fc0a73fc475cedfc79c78c284ad0b3e8618","third-party/protobuf/include/google/protobuf/descriptor.proto":"7b98a2ab76635880b9fb9c830ea5feeeb43fd902e2532e779efd51e179b61c35","third-party/protobuf/include/google/protobuf/duration.proto":"933001db4a42dba2b99b4c6663b83c8ae0965765a5cbb6ca5da7bbc587741388","third-party/protobuf/include/google/protobuf/empty.proto":"b18e0cd44e0d054202c1403c48327180f3995d08ead2a6d4d012c0551a7a3563","third-party/protobuf/include/google/protobuf/field_mask.proto":"355146e9d480db65632f28a6fe59f6d9649a197c06e1a7b9198f113dcd773925","third-party/protobuf/include/google/protobuf/source_context.proto":"64ac204d47270547bde952a1c7a202d0af0c955292a21f513ef269f6f8a0c78d","third-party/protobuf/include/google/protobuf/struct.proto":"82b23cc319988977fd61eca7b6ad8f17269b36522ca24a06dde374005fa74353","third-party/protobuf/include/google/protobuf/timestamp.proto":"ea8f706782105b6e8150400a4d61895caad81bd6f3c8566f82d46b843bea21d2","third-party/protobuf/include/google/protobuf/type.proto":"e007d8d8763d564ea4724712cc737c60573a411c46572167c0236ec621d21de1","third-party/protobuf/include/google/protobuf/wrappers.proto":"0d0c7cf568359354d6fec5ddb63d80716807625cb13d3a69f5144742257eb1f9","third-party/protobuf/protoc-linux-aarch_64":"0213b5560ac69c9fe1401e073648213ffb73fbffa920e82c2b652708c0b50f88","third-party/protobuf/protoc-linux-x86_32":"bb189ba95422f9e3b85bb8270661ec4cfe70640891cb223acfbf6a90511ff95b","third-party/protobuf/protoc-linux-x86_64":"6ae3cdb31dc68d257f63ce8109b10b944c507ce7dfd493a66fc357e38062cd47","third-party/protobuf/protoc-osx-x86_64":"fd289988a18c461bc9e5c314c55d6a363ebede51a0e854a3b2d32da918a891eb","third-party/protobuf/protoc-win32.exe":"5b7121b3f1cd57efc2396b12605a3c4095770445c9637e0aab0d92a8a10c2482"},"package":"eb788126ea840817128183f8f603dce02cb7aea25c2a0b764359d8e20010702e"}
\ No newline at end of file
+{"files":{"Cargo.toml":"520efe6811357bda5521ddf64e5093cdbf2e185c97ffc4a70c5c7d33c272e39c","README.md":"094d454ce347d8fbd4c70e6f79f082e7b6dfa4c9dbb381e5639037b88462c5d1","build.rs":"2dec13595e93d55defb5df55da8a2397a7f66e965653405ff035b275f553fce9","src/ast.rs":"c577e41ee140d8d2414cda49bf9b098d821a0a34f16cda7be45f2cec72f8edd5","src/code_generator.rs":"f957be408e3e795c5c59bf41af0ea742797569ca0e2c4fbbd4680d405e2ce4fe","src/extern_paths.rs":"a634f7ee45ae6e1d6d12ff3e9956f5244bdd4f7c5ff7bca6895b5dbb905bbc33","src/ident.rs":"bf6d6294f4ab6626632ba1e0f96b7acdc080cbb0b345619a0f07a9e6bcd3c0ae","src/lib.rs":"03cb4e8cb1188ee327595126884d8c778bbc22acca10f445f84ab89431810faf","src/message_graph.rs":"a21dbdc600e928fd9cbf8cbfbb90c685d12d0cf49d7972495d445e459a91f1fc","src/smoke_test.proto":"05068c3db3f1df2d5737eaaec730e42e3e58eb1d533df630fcb3dc138c7d8c9b","third-party/protobuf/LICENSE":"af67c58de2e18677a0b8cb5fffbe2232aabb8eb2930e8cd684769cef3d74a262","third-party/protobuf/README.md":"678126b0e9bc281ccff096d37726167e54ed8a53b8970b525104ed888ad54b7d","third-party/protobuf/include/google/protobuf/any.proto":"fbf886b5d2f6ac6872acfd61b2ab60f0abe1ecd8f359ed2e2b1276295ec5529a","third-party/protobuf/include/google/protobuf/api.proto":"dc01037a072410e5f7cd08c52fb6415acd6707b59ace2dfb4df878a6e016f9b8","third-party/protobuf/include/google/protobuf/compiler/plugin.proto":"63881dd80d7ddc345d5cc4dd495f6fc0a73fc475cedfc79c78c284ad0b3e8618","third-party/protobuf/include/google/protobuf/descriptor.proto":"7b98a2ab76635880b9fb9c830ea5feeeb43fd902e2532e779efd51e179b61c35","third-party/protobuf/include/google/protobuf/duration.proto":"933001db4a42dba2b99b4c6663b83c8ae0965765a5cbb6ca5da7bbc587741388","third-party/protobuf/include/google/protobuf/empty.proto":"b18e0cd44e0d054202c1403c48327180f3995d08ead2a6d4d012c0551a7a3563","third-party/protobuf/include/google/protobuf/field_mask.proto":"355146e9d480db65632f28a6fe59f6d9649a197c06e1a7b9198f113dcd773925","third-party/protobuf/include/google/protobuf/source_context.proto":"64ac204d47270547bde952a1c7a202d0af0c955292a21f513ef269f6f8a0c78d","third-party/protobuf/include/google/protobuf/struct.proto":"82b23cc319988977fd61eca7b6ad8f17269b36522ca24a06dde374005fa74353","third-party/protobuf/include/google/protobuf/timestamp.proto":"ea8f706782105b6e8150400a4d61895caad81bd6f3c8566f82d46b843bea21d2","third-party/protobuf/include/google/protobuf/type.proto":"e007d8d8763d564ea4724712cc737c60573a411c46572167c0236ec621d21de1","third-party/protobuf/include/google/protobuf/wrappers.proto":"0d0c7cf568359354d6fec5ddb63d80716807625cb13d3a69f5144742257eb1f9","third-party/protobuf/protoc-linux-aarch_64":"0213b5560ac69c9fe1401e073648213ffb73fbffa920e82c2b652708c0b50f88","third-party/protobuf/protoc-linux-x86_32":"bb189ba95422f9e3b85bb8270661ec4cfe70640891cb223acfbf6a90511ff95b","third-party/protobuf/protoc-linux-x86_64":"6ae3cdb31dc68d257f63ce8109b10b944c507ce7dfd493a66fc357e38062cd47","third-party/protobuf/protoc-osx-x86_64":"fd289988a18c461bc9e5c314c55d6a363ebede51a0e854a3b2d32da918a891eb","third-party/protobuf/protoc-win32.exe":"5b7121b3f1cd57efc2396b12605a3c4095770445c9637e0aab0d92a8a10c2482"},"package":"eb788126ea840817128183f8f603dce02cb7aea25c2a0b764359d8e20010702e"}
diff --git a/vendor/prost-build/build.rs b/vendor/prost-build/build.rs
index 6f3b0bf..24014b4 100644
--- a/vendor/prost-build/build.rs
+++ b/vendor/prost-build/build.rs
@@ -48,6 +48,7 @@ fn bundled_protoc() -> Option<PathBuf> {
("linux", "x86") => "protoc-linux-x86_32",
("linux", "x86_64") => "protoc-linux-x86_64",
("linux", "aarch64") => "protoc-linux-aarch_64",
+ ("linux", "loongarch64") => "protoc-linux-loongarch_64",
("macos", "x86_64") => "protoc-osx-x86_64",
("windows", _) => "protoc-win32.exe",
_ => return None,
--
2.33.0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,28 @@
From 0faa4dfeb2158e14fd458a4d3836db6be7ab0214 Mon Sep 17 00:00:00 2001
From: jackey_1024 <jikui2@huawei.com>
Date: Mon, 21 Oct 2024 16:51:02 +0800
Subject: [PATCH] sandbox:sandbox api update
Signed-off-by: jackey_1024 <jikui2@huawei.com>
---
src/client/client.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/client/client.rs b/src/client/client.rs
index 2151e23..fe1b1c2 100644
--- a/src/client/client.rs
+++ b/src/client/client.rs
@@ -118,8 +118,8 @@ fn connect_to_unix_socket(abs: bool, address: &str) -> Result<RawFd> {
}
pub fn new_conn(container_id: &String, addr: &String) -> Result<()> {
- let fd = if addr.starts_with("vsock://") {
- let address = addr.strip_prefix("vsock://").unwrap();
+ let fd = if addr.starts_with("ttrpc+vsock://") {
+ let address = addr.strip_prefix("ttrpc+vsock://").unwrap();
connect_to_vsock(address)?
} else {
let address = if addr.starts_with("unix://") {
--
2.45.0

View File

@ -0,0 +1,28 @@
From 8b393e10d52876aef1c2c4ac0878eab6e1962f48 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Thu, 19 Dec 2024 15:11:16 +0800
Subject: [PATCH] add adapter for runc sandboxer
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
src/client/client.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/client/client.rs b/src/client/client.rs
index fe1b1c2..7323197 100644
--- a/src/client/client.rs
+++ b/src/client/client.rs
@@ -121,6 +121,10 @@ pub fn new_conn(container_id: &String, addr: &String) -> Result<()> {
let fd = if addr.starts_with("ttrpc+vsock://") {
let address = addr.strip_prefix("ttrpc+vsock://").unwrap();
connect_to_vsock(address)?
+ } else if addr.starts_with("ttrpc+unix://") {
+ let address = addr.strip_prefix("ttrpc+unix://").unwrap();
+ let path = Path::new(&MAIN_SEPARATOR.to_string()).join(address);
+ connect_to_unix_socket(!addr.starts_with("ttrpc+unix://"), &path.to_string_lossy())?
} else {
let address = if addr.starts_with("unix://") {
addr.strip_prefix("unix://").unwrap()
--
2.45.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,383 @@
From 2de35a3762ae9372cb4834211fdda9324bc215bb Mon Sep 17 00:00:00 2001
From: kamizjw <zhongjiawei1@huawei.com>
Date: Wed, 15 Jan 2025 15:27:30 +0800
Subject: [PATCH] lib-shim-v2:support stats cmd
---
build.rs | 1 +
shim_v2.h | 27 +++
src/client/client.rs | 22 +++
src/lib.rs | 73 +++++++-
src/protocols/mod.rs | 1 +
.../containerd/cgroup/stats/v1/metrics.proto | 158 ++++++++++++++++++
6 files changed, 281 insertions(+), 1 deletion(-)
create mode 100644 src/protocols/protos/github.com/containerd/cgroup/stats/v1/metrics.proto
diff --git a/build.rs b/build.rs
index dda0ccb..f572bc9 100644
--- a/build.rs
+++ b/build.rs
@@ -11,6 +11,7 @@ fn main() {
"src/protocols/protos/google/protobuf/timestamp.proto",
"src/protocols/protos/github.com/containerd/containerd/api/types/mount.proto",
"src/protocols/protos/github.com/containerd/containerd/api/types/task/task.proto",
+ "src/protocols/protos/github.com/containerd/cgroup/stats/v1/metrics.proto",
])
.include("src/protocols/protos")
.rust_protobuf()
diff --git a/shim_v2.h b/shim_v2.h
index 6a719f2..c19a809 100644
--- a/shim_v2.h
+++ b/shim_v2.h
@@ -41,6 +41,32 @@ struct State {
unsigned int exit_status;
};
+struct Stats {
+ uint64_t pids_current;
+ /* CPU usage */
+ uint64_t cpu_use_nanos;
+ uint64_t cpu_system_use;
+ /* BlkIO usage */
+ uint64_t blkio_read;
+ uint64_t blkio_write;
+ /* Memory usage */
+ uint64_t mem_used;
+ uint64_t mem_limit;
+ uint64_t rss_bytes;
+ uint64_t page_faults;
+ uint64_t major_page_faults;
+ /* Kernel Memory usage */
+ uint64_t kmem_used;
+ uint64_t kmem_limit;
+ /* Cache usage */
+ uint64_t cache;
+ uint64_t cache_total;
+ uint64_t inactive_file_total;
+ /* Swap usage*/
+ uint64_t swap_used;
+ uint64_t swap_limit;
+};
+
int shim_v2_new(const char *container_id, const char *addr);
int shim_v2_close(const char *container_id);
@@ -59,6 +85,7 @@ int shim_v2_pause(const char *container_id);
int shim_v2_resume(const char *container_id);
int shim_v2_state(const char *container_id, const struct State *state);
+int shim_v2_stats(const char *container_id, const struct Stats *stats);
int shim_v2_pids(const char *container_id, int *pid);
int shim_v2_wait(const char *container_id, const char *exec_id, int *exit_status);
diff --git a/src/client/client.rs b/src/client/client.rs
index 2151e23..40de955 100644
--- a/src/client/client.rs
+++ b/src/client/client.rs
@@ -11,7 +11,11 @@
// See the Mulan PSL v2 for more details.
use super::error::{Error, Result};
+use crate::protocols::metrics::Metrics;
use crate::protocols;
+use protobuf::{
+ CodedInputStream,Message,
+};
use lazy_static::lazy_static;
use nix::sys::socket::*;
use protocols::task::Status as shim_v2_status;
@@ -384,6 +388,24 @@ impl Store {
})
}
+ pub fn stats(&self) -> Result<Metrics> {
+ let client = protocols::shim_ttrpc::TaskClient::new(self.conn.clone());
+
+ let mut req = protocols::shim::StatsRequest::new();
+ req.id= self.container_id.clone();
+ let ctx = context::with_timeout(0);
+
+ let resp = client
+ .stats(ctx, &req)
+ .map_err(shim_error!(e, "ttrpc call stats failed"))?;
+ let mut m = Metrics::new();
+ if let Some(any) = resp.stats.as_ref() {
+ let mut input = CodedInputStream::from_bytes(any.value.as_ref());
+ m.merge_from(&mut input).unwrap();
+ }
+ Ok(m)
+ }
+
pub fn pids(&self) -> Result<i32> {
let c = protocols::shim_ttrpc::TaskClient::new(self.conn.clone());
diff --git a/src/lib.rs b/src/lib.rs
index b46d800..7c77187 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,7 +22,8 @@ use client::client::State as client_state;
use client::client::Status as client_status;
use client::client::{del_conn, get_conn, new_conn};
use std::ffi::{CStr, CString};
-use std::os::raw::{c_char, c_int, c_uint};
+use std::os::raw::{c_char, c_int, c_uint, c_ulonglong};
+use protocols::metrics::Metrics;
fn to_string(x: *const c_char) -> String {
unsafe {
@@ -371,6 +372,76 @@ pub extern "C" fn shim_v2_state(container_id: *const c_char, state: &mut State)
})
}
+#[repr(C)]
+pub struct Stats {
+ pids_current: c_ulonglong,
+ /* CPU usage */
+ cpu_use_nanos: c_ulonglong,
+ cpu_system_use: c_ulonglong,
+ /* BlkIO usage */
+ blkio_read: c_ulonglong,
+ blkio_write: c_ulonglong,
+ /* Memory usage */
+ mem_used: c_ulonglong,
+ mem_limit: c_ulonglong,
+ rss_bytes: c_ulonglong,
+ page_faults: c_ulonglong,
+ major_page_faults: c_ulonglong,
+ /* Kernel Memory usage */
+ kmem_used: c_ulonglong,
+ kmem_limit: c_ulonglong,
+ /* Cache usage */
+ cache: c_ulonglong,
+ cache_total: c_ulonglong,
+ inactive_file_total: c_ulonglong,
+ /* Swap usage*/
+ swap_used: c_ulonglong,
+ swap_limit: c_ulonglong,
+}
+
+impl Stats {
+ fn copy(&mut self, in_obj: Metrics) {
+ self.pids_current = in_obj.pids.current;
+ self.cpu_use_nanos = in_obj.cpu.usage.total;
+ self.cpu_system_use = in_obj.cpu.usage.kernel;
+ self.mem_used = in_obj.memory.usage.usage;
+ self.mem_limit = in_obj.memory.usage.limit;
+ self.rss_bytes = in_obj.memory.rss;
+ self.page_faults = in_obj.memory.pg_fault;
+ self.major_page_faults = in_obj.memory.pg_maj_fault;
+ self.kmem_used = in_obj.memory.kernel.usage;
+ self.kmem_limit = in_obj.memory.kernel.limit;
+ self.inactive_file_total = in_obj.memory.total_inactive_file;
+ self.swap_limit = in_obj.memory.swap.limit;
+ self.swap_used = in_obj.memory.swap.usage;
+ for ele in in_obj.blkio.io_service_bytes_recursive.iter() {
+ if ele.op == "read" {
+ self.blkio_read += ele.value;
+ } else {
+ self.blkio_write += ele.value;
+ }
+ }
+ }
+}
+
+#[no_mangle]
+pub extern "C" fn shim_v2_stats(container_id: *const c_char, stats: &mut Stats) -> c_int {
+ let r_container_id = to_string(container_id);
+ println!("lib-shim-v2::stats::{}::", r_container_id);
+ get_conn(&r_container_id)
+ .and_then(|client| {
+ client.stats().map(|metrics| {
+ println!("lib-shim-v2::metrics data::{:?}", metrics);
+ stats.copy(metrics);
+ 0
+ })
+ })
+ .unwrap_or_else(|e| {
+ println!("lib-shim-v2::stats::{}:: failed, {}.", r_container_id, e);
+ -1
+ })
+}
+
#[no_mangle]
pub extern "C" fn shim_v2_pids(container_id: *const c_char, pid: &mut c_int) -> c_int {
let r_container_id = to_string(container_id);
diff --git a/src/protocols/mod.rs b/src/protocols/mod.rs
index cc5794e..dfe4f42 100644
--- a/src/protocols/mod.rs
+++ b/src/protocols/mod.rs
@@ -13,6 +13,7 @@
pub mod any;
pub mod empty;
pub mod gogo;
+pub mod metrics;
pub mod mount;
pub mod shim;
pub mod shim_ttrpc;
diff --git a/src/protocols/protos/github.com/containerd/cgroup/stats/v1/metrics.proto b/src/protocols/protos/github.com/containerd/cgroup/stats/v1/metrics.proto
new file mode 100644
index 0000000..b3f6cc3
--- /dev/null
+++ b/src/protocols/protos/github.com/containerd/cgroup/stats/v1/metrics.proto
@@ -0,0 +1,158 @@
+syntax = "proto3";
+
+package io.containerd.cgroups.v1;
+
+import "gogoproto/gogo.proto";
+
+message Metrics {
+ repeated HugetlbStat hugetlb = 1;
+ PidsStat pids = 2;
+ CPUStat cpu = 3 [(gogoproto.customname) = "CPU"];
+ MemoryStat memory = 4;
+ BlkIOStat blkio = 5;
+ RdmaStat rdma = 6;
+ repeated NetworkStat network = 7;
+ CgroupStats cgroup_stats = 8;
+ MemoryOomControl memory_oom_control = 9;
+}
+
+message HugetlbStat {
+ uint64 usage = 1;
+ uint64 max = 2;
+ uint64 failcnt = 3;
+ string pagesize = 4;
+}
+
+message PidsStat {
+ uint64 current = 1;
+ uint64 limit = 2;
+}
+
+message CPUStat {
+ CPUUsage usage = 1;
+ Throttle throttling = 2;
+}
+
+message CPUUsage {
+ // values in nanoseconds
+ uint64 total = 1;
+ uint64 kernel = 2;
+ uint64 user = 3;
+ repeated uint64 per_cpu = 4 [(gogoproto.customname) = "PerCPU"];
+
+}
+
+message Throttle {
+ uint64 periods = 1;
+ uint64 throttled_periods = 2;
+ uint64 throttled_time = 3;
+}
+
+message MemoryStat {
+ uint64 cache = 1;
+ uint64 rss = 2 [(gogoproto.customname) = "RSS"];
+ uint64 rss_huge = 3 [(gogoproto.customname) = "RSSHuge"];
+ uint64 mapped_file = 4;
+ uint64 dirty = 5;
+ uint64 writeback = 6;
+ uint64 pg_pg_in = 7;
+ uint64 pg_pg_out = 8;
+ uint64 pg_fault = 9;
+ uint64 pg_maj_fault = 10;
+ uint64 inactive_anon = 11;
+ uint64 active_anon = 12;
+ uint64 inactive_file = 13;
+ uint64 active_file = 14;
+ uint64 unevictable = 15;
+ uint64 hierarchical_memory_limit = 16;
+ uint64 hierarchical_swap_limit = 17;
+ uint64 total_cache = 18;
+ uint64 total_rss = 19 [(gogoproto.customname) = "TotalRSS"];
+ uint64 total_rss_huge = 20 [(gogoproto.customname) = "TotalRSSHuge"];
+ uint64 total_mapped_file = 21;
+ uint64 total_dirty = 22;
+ uint64 total_writeback = 23;
+ uint64 total_pg_pg_in = 24;
+ uint64 total_pg_pg_out = 25;
+ uint64 total_pg_fault = 26;
+ uint64 total_pg_maj_fault = 27;
+ uint64 total_inactive_anon = 28;
+ uint64 total_active_anon = 29;
+ uint64 total_inactive_file = 30;
+ uint64 total_active_file = 31;
+ uint64 total_unevictable = 32;
+ MemoryEntry usage = 33;
+ MemoryEntry swap = 34;
+ MemoryEntry kernel = 35;
+ MemoryEntry kernel_tcp = 36 [(gogoproto.customname) = "KernelTCP"];
+
+}
+
+message MemoryEntry {
+ uint64 limit = 1;
+ uint64 usage = 2;
+ uint64 max = 3;
+ uint64 failcnt = 4;
+}
+
+message MemoryOomControl {
+ uint64 oom_kill_disable = 1;
+ uint64 under_oom = 2;
+ uint64 oom_kill = 3;
+}
+
+message BlkIOStat {
+ repeated BlkIOEntry io_service_bytes_recursive = 1;
+ repeated BlkIOEntry io_serviced_recursive = 2;
+ repeated BlkIOEntry io_queued_recursive = 3;
+ repeated BlkIOEntry io_service_time_recursive = 4;
+ repeated BlkIOEntry io_wait_time_recursive = 5;
+ repeated BlkIOEntry io_merged_recursive = 6;
+ repeated BlkIOEntry io_time_recursive = 7;
+ repeated BlkIOEntry sectors_recursive = 8;
+}
+
+message BlkIOEntry {
+ string op = 1;
+ string device = 2;
+ uint64 major = 3;
+ uint64 minor = 4;
+ uint64 value = 5;
+}
+
+message RdmaStat {
+ repeated RdmaEntry current = 1;
+ repeated RdmaEntry limit = 2;
+}
+
+message RdmaEntry {
+ string device = 1;
+ uint32 hca_handles = 2;
+ uint32 hca_objects = 3;
+}
+
+message NetworkStat {
+ string name = 1;
+ uint64 rx_bytes = 2;
+ uint64 rx_packets = 3;
+ uint64 rx_errors = 4;
+ uint64 rx_dropped = 5;
+ uint64 tx_bytes = 6;
+ uint64 tx_packets = 7;
+ uint64 tx_errors = 8;
+ uint64 tx_dropped = 9;
+}
+
+// CgroupStats exports per-cgroup statistics.
+message CgroupStats {
+ // number of tasks sleeping
+ uint64 nr_sleeping = 1;
+ // number of tasks running
+ uint64 nr_running = 2;
+ // number of tasks in stopped state
+ uint64 nr_stopped = 3;
+ // number of tasks in uninterruptible state
+ uint64 nr_uninterruptible = 4;
+ // number of tasks waiting on IO
+ uint64 nr_io_wait = 5;
+}
--
2.43.0

Binary file not shown.

View File

@ -7,7 +7,7 @@
Name: lib-shim-v2
Version: 0.0.1
Release: 8
Release: 10
URL: https://gitee.com/openeuler/lib-shim-v2
Source: %{name}-%{version}.tar.gz
Source1: libc.tar.gz
@ -16,24 +16,23 @@ Group: Application/System
License: Mulan PSL v2
ExclusiveArch: x86_64 aarch64 loongarch64 riscv64
%ifarch loongarch64
Patch01: 0001-add-loongarch64-support-for-nix.patch
Patch02: 0001-add-loongarch64-support-for-prost-build.patch
%endif
Patch03: 0002-add-riscv-support.patch
%ifarch riscv64
BuildRequires: protobuf-compiler
%endif
Patch04: 0004-simplify-Store-api-remove-unnecessary-validation.patch
Patch05: 0005-Check-if-a-path-is-abstract-before-connection.patch
Patch06: 0006-Add-vsock-support.patch
Patch01: 0001-lib-shim-v2-add-support-for-loongarch64.patch
Patch02: 0002-simplify-Store-api-remove-unnecessary-validation.patch
Patch03: 0003-Check-if-a-path-is-abstract-before-connection.patch
Patch04: 0004-Add-vsock-support.patch
Patch05: 0005-sandbox-sandbox-api-update.patch
Patch06: 0006-add-adapter-for-runc-sandboxer.patch
Patch07: 0007-update-dependent-protobuf-and-ttrpc-version.patch
Patch08: 0008-support-stats-cmd.patch
BuildRequires: rust
BuildRequires: cargo
BuildRequires: rust-packaging
BuildRequires: gcc
%ifarch riscv64
BuildRequires: protobuf-compiler
%endif
%description
Based on Rust programming language, as a shim v2 ttrpc client, it is called by iSulad.
@ -77,6 +76,15 @@ install -m 0755 target/release/libshim_v2.so ${RPM_BUILD_ROOT}/%{_libdir}/libshi
%{_includedir}/shim_v2.h
%changelog
* Wed Jan 15 2025 kamizjw <zhongjiawei1@huawei.com> - 0.0.1-10
- Type:NA
- ID:NA
- SUG:NA
- DESC: sync some patches
* Tue Oct 29 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 0.0.1-9
- fix build error on loongarch64
* Fri Sep 01 2023 xuxuepeng <xuxuepeng1@huawei.com> - 0.0.1-8
- Type:Enhancement
- ID:NA