github.com/qorio/etcd@v0.1.2-0.20131003183127-5cc585af9618/third_party/bitbucket.org/kardianos/osext/osext_procfs.go (about)

     1  // Copyright 2012 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build linux netbsd openbsd
     6  
     7  package osext
     8  
     9  import (
    10  	"errors"
    11  	"os"
    12  	"runtime"
    13  )
    14  
    15  func executable() (string, error) {
    16  	switch runtime.GOOS {
    17  	case "linux":
    18  		return os.Readlink("/proc/self/exe")
    19  	case "netbsd":
    20  		return os.Readlink("/proc/curproc/exe")
    21  	case "openbsd":
    22  		return os.Readlink("/proc/curproc/file")
    23  	}
    24  	return "", errors.New("ExecPath not implemented for " + runtime.GOOS)
    25  }