// Kill assumes a plugin is not able to hear a Kill RPC call
190144
func (a *availablePlugin) Kill(r string) error {
	log.WithFields(log.Fields{
		"_module":     "control-aplugin",
		"block":       "kill",
		"plugin_name": a,
	}).Info("hard killing available plugin")
	if a.fromPackage {
		log.WithFields(log.Fields{
			"_module":     "control-aplugin",
			"block":       "kill",
			"plugin_name": a,
			"pluginPath":  a.execPath,
		}).Debug("deleting available plugin package")
		os.RemoveAll(filepath.Dir(a.execPath))
	}

	// If it's a streaming plugin, we need to signal the scheduler that
	// this plugin is being killed.
	if c, ok := a.client.(client.PluginStreamCollectorClient); ok {
		c.Killed()
	}

	if a.ePlugin != nil {
		return a.ePlugin.Kill()
	}
	return nil
}
1076921
func (s *Server) Stop() {
	s.grpcServer.Stop()
	for i := len(s.plugins) - 1; i >= 0; i-- {
		p := s.plugins[i]
		instance, err := p.Instance()
		if err != nil {
			log.L.WithError(err).WithField("id", p.Registration.ID).
				Errorf("could not get plugin instance")
			continue
		}
		closer, ok := instance.(io.Closer)
		if !ok {
			continue
		}
		if err := closer.Close(); err != nil {
			log.L.WithError(err).WithField("id", p.Registration.ID).
				Errorf("failed to close plugin")
		}
	}
}
700932
func (r *Runhcs) Kill(context context.Context, id, signal string) error {
	return r.runOrError(r.command(context, "kill", id, signal))
}
1157760
func (lifecycle *Lifecycle) Kill() {
	lifecycle.mutex.Lock()
	lifecycle.killFlag = true
	lifecycle.mutex.Unlock()
}
543924
func (p *Plugin) Close() error {
	for _, pr := range p.processes {
		if pr.cancelChan != nil {
			close(pr.cancelChan)
		}
	}
	return nil
}
145265
func (daemon *Daemon) ContainerKill(name string, sig uint64) error {
	container, err := daemon.GetContainer(name)
	if err != nil {
		return err
	}

	if sig != 0 && !signal.ValidSignalForPlatform(syscall.Signal(sig)) {
		return fmt.Errorf("The %s daemon does not support signal %d", runtime.GOOS, sig)
	}

	// If no signal is passed, or SIGKILL, perform regular Kill (SIGKILL + wait())
	if sig == 0 || syscall.Signal(sig) == syscall.SIGKILL {
		return daemon.Kill(container)
	}
	return daemon.killWithSignal(container, int(sig))
}
90338
func Kill() error {
	p, err := os.FindProcess(os.Getpid())
	if err != nil {
		return err
	}
	return p.Signal(syscall.SIGTERM)
}
1361757
func (t *Task) Kill(ctx context.Context, signal uint32, all bool) error {
	if _, err := t.shim.Kill(ctx, &shim.KillRequest{
		ID:     t.id,
		Signal: signal,
		All:    all,
	}); err != nil {
		return errdefs.FromGRPC(err)
	}
	return nil
}
35652
func (s *Service) Kill(ctx context.Context, signal string) error {
	return s.collectContainersAndDo(ctx, func(c *container.Container) error {
		return c.Kill(ctx, signal)
	})
}
1099197
func (e *EmptyService) Kill(ctx context.Context, signal string) error {
	return nil
}
722921
func (process *Process) Kill() (_ bool, err error) {
	process.handleLock.RLock()
	defer process.handleLock.RUnlock()

	operation := "hcsshim::Process::Kill"
	process.logOperationBegin(operation)
	defer func() { process.logOperationEnd(operation, err) }()

	if process.handle == 0 {
		return false, makeProcessError(process, operation, ErrAlreadyClosed, nil)
	}

	var resultp *uint16
	syscallWatcher(process.logctx, func() {
		err = hcsTerminateProcess(process.handle, &resultp)
	})
	events := processHcsResult(resultp)
	delivered, err := process.processSignalResult(err)
	if err != nil {
		err = makeProcessError(process, operation, err, events)
	}
	return delivered, err
}
1115359
func (k8s *Kubernetes) Kill(qorJob worker.QorJobInterface) error {
	var (
		k8sJob, err = k8s.GetJobSpec(qorJob)
		jobName     = fmt.Sprintf("qor-job-%v", qorJob.GetJobID())
	)

	if err == nil {
		return k8s.Clientset.Batch().Jobs(k8sJob.ObjectMeta.GetNamespace()).Delete(jobName, &metav1.DeleteOptions{})
	}
	return err
}
1288573
func (k *K8sAPIExecutor) Kill(containerIDs []string) error {
	log.Infof("Killing containers %s", containerIDs)
	for _, containerID := range containerIDs {
		err := k.client.killGracefully(containerID)
		if err != nil {
			return err
		}
	}
	return nil
}
340005
func (p *Process) Kill(ctx context.Context, signal uint32, _ bool) error {
	_, err := p.t.shim.Kill(ctx, &shim.KillRequest{
		Signal: signal,
		ID:     p.id,
	})
	if err != nil {
		return errdefs.FromGRPC(err)
	}
	return err
}
1364749
func (c *Client) ClientKill(ip string, port uint) (string, error) {
	var ret string
	err := c.command(
		&ret,
		[]byte("CLIENT"),
		[]byte("KILL"),
		to.Bytes(fmt.Sprintf("%s:%d", ip, port)),
	)
	return ret, err
}
928371
func (a *availablePlugin) Stop(r string) error {
	log.WithFields(log.Fields{
		"_module":     "control-aplugin",
		"block":       "stop",
		"plugin_name": a,
	}).Info("stopping available plugin")
	if a.IsRemote() {
		return a.client.Close()
	}
	return a.client.Kill(r)
}
286661
func KillProcess(pid int) {
	p, err := os.FindProcess(pid)
	if err == nil {
		p.Kill()
	}
}