github.com/demonoid81/containerd@v1.3.4/cmd/containerd-shim/shim_darwin.go (about)

     1  // +build darwin
     2  
     3  /*
     4     Copyright The containerd Authors.
     5  
     6     Licensed under the Apache License, Version 2.0 (the "License");
     7     you may not use this file except in compliance with the License.
     8     You may obtain a copy of the License at
     9  
    10         http://www.apache.org/licenses/LICENSE-2.0
    11  
    12     Unless required by applicable law or agreed to in writing, software
    13     distributed under the License is distributed on an "AS IS" BASIS,
    14     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15     See the License for the specific language governing permissions and
    16     limitations under the License.
    17  */
    18  
    19  package main
    20  
    21  import (
    22  	"os"
    23  	"os/signal"
    24  
    25  	"github.com/containerd/containerd/sys/reaper"
    26  	runc "github.com/containerd/go-runc"
    27  	"github.com/containerd/ttrpc"
    28  )
    29  
    30  // setupSignals creates a new signal handler for all signals and sets the shim as a
    31  // sub-reaper so that the container processes are reparented
    32  func setupSignals() (chan os.Signal, error) {
    33  	signals := make(chan os.Signal, 2048)
    34  	signal.Notify(signals)
    35  	// make sure runc is setup to use the monitor
    36  	// for waiting on processes
    37  	runc.Monitor = reaper.Default
    38  	return signals, nil
    39  }
    40  
    41  func newServer() (*ttrpc.Server, error) {
    42  	// for darwin, we omit the socket credentials because these syscalls are
    43  	// slightly different. since we don't have darwin support yet, this can be
    44  	// implemented later and the build can continue without issue.
    45  	return ttrpc.NewServer()
    46  }