]> Nishi Git Mirror - dataworks.git/commitdiff
add -s to raise SIGUSR1
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Tue, 18 Jun 2024 01:29:03 +0000 (01:29 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Tue, 18 Jun 2024 01:29:03 +0000 (01:29 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@325 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Installer/install.c
Makefiles/common.mk
Makefiles/test.mk [new file with mode: 0644]
Server/hayes.c
Server/server.c
Server/tcpip.c

index d7c0b3c0c9aa2e5d89e8489c83680ab2b43b00f5..919918c209ab17f462af530d9c5fc4c556bcd945 100644 (file)
@@ -33,8 +33,8 @@
 #include <direct.h>
 #else
 #include <dirent.h>
-#include <stdint.h>
 #include <errno.h>
+#include <stdint.h>
 #include <unistd.h>
 #endif
 #include <stdio.h>
index b66595dc82c1b895d02591747c89b4582a83f162..11a67f6e22afc6665491be4f4c9134d7eef7ea82 100644 (file)
@@ -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 (file)
index 0000000..c5c976b
--- /dev/null
@@ -0,0 +1,5 @@
+# $Id$
+
+.PHONY: test
+
+test: no-doc
index 4337a60cf2fba5d772db48d4031c4b1181142535..fe4d58fef11d6ae41e901fab5292ba7fd0e27ad8 100644 (file)
@@ -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;
index 049b5241bf6a9522d02985198380fd4ca5298842..16bb626678d43c1c64917a63c8ec37d5cb659313 100644 (file)
@@ -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();
 }
index d1b5fa90902407863b18c9a598609256355dcae4..26c9745931e20a23e08f562a2aa3f23f0adb79ae 100644 (file)
@@ -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]);