Black Lives Matter. Support the Equal Justice Initiative.

Source file src/internal/poll/sockopt.go

Documentation: internal/poll

     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.
     4  
     5  //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
     6  // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
     7  
     8  package poll
     9  
    10  import "syscall"
    11  
    12  // SetsockoptInt wraps the setsockopt network call with an int argument.
    13  func (fd *FD) SetsockoptInt(level, name, arg int) error {
    14  	if err := fd.incref(); err != nil {
    15  		return err
    16  	}
    17  	defer fd.decref()
    18  	return syscall.SetsockoptInt(fd.Sysfd, level, name, arg)
    19  }
    20  
    21  // SetsockoptInet4Addr wraps the setsockopt network call with an IPv4 address.
    22  func (fd *FD) SetsockoptInet4Addr(level, name int, arg [4]byte) error {
    23  	if err := fd.incref(); err != nil {
    24  		return err
    25  	}
    26  	defer fd.decref()
    27  	return syscall.SetsockoptInet4Addr(fd.Sysfd, level, name, arg)
    28  }
    29  
    30  // SetsockoptLinger wraps the setsockopt network call with a Linger argument.
    31  func (fd *FD) SetsockoptLinger(level, name int, l *syscall.Linger) error {
    32  	if err := fd.incref(); err != nil {
    33  		return err
    34  	}
    35  	defer fd.decref()
    36  	return syscall.SetsockoptLinger(fd.Sysfd, level, name, l)
    37  }
    38  

View as plain text