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:
Damien Neil 2015-05-06 16:04:10 -07:00 коммит произвёл David Symonds
Родитель 0a2b4af5eb
Коммит f2654f8719
8 изменённых файлов: 78 добавлений и 1 удалений

Просмотреть файл

@ -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 {