From 0aa8a87b5d8f9425ed4c1b66b85e453bef8b7f29 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 18 May 2022 16:42:30 -0400 Subject: [PATCH] syscall: make //sys lines not doc comments If they are doc comments then gofmt will put a space between // and sys. Most of syscall was already this way, following CL 7324056 (in 2013). These were not. Change-Id: Ie6ebf82809c199d0d06b87c86045bbb62b687d5f Reviewed-on: https://go-review.googlesource.com/c/go/+/407136 Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Auto-Submit: Russ Cox Run-TryBot: Russ Cox --- src/syscall/syscall_aix.go | 9 +++++++++ src/syscall/syscall_dragonfly.go | 2 ++ src/syscall/syscall_netbsd.go | 3 +++ src/syscall/syscall_openbsd.go | 3 +++ src/syscall/syscall_plan9.go | 10 ++++++++++ 5 files changed, 27 insertions(+) diff --git a/src/syscall/syscall_aix.go b/src/syscall/syscall_aix.go index 693424165e7..dbcb7bb7173 100644 --- a/src/syscall/syscall_aix.go +++ b/src/syscall/syscall_aix.go @@ -65,6 +65,7 @@ func Access(path string, mode uint32) (err error) { //sys Dup2(old int, new int) (err error) //sysnb pipe(p *[2]_C_int) (err error) + func Pipe(p []int) (err error) { if len(p) != 2 { return EINVAL @@ -79,12 +80,14 @@ func Pipe(p []int) (err error) { } //sys readlink(path string, buf []byte, bufSize uint64) (n int, err error) + func Readlink(path string, buf []byte) (n int, err error) { s := uint64(len(buf)) return readlink(path, buf, s) } //sys utimes(path string, times *[2]Timeval) (err error) + func Utimes(path string, tv []Timeval) error { if len(tv) != 2 { return EINVAL @@ -93,6 +96,7 @@ func Utimes(path string, tv []Timeval) error { } //sys utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) + func UtimesNano(path string, ts []Timespec) error { if len(ts) != 2 { return EINVAL @@ -101,6 +105,7 @@ func UtimesNano(path string, ts []Timespec) error { } //sys unlinkat(dirfd int, path string, flags int) (err error) + func Unlinkat(dirfd int, path string) (err error) { return unlinkat(dirfd, path, 0) } @@ -206,11 +211,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } //sys getdirent(fd int, buf []byte) (n int, err error) + func ReadDirent(fd int, buf []byte) (n int, err error) { return getdirent(fd, buf) } //sys wait4(pid _Pid_t, status *_C_int, options int, rusage *Rusage) (wpid _Pid_t, err error) + func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { var status _C_int var r _Pid_t @@ -228,6 +235,7 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, } //sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range + func Fsync(fd int) error { return fsyncRange(fd, O_SYNC, 0, 0) } @@ -313,6 +321,7 @@ func Getsockname(fd int) (sa Sockaddr, err error) { } //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) + func Accept(fd int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny diff --git a/src/syscall/syscall_dragonfly.go b/src/syscall/syscall_dragonfly.go index 3628895ef93..1a3cfe51fa4 100644 --- a/src/syscall/syscall_dragonfly.go +++ b/src/syscall/syscall_dragonfly.go @@ -127,11 +127,13 @@ func Pipe2(p []int, flags int) (err error) { } //sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error) + func pread(fd int, p []byte, offset int64) (n int, err error) { return extpread(fd, p, 0, offset) } //sys extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error) + func pwrite(fd int, p []byte, offset int64) (n int, err error) { return extpwrite(fd, p, 0, offset) } diff --git a/src/syscall/syscall_netbsd.go b/src/syscall/syscall_netbsd.go index 07afa072fc7..d8efb41d20c 100644 --- a/src/syscall/syscall_netbsd.go +++ b/src/syscall/syscall_netbsd.go @@ -112,6 +112,7 @@ func Pipe(p []int) (err error) { } //sysnb pipe2(p *[2]_C_int, flags int) (err error) + func Pipe2(p []int, flags int) error { if len(p) != 2 { return EINVAL @@ -126,6 +127,7 @@ func Pipe2(p []int, flags int) error { } //sys paccept(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, sigmask *sigset, flags int) (nfd int, err error) + func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny @@ -145,6 +147,7 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { } //sys getdents(fd int, buf []byte) (n int, err error) + func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { return getdents(fd, buf) } diff --git a/src/syscall/syscall_openbsd.go b/src/syscall/syscall_openbsd.go index 19cf1f4985b..75217344df1 100644 --- a/src/syscall/syscall_openbsd.go +++ b/src/syscall/syscall_openbsd.go @@ -70,6 +70,7 @@ func Pipe(p []int) error { } //sysnb pipe2(p *[2]_C_int, flags int) (err error) + func Pipe2(p []int, flags int) error { if len(p) != 2 { return EINVAL @@ -84,6 +85,7 @@ func Pipe2(p []int, flags int) error { } //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) + func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny @@ -103,6 +105,7 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { } //sys getdents(fd int, buf []byte) (n int, err error) + func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { return getdents(fd, buf) } diff --git a/src/syscall/syscall_plan9.go b/src/syscall/syscall_plan9.go index 6a8ab97dc6c..ca286c8c975 100644 --- a/src/syscall/syscall_plan9.go +++ b/src/syscall/syscall_plan9.go @@ -181,6 +181,7 @@ func Write(fd int, p []byte) (n int, err error) { var ioSync int64 //sys fd2path(fd int, buf []byte) (err error) + func Fd2path(fd int) (path string, err error) { var buf [512]byte @@ -192,6 +193,7 @@ func Fd2path(fd int) (path string, err error) { } //sys pipe(p *[2]int32) (err error) + func Pipe(p []int) (err error) { if len(p) != 2 { return NewError("bad arg in system call") @@ -260,6 +262,7 @@ func (w Waitmsg) ExitStatus() int { } //sys await(s []byte) (n int, err error) + func Await(w *Waitmsg) (err error) { var buf [512]byte var f [5][]byte @@ -379,42 +382,49 @@ func Getgroups() (gids []int, err error) { } //sys open(path string, mode int) (fd int, err error) + func Open(path string, mode int) (fd int, err error) { fixwd(path) return open(path, mode) } //sys create(path string, mode int, perm uint32) (fd int, err error) + func Create(path string, mode int, perm uint32) (fd int, err error) { fixwd(path) return create(path, mode, perm) } //sys remove(path string) (err error) + func Remove(path string) error { fixwd(path) return remove(path) } //sys stat(path string, edir []byte) (n int, err error) + func Stat(path string, edir []byte) (n int, err error) { fixwd(path) return stat(path, edir) } //sys bind(name string, old string, flag int) (err error) + func Bind(name string, old string, flag int) (err error) { fixwd(name, old) return bind(name, old, flag) } //sys mount(fd int, afd int, old string, flag int, aname string) (err error) + func Mount(fd int, afd int, old string, flag int, aname string) (err error) { fixwd(old) return mount(fd, afd, old, flag, aname) } //sys wstat(path string, edir []byte) (err error) + func Wstat(path string, edir []byte) (err error) { fixwd(path) return wstat(path, edir)