ent = VFS_int_GetUserHandles(PID, 1);
- maxhandles = *Threads_GetMaxFD();
+ maxhandles = *Threads_GetMaxFD(NULL);
memcpy(ent->Handles, cur->Handles, maxhandles*sizeof(tVFS_Handle));
// Reference all
LOG("Copying %i FDs from %i", nFD, PID);
- maxhandles = *Threads_GetMaxFD();
+ maxhandles = *Threads_GetMaxFD(NULL);
if( nFD > maxhandles )
nFD = maxhandles;
for( int i = 0; i < nFD; i ++ )
}
else
{
- tUserHandles *ent;
int pid = Threads_GetPID();
- int maxhandles = *Threads_GetMaxFD();
+ int maxhandles = *Threads_GetMaxFD(NULL);
- ent = VFS_int_GetUserHandles(pid, 0);
+ tUserHandles *ent = VFS_int_GetUserHandles(pid, 0);
if(!ent) {
Log_Error("VFS", "Client %i does not have a handle list (>)", pid);
return NULL;
else {
tUserHandles *ent;
int pid = Threads_GetPID();
- int maxhandles = *Threads_GetMaxFD();
+ int maxhandles = *Threads_GetMaxFD(NULL);
ent = VFS_int_GetUserHandles(pid, 0);
if(!ent) {
if(bIsUser)
{
tUserHandles *ent;
- int maxhandles = *Threads_GetMaxFD();
+ int maxhandles = *Threads_GetMaxFD(NULL);
// Find the PID's handle list
ent = VFS_int_GetUserHandles(Threads_GetPID(), 1);
// Get a handle
return -1;
}
+
+void VFS_ClearHandles(int PID)
+{
+ // Find the PID's handle list
+ tUserHandles *ent = VFS_int_GetUserHandles(PID, 0);
+ if( !ent ) return;
+ // Get a handle
+ int maxhandles = *Threads_GetMaxFD(NULL);
+ for( int i = 0; i < maxhandles; i ++ )
+ {
+ if(ent->Handles[i].Node) continue;
+ _CloseNode(ent->Handles[i].Node);
+ ent->Handles[i].Node = NULL;
+ }
+}