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);
/**
* \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;
*/
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);
* semaphore.c
* - Semaphores
*/
+#define DEBUG 0
#include <acess.h>
#include <semaphore.h>
#include <threads_int.h>
//
void Semaphore_Init(tSemaphore *Sem, int Value, int MaxValue, const char *Module, const char *Name)
{
+ LOG("Init %p to %i/%i (%s:%s)", Sem, Value, MaxValue, Module, Name);
memset(Sem, 0, sizeof(tSemaphore));
Sem->Value = Value;
Sem->ModName = Module;
MaxToTake, Sem, Sem->Name);
MaxToTake = 0;
}
+ LOG("Waiting on %p for %i (%i/%i used atm) - (%s:%s)",
+ Sem, MaxToTake, Sem->Value, Sem->MaxValue, Sem->ModName, Sem->Name);
SHORTLOCK( &Sem->Protector );
+ LOG("Protector grabbed");
// Check if there's already items avaliable
if( Sem->Value > 0 )