MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / alloc_fd

Method alloc_fd

os/src/task/process.rs:43–50  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

41 }
42
43 pub fn alloc_fd(&mut self) -> usize {
44 if let Some(fd) = (0..self.fd_table.len()).find(|fd| self.fd_table[*fd].is_none()) {
45 fd
46 } else {
47 self.fd_table.push(None);
48 self.fd_table.len() - 1
49 }
50 }
51
52 pub fn alloc_tid(&mut self) -> usize {
53 self.task_res_allocator.alloc()

Callers 3

sys_openFunction · 0.80
sys_pipeFunction · 0.80
sys_dupFunction · 0.80

Calls 3

findMethod · 0.80
lenMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected