~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/golang.org/x/net/ipv6/syscall_linux_386.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
package ipv6
 
6
 
 
7
import (
 
8
        "syscall"
 
9
        "unsafe"
 
10
)
 
11
 
 
12
const (
 
13
        sysGETSOCKOPT = 0xf
 
14
        sysSETSOCKOPT = 0xe
 
15
)
 
16
 
 
17
func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno)
 
18
 
 
19
func getsockopt(fd, level, name int, v unsafe.Pointer, l *sysSockoptLen) error {
 
20
        if _, errno := socketcall(sysGETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 {
 
21
                return error(errno)
 
22
        }
 
23
        return nil
 
24
}
 
25
 
 
26
func setsockopt(fd, level, name int, v unsafe.Pointer, l sysSockoptLen) error {
 
27
        if _, errno := socketcall(sysSETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 {
 
28
                return error(errno)
 
29
        }
 
30
        return nil
 
31
}