diff options
author | Fabricio Voznika <fvoznika@google.com> | 2020-01-16 12:28:44 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-16 12:30:21 -0800 |
commit | 7b7c31820b83abcfe43f7170eff1f7953f3f27e2 (patch) | |
tree | 7a01db872d9c026b4a35437469e5c1ec94c7a1bf /pkg/sentry/fs/proc/cpuinfo.go | |
parent | fea1ce655de92a5411589d2f4a6b8973cd911a77 (diff) |
Add remaining /proc/* and /proc/sys/* files
Except for one under /proc/sys/net/ipv4/tcp_sack.
/proc/pid/* is still incomplete.
Updates #1195
PiperOrigin-RevId: 290120438
Diffstat (limited to 'pkg/sentry/fs/proc/cpuinfo.go')
-rw-r--r-- | pkg/sentry/fs/proc/cpuinfo.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/sentry/fs/proc/cpuinfo.go b/pkg/sentry/fs/proc/cpuinfo.go index 3edf36780..6330337eb 100644 --- a/pkg/sentry/fs/proc/cpuinfo.go +++ b/pkg/sentry/fs/proc/cpuinfo.go @@ -15,6 +15,8 @@ package proc import ( + "bytes" + "gvisor.dev/gvisor/pkg/sentry/context" "gvisor.dev/gvisor/pkg/sentry/fs" "gvisor.dev/gvisor/pkg/sentry/kernel" @@ -27,9 +29,9 @@ func newCPUInfo(ctx context.Context, msrc *fs.MountSource) *fs.Inode { // Kernel is always initialized with a FeatureSet. panic("cpuinfo read with nil FeatureSet") } - contents := make([]byte, 0, 1024) + var buf bytes.Buffer for i, max := uint(0), k.ApplicationCores(); i < max; i++ { - contents = append(contents, []byte(features.CPUInfo(i))...) + features.WriteCPUInfoTo(i, &buf) } - return newStaticProcInode(ctx, msrc, contents) + return newStaticProcInode(ctx, msrc, buf.Bytes()) } |