1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
#pragma once
#define packed __attribute__((packed))
/*
* time
*/
/* timeval */
typedef struct sys·TimeStamp sys·TimeStamp;
typedef struct sys·TimeValue sys·TimeValue;
struct sys·TimeStamp
{
int64 sec;
uint32 nano;
int32 femto;
};
struct sys·TimeValue
{
int64 sec;
int64 micro;
};
/* resource */
typedef struct sys·UsageInfo sys·UsageInfo;
/* rusage */
struct sys·UsageInfo
{
sys·TimeValue cpu;
sys·TimeValue sys;
/* linux extensions */
long maxrss; /* maximum resident set size */
long ixrss; /* integral shared memory size */
long idrss; /* integral unshared data size */
long isrss; /* integral unshared stack size */
struct packed {
long minor; /* page reclaims (soft page faults) */
long major; /* page faults (hard page faults) */
}fault;
long nswap; /* swaps */
long iblk; /* block input operations */
long oblk; /* block output operations */
long msgsent; /* IPC messages sent */
long msgrcvd; /* IPC messages received */
long nsignal; /* signals received */
long nvctxsw; /* voluntary context switches */
long nictxsw; /* involuntary context switches */
/* room for more... */
long __reserved[16];
};
/*
* files
*/
typedef struct sys·Info sys·Info;
typedef struct sys·Directory sys·Directory;
typedef struct sys·DirEntry sys·DirEntry;
/* statx */
struct sys·Info
{
uint32 mask;
uint32 blksize;
uint64 attr;
uint32 nlink;
uint32 uid;
uint32 gid;
uint16 mode;
uint16 _pad;
uint64 inode;
uint64 size;
uint64 nblk;
uint64 attrmask;
sys·TimeStamp access, create, status, modify;
struct packed{
uint32 major;
uint32 minor;
}spdev;
struct{
uint32 major;
uint32 minor;
}device;
uint64 spare[14];
};
struct sys·Directory
{
intptr off;
int fd;
int pad;
int pos, end;
/* buf needs fall on (off_t) 8 byte alignment */
char buf[2048];
};
struct sys·DirEntry
{
ulong ino; /* inode number */
ulong off; /* offset to next entry (from start of directory */
ushort len; /* length of entry (in bytes) */
uchar type; /* filetype */
char name[]; /* filename */
};
/*
* terminal
*/
typedef struct sys·TerminalIO sys·TerminalIO;
typedef struct sys·WindowSize sys·WindowSize;
/* termios NOTE: this is incorrect for Mips and PowerPC... */
struct sys·TerminalIO
{
uint i,o,c,l; /* input,output,control,local flags */
uchar line;
uchar ctrl[32]; /* control chars */
uint ispeed; /* input speed */
uint ospeed; /* output speed */
};
/* screen/window */
struct sys·WindowSize
{
ushort row, col;
ushort dx, dy; /* pixels */
};
#undef packed
|