github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/pkg/sentry/seccheck/sinks/null/null.go (about)

     1  // Copyright 2021 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 null defines a seccheck.Sink that does nothing with the trace
    16  // points, akin to /dev/null.
    17  package null
    18  
    19  import (
    20  	"github.com/MerlinKodo/gvisor/pkg/fd"
    21  	"github.com/MerlinKodo/gvisor/pkg/sentry/seccheck"
    22  )
    23  
    24  const name = "null"
    25  
    26  func init() {
    27  	seccheck.RegisterSink(seccheck.SinkDesc{
    28  		Name: name,
    29  		New:  new,
    30  	})
    31  }
    32  
    33  // null is a checker that does nothing with the trace points.
    34  type null struct {
    35  	seccheck.SinkDefaults
    36  }
    37  
    38  var _ seccheck.Sink = (*null)(nil)
    39  
    40  func new(_ map[string]any, _ *fd.FD) (seccheck.Sink, error) {
    41  	return &null{}, nil
    42  }
    43  
    44  func (*null) Name() string {
    45  	return name
    46  }