commit 3fd47336b2b5b470aeeb41da0fb1500be3741eab
parent 453651303bf1b056ee6cd1451b33a254b51f0fbe
Author: Friedel Schön <[email protected]>
Date: Tue, 23 May 2023 00:01:58 +0200
some restructuring, fixing linker errors
Diffstat:
11 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/include/config_parser.h b/include/config_parser.h
@@ -1,8 +0,0 @@
-#pragma once
-
-#include "service.h"
-
-
-void parse_env_file(char** env);
-void parse_param_file(service_t* s, char* args[]);
-pid_t parse_pid_file(service_t* s);
diff --git a/include/parse.h b/include/parse.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "service.h"
+
+#include <unistd.h>
+
+
+void parse_env_file(char** env);
+void parse_param_file(service_t* s, char* args[]);
+pid_t parse_pid_file(service_t* s);
+int parse_ugid(char* str, uid_t* uid, gid_t* gids);
diff --git a/include/user_group.h b/include/user_group.h
@@ -1,6 +0,0 @@
-#pragma once
-
-#include <unistd.h>
-
-
-int parse_ugid(char* str, uid_t* uid, gid_t* gids);
diff --git a/src/exec/chpst.c b/src/exec/chpst.c
@@ -1,4 +1,4 @@
-#include "user_group.h"
+#include "parse.h"
#include "util.h"
#include <errno.h>
@@ -8,6 +8,7 @@
#include <string.h>
#include <sys/file.h>
+
static long parse_long(const char* str) {
char* end;
long l = strtol(str, &end, 10);
diff --git a/src/exec/finit.c b/src/exec/finit.c
@@ -57,7 +57,7 @@ int main(int argc, const char** argv) {
printf("booting...\n");
// stage 1
- service_handle_stage(0);
+ service_stage(0);
// stage 2
@@ -74,7 +74,7 @@ int main(int argc, const char** argv) {
}
// stage 3
- service_handle_stage(2);
+ service_stage(2);
#ifdef RB_AUTOBOOT
/* fallthrough stage 3 */
diff --git a/src/handle_command.c b/src/handle_command.c
@@ -84,7 +84,7 @@ int service_handle_command(void* argv, sv_command_t command, unsigned char extra
if (s == NULL)
return -ENOSV;
- service_send(s, extra);
+ service_kill(s, extra);
response[0] = s;
return 1;
@@ -96,7 +96,7 @@ int service_handle_command(void* argv, sv_command_t command, unsigned char extra
return 0;
s->paused = true;
- service_send(s, SIGSTOP);
+ service_kill(s, SIGSTOP);
s->status_change = time(NULL);
service_update_status(s);
@@ -112,7 +112,7 @@ int service_handle_command(void* argv, sv_command_t command, unsigned char extra
return 0;
s->paused = false;
- service_send(s, SIGCONT);
+ service_kill(s, SIGCONT);
s->status_change = time(NULL);
service_update_status(s);
diff --git a/src/handle_exit.c b/src/handle_exit.c
@@ -1,4 +1,4 @@
-#include "config_parser.h"
+#include "parse.h"
#include "service.h"
#include <errno.h>
diff --git a/src/parse.c b/src/parse.c
@@ -1,4 +1,4 @@
-#include "config_parser.h"
+#include "parse.h"
#include <fcntl.h>
#include <grp.h>
diff --git a/src/service.c b/src/service.c
@@ -40,7 +40,7 @@ int service_pattern(const char* name, service_t** dest, int dest_max) {
return size;
}
-int service_refresh(void) {
+int service_refresh_directory(void) {
DIR* dp;
struct dirent* ep;
diff --git a/src/start.c b/src/start.c
@@ -1,6 +1,5 @@
-#include "config_parser.h"
+#include "parse.h"
#include "service.h"
-#include "user_group.h"
#include <errno.h>
#include <fcntl.h>
diff --git a/src/stop.c b/src/stop.c
@@ -57,7 +57,7 @@ void service_stop(service_t* s, bool* changed) {
}
}
-void service_send(service_t* s, int signal) {
+void service_kill(service_t* s, int signal) {
if (!s->pid)
return;