/// <summary> /// Opens a file /// </summary> /// <param name="path">The path</param> /// <param name="flags">The flags</param> /// <returns>The file descriptor ID</returns> public static int Open(string path, int flags) { if (path.Length == 0) { return(-(int)ErrorCode.EINVAL); } Node node = null; // Check if O_CREATE if ((flags & 0x0200) > 0) { node = VFS.GetOffsetNodeByPath(path, 1); node = VFS.Create(node, "test"); if (node == null) { return(-(int)ErrorCode.ENOENT); } } else { node = VFS.GetByPath(path); if (node == null) { return(-(int)ErrorCode.ENOENT); } VFS.Open(node, flags); } FileDescriptors descriptors = Tasking.CurrentTask.FileDescriptors; return(descriptors.AddNode(node)); }