mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 16:47:27 -04:00
go.sys/unix: use "use" in syscall interface
LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/144980043
This commit is contained in:
@@ -3,14 +3,11 @@
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
import "unsafe"
|
||||
|
||||
var (
|
||||
modlibc = newLazySO("libc.so")
|
||||
modlibsocket = newLazySO("libsocket.so")
|
||||
modlibc = syscall.newLazySO("libc.so")
|
||||
modlibsocket = syscall.newLazySO("libsocket.so")
|
||||
|
||||
procgetgroups = modlibc.NewProc("getgroups")
|
||||
procsetgroups = modlibc.NewProc("setgroups")
|
||||
@@ -145,6 +142,7 @@ func Access(path string, mode uint32) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procAccess.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -166,6 +164,7 @@ func Chdir(path string) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procChdir.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -179,6 +178,7 @@ func Chmod(path string, mode uint32) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procChmod.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -192,6 +192,7 @@ func Chown(path string, uid int, gid int) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procChown.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -205,6 +206,7 @@ func Chroot(path string) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procChroot.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -363,6 +365,7 @@ func Lchown(path string, uid int, gid int) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procLchown.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -381,6 +384,8 @@ func Link(path string, link string) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procLink.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
use(unsafe.Pointer(_p1))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -402,6 +407,7 @@ func Lstat(path string, stat *Stat_t) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procLstat.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -415,6 +421,7 @@ func Mkdir(path string, mode uint32) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procMkdir.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -428,6 +435,7 @@ func Mknod(path string, mode uint32, dev int) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procMknod.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -449,6 +457,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := sysvicall6(procOpen.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
fd = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
@@ -463,6 +472,7 @@ func Pathconf(path string, name int) (val int, err error) {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := sysvicall6(procPathconf.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
val = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
@@ -520,6 +530,7 @@ func Readlink(path string, buf []byte) (n int, err error) {
|
||||
_p1 = &buf[0]
|
||||
}
|
||||
r0, _, e1 := sysvicall6(procReadlink.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(len(buf)), 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
@@ -539,6 +550,8 @@ func Rename(from string, to string) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procRename.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
use(unsafe.Pointer(_p1))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -552,6 +565,7 @@ func Rmdir(path string) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procRmdir.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -663,6 +677,7 @@ func Stat(path string, stat *Stat_t) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procStat.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -681,6 +696,8 @@ func Symlink(path string, link string) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procSymlink.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
use(unsafe.Pointer(_p1))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -702,6 +719,7 @@ func Truncate(path string, length int64) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procTruncate.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -737,6 +755,7 @@ func Unlink(path string) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procUnlink.Addr(), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
@@ -750,6 +769,7 @@ func Utimes(path string, times *[2]Timeval) (err error) {
|
||||
return
|
||||
}
|
||||
_, _, e1 := sysvicall6(procUtimes.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0, 0, 0, 0)
|
||||
use(unsafe.Pointer(_p0))
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user