summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/ptrace/ptrace.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-07-03 22:50:26 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-03 22:51:26 -0700
commit67f2cefce02816307805699c3462d6fd7ce61b69 (patch)
treeac9b1a7501385c29589699a2cedbf871214ec4a0 /pkg/sentry/platform/ptrace/ptrace.go
parentda57fb9d25d947195147868253a928f83980c1fd (diff)
Avoid importing platforms from many source files
PiperOrigin-RevId: 256494243
Diffstat (limited to 'pkg/sentry/platform/ptrace/ptrace.go')
-rw-r--r--pkg/sentry/platform/ptrace/ptrace.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/sentry/platform/ptrace/ptrace.go b/pkg/sentry/platform/ptrace/ptrace.go
index ee7e0640c..6fd30ed25 100644
--- a/pkg/sentry/platform/ptrace/ptrace.go
+++ b/pkg/sentry/platform/ptrace/ptrace.go
@@ -45,6 +45,7 @@
package ptrace
import (
+ "os"
"sync"
"gvisor.dev/gvisor/pkg/abi/linux"
@@ -236,3 +237,17 @@ func (p *PTrace) NewAddressSpace(_ interface{}) (platform.AddressSpace, <-chan s
func (*PTrace) NewContext() platform.Context {
return &context{}
}
+
+type constructor struct{}
+
+func (*constructor) New(*os.File) (platform.Platform, error) {
+ return New()
+}
+
+func (*constructor) OpenDevice() (*os.File, error) {
+ return nil, nil
+}
+
+func init() {
+ platform.Register("ptrace", &constructor{})
+}