1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:14:40 -07:00

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
This commit is contained in:
Dave Cheney 2011-02-03 14:15:35 -05:00 committed by Russ Cox
parent 33cf883440
commit eff1952873
11 changed files with 226 additions and 176 deletions

View File

@ -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))
} }

View File

@ -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))
} }

View File

@ -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 {
$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),
}; };

View File

@ -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 {
$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),
}; };

View File

@ -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 {
$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),

View File

@ -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
@ -144,13 +145,13 @@ type Log2phys_t struct {
} }
type Dirent struct { type Dirent struct {
Ino uint64 Ino uint64
Seekoff uint64 Seekoff uint64
Reclen uint16 Reclen uint16
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 {
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

View File

@ -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
@ -40,9 +41,9 @@ 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 {
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
@ -129,9 +130,9 @@ 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 {
@ -147,13 +148,13 @@ type Log2phys_t struct {
} }
type Dirent struct { type Dirent struct {
Ino uint64 Ino uint64
Seekoff uint64 Seekoff uint64
Reclen uint16 Reclen uint16
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,16 +203,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 int32 Iovlen int32
Pad1 [4]byte Pad_godefs_1 [4]byte
Control *byte Control *byte
Controllen uint32 Controllen uint32
Flags int32 Flags int32
} }
type Cmsghdr struct { type Cmsghdr struct {

View File

@ -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 {
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 {
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

View File

@ -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 {
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 {
@ -132,13 +133,13 @@ type Statfs_t struct {
} }
type Flock_t struct { type Flock_t struct {
Start int64 Start int64
Len int64 Len int64
Pid int32 Pid int32
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,16 +196,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 int32 Iovlen int32
Pad1 [4]byte Pad_godefs_1 [4]byte
Control *byte Control *byte
Controllen uint32 Controllen uint32
Flags int32 Flags int32
} }
type Cmsghdr struct { type Cmsghdr struct {

View File

@ -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
@ -45,37 +46,37 @@ type Timeval struct {
} }
type Timex struct { type Timex struct {
Modes uint32 Modes uint32
Offset int32 Offset int32
Freq int32 Freq int32
Maxerror int32 Maxerror int32
Esterror int32 Esterror int32
Status int32 Status int32
Constant int32 Constant int32
Precision int32 Precision int32
Tolerance int32 Tolerance int32
Time Timeval Time Timeval
Tick int32 Tick int32
Ppsfreq int32 Ppsfreq int32
Jitter int32 Jitter int32
Shift int32 Shift int32
Stabil int32 Stabil int32
Jitcnt int32 Jitcnt int32
Calcnt int32 Calcnt int32
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
@ -119,24 +120,24 @@ type Rlimit struct {
type _Gid_t uint32 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
Uid uint32 Uid uint32
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
Atim Timespec Atim Timespec
Mtim Timespec Mtim Timespec
Ctim Timespec Ctim Timespec
Ino uint64 Ino uint64
} }
type Statfs_t struct { type Statfs_t struct {
@ -154,12 +155,12 @@ type Statfs_t struct {
} }
type Dirent struct { type Dirent struct {
Ino uint64 Ino uint64
Off int64 Off int64
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 {
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

View File

@ -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
@ -45,40 +46,40 @@ 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
Time Timeval Time Timeval
Tick int64 Tick int64
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
@ -154,12 +155,12 @@ type Statfs_t struct {
} }
type Dirent struct { type Dirent struct {
Ino uint64 Ino uint64
Off int64 Off int64
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 {
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 {
@ -280,22 +286,22 @@ type FdSet struct {
} }
type Sysinfo_t struct { type Sysinfo_t struct {
Uptime int64 Uptime int64
Loads [3]uint64 Loads [3]uint64
Totalram uint64 Totalram uint64
Freeram uint64 Freeram uint64
Sharedram uint64 Sharedram uint64
Bufferram uint64 Bufferram uint64
Totalswap uint64 Totalswap uint64
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 {
@ -308,12 +314,12 @@ 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 {