author | Mikio Hara
<mikioh.mikioh@gmail.com> 2016-03-30 00:22:35 UTC |
committer | Mikio Hara
<mikioh.mikioh@gmail.com> 2016-03-31 04:07:02 UTC |
parent | 37db164db41c1a1fa2a6d787132053d795b78a9c |
ipv6/sockopt_ssmreq_unix.go | +2 | -2 |
ipv6/sockopt_unix.go | +6 | -6 |
ipv6/sys_bsd.go | +0 | -2 |
ipv6/sys_darwin.go | +0 | -2 |
ipv6/sys_freebsd.go | +0 | -2 |
ipv6/sys_linux.go | +0 | -2 |
ipv6/sys_stub.go | +0 | -2 |
ipv6/syscall_linux_386.go | +2 | -2 |
ipv6/syscall_unix.go | +2 | -2 |
diff --git a/ipv6/sockopt_ssmreq_unix.go b/ipv6/sockopt_ssmreq_unix.go index c64d6d5..a36a7e0 100644 --- a/ipv6/sockopt_ssmreq_unix.go +++ b/ipv6/sockopt_ssmreq_unix.go @@ -21,7 +21,7 @@ func setsockoptGroupReq(fd int, opt *sockOpt, ifi *net.Interface, grp net.IP) er } gr.setGroup(grp) var p unsafe.Pointer - var l sysSockoptLen + var l uint32 if freebsd32o64 { var d [sysSizeofGroupReq + 4]byte s := (*[sysSizeofGroupReq]byte)(unsafe.Pointer(&gr)) @@ -43,7 +43,7 @@ func setsockoptGroupSourceReq(fd int, opt *sockOpt, ifi *net.Interface, grp, src } gsr.setSourceGroup(grp, src) var p unsafe.Pointer - var l sysSockoptLen + var l uint32 if freebsd32o64 { var d [sysSizeofGroupSourceReq + 4]byte s := (*[sysSizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr)) diff --git a/ipv6/sockopt_unix.go b/ipv6/sockopt_unix.go index 25ea545..7115b18 100644 --- a/ipv6/sockopt_unix.go +++ b/ipv6/sockopt_unix.go @@ -17,7 +17,7 @@ func getInt(fd int, opt *sockOpt) (int, error) { return 0, errOpNoSupport } var i int32 - l := sysSockoptLen(4) + l := uint32(4) if err := getsockopt(fd, opt.level, opt.name, unsafe.Pointer(&i), &l); err != nil { return 0, os.NewSyscallError("getsockopt", err) } @@ -29,7 +29,7 @@ func setInt(fd int, opt *sockOpt, v int) error { return errOpNoSupport } i := int32(v) - return os.NewSyscallError("setsockopt", setsockopt(fd, opt.level, opt.name, unsafe.Pointer(&i), sysSockoptLen(4))) + return os.NewSyscallError("setsockopt", setsockopt(fd, opt.level, opt.name, unsafe.Pointer(&i), 4)) } func getInterface(fd int, opt *sockOpt) (*net.Interface, error) { @@ -37,7 +37,7 @@ func getInterface(fd int, opt *sockOpt) (*net.Interface, error) { return nil, errOpNoSupport } var i int32 - l := sysSockoptLen(4) + l := uint32(4) if err := getsockopt(fd, opt.level, opt.name, unsafe.Pointer(&i), &l); err != nil { return nil, os.NewSyscallError("getsockopt", err) } @@ -59,7 +59,7 @@ func setInterface(fd int, opt *sockOpt, ifi *net.Interface) error { if ifi != nil { i = int32(ifi.Index) } - return os.NewSyscallError("setsockopt", setsockopt(fd, opt.level, opt.name, unsafe.Pointer(&i), sysSockoptLen(4))) + return os.NewSyscallError("setsockopt", setsockopt(fd, opt.level, opt.name, unsafe.Pointer(&i), 4)) } func getICMPFilter(fd int, opt *sockOpt) (*ICMPFilter, error) { @@ -67,7 +67,7 @@ func getICMPFilter(fd int, opt *sockOpt) (*ICMPFilter, error) { return nil, errOpNoSupport } var f ICMPFilter - l := sysSockoptLen(sysSizeofICMPv6Filter) + l := uint32(sysSizeofICMPv6Filter) if err := getsockopt(fd, opt.level, opt.name, unsafe.Pointer(&f.sysICMPv6Filter), &l); err != nil { return nil, os.NewSyscallError("getsockopt", err) } @@ -86,7 +86,7 @@ func getMTUInfo(fd int, opt *sockOpt) (*net.Interface, int, error) { return nil, 0, errOpNoSupport } var mi sysIPv6Mtuinfo - l := sysSockoptLen(sysSizeofIPv6Mtuinfo) + l := uint32(sysSizeofIPv6Mtuinfo) if err := getsockopt(fd, opt.level, opt.name, unsafe.Pointer(&mi), &l); err != nil { return nil, 0, os.NewSyscallError("getsockopt", err) } diff --git a/ipv6/sys_bsd.go b/ipv6/sys_bsd.go index 75a8863..0ee43e6 100644 --- a/ipv6/sys_bsd.go +++ b/ipv6/sys_bsd.go @@ -13,8 +13,6 @@ import ( "golang.org/x/net/internal/iana" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, diff --git a/ipv6/sys_darwin.go b/ipv6/sys_darwin.go index 411fb49..c263f08 100644 --- a/ipv6/sys_darwin.go +++ b/ipv6/sys_darwin.go @@ -12,8 +12,6 @@ import ( "golang.org/x/net/internal/iana" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlHopLimit: {sysIPV6_2292HOPLIMIT, 4, marshal2292HopLimit, parseHopLimit}, diff --git a/ipv6/sys_freebsd.go b/ipv6/sys_freebsd.go index b68725c..5527001 100644 --- a/ipv6/sys_freebsd.go +++ b/ipv6/sys_freebsd.go @@ -14,8 +14,6 @@ import ( "golang.org/x/net/internal/iana" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, diff --git a/ipv6/sys_linux.go b/ipv6/sys_linux.go index 2fa6088..fd7d5b1 100644 --- a/ipv6/sys_linux.go +++ b/ipv6/sys_linux.go @@ -12,8 +12,6 @@ import ( "golang.org/x/net/internal/iana" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, diff --git a/ipv6/sys_stub.go b/ipv6/sys_stub.go index 6c9a143..ead0f4d 100644 --- a/ipv6/sys_stub.go +++ b/ipv6/sys_stub.go @@ -6,8 +6,6 @@ package ipv6 -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{} diff --git a/ipv6/syscall_linux_386.go b/ipv6/syscall_linux_386.go index 82633a5..64a3c66 100644 --- a/ipv6/syscall_linux_386.go +++ b/ipv6/syscall_linux_386.go @@ -16,14 +16,14 @@ const ( func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) -func getsockopt(fd, level, name int, v unsafe.Pointer, l *sysSockoptLen) error { +func getsockopt(fd, level, name int, v unsafe.Pointer, l *uint32) error { if _, errno := socketcall(sysGETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 { return error(errno) } return nil } -func setsockopt(fd, level, name int, v unsafe.Pointer, l sysSockoptLen) error { +func setsockopt(fd, level, name int, v unsafe.Pointer, l uint32) error { if _, errno := socketcall(sysSETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 { return error(errno) } diff --git a/ipv6/syscall_unix.go b/ipv6/syscall_unix.go index a2bd836..925fd2f 100644 --- a/ipv6/syscall_unix.go +++ b/ipv6/syscall_unix.go @@ -11,14 +11,14 @@ import ( "unsafe" ) -func getsockopt(fd, level, name int, v unsafe.Pointer, l *sysSockoptLen) error { +func getsockopt(fd, level, name int, v unsafe.Pointer, l *uint32) error { if _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 { return error(errno) } return nil } -func setsockopt(fd, level, name int, v unsafe.Pointer, l sysSockoptLen) error { +func setsockopt(fd, level, name int, v unsafe.Pointer, l uint32) error { if _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 { return error(errno) }