executable_plan9.go 427 B

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