github.com/primecitizens/pcz/std@v0.2.1/ffi/wasm/wasi/environ.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2023 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 //go:build wasip1 9 10 package wasi 11 12 import ( 13 "unsafe" 14 ) 15 16 // Environ depends on values returned by EnvironSizes 17 // 18 // envv is [count]uint32 19 // environBuf is [totalBytes]byte 20 // 21 //go:wasmimport wasi_snapshot_preview1 environ_get 22 //go:noescape 23 func Environ(envv, environBuf unsafe.Pointer) Errno 24 25 //go:wasmimport wasi_snapshot_preview1 environ_sizes_get 26 //go:noescape 27 func environ_sizes_get(environCount, environBufLen unsafe.Pointer) Errno 28 29 func EnvironSizes() (envc, totalBytes Size, errno Errno) { 30 var n, sz Size 31 errno = environ_sizes_get(unsafe.Pointer(&n), unsafe.Pointer(&sz)) 32 return n, sz, errno 33 }