mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
This replaces five implementations scattered across low level packages. (And I plan to use it in a sixth soon.) Three of the five were byte-for-byte identical. Change-Id: I3bbbeeac63723a487986c912b604e10ad1e042f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/301549 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
23 lines
443 B
Go
23 lines
443 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build plan9
|
|
// +build plan9
|
|
|
|
package os
|
|
|
|
import (
|
|
"internal/itoa"
|
|
"syscall"
|
|
)
|
|
|
|
func executable() (string, error) {
|
|
fn := "/proc/" + itoa.Itoa(Getpid()) + "/text"
|
|
f, err := Open(fn)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
defer f.Close()
|
|
return syscall.Fd2path(int(f.Fd()))
|
|
}
|