diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-23 01:52:57 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-01-23 01:52:57 +0100 |
commit | 5cb5a6ffc33667c93e9bc3572534dcaa684046e3 (patch) | |
tree | 51e8b6260d56027c4d610ff6db5882737101a809 /execute.c | |
parent | cd2dbd7df9f1b8c46386b2898523aec3dd4578fd (diff) |
first attempt in implementinging execution logic
Diffstat (limited to 'execute.c')
-rw-r--r-- | execute.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/execute.c b/execute.c new file mode 100644 index 0000000000..9bb8351fb3 --- /dev/null +++ b/execute.c @@ -0,0 +1,68 @@ +/*-*- Mode: C; c-basic-offset: 8 -*-*/ + +#include <assert.h> + +#include "execute.h" +#include "strv.h" +#include "macro.h" +#include "util.h" + +int exec_spawn(const ExecCommand *command, const ExecContext *context, pid_t *ret) { + assert(command); + assert(context); + assert(ret); + + return 0; +} + +void exec_context_free(ExecContext *c) { + unsigned l; + + assert(c); + + strv_free(c->environment); + + for (l = 0; l < ELEMENTSOF(c->rlimit); l++) + free(c->rlimit[l]); + + free(c->chdir); + free(c->user); + free(c->group); + free(c->supplementary_groups); +} + +void exec_command_free_list(ExecCommand *c) { + ExecCommand *i; + + while ((i = c)) { + LIST_REMOVE(ExecCommand, c, i); + + free(i->path); + free(i->argv); + free(i); + } +} + +void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { + assert(c); + assert(f); + + if (!prefix) + prefix = ""; + + fprintf(f, + "%sUmask: %04o\n" + "%sDumpable: %s\n" + "%sDirectory: %s\n", + prefix, c->umask, + prefix, yes_no(c->dumpable), + prefix, c->chdir ? c->chdir : "/"); +} + +void exec_context_defaults(ExecContext *c) { + assert(c); + + c->umask = 0002; + cap_clear(c->capabilities); + c->dumpable = true; +} |