Nov 10, 2019

[Go][linux] AF_VSOCK

func Ioctl(fd uintptr, request int, argp unsafe.Pointer) error {
 _, _, errno := unix.Syscall(
  unix.SYS_IOCTL,
  fd,
  uintptr(request),
  // Note that the conversion from unsafe.Pointer to uintptr _must_
  // occur in the call expression.  See the package unsafe documentation
  // for more details.
  uintptr(argp),
 )
 if errno != 0 {
  return os.NewSyscallError("ioctl", fmt.Errorf("%d", int(errno)))
 }

 return nil
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.