syscall/: The non-standard interface exec() is now enshrined as a official NuttX API. I really dislike doing this but I think that this is probably the only want to load programs in the protected mode. It is currently used by some example code under apps/ that generate their own symbol tables for linking. Other file execution APIs relay on a symbol table provided by the OS. In the protected mode, the OS cannot provide any meaning symbol table for execution of code in the user-space blob so that is they exec() is really needed in that build case. And, finally, the interface is completely useless and will not be supported in the KERNEL build mode where the contrary is true: An application process cannot provide any meaning symbolic information for use in linking a different process.

This commit is contained in:
Gregory Nutt
2017-10-03 07:09:35 -06:00
parent 5512813157
commit 8e966546c1
4 changed files with 31 additions and 15 deletions
+1
View File
@@ -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","..."
1 _exit unistd.h void int
18 connect sys/socket.h CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET) int int
19 dup unistd.h CONFIG_NFILE_DESCRIPTORS > 0 int int
20 dup2 unistd.h CONFIG_NFILE_DESCRIPTORS > 0 int int
21 exec nuttx/binfmt/binfmt.h !defined(CONFIG_BINFMT_DISABLE) && !defined(CONFIG_BUILD_KERNEL) int FAR const char *
22 execv unistd.h !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS) int FAR const char *
23 exit stdlib.h void int
24 fcntl fcntl.h CONFIG_NFILE_DESCRIPTORS > 0 int int
+9 -4
View File
@@ -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.
+2 -2
View File
@@ -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);