wasi-libc/libc-bottom-half/headers/public
Dan Gohman 9efc2f4283
Lazy-initialize the environment variables. (#184)
* Lazy-initialize the environment variables.

This is the first in a series of PRs to make it easier to use WASI libc
in Wasm modules that don't have a `main` function. By initializing the
environment on demand, we avoid depending on having `__wasm_call_ctors`
run.

This uses weak symbols strategically to ensure that if `environ` is
used, it is initialized eagerly, but if only `getenv` and friends
are used, the environment is initialized lazily.

Eventually, I expect we'll have a convention for wasm modules without
main functions which will allow the `__wasm_call_ctors` function to be
called automatically, but this helps in simple cases for now.

Fixes #180.

* Add comments explaining the libc-environ-compat.h header usage.
2020-03-19 09:32:41 -07:00
..
netinet WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
sys WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
wasi Lazy-initialize the environment variables. (#184) 2020-03-19 09:32:41 -07:00
__errno_values.h Wasi snapshot preview1 (#140) 2019-11-21 20:06:00 -08:00
__fd_set.h Implement FD_SET, FD_CLR, etc. 2019-04-23 15:01:23 -07:00
__function___isatty.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__header_bits_signal.h Update signal macros after upgrade to snapshot1 (#144) 2019-12-03 09:23:40 -08:00
__header_dirent.h Wasi snapshot preview1 (#140) 2019-11-21 20:06:00 -08:00
__header_fcntl.h Wasi snapshot preview1 (#140) 2019-11-21 20:06:00 -08:00
__header_netinet_in.h Update to musl 1.1.24. 2020-02-26 10:23:05 -08:00
__header_poll.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__header_stdlib.h Miscellaneous cleanups (#113) 2019-10-18 13:53:13 -07:00
__header_string.h Miscellaneous cleanups (#113) 2019-10-18 13:53:13 -07:00
__header_sys_ioctl.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__header_sys_resource.h Declare getrusage. 2019-04-22 11:41:40 -07:00
__header_sys_socket.h Wasi snapshot preview1 (#140) 2019-11-21 20:06:00 -08:00
__header_sys_stat.h Move the mode_t macros into their own header. 2019-05-10 12:37:49 -07:00
__header_time.h Wasi snapshot preview1 (#140) 2019-11-21 20:06:00 -08:00
__header_unistd.h Move the SEEK_* macros into their own header and use it from fcntl.h. 2019-05-09 09:11:43 -07:00
__macro_FD_SETSIZE.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__mode_t.h Move the mode_t macros into their own header. 2019-05-10 12:37:49 -07:00
__seek.h Wasi snapshot preview1 (#140) 2019-11-21 20:06:00 -08:00
__struct_dirent.h WASI libc's dirent does have t_type, so define _DIRENT_HAVE_D_TYPE. 2019-08-29 10:22:03 -07:00
__struct_in6_addr.h Update to musl 1.1.24. 2020-02-26 10:23:05 -08:00
__struct_in_addr.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_iovec.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_msghdr.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_pollfd.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_rusage.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_sockaddr_in6.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_sockaddr_in.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_sockaddr_storage.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_sockaddr_un.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_sockaddr.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_timeval.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_tm.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__struct_tms.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_clockid_t.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_DIR.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_fd_set.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_in_addr_t.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_in_port_t.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_nfds_t.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_sa_family_t.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_sigset_t.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
__typedef_socklen_t.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
dirent.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
errno.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
fcntl.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
poll.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
stdlib.h Miscellaneous cleanups (#113) 2019-10-18 13:53:13 -07:00
string.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
time.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00
unistd.h WASI libc prototype implementation. 2019-03-27 07:59:55 -07:00