1*2810ac1bSKiyoung Kim// +build !go1.10 2*2810ac1bSKiyoung Kim 3*2810ac1bSKiyoung Kimpackage cap 4*2810ac1bSKiyoung Kim 5*2810ac1bSKiyoung Kimimport "syscall" 6*2810ac1bSKiyoung Kim 7*2810ac1bSKiyoung Kim// LaunchSupported indicates that is safe to return from a locked OS 8*2810ac1bSKiyoung Kim// Thread and have that OS Thread be terminated by the runtime. The 9*2810ac1bSKiyoung Kim// Launch functionality really needs to rely on the fact that an 10*2810ac1bSKiyoung Kim// excess of runtime.LockOSThread() vs. runtime.UnlockOSThread() calls 11*2810ac1bSKiyoung Kim// in a returning go routine will cause the underlying locked OSThread 12*2810ac1bSKiyoung Kim// to terminate. That feature was added to the Go runtime in version 13*2810ac1bSKiyoung Kim// 1.10. 14*2810ac1bSKiyoung Kim// 15*2810ac1bSKiyoung Kim// See these bugs for the discussion and feature assumed by the code 16*2810ac1bSKiyoung Kim// in this Launch() functionality: 17*2810ac1bSKiyoung Kim// 18*2810ac1bSKiyoung Kim// https://github.com/golang/go/issues/20395 19*2810ac1bSKiyoung Kim// https://github.com/golang/go/issues/20458 20*2810ac1bSKiyoung Kim// 21*2810ac1bSKiyoung Kim// A value of false for this constant causes the Launch functionality 22*2810ac1bSKiyoung Kim// to fail with an error: cap.ErrNoLaunch. If this value is false you 23*2810ac1bSKiyoung Kim// have two choices with respect to the Launch functionality: 24*2810ac1bSKiyoung Kim// 25*2810ac1bSKiyoung Kim// 1) don't use cap.(*Launcher).Launch() 26*2810ac1bSKiyoung Kim// 2) upgrade your Go toolchain to 1.10+ (ie., do this one). 27*2810ac1bSKiyoung Kimconst LaunchSupported = false 28*2810ac1bSKiyoung Kim 29*2810ac1bSKiyoung Kim// validatePA confirms that the pa.Sys entry is not incompatible with 30*2810ac1bSKiyoung Kim// Launch. 31*2810ac1bSKiyoung Kimfunc validatePA(pa *syscall.ProcAttr, chroot string) (bool, error) { 32*2810ac1bSKiyoung Kim return false, ErrNoLaunch 33*2810ac1bSKiyoung Kim} 34