Commit 76cc09b6 authored by Joe Richey's avatar Joe Richey Committed by Ian Lance Taylor

unix: add Getrandom syscall bindings and flags

This CL introduces the Getrandom syscall. Allowing users of
sufficiently new kernels (3.17) to detect when the operating system
lacks enough entropy to generate cryptographic random data. See:
http://man7.org/linux/man-pages/man2/getrandom.2.html

As we have updated the syscall numbers, the Getrandom function can
just be generated normally. The only other change is to mkerrors.sh
to include the GRND_* flags for getrandom from <linux/random.h>.

It is important to note that currently the mkerrors.sh script cannot
actually be run as it has fallen behind the 4.10 kernel. The GRND_*
flags were added manually.

This was originally part of a larger commit that was split up.
See CL: https://go-review.googlesource.com/37570

Change-Id: I464088a9c9f7224abdcdae476b30a4f2f412d9f5
Reviewed-on: https://go-review.googlesource.com/37589Reviewed-by: 's avatarMatt Layher <mdlayher@gmail.com>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 21f2569f
...@@ -123,6 +123,7 @@ includes_Linux=' ...@@ -123,6 +123,7 @@ includes_Linux='
#include <linux/falloc.h> #include <linux/falloc.h>
#include <linux/filter.h> #include <linux/filter.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/random.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
...@@ -349,6 +350,7 @@ ccflags="$@" ...@@ -349,6 +350,7 @@ ccflags="$@"
$2 ~ /^CLOCK_/ || $2 ~ /^CLOCK_/ ||
$2 ~ /^CAN_/ || $2 ~ /^CAN_/ ||
$2 ~ /^ALG_/ || $2 ~ /^ALG_/ ||
$2 ~ /^GRND_/ ||
$2 ~ /^SPLICE_/ || $2 ~ /^SPLICE_/ ||
$2 !~ "WMESGLEN" && $2 !~ "WMESGLEN" &&
$2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)}
......
...@@ -1038,6 +1038,7 @@ func Getpgrp() (pid int) { ...@@ -1038,6 +1038,7 @@ func Getpgrp() (pid int) {
//sysnb Getpid() (pid int) //sysnb Getpid() (pid int)
//sysnb Getppid() (ppid int) //sysnb Getppid() (ppid int)
//sys Getpriority(which int, who int) (prio int, err error) //sys Getpriority(which int, who int) (prio int, err error)
//sys Getrandom(buf []byte, flags int) (n int, err error)
//sysnb Getrusage(who int, rusage *Rusage) (err error) //sysnb Getrusage(who int, rusage *Rusage) (err error)
//sysnb Getsid(pid int) (sid int, err error) //sysnb Getsid(pid int) (sid int, err error)
//sysnb Gettid() (tid int) //sysnb Gettid() (tid int)
......
...@@ -437,6 +437,8 @@ const ( ...@@ -437,6 +437,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x2 ICANON = 0x2
......
...@@ -437,6 +437,8 @@ const ( ...@@ -437,6 +437,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x2 ICANON = 0x2
......
...@@ -422,6 +422,8 @@ const ( ...@@ -422,6 +422,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x2 ICANON = 0x2
......
...@@ -451,6 +451,8 @@ const ( ...@@ -451,6 +451,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x2 ICANON = 0x2
......
...@@ -427,6 +427,8 @@ const ( ...@@ -427,6 +427,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x2 ICANON = 0x2
......
...@@ -426,6 +426,8 @@ const ( ...@@ -426,6 +426,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
ICANON = 0x2 ICANON = 0x2
ICMPV6_FILTER = 0x1 ICMPV6_FILTER = 0x1
......
...@@ -426,6 +426,8 @@ const ( ...@@ -426,6 +426,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
ICANON = 0x2 ICANON = 0x2
ICMPV6_FILTER = 0x1 ICMPV6_FILTER = 0x1
......
...@@ -466,6 +466,8 @@ const ( ...@@ -466,6 +466,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x2 ICANON = 0x2
......
...@@ -456,6 +456,8 @@ const ( ...@@ -456,6 +456,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x4000 HUPCL = 0x4000
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x100 ICANON = 0x100
......
...@@ -449,6 +449,8 @@ const ( ...@@ -449,6 +449,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x4000 HUPCL = 0x4000
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x100 ICANON = 0x100
......
...@@ -462,6 +462,8 @@ const ( ...@@ -462,6 +462,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x2 ICANON = 0x2
......
...@@ -470,6 +470,8 @@ const ( ...@@ -470,6 +470,8 @@ const (
F_ULOCK = 0x0 F_ULOCK = 0x0
F_UNLCK = 0x3 F_UNLCK = 0x3
F_WRLCK = 0x2 F_WRLCK = 0x2
GRND_NONBLOCK = 0x1
GRND_RANDOM = 0x2
HUPCL = 0x400 HUPCL = 0x400
IBSHIFT = 0x10 IBSHIFT = 0x10
ICANON = 0x2 ICANON = 0x2
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
// mksyscall.pl syscall_linux.go syscall_linux_sparc64.go // mksyscall.pl -tags linux,sparc64 syscall_linux.go syscall_linux_sparc64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// +build // +build linux,sparc64
package unix package unix
...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) { ...@@ -543,6 +543,23 @@ func Getpriority(which int, who int) (prio int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment