github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/net/internal/socket/sys_linux.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build linux && !s390x && !386
     6  // +build linux,!s390x,!386
     7  
     8  package socket
     9  
    10  import (
    11  	"syscall"
    12  	"unsafe"
    13  )
    14  
    15  func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
    16  	n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0)
    17  	return int(n), errnoErr(errno)
    18  }
    19  
    20  func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
    21  	n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0)
    22  	return int(n), errnoErr(errno)
    23  }