Open the given path Returns either a Rendezvous handle and path match length, or an error
(
_current_context: &mut Context,
path: &str)
| 751 | /// Open the given path |
| 752 | /// Returns either a Rendezvous handle and path match length, or an error |
| 753 | pub 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 | /// |