Skip to content

Commit

Permalink
runtime: rename close to closefd
Browse files Browse the repository at this point in the history
Avoids shadowing the builtin channel close function.

Change-Id: I7a729b0937c8248fe27222be61318a88db995eee
Reviewed-on: https://go-review.googlesource.com/8898
Reviewed-by: Ian Lance Taylor <[email protected]>
Run-TryBot: David Crawshaw <[email protected]>
  • Loading branch information
crawshaw committed Apr 14, 2015
1 parent 2f98bac commit cea272d
Show file tree
Hide file tree
Showing 37 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/runtime/env_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ func gogetenv(key string) string {
}
n := seek(fd, 0, 2)
if n <= 0 {
close(fd)
closefd(fd)
return ""
}

p := make([]byte, n)

r := pread(fd, unsafe.Pointer(&p[0]), int32(n), 0)
close(fd)
closefd(fd)
if r < 0 {
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var Maxstring = &maxstring
type Uintreg uintreg

var Open = open
var Close = close
var Close = closefd
var Read = read
var Write = write

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/os1_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var urandom_dev = []byte("/dev/urandom\x00")
func getRandomData(r []byte) {
fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0)
n := read(fd, unsafe.Pointer(&r[0]), int32(len(r)))
close(fd)
closefd(fd)
extendRandom(r, int(n))
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/os1_dragonfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var urandom_dev = []byte("/dev/urandom\x00")
func getRandomData(r []byte) {
fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0)
n := read(fd, unsafe.Pointer(&r[0]), int32(len(r)))
close(fd)
closefd(fd)
extendRandom(r, int(n))
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/os1_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var urandom_dev = []byte("/dev/urandom\x00")
func getRandomData(r []byte) {
fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0)
n := read(fd, unsafe.Pointer(&r[0]), int32(len(r)))
close(fd)
closefd(fd)
extendRandom(r, int(n))
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/os1_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func getRandomData(r []byte) {
}
fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0)
n := read(fd, unsafe.Pointer(&r[0]), int32(len(r)))
close(fd)
closefd(fd)
extendRandom(r, int(n))
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/os1_netbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ var urandom_dev = []byte("/dev/urandom\x00")
func getRandomData(r []byte) {
fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0)
n := read(fd, unsafe.Pointer(&r[0]), int32(len(r)))
close(fd)
closefd(fd)
extendRandom(r, int(n))
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/os1_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ var urandom_dev = []byte("/dev/urandom\x00")
func getRandomData(r []byte) {
fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0)
n := read(fd, unsafe.Pointer(&r[0]), int32(len(r)))
close(fd)
closefd(fd)
extendRandom(r, int(n))
}

Expand Down
8 changes: 4 additions & 4 deletions src/runtime/os1_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func getproccount() int32 {
}
}
}
close(fd)
closefd(fd)
if ncpu == 0 {
ncpu = 1
}
Expand All @@ -64,7 +64,7 @@ func getpid() uint64 {
fd := open(&pid[0], 0, 0)
if fd >= 0 {
read(fd, unsafe.Pointer(&b), int32(len(b)))
close(fd)
closefd(fd)
}
c := b[:]
for c[0] == ' ' || c[0] == '\t' {
Expand Down Expand Up @@ -162,10 +162,10 @@ func postnote(pid uint64, msg []byte) int {
}
len := findnull(&msg[0])
if write(uintptr(fd), (unsafe.Pointer)(&msg[0]), int32(len)) != int64(len) {
close(fd)
closefd(fd)
return -1
}
close(fd)
closefd(fd)
return 0
}

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/os3_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ var urandom_dev = []byte("/dev/urandom\x00")
func getRandomData(r []byte) {
fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0)
n := read(fd, unsafe.Pointer(&r[0]), int32(len(r)))
close(fd)
closefd(fd)
extendRandom(r, int(n))
}

Expand Down Expand Up @@ -351,7 +351,7 @@ func semawakeup(mp *m) {
}

//go:nosplit
func close(fd int32) int32 {
func closefd(fd int32) int32 {
return int32(sysvicall1(libc_close, uintptr(fd)))
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/os_nacl.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ func raiseproc(sig int32) {

// Stubs so tests can link correctly. These should never be called.
func open(name *byte, mode, perm int32) int32
func close(fd int32) int32
func closefd(fd int32) int32
func read(fd int32, p unsafe.Pointer, n int32) int32
2 changes: 1 addition & 1 deletion src/runtime/os_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package runtime

import "unsafe"

func close(fd int32) int32
func closefd(fd int32) int32

//go:noescape
func open(name *byte, mode, perm int32) int32
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/os_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func open(name *byte, mode, perm int32) int32 {
throw("unimplemented")
return -1
}
func close(fd int32) int32 {
func closefd(fd int32) int32 {
throw("unimplemented")
return -1
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/stubs2.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package runtime
import "unsafe"

func read(fd int32, p unsafe.Pointer, n int32) int32
func close(fd int32) int32
func closefd(fd int32) int32

func exit(code int32)
func nanotime() int64
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_darwin_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TEXT runtime·open(SB),NOSPLIT,$0
MOVL AX, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVL $6, AX
INT $0x80
JAE 2(PC)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_darwin_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TEXT runtime·open(SB),NOSPLIT,$0
MOVL AX, ret+16(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVL fd+0(FP), DI // arg 1 fd
MOVL $(0x2000000+6), AX // syscall entry
SYSCALL
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_darwin_arm.s
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TEXT runtime·open(SB),NOSPLIT,$0
MOVW R0, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVW fd+0(FP), R0
MOVW $SYS_close, R12
SWI $0x80
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_dragonfly_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ TEXT runtime·open(SB),NOSPLIT,$-8
MOVL AX, ret+16(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-8
TEXT runtime·closefd(SB),NOSPLIT,$-8
MOVL fd+0(FP), DI // arg 1 fd
MOVL $6, AX
SYSCALL
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_freebsd_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEXT runtime·open(SB),NOSPLIT,$-4
MOVL AX, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-4
TEXT runtime·closefd(SB),NOSPLIT,$-4
MOVL $6, AX
INT $0x80
JAE 2(PC)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_freebsd_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TEXT runtime·open(SB),NOSPLIT,$-8
MOVL AX, ret+16(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-8
TEXT runtime·closefd(SB),NOSPLIT,$-8
MOVL fd+0(FP), DI // arg 1 fd
MOVL $6, AX
SYSCALL
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_freebsd_arm.s
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ TEXT runtime·write(SB),NOSPLIT,$-8
MOVW R0, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-8
TEXT runtime·closefd(SB),NOSPLIT,$-8
MOVW fd+0(FP), R0 // arg 1 fd
MOVW $SYS_close, R7
SWI $0
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_linux_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEXT runtime·open(SB),NOSPLIT,$0
MOVL AX, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVL $6, AX // syscall - close
MOVL fd+0(FP), BX
CALL *runtime·_vdso(SB)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_linux_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TEXT runtime·open(SB),NOSPLIT,$0-20
MOVL AX, ret+16(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0-12
TEXT runtime·closefd(SB),NOSPLIT,$0-12
MOVL fd+0(FP), DI
MOVL $3, AX // syscall entry
SYSCALL
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_linux_arm.s
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ TEXT runtime·open(SB),NOSPLIT,$0
MOVW R0, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVW fd+0(FP), R0
MOVW $SYS_close, R7
SWI $0
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_linux_arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ done:
MOVW R0, ret+16(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-8-12
TEXT runtime·closefd(SB),NOSPLIT,$-8-12
MOVW fd+0(FP), R0
MOVD $SYS_close, R8
SVC
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_linux_ppc64x.s
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEXT runtime·open(SB),NOSPLIT,$-8-20
MOVW R3, ret+16(FP)
RETURN

TEXT runtime·close(SB),NOSPLIT,$-8-12
TEXT runtime·closefd(SB),NOSPLIT,$-8-12
MOVW fd+0(FP), R3
SYSCALL $SYS_close
BVC 2(PC)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_nacl_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEXT runtime·open(SB),NOSPLIT,$12
MOVL AX, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$4
TEXT runtime·closefd(SB),NOSPLIT,$4
MOVL fd+0(FP), AX
MOVL AX, 0(SP)
NACL_SYSCALL(SYS_close)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_nacl_amd64p32.s
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TEXT runtime·open(SB),NOSPLIT,$0
MOVL AX, ret+16(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVL fd+0(FP), DI
NACL_SYSCALL(SYS_close)
MOVL AX, ret+8(FP)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_nacl_arm.s
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TEXT runtime·open(SB),NOSPLIT,$0
MOVW R0, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVW fd+0(FP), R0
NACL_SYSCALL(SYS_close)
MOVW R0, ret+4(FP)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_netbsd_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TEXT runtime·open(SB),NOSPLIT,$-4
MOVL AX, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-4
TEXT runtime·closefd(SB),NOSPLIT,$-4
MOVL $6, AX
INT $0x80
JAE 2(PC)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_netbsd_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ TEXT runtime·open(SB),NOSPLIT,$-8
MOVL AX, ret+16(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-8
TEXT runtime·closefd(SB),NOSPLIT,$-8
MOVL fd+0(FP), DI // arg 1 fd
MOVL $6, AX
SYSCALL
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_netbsd_arm.s
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEXT runtime·open(SB),NOSPLIT,$-8
MOVW R0, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-8
TEXT runtime·closefd(SB),NOSPLIT,$-8
MOVW fd+0(FP), R0
SWI $0xa00006
MOVW.CS $-1, R0
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_openbsd_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TEXT runtime·open(SB),NOSPLIT,$-4
MOVL AX, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-4
TEXT runtime·closefd(SB),NOSPLIT,$-4
MOVL $6, AX
INT $0x80
JAE 2(PC)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_openbsd_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ TEXT runtime·open(SB),NOSPLIT,$-8
MOVL AX, ret+16(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-8
TEXT runtime·closefd(SB),NOSPLIT,$-8
MOVL fd+0(FP), DI // arg 1 fd
MOVL $6, AX
SYSCALL
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_openbsd_arm.s
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TEXT runtime·open(SB),NOSPLIT,$-4
MOVW R0, ret+12(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$-4
TEXT runtime·closefd(SB),NOSPLIT,$-4
MOVW path+0(FP), R0 // arg 1 - path
MOVW $6, R12 // sys_close
SWI $0
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_plan9_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TEXT runtime·seek(SB),NOSPLIT,$24
MOVL $-1, ret_hi+20(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVL $4, AX
INT $64
MOVL AX, ret+4(FP)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_plan9_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TEXT runtime·seek(SB),NOSPLIT,$32
MOVQ $-1, ret+24(FP)
RET

TEXT runtime·close(SB),NOSPLIT,$0
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVQ $4, BP
SYSCALL
MOVL AX, ret+8(FP)
Expand Down

0 comments on commit cea272d

Please sign in to comment.