Commit eff19528 authored by Dave Cheney's avatar Dave Cheney Committed by Russ Cox

syscall: add SetsockoptIpMreq

notes:
* due to Issue 1466 the Msghdr struct for
 src/pkg/syscall/ztypes_darwin_386.go
 src/pkg/syscall/ztypes_darwin_amd64.go
had to be edited after the godefs generation.
* ztypes_*.go files for linux, freebsd and darwin
have been prepared on the correct host OS and ARCH.
While the total increase is a dozen lines per file
the diff is larger due to a change to godefs,
 http://code.google.com/p/go/source/detail?r=c79e30afe9c8
while has altered the names of Pad members which
causes gofmt to realign the affected structs

R=rsc, mikioh
CC=golang-dev
https://golang.org/cl/4119053
parent 33cf8834
...@@ -343,6 +343,10 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) { ...@@ -343,6 +343,10 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l)) return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l))
} }
func SetsockoptIpMreq(fd, level, opt int, mreq *IpMreq) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(mreq)), unsafe.Sizeof(*mreq))
}
func SetsockoptString(fd, level, opt int, s string) (errno int) { func SetsockoptString(fd, level, opt int, s string) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s)) return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s))
} }
......
...@@ -428,6 +428,10 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) { ...@@ -428,6 +428,10 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l)) return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l))
} }
func SetsockoptIpMreq(fd, level, opt int, mreq *IpMreq) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(mreq)), unsafe.Sizeof(*mreq))
}
func SetsockoptString(fd, level, opt int, s string) (errno int) { func SetsockoptString(fd, level, opt int, s string) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s)) return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s))
} }
......
...@@ -104,6 +104,7 @@ typedef struct sockaddr_any $RawSockaddrAny; ...@@ -104,6 +104,7 @@ typedef struct sockaddr_any $RawSockaddrAny;
typedef socklen_t $_Socklen; 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 msghdr $Msghdr; typedef struct msghdr $Msghdr;
typedef struct cmsghdr $Cmsghdr; typedef struct cmsghdr $Cmsghdr;
...@@ -113,6 +114,7 @@ enum { ...@@ -113,6 +114,7 @@ enum {
$SizeofSockaddrAny = sizeof(struct sockaddr_any), $SizeofSockaddrAny = sizeof(struct sockaddr_any),
$SizeofSockaddrUnix = sizeof(struct sockaddr_un), $SizeofSockaddrUnix = sizeof(struct sockaddr_un),
$SizeofLinger = sizeof(struct linger), $SizeofLinger = sizeof(struct linger),
$SizeofIpMreq = sizeof(struct ip_mreq),
$SizeofMsghdr = sizeof(struct msghdr), $SizeofMsghdr = sizeof(struct msghdr),
$SizeofCmsghdr = sizeof(struct cmsghdr), $SizeofCmsghdr = sizeof(struct cmsghdr),
}; };
......
...@@ -116,6 +116,7 @@ typedef struct sockaddr_any $RawSockaddrAny; ...@@ -116,6 +116,7 @@ typedef struct sockaddr_any $RawSockaddrAny;
typedef socklen_t $_Socklen; 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 msghdr $Msghdr; typedef struct msghdr $Msghdr;
typedef struct cmsghdr $Cmsghdr; typedef struct cmsghdr $Cmsghdr;
...@@ -125,6 +126,7 @@ enum { ...@@ -125,6 +126,7 @@ enum {
$SizeofSockaddrAny = sizeof(struct sockaddr_any), $SizeofSockaddrAny = sizeof(struct sockaddr_any),
$SizeofSockaddrUnix = sizeof(struct sockaddr_un), $SizeofSockaddrUnix = sizeof(struct sockaddr_un),
$SizeofLinger = sizeof(struct linger), $SizeofLinger = sizeof(struct linger),
$SizeofIpMreq = sizeof(struct ip_mreq),
$SizeofMsghdr = sizeof(struct msghdr), $SizeofMsghdr = sizeof(struct msghdr),
$SizeofCmsghdr = sizeof(struct cmsghdr), $SizeofCmsghdr = sizeof(struct cmsghdr),
}; };
......
...@@ -109,6 +109,7 @@ typedef struct sockaddr_any $RawSockaddrAny; ...@@ -109,6 +109,7 @@ typedef struct sockaddr_any $RawSockaddrAny;
typedef socklen_t $_Socklen; 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 msghdr $Msghdr; typedef struct msghdr $Msghdr;
typedef struct cmsghdr $Cmsghdr; typedef struct cmsghdr $Cmsghdr;
typedef struct ucred $Ucred; typedef struct ucred $Ucred;
...@@ -120,6 +121,7 @@ enum { ...@@ -120,6 +121,7 @@ enum {
$SizeofSockaddrUnix = sizeof(struct sockaddr_un), $SizeofSockaddrUnix = sizeof(struct sockaddr_un),
$SizeofSockaddrLinklayer = sizeof(struct sockaddr_ll), $SizeofSockaddrLinklayer = sizeof(struct sockaddr_ll),
$SizeofLinger = sizeof(struct linger), $SizeofLinger = sizeof(struct linger),
$SizeofIpMreq = sizeof(struct ip_mreq),
$SizeofMsghdr = sizeof(struct msghdr), $SizeofMsghdr = sizeof(struct msghdr),
$SizeofCmsghdr = sizeof(struct cmsghdr), $SizeofCmsghdr = sizeof(struct cmsghdr),
$SizeofUcred = sizeof(struct ucred), $SizeofUcred = sizeof(struct ucred),
......
...@@ -17,6 +17,7 @@ const ( ...@@ -17,6 +17,7 @@ const (
SizeofSockaddrAny = 0x6c SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a SizeofSockaddrUnix = 0x6a
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x1c SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc SizeofCmsghdr = 0xc
PTRACE_TRACEME = 0 PTRACE_TRACEME = 0
...@@ -150,7 +151,7 @@ type Dirent struct { ...@@ -150,7 +151,7 @@ type Dirent struct {
Namlen uint16 Namlen uint16
Type uint8 Type uint8
Name [1024]int8 Name [1024]int8
Pad0 [3]byte Pad_godefs_0 [3]byte
} }
type RawSockaddrInet4 struct { type RawSockaddrInet4 struct {
...@@ -199,6 +200,11 @@ type Iovec struct { ...@@ -199,6 +200,11 @@ type Iovec struct {
Len uint32 Len uint32
} }
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct { type Msghdr struct {
Name *byte Name *byte
Namelen uint32 Namelen uint32
......
...@@ -17,6 +17,7 @@ const ( ...@@ -17,6 +17,7 @@ const (
SizeofSockaddrAny = 0x6c SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a SizeofSockaddrUnix = 0x6a
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x30 SizeofMsghdr = 0x30
SizeofCmsghdr = 0xc SizeofCmsghdr = 0xc
PTRACE_TRACEME = 0 PTRACE_TRACEME = 0
...@@ -42,7 +43,7 @@ type Timespec struct { ...@@ -42,7 +43,7 @@ type Timespec struct {
type Timeval struct { type Timeval struct {
Sec int64 Sec int64
Usec int32 Usec int32
Pad0 [4]byte Pad_godefs_0 [4]byte
} }
type Rusage struct { type Rusage struct {
...@@ -79,7 +80,7 @@ type Stat_t struct { ...@@ -79,7 +80,7 @@ type Stat_t struct {
Uid uint32 Uid uint32
Gid uint32 Gid uint32
Rdev int32 Rdev int32
Pad0 [4]byte Pad_godefs_0 [4]byte
Atimespec Timespec Atimespec Timespec
Mtimespec Timespec Mtimespec Timespec
Ctimespec Timespec Ctimespec Timespec
...@@ -131,7 +132,7 @@ type Fstore_t struct { ...@@ -131,7 +132,7 @@ type Fstore_t struct {
type Radvisory_t struct { type Radvisory_t struct {
Offset int64 Offset int64
Count int32 Count int32
Pad0 [4]byte Pad_godefs_0 [4]byte
} }
type Fbootstraptransfer_t struct { type Fbootstraptransfer_t struct {
...@@ -153,7 +154,7 @@ type Dirent struct { ...@@ -153,7 +154,7 @@ type Dirent struct {
Namlen uint16 Namlen uint16
Type uint8 Type uint8
Name [1024]int8 Name [1024]int8
Pad0 [3]byte Pad_godefs_0 [3]byte
} }
type RawSockaddrInet4 struct { type RawSockaddrInet4 struct {
...@@ -202,13 +203,18 @@ type Iovec struct { ...@@ -202,13 +203,18 @@ type Iovec struct {
Len uint64 Len uint64
} }
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct { type Msghdr struct {
Name *byte Name *byte
Namelen uint32 Namelen uint32
Pad0 [4]byte Pad_godefs_0 [4]byte
Iov *Iovec Iov *Iovec
Iovlen int32 Iovlen int32
Pad1 [4]byte Pad_godefs_1 [4]byte
Control *byte Control *byte
Controllen uint32 Controllen uint32
Flags int32 Flags int32
......
...@@ -31,6 +31,7 @@ const ( ...@@ -31,6 +31,7 @@ const (
SizeofSockaddrAny = 0x6c SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a SizeofSockaddrUnix = 0x6a
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x1c SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc SizeofCmsghdr = 0xc
PTRACE_TRACEME = 0 PTRACE_TRACEME = 0
...@@ -102,8 +103,8 @@ type Stat_t struct { ...@@ -102,8 +103,8 @@ type Stat_t struct {
Gen uint32 Gen uint32
Lspare int32 Lspare int32
Birthtimespec Timespec Birthtimespec Timespec
Pad0 uint32 Pad_godefs_0 uint32
Pad1 uint32 Pad_godefs_1 uint32
} }
type Statfs_t struct { type Statfs_t struct {
...@@ -194,6 +195,11 @@ type Iovec struct { ...@@ -194,6 +195,11 @@ type Iovec struct {
Len uint32 Len uint32
} }
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct { type Msghdr struct {
Name *byte Name *byte
Namelen uint32 Namelen uint32
......
...@@ -31,6 +31,7 @@ const ( ...@@ -31,6 +31,7 @@ const (
SizeofSockaddrAny = 0x6c SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a SizeofSockaddrUnix = 0x6a
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x30 SizeofMsghdr = 0x30
SizeofCmsghdr = 0xc SizeofCmsghdr = 0xc
PTRACE_TRACEME = 0 PTRACE_TRACEME = 0
...@@ -102,8 +103,8 @@ type Stat_t struct { ...@@ -102,8 +103,8 @@ type Stat_t struct {
Gen uint32 Gen uint32
Lspare int32 Lspare int32
Birthtimespec Timespec Birthtimespec Timespec
Pad0 uint8 Pad_godefs_0 uint8
Pad1 uint8 Pad_godefs_1 uint8
} }
type Statfs_t struct { type Statfs_t struct {
...@@ -138,7 +139,7 @@ type Flock_t struct { ...@@ -138,7 +139,7 @@ type Flock_t struct {
Type int16 Type int16
Whence int16 Whence int16
Sysid int32 Sysid int32
Pad0 [4]byte Pad_godefs_0 [4]byte
} }
type Dirent struct { type Dirent struct {
...@@ -195,13 +196,18 @@ type Iovec struct { ...@@ -195,13 +196,18 @@ type Iovec struct {
Len uint64 Len uint64
} }
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct { type Msghdr struct {
Name *byte Name *byte
Namelen uint32 Namelen uint32
Pad0 [4]byte Pad_godefs_0 [4]byte
Iov *Iovec Iov *Iovec
Iovlen int32 Iovlen int32
Pad1 [4]byte Pad_godefs_1 [4]byte
Control *byte Control *byte
Controllen uint32 Controllen uint32
Flags int32 Flags int32
......
...@@ -18,6 +18,7 @@ const ( ...@@ -18,6 +18,7 @@ const (
SizeofSockaddrUnix = 0x6e SizeofSockaddrUnix = 0x6e
SizeofSockaddrLinklayer = 0x14 SizeofSockaddrLinklayer = 0x14
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x1c SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc SizeofCmsghdr = 0xc
SizeofUcred = 0xc SizeofUcred = 0xc
...@@ -65,17 +66,17 @@ type Timex struct { ...@@ -65,17 +66,17 @@ type Timex struct {
Errcnt int32 Errcnt int32
Stbcnt int32 Stbcnt int32
Tai int32 Tai int32
Pad0 int32 Pad_godefs_0 int32
Pad1 int32 Pad_godefs_1 int32
Pad2 int32 Pad_godefs_2 int32
Pad3 int32 Pad_godefs_3 int32
Pad4 int32 Pad_godefs_4 int32
Pad5 int32 Pad_godefs_5 int32
Pad6 int32 Pad_godefs_6 int32
Pad7 int32 Pad_godefs_7 int32
Pad8 int32 Pad_godefs_8 int32
Pad9 int32 Pad_godefs_9 int32
Pad10 int32 Pad_godefs_10 int32
} }
type Time_t int32 type Time_t int32
...@@ -121,7 +122,7 @@ type _Gid_t uint32 ...@@ -121,7 +122,7 @@ type _Gid_t uint32
type Stat_t struct { type Stat_t struct {
Dev uint64 Dev uint64
X__pad1 uint16 X__pad1 uint16
Pad0 [2]byte Pad_godefs_0 [2]byte
X__st_ino uint32 X__st_ino uint32
Mode uint32 Mode uint32
Nlink uint32 Nlink uint32
...@@ -129,7 +130,7 @@ type Stat_t struct { ...@@ -129,7 +130,7 @@ type Stat_t struct {
Gid uint32 Gid uint32
Rdev uint64 Rdev uint64
X__pad2 uint16 X__pad2 uint16
Pad1 [2]byte Pad_godefs_1 [2]byte
Size int64 Size int64
Blksize int32 Blksize int32
Blocks int64 Blocks int64
...@@ -159,7 +160,7 @@ type Dirent struct { ...@@ -159,7 +160,7 @@ type Dirent struct {
Reclen uint16 Reclen uint16
Type uint8 Type uint8
Name [256]int8 Name [256]int8
Pad0 [1]byte Pad_godefs_0 [1]byte
} }
type RawSockaddrInet4 struct { type RawSockaddrInet4 struct {
...@@ -214,6 +215,11 @@ type Iovec struct { ...@@ -214,6 +215,11 @@ type Iovec struct {
Len uint32 Len uint32
} }
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct { type Msghdr struct {
Name *byte Name *byte
Namelen uint32 Namelen uint32
......
...@@ -18,6 +18,7 @@ const ( ...@@ -18,6 +18,7 @@ const (
SizeofSockaddrUnix = 0x6e SizeofSockaddrUnix = 0x6e
SizeofSockaddrLinklayer = 0x14 SizeofSockaddrLinklayer = 0x14
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x38 SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10 SizeofCmsghdr = 0x10
SizeofUcred = 0xc SizeofUcred = 0xc
...@@ -46,13 +47,13 @@ type Timeval struct { ...@@ -46,13 +47,13 @@ type Timeval struct {
type Timex struct { type Timex struct {
Modes uint32 Modes uint32
Pad0 [4]byte Pad_godefs_0 [4]byte
Offset int64 Offset int64
Freq int64 Freq int64
Maxerror int64 Maxerror int64
Esterror int64 Esterror int64
Status int32 Status int32
Pad1 [4]byte Pad_godefs_1 [4]byte
Constant int64 Constant int64
Precision int64 Precision int64
Tolerance int64 Tolerance int64
...@@ -61,24 +62,24 @@ type Timex struct { ...@@ -61,24 +62,24 @@ type Timex struct {
Ppsfreq int64 Ppsfreq int64
Jitter int64 Jitter int64
Shift int32 Shift int32
Pad2 [4]byte Pad_godefs_2 [4]byte
Stabil int64 Stabil int64
Jitcnt int64 Jitcnt int64
Calcnt int64 Calcnt int64
Errcnt int64 Errcnt int64
Stbcnt int64 Stbcnt int64
Tai int32 Tai int32
Pad3 int32 Pad_godefs_3 int32
Pad4 int32 Pad_godefs_4 int32
Pad5 int32 Pad_godefs_5 int32
Pad6 int32 Pad_godefs_6 int32
Pad7 int32 Pad_godefs_7 int32
Pad8 int32 Pad_godefs_8 int32
Pad9 int32 Pad_godefs_9 int32
Pad10 int32 Pad_godefs_10 int32
Pad11 int32 Pad_godefs_11 int32
Pad12 int32 Pad_godefs_12 int32
Pad13 int32 Pad_godefs_13 int32
} }
type Time_t int64 type Time_t int64
...@@ -159,7 +160,7 @@ type Dirent struct { ...@@ -159,7 +160,7 @@ type Dirent struct {
Reclen uint16 Reclen uint16
Type uint8 Type uint8
Name [256]int8 Name [256]int8
Pad0 [5]byte Pad_godefs_0 [5]byte
} }
type RawSockaddrInet4 struct { type RawSockaddrInet4 struct {
...@@ -214,16 +215,21 @@ type Iovec struct { ...@@ -214,16 +215,21 @@ type Iovec struct {
Len uint64 Len uint64
} }
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct { type Msghdr struct {
Name *byte Name *byte
Namelen uint32 Namelen uint32
Pad0 [4]byte Pad_godefs_0 [4]byte
Iov *Iovec Iov *Iovec
Iovlen uint64 Iovlen uint64
Control *byte Control *byte
Controllen uint64 Controllen uint64
Flags int32 Flags int32
Pad1 [4]byte Pad_godefs_1 [4]byte
} }
type Cmsghdr struct { type Cmsghdr struct {
...@@ -290,12 +296,12 @@ type Sysinfo_t struct { ...@@ -290,12 +296,12 @@ type Sysinfo_t struct {
Freeswap uint64 Freeswap uint64
Procs uint16 Procs uint16
Pad uint16 Pad uint16
Pad0 [4]byte Pad_godefs_0 [4]byte
Totalhigh uint64 Totalhigh uint64
Freehigh uint64 Freehigh uint64
Unit uint32 Unit uint32
X_f [2]int8 X_f [0]int8
Pad1 [4]byte Pad_godefs_1 [4]byte
} }
type Utsname struct { type Utsname struct {
...@@ -309,11 +315,11 @@ type Utsname struct { ...@@ -309,11 +315,11 @@ type Utsname struct {
type Ustat_t struct { type Ustat_t struct {
Tfree int32 Tfree int32
Pad0 [4]byte Pad_godefs_0 [4]byte
Tinode uint64 Tinode uint64
Fname [6]int8 Fname [6]int8
Fpack [6]int8 Fpack [6]int8
Pad1 [4]byte Pad_godefs_1 [4]byte
} }
type EpollEvent struct { type EpollEvent struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment