libc: Implement execvp, execlp and execvpe as macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-04-20 21:21:21 +08:00 committed by Petro Karashchenko
parent 55b5561fdb
commit 49eb2bd415
2 changed files with 18 additions and 2 deletions

View File

@ -54,6 +54,13 @@
#define POSIX_SPAWN_SETSIGMASK (1 << 5) /* 1: Set sigmask */
#define POSIX_SPAWN_SETSID (1 << 7) /* 1: Create the new session(glibc specific) */
/* NOTE: NuttX provides only one implementation: If
* CONFIG_LIBC_ENVPATH is defined, then only posix_spawnp() behavior
* is supported; otherwise, only posix_spawn behavior is supported.
*/
#define posix_spawnp posix_spawn
/****************************************************************************
* Type Definitions
****************************************************************************/
@ -129,8 +136,6 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path,
FAR const posix_spawn_file_actions_t *file_actions,
FAR const posix_spawnattr_t *attr,
FAR char * const argv[], FAR char * const envp[]);
#define posix_spawnp(pid,path,file_actions,attr,argv,envp) \
posix_spawn(pid,path,file_actions,attr,argv,envp)
#ifndef CONFIG_BUILD_KERNEL
/* Non-standard task_spawn interface. This function uses the same

View File

@ -280,6 +280,17 @@
# define lockf64 lockf
#endif
/* NOTE: NuttX provides only one implementation: If
* CONFIG_LIBC_ENVPATH is defined, then only execvp/execlp/execvpe behavior
* is supported; otherwise, only execv/execl/execve behavior is supported.
*/
#ifdef CONFIG_LIBC_EXECFUNCS
# define execvp execv
# define execlp execl
# define execvpe execve
#endif
/****************************************************************************
* Public Data
****************************************************************************/