libc_unix1.go 806 B

123456789101112131415161718192021222324252627
  1. // Copyright 2024 The Libc 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. //go:build unix && !illumos && !(linux && (amd64 || arm64 || loong64 || ppc64le || s390x || riscv64 || 386 || arm)) && !openbsd
  5. package libc // import "modernc.org/libc"
  6. import (
  7. "golang.org/x/sys/unix"
  8. "modernc.org/libc/sys/types"
  9. )
  10. // ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
  11. func Xrecvmsg(t *TLS, sockfd int32, msg uintptr, flags int32) types.Ssize_t {
  12. if __ccgo_strace {
  13. trc("t=%v sockfd=%v msg=%v flags=%v, (%v:)", t, sockfd, msg, flags, origin(2))
  14. }
  15. n, _, err := unix.Syscall(unix.SYS_RECVMSG, uintptr(sockfd), msg, uintptr(flags))
  16. if err != 0 {
  17. t.setErrno(err)
  18. return -1
  19. }
  20. return types.Ssize_t(n)
  21. }