git » go-net » unix-separados » tree

[unix-separados] / unix / sys_linux.go

// Copyright 2016 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package unix

import (
	"unsafe"

	"golang.org/x/net/internal/netsyscall"
)

func getSockoptUcred(fd uintptr, level, opt int) (*ucred, error) {
	var value ucred
	vallen := uint32(sizeofUcred)
	err := netsyscall.Getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
	return &value, err
}