My first exploration was running uname -a and having a look at the source for it.
I noticed that the version number reported ("4.2.3") and the date are both hardcoded in the function:
pub async fn sys_uname(uts_ptr: TUA<OldUtsname>) -> Result<usize> {
let mut uts = unsafe { mem::zeroed::<OldUtsname>() };
let sysname = c"Moss".to_bytes_with_nul();
copy_str_to_c_char_arr(&mut uts.sysname, sysname);
let nodename = CString::from_str(&hostname().lock_save_irq()).unwrap();
copy_str_to_c_char_arr(&mut uts.nodename, nodename.as_c_str().to_bytes_with_nul());
let release = c"4.2.3".to_bytes_with_nul();
copy_str_to_c_char_arr(&mut uts.release, release);
#[cfg(feature = "smp")]
let version = c"#1 Moss SMP Tue Feb 20 12:34:56 UTC 2024".to_bytes_with_nul();
#[cfg(not(feature = "smp"))]
let version = c"#1 Moss Tue Feb 20 12:34:56 UTC 2024".to_bytes_with_nul();
copy_str_to_c_char_arr(&mut uts.version, version);
let machine = CString::new(ArchImpl::name()).unwrap();
let machine = machine.to_bytes_with_nul();
copy_str_to_c_char_arr(&mut uts.machine, machine);
copy_to_user(uts_ptr, uts).await?;
Ok(0)
}
So, I wondered:
- How does the version numbering work?
- The number doesn't seem to match that in any of the
Cargo.toml, and it looks like they are not modified.
- Do you plan to do releases using GitHub?
- Would you appreciate some contribution in this area:
- Using one of the
Cargo.toml version numbers in the code from Cargo variables, not hardcoded
- Similar with date
- Maybe require a simple build.rs to generate the date (not sure)
- Some work on automation of releases in GH via GH Actions
- Will require a bit of guidance on how you'd like releases done and numbered...
My first exploration was running
uname -aand having a look at the source for it.I noticed that the version number reported ("4.2.3") and the date are both hardcoded in the function:
So, I wondered:
Cargo.toml, and it looks like they are not modified.Cargo.tomlversion numbers in the code from Cargo variables, not hardcoded