AcessKernel - cleaning up debug messages
[tpg/acess2.git] / AcessNative / ld-acess_src / syscalls.c
index 91b8de6..3fdbc72 100644 (file)
 #include <unistd.h>
 #include "request.h"
 
+#if SYSCALL_TRACE
 #define DEBUG(str, x...)       Debug(str, x)
+#else
+#define DEBUG(...)     do{}while(0)
+#endif
 
 #define        MAX_FPS 16
 
@@ -206,6 +210,7 @@ uint64_t _Syscall(int SyscallID, const char *ArgTypes, ...)
        req->ClientID = 0;      //< Filled later
        req->CallID = SyscallID;
        req->NParams = paramCount;
+       req->MessageLength = dataLength;
        dataPtr = &req->Params[paramCount];
        
        // Fill `output` and `input`
@@ -253,6 +258,11 @@ uint64_t _Syscall(int SyscallID, const char *ArgTypes, ...)
        }
        
        // 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 ++ )
        {
@@ -318,10 +328,10 @@ uint64_t native_tell(int FD)
        return ftell( gaSyscall_LocalFPs[FD] );
 }
 
-int native_execve(const char *filename, char *const argv[], char *const envp[])
+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;
 }

UCC git Repository :: git.ucc.asn.au