github.com/rakyll/go@v0.0.0-20170216000551-64c02460d703/src/os/executable_plan9.go (about)

     1  // Copyright 2016 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 plan9
     6  
     7  package os
     8  
     9  import "syscall"
    10  
    11  func executable() (string, error) {
    12  	fn := "/proc/" + itoa(Getpid()) + "/text"
    13  	f, err := Open(fn)
    14  	if err != nil {
    15  		return "", err
    16  	}
    17  	defer f.Close()
    18  	return syscall.Fd2path(int(f.Fd()))
    19  }