aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/syscall/libc_wasip2.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/syscall/libc_wasip2.go')
-rw-r--r--src/syscall/libc_wasip2.go52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/syscall/libc_wasip2.go b/src/syscall/libc_wasip2.go
index a89e64a80..5621c1a68 100644
--- a/src/syscall/libc_wasip2.go
+++ b/src/syscall/libc_wasip2.go
@@ -1227,58 +1227,6 @@ func p2fileTypeToStatType(t types.DescriptorType) uint32 {
return 0
}
-var libc_envs map[string]string
-
-func populateEnvironment() {
- libc_envs = make(map[string]string)
- for _, kv := range environment.GetEnvironment().Slice() {
- libc_envs[kv[0]] = kv[1]
- }
-}
-
-// char * getenv(const char *name);
-//
-//export getenv
-func getenv(key *byte) *byte {
- k := goString(key)
-
- v, ok := libc_envs[k]
- if !ok {
- return nil
- }
-
- // The new allocation is zero-filled; allocating an extra byte and then
- // copying the data over will leave the last byte untouched,
- // null-terminating the string.
- vbytes := make([]byte, len(v)+1)
- copy(vbytes, v)
- return unsafe.SliceData(vbytes)
-}
-
-// int setenv(const char *name, const char *value, int overwrite);
-//
-//export setenv
-func setenv(key, value *byte, overwrite int) int {
- k := goString(key)
- if _, ok := libc_envs[k]; ok && overwrite == 0 {
- return 0
- }
-
- v := goString(value)
- libc_envs[k] = v
-
- return 0
-}
-
-// int unsetenv(const char *name);
-//
-//export unsetenv
-func unsetenv(key *byte) int {
- k := goString(key)
- delete(libc_envs, k)
- return 0
-}
-
// void arc4random_buf (void *, size_t);
//
//export arc4random_buf