all: gofmt

Gofmt to update doc comments to the new formatting.

For golang/go#51082.

Change-Id: I9a1c4b671c06820a1c383ee515f7884965fefa54
Reviewed-on: https://go-review.googlesource.com/c/sys/+/399602
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox
2022-04-29 23:34:32 +00:00
committed by Gopher Robot
parent 84afa8d3f7
commit b5fbb4746d
20 changed files with 132 additions and 113 deletions
+3 -3
View File
@@ -10,11 +10,11 @@ This program reads a file containing function prototypes
(like syscall_plan9.go) and generates system call bodies. (like syscall_plan9.go) and generates system call bodies.
The prototypes are marked by lines beginning with "//sys" The prototypes are marked by lines beginning with "//sys"
and read like func declarations if //sys is replaced by func, but: and read like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument. - The parameter lists must give a name for each argument.
This includes return parameters. This includes return parameters.
* The parameter lists must give a type for each argument: - The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed. the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named errno. - If the return parameter is an error number, it must be named errno.
A line beginning with //sysnb is like //sys, except that the A line beginning with //sysnb is like //sys, except that the
goroutine will not be suspended during the execution of the system goroutine will not be suspended during the execution of the system
+1
View File
@@ -113,5 +113,6 @@ func (tv *Timeval) Nano() int64 {
// use is a no-op, but the compiler cannot see that it is. // use is a no-op, but the compiler cannot see that it is.
// Calling use(p) ensures that p is kept live until that point. // Calling use(p) ensures that p is kept live until that point.
//
//go:noescape //go:noescape
func use(p unsafe.Pointer) func use(p unsafe.Pointer)
+10
View File
@@ -115,6 +115,7 @@ func Write(fd int, p []byte) (n int, err error) {
var ioSync int64 var ioSync int64
//sys fd2path(fd int, buf []byte) (err error) //sys fd2path(fd int, buf []byte) (err error)
func Fd2path(fd int) (path string, err error) { func Fd2path(fd int) (path string, err error) {
var buf [512]byte var buf [512]byte
@@ -126,6 +127,7 @@ func Fd2path(fd int) (path string, err error) {
} }
//sys pipe(p *[2]int32) (err error) //sys pipe(p *[2]int32) (err error)
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {
if len(p) != 2 { if len(p) != 2 {
return syscall.ErrorString("bad arg in system call") return syscall.ErrorString("bad arg in system call")
@@ -180,6 +182,7 @@ func (w Waitmsg) ExitStatus() int {
} }
//sys await(s []byte) (n int, err error) //sys await(s []byte) (n int, err error)
func Await(w *Waitmsg) (err error) { func Await(w *Waitmsg) (err error) {
var buf [512]byte var buf [512]byte
var f [5][]byte var f [5][]byte
@@ -301,42 +304,49 @@ func Getgroups() (gids []int, err error) {
} }
//sys open(path string, mode int) (fd int, err error) //sys open(path string, mode int) (fd int, err error)
func Open(path string, mode int) (fd int, err error) { func Open(path string, mode int) (fd int, err error) {
fixwd() fixwd()
return open(path, mode) return open(path, mode)
} }
//sys create(path string, mode int, perm uint32) (fd int, err error) //sys create(path string, mode int, perm uint32) (fd int, err error)
func Create(path string, mode int, perm uint32) (fd int, err error) { func Create(path string, mode int, perm uint32) (fd int, err error) {
fixwd() fixwd()
return create(path, mode, perm) return create(path, mode, perm)
} }
//sys remove(path string) (err error) //sys remove(path string) (err error)
func Remove(path string) error { func Remove(path string) error {
fixwd() fixwd()
return remove(path) return remove(path)
} }
//sys stat(path string, edir []byte) (n int, err error) //sys stat(path string, edir []byte) (n int, err error)
func Stat(path string, edir []byte) (n int, err error) { func Stat(path string, edir []byte) (n int, err error) {
fixwd() fixwd()
return stat(path, edir) return stat(path, edir)
} }
//sys bind(name string, old string, flag int) (err error) //sys bind(name string, old string, flag int) (err error)
func Bind(name string, old string, flag int) (err error) { func Bind(name string, old string, flag int) (err error) {
fixwd() fixwd()
return bind(name, old, flag) return bind(name, old, flag)
} }
//sys mount(fd int, afd int, old string, flag int, aname string) (err error) //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) { func Mount(fd int, afd int, old string, flag int, aname string) (err error) {
fixwd() fixwd()
return mount(fd, afd, old, flag, aname) return mount(fd, afd, old, flag, aname)
} }
//sys wstat(path string, edir []byte) (err error) //sys wstat(path string, edir []byte) (err error)
func Wstat(path string, edir []byte) (err error) { func Wstat(path string, edir []byte) (err error) {
fixwd() fixwd()
return wstat(path, edir) return wstat(path, edir)
+2
View File
@@ -6,9 +6,11 @@
// consts, funcs, and types into a common source file, per GOOS. // consts, funcs, and types into a common source file, per GOOS.
// //
// Usage: // Usage:
//
// $ mkmerge -out MERGED FILE [FILE ...] // $ mkmerge -out MERGED FILE [FILE ...]
// //
// Example: // Example:
//
// # Remove all common consts, funcs, and types from zerrors_linux_*.go // # Remove all common consts, funcs, and types from zerrors_linux_*.go
// # and write the common code into zerrors_linux.go // # and write the common code into zerrors_linux.go
// $ mkmerge -out zerrors_linux.go zerrors_linux_*.go // $ mkmerge -out zerrors_linux.go zerrors_linux_*.go
+1 -1
View File
@@ -6,7 +6,7 @@
// +build ignore // +build ignore
// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go. // mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go.
//This program must be run after mksyscall.go. // This program must be run after mksyscall.go.
package main package main
import ( import (
+3 -3
View File
@@ -10,11 +10,11 @@ This program reads a file containing function prototypes
(like syscall_darwin.go) and generates system call bodies. (like syscall_darwin.go) and generates system call bodies.
The prototypes are marked by lines beginning with "//sys" The prototypes are marked by lines beginning with "//sys"
and read like func declarations if //sys is replaced by func, but: and read like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument. - The parameter lists must give a name for each argument.
This includes return parameters. This includes return parameters.
* The parameter lists must give a type for each argument: - The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed. the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named errno. - If the return parameter is an error number, it must be named errno.
A line beginning with //sysnb is like //sys, except that the A line beginning with //sysnb is like //sys, except that the
goroutine will not be suspended during the execution of the system goroutine will not be suspended during the execution of the system
+6 -6
View File
@@ -10,14 +10,14 @@ This program reads a file containing function prototypes
(like syscall_aix.go) and generates system call bodies. (like syscall_aix.go) and generates system call bodies.
The prototypes are marked by lines beginning with "//sys" The prototypes are marked by lines beginning with "//sys"
and read like func declarations if //sys is replaced by func, but: and read like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument. - The parameter lists must give a name for each argument.
This includes return parameters. This includes return parameters.
* The parameter lists must give a type for each argument: - The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed. the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named err. - If the return parameter is an error number, it must be named err.
* If go func name needs to be different than its libc name, - If go func name needs to be different than its libc name,
* or the function is not in libc, name could be specified - or the function is not in libc, name could be specified
* at the end, after "=" sign, like - at the end, after "=" sign, like
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
*/ */
package main package main
+6
View File
@@ -37,6 +37,7 @@ func Creat(path string, mode uint32) (fd int, err error) {
} }
//sys utimes(path string, times *[2]Timeval) (err error) //sys utimes(path string, times *[2]Timeval) (err error)
func Utimes(path string, tv []Timeval) error { func Utimes(path string, tv []Timeval) error {
if len(tv) != 2 { if len(tv) != 2 {
return EINVAL return EINVAL
@@ -45,6 +46,7 @@ func Utimes(path string, tv []Timeval) error {
} }
//sys utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) //sys utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error)
func UtimesNano(path string, ts []Timespec) error { func UtimesNano(path string, ts []Timespec) error {
if len(ts) != 2 { if len(ts) != 2 {
return EINVAL return EINVAL
@@ -300,11 +302,13 @@ func direntNamlen(buf []byte) (uint64, bool) {
} }
//sys getdirent(fd int, buf []byte) (n int, err error) //sys getdirent(fd int, buf []byte) (n int, err error)
func Getdents(fd int, buf []byte) (n int, err error) { func Getdents(fd int, buf []byte) (n int, err error) {
return getdirent(fd, buf) return getdirent(fd, buf)
} }
//sys wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error) //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) { func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
var status _C_int var status _C_int
var r Pid_t var r Pid_t
@@ -372,6 +376,7 @@ func (w WaitStatus) TrapCause() int { return -1 }
//sys fcntl(fd int, cmd int, arg int) (val int, err error) //sys fcntl(fd int, cmd int, arg int) (val int, err error)
//sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range //sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range
func Fsync(fd int) error { func Fsync(fd int) error {
return fsyncRange(fd, O_SYNC, 0, 0) return fsyncRange(fd, O_SYNC, 0, 0)
} }
@@ -536,6 +541,7 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
//sys Getsystemcfg(label int) (n uint64) //sys Getsystemcfg(label int) (n uint64)
//sys umount(target string) (err error) //sys umount(target string) (err error)
func Unmount(target string, flags int) (err error) { func Unmount(target string, flags int) (err error) {
if flags != 0 { if flags != 0 {
// AIX doesn't have any flags for umount. // AIX doesn't have any flags for umount.
+2
View File
@@ -125,11 +125,13 @@ func Pipe2(p []int, flags int) (err error) {
} }
//sys extpread(fd int, p []byte, flags int, offset int64) (n 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) { func pread(fd int, p []byte, offset int64) (n int, err error) {
return extpread(fd, p, 0, offset) return extpread(fd, p, 0, offset)
} }
//sys extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error) //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) { func pwrite(fd int, p []byte, offset int64) (n int, err error) {
return extpwrite(fd, p, 0, offset) return extpwrite(fd, p, 0, offset)
} }
+2
View File
@@ -81,6 +81,7 @@ func Pipe(p []int) (err error) {
} }
//sysnb pipe2(p *[2]_C_int, flags int) (err error) //sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) error { func Pipe2(p []int, flags int) error {
if len(p) != 2 { if len(p) != 2 {
return EINVAL return EINVAL
@@ -95,6 +96,7 @@ func Pipe2(p []int, flags int) error {
} }
//sys Getdents(fd int, buf []byte) (n int, err error) //sys Getdents(fd int, buf []byte) (n int, err error)
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
n, err = Getdents(fd, buf) n, err = Getdents(fd, buf)
if err != nil || basep == nil { if err != nil || basep == nil {
+8 -6
View File
@@ -12,32 +12,34 @@ to standard output.
The prototypes are marked by lines beginning with "//sys" and read The prototypes are marked by lines beginning with "//sys" and read
like func declarations if //sys is replaced by func, but: like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument. This - The parameter lists must give a name for each argument. This
includes return parameters. includes return parameters.
* The parameter lists must give a type for each argument: - The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed. the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named err. - If the return parameter is an error number, it must be named err.
* If go func name needs to be different from its winapi dll name, - If go func name needs to be different from its winapi dll name,
the winapi name could be specified at the end, after "=" sign, like the winapi name could be specified at the end, after "=" sign, like
//sys LoadLibrary(libname string) (handle uint32, err error) = LoadLibraryA //sys LoadLibrary(libname string) (handle uint32, err error) = LoadLibraryA
* Each function that returns err needs to supply a condition, that - Each function that returns err needs to supply a condition, that
return value of winapi will be tested against to detect failure. return value of winapi will be tested against to detect failure.
This would set err to windows "last-error", otherwise it will be nil. This would set err to windows "last-error", otherwise it will be nil.
The value can be provided at end of //sys declaration, like The value can be provided at end of //sys declaration, like
//sys LoadLibrary(libname string) (handle uint32, err error) [failretval==-1] = LoadLibraryA //sys LoadLibrary(libname string) (handle uint32, err error) [failretval==-1] = LoadLibraryA
and is [failretval==0] by default. and is [failretval==0] by default.
* If the function name ends in a "?", then the function not existing is non- - If the function name ends in a "?", then the function not existing is non-
fatal, and an error will be returned instead of panicking. fatal, and an error will be returned instead of panicking.
Usage: Usage:
mkwinsyscall [flags] [path ...] mkwinsyscall [flags] [path ...]
The flags are: The flags are:
-output -output
Specify output file name (outputs to console if blank). Specify output file name (outputs to console if blank).
-trace -trace
-1
View File
@@ -20,7 +20,6 @@
// log.Fatal(err) // log.Fatal(err)
// } // }
// fmt.Printf("Windows system root is %q\n", s) // fmt.Printf("Windows system root is %q\n", s)
//
package registry package registry
import ( import (
-1
View File
@@ -6,7 +6,6 @@
// +build windows // +build windows
// Package debug provides facilities to execute svc.Handler on console. // Package debug provides facilities to execute svc.Handler on console.
//
package debug package debug
import ( import (
-1
View File
@@ -6,7 +6,6 @@
// +build windows // +build windows
// Package eventlog implements access to Windows event log. // Package eventlog implements access to Windows event log.
//
package eventlog package eventlog
import ( import (
-1
View File
@@ -12,7 +12,6 @@
// stop / start / pause / continue any service, and how to // stop / start / pause / continue any service, and how to
// write to event log. It also shows how to use debug // write to event log. It also shows how to use debug
// facilities available in debug package. // facilities available in debug package.
//
package main package main
import ( import (
-1
View File
@@ -9,7 +9,6 @@
// It can be used to install and remove them. It can also start, // It can be used to install and remove them. It can also start,
// stop and pause them. The package can query / change current // stop and pause them. The package can query / change current
// service state and config parameters. // service state and config parameters.
//
package mgr package mgr
import ( import (
-1
View File
@@ -6,7 +6,6 @@
// +build windows // +build windows
// Package svc provides everything required to build Windows service. // Package svc provides everything required to build Windows service.
//
package svc package svc
import ( import (