X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fbinary.c;h=3dab6a9210ca8fc9ef26f7c41710dff3cebc9c49;hb=e4978500b375ec6d919beacec14b3f132811b51c;hp=cca55b481cca1dcf5ce90d5de38cd62ac9bb5539;hpb=f8be4e59ce8a53869ccf375f8a01e4e8ad88ef2c;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/binary.c b/KernelLand/Kernel/binary.c index cca55b48..3dab6a92 100644 --- a/KernelLand/Kernel/binary.c +++ b/KernelLand/Kernel/binary.c @@ -31,7 +31,7 @@ extern tKernelSymbol gKernelSymbolsEnd[]; extern tBinaryType gELF_Info; // === PROTOTYPES === - int Binary_int_CacheArgs(const char **Path, const char ***ArgV, const char ***EnvP, void *DestBuffer); +size_t Binary_int_CacheArgs(const char **Path, const char ***ArgV, const char ***EnvP, void *DestBuffer); int Proc_int_Execve(const char *File, const char **ArgV, const char **EnvP, int DataSize, bool bClearUser); tVAddr Binary_Load(const char *Path, tVAddr *EntryPoint); tBinary *Binary_GetInfo(tMount MountID, tInode InodeID); @@ -95,9 +95,10 @@ int Proc_Spawn(const char *Path) /** * \todo Document */ -int Binary_int_CacheArgs(const char **Path, const char ***ArgV, const char ***EnvP, void *DestBuffer) +size_t Binary_int_CacheArgs(const char **Path, const char ***ArgV, const char ***EnvP, void *DestBuffer) { - int size, argc=0, envc=0; + size_t size; + int argc=0, envc=0; int i; char *strbuf; const char **arrays; @@ -172,21 +173,17 @@ int Binary_int_CacheArgs(const char **Path, const char ***ArgV, const char ***En */ int Proc_SysSpawn(const char *Binary, const char **ArgV, const char **EnvP, int nFD, int *FDs) { - void *handles; - void *cachebuf; - int size; - tPID ret; // --- Save File, ArgV and EnvP - size = Binary_int_CacheArgs( &Binary, &ArgV, &EnvP, NULL ); - cachebuf = malloc( size ); + size_t size = Binary_int_CacheArgs( &Binary, &ArgV, &EnvP, NULL ); + void *cachebuf = malloc( size ); Binary_int_CacheArgs( &Binary, &ArgV, &EnvP, cachebuf ); // Cache the VFS handles - handles = VFS_SaveHandles(nFD, FDs); + void *handles = VFS_SaveHandles(nFD, FDs); // Create new process - ret = Proc_Clone(CLONE_VM|CLONE_NOUSER); + tPID ret = Proc_Clone(CLONE_VM|CLONE_NOUSER); if( ret == 0 ) { VFS_RestoreHandles(nFD, handles); @@ -826,22 +823,20 @@ int Binary_GetSymbol(const char *Name, Uint *Val) */ Uint Binary_GetSymbolEx(const char *Name, Uint *Value) { - int i; tKernelBin *pKBin; int numKSyms = ((Uint)&gKernelSymbolsEnd-(Uint)&gKernelSymbols)/sizeof(tKernelSymbol); - LOG("numKSyms = %i", numKSyms); - // Scan Kernel - for( i = 0; i < numKSyms; i++ ) + for( int i = 0; i < numKSyms; i++ ) { - LOG("KSym %s = %p", gKernelSymbols[i].Name, gKernelSymbols[i].Value); if(strcmp(Name, gKernelSymbols[i].Name) == 0) { + LOG("KSym %s = %p", gKernelSymbols[i].Name, gKernelSymbols[i].Value); *Value = gKernelSymbols[i].Value; return 1; } } + // Scan Loaded Libraries for(pKBin = glLoadedKernelLibs; pKBin;