MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / open_path

Function open_path

kernel/src/process.rs:753–770  ·  view source on GitHub ↗

Open the given path Returns either a Rendezvous handle and path match length, or an error

(
    _current_context: &mut Context,
    path: &str)

Source from the content-addressed store, hash-verified

751/// Open the given path
752/// Returns either a Rendezvous handle and path match length, or an error
753pub fn open_path(
754 _current_context: &mut Context,
755 path: &str) -> Result<(usize, usize), usize> {
756
757 if let Some(current_thread) = CURRENT_THREAD.read().as_ref() {
758 let mut process = current_thread.process.write();
759
760 if let Some((rv, match_len)) = process.mounts.open(path) {
761 // Found!
762 let handle = process.add_handle(rv.clone());
763 return Ok((handle, match_len));
764 } else {
765 return Err(syscalls::SYSCALL_ERROR_NOTFOUND);
766 }
767 }
768 // No thread(?)
769 Err(0)
770}
771
772/// Create a new memory chunk
773///

Callers 1

sys_openFunction · 0.70

Calls 6

add_handleMethod · 0.80
cloneMethod · 0.80
as_refMethod · 0.45
readMethod · 0.45
writeMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected