syscall_unix.go 802 B

1234567891011121314151617181920212223242526
  1. // Copyright 2013 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. // +build darwin dragonfly freebsd linux,!386 netbsd openbsd
  5. package ipv6
  6. import (
  7. "syscall"
  8. "unsafe"
  9. )
  10. func getsockopt(fd, level, name int, v unsafe.Pointer, l *uint32) error {
  11. if _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 {
  12. return error(errno)
  13. }
  14. return nil
  15. }
  16. func setsockopt(fd, level, name int, v unsafe.Pointer, l uint32) error {
  17. if _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 {
  18. return error(errno)
  19. }
  20. return nil
  21. }