// Copyright 2021 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.

//go:build dragonfly || freebsd || linux

package unix

import (
	
	
	
)

var getrandomUnsupported atomic.Bool

// GetRandomFlag is a flag supported by the getrandom system call.
type GetRandomFlag uintptr

// GetRandom calls the getrandom system call.
func ( []byte,  GetRandomFlag) ( int,  error) {
	if len() == 0 {
		return 0, nil
	}
	if getrandomUnsupported.Load() {
		return 0, syscall.ENOSYS
	}
	, ,  := syscall.Syscall(getrandomTrap,
		uintptr(unsafe.Pointer(&[0])),
		uintptr(len()),
		uintptr())
	if  != 0 {
		if  == syscall.ENOSYS {
			getrandomUnsupported.Store(true)
		}
		return 0, 
	}
	return int(), nil
}