syscall: add ucred structure for SCM_CREDENTIALS over UNIX sockets.

Working on issue 1101.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/2338042
This commit is contained in:
Albert Strasheim 2010-10-06 21:32:31 +11:00 committed by Andrew Gerrand
parent c276ce98c2
commit 8b905489ab
3 changed files with 16 additions and 0 deletions

2
src/pkg/syscall/types_linux.c Normal file → Executable file
View file

@ -108,6 +108,7 @@ typedef struct linger $Linger;
typedef struct iovec $Iovec; typedef struct iovec $Iovec;
typedef struct msghdr $Msghdr; typedef struct msghdr $Msghdr;
typedef struct cmsghdr $Cmsghdr; typedef struct cmsghdr $Cmsghdr;
typedef struct ucred $Ucred;
enum { enum {
$SizeofSockaddrInet4 = sizeof(struct sockaddr_in), $SizeofSockaddrInet4 = sizeof(struct sockaddr_in),
@ -117,6 +118,7 @@ enum {
$SizeofLinger = sizeof(struct linger), $SizeofLinger = sizeof(struct linger),
$SizeofMsghdr = sizeof(struct msghdr), $SizeofMsghdr = sizeof(struct msghdr),
$SizeofCmsghdr = sizeof(struct cmsghdr), $SizeofCmsghdr = sizeof(struct cmsghdr),
$SizeofUcred = sizeof(struct ucred),
}; };

View file

@ -19,6 +19,7 @@ const (
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofMsghdr = 0x1c SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc SizeofCmsghdr = 0xc
SizeofUcred = 0xc
SizeofInotifyEvent = 0x10 SizeofInotifyEvent = 0x10
) )
@ -218,6 +219,12 @@ type Cmsghdr struct {
Type int32 Type int32
} }
type Ucred struct {
Pid int32
Uid uint32
Gid uint32
}
type InotifyEvent struct { type InotifyEvent struct {
Wd int32 Wd int32
Mask uint32 Mask uint32

View file

@ -19,6 +19,7 @@ const (
SizeofLinger = 0x8 SizeofLinger = 0x8
SizeofMsghdr = 0x38 SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10 SizeofCmsghdr = 0x10
SizeofUcred = 0xc
SizeofInotifyEvent = 0x10 SizeofInotifyEvent = 0x10
) )
@ -220,6 +221,12 @@ type Cmsghdr struct {
Type int32 Type int32
} }
type Ucred struct {
Pid int32
Uid uint32
Gid uint32
}
type InotifyEvent struct { type InotifyEvent struct {
Wd int32 Wd int32
Mask uint32 Mask uint32