From: John Hodge Date: Sun, 22 Sep 2013 11:07:00 +0000 (+0800) Subject: Kernel - Stopped unneeded VFS handle save/restore on spawn X-Git-Tag: rel0.15~197 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=f8be4e59ce8a53869ccf375f8a01e4e8ad88ef2c;p=tpg%2Facess2.git Kernel - Stopped unneeded VFS handle save/restore on spawn --- diff --git a/KernelLand/Kernel/binary.c b/KernelLand/Kernel/binary.c index f6186739..cca55b48 100644 --- a/KernelLand/Kernel/binary.c +++ b/KernelLand/Kernel/binary.c @@ -32,6 +32,7 @@ extern tBinaryType gELF_Info; // === PROTOTYPES === int 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); tVAddr Binary_MapIn(tBinary *Binary, const char *Path, tVAddr LoadMin, tVAddr LoadMax); @@ -191,7 +192,7 @@ int Proc_SysSpawn(const char *Binary, const char **ArgV, const char **EnvP, int VFS_RestoreHandles(nFD, handles); VFS_FreeSavedHandles(nFD, handles); // Frees cachebuf - Proc_Execve(Binary, ArgV, EnvP, size); + Proc_int_Execve(Binary, ArgV, EnvP, size, 0); for(;;); } if( ret == -1 ) @@ -211,6 +212,11 @@ int Proc_SysSpawn(const char *Binary, const char **ArgV, const char **EnvP, int * \note Called Proc_ for historical reasons */ int Proc_Execve(const char *File, const char **ArgV, const char **EnvP, int DataSize) +{ + return Proc_int_Execve(File, ArgV, EnvP, DataSize, 1); +} + +int Proc_int_Execve(const char *File, const char **ArgV, const char **EnvP, int DataSize, bool bClearUser) { void *cachebuf; tVAddr entry; @@ -236,6 +242,7 @@ int Proc_Execve(const char *File, const char **ArgV, const char **EnvP, int Data // --- Clear User Address space // NOTE: This is a little roundabout, maybe telling ClearUser to not touch the // PPD area would be a better idea. + if( bClearUser ) { int nfd = *Threads_GetMaxFD(); void *handles;