1
0
mirror of https://github.com/golang/go synced 2024-11-23 08:20:05 -07:00

runtime: rename close to closefd

Avoids shadowing the builtin channel close function.

Change-Id: I7a729b0937c8248fe27222be61318a88db995eee
Reviewed-on: https://go-review.googlesource.com/8898
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
David Crawshaw 2015-04-13 19:37:04 -04:00
parent 2f98bac310
commit cea272de30
37 changed files with 42 additions and 42 deletions

View File

@ -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 ""
}

View File

@ -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

View File

@ -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))
}

View File

@ -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))
}

View File

@ -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))
}

View File

@ -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))
}

View File

@ -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))
}

View File

@ -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))
}

View File

@ -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
}

View File

@ -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)))
}

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)