Skip to content

Commit 0a2cdb0

Browse files
committed
rc_exec: reduce verbosity
1 parent 4b034d2 commit 0a2cdb0

File tree

4 files changed

+20
-24
lines changed

4 files changed

+20
-24
lines changed

src/kill_all/kill_all.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ static int mount_proc(void)
5555
pid_t rc;
5656
int status;
5757
const char *argv[] = { "mount", "-t", "proc", "proc", "/proc", NULL };
58-
struct rc_exec_result res;
59-
struct rc_exec_args args = rc_exec_args_init(argv);
58+
rc_exec_result_t res;
59+
rc_exec_args_t args = rc_exec_init(argv);
6060

6161
if (exists("/proc/version"))
6262
return 0;

src/openrc-init/openrc-init.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ static int sigpipe[2] = { -1, -1 };
5252
static void do_openrc(const char *runlevel)
5353
{
5454
const char *argv[] = { "openrc", runlevel, NULL };
55-
struct rc_exec_result res;
56-
struct rc_exec_args args = rc_exec_args_init(argv);
55+
rc_exec_result_t res;
56+
rc_exec_args_t args = rc_exec_init(argv);
5757
args.setsid = 1;
5858

5959
printf("Starting %s runlevel\n", runlevel);
@@ -111,8 +111,8 @@ static void handle_shutdown(const char *runlevel, int cmd)
111111
static void run_program(const char *prog)
112112
{
113113
const char *argv[] = { prog, NULL };
114-
struct rc_exec_args args = rc_exec_args_init(argv);
115-
struct rc_exec_result res = rc_exec(&args);
114+
rc_exec_args_t args = rc_exec_init(argv);
115+
rc_exec_result_t res = rc_exec(&args);
116116
if (res.pid < 0 || rc_waitpid(res.pid) == -1)
117117
perror("init");
118118
}

src/shared/rc_exec.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
#include "rc_exec.h"
2121
#include "helpers.h"
2222

23-
static void
24-
checked_close(int fd)
23+
static void checked_close(int fd)
2524
{
2625
if (fd >= 0)
2726
close(fd);
2827
}
2928

30-
static int
31-
devnull(void)
29+
static int devnull(void)
3230
{
3331
static int devnullfd = -1;
3432
if (devnullfd < 0)
@@ -40,21 +38,19 @@ devnull(void)
4038
return devnullfd;
4139
}
4240

43-
struct rc_exec_args
44-
rc_exec_args_init(const char **argv)
41+
rc_exec_args_t rc_exec_init(const char **argv)
4542
{
46-
struct rc_exec_args args = {0};
43+
rc_exec_args_t args = {0};
4744
args.argv = argv;
4845
args.redirect_stdin = RC_EXEC_REDIRECT_NONE;
4946
args.redirect_stdout = RC_EXEC_REDIRECT_NONE;
5047
args.redirect_stderr = RC_EXEC_REDIRECT_NONE;
5148
return args;
5249
}
5350

54-
struct rc_exec_result
55-
rc_exec(struct rc_exec_args *args)
51+
rc_exec_result_t rc_exec(rc_exec_args_t *args)
5652
{
57-
struct rc_exec_result res = { .pid = -1 };
53+
rc_exec_result_t res = { .pid = -1 };
5854
sigset_t full, old;
5955
int saved_errno, err, n;
6056
int execpipe[2] = {-1, -1};
@@ -157,8 +153,8 @@ int
157153
rc_pipe_command(const char *cmd, int devnullfd)
158154
{
159155
const char *argv[] = { "/bin/sh", "-c", cmd, NULL };
160-
struct rc_exec_result res;
161-
struct rc_exec_args args = rc_exec_args_init(argv);
156+
rc_exec_result_t res;
157+
rc_exec_args_t args = rc_exec_init(argv);
162158
args.redirect_stdin = RC_EXEC_MKPIPE;
163159
args.redirect_stdout = args.redirect_stderr = devnullfd;
164160
res = rc_exec(&args);

src/shared/rc_exec.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@ enum {
3131
RC_EXEC_DEVNULL = -3,
3232
};
3333

34-
struct rc_exec_args {
34+
typedef struct {
3535
const char **argv;
3636
int redirect_stdin;
3737
int redirect_stdout;
3838
int redirect_stderr;
3939
bool setsid : 1;
40-
};
40+
} rc_exec_args_t;
4141

42-
struct rc_exec_result {
42+
typedef struct {
4343
pid_t pid;
4444
/* returned in case of RC_EXEC_MKPIPE */
4545
int proc_stdin;
4646
int proc_stdout;
4747
int proc_stderr;
48-
};
48+
} rc_exec_result_t;
4949

50-
struct rc_exec_args rc_exec_args_init(const char **argv);
51-
struct rc_exec_result rc_exec(struct rc_exec_args *args);
50+
rc_exec_args_t rc_exec_init(const char **argv);
51+
rc_exec_result_t rc_exec(rc_exec_args_t *args);
5252

5353
int rc_pipe_command(const char *cmd, int devnullfd);
5454

0 commit comments

Comments
 (0)