diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 81d17e027cb08c333992a6034b263404c3e98cde..feff1029391d56bc94d1e679a5f85ed0256ffcf1 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -183,25 +183,35 @@ # define SYS_insmod __SYS_insmod # define SYS_rmmod (__SYS_insmod+1) # define SYS_modhandle (__SYS_insmod+2) -# define __SYS_posix_spawn (__SYS_insmod+3) +# define __SYS_exec (__SYS_insmod+3) #else -# define __SYS_posix_spawn __SYS_insmod +# define __SYS_exec __SYS_insmod #endif /* The following can only be defined if we are configured to execute * programs from a file system. */ -#if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) -# ifdef CONFIG_BINFMT_EXEPATH -# define SYS_posix_spawnp __SYS_posix_spawn +#ifndef CONFIG_BINFMT_DISABLE +# ifndef CONFIG_BUILD_KERNEL +# define SYS_exec __SYS_exec +# define __SYS_posix_spawn (__SYS_exec+1) # else -# define SYS_posix_spawn __SYS_posix_spawn +# define __SYS_posix_spawn __SYS_exec +# endif +# ifdef CONFIG_LIBC_EXECFUNCS +# ifdef CONFIG_BINFMT_EXEPATH +# define SYS_posix_spawnp __SYS_posix_spawn +# else +# define SYS_posix_spawn __SYS_posix_spawn +# endif +# define SYS_execv (__SYS_posix_spawn+1) +# define __SYS_signals (__SYS_posix_spawn+2) +# else +# define __SYS_signals __SYS_posix_spawn # endif -# define SYS_execv (__SYS_posix_spawn+1) -# define __SYS_signals (__SYS_posix_spawn+2) #else -# define __SYS_signals __SYS_posix_spawn +# define __SYS_signals __SYS_exec #endif /* The following are only defined is signals are supported in the NuttX diff --git a/syscall/syscall.csv b/syscall/syscall.csv index bfb950a8ebc53f82975e38eb1bd6eeca44579c2d..b5efe96510f65a2190f7e0342adc0c4194a07043 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -18,6 +18,7 @@ "connect","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t" "dup","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int" "dup2","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int" +"exec","nuttx/binfmt/binfmt.h","!defined(CONFIG_BINFMT_DISABLE) && !defined(CONFIG_BUILD_KERNEL)","int","FAR const char *","FAR char * const *","FAR const struct symtab_s *","int" "execv","unistd.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS)","int","FAR const char *","FAR char *const []|FAR char *const *" "exit","stdlib.h","","void","int" "fcntl","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int","..." diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index 66a3153aa8c69c0303bb52a11b69c24442fe7405..d6d7c70a8e9c9237ddce45516c62192640f30bf2 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -130,14 +130,19 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) * programs from a file system. */ -#if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) -# ifdef CONFIG_BINFMT_EXEPATH +#ifndef CONFIG_BINFMT_DISABLE +#ifndef CONFIG_BUILD_KERNEL + SYSCALL_LOOKUP(exec, 4, STUB_exec) +#endif +#ifdef CONFIG_LIBC_EXECFUNCS +#ifdef CONFIG_BINFMT_EXEPATH SYSCALL_LOOKUP(posix_spawnp, 6, STUB_posix_spawnp) -# else +#else SYSCALL_LOOKUP(posix_spawn, 6, STUB_posix_spawn) -# endif +#endif SYSCALL_LOOKUP(execv, 2, STUB_execv) #endif +#endif /* The following are only defined is signals are supported in the NuttX * configuration. diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index 289244e7a8462629421c7292fe262c0246cb40a7..5cdda6e17d2bc8a8c1804e7b6eba230c0be88167 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -119,16 +119,16 @@ uintptr_t STUB_waitid(int nbr, uintptr_t parm1, uintptr_t parm2, * OS modules from a file system. */ -#ifdef CONFIG_MODULE uintptr_t STUB_insmod(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_rmmod(int nbr, uintptr_t parm1); uintptr_t STUB_modhandle(int nbr, uintptr_t parm1, uintptr_t parm2); -#endif /* The following can only be defined if we are configured to execute * programs from a file system. */ +uintptr_t STUB_exec(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3, uintptr_t parm4); uintptr_t STUB_posix_spawn(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6);