#include <string.h>
#include <stddef.h>
#include <unistd.h>
+#ifndef __WIN32__
+# include <spawn.h> // posix_spawn
+#endif
#include "request.h"
+#if SYSCALL_TRACE
#define DEBUG(str, x...) Debug(str, x)
+#else
+#define DEBUG(...) do{}while(0)
+#endif
#define MAX_FPS 16
req->ClientID = 0; //< Filled later
req->CallID = SyscallID;
req->NParams = paramCount;
+ req->MessageLength = dataLength;
dataPtr = &req->Params[paramCount];
// Fill `output` and `input`
}
// Write changes to buffers
+ if( req->NParams - 1 != retCount ) {
+ fprintf(stderr, "syscalls.c: Return count inbalance (%i - 1 != exp %i) [Call %i]\n",
+ req->NParams, retCount, SyscallID);
+ exit(127);
+ }
retCount = 0;
for( i = 1; i < req->NParams; i ++ )
{
int native_execve(const char *filename, const char *const argv[], const char *const envp[])
{
int ret;
- ret = execve(filename, argv, envp);
+ ret = execve(filename, (void*)argv, (void*)envp);
perror("native_execve");
return ret;
}
+
+int native_spawn(const char *filename, const char *const argv[], const char *const envp[])
+{
+ int rv;
+
+ #if __WIN32__
+ rv = _spawnve(_P_NOWAIT, filename, argv, envp);
+ #else
+ rv = posix_spawn(NULL, filename, NULL, NULL, (void*)argv, (void*)envp);
+ #endif
+
+ return rv;
+}