On 11/5/2024 3:43 AM, Takashi Yamamoto wrote:
i guess it's possible to implement it similarly to what we do for errno.

eg.
#  define environ (*get_environ_ptr_ptr())

although it still isn't quite posix compatible, it might be good
enough for many applications.
d18be28c82a2a6d82115c8af19d/shell/ash.c#L10574

There would be a complexity in this:  The environ is shared by all threads in a task group.  Hence, the environ lies in the protected, kernel task group structure.  That structure  is not accessible to user code in PROTECTED or KERNEL build modes.

So in order to do what you want, you would need to (1) redesign how common data is stored so that the environ is accessible from user space or (2) marshal the environ to other accessible memory when it is requested.  Neither are simple and the latter would have synchronization issues.

I think there is an open issue about the POSIX compatibility of the environment.

Reply via email to