mirror of
https://github.com/golang/sys.git
synced 2026-02-08 19:56:04 +03:00
unix: add Sysconf on solaris
This wraps sysconf(3) on solaris. Change-Id: Ie5dd32bfa98bf900cadce6f20cefd553fdf80e29 Reviewed-on: https://go-review.googlesource.com/c/sys/+/286593 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
1d4d2d3355
commit
21e18009e2
@@ -682,6 +682,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||
//sys Statvfs(path string, vfsstat *Statvfs_t) (err error)
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Sync() (err error)
|
||||
//sys Sysconf(which int) (n int64, err error)
|
||||
//sysnb Times(tms *Tms) (ticks uintptr, err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
|
||||
@@ -74,3 +74,11 @@ func TestStatvfs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSysconf(t *testing.T) {
|
||||
n, err := unix.Sysconf(3 /* SC_CLK_TCK */)
|
||||
if err != nil {
|
||||
t.Fatalf("Sysconf: %v", err)
|
||||
}
|
||||
t.Logf("Sysconf(SC_CLK_TCK) = %d", n)
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ import (
|
||||
//go:cgo_import_dynamic libc_statvfs statvfs "libc.so"
|
||||
//go:cgo_import_dynamic libc_symlink symlink "libc.so"
|
||||
//go:cgo_import_dynamic libc_sync sync "libc.so"
|
||||
//go:cgo_import_dynamic libc_sysconf sysconf "libc.so"
|
||||
//go:cgo_import_dynamic libc_times times "libc.so"
|
||||
//go:cgo_import_dynamic libc_truncate truncate "libc.so"
|
||||
//go:cgo_import_dynamic libc_fsync fsync "libc.so"
|
||||
@@ -245,6 +246,7 @@ import (
|
||||
//go:linkname procStatvfs libc_statvfs
|
||||
//go:linkname procSymlink libc_symlink
|
||||
//go:linkname procSync libc_sync
|
||||
//go:linkname procSysconf libc_sysconf
|
||||
//go:linkname procTimes libc_times
|
||||
//go:linkname procTruncate libc_truncate
|
||||
//go:linkname procFsync libc_fsync
|
||||
@@ -376,6 +378,7 @@ var (
|
||||
procStatvfs,
|
||||
procSymlink,
|
||||
procSync,
|
||||
procSysconf,
|
||||
procTimes,
|
||||
procTruncate,
|
||||
procFsync,
|
||||
@@ -1687,6 +1690,17 @@ func Sync() (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Sysconf(which int) (n int64, err error) {
|
||||
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSysconf)), 1, uintptr(which), 0, 0, 0, 0, 0)
|
||||
n = int64(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Times(tms *Tms) (ticks uintptr, err error) {
|
||||
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0)
|
||||
ticks = uintptr(r0)
|
||||
|
||||
Reference in New Issue
Block a user