зеркало из https://github.com/golang/sys.git
unix: add clock_gettime for Linux
Includes 386, amd64, and arm for Linux. Change-Id: I428bfb732141448659a94dc6e2ab7a98efea507a Reviewed-on: https://go-review.googlesource.com/9766 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: David Symonds <dsymonds@golang.org>
This commit is contained in:
Родитель
0a2b4af5eb
Коммит
f2654f8719
|
@ -218,6 +218,7 @@ includes='
|
|||
#include <sys/signal.h>
|
||||
#include <signal.h>
|
||||
#include <sys/resource.h>
|
||||
#include <time.h>
|
||||
'
|
||||
ccflags="$@"
|
||||
|
||||
|
@ -296,6 +297,7 @@ ccflags="$@"
|
|||
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||
$2 !~ /^(BPF_TIMEVAL)$/ &&
|
||||
$2 ~ /^(BPF|DLT)_/ ||
|
||||
$2 ~ /^CLOCK_/ ||
|
||||
$2 !~ "WMESGLEN" &&
|
||||
$2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||
$2 ~ /^__WCOREFLAG$/ {next}
|
||||
|
|
|
@ -795,6 +795,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||
//sys Chdir(path string) (err error)
|
||||
//sys Chmod(path string, mode uint32) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys Creat(path string, mode uint32) (fd int, err error)
|
||||
//sys Dup(oldfd int) (fd int, err error)
|
||||
|
@ -926,7 +927,6 @@ func Munmap(b []byte) (err error) {
|
|||
// Capget
|
||||
// Capset
|
||||
// ClockGetres
|
||||
// ClockGettime
|
||||
// ClockNanosleep
|
||||
// ClockSettime
|
||||
// Clone
|
||||
|
|
|
@ -186,6 +186,21 @@ const (
|
|||
BRKINT = 0x2
|
||||
CFLUSH = 0xf
|
||||
CLOCAL = 0x800
|
||||
CLOCK_BOOTTIME = 0x7
|
||||
CLOCK_BOOTTIME_ALARM = 0x9
|
||||
CLOCK_DEFAULT = 0x0
|
||||
CLOCK_EXT = 0x1
|
||||
CLOCK_INT = 0x2
|
||||
CLOCK_MONOTONIC = 0x1
|
||||
CLOCK_MONOTONIC_COARSE = 0x6
|
||||
CLOCK_MONOTONIC_RAW = 0x4
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_ALARM = 0x8
|
||||
CLOCK_REALTIME_COARSE = 0x5
|
||||
CLOCK_THREAD_CPUTIME_ID = 0x3
|
||||
CLOCK_TXFROMRX = 0x4
|
||||
CLOCK_TXINT = 0x3
|
||||
CLONE_CHILD_CLEARTID = 0x200000
|
||||
CLONE_CHILD_SETTID = 0x1000000
|
||||
CLONE_DETACHED = 0x400000
|
||||
|
|
|
@ -186,6 +186,21 @@ const (
|
|||
BRKINT = 0x2
|
||||
CFLUSH = 0xf
|
||||
CLOCAL = 0x800
|
||||
CLOCK_BOOTTIME = 0x7
|
||||
CLOCK_BOOTTIME_ALARM = 0x9
|
||||
CLOCK_DEFAULT = 0x0
|
||||
CLOCK_EXT = 0x1
|
||||
CLOCK_INT = 0x2
|
||||
CLOCK_MONOTONIC = 0x1
|
||||
CLOCK_MONOTONIC_COARSE = 0x6
|
||||
CLOCK_MONOTONIC_RAW = 0x4
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_ALARM = 0x8
|
||||
CLOCK_REALTIME_COARSE = 0x5
|
||||
CLOCK_THREAD_CPUTIME_ID = 0x3
|
||||
CLOCK_TXFROMRX = 0x4
|
||||
CLOCK_TXINT = 0x3
|
||||
CLONE_CHILD_CLEARTID = 0x200000
|
||||
CLONE_CHILD_SETTID = 0x1000000
|
||||
CLONE_DETACHED = 0x400000
|
||||
|
|
|
@ -148,6 +148,21 @@ const (
|
|||
BPF_TXA = 0x80
|
||||
BPF_W = 0x0
|
||||
BPF_X = 0x8
|
||||
CLOCK_BOOTTIME = 0x7
|
||||
CLOCK_BOOTTIME_ALARM = 0x9
|
||||
CLOCK_DEFAULT = 0x0
|
||||
CLOCK_EXT = 0x1
|
||||
CLOCK_INT = 0x2
|
||||
CLOCK_MONOTONIC = 0x1
|
||||
CLOCK_MONOTONIC_COARSE = 0x6
|
||||
CLOCK_MONOTONIC_RAW = 0x4
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_ALARM = 0x8
|
||||
CLOCK_REALTIME_COARSE = 0x5
|
||||
CLOCK_THREAD_CPUTIME_ID = 0x3
|
||||
CLOCK_TXFROMRX = 0x4
|
||||
CLOCK_TXINT = 0x3
|
||||
CLONE_CHILD_CLEARTID = 0x200000
|
||||
CLONE_CHILD_SETTID = 0x1000000
|
||||
CLONE_DETACHED = 0x400000
|
||||
|
|
|
@ -281,6 +281,16 @@ func Chroot(path string) (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ClockGettime(clockid int32, time *Timespec) (err error) {
|
||||
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Close(fd int) (err error) {
|
||||
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
|
||||
if e1 != 0 {
|
||||
|
|
|
@ -281,6 +281,16 @@ func Chroot(path string) (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ClockGettime(clockid int32, time *Timespec) (err error) {
|
||||
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Close(fd int) (err error) {
|
||||
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
|
||||
if e1 != 0 {
|
||||
|
|
|
@ -281,6 +281,16 @@ func Chroot(path string) (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ClockGettime(clockid int32, time *Timespec) (err error) {
|
||||
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Close(fd int) (err error) {
|
||||
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
|
||||
if e1 != 0 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче