feat(process): fork/exec/id/session + system/popen

This commit is contained in:
2026-09-05 16:55:14 -04:00
parent c9e9676d38
commit 14c6fd6cf6
19 changed files with 2118 additions and 2 deletions
+47
View File
@@ -0,0 +1,47 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdarg.h>
#include <unistd.h>
#include "../internal/syscall.h"
/*
* execlp: like execl, but the file is located through PATH (see
* execvp.c). The argv staging uses a VLA; the POSIX signature is fixed
* and the adjacent-parameter check is waived per the house NOLINT
* convention.
*/
// NOLINTBEGIN(bugprone-easily-swappable-parameters)
int
execlp(const char *file, const char *arg0, ...)
{
va_list ap;
int argc;
int i;
int ret;
va_start(ap, arg0);
argc = 1;
while (va_arg(ap, const char *) != 0)
{
argc++;
}
va_end(ap);
{
char *argv[argc + 1];
argv[0] = (char *)arg0;
va_start(ap, arg0);
for (i = 1; i <= argc; i++)
{
argv[i] = va_arg(ap, char *);
}
va_end(ap);
ret = execvp(file, argv);
}
return ret;
}
// NOLINTEND(bugprone-easily-swappable-parameters)