Files
agent/proc_nowin.go
Andrew Martinez 370c252b6b allows windows machines to use agent controller init
gops in Windows stores socket files in %TEMP% which is user specific
(e.g.C:\Users\user1\AppData\Local\Temp\gops-agent.19372.sock). For
windows instead of relying on sig(0) for a ping we assume writability.
2023-10-17 14:32:02 -04:00

31 lines
733 B
Go

//go:build !windows
/*
Copyright NetFoundry Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package agent
import (
"os"
"syscall"
)
func isReachable(proc *os.Process) bool {
err := proc.Signal(syscall.Signal(0))
return err == nil
}