summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-06-22 20:37:41 +0000
committergVisor bot <gvisor-bot@google.com>2019-06-22 20:37:41 +0000
commitd01228b4707699238b93057065748e9391113358 (patch)
tree308e3df7de9d4d76d349daf8444e0e7d54e77b7b /pkg/abi
parenta09dced0e1e48d31dea8b5b5d7b6b52269b6adcc (diff)
parent35719d52c7ac7faa87b610013aedd69ad5d99ecc (diff)
Merge 35719d52 (automated)
Diffstat (limited to 'pkg/abi')
-rw-r--r--pkg/abi/linux/file.go51
-rw-r--r--pkg/abi/linux/time.go15
2 files changed, 66 insertions, 0 deletions
diff --git a/pkg/abi/linux/file.go b/pkg/abi/linux/file.go
index c3301f7c5..426003eb7 100644
--- a/pkg/abi/linux/file.go
+++ b/pkg/abi/linux/file.go
@@ -181,6 +181,57 @@ type Stat struct {
// SizeOfStat is the size of a Stat struct.
var SizeOfStat = binary.Size(Stat{})
+// Flags for statx.
+const (
+ AT_STATX_SYNC_TYPE = 0x6000
+ AT_STATX_SYNC_AS_STAT = 0x0000
+ AT_STATX_FORCE_SYNC = 0x2000
+ AT_STATX_DONT_SYNC = 0x4000
+)
+
+// Mask values for statx.
+const (
+ STATX_TYPE = 0x00000001
+ STATX_MODE = 0x00000002
+ STATX_NLINK = 0x00000004
+ STATX_UID = 0x00000008
+ STATX_GID = 0x00000010
+ STATX_ATIME = 0x00000020
+ STATX_MTIME = 0x00000040
+ STATX_CTIME = 0x00000080
+ STATX_INO = 0x00000100
+ STATX_SIZE = 0x00000200
+ STATX_BLOCKS = 0x00000400
+ STATX_BASIC_STATS = 0x000007ff
+ STATX_BTIME = 0x00000800
+ STATX_ALL = 0x00000fff
+ STATX__RESERVED = 0x80000000
+)
+
+// Statx represents struct statx.
+type Statx struct {
+ Mask uint32
+ Blksize uint32
+ Attributes uint64
+ Nlink uint32
+ UID uint32
+ GID uint32
+ Mode uint16
+ _ uint16
+ Ino uint64
+ Size uint64
+ Blocks uint64
+ AttributesMask uint64
+ Atime StatxTimestamp
+ Btime StatxTimestamp
+ Ctime StatxTimestamp
+ Mtime StatxTimestamp
+ RdevMajor uint32
+ RdevMinor uint32
+ DevMajor uint32
+ DevMinor uint32
+}
+
// FileMode represents a mode_t.
type FileMode uint
diff --git a/pkg/abi/linux/time.go b/pkg/abi/linux/time.go
index fa9ee27e1..e727066d7 100644
--- a/pkg/abi/linux/time.go
+++ b/pkg/abi/linux/time.go
@@ -226,3 +226,18 @@ type Tms struct {
// TimerID represents type timer_t, which identifies a POSIX per-process
// interval timer.
type TimerID int32
+
+// StatxTimestamp represents struct statx_timestamp.
+type StatxTimestamp struct {
+ Sec int64
+ Nsec uint32
+ _ int32
+}
+
+// NsecToStatxTimestamp translates nanoseconds to StatxTimestamp.
+func NsecToStatxTimestamp(nsec int64) (ts StatxTimestamp) {
+ return StatxTimestamp{
+ Sec: nsec / 1e9,
+ Nsec: uint32(nsec % 1e9),
+ }
+}