mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall, net: Add Recvmsg and Sendmsg on Linux.
Working on issue 1101. R=rsc CC=golang-dev https://golang.org/cl/2331044
This commit is contained in:
parent
ed7c3f3127
commit
cf6c212197
11 changed files with 326 additions and 5 deletions
|
|
@ -151,6 +151,16 @@ func sendto(s int, p []byte, flags int, to uintptr, addrlen _Socklen) (errno int
|
|||
return
|
||||
}
|
||||
|
||||
func recvmsg(s int, msg *Msghdr, flags int) (n int, errno int) {
|
||||
n, errno = socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
|
||||
return
|
||||
}
|
||||
|
||||
func sendmsg(s int, msg *Msghdr, flags int) (errno int) {
|
||||
_, errno = socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
|
||||
return
|
||||
}
|
||||
|
||||
func Listen(s int, n int) (errno int) {
|
||||
_, errno = socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
|
||||
return
|
||||
|
|
@ -176,3 +186,15 @@ func Statfs(path string, buf *Statfs_t) (errno int) {
|
|||
func (r *PtraceRegs) PC() uint64 { return uint64(uint32(r.Eip)) }
|
||||
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Eip = int32(pc) }
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint32(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue