| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // +build aix dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris |
| // Auxiliary information if the File describes a directory |
| buf []byte // buffer for directory I/O |
| nbuf int // length of buf; return value from Getdirentries |
| bufp int // location of next record in buf. |
| // More than 5760 to work around https://golang.org/issue/24015. |
| func (d *dirInfo) close() {} |
| func (f *File) readdirnames(n int) (names []string, err error) { |
| // If this file has no dirinfo, create one. |
| // The buffer must be at least a block long. |
| f.dirinfo.buf = make([]byte, blockSize) |
| names = make([]string, 0, size) // Empty with room to grow. |
| // Refill the buffer if necessary |
| d.nbuf, errno = f.pfd.ReadDirent(d.buf) |
| return names, wrapSyscallError("readdirent", errno) |
| nb, nc, names = syscall.ParseDirent(d.buf[d.bufp:d.nbuf], n, names) |
| if n >= 0 && len(names) == 0 { |