AcessNative - Misc testing and bugfixing
authorJohn Hodge <[email protected]>
Thu, 4 Oct 2012 04:09:47 +0000 (12:09 +0800)
committerJohn Hodge <[email protected]>
Thu, 4 Oct 2012 04:09:47 +0000 (12:09 +0800)
AcessNative/RunTest
AcessNative/acesskernel_src/main.c
AcessNative/acesskernel_src/server.c
AcessNative/ld-acess_src/Makefile
AcessNative/ld-acess_src/request.c

index f2621d4..6ea88b6 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 trap '' 2
-$1 ./AcessKernel --rootapp /Acess/SBin/login
-#$1 ./AcessKernel --rootapp /Acess/Apps/AxWin/3.0/AxWinWM
+#$1 ./AcessKernel --rootapp /Acess/SBin/login
+$1 ./AcessKernel --rootapp /Acess/Apps/AxWin/3.0/AxWinWM
 trap 2
 killall ld-acess
index fbb457c..8f03f9a 100644 (file)
@@ -14,6 +14,8 @@
 #include <unistd.h>
 #include <string.h>
 
+#define VALGRIND_CLIENT        0
+
 // === IMPORTS ===
 extern int     UI_Initialise(int Width, int Height);
 extern void    UI_MainLoop(void);
@@ -97,15 +99,19 @@ int main(int argc, char *argv[])
        if( rootapp )
        {
                 int    pid;
-               char    *args[7+rootapp_argc+1];
-               
-               args[0] = "ld-acess";
-               args[1] = "--open";     args[2] = "/Devices/VTerm/0";
-               args[3] = "--open";     args[4] = "/Devices/VTerm/0";
-               args[5] = "--open";     args[6] = "/Devices/VTerm/0";
+                int    argcount = 0;
+               char    *args[7+rootapp_argc+1+1];
+
+               #if VALGRIND_CLIENT
+               args[argcount++] = "valgrind";
+               #endif
+               args[argcount++] = "./ld-acess";
+               args[argcount++] = "--open";    args[argcount++] = "/Devices/VTerm/0";
+               args[argcount++] = "--open";    args[argcount++] = "/Devices/VTerm/0";
+               args[argcount++] = "--open";    args[argcount++] = "/Devices/VTerm/0";
                for( i = 0; i < rootapp_argc; i ++ )
-                       args[7+i] = rootapp[i];
-               args[7+rootapp_argc] = NULL;
+                       args[argcount+i] = rootapp[i];
+               args[argcount+rootapp_argc] = NULL;
                
                pid = fork();
                if(pid < 0) {
@@ -117,7 +123,11 @@ int main(int argc, char *argv[])
                        #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);
        }
index 37694bf..bdc9879 100644 (file)
@@ -19,6 +19,7 @@
 #endif
 #include "../syscalls.h"
 //#include <debug.h>
+#include <errno.h>
 
 #define        USE_TCP 1
 #define MAX_CLIENTS    16
@@ -159,6 +160,11 @@ int Server_WorkerThread(void *ClientPtr)
                        size_t  len = recv(Client->Socket, hdr, sizeof(*hdr), 0);
                        Log_Debug("Server", "%i bytes of header", len);
                        if( len == 0 )  break;
+                       if( len == -1 ) {
+                               perror("recv header");
+//                             Log_Warning("Server", "recv() error - %s", strerror(errno));
+                               break;
+                       }
                        if( len != sizeof(*hdr) ) {
                                // Oops?
                                Log_Warning("Server", "FD%i bad sized (%i != exp %i)",
@@ -173,10 +179,17 @@ int Server_WorkerThread(void *ClientPtr)
                                continue ;
                        }
 
-                       len = recv(Client->Socket, hdr->Params, hdr->NParams*sizeof(tRequestValue), 0);
-                       Log_Debug("Server", "%i bytes of params", len);
-                       if( len != hdr->NParams*sizeof(tRequestValue) ) {
-                               // Oops.
+                       if( hdr->NParams > 0 )
+                       {
+                               len = recv(Client->Socket, hdr->Params, hdr->NParams*sizeof(tRequestValue), 0);
+                               Log_Debug("Server", "%i bytes of params", len);
+                               if( len != hdr->NParams*sizeof(tRequestValue) ) {
+                                       // Oops.
+                               }
+                       }
+                       else
+                       {
+                               Log_Debug("Server", "No params?");
                        }
 
                        // Get buffer size
index af7f8c8..419e47d 100644 (file)
@@ -20,7 +20,7 @@ endif
 
 CFLAGS   += -Wall
 CFLAGS   += -Werror
-CFLAGS   += -g
+CFLAGS   += -g -O2
 CPPFLAGS += -DARCHDIR_is_x86_64=1
 LDFLAGS  += -g -Wl,-T,obj-$(PLATFORM)/link.ld
 
@@ -36,6 +36,7 @@ clean:
 
 $(BIN): obj-$(PLATFORM)/link.ld $(OBJ)
        $(CC) $(LDFLAGS) -o $@ $(OBJ)
+       objdump -S $@ > [email protected]
 
 obj-$(PLATFORM)/%.o: %.c
        @mkdir -p $(dir $@)
@@ -47,7 +48,7 @@ obj-$(PLATFORM)/%.o: %.c
 obj-lin/link.ld:
        @mkdir -p $(dir $@)
        @echo "Making Linker Script ($@)"
-       $(LD) --verbose | awk '{ if( substr($$0,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x[048][0-9]*\b/$(LINKADDR)/g' | sed 's/CONSTANT (MAXPAGESIZE)/0x1000/g' > $@
+       $(LD) -g --verbose | awk '{ if( substr($$1,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x[048][0-9]*\b/$(LINKADDR)/g' | sed 's/CONSTANT (MAXPAGESIZE)/0x1000/g' > $@
 
 -include $(DEPFILES)
 
index 12a26d1..7a9b3b3 100644 (file)
@@ -122,6 +122,7 @@ int _InitSyscalls(void)
        {
                tRequestAuthHdr auth;
                auth.pid = giSyscall_ClientID;
+               auth.key = 0;
                SendData(&auth, sizeof(auth));
                int len = ReadData(&auth, sizeof(auth), 5);
                if( len == 0 ) { 

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