github.com/ice-blockchain/go/src@v0.0.0-20240403114104-1564d284e521/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  //go:build plan9
     6  
     7  package os
     8  
     9  import (
    10  	"internal/itoa"
    11  	"syscall"
    12  )
    13  
    14  func executable() (string, error) {
    15  	fn := "/proc/" + itoa.Itoa(Getpid()) + "/text"
    16  	f, err := Open(fn)
    17  	if err != nil {
    18  		return "", err
    19  	}
    20  	defer f.Close()
    21  	return syscall.Fd2path(int(f.Fd()))
    22  }