git.ucc.asn.au
/
tpg
/
acess2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d0b4559
)
AcessNative - TCP client implimented, buggy
author
John Hodge
<
[email protected]
>
Wed, 3 Oct 2012 06:11:18 +0000
(14:11 +0800)
committer
John Hodge
<
[email protected]
>
Wed, 3 Oct 2012 06:11:18 +0000
(14:11 +0800)
AcessNative/RunTest
patch
|
blob
|
history
AcessNative/acesskernel_src/server.c
patch
|
blob
|
history
AcessNative/acesskernel_src/ui_sdl.c
patch
|
blob
|
history
AcessNative/ld-acess_src/request.c
patch
|
blob
|
history
BuildConf/x86/Makefile.cfg
patch
|
blob
|
history
diff --git
a/AcessNative/RunTest
b/AcessNative/RunTest
index
6ea88b6
..
f2621d4
100755
(executable)
--- a/
AcessNative/RunTest
+++ b/
AcessNative/RunTest
@@
-1,6
+1,6
@@
#!/bin/sh
trap '' 2
#!/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
trap 2
killall ld-acess
diff --git
a/AcessNative/acesskernel_src/server.c
b/AcessNative/acesskernel_src/server.c
index
2e3f3a9
..
02aa290
100644
(file)
--- a/
AcessNative/acesskernel_src/server.c
+++ b/
AcessNative/acesskernel_src/server.c
@@
-132,11
+132,15
@@
int Server_WorkerThread(void *ClientPtr)
for( ;; )
{
fd_set fds;
for( ;; )
{
fd_set fds;
- int nfd = Client->Socket;
+ int nfd = Client->Socket
+1
;
FD_ZERO(&fds);
FD_SET(Client->Socket, &fds);
FD_ZERO(&fds);
FD_SET(Client->Socket, &fds);
- select(nfd, &fds, NULL, NULL, NULL); // TODO: Timeouts?
+ int rv = select(nfd, &fds, NULL, NULL, NULL); // TODO: Timeouts?
+ if(rv <= 0) {
+ perror("select");
+ continue ;
+ }
if( FD_ISSET(Client->Socket, &fds) )
{
if( FD_ISSET(Client->Socket, &fds) )
{
@@
-144,15
+148,24
@@
int Server_WorkerThread(void *ClientPtr)
char lbuf[sizeof(tRequestHeader) + ciMaxParamCount*sizeof(tRequestValue)];
tRequestHeader *hdr = (void*)lbuf;
size_t len = recv(Client->Socket, hdr, sizeof(*hdr), 0);
char lbuf[sizeof(tRequestHeader) + ciMaxParamCount*sizeof(tRequestValue)];
tRequestHeader *hdr = (void*)lbuf;
size_t len = recv(Client->Socket, hdr, sizeof(*hdr), 0);
- if( len != sizeof(hdr) ) {
+ Log_Debug("Server", "%i bytes of header", len);
+ if( len == 0 ) break;
+ if( len != sizeof(*hdr) ) {
// Oops?
// Oops?
+ Log_Warning("Server", "FD%i bad sized (%i != exp %i)",
+ Client->Socket, len, sizeof(*hdr));
+ continue ;
}
if( hdr->NParams > ciMaxParamCount ) {
// Oops.
}
if( hdr->NParams > ciMaxParamCount ) {
// Oops.
+ Log_Warning("Server", "FD%i too many params (%i > max %i)",
+ Client->Socket, hdr->NParams, ciMaxParamCount);
+ continue ;
}
len = recv(Client->Socket, hdr->Params, hdr->NParams*sizeof(tRequestValue), 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.
}
if( len != hdr->NParams*sizeof(tRequestValue) ) {
// Oops.
}
@@
-174,6
+187,7
@@
int Server_WorkerThread(void *ClientPtr)
hdr = malloc(bufsize);
memcpy(hdr, lbuf, hdrsize);
len = recv(Client->Socket, hdr->Params + hdr->NParams, bufsize - hdrsize, 0);
hdr = malloc(bufsize);
memcpy(hdr, lbuf, hdrsize);
len = recv(Client->Socket, hdr->Params + hdr->NParams, bufsize - hdrsize, 0);
+ Log_Debug("Server", "%i bytes of data", len);
if( len != bufsize - hdrsize ) {
// Oops?
}
if( len != bufsize - hdrsize ) {
// Oops?
}
@@
-183,6
+197,8
@@
int Server_WorkerThread(void *ClientPtr)
retHeader = SyscallRecieve(hdr, &retlen);
if( !retHeader ) {
// Some sort of error
retHeader = SyscallRecieve(hdr, &retlen);
if( !retHeader ) {
// Some sort of error
+ Log_Warning("Server", "SyscallRecieve failed?");
+ continue ;
}
send(Client->Socket, retHeader, retlen, 0);
}
send(Client->Socket, retHeader, retlen, 0);
@@
-343,8
+359,13
@@
int Server_ListenThread(void *Unused)
len = recv(clientSock, &authhdr, sizeof(authhdr), 0);
if( len != sizeof(authhdr) ) {
// Some form of error?
len = recv(clientSock, &authhdr, sizeof(authhdr), 0);
if( len != sizeof(authhdr) ) {
// Some form of error?
+ Log_Warning("Server", "Client auth block bad size (%i != exp %i)",
+ len, sizeof(authhdr));
+ continue ;
}
}
+ Log_Debug("Server", "Client assumed PID %i", authhdr.pid);
+
tClient *client;
if( authhdr.pid == 0 ) {
// Allocate PID and client structure/thread
tClient *client;
if( authhdr.pid == 0 ) {
// Allocate PID and client structure/thread
@@
-365,6
+386,7
@@
int Server_ListenThread(void *Unused)
client->Socket = clientSock;
}
}
client->Socket = clientSock;
}
}
+ Log_Debug("Server", "Client given PID %i", authhdr.pid);
len = send(clientSock, &authhdr, sizeof(authhdr), 0);
if( len != sizeof(authhdr) ) {
len = send(clientSock, &authhdr, sizeof(authhdr), 0);
if( len != sizeof(authhdr) ) {
diff --git
a/AcessNative/acesskernel_src/ui_sdl.c
b/AcessNative/acesskernel_src/ui_sdl.c
index
520ac00
..
ae1d811
100644
(file)
--- a/
AcessNative/acesskernel_src/ui_sdl.c
+++ b/
AcessNative/acesskernel_src/ui_sdl.c
@@
-102,6
+102,8
@@
Uint32 UI_GetAcessKeyFromSDL(SDLKey Sym, Uint16 Unicode)
case SDLK_F11: ret = KEY_F11; break;
case SDLK_F12: ret = KEY_F12; break;
case SDLK_RETURN: ret = '\n'; break;
case SDLK_F11: ret = KEY_F11; break;
case SDLK_F12: ret = KEY_F12; break;
case SDLK_RETURN: ret = '\n'; break;
+ case SDLK_LALT: ret = KEY_LALT; break;
+ case SDLK_RALT: ret = KEY_RALT; break;
default:
printf("Unhandled key code %i\n", Sym);
break;
default:
printf("Unhandled key code %i\n", Sym);
break;
diff --git
a/AcessNative/ld-acess_src/request.c
b/AcessNative/ld-acess_src/request.c
index
2117591
..
670cc3d
100644
(file)
--- a/
AcessNative/ld-acess_src/request.c
+++ b/
AcessNative/ld-acess_src/request.c
@@
-1,6
+1,6
@@
/*
*/
/*
*/
-#define DEBUG
0
+#define DEBUG
1
#if DEBUG
#if DEBUG
@@
-13,6
+13,7
@@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <inttypes.h>
#ifdef __WIN32__
# include <windows.h>
# include <winsock.h>
#ifdef __WIN32__
# include <windows.h>
# include <winsock.h>
@@
-24,7
+25,7
@@
#include "request.h"
#include "../syscalls.h"
#include "request.h"
#include "../syscalls.h"
-#define USE_TCP
0
+#define USE_TCP
1
// === PROTOTYPES ===
void SendData(void *Data, int Length);
// === PROTOTYPES ===
void SendData(void *Data, int Length);
@@
-91,7
+92,6
@@
int _InitSyscalls(void)
if( connect(gSocket, (struct sockaddr *)&gSyscall_ServerAddr, sizeof(struct sockaddr_in)) < 0 )
{
fprintf(stderr, "[ERROR -] Cannot connect to server (localhost:%i)\n", SERVER_PORT);
if( connect(gSocket, (struct sockaddr *)&gSyscall_ServerAddr, sizeof(struct sockaddr_in)) < 0 )
{
fprintf(stderr, "[ERROR -] Cannot connect to server (localhost:%i)\n", SERVER_PORT);
- fprintf(stderr, "[ERROR -] ", giSyscall_ClientID);
perror("_InitSyscalls");
#if __WIN32__
closesocket(gSocket);
perror("_InitSyscalls");
#if __WIN32__
closesocket(gSocket);
@@
-118,7
+118,19
@@
int _InitSyscalls(void)
}
#endif
}
#endif
- #if !USE_TCP
+ #if USE_TCP
+ {
+ tRequestAuthHdr auth;
+ auth.pid = giSyscall_ClientID;
+ SendData(&auth, sizeof(auth));
+ int len = ReadData(&auth, sizeof(auth), 5);
+ if( len == 0 ) {
+ fprintf(stderr, "Timeout waiting for auth response\n");
+ exit(-1);
+ }
+ giSyscall_ClientID = auth.pid;
+ }
+ #else
// Ask server for a client ID
if( !giSyscall_ClientID )
{
// Ask server for a client ID
if( !giSyscall_ClientID )
{
@@
-190,7
+202,7
@@
int SendRequest(tRequestHeader *Request, int RequestSize, int ResponseSize)
data += sizeof(uint32_t);
break;
case ARG_TYPE_INT64:
data += sizeof(uint32_t);
break;
case ARG_TYPE_INT64:
- DEBUG_S(" 0x%016
llx
", *(uint64_t*)data);
+ DEBUG_S(" 0x%016
"PRIx64"
", *(uint64_t*)data);
data += sizeof(uint64_t);
break;
case ARG_TYPE_STRING:
data += sizeof(uint64_t);
break;
case ARG_TYPE_STRING:
@@
-221,7
+233,7
@@
void SendData(void *Data, int Length)
int len;
#if USE_TCP
int len;
#if USE_TCP
- len = send(Data, Length, 0);
+ len = send(
gSocket,
Data, Length, 0);
#else
len = sendto(gSocket, Data, Length, 0,
(struct sockaddr*)&gSyscall_ServerAddr, sizeof(gSyscall_ServerAddr));
#else
len = sendto(gSocket, Data, Length, 0,
(struct sockaddr*)&gSyscall_ServerAddr, sizeof(gSyscall_ServerAddr));
diff --git
a/BuildConf/x86/Makefile.cfg
b/BuildConf/x86/Makefile.cfg
index
7b3d8a9
..
76c3d3c
100644
(file)
--- a/
BuildConf/x86/Makefile.cfg
+++ b/
BuildConf/x86/Makefile.cfg
@@
-2,10
+2,13
@@
# Acess2 Build Configuration
#
# Acess2 Build Configuration
#
-CC = i586-elf-gcc
-LD = i586-elf-ld
+#CC = i586-elf-gcc
+#LD = i586-elf-ld
+CC = gcc
+LD = ld
AS = nasm
AS = nasm
-OBJDUMP = i586-elf-objdump
+#OBJDUMP = i586-elf-objdump
+OBJDUMP = objdump
RM = @rm -f
STRIP = strip
RM = @rm -f
STRIP = strip
UCC
git Repository :: git.ucc.asn.au