소스 검색

unix: add ClockGettime on darwin/amd64

Updates golang/go#25633

Change-Id: I20ff2d0cda642fb7b155d3ae06499e8c0ef0a2b2
Reviewed-on: https://go-review.googlesource.com/c/161721
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Josh Bleecher Snyder 6 년 전
부모
커밋
3b52091055
3개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      unix/syscall_darwin.go
  2. 15 0
      unix/zsyscall_darwin_amd64.go
  3. 2 0
      unix/zsyscall_darwin_amd64.s

+ 1 - 0
unix/syscall_darwin.go

@@ -416,6 +416,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 //sys	Chmod(path string, mode uint32) (err error)
 //sys	Chown(path string, uid int, gid int) (err error)
 //sys	Chroot(path string) (err error)
+//sys	ClockGettime(clockid int32, time *Timespec) (err error)
 //sys	Close(fd int) (err error)
 //sys	Dup(fd int) (nfd int, err error)
 //sys	Dup2(from int, to int) (err error)

+ 15 - 0
unix/zsyscall_darwin_amd64.go

@@ -943,6 +943,21 @@ func libc_chroot_trampoline()
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func ClockGettime(clockid int32, time *Timespec) (err error) {
+	_, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
+	if e1 != 0 {
+		err = errnoErr(e1)
+	}
+	return
+}
+
+func libc_clock_gettime_trampoline()
+
+//go:linkname libc_clock_gettime libc_clock_gettime
+//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Close(fd int) (err error) {
 	_, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0)
 	if e1 != 0 {

+ 2 - 0
unix/zsyscall_darwin_amd64.s

@@ -108,6 +108,8 @@ TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_chown(SB)
 TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_chroot(SB)
+TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0
+	JMP	libc_clock_gettime(SB)
 TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
 	JMP	libc_close(SB)
 TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0