Fix clippy.sh script and fix a number of clippy warnings

This commit is contained in:
Jeremy Soller
2019-10-06 11:04:06 -06:00
parent a57ea6a72b
commit 63e2a835e0
40 changed files with 196 additions and 543 deletions
+6 -7
View File
@@ -149,7 +149,7 @@ pub fn clone(flags: CloneFlags, stack_base: usize) -> Result<ContextId> {
// Change the return address of the child
// (previously syscall) to the arch-specific
// clone_ret callback
let func_ptr = new_stack.as_mut_ptr().offset(offset as isize);
let func_ptr = new_stack.as_mut_ptr().add(offset);
*(func_ptr as *mut usize) = interrupt::syscall::clone_ret as usize;
}
@@ -1044,7 +1044,6 @@ pub fn fexec(fd: FileHandle, arg_ptrs: &[[usize; 2]], var_ptrs: &[[usize; 2]]) -
// Argument must be moved into kernel space before exec unmaps all memory
args.push(arg.to_vec().into_boxed_slice());
}
drop(arg_ptrs);
let mut vars = Vec::new();
for var_ptr in var_ptrs {
@@ -1052,7 +1051,9 @@ pub fn fexec(fd: FileHandle, arg_ptrs: &[[usize; 2]], var_ptrs: &[[usize; 2]]) -
// Argument must be moved into kernel space before exec unmaps all memory
vars.push(var.to_vec().into_boxed_slice());
}
drop(var_ptrs);
// Neither arg_ptrs nor var_ptrs should be used after this point, the kernel
// now has owned copies in args and vars
fexec_kernel(fd, args.into_boxed_slice(), vars.into_boxed_slice(), None)
}
@@ -1125,10 +1126,8 @@ pub fn exit(status: usize) -> ! {
if let Some(parent_lock) = contexts.get(ppid) {
let waitpid = {
let mut parent = parent_lock.write();
if vfork {
if ! parent.unblock() {
println!("{}: {} not blocked for exit vfork unblock", pid.into(), ppid.into());
}
if vfork && ! parent.unblock() {
println!("{}: {} not blocked for exit vfork unblock", pid.into(), ppid.into());
}
Arc::clone(&parent.waitpid)
};