diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/skalibs/cspawn.h | 55 | ||||
-rw-r--r-- | src/include/skalibs/env.h | 4 | ||||
-rw-r--r-- | src/include/skalibs/stddjb.h | 2 |
3 files changed, 58 insertions, 3 deletions
diff --git a/src/include/skalibs/cspawn.h b/src/include/skalibs/cspawn.h index 061fbfb..0d8dd50 100644 --- a/src/include/skalibs/cspawn.h +++ b/src/include/skalibs/cspawn.h @@ -90,4 +90,59 @@ extern pid_t child_spawn (char const *, char const *const *, char const *const * extern pid_t gcspawn (char const *, char const *const *, char const *const *, uint16_t, cspawn_fileaction const *, size_t) ; + + /* mexec (see skalibs/exec.h), but with cspawn instead */ + +extern int env_mspawn (char const *, char const *) ; + +extern pid_t mspawn_afn (char const *, char const *const *, char const *const *, size_t, char const *, size_t, size_t, uint16_t, cspawn_fileaction const *, size_t) ; +extern pid_t mspawn_afm (char const *, char const *const *, char const *const *, size_t, char const *, size_t, uint16_t, cspawn_fileaction const *, size_t) ; +extern pid_t mspawn_af (char const *, char const *const *, char const *const *, size_t, uint16_t, cspawn_fileaction const *, size_t) ; + +#define mspawn_aen(file, argv, envp, modif, modiflen, modifn, flags, fa, n) mspawn_afn(file, argv, envp, env_len(envp), modif, modiflen, modifn, flags, fa, n) +#define mspawn_aem(file, argv, envp, modif, modiflen, flags, fa, n) mspawn_afm(file, argv, envp, env_len(envp), modif, modiflen, flags, fa, n) +#define mspawn_ae(file, argv, envp, flags, fa, n) mspawn_af(file, argv, (envp), env_len(envp), flags, fa, n) + +#define mspawn_an(file, argv, modif, modiflen, modifn, flags, fa, n) mspawn_aen(file, argv, (char const *const *)environ, modif, modiflen, modifn, flags, fa, n) +#define mspawn_am(file, argv, modif, modiflen, flags, fa, n) mspawn_aem(file, argv, (char const *const *)environ, modif, modiflen, flaga, fa, n) +#define mspawn_a(file, argv, flags, fa, n) mspawn_ae(file, (argv), (char const *const *)environ, flags, fa, n) + +#define mspawn_fn(argv, envp, envlen, modif, modiflen, modifn, flags, fa, n) mspawn_afn((argv)[0], (argv), envp, envlen, modif, modiflen, modifn, flags, fa, n) +#define mspawn_fm(argv, envp, envlen, modif, modiflen, flags, fa, n) mspawn_afm((argv)[0], (argv), envp, envlen, modif, modiflen, flags, fa, n) +#define mspawn_f(argv, envp, envlen, flags, fa, n) mspawn_af((argv)[0], (argv), envp, envlen, flags, fa, n) + +#define mspawn_en(argv, envp, modif, modiflen, modifn, flags, fa, n) mspawn_aen((argv)[0], (argv), envp, modif, modiflen, modifn, flags, fa, n) +#define mspawn_em(argv, envp, modif, modiflen, flags, fa, n) mspawn_aem((argv)[0], (argv), envp, modif, modiflen, flags, fa, n) +#define mspawn_e(argv, envp, flags, fa, n) mspawn_ae((argv)[0], (argv), envp, flags, fa, n) + +#define mspawn_n(argv, modif, modiflen, modifn, flags, fa, n) mspawn_an((argv)[0], (argv), modif, modiflen, modifn, flags, fa, n) +#define mspawn_m(argv, modif, modiflen, flags, fa, n) mspawn_am((argv)[0], (argv), modif, modiflen, flags, fa, n) +#define mspawn(argv, flags, fa, n) mspawn_a((argv)[0], (argv), flags, fa, n) + +extern pid_t xmspawn_afn (char const *, char const *const *, char const *const *, size_t, char const *, size_t, size_t, uint16_t, cspawn_fileaction const *, size_t) ; +extern pid_t xmspawn_afm (char const *, char const *const *, char const *const *, size_t, char const *, size_t, uint16_t, cspawn_fileaction const *, size_t) ; +extern pid_t xmspawn_af (char const *, char const *const *, char const *const *, size_t, uint16_t, cspawn_fileaction const *, size_t) ; + +#define xmspawn_aen(file, argv, envp, modif, modiflen, modifn, flags, fa, n) xmspawn_afn(file, argv, envp, env_len(envp), modif, modiflen, modifn, flags, fa, n) +#define xmspawn_aem(file, argv, envp, modif, modiflen, flags, fa, n) xmspawn_afm(file, argv, envp, env_len(envp), modif, modiflen, flags, fa, n) +#define xmspawn_ae(file, argv, envp, flags, fa, n) xmspawn_af(file, argv, envp, env_len(envp), flags, fa, n) + +#define xmspawn_an(file, argv, modif, modiflen, modifn, flags, fa, n) xmspawn_aen(file, argv, (char const *const *)environ, modif, modiflen, modifn, flags, fa, n) +#define xmspawn_am(file, argv, modif, modiflen, flags, fa, n) xmspawn_aem(file, argv, (char const *const *)environ, modif, modiflen, flags, fa, n) +#define xmspawn_a(file, argv, flags, fa, n) xmspawn_ae(file, argv, (char const *const *)environ, flags, fa, n) + +#define xmspawn_fn(argv, envp, envlen, modif, modiflen, modifn, flags, fa, n) xmspawn_afn((argv)[0], (argv), envp, envlen, modif, modiflen, modifn, flags, fa, n) +#define xmspawn_fm(argv, envp, envlen, modif, modiflen, flags, fa, n) xmspawn_afm((argv)[0], (argv), envp, envlen, modif, modiflen, flags, fa, n) +#define xmspawn_f(argv, envp, envlen, flags, fa, n) xmspawn_af((argv)[0], (argv), envp, envlen, flags, fa, n) + +#define xmspawn_en(argv, envp, modif, modiflen, modifn, flags, fa, n) xmspawn_aen((argv)[0], (argv), envp, modif, modiflen, modifn, flags, fa, n) +#define xmspawn_em(argv, envp, modif, modiflen, flags, fa, n) xmspawn_aem((argv)[0], (argv), envp, modif, modiflen, flags, fa, n) +#define xmspawn_e(argv, envp, flags, fa, n) xmspawn_ae((argv)[0], (argv), envp, flags, fa, n) + +#define xmspawn_n(argv, modif, modiflen, modifn, flags, fa, n) xmspawn_an((argv)[0], (argv), modif, modiflen, modifn, flags, fa, n) +#define xmspawn_m(argv, modif, modiflen, flags, fa, n) xmspawn_am((argv)[0], (argv), modif, modiflen, flags, fa, n) +#define xmspawn(argv, flags, fa, n) xmspawn_a((argv)[0], (argv), flags, fa, n) + +extern pid_t gmspawn_afn (char const *, char const *const *, char const *const *, size_t, char const *, size_t, size_t, uint16_t, cspawn_fileaction const *, size_t) ; + #endif diff --git a/src/include/skalibs/env.h b/src/include/skalibs/env.h index 5e17dfa..e5dfd1d 100644 --- a/src/include/skalibs/env.h +++ b/src/include/skalibs/env.h @@ -17,10 +17,10 @@ extern int env_addmodif (stralloc *, char const *, char const *) ; extern int env_make (char const **, size_t, char const *, size_t) ; extern int env_string (stralloc *, char const *const *, size_t) ; -extern size_t env_mergen (char const **, size_t, char const *const *, size_t, char const *, size_t, size_t) ; +extern size_t env_merg (char const **, size_t, char const *const *, char const *, size_t) ; extern size_t env_merge (char const **, size_t, char const *const *, size_t, char const *, size_t) ; +#define env_mergen(v, vmax, envp, envlen, modifs, modiflen, modifn) env_merge(v, vmax, envp, envlen, modifs, modiflen) extern size_t env_mergn (char const **, size_t, char const *const *, char const *, size_t, size_t) ; -extern size_t env_merg (char const **, size_t, char const *const *, char const *, size_t) ; #define SKALIBS_ENVDIR_VERBATIM 0x01 #define SKALIBS_ENVDIR_NOCHOMP 0x02 diff --git a/src/include/skalibs/stddjb.h b/src/include/skalibs/stddjb.h index d241de8..ab5bcaf 100644 --- a/src/include/skalibs/stddjb.h +++ b/src/include/skalibs/stddjb.h @@ -20,7 +20,6 @@ #include <skalibs/cbuffer.h> #include <skalibs/cdb.h> #include <skalibs/cdbmake.h> -#include <skalibs/cspawn.h> #include <skalibs/devino.h> #include <skalibs/direntry.h> #include <skalibs/diuint32.h> @@ -31,6 +30,7 @@ #include <skalibs/envalloc.h> #include <skalibs/env.h> #include <skalibs/exec.h> +#include <skalibs/cspawn.h> #include <skalibs/fmtscan.h> #include <skalibs/functypes.h> #include <skalibs/gccattributes.h> |