github.com/JimmyHuang454/JLS-go@v0.0.0-20230831150107-90d536585ba0/internal/poll/sockoptip.go (about) 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. 4 5 //go:build unix || windows 6 7 package poll 8 9 import "syscall" 10 11 // SetsockoptIPMreq wraps the setsockopt network call with an IPMreq argument. 12 func (fd *FD) SetsockoptIPMreq(level, name int, mreq *syscall.IPMreq) error { 13 if err := fd.incref(); err != nil { 14 return err 15 } 16 defer fd.decref() 17 return syscall.SetsockoptIPMreq(fd.Sysfd, level, name, mreq) 18 } 19 20 // SetsockoptIPv6Mreq wraps the setsockopt network call with an IPv6Mreq argument. 21 func (fd *FD) SetsockoptIPv6Mreq(level, name int, mreq *syscall.IPv6Mreq) error { 22 if err := fd.incref(); err != nil { 23 return err 24 } 25 defer fd.decref() 26 return syscall.SetsockoptIPv6Mreq(fd.Sysfd, level, name, mreq) 27 }