libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
stat.hxx
1#pragma once
2
3// C++
4#include <cstdint>
5
6// cosmos
7#include <cosmos/compiler.hxx>
8
9namespace clues {
10
11extern "C" {
12
15 uint16_t dev;
16 uint16_t ino;
17 uint16_t mode;
18 uint16_t nlink;
19 uint16_t uid;
20 uint16_t gid;
21 uint16_t rdev;
22 uint32_t size;
23 uint32_t atime;
24 uint32_t mtime;
25 uint32_t ctime;
26};
27
29struct stat32 {
30 uint32_t dev;
31 uint32_t ino;
32 uint16_t mode;
33 uint16_t nlink;
34 uint16_t uid;
35 uint16_t gid;
36 uint32_t rdev;
37 uint32_t size;
38 uint32_t blksize;
39 uint32_t blocks;
40 uint32_t atime;
41 uint32_t atime_nsec;
42 uint32_t mtime;
43 uint32_t mtime_nsec;
44 uint32_t ctime;
45 uint32_t ctime_nsec;
46 uint32_t __unused4;
47 uint32_t __unused5;
48};
49
51
57struct stat32_64 {
58 uint64_t dev;
59 unsigned char __pad0[4];
60 uint32_t _ino;
61 uint32_t mode;
62 uint32_t nlink;
63 uint32_t uid;
64 uint32_t gid;
65 uint64_t rdev;
66 unsigned char __pad3[4];
67 int64_t size;
68 uint32_t blksize;
69 /* Number 512-byte blocks allocated. */
70 uint64_t blocks;
71 uint32_t atime;
72 uint32_t atime_nsec;
73 uint32_t mtime;
74 uint32_t mtime_nsec;
75 uint32_t ctime;
76 uint32_t ctime_nsec;
77 uint64_t ino;
78} __attribute__((packed));
79
80#ifdef COSMOS_X86
82struct stat64 {
83 uint64_t dev;
84 uint64_t ino;
85 uint64_t nlink;
86
87 uint32_t mode;
88 uint32_t uid;
89 uint32_t gid;
90 uint32_t __pad0;
91 uint64_t rdev;
92 int64_t size;
93 int64_t blksize;
94 int64_t blocks; /* Number 512-byte blocks alloc */
95
96 uint64_t atime;
97 uint64_t atime_nsec;
98 uint64_t mtime;
99 uint64_t mtime_nsec;
100 uint64_t ctime;
101 uint64_t ctime_nsec;
102 int64_t __unused[3];
103};
104#else
106struct stat64 {
107 unsigned long dev; /* Device. */
108 unsigned long ino; /* File serial number. */
109 unsigned int mode; /* File mode. */
110 unsigned int nlink; /* Link count. */
111 unsigned int uid; /* User ID of the file's owner. */
112 unsigned int gid; /* Group ID of the file's group. */
113 unsigned long rdev; /* Device number, if device. */
114 unsigned long __pad1;
115 long size; /* Size of file, in bytes. */
116 int blksize; /* Optimal block size for I/O. */
117 int __pad2;
118 long blocks; /* Number 512-byte blocks allocated. */
119 long atime; /* Time of last access. */
120 unsigned long atime_nsec;
121 long mtime; /* Time of last modification. */
122 unsigned long mtime_nsec;
123 long ctime; /* Time of last status change. */
124 unsigned long ctime_nsec;
125 unsigned int __unused4;
126 unsigned int __unused5;
127};
128#endif
129
130} // end extern
131
132} // end ns
Original Linux stat data structure for SystemCallNr::OLDSTAT, OLDLSTAT and OLDFSTAT.
Definition stat.hxx:14
64-bit sized stat data structure used with the stat64 family of system calls on 32-bit ABIs like i386...
Definition stat.hxx:57
32-bit sized stat data structure with some padding for SystemCallNR::STAT, LSTAT and FSTAT on 32-bit ...
Definition stat.hxx:29
The single stat structure from asm-generic used e.g. on AARCH64.
Definition stat.hxx:106