AcessNative - Changes to allow _compiling_ on windows.
[tpg/acess2.git] / AcessNative / acesskernel_src / main.c
index 8f03f9a..e5d8bab 100644 (file)
@@ -13,6 +13,7 @@
 #endif
 #include <unistd.h>
 #include <string.h>
+#include "../../KernelLand/Kernel/include/logdebug.h"
 
 #define VALGRIND_CLIENT        0
 
@@ -28,6 +29,7 @@ extern int    VT_Install(char **Arguments);
 extern int     VFS_Mount(const char *Device, const char *MountPoint, const char *Filesystem, const char *Options);
 extern int     VFS_MkDir(const char *Path);
 extern int     SyscallServer(void);
+extern int     Server_Shutdown(void);
 extern const char      gsKernelVersion[];
 extern const char      gsGitHash[];
 extern int     giBuildNumber;
@@ -65,7 +67,9 @@ int main(int argc, char *argv[])
        UI_Initialise(800, 480);
        
        // - Ignore SIGUSR1 (used to wake threads)
+       #ifdef SIGUSR1
        signal(SIGUSR1, SIG_IGN);
+       #endif
                
        // Initialise VFS
        VFS_Init();
@@ -100,7 +104,7 @@ int main(int argc, char *argv[])
        {
                 int    pid;
                 int    argcount = 0;
-               char    *args[7+rootapp_argc+1+1];
+               const char      *args[7+rootapp_argc+1+1];
 
                #if VALGRIND_CLIENT
                args[argcount++] = "valgrind";
@@ -112,23 +116,11 @@ int main(int argc, char *argv[])
                for( i = 0; i < rootapp_argc; i ++ )
                        args[argcount+i] = rootapp[i];
                args[argcount+rootapp_argc] = NULL;
-               
-               pid = fork();
+               pid = spawnv(P_NOWAIT, "./ld-acess", args);
                if(pid < 0) {
                        perror("Starting root application [fork(2)]");
                        return 1;
                }
-               if(pid == 0)
-               {
-                       #ifdef __LINUX__
-                       prctl(PR_SET_PDEATHSIG, SIGHUP);        // LINUX ONLY!
-                       #endif
-                       #if VALGRIND_CLIENT
-                       execv("valgrind", args);
-                       #else
-                       execv("./ld-acess", args);
-                       #endif
-               }
                printf("Root application running as PID %i\n", pid);
        }
 
@@ -140,6 +132,7 @@ int main(int argc, char *argv[])
 void AcessNative_Exit(void)
 {
        // TODO: Close client applications too
+       Server_Shutdown();
        exit(0);
 }
 

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