author | Olivier Brunel
<jjk@jjacky.com> 2023-12-18 20:12:25 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2024-01-01 19:10:12 UTC |
parent | 226d911dc71402898acc6f5d404b04c0fbcd5e6b |
src/doc/exec.h/exec.3.md | +1 | -0 |
src/doc/exec.h/exec.h.0.md | +36 | -0 |
src/doc/exec.h/exec_a.3.md | +1 | -0 |
src/doc/exec.h/exec_ae.3.md | +49 | -0 |
src/doc/exec.h/exec_e.3.md | +1 | -0 |
src/liblimb/include/limb/exec.h | +10 | -0 |
diff --git a/src/doc/exec.h/exec.3.md b/src/doc/exec.h/exec.3.md new file mode 120000 index 0000000..49be2e2 --- /dev/null +++ b/src/doc/exec.h/exec.3.md @@ -0,0 +1 @@ +exec_ae.3.md \ No newline at end of file diff --git a/src/doc/exec.h/exec.h.0.md b/src/doc/exec.h/exec.h.0.md new file mode 100644 index 0000000..ebcb6d8 --- /dev/null +++ b/src/doc/exec.h/exec.h.0.md @@ -0,0 +1,36 @@ +% limb manual +% exec.h(0) + +# NAME + +exec.h - execute a file + + +# SYNOPSIS + + #include <limb/exec.h> + + +# DESCRIPTION + +The header defines functions to needed to execute a file. + +<inc skalibs.md> + +## Functions + +The following functions are defined : + +: [exec_ae](3) +:: To execute a file specifying file, argv and environ. + +: [exec_a](3) +:: Similar to [exec_ae](3) specifying file and argv (using global `environ`). + +: [exec_e](3) +:: Similar to [exec_ae](3) specifying argv and environ (using `argv[0]` as file). + +: [exec](3) +:: Similar to [exec_ae](3) specifying argv (using `argtv[0]` as file, and global +:: `environ`). + diff --git a/src/doc/exec.h/exec_a.3.md b/src/doc/exec.h/exec_a.3.md new file mode 120000 index 0000000..49be2e2 --- /dev/null +++ b/src/doc/exec.h/exec_a.3.md @@ -0,0 +1 @@ +exec_ae.3.md \ No newline at end of file diff --git a/src/doc/exec.h/exec_ae.3.md b/src/doc/exec.h/exec_ae.3.md new file mode 100644 index 0000000..22dabb4 --- /dev/null +++ b/src/doc/exec.h/exec_ae.3.md @@ -0,0 +1,49 @@ +% limb manual +% exec_ae(3) + +# NAME + +exec_ae, exec_a, exec_e, exec - execute a file + +# SYNOPSIS + + #include <limb/exec.h> + +```pre hl +void exec_ae(const char *<em>file</em>, const char * const *<em>argv</em>, const char * const *<em>env</em>) +void exec_a(const char *<em>file</em>, const char * const *<em>argv</em>) +void exec_e(const char * const *<em>argv</em>, const char * const *<em>env</em>) +void exec(const char * const *<em>argv</em>) +``` + +# DESCRIPTION + +These functions will replace the current process image with a new process image, +constructed from a regular executable file. + +The `exec_ae`() function will execute into `file`. If it does not contain a +slash (`/`) then the file will be searched into the directories specified in the +environment variable `PATH` or, if there's none, in the constant +`SKALIBS_DEFAULTPATH` (defined when compiling skalibs). + +The `argv` and `env` arguments shall point to the arrays of arguments and +environment for the new process, respectively. Execution is performed using a +call to [execve](3). + +The `exec_a`() macro is similar to `exec_ae`() but using the global variable +`environ` as environment. + +The `exec_e`() macro is similar to `exec_ae`() using `argv[0]` as file to +execute. + +The `exec`() macro is similar to `exec_a`() using `argv[0]` as file to execute. + +# RETURN VALUE + +These functions should not return on success. Otherwise they set `errno` to +indicate the error. + +# ERRORS + +These functions might fail and set `errno` for any of the errors described for +[execve](3). diff --git a/src/doc/exec.h/exec_e.3.md b/src/doc/exec.h/exec_e.3.md new file mode 120000 index 0000000..49be2e2 --- /dev/null +++ b/src/doc/exec.h/exec_e.3.md @@ -0,0 +1 @@ +exec_ae.3.md \ No newline at end of file diff --git a/src/liblimb/include/limb/exec.h b/src/liblimb/include/limb/exec.h new file mode 100644 index 0000000..5cc3645 --- /dev/null +++ b/src/liblimb/include/limb/exec.h @@ -0,0 +1,10 @@ +/* This file is part of limb https://lila.oss/limb + * Copyright (C) 2023 Olivier Brunel jjk@jjacky.com */ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef LIMB_EXEC_H +#define LIMB_EXEC_H + +#include <skalibs/exec.h> + +#endif /* LIMB_EXEC_H */