mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 16:47:27 -04:00
unix: add Major, Minor and Mkdev functions on Solaris
Add Major, Minor and Mkdev functions for converting device numbers to their major/minor components and vice versa. Use the respective functions provided by the Solaris libc instead of reimplementing them. Test the conversion function with some well-known static device numbers for devices which should be present on any Solaris system. Re-generated files on OpenIndiana Hipster 2017.04 (SunOS 5.11) which also added some previously missing error constants. Change-Id: Ief9ea973d91c24956571eb8fafc8a4525b0f5b90 Reviewed-on: https://go-review.googlesource.com/64390 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Ian Lance Taylor
parent
b8ca6dd53d
commit
1f337fdb7f
@@ -25,6 +25,9 @@ import (
|
||||
//go:cgo_import_dynamic libc___xnet_recvmsg __xnet_recvmsg "libsocket.so"
|
||||
//go:cgo_import_dynamic libc___xnet_sendmsg __xnet_sendmsg "libsocket.so"
|
||||
//go:cgo_import_dynamic libc_acct acct "libc.so"
|
||||
//go:cgo_import_dynamic libc___makedev __makedev "libc.so"
|
||||
//go:cgo_import_dynamic libc___major __major "libc.so"
|
||||
//go:cgo_import_dynamic libc___minor __minor "libc.so"
|
||||
//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
|
||||
//go:cgo_import_dynamic libc_access access "libc.so"
|
||||
//go:cgo_import_dynamic libc_adjtime adjtime "libc.so"
|
||||
@@ -146,6 +149,9 @@ import (
|
||||
//go:linkname proc__xnet_recvmsg libc___xnet_recvmsg
|
||||
//go:linkname proc__xnet_sendmsg libc___xnet_sendmsg
|
||||
//go:linkname procacct libc_acct
|
||||
//go:linkname proc__makedev libc___makedev
|
||||
//go:linkname proc__major libc___major
|
||||
//go:linkname proc__minor libc___minor
|
||||
//go:linkname procioctl libc_ioctl
|
||||
//go:linkname procAccess libc_access
|
||||
//go:linkname procAdjtime libc_adjtime
|
||||
@@ -268,6 +274,9 @@ var (
|
||||
proc__xnet_recvmsg,
|
||||
proc__xnet_sendmsg,
|
||||
procacct,
|
||||
proc__makedev,
|
||||
proc__major,
|
||||
proc__minor,
|
||||
procioctl,
|
||||
procAccess,
|
||||
procAdjtime,
|
||||
@@ -522,6 +531,24 @@ func acct(path *byte) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func __makedev(version int, major uint, minor uint) (val uint64) {
|
||||
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__makedev)), 3, uintptr(version), uintptr(major), uintptr(minor), 0, 0, 0)
|
||||
val = uint64(r0)
|
||||
return
|
||||
}
|
||||
|
||||
func __major(version int, dev uint64) (val uint) {
|
||||
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__major)), 2, uintptr(version), uintptr(dev), 0, 0, 0, 0)
|
||||
val = uint(r0)
|
||||
return
|
||||
}
|
||||
|
||||
func __minor(version int, dev uint64) (val uint) {
|
||||
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&proc__minor)), 2, uintptr(version), uintptr(dev), 0, 0, 0, 0)
|
||||
val = uint(r0)
|
||||
return
|
||||
}
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0)
|
||||
if e1 != 0 {
|
||||
|
||||
Reference in New Issue
Block a user