Skip to content

Commit

Permalink
unix: remove unused readlen and writelen
Browse files Browse the repository at this point in the history
These were originally added when copying over files from package
syscall. However, their use was removed in CL 129500043. New ports kept
adding these wrappers without using them. They are still unused, so
remove them.

Change-Id: I2ffffe98a5c999d23b63d1f04ee4ad8f807ee736
Reviewed-on: https://go-review.googlesource.com/c/sys/+/531356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
  • Loading branch information
tklauser authored and gopherbot committed Sep 28, 2023
1 parent 3186bae commit 2964e1e
Show file tree
Hide file tree
Showing 35 changed files with 40 additions and 558 deletions.
2 changes: 1 addition & 1 deletion unix/mksyscall.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func main() {
text += "}\n\n"

if *libc && !trampolines[libcFn] {
// some system calls share a trampoline, like read and readlen.
// Some system calls share a trampoline.
trampolines[libcFn] = true
// Declare assembly trampoline address.
text += fmt.Sprintf("var libc_%s_trampoline_addr uintptr\n\n", libcFn)
Expand Down
6 changes: 2 additions & 4 deletions unix/mksyscall_aix_ppc.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func main() {
}
}

if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" && funct != "ioctlPtr" {
if funct != "fcntl" && funct != "FcntlInt" && funct != "ioctlPtr" {
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
Expand Down Expand Up @@ -296,9 +296,7 @@ func main() {
} else if p.Type == "unsafe.Pointer" {
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
} else if p.Type == "int" {
if (argN == 2) && ((funct == "readlen") || (funct == "writelen")) {
args = append(args, fmt.Sprintf("C.size_t(%s)", p.Name))
} else if argN == 0 && funct == "fcntl" {
if argN == 0 && funct == "fcntl" {
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
} else if (argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt")) {
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
Expand Down
2 changes: 1 addition & 1 deletion unix/mksyscall_aix_ppc64.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func main() {
}

onlyCommon := false
if funct == "readlen" || funct == "writelen" || funct == "FcntlInt" || funct == "FcntlFlock" || funct == "ioctlPtr" {
if funct == "FcntlInt" || funct == "FcntlFlock" || funct == "ioctlPtr" {
// This function call another syscall which is already implemented.
// Therefore, the gc and gccgo part must not be generated.
onlyCommon = true
Expand Down
2 changes: 0 additions & 2 deletions unix/syscall_aix.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,6 @@ func Fsync(fd int) error {
//sys Unlinkat(dirfd int, path string, flags int) (err error)
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
//sys write(fd int, p []byte) (n int, err error)
//sys readlen(fd int, p *byte, np int) (n int, err error) = read
//sys writelen(fd int, p *byte, np int) (n int, err error) = write

//sys Dup2(oldfd int, newfd int) (err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64
Expand Down
2 changes: 0 additions & 2 deletions unix/syscall_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,5 +644,3 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
//sys write(fd int, p []byte) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
2 changes: 0 additions & 2 deletions unix/syscall_dragonfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,5 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys write(fd int, p []byte) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
2 changes: 0 additions & 2 deletions unix/syscall_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,5 @@ func Dup3(oldfd, newfd, flags int) error {
//sys write(fd int, p []byte) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
2 changes: 0 additions & 2 deletions unix/syscall_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1979,8 +1979,6 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) {
//sys Unshare(flags int) (err error)
//sys write(fd int, p []byte) (n int, err error)
//sys exitThread(code int) (err error) = SYS_EXIT
//sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ
//sys writelen(fd int, p *byte, np int) (n int, err error) = SYS_WRITE
//sys readv(fd int, iovs []Iovec) (n int, err error) = SYS_READV
//sys writev(fd int, iovs []Iovec) (n int, err error) = SYS_WRITEV
//sys preadv(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr) (n int, err error) = SYS_PREADV
Expand Down
2 changes: 0 additions & 2 deletions unix/syscall_netbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ func Statvfs(path string, buf *Statvfs_t) (err error) {
//sys write(fd int, p []byte) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)

const (
Expand Down
2 changes: 0 additions & 2 deletions unix/syscall_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,4 @@ func Uname(uname *Utsname) error {
//sys write(fd int, p []byte) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
18 changes: 0 additions & 18 deletions unix/syscall_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,24 +698,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) = libsocket.setsockopt
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = libsocket.recvfrom

func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
n = int(r0)
if e1 != 0 {
err = e1
}
return
}

func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
n = int(r0)
if e1 != 0 {
err = e1
}
return
}

// Event Ports

type fileObjCookie struct {
Expand Down
1 change: 0 additions & 1 deletion unix/syscall_zos_s390x.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {

//sys fcntl(fd int, cmd int, arg int) (val int, err error)
//sys read(fd int, p []byte) (n int, err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys write(fd int, p []byte) (n int, err error)

//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) = SYS___ACCEPT_A
Expand Down
22 changes: 0 additions & 22 deletions unix/zsyscall_aix_ppc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions unix/zsyscall_aix_ppc64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions unix/zsyscall_darwin_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions unix/zsyscall_darwin_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions unix/zsyscall_dragonfly_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions unix/zsyscall_freebsd_386.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions unix/zsyscall_freebsd_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions unix/zsyscall_freebsd_arm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions unix/zsyscall_freebsd_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2964e1e

Please sign in to comment.