1 2 3 4 5 6 7 8 9 10 11 12 13
#include <kernel/fd.h> #include <kernel/panic.h> #include <kernel/proc.h> int fdop_dispatch(enum fdop fdop, fd_t fd, void *ptr, size_t len) { if (fd < 0 || fd >= FD_MAX) return -1; switch(process_current->fds[fd].type) { case FD_EMPTY: return -1; default: panic(); } }