go getentropy_openbsd 源码

  • 2022-07-15
  • 浏览 (904)

golang getentropy_openbsd 代码

文件路径:/src/internal/syscall/unix/getentropy_openbsd.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 (
	"syscall"
	"unsafe"
)

// getentropy(2)'s syscall number, from /usr/src/sys/kern/syscalls.master
const entropyTrap uintptr = 7

// GetEntropy calls the OpenBSD getentropy system call.
func GetEntropy(p []byte) error {
	_, _, errno := syscall.Syscall(entropyTrap,
		uintptr(unsafe.Pointer(&p[0])),
		uintptr(len(p)),
		0)
	if errno != 0 {
		return errno
	}
	return nil
}

相关信息

go 源码目录

相关文章

go at 源码

go at_aix 源码

go at_darwin 源码

go at_freebsd 源码

go at_fstatat 源码

go at_libc 源码

go at_solaris 源码

go at_statx 源码

go at_sysnum_darwin 源码

go at_sysnum_dragonfly 源码

0  赞