Commit cea272de authored by David Crawshaw's avatar David Crawshaw

runtime: rename close to closefd

Avoids shadowing the builtin channel close function.

Change-Id: I7a729b0937c8248fe27222be61318a88db995eee
Reviewed-on: https://go-review.googlesource.com/8898Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
parent 2f98bac3
......@@ -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 ""
}
......
......@@ -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
......
......@@ -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))
}
......
......@@ -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))
}
......
......@@ -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))
}
......
......@@ -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))
}
......
......@@ -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))
}
......
......@@ -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))
}
......
......@@ -50,7 +50,7 @@ func getproccount() int32 {
}
}
}
close(fd)
closefd(fd)
if ncpu == 0 {
ncpu = 1
}
......@@ -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' {
......@@ -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
}
......
......@@ -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))
}
......@@ -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)))
}
......
......@@ -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
......@@ -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
......
......@@ -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
}
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment