~smoser/ubuntu/precise/juju-core/cloud-tools

« back to all changes in this revision

Viewing changes to src/code.google.com/p/go.net/ipv6/syscall_linux_386.go

  • Committer: Scott Moser
  • Date: 2014-04-14 16:22:55 UTC
  • mfrom: (24.1.11 trusty-proposed)
  • Revision ID: smoser@ubuntu.com-20140414162255-1gco8gmo03v3aff6
* New update for the Ubuntu Cloud Archive.
* New upstream point release, including fixes for:
  - Upgrading juju 1.16.6 -> 1.18.x fails (LP: #1299802).
  - Peer relation disappears during juju-upgrade (LP: #1303697).
  - public-address of units changes to internal bridge post upgrade
    (LP: #1303735).
  - Unable to deploy local charms without series (LP: #1303880).
  - juju scp no longer allows multiple extra arguments to be passed
    (LP: #1306208).
  - juju cannot downgrade to same major.minor version with earlier
    patch number (LP: #1306296).

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
// This code is a duplicate of syscall/syscall_linux_386.go with small
 
6
// modifications.
 
7
 
 
8
package ipv6
 
9
 
 
10
import (
 
11
        "syscall"
 
12
        "unsafe"
 
13
)
 
14
 
 
15
// On x86 Linux, all the socket calls go through an extra indirection,
 
16
// I think because the 5-register system call interface can't handle
 
17
// the 6-argument calls like sendto and recvfrom. Instead the
 
18
// arguments to the underlying system call are the number below and a
 
19
// pointer to an array of uintptr. We hide the pointer in the
 
20
// socketcall assembly to avoid allocation on every system call.
 
21
 
 
22
const (
 
23
        // See /usr/include/linux/net.h.
 
24
        _SETSOCKOPT = 14
 
25
        _GETSOCKOPT = 15
 
26
)
 
27
 
 
28
var socketcall func(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno)
 
29
 
 
30
func getsockopt(fd int, level int, name int, v uintptr, l *sysSockoptLen) error {
 
31
        if _, errno := socketcall(_GETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 {
 
32
                return error(errno)
 
33
        }
 
34
        return nil
 
35
}
 
36
 
 
37
func setsockopt(fd int, level int, name int, v uintptr, l uintptr) error {
 
38
        if _, errno := socketcall(_SETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), v, l, 0); errno != 0 {
 
39
                return error(errno)
 
40
        }
 
41
        return nil
 
42
}