//go:cgo_import_dynamic libc_sysconf sysconf "libc.so"
//go:cgo_import_dynamic libc_usleep usleep "libc.so"
//go:cgo_import_dynamic libc_write write "libc.so"
-//go:cgo_import_dynamic libc_pipe pipe "libc.so"
//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so"
//go:linkname libc____errno libc____errno
//go:linkname libc_sysconf libc_sysconf
//go:linkname libc_usleep libc_usleep
//go:linkname libc_write libc_write
-//go:linkname libc_pipe libc_pipe
//go:linkname libc_pipe2 libc_pipe2
var (
libc_sysconf,
libc_usleep,
libc_write,
- libc_pipe,
libc_pipe2 libcFunc
)
MOVQ AX, (m_mOS+mOS_perrno)(BX)
RET
-// pipe(3c) wrapper that returns fds in AX, DX.
-// NOT USING GO CALLING CONVENTION.
-TEXT runtime·pipe1(SB),NOSPLIT,$0
- SUBQ $16, SP // 8 bytes will do, but stack has to be 16-byte aligned
- MOVQ SP, DI
- LEAQ libc_pipe(SB), AX
- CALL AX
- MOVL 0(SP), AX
- MOVL 4(SP), DX
- ADDQ $16, SP
- RET
-
// Call a library function with SysV calling conventions.
// The called function can take a maximum of 6 INTEGER class arguments,
// see
libc_wait4 libcFunc
)
-//go:linkname pipe1x runtime.pipe1
-var pipe1x libcFunc // name to take addr of pipe1
-
-func pipe1() // declared for vet; do NOT call
-
// Many of these are exported via linkname to assembly in the syscall
// package.
return call.err
}
-//go:linkname syscall_pipe
-func syscall_pipe() (r, w, err uintptr) {
- call := libcall{
- fn: uintptr(unsafe.Pointer(&pipe1x)),
- n: 0,
- args: uintptr(unsafe.Pointer(&pipe1x)), // it's unused but must be non-nil, otherwise crashes
- }
- entersyscallblock()
- asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
- exitsyscall()
- return call.r1, call.r2, call.err
-}
-
// This is syscall.RawSyscall, it exists to satisfy some build dependency,
// but it doesn't work.
//
TEXT ·ioctl(SB),NOSPLIT,$0
JMP runtime·syscall_ioctl(SB)
-TEXT ·pipe(SB),NOSPLIT,$0
- JMP runtime·syscall_pipe(SB)
-
TEXT ·RawSyscall(SB),NOSPLIT,$0
JMP runtime·syscall_rawsyscall(SB)
return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
}
-func pipe() (r uintptr, w uintptr, err uintptr)
-
func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- r0, w0, e1 := pipe()
- if e1 != 0 {
- err = Errno(e1)
- }
- if err == nil {
- p[0], p[1] = int(r0), int(w0)
- }
- return
+ return Pipe2(p, 0)
}
//sysnb pipe2(p *[2]_C_int, flags int) (err error)