Black Lives Matter. Support the Equal Justice Initiative.

Source file src/os/executable_plan9.go

Documentation: os

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

View as plain text