summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/proc/task.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-07-12 13:11:01 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-12 13:11:01 -0700
commiteff2c264a48611a714cb89f28693a18ac029886a (patch)
treec1adf06c534a2ce971efe52b13d2422acdd436a4 /pkg/sentry/fs/proc/task.go
parent69e0affaecda24b4d193e4592202b55b53afecc3 (diff)
parentf957fb23cf68e72084c7b50569242a07997f96bc (diff)
Merge pull request #282 from zhangningdlut:chris_test_proc
PiperOrigin-RevId: 257855479
Diffstat (limited to 'pkg/sentry/fs/proc/task.go')
-rw-r--r--pkg/sentry/fs/proc/task.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/sentry/fs/proc/task.go b/pkg/sentry/fs/proc/task.go
index ef0ca3301..d82d4e998 100644
--- a/pkg/sentry/fs/proc/task.go
+++ b/pkg/sentry/fs/proc/task.go
@@ -162,6 +162,11 @@ func (f *subtasksFile) Readdir(ctx context.Context, file *fs.File, ser fs.Dentry
// subtask to emit.
offset := file.Offset()
+ tasks := f.t.ThreadGroup().MemberIDs(f.pidns)
+ if len(tasks) == 0 {
+ return offset, syserror.ENOENT
+ }
+
if offset == 0 {
// Serialize "." and "..".
root := fs.RootFromContext(ctx)
@@ -178,7 +183,6 @@ func (f *subtasksFile) Readdir(ctx context.Context, file *fs.File, ser fs.Dentry
}
// Serialize tasks.
- tasks := f.t.ThreadGroup().MemberIDs(f.pidns)
taskInts := make([]int, 0, len(tasks))
for _, tid := range tasks {
taskInts = append(taskInts, int(tid))