You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/04/21 10:38:46 UTC

[incubator-nuttx] 03/04: syscall: Add call gate for get_environ_ptr

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit d6ef4849a96cd2031c6c306a1c8aca45a969bdbd
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Wed Apr 20 13:41:26 2022 +0300

    syscall: Add call gate for get_environ_ptr
    
    Now that the environment strings are stored as an array of strings,
    they can be passed from the application via char **environ, which
    is really defined as a function call to get_environ_ptr().
    
    This works as is for flat build, but protected mode and kernel mode
    require a call gate, which is added here.
---
 include/sys/syscall_lookup.h | 1 +
 syscall/syscall.csv          | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h
index abc0b7137e..d183f0931e 100644
--- a/include/sys/syscall_lookup.h
+++ b/include/sys/syscall_lookup.h
@@ -353,6 +353,7 @@ SYSCALL_LOOKUP(futimens,                   2)
 /* The following are defined only if environment variables are supported */
 
 #ifndef CONFIG_DISABLE_ENVIRON
+  SYSCALL_LOOKUP(get_environ_ptr,          0)
   SYSCALL_LOOKUP(clearenv,                 0)
   SYSCALL_LOOKUP(getenv,                   1)
   SYSCALL_LOOKUP(putenv,                   1)
diff --git a/syscall/syscall.csv b/syscall/syscall.csv
index 3c3b14a7f2..0705de96a2 100644
--- a/syscall/syscall.csv
+++ b/syscall/syscall.csv
@@ -35,6 +35,7 @@
 "fsync","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int"
 "ftruncate","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","int","off_t"
 "futimens","sys/stat.h","","int","int","const struct timespec [2]|FAR const struct timespec *"
+"get_environ_ptr","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char **"
 "getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char *","FAR const char *"
 "getgid","unistd.h","defined(CONFIG_SCHED_USER_IDENTITY)","gid_t"
 "gethostname","unistd.h","","int","FAR char *","size_t"