1
0
mirror of https://github.com/golang/go synced 2024-11-21 18:44:45 -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))
}
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) {
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))
}
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) {
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 struct linger $Linger;
typedef struct iovec $Iovec;
typedef struct ip_mreq $IpMreq;
typedef struct msghdr $Msghdr;
typedef struct cmsghdr $Cmsghdr;
@ -113,6 +114,7 @@ enum {
$SizeofSockaddrAny = sizeof(struct sockaddr_any),
$SizeofSockaddrUnix = sizeof(struct sockaddr_un),
$SizeofLinger = sizeof(struct linger),
$SizeofIpMreq = sizeof(struct ip_mreq),
$SizeofMsghdr = sizeof(struct msghdr),
$SizeofCmsghdr = sizeof(struct cmsghdr),
};

View File

@ -116,6 +116,7 @@ typedef struct sockaddr_any $RawSockaddrAny;
typedef socklen_t $_Socklen;
typedef struct linger $Linger;
typedef struct iovec $Iovec;
typedef struct ip_mreq $IpMreq;
typedef struct msghdr $Msghdr;
typedef struct cmsghdr $Cmsghdr;
@ -125,6 +126,7 @@ enum {
$SizeofSockaddrAny = sizeof(struct sockaddr_any),
$SizeofSockaddrUnix = sizeof(struct sockaddr_un),
$SizeofLinger = sizeof(struct linger),
$SizeofIpMreq = sizeof(struct ip_mreq),
$SizeofMsghdr = sizeof(struct msghdr),
$SizeofCmsghdr = sizeof(struct cmsghdr),
};

View File

@ -109,6 +109,7 @@ typedef struct sockaddr_any $RawSockaddrAny;
typedef socklen_t $_Socklen;
typedef struct linger $Linger;
typedef struct iovec $Iovec;
typedef struct ip_mreq $IpMreq;
typedef struct msghdr $Msghdr;
typedef struct cmsghdr $Cmsghdr;
typedef struct ucred $Ucred;
@ -120,6 +121,7 @@ enum {
$SizeofSockaddrUnix = sizeof(struct sockaddr_un),
$SizeofSockaddrLinklayer = sizeof(struct sockaddr_ll),
$SizeofLinger = sizeof(struct linger),
$SizeofIpMreq = sizeof(struct ip_mreq),
$SizeofMsghdr = sizeof(struct msghdr),
$SizeofCmsghdr = sizeof(struct cmsghdr),
$SizeofUcred = sizeof(struct ucred),

View File

@ -17,6 +17,7 @@ const (
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
PTRACE_TRACEME = 0
@ -144,13 +145,13 @@ type Log2phys_t struct {
}
type Dirent struct {
Ino uint64
Seekoff uint64
Reclen uint16
Namlen uint16
Type uint8
Name [1024]int8
Pad0 [3]byte
Ino uint64
Seekoff uint64
Reclen uint16
Namlen uint16
Type uint8
Name [1024]int8
Pad_godefs_0 [3]byte
}
type RawSockaddrInet4 struct {
@ -199,6 +200,11 @@ type Iovec struct {
Len uint32
}
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct {
Name *byte
Namelen uint32

View File

@ -17,6 +17,7 @@ const (
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x30
SizeofCmsghdr = 0xc
PTRACE_TRACEME = 0
@ -40,9 +41,9 @@ type Timespec struct {
}
type Timeval struct {
Sec int64
Usec int32
Pad0 [4]byte
Sec int64
Usec int32
Pad_godefs_0 [4]byte
}
type Rusage struct {
@ -79,7 +80,7 @@ type Stat_t struct {
Uid uint32
Gid uint32
Rdev int32
Pad0 [4]byte
Pad_godefs_0 [4]byte
Atimespec Timespec
Mtimespec Timespec
Ctimespec Timespec
@ -129,9 +130,9 @@ type Fstore_t struct {
}
type Radvisory_t struct {
Offset int64
Count int32
Pad0 [4]byte
Offset int64
Count int32
Pad_godefs_0 [4]byte
}
type Fbootstraptransfer_t struct {
@ -147,13 +148,13 @@ type Log2phys_t struct {
}
type Dirent struct {
Ino uint64
Seekoff uint64
Reclen uint16
Namlen uint16
Type uint8
Name [1024]int8
Pad0 [3]byte
Ino uint64
Seekoff uint64
Reclen uint16
Namlen uint16
Type uint8
Name [1024]int8
Pad_godefs_0 [3]byte
}
type RawSockaddrInet4 struct {
@ -202,16 +203,21 @@ type Iovec struct {
Len uint64
}
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct {
Name *byte
Namelen uint32
Pad0 [4]byte
Iov *Iovec
Iovlen int32
Pad1 [4]byte
Control *byte
Controllen uint32
Flags int32
Name *byte
Namelen uint32
Pad_godefs_0 [4]byte
Iov *Iovec
Iovlen int32
Pad_godefs_1 [4]byte
Control *byte
Controllen uint32
Flags int32
}
type Cmsghdr struct {

View File

@ -31,6 +31,7 @@ const (
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
PTRACE_TRACEME = 0
@ -102,8 +103,8 @@ type Stat_t struct {
Gen uint32
Lspare int32
Birthtimespec Timespec
Pad0 uint32
Pad1 uint32
Pad_godefs_0 uint32
Pad_godefs_1 uint32
}
type Statfs_t struct {
@ -194,6 +195,11 @@ type Iovec struct {
Len uint32
}
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct {
Name *byte
Namelen uint32

View File

@ -31,6 +31,7 @@ const (
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x30
SizeofCmsghdr = 0xc
PTRACE_TRACEME = 0
@ -102,8 +103,8 @@ type Stat_t struct {
Gen uint32
Lspare int32
Birthtimespec Timespec
Pad0 uint8
Pad1 uint8
Pad_godefs_0 uint8
Pad_godefs_1 uint8
}
type Statfs_t struct {
@ -132,13 +133,13 @@ type Statfs_t struct {
}
type Flock_t struct {
Start int64
Len int64
Pid int32
Type int16
Whence int16
Sysid int32
Pad0 [4]byte
Start int64
Len int64
Pid int32
Type int16
Whence int16
Sysid int32
Pad_godefs_0 [4]byte
}
type Dirent struct {
@ -195,16 +196,21 @@ type Iovec struct {
Len uint64
}
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct {
Name *byte
Namelen uint32
Pad0 [4]byte
Iov *Iovec
Iovlen int32
Pad1 [4]byte
Control *byte
Controllen uint32
Flags int32
Name *byte
Namelen uint32
Pad_godefs_0 [4]byte
Iov *Iovec
Iovlen int32
Pad_godefs_1 [4]byte
Control *byte
Controllen uint32
Flags int32
}
type Cmsghdr struct {

View File

@ -18,6 +18,7 @@ const (
SizeofSockaddrUnix = 0x6e
SizeofSockaddrLinklayer = 0x14
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofUcred = 0xc
@ -45,37 +46,37 @@ type Timeval struct {
}
type Timex struct {
Modes uint32
Offset int32
Freq int32
Maxerror int32
Esterror int32
Status int32
Constant int32
Precision int32
Tolerance int32
Time Timeval
Tick int32
Ppsfreq int32
Jitter int32
Shift int32
Stabil int32
Jitcnt int32
Calcnt int32
Errcnt int32
Stbcnt int32
Tai int32
Pad0 int32
Pad1 int32
Pad2 int32
Pad3 int32
Pad4 int32
Pad5 int32
Pad6 int32
Pad7 int32
Pad8 int32
Pad9 int32
Pad10 int32
Modes uint32
Offset int32
Freq int32
Maxerror int32
Esterror int32
Status int32
Constant int32
Precision int32
Tolerance int32
Time Timeval
Tick int32
Ppsfreq int32
Jitter int32
Shift int32
Stabil int32
Jitcnt int32
Calcnt int32
Errcnt int32
Stbcnt int32
Tai int32
Pad_godefs_0 int32
Pad_godefs_1 int32
Pad_godefs_2 int32
Pad_godefs_3 int32
Pad_godefs_4 int32
Pad_godefs_5 int32
Pad_godefs_6 int32
Pad_godefs_7 int32
Pad_godefs_8 int32
Pad_godefs_9 int32
Pad_godefs_10 int32
}
type Time_t int32
@ -119,24 +120,24 @@ type Rlimit struct {
type _Gid_t uint32
type Stat_t struct {
Dev uint64
X__pad1 uint16
Pad0 [2]byte
X__st_ino uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint64
X__pad2 uint16
Pad1 [2]byte
Size int64
Blksize int32
Blocks int64
Atim Timespec
Mtim Timespec
Ctim Timespec
Ino uint64
Dev uint64
X__pad1 uint16
Pad_godefs_0 [2]byte
X__st_ino uint32
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint64
X__pad2 uint16
Pad_godefs_1 [2]byte
Size int64
Blksize int32
Blocks int64
Atim Timespec
Mtim Timespec
Ctim Timespec
Ino uint64
}
type Statfs_t struct {
@ -154,12 +155,12 @@ type Statfs_t struct {
}
type Dirent struct {
Ino uint64
Off int64
Reclen uint16
Type uint8
Name [256]int8
Pad0 [1]byte
Ino uint64
Off int64
Reclen uint16
Type uint8
Name [256]int8
Pad_godefs_0 [1]byte
}
type RawSockaddrInet4 struct {
@ -214,6 +215,11 @@ type Iovec struct {
Len uint32
}
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct {
Name *byte
Namelen uint32

View File

@ -18,6 +18,7 @@ const (
SizeofSockaddrUnix = 0x6e
SizeofSockaddrLinklayer = 0x14
SizeofLinger = 0x8
SizeofIpMreq = 0x8
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofUcred = 0xc
@ -45,40 +46,40 @@ type Timeval struct {
}
type Timex struct {
Modes uint32
Pad0 [4]byte
Offset int64
Freq int64
Maxerror int64
Esterror int64
Status int32
Pad1 [4]byte
Constant int64
Precision int64
Tolerance int64
Time Timeval
Tick int64
Ppsfreq int64
Jitter int64
Shift int32
Pad2 [4]byte
Stabil int64
Jitcnt int64
Calcnt int64
Errcnt int64
Stbcnt int64
Tai int32
Pad3 int32
Pad4 int32
Pad5 int32
Pad6 int32
Pad7 int32
Pad8 int32
Pad9 int32
Pad10 int32
Pad11 int32
Pad12 int32
Pad13 int32
Modes uint32
Pad_godefs_0 [4]byte
Offset int64
Freq int64
Maxerror int64
Esterror int64
Status int32
Pad_godefs_1 [4]byte
Constant int64
Precision int64
Tolerance int64
Time Timeval
Tick int64
Ppsfreq int64
Jitter int64
Shift int32
Pad_godefs_2 [4]byte
Stabil int64
Jitcnt int64
Calcnt int64
Errcnt int64
Stbcnt int64
Tai int32
Pad_godefs_3 int32
Pad_godefs_4 int32
Pad_godefs_5 int32
Pad_godefs_6 int32
Pad_godefs_7 int32
Pad_godefs_8 int32
Pad_godefs_9 int32
Pad_godefs_10 int32
Pad_godefs_11 int32
Pad_godefs_12 int32
Pad_godefs_13 int32
}
type Time_t int64
@ -154,12 +155,12 @@ type Statfs_t struct {
}
type Dirent struct {
Ino uint64
Off int64
Reclen uint16
Type uint8
Name [256]int8
Pad0 [5]byte
Ino uint64
Off int64
Reclen uint16
Type uint8
Name [256]int8
Pad_godefs_0 [5]byte
}
type RawSockaddrInet4 struct {
@ -214,16 +215,21 @@ type Iovec struct {
Len uint64
}
type IpMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type Msghdr struct {
Name *byte
Namelen uint32
Pad0 [4]byte
Iov *Iovec
Iovlen uint64
Control *byte
Controllen uint64
Flags int32
Pad1 [4]byte
Name *byte
Namelen uint32
Pad_godefs_0 [4]byte
Iov *Iovec
Iovlen uint64
Control *byte
Controllen uint64
Flags int32
Pad_godefs_1 [4]byte
}
type Cmsghdr struct {
@ -280,22 +286,22 @@ type FdSet struct {
}
type Sysinfo_t struct {
Uptime int64
Loads [3]uint64
Totalram uint64
Freeram uint64
Sharedram uint64
Bufferram uint64
Totalswap uint64
Freeswap uint64
Procs uint16
Pad uint16
Pad0 [4]byte
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [2]int8
Pad1 [4]byte
Uptime int64
Loads [3]uint64
Totalram uint64
Freeram uint64
Sharedram uint64
Bufferram uint64
Totalswap uint64
Freeswap uint64
Procs uint16
Pad uint16
Pad_godefs_0 [4]byte
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [0]int8
Pad_godefs_1 [4]byte
}
type Utsname struct {
@ -308,12 +314,12 @@ type Utsname struct {
}
type Ustat_t struct {
Tfree int32
Pad0 [4]byte
Tinode uint64
Fname [6]int8
Fpack [6]int8
Pad1 [4]byte
Tfree int32
Pad_godefs_0 [4]byte
Tinode uint64
Fname [6]int8
Fpack [6]int8
Pad_godefs_1 [4]byte
}
type EpollEvent struct {