git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel - Made tFInfo packed to fix size mismatches between user and kernel land
[tpg/acess2.git]
/
Kernel
/
vfs
/
handle.c
diff --git
a/Kernel/vfs/handle.c
b/Kernel/vfs/handle.c
index
4a8d478
..
55c841e
100644
(file)
--- a/
Kernel/vfs/handle.c
+++ b/
Kernel/vfs/handle.c
@@
-13,11
+13,13
@@
#define MAX_KERNEL_FILES 128
// === PROTOTYPES ===
#define MAX_KERNEL_FILES 128
// === PROTOTYPES ===
+#if 0
tVFS_Handle *VFS_GetHandle(int FD);
tVFS_Handle *VFS_GetHandle(int FD);
+#endif
int VFS_AllocHandle(int FD, tVFS_Node *Node, int Mode);
// === GLOBALS ===
int VFS_AllocHandle(int FD, tVFS_Node *Node, int Mode);
// === GLOBALS ===
-tVFS_Handle *gaUserHandles = (void*)MM_PPD_
VF
S;
+tVFS_Handle *gaUserHandles = (void*)MM_PPD_
HANDLE
S;
tVFS_Handle *gaKernelHandles = (void*)MM_KERNEL_VFS;
// === CODE ===
tVFS_Handle *gaKernelHandles = (void*)MM_KERNEL_VFS;
// === CODE ===
@@
-60,7
+62,13
@@
int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode)
Uint addr, size;
size = CFGINT(CFG_VFS_MAXFILES) * sizeof(tVFS_Handle);
for(addr = 0; addr < size; addr += 0x1000)
Uint addr, size;
size = CFGINT(CFG_VFS_MAXFILES) * sizeof(tVFS_Handle);
for(addr = 0; addr < size; addr += 0x1000)
- MM_Allocate( (Uint)gaUserHandles + addr );
+ {
+ if( !MM_Allocate( (Uint)gaUserHandles + addr ) )
+ {
+ Warning("OOM - VFS_AllocHandle");
+ Threads_Exit(0, 0xFF); // Terminate user
+ }
+ }
memset( gaUserHandles, 0, size );
}
// Get a handle
memset( gaUserHandles, 0, size );
}
// Get a handle
@@
-81,7
+89,13
@@
int VFS_AllocHandle(int bIsUser, tVFS_Node *Node, int Mode)
Uint addr, size;
size = MAX_KERNEL_FILES * sizeof(tVFS_Handle);
for(addr = 0; addr < size; addr += 0x1000)
Uint addr, size;
size = MAX_KERNEL_FILES * sizeof(tVFS_Handle);
for(addr = 0; addr < size; addr += 0x1000)
- MM_Allocate( (Uint)gaKernelHandles + addr );
+ {
+ if( !MM_Allocate( (Uint)gaKernelHandles + addr ) )
+ {
+ Panic("OOM - VFS_AllocHandle");
+ Threads_Exit(0, 0xFF); // Terminate application (get some space back)
+ }
+ }
memset( gaKernelHandles, 0, size );
}
// Get a handle
memset( gaKernelHandles, 0, size );
}
// Get a handle
UCC
git Repository :: git.ucc.asn.au