* gcc.dg/guality/guality.exp: Skip on AIX.
[official-gcc.git] / libgo / go / net / sockoptip_windows.go
blob3e248441ab3b82d628af4625811216b6daf315cc
1 // Copyright 2011 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.
5 package net
7 import (
8 "os"
9 "syscall"
10 "unsafe"
13 func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
14 ip, err := interfaceToIPv4Addr(ifi)
15 if err != nil {
16 return os.NewSyscallError("setsockopt", err)
18 var a [4]byte
19 copy(a[:], ip.To4())
20 if err := fd.incref(false); err != nil {
21 return err
23 defer fd.decref()
24 err = syscall.Setsockopt(fd.sysfd, int32(syscall.IPPROTO_IP), int32(syscall.IP_MULTICAST_IF), (*byte)(unsafe.Pointer(&a[0])), 4)
25 if err != nil {
26 return os.NewSyscallError("setsockopt", err)
28 return nil
31 func setIPv4MulticastLoopback(fd *netFD, v bool) error {
32 if err := fd.incref(false); err != nil {
33 return err
35 defer fd.decref()
36 vv := int32(boolint(v))
37 err := syscall.Setsockopt(fd.sysfd, int32(syscall.IPPROTO_IP), int32(syscall.IP_MULTICAST_LOOP), (*byte)(unsafe.Pointer(&vv)), 4)
38 if err != nil {
39 return os.NewSyscallError("setsockopt", err)
41 return nil