Skip to content

Commit

Permalink
syscall: gofmt
Browse files Browse the repository at this point in the history
Add blank lines after //sys comments where needed, and then run gofmt
on the syscall package with the new formatter.

This is the libgo version of CL 407136.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/412074
  • Loading branch information
ianlancetaylor committed Jun 14, 2022
1 parent 6abe341 commit cf79b11
Show file tree
Hide file tree
Showing 43 changed files with 53 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gcc/go/gofrontend/MERGE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0058658a9efb6e5c5faa6f0f65949beea5ddbc98
bbb3a4347714faee620dc205674510a0f20b81ae

The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
1 change: 1 addition & 0 deletions libgo/go/syscall/dir_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func gbit8(b []byte) (uint8, []byte) {
}

// gbit16 reads a 16-bit number in little-endian order from b and returns it with the remaining slice of b.
//
//go:nosplit
func gbit16(b []byte) (uint16, []byte) {
return uint16(b[0]) | uint16(b[1])<<8, b[2:]
Expand Down
4 changes: 2 additions & 2 deletions libgo/go/syscall/errstr.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build !hurd
// +build !linux
//go:build !hurd && !linux
// +build !hurd,!linux

package syscall

Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/errstr_glibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// We use this rather than errstr.go because on GNU/Linux sterror_r
// returns a pointer to the error message, and may not use buf at all.

//go:build hurd || linux
// +build hurd linux

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/exec_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func runtime_AfterForkInChild()
// For the same reason compiler does not race instrument it.
// The calls to RawSyscall are okay because they are assembly
// functions that do not grow the stack.
//
//go:norace
func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) {
// Declare all variables at top in case any
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/exec_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func runtime_AfterForkInChild()
// For the same reason compiler does not race instrument it.
// The calls to RawSyscall are okay because they are assembly
// functions that do not grow the stack.
//
//go:norace
func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) {
// Declare all variables at top in case any
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/exec_hurd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func runtime_AfterForkInChild()
// For the same reason compiler does not race instrument it.
// The calls to RawSyscall are okay because they are assembly
// functions that do not grow the stack.
//
//go:norace
func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) {
// Declare all variables at top in case any
Expand Down
2 changes: 2 additions & 0 deletions libgo/go/syscall/exec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func runtime_AfterFork()
func runtime_AfterForkInChild()

// Implemented in clone_linux.c
//
//go:noescape
func rawClone(flags _C_ulong, child_stack *byte, ptid *Pid_t, ctid *Pid_t, regs unsafe.Pointer) _C_long

Expand All @@ -92,6 +93,7 @@ func rawClone(flags _C_ulong, child_stack *byte, ptid *Pid_t, ctid *Pid_t, regs
// For the same reason compiler does not race instrument it.
// The calls to RawSyscall are okay because they are assembly
// functions that do not grow the stack.
//
//go:norace
func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) {
// Set up and fork. This returns immediately in the parent or
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/exec_stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build rtems
// +build rtems

// Stubs for fork, exec and wait.
Expand Down
2 changes: 2 additions & 0 deletions libgo/go/syscall/libcall_aix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build aix
// +build aix

package syscall
Expand Down Expand Up @@ -95,6 +96,7 @@ func PtraceDetach(pid int) (err error) { return ptrace64(_PT_DETACH, int64(pid),

//sys reboot(how int) (err error)
//__linux_reboot(how _C_int) _C_int

func Reboot(how int) (err error) {
return reboot(how)
}
Expand Down
2 changes: 2 additions & 0 deletions libgo/go/syscall/libcall_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd

// BSD library calls.
Expand Down Expand Up @@ -53,6 +54,7 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {

//sysnb pipe2(p *[2]_C_int, flags int) (err error)
//pipe2(p *[2]_C_int, flags _C_int) _C_int

func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
return EINVAL
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_bsd_largefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (solaris && 386) || (solaris && sparc)
// +build solaris,386 solaris,sparc

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_bsd_regfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin || dragonfly || freebsd || openbsd || (solaris && amd64) || (solaris && sparc64)
// +build darwin dragonfly freebsd openbsd solaris,amd64 solaris,sparc64

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_bsd_sendfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin || dragonfly || freebsd || openbsd || solaris
// +build darwin dragonfly freebsd openbsd solaris

// BSD sendfile support.
Expand Down
3 changes: 3 additions & 0 deletions libgo/go/syscall/libcall_glibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

//sys futimesat(dirfd int, path *byte, times *[2]Timeval) (err error)
//futimesat(dirfd _C_int, path *byte, times *[2]Timeval) _C_int

func Futimesat(dirfd int, path string, tv []Timeval) (err error) {
if len(tv) != 2 {
return EINVAL
Expand Down Expand Up @@ -100,6 +101,7 @@ func ReadDirent(fd int, buf []byte) (n int, err error) {

//sysnb pipe2(p *[2]_C_int, flags int) (err error)
//pipe2(p *[2]_C_int, flags _C_int) _C_int

func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
return EINVAL
Expand All @@ -113,6 +115,7 @@ func Pipe2(p []int, flags int) (err error) {

//sys sendfile(outfd int, infd int, offset *Offset_t, count int) (written int, err error)
//sendfile64(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t

func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if race.Enabled {
race.ReleaseMerge(unsafe.Pointer(&ioSync))
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_irix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build irix
// +build irix

package syscall
Expand Down
2 changes: 2 additions & 0 deletions libgo/go/syscall/libcall_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func PtraceDetach(pid int) (err error) { return ptrace(PTRACE_DETACH, pid, 0, 0)

//sys reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error)
//reboot(magic1 _C_uint, magic2 _C_uint, cmd _C_int, arg *byte) _C_int

func Reboot(cmd int) (err error) {
return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "")
}
Expand Down Expand Up @@ -211,6 +212,7 @@ func Gettid() (tid int) {

//sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error)
//splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t

func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
var lroff _loff_t
var plroff *_loff_t
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_linux_utimesnano.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "unsafe"

//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
//utimensat(dirfd _C_int, path *byte, times *[2]Timespec, flags _C_int) _C_int

func UtimesNano(path string, ts []Timespec) (err error) {
if len(ts) != 2 {
return EINVAL
Expand Down
3 changes: 3 additions & 0 deletions libgo/go/syscall/libcall_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import "unsafe"

//sysnb pipe(p *[2]_C_int) (err error)
//pipe(p *[2]_C_int) _C_int

func Pipe(p []int) (err error) {
if len(p) != 2 {
return EINVAL
Expand All @@ -32,6 +33,7 @@ func Pipe(p []int) (err error) {

//sys utimes(path string, times *[2]Timeval) (err error)
//utimes(path *byte, times *[2]Timeval) _C_int

func Utimes(path string, tv []Timeval) (err error) {
if len(tv) != 2 {
return EINVAL
Expand Down Expand Up @@ -240,6 +242,7 @@ func FDZero(set *FdSet) {

//sysnb gettimeofday(tv *Timeval, tz *byte) (err error)
//gettimeofday(tv *Timeval, tz *byte) _C_int

func Gettimeofday(tv *Timeval) (err error) {
return gettimeofday(tv, nil)
}
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_posix_largefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build aix || hurd || linux || (solaris && 386) || (solaris && sparc)
// +build aix hurd linux solaris,386 solaris,sparc

// POSIX library calls on systems which use the largefile interface.
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_posix_nonhurd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !hurd
// +build !hurd

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_posix_regfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !aix && !hurd && !linux && (!solaris || !386) && (!solaris || !sparc)
// +build !aix
// +build !hurd
// +build !linux
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_posix_utimesnano.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build aix || darwin || dragonfly || freebsd || hurd || openbsd || netbsd || solaris
// +build aix darwin dragonfly freebsd hurd openbsd netbsd solaris

// General POSIX version of UtimesNano.
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_solaris_largefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (solaris && 386) || (solaris && sparc)
// +build solaris,386 solaris,sparc

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_solaris_regfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (solaris && amd64) || (solaris && sparc64)
// +build solaris,amd64 solaris,sparc64

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_uname.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// Build on all systems other than solaris/386.
// 32-bit Solaris 2/x86 needs _nuname, handled in libcall_solaris_386.go.
//go:build !386 || !solaris
// +build !386 !solaris

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/libcall_wait4.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !aix
// +build !aix

// For systems with the wait4 library call.
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/sleep_rtems.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build rtems
// +build rtems

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/sleep_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !rtems
// +build !rtems

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/socket_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin || dragonfly || freebsd || openbsd || netbsd
// +build darwin dragonfly freebsd openbsd netbsd

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/socket_hurd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build hurd
// +build hurd

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/socket_irix.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build irix
// +build irix

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/socket_linux_ppc64x_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (linux && ppc64) || (linux && ppc64le)
// +build linux,ppc64 linux,ppc64le

package syscall
Expand Down
5 changes: 2 additions & 3 deletions libgo/go/syscall/socket_linux_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build linux
// +build !ppc64
// +build !ppc64le
//go:build linux && !ppc64 && !ppc64le
// +build linux,!ppc64,!ppc64le

package syscall

Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/socket_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !solaris
// +build !solaris

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/socket_xnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build solaris
// +build solaris

package syscall
Expand Down
1 change: 0 additions & 1 deletion libgo/go/syscall/syscall.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
// That is also where updates required by new systems or versions
// should be applied. See https://golang.org/s/go1.4-syscall for more
// information.
//
package syscall

import "unsafe"
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/syscall_errno.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "internal/oserror"
// An Errno is an unsigned number describing an error condition.
// It implements the error interface. The zero Errno is by convention
// a non-error, so code to convert from Errno to error should use:
//
// err = nil
// if errno != 0 {
// err = errno
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/syscall_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd hurd linux netbsd openbsd solaris

package syscall
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/syscall_funcs_stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build aix || rtems
// +build aix rtems

// These are stubs.
Expand Down
1 change: 1 addition & 0 deletions libgo/go/syscall/syscall_glibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build hurd || linux
// +build hurd linux

package syscall
Expand Down
Loading

0 comments on commit cf79b11

Please sign in to comment.