...
Run Format

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  // +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  }
    20  

View as plain text