-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from Burning1020/runc-new-api
runc: support new sandbox api
- Loading branch information
Showing
11 changed files
with
764 additions
and
151 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Copyright 2024 The Kuasar Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
use std::process::exit; | ||
|
||
fn main() { | ||
if let Err(e) = built::write_built_file() { | ||
eprint!("Failed to acquire build-time information: {:?}", e); | ||
exit(-1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
newline_style = "Unix" | ||
unstable_features = true | ||
group_imports = "StdExternalCrate" | ||
imports_granularity = "Crate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
Copyright 2024 The Kuasar Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
use clap::Parser; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(author, about, long_about = None)] | ||
pub struct Args { | ||
/// Version info | ||
#[arg(short, long)] | ||
pub version: bool, | ||
|
||
/// Sandboxer working directory, default is `/run/kuasar-runc` | ||
#[arg(short, long, value_name = "DIR", default_value = "/run/kuasar-runc")] | ||
pub dir: String, | ||
|
||
/// Address for sandboxer's server, default is `/run/runc-sandboxer.sock` | ||
#[arg( | ||
short, | ||
long, | ||
value_name = "FILE", | ||
default_value = "/run/runc-sandboxer.sock" | ||
)] | ||
pub listen: String, | ||
|
||
// log_level is optional and should not have default value if not given, since | ||
// it can be defined in configuration file. | ||
/// Logging level for sandboxer [trace, debug, info, warn, error, fatal, panic] | ||
#[arg(long, value_name = "STRING")] | ||
pub log_level: Option<String>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use clap::Parser; | ||
|
||
use crate::args::Args; | ||
|
||
#[test] | ||
fn test_args_parse_default() { | ||
let args = Args::parse(); | ||
assert!(!args.version); | ||
assert_eq!(args.dir, "/run/kuasar-runc"); | ||
assert_eq!(args.listen, "/run/runc-sandboxer.sock"); | ||
assert!(args.log_level.is_none()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.