12 2020 档案

Effectively Using Iterators In Rust
摘要:iter()通过引用遍历项目 into_iter()遍历项目,将其移至新范围 iter_mut()遍历项目,为每个项目提供可变的引用 因此,for x in my_vec { ... }本质上等效于my_vec.into_iter().for_each(|x| ... )-将my_vec的两个元素都 阅读全文

posted @ 2020-12-30 11:27 tycoon3 阅读(112) 评论(0) 推荐(0) 编辑

Containers and Security: Seccomp
摘要:When working with potentially dangerous, unverified, or simply raw software, developers often use sandboxes. These are special environments that isola 阅读全文

posted @ 2020-12-30 09:37 tycoon3 阅读(190) 评论(0) 推荐(0) 编辑

Denying Syscalls with Seccomp
摘要:The web is an ugly place, and anything that touches it in any significant capacity is likely to be attacked. Programs are full of bugs and exploits, a 阅读全文

posted @ 2020-12-30 09:35 tycoon3 阅读(102) 评论(0) 推荐(0) 编辑

Introduction to seccomp: BPF linux syscall filter
摘要:Seccomp is basic yet efficient way to filter syscalls issued by a program. It is especially useful when running untrusted third party programs. Actual 阅读全文

posted @ 2020-12-30 09:15 tycoon3 阅读(321) 评论(0) 推荐(0) 编辑

Docker安装Go go1.15
摘要:Docker安装Go 用docker安装go,可能不是最好的方法,但一定是最方便的方法 # 指定容器名为go115 docker run -it --name go115 golang:1.15 /bin/bash 你可以通过加上-v ~:/home/me参数,表示将家目录挂载到/home/me目录 阅读全文

posted @ 2020-12-29 19:38 tycoon3 阅读(1022) 评论(0) 推荐(0) 编辑

missing: OPENSSL_CRYPTO_LIBRARY
摘要:CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find OpenSSL, try to set the path to OpenSSL 阅读全文

posted @ 2020-12-29 16:35 tycoon3 阅读(4936) 评论(0) 推荐(0) 编辑

rust FnMut 闭包
摘要:fn consume_with_relish<F>(mut func: F) where F: FnMut() -> String { // `func` consumes its captured variables, so it cannot be run more // than once p 阅读全文

posted @ 2020-12-29 15:42 tycoon3 阅读(248) 评论(0) 推荐(0) 编辑

cloud-hypervisor coredump
摘要:[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1". Core was generated by `cloud 阅读全文

posted @ 2020-12-29 14:59 tycoon3 阅读(205) 评论(0) 推荐(0) 编辑

Installing Bazel on Ubuntu
摘要:https://docs.bazel.build/versions/master/install-ubuntu.html his page describes the options for installing Bazel on Ubuntu. It also provides links to 阅读全文

posted @ 2020-12-29 11:04 tycoon3 阅读(328) 评论(0) 推荐(0) 编辑

github 查看comits
摘要: 阅读全文

posted @ 2020-12-29 10:33 tycoon3 阅读(69) 评论(0) 推荐(0) 编辑

rust 迭代器
摘要:https://blog.csdn.net/guiqulaxi920/article/details/78823541 fn main() { // Basic Range (exclusive on the right) for i in 1..11 { print!("{} ", i); } p 阅读全文

posted @ 2020-12-28 17:39 tycoon3 阅读(135) 评论(0) 推荐(0) 编辑

Rust:迭代器(Iterator)
摘要:https://github.com/rustomax/rust-iterators 1、迭代器是什么? 迭代器(iterator)负责遍历序列中的每一项和决定序列何时结束的逻辑,迭代器是 惰性的(lazy)。迭代器模式允许你对一个项的序列进行某些处理。 let v = vec![1, 2, 3]; 阅读全文

posted @ 2020-12-28 17:25 tycoon3 阅读(512) 评论(0) 推荐(0) 编辑

rust async
摘要:use futures::{ self, executor}; use std::thread; use std::time; async fn song() { loop { println!("song!"); thread::sleep(time::Duration::from_secs(5) 阅读全文

posted @ 2020-12-28 15:45 tycoon3 阅读(217) 评论(0) 推荐(0) 编辑

rust clone
摘要:use std::sync::Arc; let foo = Arc::new(vec![1.0, 2.0, 3.0]); // The two syntaxes below are equivalent. let a = foo.clone(); let b = Arc::clone(&foo); 阅读全文

posted @ 2020-12-28 14:58 tycoon3 阅读(153) 评论(0) 推荐(0) 编辑

rust panicked
摘要:use std::thread; use std::time; use std::sync::mpsc; fn main() { let (tx, rx) : (mpsc::Sender<i32>, mpsc::Receiver<i32>) = mpsc::channel(); //drop(rx) 阅读全文

posted @ 2020-12-28 14:30 tycoon3 阅读(171) 评论(0) 推荐(0) 编辑

Rust“所有权”思想
摘要:fn main() { let s1 = String::from("hello"); let s2 = s1; println!("s1 : {}", s1); let s3 = s2.clone(); println!("s2 : {}", s2); println!("s3 : {}", s3 阅读全文

posted @ 2020-12-28 11:35 tycoon3 阅读(330) 评论(0) 推荐(0) 编辑

Rust学习 mutex
摘要:use std::sync::Mutex; fn main() { let m = Mutex::new(5); //Mutex<i32>, 智能指针 { let mut num = m.lock().unwrap(); //等待,阻塞线程, //返回MutexGuard, 智能指针,实施deref 阅读全文

posted @ 2020-12-28 11:10 tycoon3 阅读(872) 评论(0) 推荐(1) 编辑

How Arc works in Rust
摘要:The Atomic Reference Counter (Arc) type is a smart pointer that lets you share immutable data across threads in a thread-safe way. I couldn’t find any 阅读全文

posted @ 2020-12-28 10:41 tycoon3 阅读(67) 评论(0) 推荐(0) 编辑

Handmade Rust Part 1: Introduction & Allocators
摘要:Blog series Part 1: Introduction & Allocators Part 2: Unq, an allocator-aware Box Part 3: Containers Part 4: Generating Vulkan bindings Welcome to Han 阅读全文

posted @ 2020-12-28 10:26 tycoon3 阅读(91) 评论(0) 推荐(0) 编辑

rust 强制转换
摘要:use std::ops::Deref; struct MyBox<T>(T); impl<T> MyBox<T> { fn new(x: T) -> MyBox<T> { MyBox(x) } } //impl<T> Deref for MyBox<T> { // type Target = T; 阅读全文

posted @ 2020-12-28 09:52 tycoon3 阅读(422) 评论(0) 推荐(0) 编辑

引用与借用
摘要:https://kaisery.github.io/trpl-zh-cn/ch04-02-references-and-borrowing.html 示例 4-5 中的元组代码有这样一个问题:我们必须将 String 返回给调用函数,以便在调用 calculate_length 后仍能使用 Stri 阅读全文

posted @ 2020-12-28 09:28 tycoon3 阅读(360) 评论(0) 推荐(0) 编辑

candidate #1: `std::clone::Clone`
摘要:struct Rec { width : u32, length : u32 } fn process(rec1: Rec) -> Rec { let mut rec2 = rec1; rec2.width = 10; rec2.length = 11; rec2 } fn main() { let 阅读全文

posted @ 2020-12-26 22:28 tycoon3 阅读(145) 评论(0) 推荐(0) 编辑

value used here after move
摘要:[root@bogon fnmut]# cat src/main.rs #[derive(Debug)] struct f_closure{ name: String, } impl f_closure{ fn fn_call( self) -> String{ self.name } } fn g 阅读全文

posted @ 2020-12-26 12:08 tycoon3 阅读(348) 评论(0) 推荐(0) 编辑

cannot borrow as mutable
摘要:cat src/main.rs #[derive(Debug)] struct f_closure{ name: String, } impl f_closure{ fn fn_call( self) -> String{ self.name } } fn get_string<T>(name: S 阅读全文

posted @ 2020-12-26 12:02 tycoon3 阅读(940) 评论(0) 推荐(0) 编辑

move occurs because `self.name` has type `std::string::String`, which does not implement the `Copy` trait
摘要:cat src/main.rs #[derive(Debug)] struct f_closure{ name: String, } impl f_closure{ fn fn_call(& self) -> String{ self.name } } fn main() { let name = 阅读全文

posted @ 2020-12-26 11:29 tycoon3 阅读(1925) 评论(0) 推荐(0) 编辑

rust练习之高阶过程
摘要:在学习rust的过程中,了解了高阶函数的知识,说白了就是函数可以作为参数,也可以返回一个函数,正好最近看到了scip公开课里面讲高阶过程这一章,有个求平方根的过程,里面的lisp实现相当的简洁优美,基本是对数学公式的形式化书写。这里用rust实现一下,看看区别有多大。 主要实现了传入函数作为参数,并 阅读全文

posted @ 2020-12-25 20:38 tycoon3 阅读(474) 评论(0) 推荐(0) 编辑

Rust点滴: 闭包那点事儿
摘要:Rust点滴: 闭包那点事儿 概述 我们常常需要回调函数的功能, 需要函数并不是在创建时执行, 而是以回调的方式, 在需要的时候延迟执行. 并且, 常常需要在函数中获取环境中的一些信息, 又不需要将其作为函数参数传入. 这种应用场景就需要闭包这一工具了. 闭包是持有外部环境变量的函数. 所谓外部环境 阅读全文

posted @ 2020-12-25 20:37 tycoon3 阅读(453) 评论(0) 推荐(0) 编辑

Rust 迭代器与闭包与高阶函数
摘要:迭代器与闭包 fn main() { let vec_1 = vec![1, 2, 3,4,5]; let vec_2 = vec!["a","b","c","d","e"]; //对vec的`iter()`举出`i32`,(通过用`x`匹配)把它解构成`i32`。 //对vec的`into_ite 阅读全文

posted @ 2020-12-25 20:31 tycoon3 阅读(210) 评论(0) 推荐(0) 编辑

返回闭包
摘要:返回闭包错误例子: fn returns_closure() -> Fn(i32) -> i32 { |x| x + 1 }正确例子: fn returns_closure() -> Box<dyn Fn(i32) -> i32> { Box::new(|x| x + 1)} fn main() { 阅读全文

posted @ 2020-12-25 20:23 tycoon3 阅读(100) 评论(0) 推荐(0) 编辑

函数指针
摘要:函数指针 我们讨论过了如何向函数传递闭包;也可以向函数传递常规函数!这在我们希望传递已经定义的函数而不是重新定义闭包作为参数时很有用。通过函数指针允许我们使用函数作为另一个函数的参数。函数的类型是 fn (使用小写的 “f” )以免与 Fn 闭包 trait 相混淆。fn 被称为 函数指针(func 阅读全文

posted @ 2020-12-25 20:22 tycoon3 阅读(118) 评论(0) 推荐(0) 编辑

Rust 中的 Closure
摘要:闭包会捕获其环境 闭包中可以使用x变量。 fn main() { let x = 4; let equal_to_x = |z| z == x; println!("{:?}", x); let y = 4; assert!(equal_to_x(y)); } 而在函数中,则无法使用x变量。 fn 阅读全文

posted @ 2020-12-25 19:55 tycoon3 阅读(200) 评论(0) 推荐(0) 编辑

Moves, copies and clones in Rust
摘要:https://zhuanlan.zhihu.com/p/184907190 https://colobu.com/2020/03/05/A-half-hour-to-learn-Rust/ Introduction Moves and copies are fundamental concepts 阅读全文

posted @ 2020-12-25 19:41 tycoon3 阅读(147) 评论(0) 推荐(0) 编辑

Rust的闭包类型(Fn, FnMut, FnOne的区别)
摘要:闭包是什么? 先来看看维基百科上的描述: 在计算机科学中,闭包(英语:Closure),又称词法闭包(Lexical Closure)或函数闭包(function closures),是引用了自由变量的函数。这个被引用的自由变量将和这个函数一同存在,即使已经离开了创造它的环境也不例外。所以,有另一种 阅读全文

posted @ 2020-12-25 17:57 tycoon3 阅读(6598) 评论(0) 推荐(3) 编辑

Clone VS Copy
摘要:struct Morpheus { blue_pill: f32, red_pill: i64, } fn main() { let f = Morpheus { blue_pill: 0.0, red_pill: 0 }; let copy = f.clone(); // and now we c 阅读全文

posted @ 2020-12-25 17:41 tycoon3 阅读(194) 评论(1) 推荐(0) 编辑

rust socket
摘要:https://docs.rs/socket-io/0.1.1/src/socket_io/.cargo/registry/src/github.com-1ecc6299db9ec823/socket-io-0.1.1/src/socket.rs.html 阅读全文

posted @ 2020-12-25 17:38 tycoon3 阅读(435) 评论(0) 推荐(0) 编辑

A simple UNIX socket listener in Rust
摘要:I decided that I wanted to learn a new programming language in 2019. After a bit of research, I settled upon Rust due to its speed, novel ideas about 阅读全文

posted @ 2020-12-25 17:25 tycoon3 阅读(362) 评论(0) 推荐(1) 编辑

【firecracker】系统启动与epoll事件循环
摘要:吴斌的博客 » 【firecracker】系统启动与epoll事件循环 在分析完firecracker虚拟机中各个子系统的运行时原理和初始化流程后,最后我们整体分析一下firecracker的系统启动过程,并重点分析IO线程(fc_vmm)所采用的epoll事件循环框架。 回顾首文中介绍的firec 阅读全文

posted @ 2020-12-25 17:11 tycoon3 阅读(101) 评论(0) 推荐(0) 编辑

rust vec
摘要:Vec 定义了一个动态增长的数组,与java ArrayList类似。基本也定义了增删改查操作: pub fn push(&mut self, value: T) pub fn remove(&mut self, index: usize) pub fn get<I>(&self, index: I 阅读全文

posted @ 2020-12-25 16:46 tycoon3 阅读(508) 评论(0) 推荐(0) 编辑

rust thread
摘要:https://kaisery.github.io/trpl-zh-cn/ch16-01-threads.html use std::thread; use std::time::Duration; fn main() { thread::spawn(|| { for i in 1..10 { pr 阅读全文

posted @ 2020-12-25 16:28 tycoon3 阅读(187) 评论(0) 推荐(0) 编辑

rust Rc 和 Arc
摘要:https://wiki.jikexueyuan.com/project/rust-primer/rcarc/rcarc.html Rc 和 Arc Rust 建立在所有权之上的这一套机制,它要求一个资源同一时刻有且只能有一个拥有所有权的绑定或 &mut 引用,这在大部分的情况下保证了内存的安全。但 阅读全文

posted @ 2020-12-25 16:17 tycoon3 阅读(1690) 评论(0) 推荐(0) 编辑

rust unwrap
摘要:https://zhuanlan.zhihu.com/p/109242831 fn main() { let path = "/tmp/dat"; println!("{}", read_file(path)); } fn read_file(path: &str) -> String { std: 阅读全文

posted @ 2020-12-25 16:04 tycoon3 阅读(1045) 评论(0) 推荐(0) 编辑

rust option
摘要:[root@bogon option]# rm -rf target/ [root@bogon option]# cargo build Compiling own v0.1.0 (/data2/rust/option) Finished dev [unoptimized + debuginfo] 阅读全文

posted @ 2020-12-25 15:47 tycoon3 阅读(289) 评论(0) 推荐(0) 编辑

rust 宏
摘要:Rust 中的属性,可以分为以下四大类。 Macro attributes - 宏属性 Derive macro helper attributes - 派生宏辅助属性 Tool attributes - 工具属性 Built-in attributes - 内建属性 Macro Attribute 阅读全文

posted @ 2020-12-25 15:32 tycoon3 阅读(882) 评论(0) 推荐(0) 编辑

rust lib
摘要:[root@bogon rust]# mkdir learn_marco2 [root@bogon rust]# cd learn_marco2/ [root@bogon learn_marco2]# cargo new hello_macro --lib Created library `hell 阅读全文

posted @ 2020-12-25 14:45 tycoon3 阅读(189) 评论(0) 推荐(0) 编辑

Rust:Trait
摘要:1、Trait是什么? 一个Trait描述了一种抽象接口(找不到很合适的词),这个抽象接口可以被类型继承。Trait只能由三部分组成(可能只包含部分): functions(方法) types(类型) constants(常量) 所有的Trait都定义了一个隐含类型Self,其指向实现该Trait的 阅读全文

posted @ 2020-12-25 14:13 tycoon3 阅读(565) 评论(0) 推荐(0) 编辑

Rust 异步编程,async await
摘要:应用:简单HTTP服务器 https://learnku.com/docs/async-book/2018/http_server_example/4789 //例子二 use futures::{ self, executor}; async fn learn_song() { println!( 阅读全文

posted @ 2020-12-25 12:02 tycoon3 阅读(1450) 评论(0) 推荐(0) 编辑

rust async
摘要:cargo check [root@bogon async]# cargo check Checking own v0.1.0 (/data2/rust/async) error[E0670]: `async fn` is not permitted in the 2015 edition --> 阅读全文

posted @ 2020-12-25 11:53 tycoon3 阅读(915) 评论(0) 推荐(0) 编辑

rust self
摘要:src/main.rs #[derive(Debug)] struct MyType { name: String } impl MyType { fn do_something(self, age: u32) { //等价于 fn do_something(self: Self, age: u32 阅读全文

posted @ 2020-12-25 11:21 tycoon3 阅读(241) 评论(0) 推荐(0) 编辑

在Firecracker上运行OSv
摘要:Firecracker Firecracker is a new light KVM-based hypervisor written in Rust and announced during last AWS re:Invent in 2018. But unlike QEMU, Firecrac 阅读全文

posted @ 2020-12-25 10:14 tycoon3 阅读(278) 评论(0) 推荐(0) 编辑

gdb firecracker
摘要:root@ubuntu:~# gdb firecracker /data1/core/core.53227 GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git Copyright (C) 2018 Free Software Foundation, 阅读全文

posted @ 2020-12-25 10:12 tycoon3 阅读(134) 评论(0) 推荐(0) 编辑

gdb --configuration
摘要:$ gdb --configuration 这个GDB配置如下:配置--host = x86_64-apple-darwin13.1.0 --target = x86_64-apple-darwin13.1.0 --with-auto-load-dir =:$ {prefix} / share / 阅读全文

posted @ 2020-12-25 10:10 tycoon3 阅读(336) 评论(0) 推荐(0) 编辑

firecracker 编译
摘要:git clone https://github.com/firecracker-microvm/firecracker git checkout tags/v0.10.1 [root@bogon firecracker]# ls api_server CHANGELOG.md devices du 阅读全文

posted @ 2020-12-25 09:16 tycoon3 阅读(295) 评论(0) 推荐(0) 编辑

gvisor 编译
摘要:https://pkg.go.dev/gvisor.dev/gvisor@v0.0.0-20201222062610-620de250a48a?tab=versions https://cloud-atlas.readthedocs.io/zh_CN/latest/kubernetes/virtua 阅读全文

posted @ 2020-12-24 19:54 tycoon3 阅读(777) 评论(0) 推荐(0) 编辑

gvisor
摘要:gVisor gVisor is a user-space kernel, written in Go, that implements a substantial portion of the Linux system surface. gVisor uses linux OS, but the 阅读全文

posted @ 2020-12-24 19:26 tycoon3 阅读(126) 评论(0) 推荐(0) 编辑

rust Deref
摘要:Deref <T> trait用于自定义解除引用运算符(*)的行为。如果实现Deref <T>特征,则可以将智能指针视为参考。 因此,在引用上工作的代码也可以用在智能指针上。 常规引用 常规引用是一种指向某个值的指针,该值存储在其他地方。下面来看一个简单的例子来创建i32类型值的引用,然后使用引用运 阅读全文

posted @ 2020-12-24 17:57 tycoon3 阅读(398) 评论(0) 推荐(0) 编辑

rust explicit
摘要:cat src/main.rs // 生命周期 `'a` 和 `'b`。这两个生命周期都必须至少要和 `print_refs` // 函数的一样长。 fn print_refs<'a, 'b>(x: &'a i32, y: &'b i32) { println!("x is {} and y is 阅读全文

posted @ 2020-12-24 17:43 tycoon3 阅读(75) 评论(0) 推荐(0) 编辑

rust move
摘要:// 此函数取倒堆分配的内存的所有权 fn destroy_box(c: Box<i32>) { println!("Destroying a box that contains {}", c); // `c` 被销毁且内存得到释放 } fn main() { // 栈分配的整型 let x = 5 阅读全文

posted @ 2020-12-24 17:20 tycoon3 阅读(223) 评论(0) 推荐(0) 编辑

rust drop
摘要:Drop Drop trait 只有一个方法:drop,当一个对象离开作用域时会自动调用该方法。Drop trait 的主要作用是释放实现者实例拥有的资源。 Box,Vec,String,File,以及 Process 是一些实现了 Drop trait 来释放资源的类型的例子。Drop trait 阅读全文

posted @ 2020-12-24 17:10 tycoon3 阅读(188) 评论(0) 推荐(0) 编辑

rust 可变变量
摘要:变量绑定默认是不可变的,但加上 mut 修饰语后变量就可以改变。 fn main() { let _immutable_binding = 1; let mut mutable_binding = 1; println!("Before mutation: {}", mutable_binding) 阅读全文

posted @ 2020-12-24 17:03 tycoon3 阅读(191) 评论(0) 推荐(0) 编辑

Rust学习(32):智能指针-Rc<T>
摘要:cat src/main.rs use std::rc::Rc; struct Owner { name: String, // ...other fields } struct Gadget { id: i32, owner: Rc<Owner>, // ...other fields } fn 阅读全文

posted @ 2020-12-24 16:53 tycoon3 阅读(212) 评论(0) 推荐(0) 编辑

rust 高级编程
摘要:高级编程 https://learnku.com/docs/nomicon/2018/33-life-cycle/4714 rust-by-example- http://llever.com/rust-by-example-cn/variable_bindings/mut.html 箱子、栈和堆 阅读全文

posted @ 2020-12-24 16:13 tycoon3 阅读(307) 评论(0) 推荐(0) 编辑

rust 所有权
摘要:cat src/main.rs fn main() { let x= String::from("42"); let y=x; println!("value of x :{}",x); } cargo build Compiling own v0.1.0 (/data2/rust/own) war 阅读全文

posted @ 2020-12-24 15:58 tycoon3 阅读(426) 评论(0) 推荐(0) 编辑

rust智能指针
摘要:demo1 fn main() { let a = 5; let b = &a; if a == *b { println!("Equal"); } else { println!("Not equal"); } } cargo run Finished dev [unoptimized + deb 阅读全文

posted @ 2020-12-24 15:16 tycoon3 阅读(158) 评论(0) 推荐(0) 编辑

Anbox:容器中的 Android,anboxandroid
摘要:Anbox 实现分析 3:会话管理器与容器管理器的通信 Anbox源码分析 https://blog.csdn.net/qq_36383272/category_9934190.html Anbox 实现分析之 I/O 模型 https://blog.csdn.net/tq08g2z/article 阅读全文

posted @ 2020-12-24 10:08 tycoon3 阅读(938) 评论(0) 推荐(0) 编辑

ata1/dpdk-19.11/mk/internal/rte.extvars.mk:29: *** Cannot find .config in /data1/dpdk-19.11/---. Stop.
摘要:[root@localhost vxlan]# make /data1/dpdk-19.11/mk/internal/rte.extvars.mk:29: *** Cannot find .config in /data1/dpdk-19.11/ . Stop. [root@localhost vx 阅读全文

posted @ 2020-12-23 19:40 tycoon3 阅读(904) 评论(0) 推荐(0) 编辑

鲲鹏服务器 跑dpdk 添加vxlan失败
摘要:原来没有实现udp_tunnel_port_add接口 net_hinic: Disable promiscuous, nic_dev: hinic-0000:05:00.0, port_id: 0, promisc: 0 net_hinic: Disable allmulticast succee 阅读全文

posted @ 2020-12-23 19:22 tycoon3 阅读(266) 评论(0) 推荐(0) 编辑

ovs netdev offload dpdk flow
摘要:https://github.com/bytedance/ovs-dpdk/blob/80e2a22dda73e5d30be5de025572a418cc722632/lib/netdev-offload-dpdk-flow.c const struct netdev_flow_api netdev 阅读全文

posted @ 2020-12-23 17:03 tycoon3 阅读(364) 评论(0) 推荐(0) 编辑

rust 智能指针
摘要:智能指针是一类数据结构 智能指针 拥有 指向的内存,而 引用 只是 借用 智能指针 实现了 Deref 和 Drop 两个trait Box<T>,用于在堆上分配值 <=> 对应 C++ 的 std::unique_ptr Rc<T>,一个引用计数类型,其数据可以有多个所有者 <=> 对应 C++ 阅读全文

posted @ 2020-12-23 16:43 tycoon3 阅读(175) 评论(0) 推荐(0) 编辑

Linux上快速入门英特尔Optane DC Persistent Memory Module的配置与使用
摘要:https://blog.csdn.net/SweeNeil/article/details/89640206 阅读全文

posted @ 2020-12-23 11:54 tycoon3 阅读(256) 评论(0) 推荐(0) 编辑

ovs 流表
摘要:https://blog.csdn.net/u010378472/article/details/79146557 Breakpoint 1, netdev_send (netdev=0x5470900, qid=qid@entry=0, batch=batch@entry=0xfffd58004f 阅读全文

posted @ 2020-12-23 11:19 tycoon3 阅读(488) 评论(0) 推荐(0) 编辑

Cannot get thread event message: debugger service failed
摘要:(gdb) c Continuing. [New Thread 0xffff9013f910 (LWP 15057)] Cannot get thread event message: debugger service failed 阅读全文

posted @ 2020-12-22 17:31 tycoon3 阅读(1285) 评论(0) 推荐(0) 编辑

gdb ovs
摘要:dpif_netdev_run && pmd_thread_main (没有启动虚拟机去连接 -chardev socket,id=char1,path=$VHOST_SOCK_DIR/vhost-user1,不会有pmd_thread_main) 执行ovs-vsctl add-port br0 阅读全文

posted @ 2020-12-22 16:21 tycoon3 阅读(599) 评论(0) 推荐(1) 编辑

rror while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
摘要:[root@localhost ovs]# ln -s /lib64/libc-2.17.so /lib64/libc.so.6ln: error while loading shared libraries: libc.so.6: cannot open shared object file: N 阅读全文

posted @ 2020-12-21 20:12 tycoon3 阅读(865) 评论(0) 推荐(0) 编辑

glibc
摘要:centos7不支持glibc-2.27 那就去清华开源站点下载glibc https://mirrors.tuna.tsinghua.edu.cn/gnu/libc/ 在介绍压缩目录里建build,../configure --prefix=/opt/glibc-2.27 make make in 阅读全文

posted @ 2020-12-21 19:37 tycoon3 阅读(708) 评论(0) 推荐(0) 编辑

qemu + dpdk vq->callfd
摘要:qemu-kvm segfault in kvm packstack aio + ovs-dpdk https://bugzilla.redhat.com/show_bug.cgi?id=1380703 (gdb) bt #0 0x00007fb6c573c0b8 in kvm_virtio_pci 阅读全文

posted @ 2020-12-21 11:09 tycoon3 阅读(249) 评论(0) 推荐(0) 编辑

kvm vcpu run
摘要:https://luohao-brian.gitbooks.io/interrupt-virtualization/content/kvm-run-processzhi-qemu-he-xin-liu-cheng.html kvm_cpu_thread void *kvm_cpu_thread(vo 阅读全文

posted @ 2020-12-20 12:20 tycoon3 阅读(634) 评论(0) 推荐(0) 编辑

ioeventfd创建
摘要:Qemu是一个应用程序,所以入口函数当然是main函数,但是一些被type_init修饰的函数会在main函数之前运行。这里分析的代码是emulate x86 的一款i440板子。main函数中会调用在main函数中会调用kvm_init函数来创建一个VM(virtual machine),然后调用 阅读全文

posted @ 2020-12-19 22:46 tycoon3 阅读(532) 评论(0) 推荐(0) 编辑

KVM_IOEVENTFD KVM_IRQFD
摘要:kvm_vm_ioctl(s, KVM_IRQFD, &irqfd); kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &kick) Ioctl Cmd Implement function Src file KVM_CREATE_VCPU kvm_vm_ioctl_c 阅读全文

posted @ 2020-12-19 22:08 tycoon3 阅读(416) 评论(0) 推荐(0) 编辑

KVM Simple Example
摘要:Background Starting from ARM-v8.1, Virtualization Host Extension (VHE) feature supports running unmodified OS in EL2. mrs x0, ESR_EL1can be redirected 阅读全文

posted @ 2020-12-19 22:02 tycoon3 阅读(284) 评论(0) 推荐(0) 编辑

Tracing QEMU-KVM Interactions
摘要:[root@localhost qemu]# find ./ -name trace-events | xargs grep -i kvm | grep irq ./target/i386/trace-events:kvm_x86_add_msi_route(int virq) "Adding ro 阅读全文

posted @ 2020-12-18 20:29 tycoon3 阅读(256) 评论(0) 推荐(0) 编辑

rte_vhost_enqueue_burst + rte_vhost_dequeue_burst + vhost_user_set_vring_call +vhost_user_set_vring_call
摘要:下图显示了作为DPDK-APP的一部分运行的虚拟主机用户库如何使用virtio-device-model和virtio-pci设备与qemu和客户机进行交互: 几个要点: virtio内存区域最初是由客户机分配的。 相应的virtio驱动程序通常通过virtio规范中定义的PCI BARs配置接口与 阅读全文

posted @ 2020-12-18 16:23 tycoon3 阅读(761) 评论(0) 推荐(0) 编辑

dpdk 连接错误
摘要:/usr/bin/ld: cannot find -lrte_mempool_octeontx2 /usr/bin/ld: cannot find -lrte_common_octeontx /usr/bin/ld: cannot find -lrte_common_octeontx2 /usr/b 阅读全文

posted @ 2020-12-17 17:13 tycoon3 阅读(382) 评论(0) 推荐(0) 编辑

strace 跟踪文件
摘要:strace -o firecracker.output firecracker --api-sock /tmp/firecracker.socket strace -ff -o log.runsc docker run --runtime=runsc-kvm --rm hello-world st 阅读全文

posted @ 2020-12-17 15:47 tycoon3 阅读(318) 评论(0) 推荐(0) 编辑

鲲鹏服务器 centos 升级gcc + 安装qemu
摘要:https://bbs.huaweicloud.com/forum/thread-22665-1-1.html# 去官网下载http://ftp.gnu.org/gnu/gcc/下载GCC 5.4.0的源码压缩包解压安装 解压gcc-5.4.0.tar.gz [root@localhost qemu 阅读全文

posted @ 2020-12-17 12:00 tycoon3 阅读(923) 评论(0) 推荐(0) 编辑

centos 升级gcc
摘要:CentOS 7官方源的gcc最新版本是4.8.5,发布于2015年,年代久远且不支持c++14。要编译c++14及以上项目,必须要升级现有版本或者安装高版本的gcc。 解决办法有两种:手动编译(也可以从其他机器拷贝或者网上下载),或从源安装。 大多数情况下本人都不推荐从源码编译,不仅因为编译过程中 阅读全文

posted @ 2020-12-17 11:43 tycoon3 阅读(1687) 评论(0) 推荐(0) 编辑

undefined reference to `shm_open'
摘要:如果你注意到的话,这样编译就能通过了: gcc -o test test.c -lrt 其实就是要连接库的原因。但是需要注意,-lrt需要放到后面,如果放到前面,还会报同样的错误,原因未知。下面给出一个我测试过的例子 /tmp/cc2aVWuG.o: In function `main': simp 阅读全文

posted @ 2020-12-16 16:58 tycoon3 阅读(1557) 评论(0) 推荐(0) 编辑

Golang与C互用
摘要:https://jermine.vdo.pub/go/golang%E4%B8%8Ec%E4%BA%92%E7%9B%B8%E8%B0%83%E7%94%A8%E4%BB%A5%E5%8F%8A%E8%B0%83%E7%94%A8c%E7%9A%84so%E5%8A%A8%E6%80%81%E5%B 阅读全文

posted @ 2020-12-14 17:53 tycoon3 阅读(370) 评论(0) 推荐(0) 编辑

[ TIME ] Timed out waiting for device dev-ttyS0.device. [DEPEND] Dependency failed for Serial Getty on ttyS0.
摘要:A start job is running for dev-ttyS0.device [ TIME ] Timed out waiting for device dev-ttyS0.device.[DEPEND] Dependency failed for Serial Getty on ttyS 阅读全文

posted @ 2020-12-11 19:41 tycoon3 阅读(6245) 评论(0) 推荐(0) 编辑

netcat nc
摘要:root@4c83d500b893:/# netcat -l -p 6000 GET / HTTP/1.1 User-Agent: Wget/1.19.4 (linux-gnu) Accept: */* Accept-Encoding: identity Host: 172.17.0.4:6000 阅读全文

posted @ 2020-12-11 10:40 tycoon3 阅读(109) 评论(0) 推荐(0) 编辑

iptables 插入规则 + docker
摘要:http://sxca.miit.gov.cn/txxh/xujfil/4749.hrh root@ # iptables -vnL cali-PREROUTING -t nat Chain cali-PREROUTING (1 references) pkts bytes target prot 阅读全文

posted @ 2020-12-11 10:24 tycoon3 阅读(2256) 评论(0) 推荐(0) 编辑

systemd kata
摘要:static noinline int init_post(void) __releases(kernel_lock) { /* need to finish all async __init code before freeing the memory */ async_synchronize_f 阅读全文

posted @ 2020-12-10 16:48 tycoon3 阅读(302) 评论(0) 推荐(0) 编辑

Debootstrap a standalone Debian system across multiple partitions
摘要:Debootstrap a standalone Debian system across multiple partitions Tuesday, July 07, 2015 Having finally finished my MSci Computer Science course at Lo 阅读全文

posted @ 2020-12-10 15:52 tycoon3 阅读(172) 评论(0) 推荐(0) 编辑

syslog
摘要:Logging to syslog from Your Script Problem You’d like your script to be able to log to syslog. Solution Use logger, Netcat, or bash’s built-in network 阅读全文

posted @ 2020-12-10 15:00 tycoon3 阅读(157) 评论(0) 推荐(0) 编辑

kata qemu
摘要:https://github.com/kata-containers/kata-containers/tree/2.0-dev/tools/packaging/qemu/patches/5.1.x root@ubuntu:/home/ubuntu/qemu_learn# bash kata_9p.s 阅读全文

posted @ 2020-12-09 17:58 tycoon3 阅读(625) 评论(0) 推荐(0) 编辑

socat
摘要:root@(none):/# host_vsock_addr=x00x00x14x14x00x00x02x00x00x00x00x00x00x00 root@(none):/# socat -u "fd:3" "socket-connect:40:0:${host_vsock_addr}" 2020 阅读全文

posted @ 2020-12-09 16:20 tycoon3 阅读(2210) 评论(0) 推荐(0) 编辑

kata agent install syslog
摘要:112 packages can be upgraded. Run 'apt list --upgradable' to see them. bash: sudo: command not found root@ubuntu:/var/lib/dpkg# apt-get install sudo r 阅读全文

posted @ 2020-12-09 11:10 tycoon3 阅读(918) 评论(0) 推荐(0) 编辑

kata rootfs
摘要:https://bevisy.github.io/kata-containers-Compile-And-Installed/ root@PORT:~# ls /sbin/init/sbin/initroot@PORT:~# ps -elf | grep init4 S root 1 0 0 80 阅读全文

posted @ 2020-12-09 09:06 tycoon3 阅读(272) 评论(0) 推荐(0) 编辑

defaultKataGuestSharedDir
摘要:virtcontainers/kata_agent.go:67: defaultKataGuestSharedDir = "/run/kata-containers/shared/containers/" 阅读全文

posted @ 2020-12-08 20:36 tycoon3 阅读(68) 评论(0) 推荐(0) 编辑

kata 9p
摘要:Manually, using qemu-kvm command line There are a nice set of details on the QEMU wiki describing this, so this section will be quite short. To share 阅读全文

posted @ 2020-12-08 12:05 tycoon3 阅读(253) 评论(0) 推荐(0) 编辑

runc nsenter 源码阅读
摘要:背景 最近在阅读 runc 的实现,发现在 runc 中比较重要的一个逻辑是在设置 namespace 过程中的 nsenter 模块,其中逻辑有些绕,也发现了一段很长很有意思的注释,分享一下。 What 什么是 nsenter,nsenter 是 runc 中的一个 package,它包含了一个特 阅读全文

posted @ 2020-12-08 10:20 tycoon3 阅读(464) 评论(0) 推荐(0) 编辑

kata vcpu
摘要:default_vcpus = 1 root@ubuntu:/# lscpu Architecture: aarch64 Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) 阅读全文

posted @ 2020-12-08 09:56 tycoon3 阅读(92) 评论(0) 推荐(0) 编辑

gdb多进程 clone系统调用 received signal SIGBUS, Bus error
摘要:#define _GNU_SOURCE #include<sched.h> #include<stdio.h> #include<stdlib.h> #include<sys/wait.h> #include<unistd.h> #include<errno.h> #include<string.h 阅读全文

posted @ 2020-12-07 19:15 tycoon3 阅读(895) 评论(0) 推荐(0) 编辑

LINUX – WRITING A SIMPLE CONTAINER APP WITH NAMESPACES
摘要:One of the building blocks to implement containers is Linux namespaces. Namespaces control what a process can see. It can be the processes IDs, mount 阅读全文

posted @ 2020-12-07 17:48 tycoon3 阅读(105) 评论(0) 推荐(0) 编辑

nsexec
摘要:root@cloud:~# ps -elf | grep nsexec 0 S root 57368 56786 0 80 0 - 420 wait 14:23 pts/0 00:00:00 ./nsexec 0 S root 57387 57371 0 80 0 - 1418 pipe_r 14: 阅读全文

posted @ 2020-12-07 14:51 tycoon3 阅读(268) 评论(0) 推荐(0) 编辑

nsenter
摘要:https://x3fwy.bitcron.com/post/runc-malicious-container-escape The `nsenter` package will `import "C"` and it uses [cgo](https://golang.org/cmd/cgo/) 阅读全文

posted @ 2020-12-06 18:16 tycoon3 阅读(312) 评论(0) 推荐(0) 编辑

setjmp
摘要:C 库宏 - setjmp 描述 C 库宏 int setjmp(jmp_buf environment) :创建本地的jmp_buf缓冲区并且初始化,用于将来跳转回此处。这个子程序保存程序的调用环境于env参数所指的缓冲区,env将被longjmp使用。如果是从setjmp直接调用返回,setjm 阅读全文

posted @ 2020-12-06 11:33 tycoon3 阅读(177) 评论(0) 推荐(0) 编辑

runc 测试
摘要:https://github.com/haslm/toolchain/tree/a29fb3909141887df1d898181010f71ac011876f/runc / finalizeRootfs sets anything to ro if necessary. You must call 阅读全文

posted @ 2020-12-04 20:15 tycoon3 阅读(358) 评论(0) 推荐(0) 编辑

cgo setns + libcontainer nsexec
摘要:https://www.jianshu.com/p/c48e6cd84ff5 nsenter/nsenter.go 1、怎么获取mydocker_pid 2、怎么获取mydocker_cmd package nsenter /* #include <errno.h> #include <sched. 阅读全文

posted @ 2020-12-04 17:18 tycoon3 阅读(124) 评论(0) 推荐(0) 编辑

kata agent + runc 进程
摘要:https://segmentfault.com/a/1190000017576314 root@ubuntu:/# ls /run/libcontainer/ -al total 0 drwx 3 root root 60 Dec 4 06:37 . drwxr-xr-x 11 root root 阅读全文

posted @ 2020-12-04 15:56 tycoon3 阅读(357) 评论(0) 推荐(0) 编辑

docker系列--namespace解读
摘要:// Config defines configuration options for executing a process inside a contained environment. type Config struct { ... // Namespaces specifies the c 阅读全文

posted @ 2020-12-04 15:29 tycoon3 阅读(352) 评论(0) 推荐(0) 编辑

kata /run
摘要:kata vm root@ubuntu:/opt# mount | grep run tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755) tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,r 阅读全文

posted @ 2020-12-04 11:51 tycoon3 阅读(76) 评论(0) 推荐(0) 编辑

mount blockdevices in the guest VM instead of passing them through as volume
摘要:https://github.com/kata-containers/runtime/issues/571 https://github.com/gotoz/runq#storage docker run -it --runtime=kata-runtime --device data1:/data 阅读全文

posted @ 2020-12-04 11:43 tycoon3 阅读(179) 评论(0) 推荐(0) 编辑

read only files
摘要: 阅读全文

posted @ 2020-12-04 11:21 tycoon3 阅读(40) 评论(0) 推荐(0) 编辑

mount namespace
摘要:https://www.junmajinlong.com/virtual/namespace/mount_namespace/ root@cloud:~# ls -1 /proc/$$/mount* /proc/3374/mountinfo /proc/3374/mounts /proc/3374/ 阅读全文

posted @ 2020-12-04 10:43 tycoon3 阅读(168) 评论(0) 推荐(0) 编辑

bindMountContainerRootfs(
摘要:func (k *kataAgent) createContainer(sandbox *Sandbox, c *Container) (p *Process, err error) { span, _ := k.trace("createContainer") defer span.Finish( 阅读全文

posted @ 2020-12-04 09:03 tycoon3 阅读(113) 评论(0) 推荐(0) 编辑

initProcess + runc init
摘要:docker: Error response from daemon: OCI runtime create failed: rpc error: code = Internal desc = Could not run process: container_linux.go:349: starti 阅读全文

posted @ 2020-12-03 20:10 tycoon3 阅读(286) 评论(0) 推荐(0) 编辑

kata container mount and umount
摘要:func setupStorages(sandbox *Sandbox) []*grpc.Storage { storages := []*grpc.Storage{} caps := sandbox.hypervisor.capabilities() // append 9p shared vol 阅读全文

posted @ 2020-12-03 11:39 tycoon3 阅读(228) 评论(0) 推荐(0) 编辑

container start or run + prepareRootfs + linuxStandardInit.Init
摘要:https://blog.csdn.net/zhonglinzhang/article/details/101212033 https://blog.csdn.net/zhonglinzhang/article/details/101212033 在Libcontainer中,p.cmd.Start 阅读全文

posted @ 2020-12-03 10:01 tycoon3 阅读(225) 评论(0) 推荐(0) 编辑

persistent namespaces
摘要:persistent namespaces Today I merged support for persistent namespaces to unshare(1). The persistent namespace does not require any running process wi 阅读全文

posted @ 2020-12-02 15:53 tycoon3 阅读(97) 评论(0) 推荐(0) 编辑

kata namespace
摘要:// setupPersistentNs creates persistent namespace without switchin to it. // Note, pid namespaces cannot be persisted. func setupPersistentNs(namespac 阅读全文

posted @ 2020-12-02 15:09 tycoon3 阅读(133) 评论(0) 推荐(0) 编辑

Could not run process: container_linux.go:349: starting container process caused "process_linux.go:449:
摘要:docker: Error response from daemon: OCI runtime create failed: rpc error: code = Internal desc = Could not run process: container_linux.go:349: starti 阅读全文

posted @ 2020-12-02 14:03 tycoon3 阅读(2006) 评论(0) 推荐(0) 编辑

CreateContainer & CreateSandbox(
摘要:func (a *agentGRPC) CreateContainer(ctx context.Context, req *pb.CreateContainerRequest) (resp *gpb.Empty, err error) { if err := a.createContainerChe 阅读全文

posted @ 2020-12-02 10:19 tycoon3 阅读(248) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示