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.
12 // See version list in https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/param.h
14 osreldateOnce sync
.Once
18 // First __DragonFly_version after September 2019 ABI changes
19 // http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html
20 const _dragonflyABIChangeVersion
= 500705
22 func supportsABI(ver
uint32) bool {
23 osreldateOnce
.Do(func() { osreldate
, _
= SysctlUint32("kern.osreldate") })
24 return osreldate
>= ver
27 func direntIno(buf
[]byte) (uint64, bool) {
28 return readInt(buf
, unsafe
.Offsetof(Dirent
{}.Fileno
), unsafe
.Sizeof(Dirent
{}.Fileno
))
31 func direntReclen(buf
[]byte) (uint64, bool) {
32 namlen
, ok
:= direntNamlen(buf
)
36 return (16 + namlen
+ 1 + 7) &^ 7, true
39 func direntNamlen(buf
[]byte) (uint64, bool) {
40 return readInt(buf
, unsafe
.Offsetof(Dirent
{}.Namlen
), unsafe
.Sizeof(Dirent
{}.Namlen
))