From: Lawrence S. <ljs...@us...> - 2020-06-29 01:44:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 921ec7f7e51d878cad495308506e08657ea11748 (commit) via 020adc506a6ba0bc0c60ee9e2693cc77d1034f70 (commit) from 2c06d3cfe11fad0ddd5a4d63e5e146b2c1ca33aa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 921ec7f7e51d878cad495308506e08657ea11748 Author: Lawrence Sebald <ljs...@us...> Date: Sun Jun 28 21:43:50 2020 -0400 Fix network/httpd example to compile against the built-in network stack. This is completely untested at the moment, but it at least compiles. commit 020adc506a6ba0bc0c60ee9e2693cc77d1034f70 Author: Lawrence Sebald <ljs...@us...> Date: Sun Jun 28 21:35:29 2020 -0400 Move lwip/http example to the network examples directory. The example still needs fixing to remove lwip stuff from it, but it will end up here in the end. ----------------------------------------------------------------------- Summary of changes: .../dreamcast/{lwip => network}/httpd/Makefile | 16 +++-------- examples/dreamcast/{lwip => network}/httpd/httpd.c | 32 +++++++++++---------- .../{lwip => network}/httpd/romdisk/changelog.html | 0 .../httpd/romdisk/documentation.html | 0 .../{lwip => network}/httpd/romdisk/download.html | 0 .../{lwip => network}/httpd/romdisk/img/sics.gif | Bin .../{lwip => network}/httpd/romdisk/index.html | 0 .../{lwip => network}/httpd/romdisk/licence.html | 0 .../{lwip => network}/httpd/romdisk/links.html | 0 .../httpd/romdisk/mailinglist.html | 0 .../{lwip => network}/httpd/romdisk/news.html | 0 .../dreamcast/{lwip => network}/httpd/simhost.c | 8 ------ 12 files changed, 21 insertions(+), 35 deletions(-) rename examples/dreamcast/{lwip => network}/httpd/Makefile (59%) rename examples/dreamcast/{lwip => network}/httpd/httpd.c (95%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/changelog.html (100%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/documentation.html (100%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/download.html (100%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/img/sics.gif (100%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/index.html (100%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/licence.html (100%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/links.html (100%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/mailinglist.html (100%) rename examples/dreamcast/{lwip => network}/httpd/romdisk/news.html (100%) rename examples/dreamcast/{lwip => network}/httpd/simhost.c (93%) diff --git a/examples/dreamcast/lwip/httpd/Makefile b/examples/dreamcast/network/httpd/Makefile similarity index 59% rename from examples/dreamcast/lwip/httpd/Makefile rename to examples/dreamcast/network/httpd/Makefile index 470fcc7..82d30ea 100644 --- a/examples/dreamcast/lwip/httpd/Makefile +++ b/examples/dreamcast/network/httpd/Makefile @@ -1,7 +1,7 @@ # -# KallistiOS lwIP test program -# (c)2002 Dan Potter -# +# KallistiOS network/httpd example +# Copyright (C) 2002 Dan Potter +# # Put the filename of the output binary here TARGET = httpd.elf @@ -9,13 +9,6 @@ TARGET = httpd.elf # List all of your C files here, but change the extension to ".o" OBJS = simhost.o httpd.o romdisk.o -LWIPDIR = $(KOS_BASE)/../kos-ports/lwip/lwip/src -ARCHDIR = $(LWIPDIR)/../../kos - -KOS_CFLAGS += -DIPv4 \ - -I$(LWIPDIR)/include -I$(ARCHDIR)/include \ - -I$(LWIPDIR)/include/ipv4 - all: rm-elf $(TARGET) include $(KOS_BASE)/Makefile.rules @@ -27,8 +20,7 @@ rm-elf: rm -f $(TARGET) romdisk.* $(TARGET): $(OBJS) - $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \ - $(OBJS) $(OBJEXTRA) -llwip4 -lkosutils $(KOS_LIBS) + kos-cc -o $(TARGET) $(OBJS) $(OBJEXTRA) romdisk.img: $(KOS_GENROMFS) -f romdisk.img -d romdisk -v diff --git a/examples/dreamcast/lwip/httpd/httpd.c b/examples/dreamcast/network/httpd/httpd.c similarity index 95% rename from examples/dreamcast/lwip/httpd/httpd.c rename to examples/dreamcast/network/httpd/httpd.c index a56434b..d702064 100644 --- a/examples/dreamcast/lwip/httpd/httpd.c +++ b/examples/dreamcast/network/httpd/httpd.c @@ -4,10 +4,18 @@ Copyright (C)2003 Dan Potter */ -#include <lwip/lwip.h> -#include <lwip/sockets.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/queue.h> +#include <sys/stat.h> + +#include <sys/socket.h> +#include <sys/select.h> +#include <netinet/in.h> + +#include <kos/thread.h> +#include <kos/mutex.h> struct http_state; typedef TAILQ_HEAD(http_state_list, http_state) http_state_list_t; @@ -19,17 +27,15 @@ typedef struct http_state { struct sockaddr_in client; socklen_t client_size; -// sys_thread_t thd; kthread_t * thd; } http_state_t; http_state_list_t states; #define st_foreach(var) TAILQ_FOREACH(var, &states, list) -mutex_t * list_mutex; +mutex_t list_mutex = MUTEX_INITIALIZER; int st_init() { TAILQ_INIT(&states); - list_mutex = mutex_create(); return 0; } @@ -37,31 +43,31 @@ http_state_t * st_create() { http_state_t * ns; ns = calloc(1, sizeof(http_state_t)); - mutex_lock(list_mutex); + mutex_lock(&list_mutex); TAILQ_INSERT_TAIL(&states, ns, list); - mutex_unlock(list_mutex); + mutex_unlock(&list_mutex); return ns; } void st_destroy(http_state_t *st) { - mutex_lock(list_mutex); + mutex_lock(&list_mutex); TAILQ_REMOVE(&states, st, list); - mutex_unlock(list_mutex); + mutex_unlock(&list_mutex); free(st); } int st_add_fds(fd_set * fds, int maxfd) { http_state_t * st; - mutex_lock(list_mutex); + mutex_lock(&list_mutex); st_foreach(st) { FD_SET(st->socket, fds); if(maxfd < (st->socket + 1)) maxfd = st->socket + 1; } - mutex_unlock(list_mutex); + mutex_unlock(&list_mutex); return maxfd; } @@ -226,7 +232,6 @@ void *client_thread(void *p) { const char * ct; file_t f = -1; int r, o, cnt; - stat_t st; printf("httpd: client thread started, sock %d\n", hs->socket); @@ -376,8 +381,6 @@ void httpd(void) { // Check for new incoming connections if(FD_ISSET(listenfd, &readset)) { - int tmp = 1; - hs = st_create(); hs->client_size = sizeof(hs->client); hs->socket = accept(listenfd, @@ -418,4 +421,3 @@ void httpd(void) { #endif } } - diff --git a/examples/dreamcast/lwip/httpd/romdisk/changelog.html b/examples/dreamcast/network/httpd/romdisk/changelog.html similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/changelog.html rename to examples/dreamcast/network/httpd/romdisk/changelog.html diff --git a/examples/dreamcast/lwip/httpd/romdisk/documentation.html b/examples/dreamcast/network/httpd/romdisk/documentation.html similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/documentation.html rename to examples/dreamcast/network/httpd/romdisk/documentation.html diff --git a/examples/dreamcast/lwip/httpd/romdisk/download.html b/examples/dreamcast/network/httpd/romdisk/download.html similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/download.html rename to examples/dreamcast/network/httpd/romdisk/download.html diff --git a/examples/dreamcast/lwip/httpd/romdisk/img/sics.gif b/examples/dreamcast/network/httpd/romdisk/img/sics.gif similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/img/sics.gif rename to examples/dreamcast/network/httpd/romdisk/img/sics.gif diff --git a/examples/dreamcast/lwip/httpd/romdisk/index.html b/examples/dreamcast/network/httpd/romdisk/index.html similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/index.html rename to examples/dreamcast/network/httpd/romdisk/index.html diff --git a/examples/dreamcast/lwip/httpd/romdisk/licence.html b/examples/dreamcast/network/httpd/romdisk/licence.html similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/licence.html rename to examples/dreamcast/network/httpd/romdisk/licence.html diff --git a/examples/dreamcast/lwip/httpd/romdisk/links.html b/examples/dreamcast/network/httpd/romdisk/links.html similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/links.html rename to examples/dreamcast/network/httpd/romdisk/links.html diff --git a/examples/dreamcast/lwip/httpd/romdisk/mailinglist.html b/examples/dreamcast/network/httpd/romdisk/mailinglist.html similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/mailinglist.html rename to examples/dreamcast/network/httpd/romdisk/mailinglist.html diff --git a/examples/dreamcast/lwip/httpd/romdisk/news.html b/examples/dreamcast/network/httpd/romdisk/news.html similarity index 100% rename from examples/dreamcast/lwip/httpd/romdisk/news.html rename to examples/dreamcast/network/httpd/romdisk/news.html diff --git a/examples/dreamcast/lwip/httpd/simhost.c b/examples/dreamcast/network/httpd/simhost.c similarity index 93% rename from examples/dreamcast/lwip/httpd/simhost.c rename to examples/dreamcast/network/httpd/simhost.c index ebe3465..2ae5a58 100644 --- a/examples/dreamcast/lwip/httpd/simhost.c +++ b/examples/dreamcast/network/httpd/simhost.c @@ -1,5 +1,3 @@ -#include <lwip/lwip.h> - #include <kos/thread.h> #include <dc/video.h> #include <dc/biosfont.h> @@ -17,7 +15,6 @@ void *do_httpd(void * foo) { } int main(int argc, char **argv) { - lwip_kos_init(); thd_create(1, do_httpd, NULL); vid_clear(50, 0, 70); @@ -37,8 +34,3 @@ int main(int argc, char **argv) { return 0; } - - - - - hooks/post-receive -- A pseudo Operating System for the Dreamcast. |