From: nishi Date: Tue, 18 Jun 2024 01:29:03 +0000 (+0000) Subject: add -s to raise SIGUSR1 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=33d9ae6a5d278bb2d8a2149ec59830f81c32f69c;p=dataworks.git add -s to raise SIGUSR1 git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@325 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- diff --git a/Installer/install.c b/Installer/install.c index d7c0b3c..919918c 100644 --- a/Installer/install.c +++ b/Installer/install.c @@ -33,8 +33,8 @@ #include #else #include -#include #include +#include #include #endif #include diff --git a/Makefiles/common.mk b/Makefiles/common.mk index b66595d..11a67f6 100644 --- a/Makefiles/common.mk +++ b/Makefiles/common.mk @@ -111,3 +111,4 @@ get-version: include Makefiles/archive.mk include Makefiles/dosbox.mk include Makefiles/package.mk +include Makefiles/test.mk diff --git a/Makefiles/test.mk b/Makefiles/test.mk new file mode 100644 index 0000000..c5c976b --- /dev/null +++ b/Makefiles/test.mk @@ -0,0 +1,5 @@ +# $Id$ + +.PHONY: test + +test: no-doc diff --git a/Server/hayes.c b/Server/hayes.c index 4337a60..fe4d58f 100644 --- a/Server/hayes.c +++ b/Server/hayes.c @@ -92,6 +92,8 @@ void write_serial(const char* str) { bool connected; bool fancy = false; +extern bool usr1sig; + extern sig_atomic_t signals; extern struct dataworks_db* db; @@ -249,6 +251,8 @@ int server_init(void) { i++; authfile = argv[i]; auth = true; + } else if(option(argv[i], "s", "signal")) { + usr1sig = true; } else if(option(argv[i], "h", "help")) { printf("\n"); printf("Usage: %s [options] database\n", argv[0]); @@ -257,6 +261,7 @@ int server_init(void) { printf("\t-p --port [comport] Specify the modem port\n"); printf("\t-f --fancy Enable the fancy manager ;)\n"); printf("\t-l --login [path] Specify the authentication file\n"); + printf("\t-s --signal Send SIGUSR1 when ready\n"); exit(0); } else if(option(argv[i], "f", "fancy")) { fancy = true; diff --git a/Server/server.c b/Server/server.c index 049b524..16bb626 100644 --- a/Server/server.c +++ b/Server/server.c @@ -44,6 +44,7 @@ int argc; char** argv; bool auth = false; char* authfile = NULL; +bool usr1sig = false; FILE* authdb; struct auth_entry { char* user; @@ -315,5 +316,9 @@ int main(int _argc, char** _argv) { fprintf(stderr, "Failed to open databse\n"); return 1; } + if(usr1sig) { + /* Server is ready, raise SIGUSR1 */ + raise(SIGUSR1); + } server_loop(); } diff --git a/Server/tcpip.c b/Server/tcpip.c index d1b5fa9..26c9745 100644 --- a/Server/tcpip.c +++ b/Server/tcpip.c @@ -75,6 +75,7 @@ struct sockaddr_in6 server_address; #endif extern struct dataworks_db* db; +extern bool usr1sig; int server_init(void) { printf("Using BSD TCP/IP\n"); @@ -88,6 +89,8 @@ int server_init(void) { i++; authfile = argv[i]; auth = true; + } else if(option(argv[i], "s", "signal")) { + usr1sig = true; } else if(option(argv[i], "h", "help")) { printf("\n"); printf("Usage: %s [options] database\n", argv[0]); @@ -95,6 +98,7 @@ int server_init(void) { printf("Options:\n"); printf("\t-p --port [port] Specify the port to be listened on\n"); printf("\t-l --login [path] Specify the authentication file\n"); + printf("\t-s --signal Send SIGUSR1 when ready\n"); exit(0); } else { fprintf(stderr, "Invalid option: %s\n", argv[i]);