code review 6445104: syscall: add linux specific Getsockopt for Ucred struct (issue 6445104)

54 views
Skip to first unread message

and...@ionisiert.de

unread,
Aug 11, 2012, 7:16:49 AM8/11/12
to golan...@googlegroups.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golan...@googlegroups.com (cc: golan...@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
syscall: add linux specific Getsockopt for Ucred struct

SO_PEERCRED on unix domain socket will fill a Ucred struct,
thus linux needs a custom Getsockopt variant.
Fixes issue 3836.

Please review this at http://codereview.appspot.com/6445104/

Affected files:
M src/pkg/syscall/syscall_linux.go


Index: src/pkg/syscall/syscall_linux.go
===================================================================
--- a/src/pkg/syscall/syscall_linux.go
+++ b/src/pkg/syscall/syscall_linux.go
@@ -477,6 +477,13 @@
return &value, err
}

+func GetsockoptUcred(fd, level, opt int) (*Ucred, error) {
+ var value Ucred
+ vallen := _Socklen(SizeofUcred)
+ err := getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value)),
&vallen)
+ return &value, err
+}
+
func SetsockoptInt(fd, level, opt int, value int) (err error) {
var n = int32(value)
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)


Russ Cox

unread,
Sep 10, 2012, 8:53:03 PM9/10/12
to and...@ionisiert.de, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
LGTM

Please complete a CLA as described at
http://golang.org/doc/contribute.html#copyright.

Thanks.
Russ

Andreas Jellinghaus

unread,
Sep 11, 2012, 2:58:55 PM9/11/12
to Russ Cox, re...@codereview-hr.appspotmail.com, golan...@googlegroups.com

Thanks. No need for CLA - do I need to resubmit this as a...@google.com?

Thanks.

Andreas

Am 11.09.2012 02:53 schrieb "Russ Cox" <r...@golang.org>:

Ian Lance Taylor

unread,
Sep 11, 2012, 4:16:20 PM9/11/12
to Andreas Jellinghaus, Russ Cox, re...@codereview-hr.appspotmail.com, golan...@googlegroups.com
On Tue, Sep 11, 2012 at 11:58 AM, Andreas Jellinghaus
<and...@ionisiert.de> wrote:
> Thanks. No need for CLA - do I need to resubmit this as a...@google.com?

it's not necessary.

Ian

ia...@golang.org

unread,
Sep 12, 2012, 9:38:37 AM9/12/12
to and...@ionisiert.de, golan...@googlegroups.com, r...@golang.org, ia...@google.com, re...@codereview-hr.appspotmail.com
*** Submitted as
http://code.google.com/p/go/source/detail?r=efd8fcc055aa ***

syscall: add linux specific Getsockopt for Ucred struct

SO_PEERCRED on unix domain socket will fill a Ucred struct,
thus linux needs a custom Getsockopt variant.
Fixes issue 3836.

R=golang-dev, rsc, iant
CC=golang-dev
http://codereview.appspot.com/6445104

Committer: Ian Lance Taylor <ia...@golang.org>


http://codereview.appspot.com/6445104/
Reply all
Reply to author
Forward
0 new messages