Skip to content

Commit

Permalink
Env: Rename getters
Browse files Browse the repository at this point in the history
  • Loading branch information
mkroening committed Mar 14, 2022
1 parent 0dd7f62 commit 87bbd2b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/arch/x86_64/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl CpuFrequency {
}

unsafe fn detect_from_cmdline(&mut self) -> Result<(), ()> {
let mhz = env::get_command_line_cpu_frequency().ok_or(())?;
let mhz = env::freq().ok_or(())?;
self.set_detected_cpu_frequency(mhz, CpuFrequencySources::CommandLine)
}

Expand Down
6 changes: 3 additions & 3 deletions src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ impl Default for Cli {
}

/// CPU Frequency in MHz if given through the -freq command-line parameter.
pub fn get_command_line_cpu_frequency() -> Option<u16> {
pub fn freq() -> Option<u16> {
ENV.get().unwrap().cli.freq
}

pub fn get_command_line_envv() -> &'static [String] {
pub fn vars() -> &'static [String] {
ENV.get().unwrap().cli.env_vars.as_slice()
}

/// Returns the cmdline argument passed in after "--"
pub fn get_command_line_argv() -> &'static [String] {
pub fn args() -> &'static [String] {
ENV.get().unwrap().cli.args.as_slice()
}

Expand Down
4 changes: 2 additions & 2 deletions src/syscalls/interfaces/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub trait SyscallInterface: Send + Sync {
let name = Box::leak(Box::new("{name}\0")).as_ptr();
argv.push(name);

let args = env::get_command_line_argv();
let args = env::args();
debug!("Setting argv as: {:?}", args);
for arg in args {
let ptr = Box::leak(format!("{arg}\0").into_boxed_str()).as_ptr();
Expand All @@ -99,7 +99,7 @@ pub trait SyscallInterface: Send + Sync {

let mut envv = Vec::new();

let envs = env::get_command_line_envv();
let envs = env::vars();
debug!("Setting envv as: {:?}", envs);
for a in envs {
let ptr = Box::leak(format!("{}\0", a).into_boxed_str()).as_ptr();
Expand Down

0 comments on commit 87bbd2b

Please sign in to comment.