$51 GRAYBYTE WORDPRESS FILE MANAGER $41

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/golang/src/os/

HOME
Current File : /usr/lib/golang/src/os//executable_path.go
// Copyright 2017 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 aix || openbsd

package os

// We query the working directory at init, to use it later to search for the
// executable file
// errWd will be checked later, if we need to use initWd
var initWd, errWd = Getwd()

func executable() (string, error) {
	var exePath string
	if len(Args) == 0 || Args[0] == "" {
		return "", ErrNotExist
	}
	if IsPathSeparator(Args[0][0]) {
		// Args[0] is an absolute path, so it is the executable.
		// Note that we only need to worry about Unix paths here.
		exePath = Args[0]
	} else {
		for i := 1; i < len(Args[0]); i++ {
			if IsPathSeparator(Args[0][i]) {
				// Args[0] is a relative path: prepend the
				// initial working directory.
				if errWd != nil {
					return "", errWd
				}
				exePath = initWd + string(PathSeparator) + Args[0]
				break
			}
		}
	}
	if exePath != "" {
		if err := isExecutable(exePath); err != nil {
			return "", err
		}
		return exePath, nil
	}
	// Search for executable in $PATH.
	for _, dir := range splitPathList(Getenv("PATH")) {
		if len(dir) == 0 {
			dir = "."
		}
		if !IsPathSeparator(dir[0]) {
			if errWd != nil {
				return "", errWd
			}
			dir = initWd + string(PathSeparator) + dir
		}
		exePath = dir + string(PathSeparator) + Args[0]
		switch isExecutable(exePath) {
		case nil:
			return exePath, nil
		case ErrPermission:
			return "", ErrPermission
		}
	}
	return "", ErrNotExist
}

// isExecutable returns an error if a given file is not an executable.
func isExecutable(path string) error {
	stat, err := Stat(path)
	if err != nil {
		return err
	}
	mode := stat.Mode()
	if !mode.IsRegular() {
		return ErrPermission
	}
	if (mode & 0111) == 0 {
		return ErrPermission
	}
	return nil
}

// splitPathList splits a path list.
// This is based on genSplit from strings/strings.go
func splitPathList(pathList string) []string {
	if pathList == "" {
		return nil
	}
	n := 1
	for i := 0; i < len(pathList); i++ {
		if pathList[i] == PathListSeparator {
			n++
		}
	}
	start := 0
	a := make([]string, n)
	na := 0
	for i := 0; i+1 <= len(pathList) && na+1 < n; i++ {
		if pathList[i] == PathListSeparator {
			a[na] = pathList[start:i]
			na++
			start = i + 1
		}
	}
	a[na] = pathList[start:]
	return a[:na+1]
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.30 PM
root / root
0755
exec
--
16 Dec 2025 9.30 PM
root / root
0755
signal
--
16 Dec 2025 9.30 PM
root / root
0755
user
--
16 Dec 2025 9.30 PM
root / root
0755
dir.go
5.935 KB
4 Dec 2025 6.06 PM
root / root
0644
dir_darwin.go
3.498 KB
4 Dec 2025 6.06 PM
root / root
0644
dir_plan9.go
2.189 KB
4 Dec 2025 6.06 PM
root / root
0644
dir_unix.go
4.846 KB
4 Dec 2025 6.06 PM
root / root
0644
dir_windows.go
7.684 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_aix.go
0.741 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_dragonfly.go
1.279 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_freebsd.go
1.159 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_js.go
0.662 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_linux.go
1.184 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_netbsd.go
1.159 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_openbsd.go
1.159 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_solaris.go
0.741 KB
4 Dec 2025 6.06 PM
root / root
0644
dirent_wasip1.go
1.355 KB
4 Dec 2025 6.06 PM
root / root
0644
eloop_netbsd.go
0.496 KB
4 Dec 2025 6.06 PM
root / root
0644
eloop_other.go
0.646 KB
4 Dec 2025 6.06 PM
root / root
0644
env.go
3.854 KB
4 Dec 2025 6.06 PM
root / root
0644
error.go
4.796 KB
4 Dec 2025 6.06 PM
root / root
0644
error_errno.go
0.334 KB
4 Dec 2025 6.06 PM
root / root
0644
error_plan9.go
0.395 KB
4 Dec 2025 6.06 PM
root / root
0644
exec.go
11.473 KB
4 Dec 2025 6.06 PM
root / root
0644
exec_linux.go
0.263 KB
4 Dec 2025 6.06 PM
root / root
0644
exec_nohandle.go
0.296 KB
4 Dec 2025 6.06 PM
root / root
0644
exec_plan9.go
3.231 KB
4 Dec 2025 6.06 PM
root / root
0644
exec_posix.go
3.71 KB
4 Dec 2025 6.06 PM
root / root
0644
exec_unix.go
3.323 KB
4 Dec 2025 6.06 PM
root / root
0644
exec_windows.go
4.677 KB
4 Dec 2025 6.06 PM
root / root
0644
executable.go
0.758 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_darwin.go
0.659 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_dragonfly.go
0.362 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_freebsd.go
0.361 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_netbsd.go
0.364 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_path.go
2.309 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_plan9.go
0.417 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_procfs.go
0.643 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_solaris.go
0.739 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_sysctl.go
0.835 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_wasm.go
0.325 KB
4 Dec 2025 6.06 PM
root / root
0644
executable_windows.go
0.626 KB
4 Dec 2025 6.06 PM
root / root
0644
file.go
29.511 KB
4 Dec 2025 6.06 PM
root / root
0644
file_mutex_plan9.go
1.809 KB
4 Dec 2025 6.06 PM
root / root
0644
file_open_unix.go
0.388 KB
4 Dec 2025 6.06 PM
root / root
0644
file_open_wasip1.go
0.799 KB
4 Dec 2025 6.06 PM
root / root
0644
file_plan9.go
15.686 KB
4 Dec 2025 6.06 PM
root / root
0644
file_posix.go
7.47 KB
4 Dec 2025 6.06 PM
root / root
0644
file_unix.go
13.718 KB
4 Dec 2025 6.06 PM
root / root
0644
file_wasip1.go
0.618 KB
4 Dec 2025 6.06 PM
root / root
0644
file_windows.go
13.51 KB
4 Dec 2025 6.06 PM
root / root
0644
getwd.go
3.71 KB
4 Dec 2025 6.06 PM
root / root
0644
path.go
2.307 KB
4 Dec 2025 6.06 PM
root / root
0644
path_plan9.go
0.433 KB
4 Dec 2025 6.06 PM
root / root
0644
path_unix.go
1.155 KB
4 Dec 2025 6.06 PM
root / root
0644
path_windows.go
5.943 KB
4 Dec 2025 6.06 PM
root / root
0644
pidfd_linux.go
5.879 KB
4 Dec 2025 6.06 PM
root / root
0644
pidfd_other.go
0.662 KB
4 Dec 2025 6.06 PM
root / root
0644
pipe2_unix.go
0.639 KB
4 Dec 2025 6.06 PM
root / root
0644
pipe_unix.go
0.756 KB
4 Dec 2025 6.06 PM
root / root
0644
pipe_wasm.go
0.477 KB
4 Dec 2025 6.06 PM
root / root
0644
proc.go
2.272 KB
4 Dec 2025 6.06 PM
root / root
0644
rawconn.go
0.97 KB
4 Dec 2025 6.06 PM
root / root
0644
removeall_at.go
4.783 KB
4 Dec 2025 6.06 PM
root / root
0644
removeall_noat.go
3.145 KB
4 Dec 2025 6.06 PM
root / root
0644
removeall_unix.go
0.469 KB
4 Dec 2025 6.06 PM
root / root
0644
removeall_windows.go
0.383 KB
4 Dec 2025 6.06 PM
root / root
0644
root.go
13.48 KB
4 Dec 2025 6.06 PM
root / root
0644
root_js.go
2.602 KB
4 Dec 2025 6.06 PM
root / root
0644
root_nonwindows.go
0.275 KB
4 Dec 2025 6.06 PM
root / root
0644
root_noopenat.go
7.861 KB
4 Dec 2025 6.06 PM
root / root
0644
root_openat.go
11.419 KB
4 Dec 2025 6.06 PM
root / root
0644
root_plan9.go
0.485 KB
4 Dec 2025 6.06 PM
root / root
0644
root_unix.go
8.497 KB
4 Dec 2025 6.06 PM
root / root
0644
root_windows.go
12.229 KB
4 Dec 2025 6.06 PM
root / root
0644
stat.go
0.95 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_aix.go
1.211 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_darwin.go
1.122 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_dragonfly.go
1.096 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_freebsd.go
1.105 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_js.go
1.147 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_linux.go
1.096 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_netbsd.go
1.105 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_openbsd.go
1.096 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_plan9.go
2.375 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_solaris.go
1.337 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_unix.go
1.215 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_wasip1.go
1.241 KB
4 Dec 2025 6.06 PM
root / root
0644
stat_windows.go
5.356 KB
4 Dec 2025 6.06 PM
root / root
0644
sticky_bsd.go
0.415 KB
4 Dec 2025 6.06 PM
root / root
0644
sticky_notbsd.go
0.313 KB
4 Dec 2025 6.06 PM
root / root
0644
sys.go
0.287 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_aix.go
0.666 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_bsd.go
0.455 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_js.go
0.306 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_linux.go
1.045 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_plan9.go
0.442 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_solaris.go
0.259 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_unix.go
0.481 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_wasip1.go
0.302 KB
4 Dec 2025 6.06 PM
root / root
0644
sys_windows.go
0.854 KB
4 Dec 2025 6.06 PM
root / root
0644
tempfile.go
3.921 KB
4 Dec 2025 6.06 PM
root / root
0644
types.go
2.858 KB
4 Dec 2025 6.06 PM
root / root
0644
types_plan9.go
0.778 KB
4 Dec 2025 6.06 PM
root / root
0644
types_unix.go
0.758 KB
4 Dec 2025 6.06 PM
root / root
0644
types_windows.go
11.714 KB
4 Dec 2025 6.06 PM
root / root
0644
wait6_dragonfly.go
0.484 KB
4 Dec 2025 6.06 PM
root / root
0644
wait6_freebsd64.go
0.534 KB
4 Dec 2025 6.06 PM
root / root
0644
wait6_freebsd_386.go
0.531 KB
4 Dec 2025 6.06 PM
root / root
0644
wait6_freebsd_arm.go
0.536 KB
4 Dec 2025 6.06 PM
root / root
0644
wait6_netbsd.go
0.521 KB
4 Dec 2025 6.06 PM
root / root
0644
wait_unimp.go
0.812 KB
4 Dec 2025 6.06 PM
root / root
0644
wait_wait6.go
0.773 KB
4 Dec 2025 6.06 PM
root / root
0644
wait_waitid.go
1.033 KB
4 Dec 2025 6.06 PM
root / root
0644
zero_copy_freebsd.go
1.323 KB
4 Dec 2025 6.06 PM
root / root
0644
zero_copy_linux.go
3.755 KB
4 Dec 2025 6.06 PM
root / root
0644
zero_copy_posix.go
1.065 KB
4 Dec 2025 6.06 PM
root / root
0644
zero_copy_solaris.go
2.568 KB
4 Dec 2025 6.06 PM
root / root
0644
zero_copy_stub.go
0.42 KB
4 Dec 2025 6.06 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF