to find out something interesting in Go runtime
- insert code into runtime
- add a pipe in runtime
now we change direction to leverage ast package to preprocess the source project, so that we could finish the task
you can use the file in runtime_change
to test after inserting code
/usr/lib/go-1.18/src/runtime/sys_netbsd_386.s:https:// func pipe2(flags int32) (r, w int32, errno int32)
/usr/lib/go-1.18/src/runtime/syscall_solaris.go
func syscall_write(fd, buf, nbyte uintptr) (n, err uintptr)
/usr/lib/go-1.18/src/os
func Pipe() (r *File, w *File, err error) {
var p [2]syscall.Handle
e := syscall.Pipe(p[:])
if e != nil {
return nil, nil, NewSyscallError("pipe", e)
}
return newFile(p[0], "|0", "pipe"), newFile(p[1], "|1", "pipe"), nil
}
/usr/lib/go-1.18/src/syscall/syscall_windows.go
func Pipe(p []Handle) (err error) {
if len(p) != 2 {
return EINVAL
}
var r, w Handle
e := CreatePipe(&r, &w, makeInheritSa(), 0)
if e != nil {
return e
}
p[0] = r
p[1] = w
return nil
}