| 1 | // Copyright 2018 The gVisor Authors. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | // Package linux contains the constants and types needed to interface with a |
| 16 | // Linux kernel. |
| 17 | package linux |
| 18 | |
| 19 | // NumSoftIRQ is the number of software IRQs, exposed via /proc/stat. |
| 20 | // |
| 21 | // Defined in linux/interrupt.h. |
| 22 | const NumSoftIRQ = 10 |
| 23 | |
| 24 | // Sysinfo is the structure provided by sysinfo on linux versions > 2.3.48. |
| 25 | // |
| 26 | // +marshal |
| 27 | type Sysinfo struct { |
| 28 | Uptime int64 |
| 29 | Loads [3]uint64 |
| 30 | TotalRAM uint64 |
| 31 | FreeRAM uint64 |
| 32 | SharedRAM uint64 |
| 33 | BufferRAM uint64 |
| 34 | TotalSwap uint64 |
| 35 | FreeSwap uint64 |
| 36 | Procs uint16 |
| 37 | _ [6]byte // Pad Procs to 64bits. |
| 38 | TotalHigh uint64 |
| 39 | FreeHigh uint64 |
| 40 | Unit uint32 `marshal:"unaligned"` // Struct ends mid-64-bit-word. |
| 41 | // The _f field in the glibc version of Sysinfo has size 0 on AMD64. |
| 42 | } |