MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / fh_new

Function fh_new

src/sys/proc.rs:326–342  ·  view source on GitHub ↗

Create a new file handle

(file: Resource)

Source from the content-addressed store, hash-verified

324
325// Create a new file handle
326pub fn fh_new(file: Resource) -> Result<usize, ()>
327{
328 let mut tab = PROCTAB.write();
329 let proc = &mut tab[id()];
330
331 let min = 4;
332 let max = MAX_FILEHANDLE;
333 for handle in min..max
334 {
335 if proc.data.filehandle[handle].is_none()
336 {
337 proc.data.filehandle[handle] = Some(file);
338 return Ok(handle);
339 }
340 }
341 Err(())
342}
343
344
345// Update file handle

Callers

nothing calls this directly

Calls 3

idFunction · 0.85
ErrEnum · 0.50
writeMethod · 0.45

Tested by

no test coverage detected