osext_plan9.go 375 B

12345678910111213141516
  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. package osext
  5. import "syscall"
  6. func executable() (string, error) {
  7. f, err := Open("/proc/" + itoa(Getpid()) + "/text")
  8. if err != nil {
  9. return "", err
  10. }
  11. defer f.Close()
  12. return syscall.Fd2path(int(f.Fd()))
  13. }