mirror of
https://github.com/golang/go
synced 2024-11-22 05:54:40 -07:00
syscall: update multicast socket options for darwin, freebsd, linux, openbsd
R=golang-dev, dave CC=golang-dev https://golang.org/cl/5137042
This commit is contained in:
parent
723f73caec
commit
71517e7b4a
@ -377,6 +377,26 @@ func GetsockoptInt(fd, level, opt int) (value, errno int) {
|
|||||||
return int(n), errno
|
return int(n), errno
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, errno int) {
|
||||||
|
vallen := _Socklen(4)
|
||||||
|
errno = getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value[0])), &vallen)
|
||||||
|
return value, errno
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, int) {
|
||||||
|
var value IPMreq
|
||||||
|
vallen := _Socklen(SizeofIPMreq)
|
||||||
|
errno := getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value)), &vallen)
|
||||||
|
return &value, errno
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, int) {
|
||||||
|
var value IPv6Mreq
|
||||||
|
vallen := _Socklen(SizeofIPv6Mreq)
|
||||||
|
errno := getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value)), &vallen)
|
||||||
|
return &value, errno
|
||||||
|
}
|
||||||
|
|
||||||
func SetsockoptByte(fd, level, opt int, value byte) (errno int) {
|
func SetsockoptByte(fd, level, opt int, value byte) (errno int) {
|
||||||
var n = byte(value)
|
var n = byte(value)
|
||||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 1)
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 1)
|
||||||
@ -387,6 +407,10 @@ func SetsockoptInt(fd, level, opt int, value int) (errno int) {
|
|||||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetsockoptInet4Addr(fd, level, opt int, value [4]byte) (errno int) {
|
||||||
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value[0])), 4)
|
||||||
|
}
|
||||||
|
|
||||||
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (errno int) {
|
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (errno int) {
|
||||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(tv)), unsafe.Sizeof(*tv))
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(tv)), unsafe.Sizeof(*tv))
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,17 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno
|
|||||||
return -1, ENOSYS
|
return -1, ENOSYS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, int) {
|
||||||
|
var value IPMreqn
|
||||||
|
vallen := _Socklen(SizeofIPMreqn)
|
||||||
|
errno := getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value)), &vallen)
|
||||||
|
return &value, errno
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (errno int) {
|
||||||
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(mreq)), unsafe.Sizeof(*mreq))
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
|
@ -450,11 +450,42 @@ func GetsockoptInt(fd, level, opt int) (value, errno int) {
|
|||||||
return int(n), errno
|
return int(n), errno
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, errno int) {
|
||||||
|
vallen := _Socklen(4)
|
||||||
|
errno = getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value[0])), &vallen)
|
||||||
|
return value, errno
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, int) {
|
||||||
|
var value IPMreq
|
||||||
|
vallen := _Socklen(SizeofIPMreq)
|
||||||
|
errno := getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value)), &vallen)
|
||||||
|
return &value, errno
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, int) {
|
||||||
|
var value IPMreqn
|
||||||
|
vallen := _Socklen(SizeofIPMreqn)
|
||||||
|
errno := getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value)), &vallen)
|
||||||
|
return &value, errno
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, int) {
|
||||||
|
var value IPv6Mreq
|
||||||
|
vallen := _Socklen(SizeofIPv6Mreq)
|
||||||
|
errno := getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value)), &vallen)
|
||||||
|
return &value, errno
|
||||||
|
}
|
||||||
|
|
||||||
func SetsockoptInt(fd, level, opt int, value int) (errno int) {
|
func SetsockoptInt(fd, level, opt int, value int) (errno int) {
|
||||||
var n = int32(value)
|
var n = int32(value)
|
||||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetsockoptInet4Addr(fd, level, opt int, value [4]byte) (errno int) {
|
||||||
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value[0])), 4)
|
||||||
|
}
|
||||||
|
|
||||||
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (errno int) {
|
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (errno int) {
|
||||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(tv)), unsafe.Sizeof(*tv))
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(tv)), unsafe.Sizeof(*tv))
|
||||||
}
|
}
|
||||||
@ -467,6 +498,10 @@ func SetsockoptIPMreq(fd, level, opt int, mreq *IPMreq) (errno int) {
|
|||||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(mreq)), unsafe.Sizeof(*mreq))
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(mreq)), unsafe.Sizeof(*mreq))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (errno int) {
|
||||||
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(mreq)), unsafe.Sizeof(*mreq))
|
||||||
|
}
|
||||||
|
|
||||||
func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) (errno int) {
|
func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) (errno int) {
|
||||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(mreq)), unsafe.Sizeof(*mreq))
|
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(mreq)), unsafe.Sizeof(*mreq))
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ typedef socklen_t $_Socklen;
|
|||||||
typedef struct linger $Linger;
|
typedef struct linger $Linger;
|
||||||
typedef struct iovec $Iovec;
|
typedef struct iovec $Iovec;
|
||||||
typedef struct ip_mreq $IPMreq;
|
typedef struct ip_mreq $IPMreq;
|
||||||
|
typedef struct ip_mreqn $IPMreqn;
|
||||||
typedef struct ipv6_mreq $IPv6Mreq;
|
typedef struct ipv6_mreq $IPv6Mreq;
|
||||||
typedef struct msghdr $Msghdr;
|
typedef struct msghdr $Msghdr;
|
||||||
typedef struct cmsghdr $Cmsghdr;
|
typedef struct cmsghdr $Cmsghdr;
|
||||||
@ -129,6 +130,7 @@ enum {
|
|||||||
$SizeofSockaddrDatalink = sizeof(struct sockaddr_dl),
|
$SizeofSockaddrDatalink = sizeof(struct sockaddr_dl),
|
||||||
$SizeofLinger = sizeof(struct linger),
|
$SizeofLinger = sizeof(struct linger),
|
||||||
$SizeofIPMreq = sizeof(struct ip_mreq),
|
$SizeofIPMreq = sizeof(struct ip_mreq),
|
||||||
|
$SizeofIPMreqn = sizeof(struct ip_mreqn),
|
||||||
$SizeofIPv6Mreq = sizeof(struct ipv6_mreq),
|
$SizeofIPv6Mreq = sizeof(struct ipv6_mreq),
|
||||||
$SizeofMsghdr = sizeof(struct msghdr),
|
$SizeofMsghdr = sizeof(struct msghdr),
|
||||||
$SizeofCmsghdr = sizeof(struct cmsghdr),
|
$SizeofCmsghdr = sizeof(struct cmsghdr),
|
||||||
|
@ -114,6 +114,7 @@ typedef socklen_t $_Socklen;
|
|||||||
typedef struct linger $Linger;
|
typedef struct linger $Linger;
|
||||||
typedef struct iovec $Iovec;
|
typedef struct iovec $Iovec;
|
||||||
typedef struct ip_mreq $IPMreq;
|
typedef struct ip_mreq $IPMreq;
|
||||||
|
typedef struct ip_mreqn $IPMreqn;
|
||||||
typedef struct ipv6_mreq $IPv6Mreq;
|
typedef struct ipv6_mreq $IPv6Mreq;
|
||||||
typedef struct msghdr $Msghdr;
|
typedef struct msghdr $Msghdr;
|
||||||
typedef struct cmsghdr $Cmsghdr;
|
typedef struct cmsghdr $Cmsghdr;
|
||||||
@ -130,6 +131,7 @@ enum {
|
|||||||
$SizeofSockaddrNetlink = sizeof(struct sockaddr_nl),
|
$SizeofSockaddrNetlink = sizeof(struct sockaddr_nl),
|
||||||
$SizeofLinger = sizeof(struct linger),
|
$SizeofLinger = sizeof(struct linger),
|
||||||
$SizeofIPMreq = sizeof(struct ip_mreq),
|
$SizeofIPMreq = sizeof(struct ip_mreq),
|
||||||
|
$SizeofIPMreqn = sizeof(struct ip_mreqn),
|
||||||
$SizeofIPv6Mreq = sizeof(struct ipv6_mreq),
|
$SizeofIPv6Mreq = sizeof(struct ipv6_mreq),
|
||||||
$SizeofMsghdr = sizeof(struct msghdr),
|
$SizeofMsghdr = sizeof(struct msghdr),
|
||||||
$SizeofCmsghdr = sizeof(struct cmsghdr),
|
$SizeofCmsghdr = sizeof(struct cmsghdr),
|
||||||
|
@ -33,6 +33,7 @@ const (
|
|||||||
SizeofSockaddrDatalink = 0x36
|
SizeofSockaddrDatalink = 0x36
|
||||||
SizeofLinger = 0x8
|
SizeofLinger = 0x8
|
||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
SizeofMsghdr = 0x1c
|
SizeofMsghdr = 0x1c
|
||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
@ -227,6 +228,12 @@ type IPMreq struct {
|
|||||||
Interface [4]byte /* in_addr */
|
Interface [4]byte /* in_addr */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IPMreqn struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Address [4]byte /* in_addr */
|
||||||
|
Ifindex int32
|
||||||
|
}
|
||||||
|
|
||||||
type IPv6Mreq struct {
|
type IPv6Mreq struct {
|
||||||
Multiaddr [16]byte /* in6_addr */
|
Multiaddr [16]byte /* in6_addr */
|
||||||
Interface uint32
|
Interface uint32
|
||||||
|
@ -33,6 +33,7 @@ const (
|
|||||||
SizeofSockaddrDatalink = 0x36
|
SizeofSockaddrDatalink = 0x36
|
||||||
SizeofLinger = 0x8
|
SizeofLinger = 0x8
|
||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
SizeofMsghdr = 0x30
|
SizeofMsghdr = 0x30
|
||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
@ -228,6 +229,12 @@ type IPMreq struct {
|
|||||||
Interface [4]byte /* in_addr */
|
Interface [4]byte /* in_addr */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IPMreqn struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Address [4]byte /* in_addr */
|
||||||
|
Ifindex int32
|
||||||
|
}
|
||||||
|
|
||||||
type IPv6Mreq struct {
|
type IPv6Mreq struct {
|
||||||
Multiaddr [16]byte /* in6_addr */
|
Multiaddr [16]byte /* in6_addr */
|
||||||
Interface uint32
|
Interface uint32
|
||||||
|
@ -20,6 +20,7 @@ const (
|
|||||||
SizeofSockaddrNetlink = 0xc
|
SizeofSockaddrNetlink = 0xc
|
||||||
SizeofLinger = 0x8
|
SizeofLinger = 0x8
|
||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
SizeofMsghdr = 0x1c
|
SizeofMsghdr = 0x1c
|
||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
@ -308,6 +309,12 @@ type IPMreq struct {
|
|||||||
Interface [4]byte /* in_addr */
|
Interface [4]byte /* in_addr */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IPMreqn struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Address [4]byte /* in_addr */
|
||||||
|
Ifindex int32
|
||||||
|
}
|
||||||
|
|
||||||
type IPv6Mreq struct {
|
type IPv6Mreq struct {
|
||||||
Multiaddr [16]byte /* in6_addr */
|
Multiaddr [16]byte /* in6_addr */
|
||||||
Interface uint32
|
Interface uint32
|
||||||
|
@ -20,6 +20,7 @@ const (
|
|||||||
SizeofSockaddrNetlink = 0xc
|
SizeofSockaddrNetlink = 0xc
|
||||||
SizeofLinger = 0x8
|
SizeofLinger = 0x8
|
||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
SizeofMsghdr = 0x38
|
SizeofMsghdr = 0x38
|
||||||
SizeofCmsghdr = 0x10
|
SizeofCmsghdr = 0x10
|
||||||
@ -308,6 +309,12 @@ type IPMreq struct {
|
|||||||
Interface [4]byte /* in_addr */
|
Interface [4]byte /* in_addr */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IPMreqn struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Address [4]byte /* in_addr */
|
||||||
|
Ifindex int32
|
||||||
|
}
|
||||||
|
|
||||||
type IPv6Mreq struct {
|
type IPv6Mreq struct {
|
||||||
Multiaddr [16]byte /* in6_addr */
|
Multiaddr [16]byte /* in6_addr */
|
||||||
Interface uint32
|
Interface uint32
|
||||||
|
@ -25,6 +25,7 @@ const (
|
|||||||
SizeofSockaddrNetlink = 0xc
|
SizeofSockaddrNetlink = 0xc
|
||||||
SizeofLinger = 0x8
|
SizeofLinger = 0x8
|
||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
SizeofMsghdr = 0x1c
|
SizeofMsghdr = 0x1c
|
||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
@ -315,6 +316,12 @@ type IPMreq struct {
|
|||||||
Interface [4]byte /* in_addr */
|
Interface [4]byte /* in_addr */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IPMreqn struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Address [4]byte /* in_addr */
|
||||||
|
Ifindex int32
|
||||||
|
}
|
||||||
|
|
||||||
type IPv6Mreq struct {
|
type IPv6Mreq struct {
|
||||||
Multiaddr [16]byte /* in6_addr */
|
Multiaddr [16]byte /* in6_addr */
|
||||||
Interface uint32
|
Interface uint32
|
||||||
|
Loading…
Reference in New Issue
Block a user