25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
715 B

  1. // Copyright 2019 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build darwin
  5. // +build darwin
  6. package unix
  7. import "unsafe"
  8. // ReadDirent reads directory entries from fd and writes them into buf.
  9. func ReadDirent(fd int, buf []byte) (n int, err error) {
  10. // Final argument is (basep *uintptr) and the syscall doesn't take nil.
  11. // 64 bits should be enough. (32 bits isn't even on 386). Since the
  12. // actual system call is getdirentries64, 64 is a good guess.
  13. // TODO(rsc): Can we use a single global basep for all calls?
  14. var base = (*uintptr)(unsafe.Pointer(new(uint64)))
  15. return Getdirentries(fd, buf, base)
  16. }