From 836cccc71d0aef7308b8f4c02214ac2ed2f3643d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 20 Sep 2017 17:49:11 +0000 Subject: [PATCH] syscall: enable ParseDirent for AIX Reviewed-on: https://go-review.googlesource.com/64990 From-SVN: r253022 --- gcc/go/gofrontend/MERGE | 2 +- libgo/go/syscall/dirent.go | 2 +- libgo/go/syscall/syscall_aix.go | 19 +++++++++++++++++++ libgo/mksysinfo.sh | 1 + 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 libgo/go/syscall/syscall_aix.go diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 27b0be0a345..06f8d621210 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -84f827669dc76326ed99ebcc982c482aa148d8d8 +5deeab42b0e5fdf2721773ce7fdaf61716599d4d The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/syscall/dirent.go b/libgo/go/syscall/dirent.go index 4db2d4355b5..a09bf055c96 100644 --- a/libgo/go/syscall/dirent.go +++ b/libgo/go/syscall/dirent.go @@ -2,7 +2,7 @@ // 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 +// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris package syscall diff --git a/libgo/go/syscall/syscall_aix.go b/libgo/go/syscall/syscall_aix.go new file mode 100644 index 00000000000..c2554eb8c6c --- /dev/null +++ b/libgo/go/syscall/syscall_aix.go @@ -0,0 +1,19 @@ +// Copyright 2017 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. + +package syscall + +import "unsafe" + +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) +} diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index 54978b97997..f7e88a6de26 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -485,6 +485,7 @@ fi | sed -e 's/type _dirent64/type Dirent/' \ -e 's/d_name/Name/' \ -e 's/]int8/]byte/' \ -e 's/d_ino/Ino/' \ + -e 's/d_namlen/Namlen/' \ -e 's/d_off/Off/' \ -e 's/d_reclen/Reclen/' \ -e 's/d_type/Type/' \ -- 2.30.2