libgo: update to go1.9
[official-gcc.git] / libgo / go / internal / poll / sockopt.go
blobf86ce707a123aef486af92d3e908344a5ca4ed07
1 // Copyright 2009 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
7 package poll
9 import "syscall"
11 // SetsockoptInt wraps the setsockopt network call with an int argument.
12 func (fd *FD) SetsockoptInt(level, name, arg int) error {
13 if err := fd.incref(); err != nil {
14 return err
16 defer fd.decref()
17 return syscall.SetsockoptInt(fd.Sysfd, level, name, arg)
20 // SetsockoptInet4Addr wraps the setsockopt network call with an IPv4 address.
21 func (fd *FD) SetsockoptInet4Addr(level, name int, arg [4]byte) error {
22 if err := fd.incref(); err != nil {
23 return err
25 defer fd.decref()
26 return syscall.SetsockoptInet4Addr(fd.Sysfd, level, name, arg)
29 // SetsockoptLinger wraps the setsockopt network call with a Linger argument.
30 func (fd *FD) SetsockoptLinger(level, name int, l *syscall.Linger) error {
31 if err := fd.incref(); err != nil {
32 return err
34 defer fd.decref()
35 return syscall.SetsockoptLinger(fd.Sysfd, level, name, l)