diff -ruN kozos23.orig/clock.c kozos23/clock.c
--- kozos23.orig/clock.c	2007-12-04 22:43:50.000000000 +0900
+++ kozos23/clock.c	2007-12-08 15:01:07.000000000 +0900
@@ -13,7 +13,7 @@
   char *p;
 
   while (1) {
-    kz_timer(1000);
+    kz_timer(999);
     kz_recv(NULL, NULL);
 
     t = time(NULL);
diff -ruN kozos23.orig/extintr.c kozos23/extintr.c
--- kozos23.orig/extintr.c	2007-12-04 22:43:50.000000000 +0900
+++ kozos23/extintr.c	2007-12-08 14:29:41.000000000 +0900
@@ -107,7 +107,7 @@
   ibp->id = id;
   if (addrp) {
     ibp->type = INTR_TYPE_ACCEPT;
-    memcpy(&ibp->addr, addrp, addrp->sa_len);
+    memcpy(&ibp->addr, addrp, sizeof(*addrp));
   } else {
     ibp->type = INTR_TYPE_READ;
     memset(&ibp->addr, 0, sizeof(ibp->addr));
@@ -125,7 +125,8 @@
 {
   fd_set fds;
   char *p, *buffer;
-  int fd, id, ret, cnt_fd = -1, size, s, len;
+  int fd, id, ret, cnt_fd = -1, size, s;
+  socklen_t len;
   struct timeval tm = {0, 0};
   intrbuf *ibp;
   int fildes[2];
@@ -147,7 +148,7 @@
 	  if (FD_ISSET(ibp->fd, &fds)) {
 	    switch (ibp->type) {
 	    case INTR_TYPE_ACCEPT:
-	      len = ibp->addr.sa_len;
+	      len = sizeof(ibp->addr);
 	      s = accept(ibp->fd, &ibp->addr, &len);
 	      if (s > 0)
 		kz_send(ibp->id, s, NULL);
diff -ruN kozos23.orig/httpd.c kozos23/httpd.c
--- kozos23.orig/httpd.c	2007-12-04 22:43:50.000000000 +0900
+++ kozos23/httpd.c	2007-12-08 14:23:08.000000000 +0900
@@ -72,7 +72,7 @@
 
   memset(&address, 0, sizeof(address));
   address.sin_family = AF_INET;
-  address.sin_len = sizeof(address);
+  /* address.sin_len = sizeof(address); */
   address.sin_port = htons(PORT);
   memcpy(&(address.sin_addr), host->h_addr, host->h_length);
 
diff -ruN kozos23.orig/i386-stub.c kozos23/i386-stub.c
--- kozos23.orig/i386-stub.c	2007-12-04 22:43:50.000000000 +0900
+++ kozos23/i386-stub.c	2007-12-08 14:43:06.000000000 +0900
@@ -466,7 +466,7 @@
 unsigned char *
 getpacket (void)
 {
-  unsigned char *buffer = &remcomInBuffer[0];
+  unsigned char *buffer = (unsigned char *)&remcomInBuffer[0];
   unsigned char checksum;
   unsigned char xmitcsum;
   int count;
@@ -838,14 +838,14 @@
 
   *ptr = '\0';
 
-  putpacket (remcomOutBuffer);
+  putpacket ((unsigned char *)remcomOutBuffer);
 
   stepping = 0;
 
   while (1 == 1)
     {
       remcomOutBuffer[0] = 0;
-      ptr = getpacket ();
+      ptr = (char *)getpacket ();
 
       switch (*ptr++)
 	{
@@ -1139,7 +1139,7 @@
 	}			/* switch */
 
       /* reply to the request */
-      putpacket (remcomOutBuffer);
+      putpacket ((unsigned char *)remcomOutBuffer);
     }
 }
 
diff -ruN kozos23.orig/stubd.c kozos23/stubd.c
--- kozos23.orig/stubd.c	2007-12-04 22:43:50.000000000 +0900
+++ kozos23/stubd.c	2007-12-08 14:28:47.000000000 +0900
@@ -14,7 +14,8 @@
 
 int stubd_main(int argc, char *argv[])
 {
-  int sockt, s, ret, len;
+  int sockt, s, ret;
+  socklen_t len;
   char hostname[256];
   struct hostent *host;
   struct sockaddr_in address;
@@ -34,7 +35,7 @@
 
   memset(&address, 0, sizeof(address));
   address.sin_family = AF_INET;
-  address.sin_len = sizeof(address);
+  /* address.sin_len = sizeof(address); */
   address.sin_port = htons(PORT);
   memcpy(&(address.sin_addr), host->h_addr, host->h_length);
 
diff -ruN kozos23.orig/stublib.c kozos23/stublib.c
--- kozos23.orig/stublib.c	2007-12-04 22:43:50.000000000 +0900
+++ kozos23/stublib.c	2007-12-08 14:21:48.000000000 +0900
@@ -3,6 +3,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#define __USE_GNU
 #include "kozos.h"
 #include "thread.h"
 #include "stublib.h"
@@ -101,42 +102,42 @@
 {
   memset(registers, 0, sizeof(registers));
 
-  registers[EAX] = thp->context.uap.uc_mcontext.mc_eax;
-  registers[ECX] = thp->context.uap.uc_mcontext.mc_ecx;
-  registers[EDX] = thp->context.uap.uc_mcontext.mc_edx;
-  registers[EBX] = thp->context.uap.uc_mcontext.mc_ebx;
-  registers[ESP] = thp->context.uap.uc_mcontext.mc_esp;
-  registers[EBP] = thp->context.uap.uc_mcontext.mc_ebp;
-  registers[ESI] = thp->context.uap.uc_mcontext.mc_esi;
-  registers[EDI] = thp->context.uap.uc_mcontext.mc_edi;
-  registers[PC]  = thp->context.uap.uc_mcontext.mc_eip;
-  registers[PS]  = thp->context.uap.uc_mcontext.mc_eflags;
-  registers[CS]  = thp->context.uap.uc_mcontext.mc_cs;
-  registers[SS]  = thp->context.uap.uc_mcontext.mc_ss;
-  registers[DS]  = thp->context.uap.uc_mcontext.mc_ds;
-  registers[ES]  = thp->context.uap.uc_mcontext.mc_es;
-  registers[FS]  = thp->context.uap.uc_mcontext.mc_fs;
-  registers[GS]  = thp->context.uap.uc_mcontext.mc_gs;
+  registers[EAX] = thp->context.uap.uc_mcontext.gregs[REG_EAX];
+  registers[ECX] = thp->context.uap.uc_mcontext.gregs[REG_ECX];
+  registers[EDX] = thp->context.uap.uc_mcontext.gregs[REG_EDX];
+  registers[EBX] = thp->context.uap.uc_mcontext.gregs[REG_EBX];
+  registers[ESP] = thp->context.uap.uc_mcontext.gregs[REG_ESP];
+  registers[EBP] = thp->context.uap.uc_mcontext.gregs[REG_EBP];
+  registers[ESI] = thp->context.uap.uc_mcontext.gregs[REG_ESI];
+  registers[EDI] = thp->context.uap.uc_mcontext.gregs[REG_EDI];
+  registers[PC]  = thp->context.uap.uc_mcontext.gregs[REG_EIP];
+  registers[PS]  = thp->context.uap.uc_mcontext.gregs[REG_EFL];
+  registers[CS]  = thp->context.uap.uc_mcontext.gregs[REG_CS];
+  registers[SS]  = thp->context.uap.uc_mcontext.gregs[REG_SS];
+  registers[DS]  = thp->context.uap.uc_mcontext.gregs[REG_DS];
+  registers[ES]  = thp->context.uap.uc_mcontext.gregs[REG_ES];
+  registers[FS]  = thp->context.uap.uc_mcontext.gregs[REG_FS];
+  registers[GS]  = thp->context.uap.uc_mcontext.gregs[REG_GS];
 }
 
 void stub_restore_regs(kz_thread *thp)
 {
-  thp->context.uap.uc_mcontext.mc_eax    = registers[EAX];
-  thp->context.uap.uc_mcontext.mc_ecx    = registers[ECX];
-  thp->context.uap.uc_mcontext.mc_edx    = registers[EDX];
-  thp->context.uap.uc_mcontext.mc_ebx    = registers[EBX];
-  thp->context.uap.uc_mcontext.mc_esp    = registers[ESP];
-  thp->context.uap.uc_mcontext.mc_ebp    = registers[EBP];
-  thp->context.uap.uc_mcontext.mc_esi    = registers[ESI];
-  thp->context.uap.uc_mcontext.mc_edi    = registers[EDI];
-  thp->context.uap.uc_mcontext.mc_eip    = registers[PC];
-  thp->context.uap.uc_mcontext.mc_eflags = registers[PS];
-  thp->context.uap.uc_mcontext.mc_cs     = registers[CS];
-  thp->context.uap.uc_mcontext.mc_ss     = registers[SS];
-  thp->context.uap.uc_mcontext.mc_ds     = registers[DS];
-  thp->context.uap.uc_mcontext.mc_es     = registers[ES];
-  thp->context.uap.uc_mcontext.mc_fs     = registers[FS];
-  thp->context.uap.uc_mcontext.mc_gs     = registers[GS];
+  thp->context.uap.uc_mcontext.gregs[REG_EAX] = registers[EAX];
+  thp->context.uap.uc_mcontext.gregs[REG_ECX] = registers[ECX];
+  thp->context.uap.uc_mcontext.gregs[REG_EDX] = registers[EDX];
+  thp->context.uap.uc_mcontext.gregs[REG_EBX] = registers[EBX];
+  thp->context.uap.uc_mcontext.gregs[REG_ESP] = registers[ESP];
+  thp->context.uap.uc_mcontext.gregs[REG_EBP] = registers[EBP];
+  thp->context.uap.uc_mcontext.gregs[REG_ESI] = registers[ESI];
+  thp->context.uap.uc_mcontext.gregs[REG_EDI] = registers[EDI];
+  thp->context.uap.uc_mcontext.gregs[REG_EIP] = registers[PC];
+  thp->context.uap.uc_mcontext.gregs[REG_EFL] = registers[PS];
+  thp->context.uap.uc_mcontext.gregs[REG_CS]  = registers[CS];
+  thp->context.uap.uc_mcontext.gregs[REG_SS]  = registers[SS];
+  thp->context.uap.uc_mcontext.gregs[REG_DS]  = registers[DS];
+  thp->context.uap.uc_mcontext.gregs[REG_ES]  = registers[ES];
+  thp->context.uap.uc_mcontext.gregs[REG_FS]  = registers[FS];
+  thp->context.uap.uc_mcontext.gregs[REG_GS]  = registers[GS];
 }
 
 int stub_proc(kz_thread *thp, int signo)
diff -ruN kozos23.orig/t2w.c kozos23/t2w.c
--- kozos23.orig/t2w.c	2007-12-04 22:43:50.000000000 +0900
+++ kozos23/t2w.c	2007-12-08 14:24:27.000000000 +0900
@@ -6,6 +6,15 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 
+typedef Elf32_Ehdr Elf_Ehdr;
+typedef Elf32_Phdr Elf_Phdr;
+
+#define IS_ELF(ehdr) ( \
+	((ehdr).e_ident[EI_MAG0] == ELFMAG0) && \
+	((ehdr).e_ident[EI_MAG1] == ELFMAG1) && \
+	((ehdr).e_ident[EI_MAG2] == ELFMAG2) && \
+	((ehdr).e_ident[EI_MAG3] == ELFMAG3))
+
 int main(int argc, char *argv[])
 {
   int fd, i;
diff -ruN kozos23.orig/telnetd.c kozos23/telnetd.c
--- kozos23.orig/telnetd.c	2007-12-04 22:43:50.000000000 +0900
+++ kozos23/telnetd.c	2007-12-08 14:24:46.000000000 +0900
@@ -111,7 +111,7 @@
 
   memset(&address, 0, sizeof(address));
   address.sin_family = AF_INET;
-  address.sin_len = sizeof(address);
+  /* address.sin_len = sizeof(address); */
   address.sin_port = htons(PORT);
   memcpy(&(address.sin_addr), host->h_addr, host->h_length);
 
