syscall_glibc.go 777 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2009 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. // +build hurd linux
  5. package syscall
  6. import "unsafe"
  7. func rawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
  8. r1, r2, _ = RawSyscall(trap, a1, a2, a3)
  9. return
  10. }
  11. func direntIno(buf []byte) (uint64, bool) {
  12. return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
  13. }
  14. func direntReclen(buf []byte) (uint64, bool) {
  15. return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
  16. }
  17. func direntNamlen(buf []byte) (uint64, bool) {
  18. reclen, ok := direntReclen(buf)
  19. if !ok {
  20. return 0, false
  21. }
  22. return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
  23. }