go/ssa/interp: add syscall.Readlink intrinsic, needed by os package
Change-Id: Ie408fd5ffb2be2d60773eb3fda91912887df0a7e Reviewed-on: https://go-review.googlesource.com/33147 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
22ba3f367c
commit
5e2ae75eb7
|
@ -142,6 +142,7 @@ func init() {
|
|||
"syscall.RawSyscall": ext۰syscall۰RawSyscall,
|
||||
"syscall.Read": ext۰syscall۰Read,
|
||||
"syscall.ReadDirent": ext۰syscall۰ReadDirent,
|
||||
"syscall.Readlink": ext۰syscall۰Readlink,
|
||||
"syscall.Stat": ext۰syscall۰Stat,
|
||||
"syscall.Write": ext۰syscall۰Write,
|
||||
"syscall.runtime_envs": ext۰runtime۰environ,
|
||||
|
@ -485,6 +486,13 @@ func ext۰syscall۰Getpid(fr *frame, args []value) value {
|
|||
return syscall.Getpid()
|
||||
}
|
||||
|
||||
func ext۰syscall۰Readlink(fr *frame, args []value) value {
|
||||
path := args[0].(string)
|
||||
buf := valueToBytes(args[1])
|
||||
n, err := syscall.Readlink(path, buf)
|
||||
return tuple{n, wrapError(err)}
|
||||
}
|
||||
|
||||
func valueToBytes(v value) []byte {
|
||||
in := v.([]value)
|
||||
b := make([]byte, len(in))
|
||||
|
|
Loading…
Reference in New Issue