func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
	skip, err := Seek(fd, 0, 1  )
	if err != nil {
		return 0, err
	}
	fd2, err := Openat(fd, ".", O_RDONLY, 0)
	if err != nil {
		return 0, err
	}
	d, err := fdopendir(fd2)
	if err != nil {
		Close(fd2)
		return 0, err
	}
	defer closedir(d)
	var cnt int64
	for {
		var entry Dirent
		var entryp *Dirent
		e := readdir_r(d, &entry, &entryp)
		if e != 0 {
			return n, errnoErr(e)
		}
		if entryp == nil {
			break
		}
		if skip > 0 {
			skip--
			cnt++
			continue
		}
		reclen := int(entry.Reclen)
		if reclen > len(buf) {
			break
		}
		var s []byte
		hdr := (*unsafeheader.Slice)(unsafe.Pointer(&s))
		hdr.Data = unsafe.Pointer(&entry)
		hdr.Cap = reclen
		hdr.Len = reclen
		copy(buf, s)
		buf = buf[reclen:]
		n += reclen
		cnt++
	}
	_, err = Seek(fd, cnt, 0  )
	if err != nil {
		return n, err
	}
	return n, nil
}
go:linkname libc_fdopendir libc_fdopendir
go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
package unix
import (
	"unsafe"
	"golang.org/x/sys/internal/unsafeheader"
)
func fdopendir(fd int) (dir uintptr, err error) {
	r0, _, e1 := syscall_syscallPtr(funcPC(libc_fdopendir_trampoline), uintptr(fd), 0, 0)
	dir = uintptr(r0)
	if e1 != 0 {
		err = errnoErr(e1)
	}
	return
}
func libc_fdopendir_trampoline()