//! Create the file if it doesn't exist
#define VFS_OPENFLAG_CREATE 0x80
//! Treat as a directory
-#define VFS_OPENFLAG_DIRECTORY 0x100
+#define VFS_OPENFLAG_DIRECTORY 0x1000
//! Open as a user
#define VFS_OPENFLAG_USER 0x8000
/**
*/
extern int VFS_DuplicateFD(int SrcFD, int DstFD);
+/**
+ * \brief Update the flags on a FD
+ */
+extern int VFS_SetFDFlags(int FD, int Mask, int Value);
+
/**
* \brief Get file information from an open file
* \param FD File handle returned by ::VFS_Open
LOG("VFS_DuplicateFD(%i,%i)", Regs->Arg1, Regs->Arg2);
ret = VFS_DuplicateFD(Regs->Arg1, Regs->Arg2);
break;
-
+
+ case SYS_FDCTL:
+ LOG("VFS_SetFDFlags(%i,0%o,0%o)", Regs->Arg1, Regs->Arg2, Regs->Arg3);
+ ret = VFS_SetFDFlags(Regs->Arg1, Regs->Arg2, Regs->Arg3);
+ break;
+
case SYS_SEEK:
#if BITS == 64
ret = VFS_Seek( Regs->Arg1, Regs->Arg2, Regs->Arg3 );
// === PROTOTYPES ===
void _ReferenceMount(tVFS_Mount *Mount, const char *DebugTag);
void _DereferenceMount(tVFS_Mount *Mount, const char *DebugTag);
- int VFS_int_CreateHandle( tVFS_Node *Node, tVFS_Mount *Mount, int Mode );
+ int VFS_int_CreateHandle(tVFS_Node *Node, tVFS_Mount *Mount, int Mode);
// === CODE ===
void _ReferenceMount(tVFS_Mount *Mount, const char *DebugTag)
return DstFD;
}
+/*
+ * Update flags on a FD
+ */
+int VFS_SetFDFlags(int FD, int Mask, int Value)
+{
+ tVFS_Handle *h = VFS_GetHandle(FD);
+ if(!FD) return -1;
+ int ret = h->Mode;
+
+ Value &= Mask;
+ h->Mode &= ~Mask;
+ h->Mode |= Value;
+ return ret;
+}
+
/**
* \brief Change current working directory
*/