| // 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 darwin dragonfly freebsd linux nacl netbsd openbsd solaris |
| 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 = fixCount(syscall.ReadDirent(f.fd, d.buf)) |
| return names, NewSyscallError("readdirent", errno) |
| nb, nc, names = syscall.ParseDirent(d.buf[d.bufp:d.nbuf], n, names) |
| if n >= 0 && len(names) == 0 { |