]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: rename close to closefd
authorDavid Crawshaw <crawshaw@golang.org>
Mon, 13 Apr 2015 23:37:04 +0000 (19:37 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Tue, 14 Apr 2015 12:31:29 +0000 (12:31 +0000)
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>

37 files changed:
src/runtime/env_plan9.go
src/runtime/export_test.go
src/runtime/os1_darwin.go
src/runtime/os1_dragonfly.go
src/runtime/os1_freebsd.go
src/runtime/os1_linux.go
src/runtime/os1_netbsd.go
src/runtime/os1_openbsd.go
src/runtime/os1_plan9.go
src/runtime/os3_solaris.go
src/runtime/os_nacl.go
src/runtime/os_plan9.go
src/runtime/os_windows.go
src/runtime/stubs2.go
src/runtime/sys_darwin_386.s
src/runtime/sys_darwin_amd64.s
src/runtime/sys_darwin_arm.s
src/runtime/sys_dragonfly_amd64.s
src/runtime/sys_freebsd_386.s
src/runtime/sys_freebsd_amd64.s
src/runtime/sys_freebsd_arm.s
src/runtime/sys_linux_386.s
src/runtime/sys_linux_amd64.s
src/runtime/sys_linux_arm.s
src/runtime/sys_linux_arm64.s
src/runtime/sys_linux_ppc64x.s
src/runtime/sys_nacl_386.s
src/runtime/sys_nacl_amd64p32.s
src/runtime/sys_nacl_arm.s
src/runtime/sys_netbsd_386.s
src/runtime/sys_netbsd_amd64.s
src/runtime/sys_netbsd_arm.s
src/runtime/sys_openbsd_386.s
src/runtime/sys_openbsd_amd64.s
src/runtime/sys_openbsd_arm.s
src/runtime/sys_plan9_386.s
src/runtime/sys_plan9_amd64.s

index b988020d9c7f42f28356c8dbb0115eeae92cd290..0e2588b5238c6a8a4ef60ca0b0a5f7a36aa763a3 100644 (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 ""
        }
index 71fbcdeabd7bf21f3e226ac64eebeea325fc456d..58ac34283f1d37740c80ea8bbbcb44eaf4aaca6e 100644 (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
 
index 9de6de9ff1245a298de496b5c595ab14c322ecce..a4c987470017bf37977e2cbaa46270eb9a0dc7ca 100644 (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))
 }
 
index 54f19eff9f2ac0d1ec665eee64f0b32d3222c650..a590aea39be49fbf7d9735a2a3ab12acbe553ae0 100644 (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))
 }
 
index ceaa9162c077ff1d3a6d51c020d541a62fd99a31..8719a49286839d12e1a256da896e95420832ca98 100644 (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))
 }
 
index 44e7698bcf17a4196b0cf0910fc89988344e35ff..4214fa7cf7a04d2aa8678061c32b26986b3e6fee 100644 (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))
 }
 
index 85b3df33970143f7abba4302ff81f56fca50c82e..8df74b5593c8f73d5b058a26d3556dbac91a45bb 100644 (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))
 }
 
index 4f41864684b9497053058323722f25289395f4be..95729a56df85035a94980b610d1c2888507d671c 100644 (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))
 }
 
index 284f3381d788977232d316a576cff28443e255dd..c02621824162c06d4d34bab9c31d2b84dcec3e08 100644 (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
 }
 
index 7a4d27e20e015a4d4a033c1d8fc184eda4bfab07..f012943b0c7c222c4ca4c61195004f1514d74a9d 100644 (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)))
 }
 
index a6a796cd76ff55bf5ac9ea41602d18ce64d2f536..efa8fa12b911fdf7db82b866223a2a8b8c64799f 100644 (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
index 870404b948dab75fd7a4d83abd24f151611169d8..6def35ccadeded25595d0ed390059c4ccc763f0b 100644 (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
index 31df0649594c14ea0a5ae7e029b82e0a2b99f7df..545b416201ae6891ff75979c2c53418681a26fdf 100644 (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
 }
index 60751dd343dc76fbff9c3045e3c2b65fb7b0a35e..1cb6f9123d8f223001340a852073ed2a98624d7b 100644 (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
index 6e1234567b7c340ea5563bc8c910168e8fd72a93..abc5d3297ab3ea57aad6538c42a02bc01ef61b10 100644 (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)
index 2ec43014c68c5d58b861b750159679c7217d387b..3d0d3395b81920cd9be70fd7fed87311d0547485 100644 (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
index 870c3bff8f865ad1a885783eb78d63f5a1dc23dc..b4c1b27530222c7169c0b4967d88aab869439198 100644 (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
index 1227196cb7e01071274be9d0ee8b09de07b5addd..efda4326a4654961cefa1cc12b416dc61d13e3df 100644 (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
index eed6b8d691c15e186e6230e25412e9fb322c9fea..94b8d95044edc09a2002bdc29cd3a00d50e1b002 100644 (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)
index ecc40e3946f6edfd60588e251a1f6348671c464b..a9a621b095ef369e407225f514eed7c02ffd7441 100644 (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
index 613c1dceed2ddb356e267738490044c2cbc9fd4e..2b5d754590b0a613c9392a234945bd226413d05f 100644 (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
index e3fae4cb93aea9d4841f96c64a5f21a80ddaf8b7..d69054feb5417d2c39fb3538e92af6a46ccc561f 100644 (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)
index e170b2e7f7f59acbc1bfc4c754a4dcaca7a1f215..43a65b7ccdbe6113502c9d0af1bdf1fef0f25fdc 100644 (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
index d422f95f083094cb35c6bc1be55652c66dd21f79..bbd7eb9eb3a08d27570b08c00786da58af70130a 100644 (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
index df7a9b49422355225ad68254227bb8c0b3f34d0c..32404570fe845969d8e3c3a2e2659fb293f04921 100644 (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
index b0477d3c2f6b879bdb6d59f983661277bc4fe989..fd7ce4fa4865141e6d052fad0e65f5abcaefeac6 100644 (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)
index 242040dd9770f34cca041ae867eeaadb389c8547..f8e7196bd32950c732bc74381bed83f66d33cbae 100644 (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)
index 821610be89981ce89f7246c34bb92b7ae3abc014..0b29c9f889e03958b51b14ff3f349e02aa92c4d6 100644 (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)
index 1bae0b31ec190ff6e9c96a8af171886d7cd6b777..39ef25a618b1a3db823fa6fdbf760028ac5014e8 100644 (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)
index bfa7928df788c7fb49437f4bab552d204e263cb4..b43a72e60ffb445e76ef8f56752276e95fcb8546 100644 (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)
index a138286d863d5ed03be2556aba082145d09ed89e..5c1d957b372563e154b99c071db27fbabe8b901d 100644 (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
index b4210228312bfc94bdd034e3758c711a92e75bb1..d275d6d0b6629b19cc8fcd803501d18d6a252077 100644 (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
index 10877096d4330dd446fb3848ec914877a076a3c8..fa3f0d9bee3096b4815c14a1c3f745955af473bc 100644 (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)
index d05782c181db85302ac2e129ab06a98eb7c47ecd..185b82db1a4e5b71ecf787b234b69c59eb66bbe6 100644 (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
index f1be7751aeb49227181a1532aa75ab148a2f07e4..e28d43eeaad65dedea3c7adfe0e8db3c013857f3 100644 (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
index b9db8cbf1a5bf821e8c84fea78fc64ad924d1a68..cae326ada6343842d4a4d7c8b4d51f10ce151e0e 100644 (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)
index 02c7c8743eb8c54c70f2c1fa1983eee7e0ba1f4b..6aefe5f125f7352d23753bfa68f13456e9ed9b95 100644 (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)