upgrade deps, clean up (#83)
This commit is contained in:
parent
5aeffe7a0c
commit
9adade7502
.github/workflows
gauth.gogauth
go.modgo.sumvendor
github.com/creachadair
golang.org/x/sys
LICENSE
internal/unsafeheader
plan9
pwd_go15_plan9.gopwd_plan9.gorace.gorace0.gostr.gosyscall.gozsyscall_plan9_386.gozsyscall_plan9_amd64.gozsyscall_plan9_arm.go
unix
README.mdaliases.goasm_aix_ppc64.sasm_bsd_386.sasm_bsd_amd64.sasm_bsd_arm.sasm_bsd_arm64.sasm_bsd_ppc64.sasm_bsd_riscv64.sasm_linux_386.sasm_linux_amd64.sasm_linux_arm.sasm_linux_arm64.sasm_linux_loong64.sasm_linux_mips64x.sasm_linux_mipsx.sasm_linux_ppc64x.sasm_linux_riscv64.sasm_linux_s390x.sasm_openbsd_mips64.sasm_solaris_amd64.sasm_zos_s390x.sauxv.goauxv_unsupported.gobpxsvc_zos.gobpxsvc_zos.scap_freebsd.goconstants.godev_aix_ppc.godev_aix_ppc64.godev_zos.godirent.goendian_big.goendian_little.goenv_unix.goepoll_zos.gofcntl.gofcntl_linux_32bit.gofdset.gofstatfs_zos.gogccgo.gogccgo_c.cgccgo_linux_amd64.goifreq_linux.goioctl_linux.goioctl_signed.goioctl_unsigned.goioctl_zos.gomkall.shmkerrors.shmmap_nomremap.gomremap.gopagesize_unix.gopledge_openbsd.goptrace_darwin.goptrace_ios.gorace.gorace0.goreaddirent_getdents.goreaddirent_getdirentries.gosockcmsg_unix.gosockcmsg_unix_other.gosockcmsg_zos.gosymaddr_zos_s390x.ssyscall.gosyscall_aix.gosyscall_aix_ppc.gosyscall_aix_ppc64.gosyscall_bsd.gosyscall_darwin.gosyscall_darwin_amd64.gosyscall_darwin_arm64.gosyscall_darwin_libSystem.gosyscall_dragonfly.go
4
.github/workflows/go-presubmit.yml
vendored
4
.github/workflows/go-presubmit.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: ['1.21', 'stable']
|
go-version: ["1.23", "stable"]
|
||||||
steps:
|
steps:
|
||||||
- name: Install Go ${{ matrix.go-version }}
|
- name: Install Go ${{ matrix.go-version }}
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
@ -22,4 +22,4 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: creachadair/go-presubmit-action@v2
|
- uses: creachadair/go-presubmit-action@v2
|
||||||
with:
|
with:
|
||||||
staticcheck-version: "2023.1.6"
|
staticcheck-version: "2024.1.1"
|
||||||
|
4
.github/workflows/goreleaser.yml
vendored
4
.github/workflows/goreleaser.yml
vendored
@ -5,7 +5,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- "*"
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, reopened, synchronize]
|
types: [opened, reopened, synchronize]
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.21
|
go-version: 1.23
|
||||||
|
|
||||||
- name: Run GoReleaser release (SKIP publish)
|
- name: Run GoReleaser release (SKIP publish)
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
|
440
gauth.go
440
gauth.go
@ -1,3 +1,4 @@
|
|||||||
|
// Package main implements a command-line TOTP (Time-based One-Time Password) generator
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -5,259 +6,392 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/creachadair/otp/otpauth"
|
"github.com/creachadair/otp/otpauth"
|
||||||
"github.com/pcarrier/gauth/gauth"
|
"github.com/pcarrier/gauth/gauth"
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
type command struct {
|
||||||
accountName := ""
|
name string
|
||||||
argument := ""
|
shortFlag string
|
||||||
|
longFlags []string
|
||||||
|
description string
|
||||||
|
handler func(string, []*otpauth.URL)
|
||||||
|
}
|
||||||
|
|
||||||
if len(os.Args) > 1 {
|
var commands = []command{
|
||||||
|
{
|
||||||
|
name: "bare",
|
||||||
|
shortFlag: "-b",
|
||||||
|
longFlags: []string{"-bare", "--bare"},
|
||||||
|
description: "Print bare code for account",
|
||||||
|
handler: func(acc string, urls []*otpauth.URL) { printBareCode(acc, urls) },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "add",
|
||||||
|
shortFlag: "-a",
|
||||||
|
longFlags: []string{"-add", "--add"},
|
||||||
|
description: "Add new account",
|
||||||
|
handler: func(acc string, _ []*otpauth.URL) { addCode(acc) },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "remove",
|
||||||
|
shortFlag: "-r",
|
||||||
|
longFlags: []string{"-remove", "--remove"},
|
||||||
|
description: "Remove account",
|
||||||
|
handler: func(acc string, _ []*otpauth.URL) { removeCode(acc) },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "secret",
|
||||||
|
shortFlag: "-s",
|
||||||
|
longFlags: []string{"-secret", "--secret"},
|
||||||
|
description: "Show secret for account",
|
||||||
|
handler: func(acc string, urls []*otpauth.URL) { printSecret(acc, urls) },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
cachedRaw []byte
|
||||||
|
cachedUrls []*otpauth.URL
|
||||||
|
)
|
||||||
|
|
||||||
|
func findCommand(arg string) *command {
|
||||||
|
for i := range commands {
|
||||||
|
if arg == commands[i].shortFlag {
|
||||||
|
return &commands[i]
|
||||||
|
}
|
||||||
|
for _, f := range commands[i].longFlags {
|
||||||
|
if arg == f {
|
||||||
|
return &commands[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func printUsage() {
|
||||||
|
fmt.Println("Usage: gauth [account] [command]")
|
||||||
|
fmt.Println("\nCommands:")
|
||||||
|
for _, cmd := range commands {
|
||||||
|
flags := append([]string{cmd.shortFlag}, cmd.longFlags...)
|
||||||
|
fmt.Printf(" %-25s %s\n", strings.Join(flags, ", "), cmd.description)
|
||||||
|
}
|
||||||
|
fmt.Println("\nExamples:")
|
||||||
|
fmt.Println(" gauth # Show all codes")
|
||||||
|
fmt.Println(" gauth github # Show codes for an account (partial matches supported)")
|
||||||
|
fmt.Println(" gauth github -b # Show current code for an account")
|
||||||
|
fmt.Println(" gauth github --add # Add new account")
|
||||||
|
}
|
||||||
|
|
||||||
|
func isHelpFlag(arg string) bool {
|
||||||
|
return arg == "-h" || arg == "--help"
|
||||||
|
}
|
||||||
|
|
||||||
|
func shouldShowHelp() bool {
|
||||||
|
for _, a := range os.Args[1:] {
|
||||||
|
if isHelpFlag(a) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cfgPath := getConfigPath()
|
||||||
|
if _, err := os.Stat(cfgPath); os.IsNotExist(err) {
|
||||||
|
// Show help if no config exists unless the user is adding a new account.
|
||||||
|
if len(os.Args) > 2 {
|
||||||
|
if cmd := findCommand(os.Args[2]); cmd != nil && cmd.name == "add" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Printf("No config file found at %s\n\n", cfgPath)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func matchAccount(pattern, account string) bool {
|
||||||
|
return strings.Contains(strings.ToLower(account), strings.ToLower(pattern))
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if shouldShowHelp() {
|
||||||
|
printUsage()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var accountName string
|
||||||
|
if len(os.Args) > 1 && !isHelpFlag(os.Args[1]) {
|
||||||
accountName = os.Args[1]
|
accountName = os.Args[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle commands or show all codes
|
||||||
|
var cmd *command
|
||||||
if len(os.Args) > 2 {
|
if len(os.Args) > 2 {
|
||||||
if os.Args[2] == "-b" || os.Args[2] == "-bare" {
|
cmd = findCommand(os.Args[2])
|
||||||
argument = "bare"
|
|
||||||
} else if os.Args[2] == "-a" || os.Args[2] == "-add" {
|
|
||||||
argument = "add"
|
|
||||||
} else if os.Args[2] == "-r" || os.Args[2] == "-remove" {
|
|
||||||
argument = "remove"
|
|
||||||
} else if os.Args[2] == "-s" || os.Args[2] == "-secret" {
|
|
||||||
argument = "secret"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if accountName != "" {
|
if cmd != nil {
|
||||||
switch argument {
|
var urls []*otpauth.URL
|
||||||
case "bare":
|
if cmd.name != "add" {
|
||||||
printBareCode(accountName, getUrls())
|
// Only load existing URLs if we're not adding a new account
|
||||||
return
|
urls = getUrls()
|
||||||
case "add":
|
|
||||||
addCode(accountName)
|
|
||||||
return
|
|
||||||
case "remove":
|
|
||||||
removeCode(accountName)
|
|
||||||
return
|
|
||||||
case "secret":
|
|
||||||
printSecret(accountName, getUrls())
|
|
||||||
return
|
|
||||||
default:
|
|
||||||
printAllCodes(getUrls())
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
cmd.handler(accountName, urls)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default behavior
|
||||||
printAllCodes(getUrls())
|
printAllCodes(getUrls())
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPassword() ([]byte, error) {
|
func getPassword() ([]byte, error) {
|
||||||
fmt.Printf("Encryption password: ")
|
fmt.Print("Encryption password: ")
|
||||||
defer fmt.Println()
|
defer fmt.Println()
|
||||||
return term.ReadPassword(int(syscall.Stdin))
|
return term.ReadPassword(int(syscall.Stdin))
|
||||||
}
|
}
|
||||||
|
|
||||||
func getConfigPath() string {
|
func getConfigPath() string {
|
||||||
cfgPath := os.Getenv("GAUTH_CONFIG")
|
if cfg := os.Getenv("GAUTH_CONFIG"); cfg != "" {
|
||||||
if cfgPath == "" {
|
return cfg
|
||||||
user, err := user.Current()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
cfgPath = filepath.Join(user.HomeDir, ".config", "gauth.csv")
|
home, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Getting home directory: %v", err)
|
||||||
|
}
|
||||||
|
return filepath.Join(home, ".config", "gauth.csv")
|
||||||
}
|
}
|
||||||
|
|
||||||
return cfgPath
|
func loadConfig() error {
|
||||||
|
if cachedRaw != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
cfgPath := getConfigPath()
|
||||||
|
raw, err := gauth.LoadConfigFile(cfgPath, getPassword)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("loading config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
urls, err := gauth.ParseConfig(raw)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("parsing config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
cachedRaw = raw
|
||||||
|
cachedUrls = urls
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUrls() []*otpauth.URL {
|
func getUrls() []*otpauth.URL {
|
||||||
cfgPath := getConfigPath()
|
if err := loadConfig(); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
cfgContent, err := gauth.LoadConfigFile(cfgPath, getPassword)
|
}
|
||||||
if err != nil {
|
return cachedUrls
|
||||||
log.Fatalf("Loading config: %v", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
urls, err := gauth.ParseConfig(cfgContent)
|
func getRawConfig() []byte {
|
||||||
if err != nil {
|
if err := loadConfig(); err != nil {
|
||||||
log.Fatalf("Decoding configuration file: %v", err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
return cachedRaw
|
||||||
return urls
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func printBareCode(accountName string, urls []*otpauth.URL) {
|
func printBareCode(accountName string, urls []*otpauth.URL) {
|
||||||
for _, url := range urls {
|
for _, url := range urls {
|
||||||
if strings.EqualFold(strings.ToLower(accountName), strings.ToLower(url.Account)) {
|
if matchAccount(accountName, url.Account) {
|
||||||
_, curr, _, err := gauth.Codes(url)
|
_, curr, _, err := gauth.Codes(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Generating codes for %q: %v", url.Account, err)
|
log.Fatalf("Generating codes for %q: %v", url.Account, err)
|
||||||
}
|
}
|
||||||
fmt.Print(curr)
|
fmt.Print(curr)
|
||||||
break
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func printSecret(accountName string, urls []*otpauth.URL) {
|
||||||
|
for _, url := range urls {
|
||||||
|
if matchAccount(accountName, url.Account) {
|
||||||
|
fmt.Print(url.RawSecret)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func addCode(accountName string) {
|
func addCode(accountName string) {
|
||||||
cfgPath := getConfigPath()
|
cfgPath := getConfigPath()
|
||||||
|
if err := os.MkdirAll(filepath.Dir(cfgPath), 0700); err != nil {
|
||||||
// Check for encryption and ask for password if necessary
|
log.Fatalf("Creating config directory: %v", err)
|
||||||
_, isEncrypted, err := gauth.ReadConfigFile(cfgPath)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Reading config: %v", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
password, err := []byte(nil), nil
|
password, err := handleEncryption(cfgPath)
|
||||||
|
if err != nil && !os.IsNotExist(err) {
|
||||||
if isEncrypted {
|
log.Fatalf("Handling encryption: %v", err)
|
||||||
password, err = getPassword()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("reading passphrase: %v", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get decoded config
|
var rawConfig []byte
|
||||||
rawConfig, err := gauth.LoadConfigFile(cfgPath, func() ([]byte, error) { return password, err })
|
if _, statErr := os.Stat(cfgPath); os.IsNotExist(statErr) {
|
||||||
if err != nil {
|
rawConfig = []byte("")
|
||||||
log.Fatalf("Loading config: %v", err)
|
} else {
|
||||||
}
|
rawConfig = getRawConfig()
|
||||||
|
if accountExists(accountName, rawConfig) {
|
||||||
newConfig := strings.TrimSuffix(string(rawConfig), "\n")
|
fmt.Printf("Account %q already exists. Nothing added.\n", accountName)
|
||||||
|
|
||||||
// Check if account already exists
|
|
||||||
for _, line := range strings.Split(newConfig, "\n") {
|
|
||||||
if strings.HasPrefix(strings.ToLower(line), strings.ToLower(accountName)) {
|
|
||||||
fmt.Printf("Account \"%s\" already exists. Nothing has been added.", accountName)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read new key
|
key := readNewKey(accountName)
|
||||||
fmt.Printf("Key for %s: ", accountName)
|
newConfig := updateConfig(string(rawConfig), accountName, key)
|
||||||
reader := bufio.NewReader(os.Stdin)
|
if err := validateAndSaveConfig(cfgPath, password, newConfig, accountName); err != nil {
|
||||||
key, _ := reader.ReadString('\n')
|
log.Fatalf("Saving config: %v", err)
|
||||||
|
|
||||||
// Append new key
|
|
||||||
newConfig += "\n" + accountName + ":" + key + "\n"
|
|
||||||
|
|
||||||
// Try parsing the new config and print the current OTP
|
|
||||||
parsedConfig, err := gauth.ParseConfig([]byte(newConfig))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Parsing new config: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("Current OTP for %s: ", accountName)
|
|
||||||
printBareCode(accountName, parsedConfig)
|
|
||||||
|
|
||||||
// write new config
|
|
||||||
err = gauth.WriteConfigFile(cfgPath, password, []byte(newConfig))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Error writing new config: %v", err)
|
|
||||||
}
|
}
|
||||||
|
cachedRaw = nil // Invalidate cache
|
||||||
|
cachedUrls = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeCode(accountName string) {
|
func removeCode(accountName string) {
|
||||||
cfgPath := getConfigPath()
|
cfgPath := getConfigPath()
|
||||||
|
password, err := handleEncryption(cfgPath)
|
||||||
// Check for encryption and ask for password if necessary
|
|
||||||
_, isEncrypted, err := gauth.ReadConfigFile(cfgPath)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Reading config: %v", err)
|
log.Fatalf("Reading config: %v", err)
|
||||||
}
|
}
|
||||||
|
rawConfig := getRawConfig()
|
||||||
password, err := []byte(nil), nil
|
newConfig, removed := buildNewConfig(accountName, rawConfig)
|
||||||
|
if !removed {
|
||||||
if isEncrypted {
|
fmt.Printf("Account %q not found. Nothing removed.\n", accountName)
|
||||||
password, err = getPassword()
|
return
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Reading passphrase: %v", err)
|
|
||||||
}
|
}
|
||||||
|
if !confirmRemoval(accountName) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := gauth.WriteConfigFile(cfgPath, password, []byte(newConfig)); err != nil {
|
||||||
|
log.Fatalf("Error writing config: %v", err)
|
||||||
|
}
|
||||||
|
cachedRaw = nil
|
||||||
|
cachedUrls = nil
|
||||||
|
fmt.Printf("%s has been removed.\n", accountName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get decoded config
|
func buildNewConfig(accountName string, rawConfig []byte) (string, bool) {
|
||||||
rawConfig, err := gauth.LoadConfigFile(cfgPath, func() ([]byte, error) { return password, err })
|
var builder strings.Builder
|
||||||
if err != nil {
|
removed := false
|
||||||
log.Fatalf("Loading config: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
newConfig := ""
|
|
||||||
anythingRemoved := false
|
|
||||||
|
|
||||||
// Iterate over config lines and search for the one to be removed
|
|
||||||
for _, line := range strings.Split(string(rawConfig), "\n") {
|
for _, line := range strings.Split(string(rawConfig), "\n") {
|
||||||
trim := strings.TrimSpace(line)
|
trim := strings.TrimSpace(line)
|
||||||
if trim == "" {
|
if trim == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
parts := strings.SplitN(trim, ":", 2)
|
||||||
if strings.HasPrefix(strings.ToLower(trim), strings.ToLower(accountName)) {
|
if len(parts) > 0 {
|
||||||
anythingRemoved = true
|
accName := strings.TrimSpace(parts[0])
|
||||||
|
if matchAccount(accountName, accName) {
|
||||||
|
removed = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
}
|
||||||
newConfig += trim + "\n"
|
builder.WriteString(trim)
|
||||||
|
builder.WriteByte('\n')
|
||||||
|
}
|
||||||
|
return builder.String(), removed
|
||||||
}
|
}
|
||||||
|
|
||||||
if !anythingRemoved {
|
func confirmRemoval(accountName string) bool {
|
||||||
fmt.Printf("Account \"%s\" was not found. Nothing has been removed.", accountName)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prompt for confirmation
|
|
||||||
fmt.Printf("Are you sure you want to remove %s [y/N]: ", accountName)
|
fmt.Printf("Are you sure you want to remove %s [y/N]: ", accountName)
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
confirmation, _ := reader.ReadString('\n')
|
resp, _ := reader.ReadString('\n')
|
||||||
|
return strings.ToLower(strings.TrimSpace(resp)) == "y"
|
||||||
confirmation = strings.TrimSpace(confirmation)
|
|
||||||
|
|
||||||
if strings.ToLower(confirmation) != "y" {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the new config
|
func updateConfig(currentConfig, accountName, key string) string {
|
||||||
err = gauth.WriteConfigFile(cfgPath, password, []byte(newConfig))
|
var builder strings.Builder
|
||||||
|
builder.WriteString(strings.TrimSuffix(currentConfig, "\n"))
|
||||||
|
builder.WriteByte('\n')
|
||||||
|
builder.WriteString(accountName)
|
||||||
|
builder.WriteByte(':')
|
||||||
|
builder.WriteString(key)
|
||||||
|
builder.WriteByte('\n')
|
||||||
|
return builder.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateAndSaveConfig(cfgPath string, password []byte, newConfig, accountName string) error {
|
||||||
|
parsedCfg, err := gauth.ParseConfig([]byte(newConfig))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error writing new config: %v", err)
|
return fmt.Errorf("parsing new config: %v", err)
|
||||||
|
}
|
||||||
|
fmt.Printf("Current OTP for %s: ", accountName)
|
||||||
|
printBareCode(accountName, parsedCfg)
|
||||||
|
return gauth.WriteConfigFile(cfgPath, password, []byte(newConfig))
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("%s has been removed.", accountName)
|
func accountExists(accountName string, rawConfig []byte) bool {
|
||||||
|
for _, line := range strings.Split(string(rawConfig), "\n") {
|
||||||
|
trim := strings.TrimSpace(line)
|
||||||
|
if trim == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
parts := strings.SplitN(trim, ":", 2)
|
||||||
|
if len(parts) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if matchAccount(accountName, strings.TrimSpace(parts[0])) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func printSecret(accountName string, urls []*otpauth.URL) {
|
func handleEncryption(cfgPath string) ([]byte, error) {
|
||||||
for _, url := range urls {
|
_, isEncrypted, err := gauth.ReadConfigFile(cfgPath)
|
||||||
if strings.EqualFold(strings.ToLower(accountName), strings.ToLower(url.Account)) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
fmt.Print(url.RawSecret)
|
return nil, err
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
if !isEncrypted {
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
pass, err := getPassword()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("reading passphrase: %v", err)
|
||||||
|
}
|
||||||
|
return pass, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func printAllCodes(urls []*otpauth.URL) {
|
func printAllCodes(urls []*otpauth.URL) {
|
||||||
_, progress := gauth.IndexNow() // TODO: do this per-code
|
|
||||||
|
|
||||||
tw := tabwriter.NewWriter(os.Stdout, 0, 8, 1, ' ', 0)
|
tw := tabwriter.NewWriter(os.Stdout, 0, 8, 1, ' ', 0)
|
||||||
fmt.Fprintln(tw, "\tprev\tcurr\tnext")
|
if _, err := fmt.Fprintln(tw, "\tprev\tcurr\tnext\tprog"); err != nil {
|
||||||
|
log.Fatalf("Writing header: %v", err)
|
||||||
|
}
|
||||||
for _, url := range urls {
|
for _, url := range urls {
|
||||||
prev, curr, next, err := gauth.Codes(url)
|
prev, curr, next, err := gauth.Codes(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Generating codes for %q: %v", url.Account, err)
|
log.Fatalf("Generating codes for %q: %v", url.Account, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(tw, "%s\t%s\t%s\t%s\n", url.Account, prev, curr, next)
|
period := url.Period
|
||||||
|
if period == 0 {
|
||||||
|
period = gauth.DefaultPeriod
|
||||||
}
|
}
|
||||||
tw.Flush()
|
elapsed := int(time.Now().Unix() % int64(period))
|
||||||
fmt.Printf("[%-29s]\n", strings.Repeat("=", progress))
|
progress := makeProgressBar(elapsed, period)
|
||||||
|
if _, err := fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%s\n", url.Account, prev, curr, next, progress); err != nil {
|
||||||
|
log.Fatalf("Writing codes: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := tw.Flush(); err != nil {
|
||||||
|
log.Fatalf("Flushing output: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeProgressBar(elapsed, period int) string {
|
||||||
|
const width = 10
|
||||||
|
filled := int(float64(elapsed) / float64(period) * float64(width))
|
||||||
|
return "[" + strings.Repeat("=", filled) + strings.Repeat(" ", width-filled) + "]"
|
||||||
|
}
|
||||||
|
|
||||||
|
func readNewKey(accountName string) string {
|
||||||
|
fmt.Printf("Key for %s: ", accountName)
|
||||||
|
reader := bufio.NewReader(os.Stdin)
|
||||||
|
key, _ := reader.ReadString('\n')
|
||||||
|
return strings.TrimSpace(key)
|
||||||
}
|
}
|
||||||
|
218
gauth/gauth.go
218
gauth/gauth.go
@ -14,18 +14,20 @@ import (
|
|||||||
"hash"
|
"hash"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/creachadair/otp"
|
"github.com/creachadair/otp"
|
||||||
"github.com/creachadair/otp/otpauth"
|
"github.com/creachadair/otp/otpauth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IndexNow returns the current 30-second time step, and the number of seconds
|
const (
|
||||||
// remaining until it ends.
|
saltedPrefix = "Salted__"
|
||||||
func IndexNow() (uint64, int) {
|
aesKeySize = 16
|
||||||
t := time.Now().Unix()
|
DefaultPeriod = 30
|
||||||
return uint64(t / 30), int(t % 30)
|
blockSize = 16
|
||||||
}
|
saltOffset = 8
|
||||||
|
saltSize = 8 // 16 - saltOffset
|
||||||
|
minPadding = 1
|
||||||
|
)
|
||||||
|
|
||||||
// pickAlgorithm returns a constructor for the named hash function, or
|
// pickAlgorithm returns a constructor for the named hash function, or
|
||||||
// an error if the name is not a supported algorithm.
|
// an error if the name is not a supported algorithm.
|
||||||
@ -45,11 +47,10 @@ func pickAlgorithm(name string) (func() hash.Hash, error) {
|
|||||||
// Codes returns the previous, current, and next codes from u.
|
// Codes returns the previous, current, and next codes from u.
|
||||||
func Codes(u *otpauth.URL) (prev, curr, next string, _ error) {
|
func Codes(u *otpauth.URL) (prev, curr, next string, _ error) {
|
||||||
var ts uint64
|
var ts uint64
|
||||||
if u.Period > 0 {
|
if u.Period == 0 {
|
||||||
ts = otp.TimeWindow(u.Period)()
|
u.Period = DefaultPeriod
|
||||||
} else {
|
|
||||||
ts, _ = IndexNow()
|
|
||||||
}
|
}
|
||||||
|
ts = otp.TimeWindow(u.Period)()
|
||||||
return CodesAtTimeStep(u, ts)
|
return CodesAtTimeStep(u, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +84,7 @@ func ReadConfigFile(path string) ([]byte, bool, error) {
|
|||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if bytes.HasPrefix(data, []byte("Salted__")) {
|
if bytes.HasPrefix(data, []byte(saltedPrefix)) {
|
||||||
return data, true, nil // encrypted
|
return data, true, nil // encrypted
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,29 +95,33 @@ func ReadConfigFile(path string) ([]byte, bool, error) {
|
|||||||
// The getPass function is called to obtain a password if needed.
|
// The getPass function is called to obtain a password if needed.
|
||||||
func LoadConfigFile(path string, getPass func() ([]byte, error)) ([]byte, error) {
|
func LoadConfigFile(path string, getPass func() ([]byte, error)) ([]byte, error) {
|
||||||
data, isEncrypted, err := ReadConfigFile(path)
|
data, isEncrypted, err := ReadConfigFile(path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("reading config file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isEncrypted {
|
if !isEncrypted {
|
||||||
return data, nil // not encrypted
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support for 'openssl enc -aes-128-cbc -md sha256 -pass pass:'
|
|
||||||
passwd, err := getPass()
|
passwd, err := getPass()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("reading passphrase: %v", err)
|
return nil, fmt.Errorf("reading passphrase: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
salt := data[8:16]
|
return decryptConfig(data, passwd)
|
||||||
rest := data[16:]
|
}
|
||||||
salting := sha256.New()
|
|
||||||
salting.Write(passwd)
|
// decryptConfig handles the decryption of encrypted configuration data
|
||||||
salting.Write(salt)
|
func decryptConfig(data, passwd []byte) ([]byte, error) {
|
||||||
sum := salting.Sum(nil)
|
if len(data) < saltOffset+saltSize {
|
||||||
key := sum[:16]
|
return nil, errors.New("encrypted data too short")
|
||||||
iv := sum[16:]
|
}
|
||||||
|
|
||||||
|
salt := data[saltOffset : saltOffset+saltSize]
|
||||||
|
rest := data[saltOffset+saltSize:]
|
||||||
|
|
||||||
|
key, iv := deriveKeyAndIV(passwd, salt)
|
||||||
|
|
||||||
block, err := aes.NewCipher(key)
|
block, err := aes.NewCipher(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("creating cipher: %v", err)
|
return nil, fmt.Errorf("creating cipher: %v", err)
|
||||||
@ -125,116 +130,131 @@ func LoadConfigFile(path string, getPass func() ([]byte, error)) ([]byte, error)
|
|||||||
mode := cipher.NewCBCDecrypter(block, iv)
|
mode := cipher.NewCBCDecrypter(block, iv)
|
||||||
mode.CryptBlocks(rest, rest)
|
mode.CryptBlocks(rest, rest)
|
||||||
|
|
||||||
// Remove CBC padding and verify that the key was valid.
|
return removePadding(rest)
|
||||||
pad := int(rest[len(rest)-1])
|
}
|
||||||
if pad == 0 || pad > len(rest) {
|
|
||||||
|
// deriveKeyAndIV generates the key and IV from password and salt
|
||||||
|
func deriveKeyAndIV(passwd, salt []byte) (key, iv []byte) {
|
||||||
|
salting := sha256.New()
|
||||||
|
salting.Write(passwd)
|
||||||
|
salting.Write(salt)
|
||||||
|
sum := salting.Sum(nil)
|
||||||
|
return sum[:blockSize], sum[blockSize:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// removePadding removes and validates PKCS#7 padding
|
||||||
|
func removePadding(data []byte) ([]byte, error) {
|
||||||
|
if len(data) == 0 {
|
||||||
|
return nil, errors.New("empty data")
|
||||||
|
}
|
||||||
|
|
||||||
|
pad := int(data[len(data)-1])
|
||||||
|
if pad < minPadding || pad > blockSize || pad > len(data) {
|
||||||
return nil, errors.New("invalid decryption key")
|
return nil, errors.New("invalid decryption key")
|
||||||
}
|
}
|
||||||
for i := len(rest) - pad; i < len(rest); i++ {
|
|
||||||
if int(rest[i]) != pad {
|
for i := len(data) - pad; i < len(data); i++ {
|
||||||
|
if int(data[i]) != pad {
|
||||||
return nil, errors.New("invalid block padding")
|
return nil, errors.New("invalid block padding")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rest[:len(rest)-pad], nil
|
|
||||||
|
return data[:len(data)-pad], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteConfigFile encrypts the provided newConfig using passwd, if necessary,
|
// WriteConfigFile encrypts the provided newConfig using passwd, if necessary,
|
||||||
// and writes it to path
|
// and writes it to path
|
||||||
func WriteConfigFile(path string, passwd []byte, newConfig []byte) error {
|
func WriteConfigFile(path string, passwd []byte, newConfig []byte) error {
|
||||||
data, isEncrypted, err := ReadConfigFile(path)
|
data, isEncrypted, err := ReadConfigFile(path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
if os.IsNotExist(err) {
|
||||||
|
// If the file doesn't exist, treat it as non-encrypted
|
||||||
|
isEncrypted = false
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("reading config file: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if isEncrypted {
|
if !isEncrypted {
|
||||||
// Encrypt newConfig using the same salt as in the old config
|
return os.WriteFile(path, newConfig, 0600)
|
||||||
salt := data[8:16]
|
}
|
||||||
|
|
||||||
|
encryptedConfig, err := encryptConfig(data[8:16], passwd, newConfig)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("encrypting config: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return os.WriteFile(path, encryptedConfig, 0600)
|
||||||
|
}
|
||||||
|
|
||||||
|
func encryptConfig(salt, passwd, config []byte) ([]byte, error) {
|
||||||
salting := sha256.New()
|
salting := sha256.New()
|
||||||
salting.Write(passwd)
|
salting.Write(passwd)
|
||||||
salting.Write(salt)
|
salting.Write(salt)
|
||||||
sum := salting.Sum(nil)
|
sum := salting.Sum(nil)
|
||||||
key := sum[:16]
|
|
||||||
iv := sum[16:]
|
key := sum[:aesKeySize]
|
||||||
|
iv := sum[aesKeySize:]
|
||||||
|
|
||||||
block, err := aes.NewCipher(key)
|
block, err := aes.NewCipher(key)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating cipher: %v", err)
|
return nil, fmt.Errorf("creating cipher: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add padding
|
||||||
|
padLength := blockSize - (len(config) % blockSize)
|
||||||
|
paddedConfig := append(config, bytes.Repeat([]byte{byte(padLength)}, padLength)...)
|
||||||
|
|
||||||
|
// Encrypt
|
||||||
mode := cipher.NewCBCEncrypter(block, iv)
|
mode := cipher.NewCBCEncrypter(block, iv)
|
||||||
|
mode.CryptBlocks(paddedConfig, paddedConfig)
|
||||||
|
|
||||||
// Add needed CBC block padding
|
// Construct final output
|
||||||
padLength := 16 - (len(newConfig) % 16)
|
return append([]byte(saltedPrefix+string(salt)), paddedConfig...), nil
|
||||||
pad := make([]byte, padLength)
|
|
||||||
|
|
||||||
for i := range pad {
|
|
||||||
pad[i] = byte(padLength)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newConfig = append(newConfig, pad...)
|
// ParseConfig parses the contents of data as a gauth configuration file.
|
||||||
|
// Returns a slice of otpauth URLs representing the parsed configurations.
|
||||||
// Encrypt and construct the new data to be written
|
|
||||||
mode.CryptBlocks(newConfig, newConfig)
|
|
||||||
|
|
||||||
saltedPrefix := []byte("Salted__")
|
|
||||||
saltedPrefix = append(saltedPrefix, salt...)
|
|
||||||
|
|
||||||
newConfig = append(saltedPrefix, newConfig...)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = os.WriteFile(path, newConfig, 0)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("writing config: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// ParseConfig parses the contents of data as a gauth configuration file. Each
|
|
||||||
// line of the file specifies a single configuration.
|
|
||||||
//
|
|
||||||
// The basic configuration format is:
|
|
||||||
//
|
|
||||||
// name:secret
|
|
||||||
//
|
|
||||||
// where "name" is the site name and "secret" is the base32-encoded secret.
|
|
||||||
// This represents a default Google authenticator code with 6 digits and a
|
|
||||||
// 30-second refresh.
|
|
||||||
//
|
|
||||||
// Otherwise, a line must be a URL in the format:
|
|
||||||
//
|
|
||||||
// otpauth://TYPE/LABEL?PARAMETERS
|
|
||||||
func ParseConfig(data []byte) ([]*otpauth.URL, error) {
|
func ParseConfig(data []byte) ([]*otpauth.URL, error) {
|
||||||
var out []*otpauth.URL
|
var out []*otpauth.URL
|
||||||
for ln, line := range strings.Split(string(data), "\n") {
|
lines := strings.Split(string(data), "\n")
|
||||||
|
|
||||||
|
for i, line := range lines {
|
||||||
trim := strings.TrimSpace(line)
|
trim := strings.TrimSpace(line)
|
||||||
if trim == "" {
|
if trim == "" {
|
||||||
continue // skip blank lines
|
|
||||||
}
|
|
||||||
|
|
||||||
// URL format.
|
|
||||||
if strings.HasPrefix(trim, "otpauth://") {
|
|
||||||
u, err := otpauth.ParseURL(trim)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("line %d: invalid otpauth URL: %v", ln+1, err)
|
|
||||||
}
|
|
||||||
out = append(out, u)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple format (name:secret)
|
url, err := parseConfigLine(trim, i+1)
|
||||||
parts := strings.SplitN(trim, ":", 2)
|
if err != nil {
|
||||||
if len(parts) != 2 {
|
return nil, err
|
||||||
return nil, fmt.Errorf("line %d: invalid format (want name:secret)", ln+1)
|
}
|
||||||
|
|
||||||
|
if url != nil {
|
||||||
|
out = append(out, url)
|
||||||
}
|
}
|
||||||
out = append(out, &otpauth.URL{
|
|
||||||
Type: "totp",
|
|
||||||
Account: strings.TrimSpace(parts[0]),
|
|
||||||
RawSecret: strings.TrimSpace(parts[1]),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parseConfigLine parses a single line of configuration
|
||||||
|
func parseConfigLine(line string, lineNum int) (*otpauth.URL, error) {
|
||||||
|
if strings.HasPrefix(line, "otpauth://") {
|
||||||
|
u, err := otpauth.ParseURL(line)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("line %d: invalid otpauth URL: %v", lineNum, err)
|
||||||
|
}
|
||||||
|
return u, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
parts := strings.SplitN(line, ":", 2)
|
||||||
|
if len(parts) != 2 {
|
||||||
|
return nil, fmt.Errorf("line %d: invalid format (want name:secret)", lineNum)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &otpauth.URL{
|
||||||
|
Type: "totp",
|
||||||
|
Account: strings.TrimSpace(parts[0]),
|
||||||
|
RawSecret: strings.TrimSpace(parts[1]),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
16
go.mod
16
go.mod
@ -1,9 +1,17 @@
|
|||||||
module github.com/pcarrier/gauth
|
module github.com/pcarrier/gauth
|
||||||
|
|
||||||
go 1.12
|
go 1.23
|
||||||
|
|
||||||
|
toolchain go1.23.6
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/creachadair/otp v0.4.0
|
github.com/creachadair/otp v0.5.0
|
||||||
golang.org/x/sys v0.1.0 // indirect
|
golang.org/x/term v0.29.0
|
||||||
golang.org/x/term v0.1.0
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/creachadair/mds v0.21.3 // indirect
|
||||||
|
github.com/creachadair/wirepb v0.0.0-20241211162510-f7f2e8a40ddc // indirect
|
||||||
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
|
golang.org/x/sys v0.30.0 // indirect
|
||||||
)
|
)
|
||||||
|
10
go.sum
10
go.sum
@ -1,7 +1,17 @@
|
|||||||
|
github.com/creachadair/mds v0.21.3/go.mod h1:1ltMWZd9yXhaHEoZwBialMaviWVUpRPvMwVP7saFAzM=
|
||||||
github.com/creachadair/otp v0.4.0 h1:3PBnESxegU3hQ0D447D75lSnTtTVfw6Eny8GviOXcqM=
|
github.com/creachadair/otp v0.4.0 h1:3PBnESxegU3hQ0D447D75lSnTtTVfw6Eny8GviOXcqM=
|
||||||
github.com/creachadair/otp v0.4.0/go.mod h1:mDkCUSoWN8zqxFoDMw20Boe6xeDd1jJuy6pNQQ4lCy4=
|
github.com/creachadair/otp v0.4.0/go.mod h1:mDkCUSoWN8zqxFoDMw20Boe6xeDd1jJuy6pNQQ4lCy4=
|
||||||
|
github.com/creachadair/otp v0.5.0 h1:q3Th7CXm2zlmCdBjw5tEPFOj4oWJMnVL5HXlq0sNKS0=
|
||||||
|
github.com/creachadair/otp v0.5.0/go.mod h1:0kceI87EnYFNYSTL121goJVAnk3eJhaed9H0nMuJUkA=
|
||||||
|
github.com/creachadair/wirepb v0.0.0-20241211162510-f7f2e8a40ddc h1:eEmY60ZlUMsvNX1AiVR6WdVY5b+WhAATf3opftu6LP0=
|
||||||
|
github.com/creachadair/wirepb v0.0.0-20241211162510-f7f2e8a40ddc/go.mod h1:dHvCVZSsk3Y/fhY0mUex0U2XBZszomOe7PzlghOtHnQ=
|
||||||
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
|
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
|
||||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||||
|
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw=
|
golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw=
|
||||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
|
||||||
|
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
|
||||||
|
1
vendor/github.com/creachadair/otp/.gitignore
generated
vendored
Normal file
1
vendor/github.com/creachadair/otp/.gitignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.go-update
|
3
vendor/github.com/creachadair/otp/go.mod
generated
vendored
3
vendor/github.com/creachadair/otp/go.mod
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
module github.com/creachadair/otp
|
|
||||||
|
|
||||||
go 1.18
|
|
3
vendor/github.com/creachadair/otp/otp.go
generated
vendored
3
vendor/github.com/creachadair/otp/otp.go
generated
vendored
@ -146,6 +146,9 @@ func (c Config) format(v []byte, nd int) string {
|
|||||||
|
|
||||||
// Truncate truncates the specified digest using the algorithm from RFC 4226.
|
// Truncate truncates the specified digest using the algorithm from RFC 4226.
|
||||||
// Only the low-order 31 bits of the value are populated; the rest are zero.
|
// Only the low-order 31 bits of the value are populated; the rest are zero.
|
||||||
|
//
|
||||||
|
// Note that RFC 6238 stipulates the same truncation algorithm regardless of
|
||||||
|
// the length of the chosen digest.
|
||||||
func Truncate(digest []byte) uint64 {
|
func Truncate(digest []byte) uint64 {
|
||||||
offset := digest[len(digest)-1] & 0x0f
|
offset := digest[len(digest)-1] & 0x0f
|
||||||
code := (uint64(digest[offset]&0x7f) << 24) |
|
code := (uint64(digest[offset]&0x7f) << 24) |
|
||||||
|
164
vendor/github.com/creachadair/otp/otpauth/migration.go
generated
vendored
Normal file
164
vendor/github.com/creachadair/otp/otpauth/migration.go
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
package otpauth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/base64"
|
||||||
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/creachadair/wirepb"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ParseMigrationURL parses an otpauth-migration URL in the format generated by
|
||||||
|
// the Google Authenticator for "exported" configurations. Typically these URLs
|
||||||
|
// are embedded as QR codes, encoding a proprietary URL in this format:
|
||||||
|
//
|
||||||
|
// otpauth-migration://offline?data=<content>
|
||||||
|
//
|
||||||
|
// The content is a protocol buffer message encoded as base64 in standard
|
||||||
|
// encoding. Note that a single migration URL may encode multiple OTP
|
||||||
|
// settings; on success this function returns all the otpauth URLs encoded by
|
||||||
|
// the content. It will always return at least one URL, or report an error.
|
||||||
|
func ParseMigrationURL(s string) ([]*URL, error) {
|
||||||
|
rest, ok := strings.CutPrefix(s, "otpauth-migration://")
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("missing otpauth-migration schema prefix")
|
||||||
|
}
|
||||||
|
content, ok := strings.CutPrefix(rest, "offline?data=")
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("unrecognized path format")
|
||||||
|
}
|
||||||
|
dec, err := url.QueryUnescape(content)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("invalid data: %w", err)
|
||||||
|
}
|
||||||
|
bits, err := base64.StdEncoding.DecodeString(dec)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("invalid base64: %w", err)
|
||||||
|
}
|
||||||
|
return parseMigrations(bits)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
The content of a migration URL is a wire-format protocol buffer message.
|
||||||
|
|
||||||
|
I don't want to take a dependency on protobuf, since that pulls in a lot of
|
||||||
|
other expensive Google nonsense, but fortunately the message structure is
|
||||||
|
fairly simple:
|
||||||
|
|
||||||
|
message Content {
|
||||||
|
repeated Params params = 1;
|
||||||
|
|
||||||
|
// ... other fields not of interest.
|
||||||
|
// If you're exporting more data than can fit in one QR code, the app may
|
||||||
|
// split up the export into multiple codes. There are some fields here to
|
||||||
|
// keep track of that, but they aren't relevant here.
|
||||||
|
}
|
||||||
|
|
||||||
|
message Params {
|
||||||
|
bytes secret = 1;
|
||||||
|
string account = 2;
|
||||||
|
string issuer = 3;
|
||||||
|
int32 algorithm = 4; // 0: unspec, 1: SHA1, 2: SHA256, 3: SHA512, 4: MD5
|
||||||
|
int32 digits = 5; // 0: unspec, 1: 6 digits, 2: 8 digits (typical Google)
|
||||||
|
int32 type = 6; // 0: unspec, 1: HOTP, 2: TOTP
|
||||||
|
uint64 counter = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
So here we just unpack the wire format directly.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// parseMigrations parses data as a wire-format protobuf message in the Content
|
||||||
|
// format described above, and returns a single URL for each instance of the
|
||||||
|
// Params found therein. Other fields of the message are ignored.
|
||||||
|
func parseMigrations(data []byte) ([]*URL, error) {
|
||||||
|
const paramsField = 1
|
||||||
|
|
||||||
|
var out []*URL
|
||||||
|
s := wirepb.NewScanner(bytes.NewReader(data))
|
||||||
|
for s.Next() == nil {
|
||||||
|
if s.ID() == paramsField {
|
||||||
|
u, err := parseParams(s.Data())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
out = append(out, u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if s.Err() != io.EOF {
|
||||||
|
return nil, s.Err()
|
||||||
|
} else if len(out) == 0 {
|
||||||
|
return nil, errors.New("no URLs found")
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseParams(data []byte) (*URL, error) {
|
||||||
|
const (
|
||||||
|
secretField = 1 + iota
|
||||||
|
accountField
|
||||||
|
issuerField
|
||||||
|
algorithmField
|
||||||
|
digitsField
|
||||||
|
typeField
|
||||||
|
counterField
|
||||||
|
)
|
||||||
|
|
||||||
|
var out = URL{Algorithm: defaultAlgorithm, Digits: defaultDigits, Period: defaultPeriod}
|
||||||
|
s := wirepb.NewScanner(bytes.NewReader(data))
|
||||||
|
for s.Next() == nil {
|
||||||
|
switch s.ID() {
|
||||||
|
case secretField:
|
||||||
|
out.SetSecret(s.Data())
|
||||||
|
case accountField:
|
||||||
|
out.Account = string(s.Data())
|
||||||
|
case issuerField:
|
||||||
|
out.Issuer = string(s.Data())
|
||||||
|
case algorithmField:
|
||||||
|
switch v, _ := binary.Uvarint(s.Data()); v {
|
||||||
|
case 1:
|
||||||
|
out.Algorithm = "SHA1"
|
||||||
|
case 2:
|
||||||
|
out.Algorithm = "SHA256"
|
||||||
|
case 3:
|
||||||
|
out.Algorithm = "SHA512"
|
||||||
|
case 4:
|
||||||
|
out.Algorithm = "MD5"
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unknown algorithm code %d", v)
|
||||||
|
}
|
||||||
|
case digitsField:
|
||||||
|
switch v, _ := binary.Uvarint(s.Data()); v {
|
||||||
|
case 1:
|
||||||
|
out.Digits = 6
|
||||||
|
case 2:
|
||||||
|
out.Digits = 8
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unknown digits code %d", v)
|
||||||
|
}
|
||||||
|
case typeField:
|
||||||
|
switch v, _ := binary.Uvarint(s.Data()); v {
|
||||||
|
case 1:
|
||||||
|
out.Type = "hotp"
|
||||||
|
case 2:
|
||||||
|
out.Type = "totp"
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unknown type code %d", v)
|
||||||
|
}
|
||||||
|
case counterField:
|
||||||
|
v, n := binary.Uvarint(s.Data())
|
||||||
|
if n <= 0 {
|
||||||
|
return nil, errors.New("invalid counter value")
|
||||||
|
}
|
||||||
|
out.Counter = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if s.Err() != io.EOF {
|
||||||
|
return nil, s.Err()
|
||||||
|
}
|
||||||
|
return &out, nil
|
||||||
|
}
|
12
vendor/github.com/creachadair/otp/otpauth/otpauth.go
generated
vendored
12
vendor/github.com/creachadair/otp/otpauth/otpauth.go
generated
vendored
@ -60,7 +60,7 @@ func (u *URL) String() string {
|
|||||||
// Encode parameters if there are any non-default values.
|
// Encode parameters if there are any non-default values.
|
||||||
var params []string
|
var params []string
|
||||||
if a := strings.ToUpper(u.Algorithm); a != "" && a != "SHA1" {
|
if a := strings.ToUpper(u.Algorithm); a != "" && a != "SHA1" {
|
||||||
params = append(params, "algorithm="+url.PathEscape(a))
|
params = append(params, "algorithm="+queryEscape(a))
|
||||||
}
|
}
|
||||||
if c := u.Counter; c > 0 || typ == "hotp" {
|
if c := u.Counter; c > 0 || typ == "hotp" {
|
||||||
params = append(params, "counter="+strconv.FormatUint(c, 10))
|
params = append(params, "counter="+strconv.FormatUint(c, 10))
|
||||||
@ -69,14 +69,14 @@ func (u *URL) String() string {
|
|||||||
params = append(params, "digits="+strconv.Itoa(d))
|
params = append(params, "digits="+strconv.Itoa(d))
|
||||||
}
|
}
|
||||||
if o := u.Issuer; o != "" {
|
if o := u.Issuer; o != "" {
|
||||||
params = append(params, "issuer="+url.PathEscape(o))
|
params = append(params, "issuer="+queryEscape(o))
|
||||||
}
|
}
|
||||||
if p := u.Period; p > 0 && p != defaultPeriod {
|
if p := u.Period; p > 0 && p != defaultPeriod {
|
||||||
params = append(params, "period="+strconv.Itoa(p))
|
params = append(params, "period="+strconv.Itoa(p))
|
||||||
}
|
}
|
||||||
if s := u.RawSecret; s != "" {
|
if s := u.RawSecret; s != "" {
|
||||||
enc := strings.ToUpper(strings.Join(strings.Fields(strings.TrimRight(s, "=")), ""))
|
enc := strings.ToUpper(strings.Join(strings.Fields(strings.TrimRight(s, "=")), ""))
|
||||||
params = append(params, "secret="+url.PathEscape(enc))
|
params = append(params, "secret="+queryEscape(enc))
|
||||||
}
|
}
|
||||||
if len(params) != 0 {
|
if len(params) != 0 {
|
||||||
sb.WriteByte('?')
|
sb.WriteByte('?')
|
||||||
@ -182,7 +182,7 @@ func ParseURL(s string) (*URL, error) {
|
|||||||
if len(ps) == 1 {
|
if len(ps) == 1 {
|
||||||
ps = append(ps, "") // check value below
|
ps = append(ps, "") // check value below
|
||||||
}
|
}
|
||||||
value, err := url.PathUnescape(ps[1])
|
value, err := url.QueryUnescape(ps[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid value: %v", err)
|
return nil, fmt.Errorf("invalid value: %v", err)
|
||||||
}
|
}
|
||||||
@ -219,3 +219,7 @@ func ParseURL(s string) (*URL, error) {
|
|||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func queryEscape(s string) string {
|
||||||
|
return strings.ReplaceAll(url.QueryEscape(s), "+", "%20")
|
||||||
|
}
|
||||||
|
26
vendor/github.com/creachadair/wirepb/LICENSE
generated
vendored
Normal file
26
vendor/github.com/creachadair/wirepb/LICENSE
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Copyright (C) 2024, Michael J. Fromberger
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
(1) Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
(2) Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
(3) The name of the author may not be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
OF SUCH DAMAGE.
|
7
vendor/github.com/creachadair/wirepb/README.md
generated
vendored
Normal file
7
vendor/github.com/creachadair/wirepb/README.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# wirepb
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/github.com/creachadair/wirepb)
|
||||||
|
[](https://github.com/creachadair/wirepb/actions/workflows/go-presubmit.yml)
|
||||||
|
|
||||||
|
This repository defines a low-level protocol buffer wire format scanner in Go.
|
||||||
|
It has no dependency on the protocol buffer compiler or code generators.
|
32
vendor/github.com/creachadair/wirepb/enums.go
generated
vendored
Normal file
32
vendor/github.com/creachadair/wirepb/enums.go
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Code generated by enumgen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package wirepb
|
||||||
|
|
||||||
|
// Type is a protobuf wire type code.
|
||||||
|
type Type struct{ _Type uint8 }
|
||||||
|
|
||||||
|
// Enum returns the name of the enumeration type for Type.
|
||||||
|
func (Type) Enum() string { return "Type" }
|
||||||
|
|
||||||
|
// String returns the string representation of Type v.
|
||||||
|
func (v Type) String() string { return _str_Type[v._Type] }
|
||||||
|
|
||||||
|
// Valid reports whether v is a valid non-zero Type value.
|
||||||
|
func (v Type) Valid() bool { return v._Type > 0 && int(v._Type) < len(_str_Type) }
|
||||||
|
|
||||||
|
// Index returns the integer index of Type v.
|
||||||
|
func (v Type) Index() int { return _idx_Type[v._Type] }
|
||||||
|
|
||||||
|
// Values for low-level wire types.
|
||||||
|
var (
|
||||||
|
_str_Type = []string{"<invalid>", "Varint", "I64", "Len", "StartGroup", "EndGroup", "I32"}
|
||||||
|
_idx_Type = []int{0, 0, 1, 2, 3, 4, 5}
|
||||||
|
|
||||||
|
Invalid = Type{0}
|
||||||
|
Varint = Type{1} // Base 128 varint
|
||||||
|
I64 = Type{2} // 64-bit fixed-width integer
|
||||||
|
Len = Type{3} // Length-prefixed string
|
||||||
|
StartGroup = Type{4} // Group start marker (obsolete, unused)
|
||||||
|
EndGroup = Type{5} // Group end marker (obsolete, unused)
|
||||||
|
I32 = Type{6} // 32-bit fixed-width integer
|
||||||
|
)
|
122
vendor/github.com/creachadair/wirepb/wirepb.go
generated
vendored
Normal file
122
vendor/github.com/creachadair/wirepb/wirepb.go
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
// Package wirepb implements a rudimentary decoder for the protocol buffers wire format.
|
||||||
|
//
|
||||||
|
// See: https://protobuf.dev/programming-guides/encoding
|
||||||
|
package wirepb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:generate go run github.com/creachadair/enumgen@latest -output enums.go
|
||||||
|
|
||||||
|
/*enumgen:type Type
|
||||||
|
doc: Type is a protobuf wire type code.
|
||||||
|
zero: Invalid
|
||||||
|
val-doc: Values for low-level wire types.
|
||||||
|
values:
|
||||||
|
- name: Varint
|
||||||
|
doc: Base 128 varint
|
||||||
|
index: 0
|
||||||
|
- name: I64
|
||||||
|
doc: 64-bit fixed-width integer
|
||||||
|
- name: Len
|
||||||
|
doc: Length-prefixed string
|
||||||
|
- name: StartGroup
|
||||||
|
doc: Group start marker (obsolete, unused)
|
||||||
|
- name: EndGroup
|
||||||
|
doc: Group end marker (obsolete, unused)
|
||||||
|
- name: I32
|
||||||
|
doc: 32-bit fixed-width integer
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Scanner is a protocol buffer wire format lexical scanner.
|
||||||
|
type Scanner struct {
|
||||||
|
r *bufio.Reader
|
||||||
|
|
||||||
|
tok Type // current token type
|
||||||
|
id int // current field ID
|
||||||
|
data []byte // current field contents
|
||||||
|
|
||||||
|
err error // last error
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewScanner creates a new scanner that consumes input from r.
|
||||||
|
func NewScanner(r io.Reader) *Scanner {
|
||||||
|
return &Scanner{r: bufio.NewReader(r), id: -1}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type returns the type of the current token, or Invalid if there is not
|
||||||
|
// currently a token available.
|
||||||
|
func (s *Scanner) Type() Type { return s.tok }
|
||||||
|
|
||||||
|
// Data returns the contents of the current token in binary form, or nil if
|
||||||
|
// there is not currently a token available. The contents of the returned slice
|
||||||
|
// are only valid until the next call to Next.
|
||||||
|
func (s *Scanner) Data() []byte { return s.data }
|
||||||
|
|
||||||
|
// ID returns the field ID of the current token, or -1 if there is no token.
|
||||||
|
func (s *Scanner) ID() int { return s.id }
|
||||||
|
|
||||||
|
// Next advances s to the next token of the input or reports an error. At the
|
||||||
|
// end of the input, Next returns io.EOF.
|
||||||
|
func (s *Scanner) Next() error {
|
||||||
|
s.tok = Invalid
|
||||||
|
s.id = -1
|
||||||
|
s.data = nil
|
||||||
|
s.err = nil
|
||||||
|
|
||||||
|
tag, err := binary.ReadUvarint(s.r)
|
||||||
|
if err == io.EOF {
|
||||||
|
return s.fail(err) // return unwrapped
|
||||||
|
} else if err != nil {
|
||||||
|
return s.failf("read tag: %w", err)
|
||||||
|
}
|
||||||
|
id, wtype := tag>>3, tag&7
|
||||||
|
switch wtype {
|
||||||
|
case 0:
|
||||||
|
v, err := binary.ReadUvarint(s.r)
|
||||||
|
if err != nil {
|
||||||
|
return s.failf("read varint: %w", err)
|
||||||
|
}
|
||||||
|
s.data = binary.AppendUvarint(s.data, v)
|
||||||
|
s.tok = Varint
|
||||||
|
case 1:
|
||||||
|
var buf [8]byte
|
||||||
|
if _, err := io.ReadFull(s.r, buf[:]); err != nil {
|
||||||
|
return s.failf("read i64: %w", err)
|
||||||
|
}
|
||||||
|
s.data, s.tok = buf[:], I64
|
||||||
|
case 2:
|
||||||
|
v, err := binary.ReadUvarint(s.r)
|
||||||
|
if err != nil {
|
||||||
|
return s.failf("read length: %w", err)
|
||||||
|
}
|
||||||
|
buf := make([]byte, int(v))
|
||||||
|
if _, err := io.ReadFull(s.r, buf); err != nil {
|
||||||
|
return s.failf("read string: %w", err)
|
||||||
|
}
|
||||||
|
s.data, s.tok = buf, Len
|
||||||
|
case 5:
|
||||||
|
var buf [4]byte
|
||||||
|
if _, err := io.ReadFull(s.r, buf[:]); err != nil {
|
||||||
|
return s.failf("read i32: %w", err)
|
||||||
|
}
|
||||||
|
s.data, s.tok = buf[:], I32
|
||||||
|
case 3, 4:
|
||||||
|
return s.failf("obsolete wire type %d", wtype)
|
||||||
|
default:
|
||||||
|
return s.failf("invalid wire type %d", wtype)
|
||||||
|
}
|
||||||
|
s.id = int(id)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Err returns the last error reported by Next, or nil if none.
|
||||||
|
func (s *Scanner) Err() error { return s.err }
|
||||||
|
|
||||||
|
func (s *Scanner) fail(err error) error { s.err = err; return err }
|
||||||
|
|
||||||
|
func (s *Scanner) failf(msg string, args ...any) error { return s.fail(fmt.Errorf(msg, args...)) }
|
4
vendor/golang.org/x/sys/LICENSE
generated
vendored
4
vendor/golang.org/x/sys/LICENSE
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
Copyright 2009 The Go Authors.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
|
|||||||
copyright notice, this list of conditions and the following disclaimer
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
in the documentation and/or other materials provided with the
|
in the documentation and/or other materials provided with the
|
||||||
distribution.
|
distribution.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
* Neither the name of Google LLC nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
30
vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go
generated
vendored
30
vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go
generated
vendored
@ -1,30 +0,0 @@
|
|||||||
// Copyright 2020 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.
|
|
||||||
|
|
||||||
// Package unsafeheader contains header declarations for the Go runtime's
|
|
||||||
// slice and string implementations.
|
|
||||||
//
|
|
||||||
// This package allows x/sys to use types equivalent to
|
|
||||||
// reflect.SliceHeader and reflect.StringHeader without introducing
|
|
||||||
// a dependency on the (relatively heavy) "reflect" package.
|
|
||||||
package unsafeheader
|
|
||||||
|
|
||||||
import (
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Slice is the runtime representation of a slice.
|
|
||||||
// It cannot be used safely or portably and its representation may change in a later release.
|
|
||||||
type Slice struct {
|
|
||||||
Data unsafe.Pointer
|
|
||||||
Len int
|
|
||||||
Cap int
|
|
||||||
}
|
|
||||||
|
|
||||||
// String is the runtime representation of a string.
|
|
||||||
// It cannot be used safely or portably and its representation may change in a later release.
|
|
||||||
type String struct {
|
|
||||||
Data unsafe.Pointer
|
|
||||||
Len int
|
|
||||||
}
|
|
1
vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build go1.5
|
//go:build go1.5
|
||||||
// +build go1.5
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/plan9/pwd_plan9.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/pwd_plan9.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !go1.5
|
//go:build !go1.5
|
||||||
// +build !go1.5
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/plan9/race.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/race.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build plan9 && race
|
//go:build plan9 && race
|
||||||
// +build plan9,race
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/plan9/race0.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/race0.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build plan9 && !race
|
//go:build plan9 && !race
|
||||||
// +build plan9,!race
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/plan9/str.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/str.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build plan9
|
//go:build plan9
|
||||||
// +build plan9
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/plan9/syscall.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/syscall.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build plan9
|
//go:build plan9
|
||||||
// +build plan9
|
|
||||||
|
|
||||||
// Package plan9 contains an interface to the low-level operating system
|
// Package plan9 contains an interface to the low-level operating system
|
||||||
// primitives. OS details vary depending on the underlying system, and
|
// primitives. OS details vary depending on the underlying system, and
|
||||||
|
1
vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go
generated
vendored
@ -2,7 +2,6 @@
|
|||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build plan9 && 386
|
//go:build plan9 && 386
|
||||||
// +build plan9,386
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go
generated
vendored
@ -2,7 +2,6 @@
|
|||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build plan9 && amd64
|
//go:build plan9 && amd64
|
||||||
// +build plan9,amd64
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go
generated
vendored
1
vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go
generated
vendored
@ -2,7 +2,6 @@
|
|||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build plan9 && arm
|
//go:build plan9 && arm
|
||||||
// +build plan9,arm
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
2
vendor/golang.org/x/sys/unix/README.md
generated
vendored
2
vendor/golang.org/x/sys/unix/README.md
generated
vendored
@ -156,7 +156,7 @@ from the generated architecture-specific files listed below, and merge these
|
|||||||
into a common file for each OS.
|
into a common file for each OS.
|
||||||
|
|
||||||
The merge is performed in the following steps:
|
The merge is performed in the following steps:
|
||||||
1. Construct the set of common code that is idential in all architecture-specific files.
|
1. Construct the set of common code that is identical in all architecture-specific files.
|
||||||
2. Write this common code to the merged file.
|
2. Write this common code to the merged file.
|
||||||
3. Remove the common code from all architecture-specific files.
|
3. Remove the common code from all architecture-specific files.
|
||||||
|
|
||||||
|
4
vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
4
vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
@ -2,9 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
|
||||||
// +build go1.9
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc
|
//go:build gc
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
2
vendor/golang.org/x/sys/unix/asm_bsd_386.s
generated
vendored
2
vendor/golang.org/x/sys/unix/asm_bsd_386.s
generated
vendored
@ -3,8 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (freebsd || netbsd || openbsd) && gc
|
//go:build (freebsd || netbsd || openbsd) && gc
|
||||||
// +build freebsd netbsd openbsd
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
2
vendor/golang.org/x/sys/unix/asm_bsd_amd64.s
generated
vendored
2
vendor/golang.org/x/sys/unix/asm_bsd_amd64.s
generated
vendored
@ -3,8 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
|
//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
|
||||||
// +build darwin dragonfly freebsd netbsd openbsd
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
2
vendor/golang.org/x/sys/unix/asm_bsd_arm.s
generated
vendored
2
vendor/golang.org/x/sys/unix/asm_bsd_arm.s
generated
vendored
@ -3,8 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (freebsd || netbsd || openbsd) && gc
|
//go:build (freebsd || netbsd || openbsd) && gc
|
||||||
// +build freebsd netbsd openbsd
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
2
vendor/golang.org/x/sys/unix/asm_bsd_arm64.s
generated
vendored
2
vendor/golang.org/x/sys/unix/asm_bsd_arm64.s
generated
vendored
@ -3,8 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
||||||
// +build darwin freebsd netbsd openbsd
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
2
vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s
generated
vendored
2
vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s
generated
vendored
@ -3,8 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
||||||
// +build darwin freebsd netbsd openbsd
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
2
vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s
generated
vendored
2
vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s
generated
vendored
@ -3,8 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
||||||
// +build darwin freebsd netbsd openbsd
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/asm_linux_386.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_386.s
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc
|
//go:build gc
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/asm_linux_amd64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_amd64.s
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc
|
//go:build gc
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/asm_linux_arm.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_arm.s
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc
|
//go:build gc
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/asm_linux_arm64.s
generated
vendored
3
vendor/golang.org/x/sys/unix/asm_linux_arm64.s
generated
vendored
@ -3,9 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build linux && arm64 && gc
|
//go:build linux && arm64 && gc
|
||||||
// +build linux
|
|
||||||
// +build arm64
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/asm_linux_loong64.s
generated
vendored
3
vendor/golang.org/x/sys/unix/asm_linux_loong64.s
generated
vendored
@ -3,9 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build linux && loong64 && gc
|
//go:build linux && loong64 && gc
|
||||||
// +build linux
|
|
||||||
// +build loong64
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
generated
vendored
3
vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
generated
vendored
@ -3,9 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build linux && (mips64 || mips64le) && gc
|
//go:build linux && (mips64 || mips64le) && gc
|
||||||
// +build linux
|
|
||||||
// +build mips64 mips64le
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
generated
vendored
3
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
generated
vendored
@ -3,9 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build linux && (mips || mipsle) && gc
|
//go:build linux && (mips || mipsle) && gc
|
||||||
// +build linux
|
|
||||||
// +build mips mipsle
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
generated
vendored
3
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
generated
vendored
@ -3,9 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build linux && (ppc64 || ppc64le) && gc
|
//go:build linux && (ppc64 || ppc64le) && gc
|
||||||
// +build linux
|
|
||||||
// +build ppc64 ppc64le
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
2
vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
generated
vendored
2
vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
generated
vendored
@ -3,8 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build riscv64 && gc
|
//go:build riscv64 && gc
|
||||||
// +build riscv64
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/asm_linux_s390x.s
generated
vendored
3
vendor/golang.org/x/sys/unix/asm_linux_s390x.s
generated
vendored
@ -3,9 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build linux && s390x && gc
|
//go:build linux && s390x && gc
|
||||||
// +build linux
|
|
||||||
// +build s390x
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc
|
//go:build gc
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gc
|
//go:build gc
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
572
vendor/golang.org/x/sys/unix/asm_zos_s390x.s
generated
vendored
572
vendor/golang.org/x/sys/unix/asm_zos_s390x.s
generated
vendored
@ -3,18 +3,17 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build zos && s390x && gc
|
//go:build zos && s390x && gc
|
||||||
// +build zos
|
|
||||||
// +build s390x
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
#define PSALAA 1208(R0)
|
#define PSALAA 1208(R0)
|
||||||
#define GTAB64(x) 80(x)
|
#define GTAB64(x) 80(x)
|
||||||
#define LCA64(x) 88(x)
|
#define LCA64(x) 88(x)
|
||||||
#define CAA(x) 8(x)
|
|
||||||
#define EDCHPXV(x) 1016(x) // in the CAA
|
|
||||||
#define SAVSTACK_ASYNC(x) 336(x) // in the LCA
|
#define SAVSTACK_ASYNC(x) 336(x) // in the LCA
|
||||||
|
#define CAA(x) 8(x)
|
||||||
|
#define CEECAATHDID(x) 976(x) // in the CAA
|
||||||
|
#define EDCHPXV(x) 1016(x) // in the CAA
|
||||||
|
#define GOCB(x) 1104(x) // in the CAA
|
||||||
|
|
||||||
// SS_*, where x=SAVSTACK_ASYNC
|
// SS_*, where x=SAVSTACK_ASYNC
|
||||||
#define SS_LE(x) 0(x)
|
#define SS_LE(x) 0(x)
|
||||||
@ -22,7 +21,30 @@
|
|||||||
#define SS_ERRNO(x) 16(x)
|
#define SS_ERRNO(x) 16(x)
|
||||||
#define SS_ERRNOJR(x) 20(x)
|
#define SS_ERRNOJR(x) 20(x)
|
||||||
|
|
||||||
#define LE_CALL BYTE $0x0D; BYTE $0x76; // BL R7, R6
|
// Function Descriptor Offsets
|
||||||
|
#define __errno 0x156*16
|
||||||
|
#define __err2ad 0x16C*16
|
||||||
|
|
||||||
|
// Call Instructions
|
||||||
|
#define LE_CALL BYTE $0x0D; BYTE $0x76 // BL R7, R6
|
||||||
|
#define SVC_LOAD BYTE $0x0A; BYTE $0x08 // SVC 08 LOAD
|
||||||
|
#define SVC_DELETE BYTE $0x0A; BYTE $0x09 // SVC 09 DELETE
|
||||||
|
|
||||||
|
DATA zosLibVec<>(SB)/8, $0
|
||||||
|
GLOBL zosLibVec<>(SB), NOPTR, $8
|
||||||
|
|
||||||
|
TEXT ·initZosLibVec(SB), NOSPLIT|NOFRAME, $0-0
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
MOVD CAA(R8), R8
|
||||||
|
MOVD EDCHPXV(R8), R8
|
||||||
|
MOVD R8, zosLibVec<>(SB)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·GetZosLibVec(SB), NOSPLIT|NOFRAME, $0-0
|
||||||
|
MOVD zosLibVec<>(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
TEXT ·clearErrno(SB), NOSPLIT, $0-0
|
TEXT ·clearErrno(SB), NOSPLIT, $0-0
|
||||||
BL addrerrno<>(SB)
|
BL addrerrno<>(SB)
|
||||||
@ -38,7 +60,7 @@ TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0
|
|||||||
// Get __errno FuncDesc.
|
// Get __errno FuncDesc.
|
||||||
MOVD CAA(R8), R9
|
MOVD CAA(R8), R9
|
||||||
MOVD EDCHPXV(R9), R9
|
MOVD EDCHPXV(R9), R9
|
||||||
ADD $(0x156*16), R9
|
ADD $(__errno), R9
|
||||||
LMG 0(R9), R5, R6
|
LMG 0(R9), R5, R6
|
||||||
|
|
||||||
// Switch to saved LE stack.
|
// Switch to saved LE stack.
|
||||||
@ -55,296 +77,6 @@ TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0
|
|||||||
MOVD R4, 0(R9) // Save stack pointer.
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
RET
|
RET
|
||||||
|
|
||||||
TEXT ·syscall_syscall(SB),NOSPLIT,$0-56
|
|
||||||
BL runtime·entersyscall(SB)
|
|
||||||
MOVD a1+8(FP), R1
|
|
||||||
MOVD a2+16(FP), R2
|
|
||||||
MOVD a3+24(FP), R3
|
|
||||||
|
|
||||||
// Get library control area (LCA).
|
|
||||||
MOVW PSALAA, R8
|
|
||||||
MOVD LCA64(R8), R8
|
|
||||||
|
|
||||||
// Get function.
|
|
||||||
MOVD CAA(R8), R9
|
|
||||||
MOVD EDCHPXV(R9), R9
|
|
||||||
MOVD trap+0(FP), R5
|
|
||||||
SLD $4, R5
|
|
||||||
ADD R5, R9
|
|
||||||
LMG 0(R9), R5, R6
|
|
||||||
|
|
||||||
// Restore LE stack.
|
|
||||||
MOVD SAVSTACK_ASYNC(R8), R9
|
|
||||||
MOVD 0(R9), R4
|
|
||||||
MOVD $0, 0(R9)
|
|
||||||
|
|
||||||
// Call function.
|
|
||||||
LE_CALL
|
|
||||||
NOPH
|
|
||||||
XOR R0, R0 // Restore R0 to $0.
|
|
||||||
MOVD R4, 0(R9) // Save stack pointer.
|
|
||||||
|
|
||||||
MOVD R3, r1+32(FP)
|
|
||||||
MOVD R0, r2+40(FP)
|
|
||||||
MOVD R0, err+48(FP)
|
|
||||||
MOVW R3, R4
|
|
||||||
CMP R4, $-1
|
|
||||||
BNE done
|
|
||||||
BL addrerrno<>(SB)
|
|
||||||
MOVWZ 0(R3), R3
|
|
||||||
MOVD R3, err+48(FP)
|
|
||||||
done:
|
|
||||||
BL runtime·exitsyscall(SB)
|
|
||||||
RET
|
|
||||||
|
|
||||||
TEXT ·syscall_rawsyscall(SB),NOSPLIT,$0-56
|
|
||||||
MOVD a1+8(FP), R1
|
|
||||||
MOVD a2+16(FP), R2
|
|
||||||
MOVD a3+24(FP), R3
|
|
||||||
|
|
||||||
// Get library control area (LCA).
|
|
||||||
MOVW PSALAA, R8
|
|
||||||
MOVD LCA64(R8), R8
|
|
||||||
|
|
||||||
// Get function.
|
|
||||||
MOVD CAA(R8), R9
|
|
||||||
MOVD EDCHPXV(R9), R9
|
|
||||||
MOVD trap+0(FP), R5
|
|
||||||
SLD $4, R5
|
|
||||||
ADD R5, R9
|
|
||||||
LMG 0(R9), R5, R6
|
|
||||||
|
|
||||||
// Restore LE stack.
|
|
||||||
MOVD SAVSTACK_ASYNC(R8), R9
|
|
||||||
MOVD 0(R9), R4
|
|
||||||
MOVD $0, 0(R9)
|
|
||||||
|
|
||||||
// Call function.
|
|
||||||
LE_CALL
|
|
||||||
NOPH
|
|
||||||
XOR R0, R0 // Restore R0 to $0.
|
|
||||||
MOVD R4, 0(R9) // Save stack pointer.
|
|
||||||
|
|
||||||
MOVD R3, r1+32(FP)
|
|
||||||
MOVD R0, r2+40(FP)
|
|
||||||
MOVD R0, err+48(FP)
|
|
||||||
MOVW R3, R4
|
|
||||||
CMP R4, $-1
|
|
||||||
BNE done
|
|
||||||
BL addrerrno<>(SB)
|
|
||||||
MOVWZ 0(R3), R3
|
|
||||||
MOVD R3, err+48(FP)
|
|
||||||
done:
|
|
||||||
RET
|
|
||||||
|
|
||||||
TEXT ·syscall_syscall6(SB),NOSPLIT,$0-80
|
|
||||||
BL runtime·entersyscall(SB)
|
|
||||||
MOVD a1+8(FP), R1
|
|
||||||
MOVD a2+16(FP), R2
|
|
||||||
MOVD a3+24(FP), R3
|
|
||||||
|
|
||||||
// Get library control area (LCA).
|
|
||||||
MOVW PSALAA, R8
|
|
||||||
MOVD LCA64(R8), R8
|
|
||||||
|
|
||||||
// Get function.
|
|
||||||
MOVD CAA(R8), R9
|
|
||||||
MOVD EDCHPXV(R9), R9
|
|
||||||
MOVD trap+0(FP), R5
|
|
||||||
SLD $4, R5
|
|
||||||
ADD R5, R9
|
|
||||||
LMG 0(R9), R5, R6
|
|
||||||
|
|
||||||
// Restore LE stack.
|
|
||||||
MOVD SAVSTACK_ASYNC(R8), R9
|
|
||||||
MOVD 0(R9), R4
|
|
||||||
MOVD $0, 0(R9)
|
|
||||||
|
|
||||||
// Fill in parameter list.
|
|
||||||
MOVD a4+32(FP), R12
|
|
||||||
MOVD R12, (2176+24)(R4)
|
|
||||||
MOVD a5+40(FP), R12
|
|
||||||
MOVD R12, (2176+32)(R4)
|
|
||||||
MOVD a6+48(FP), R12
|
|
||||||
MOVD R12, (2176+40)(R4)
|
|
||||||
|
|
||||||
// Call function.
|
|
||||||
LE_CALL
|
|
||||||
NOPH
|
|
||||||
XOR R0, R0 // Restore R0 to $0.
|
|
||||||
MOVD R4, 0(R9) // Save stack pointer.
|
|
||||||
|
|
||||||
MOVD R3, r1+56(FP)
|
|
||||||
MOVD R0, r2+64(FP)
|
|
||||||
MOVD R0, err+72(FP)
|
|
||||||
MOVW R3, R4
|
|
||||||
CMP R4, $-1
|
|
||||||
BNE done
|
|
||||||
BL addrerrno<>(SB)
|
|
||||||
MOVWZ 0(R3), R3
|
|
||||||
MOVD R3, err+72(FP)
|
|
||||||
done:
|
|
||||||
BL runtime·exitsyscall(SB)
|
|
||||||
RET
|
|
||||||
|
|
||||||
TEXT ·syscall_rawsyscall6(SB),NOSPLIT,$0-80
|
|
||||||
MOVD a1+8(FP), R1
|
|
||||||
MOVD a2+16(FP), R2
|
|
||||||
MOVD a3+24(FP), R3
|
|
||||||
|
|
||||||
// Get library control area (LCA).
|
|
||||||
MOVW PSALAA, R8
|
|
||||||
MOVD LCA64(R8), R8
|
|
||||||
|
|
||||||
// Get function.
|
|
||||||
MOVD CAA(R8), R9
|
|
||||||
MOVD EDCHPXV(R9), R9
|
|
||||||
MOVD trap+0(FP), R5
|
|
||||||
SLD $4, R5
|
|
||||||
ADD R5, R9
|
|
||||||
LMG 0(R9), R5, R6
|
|
||||||
|
|
||||||
// Restore LE stack.
|
|
||||||
MOVD SAVSTACK_ASYNC(R8), R9
|
|
||||||
MOVD 0(R9), R4
|
|
||||||
MOVD $0, 0(R9)
|
|
||||||
|
|
||||||
// Fill in parameter list.
|
|
||||||
MOVD a4+32(FP), R12
|
|
||||||
MOVD R12, (2176+24)(R4)
|
|
||||||
MOVD a5+40(FP), R12
|
|
||||||
MOVD R12, (2176+32)(R4)
|
|
||||||
MOVD a6+48(FP), R12
|
|
||||||
MOVD R12, (2176+40)(R4)
|
|
||||||
|
|
||||||
// Call function.
|
|
||||||
LE_CALL
|
|
||||||
NOPH
|
|
||||||
XOR R0, R0 // Restore R0 to $0.
|
|
||||||
MOVD R4, 0(R9) // Save stack pointer.
|
|
||||||
|
|
||||||
MOVD R3, r1+56(FP)
|
|
||||||
MOVD R0, r2+64(FP)
|
|
||||||
MOVD R0, err+72(FP)
|
|
||||||
MOVW R3, R4
|
|
||||||
CMP R4, $-1
|
|
||||||
BNE done
|
|
||||||
BL ·rrno<>(SB)
|
|
||||||
MOVWZ 0(R3), R3
|
|
||||||
MOVD R3, err+72(FP)
|
|
||||||
done:
|
|
||||||
RET
|
|
||||||
|
|
||||||
TEXT ·syscall_syscall9(SB),NOSPLIT,$0
|
|
||||||
BL runtime·entersyscall(SB)
|
|
||||||
MOVD a1+8(FP), R1
|
|
||||||
MOVD a2+16(FP), R2
|
|
||||||
MOVD a3+24(FP), R3
|
|
||||||
|
|
||||||
// Get library control area (LCA).
|
|
||||||
MOVW PSALAA, R8
|
|
||||||
MOVD LCA64(R8), R8
|
|
||||||
|
|
||||||
// Get function.
|
|
||||||
MOVD CAA(R8), R9
|
|
||||||
MOVD EDCHPXV(R9), R9
|
|
||||||
MOVD trap+0(FP), R5
|
|
||||||
SLD $4, R5
|
|
||||||
ADD R5, R9
|
|
||||||
LMG 0(R9), R5, R6
|
|
||||||
|
|
||||||
// Restore LE stack.
|
|
||||||
MOVD SAVSTACK_ASYNC(R8), R9
|
|
||||||
MOVD 0(R9), R4
|
|
||||||
MOVD $0, 0(R9)
|
|
||||||
|
|
||||||
// Fill in parameter list.
|
|
||||||
MOVD a4+32(FP), R12
|
|
||||||
MOVD R12, (2176+24)(R4)
|
|
||||||
MOVD a5+40(FP), R12
|
|
||||||
MOVD R12, (2176+32)(R4)
|
|
||||||
MOVD a6+48(FP), R12
|
|
||||||
MOVD R12, (2176+40)(R4)
|
|
||||||
MOVD a7+56(FP), R12
|
|
||||||
MOVD R12, (2176+48)(R4)
|
|
||||||
MOVD a8+64(FP), R12
|
|
||||||
MOVD R12, (2176+56)(R4)
|
|
||||||
MOVD a9+72(FP), R12
|
|
||||||
MOVD R12, (2176+64)(R4)
|
|
||||||
|
|
||||||
// Call function.
|
|
||||||
LE_CALL
|
|
||||||
NOPH
|
|
||||||
XOR R0, R0 // Restore R0 to $0.
|
|
||||||
MOVD R4, 0(R9) // Save stack pointer.
|
|
||||||
|
|
||||||
MOVD R3, r1+80(FP)
|
|
||||||
MOVD R0, r2+88(FP)
|
|
||||||
MOVD R0, err+96(FP)
|
|
||||||
MOVW R3, R4
|
|
||||||
CMP R4, $-1
|
|
||||||
BNE done
|
|
||||||
BL addrerrno<>(SB)
|
|
||||||
MOVWZ 0(R3), R3
|
|
||||||
MOVD R3, err+96(FP)
|
|
||||||
done:
|
|
||||||
BL runtime·exitsyscall(SB)
|
|
||||||
RET
|
|
||||||
|
|
||||||
TEXT ·syscall_rawsyscall9(SB),NOSPLIT,$0
|
|
||||||
MOVD a1+8(FP), R1
|
|
||||||
MOVD a2+16(FP), R2
|
|
||||||
MOVD a3+24(FP), R3
|
|
||||||
|
|
||||||
// Get library control area (LCA).
|
|
||||||
MOVW PSALAA, R8
|
|
||||||
MOVD LCA64(R8), R8
|
|
||||||
|
|
||||||
// Get function.
|
|
||||||
MOVD CAA(R8), R9
|
|
||||||
MOVD EDCHPXV(R9), R9
|
|
||||||
MOVD trap+0(FP), R5
|
|
||||||
SLD $4, R5
|
|
||||||
ADD R5, R9
|
|
||||||
LMG 0(R9), R5, R6
|
|
||||||
|
|
||||||
// Restore LE stack.
|
|
||||||
MOVD SAVSTACK_ASYNC(R8), R9
|
|
||||||
MOVD 0(R9), R4
|
|
||||||
MOVD $0, 0(R9)
|
|
||||||
|
|
||||||
// Fill in parameter list.
|
|
||||||
MOVD a4+32(FP), R12
|
|
||||||
MOVD R12, (2176+24)(R4)
|
|
||||||
MOVD a5+40(FP), R12
|
|
||||||
MOVD R12, (2176+32)(R4)
|
|
||||||
MOVD a6+48(FP), R12
|
|
||||||
MOVD R12, (2176+40)(R4)
|
|
||||||
MOVD a7+56(FP), R12
|
|
||||||
MOVD R12, (2176+48)(R4)
|
|
||||||
MOVD a8+64(FP), R12
|
|
||||||
MOVD R12, (2176+56)(R4)
|
|
||||||
MOVD a9+72(FP), R12
|
|
||||||
MOVD R12, (2176+64)(R4)
|
|
||||||
|
|
||||||
// Call function.
|
|
||||||
LE_CALL
|
|
||||||
NOPH
|
|
||||||
XOR R0, R0 // Restore R0 to $0.
|
|
||||||
MOVD R4, 0(R9) // Save stack pointer.
|
|
||||||
|
|
||||||
MOVD R3, r1+80(FP)
|
|
||||||
MOVD R0, r2+88(FP)
|
|
||||||
MOVD R0, err+96(FP)
|
|
||||||
MOVW R3, R4
|
|
||||||
CMP R4, $-1
|
|
||||||
BNE done
|
|
||||||
BL addrerrno<>(SB)
|
|
||||||
MOVWZ 0(R3), R3
|
|
||||||
MOVD R3, err+96(FP)
|
|
||||||
done:
|
|
||||||
RET
|
|
||||||
|
|
||||||
// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64)
|
// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64)
|
||||||
TEXT ·svcCall(SB), NOSPLIT, $0
|
TEXT ·svcCall(SB), NOSPLIT, $0
|
||||||
BL runtime·save_g(SB) // Save g and stack pointer
|
BL runtime·save_g(SB) // Save g and stack pointer
|
||||||
@ -374,8 +106,7 @@ TEXT ·svcLoad(SB),NOSPLIT,$0
|
|||||||
MOVD name+0(FP), R0 // Move SVC args into registers
|
MOVD name+0(FP), R0 // Move SVC args into registers
|
||||||
MOVD $0x80000000, R1
|
MOVD $0x80000000, R1
|
||||||
MOVD $0, R15
|
MOVD $0, R15
|
||||||
BYTE $0x0A // SVC 08 LOAD
|
SVC_LOAD
|
||||||
BYTE $0x08
|
|
||||||
MOVW R15, R3 // Save return code from SVC
|
MOVW R15, R3 // Save return code from SVC
|
||||||
MOVD R2, R15 // Restore go stack pointer
|
MOVD R2, R15 // Restore go stack pointer
|
||||||
CMP R3, $0 // Check SVC return code
|
CMP R3, $0 // Check SVC return code
|
||||||
@ -383,18 +114,18 @@ TEXT ·svcLoad(SB),NOSPLIT,$0
|
|||||||
|
|
||||||
MOVD $-2, R3 // Reset last bit of entry point to zero
|
MOVD $-2, R3 // Reset last bit of entry point to zero
|
||||||
AND R0, R3
|
AND R0, R3
|
||||||
MOVD R3, addr+8(FP) // Return entry point returned by SVC
|
MOVD R3, ret+8(FP) // Return entry point returned by SVC
|
||||||
CMP R0, R3 // Check if last bit of entry point was set
|
CMP R0, R3 // Check if last bit of entry point was set
|
||||||
BNE done
|
BNE done
|
||||||
|
|
||||||
MOVD R15, R2 // Save go stack pointer
|
MOVD R15, R2 // Save go stack pointer
|
||||||
MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08)
|
MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08)
|
||||||
BYTE $0x0A // SVC 09 DELETE
|
SVC_DELETE
|
||||||
BYTE $0x09
|
|
||||||
MOVD R2, R15 // Restore go stack pointer
|
MOVD R2, R15 // Restore go stack pointer
|
||||||
|
|
||||||
error:
|
error:
|
||||||
MOVD $0, addr+8(FP) // Return 0 on failure
|
MOVD $0, ret+8(FP) // Return 0 on failure
|
||||||
|
|
||||||
done:
|
done:
|
||||||
XOR R0, R0 // Reset r0 to 0
|
XOR R0, R0 // Reset r0 to 0
|
||||||
RET
|
RET
|
||||||
@ -403,13 +134,12 @@ done:
|
|||||||
TEXT ·svcUnload(SB), NOSPLIT, $0
|
TEXT ·svcUnload(SB), NOSPLIT, $0
|
||||||
MOVD R15, R2 // Save go stack pointer
|
MOVD R15, R2 // Save go stack pointer
|
||||||
MOVD name+0(FP), R0 // Move SVC args into registers
|
MOVD name+0(FP), R0 // Move SVC args into registers
|
||||||
MOVD addr+8(FP), R15
|
MOVD fnptr+8(FP), R15
|
||||||
BYTE $0x0A // SVC 09
|
SVC_DELETE
|
||||||
BYTE $0x09
|
|
||||||
XOR R0, R0 // Reset r0 to 0
|
XOR R0, R0 // Reset r0 to 0
|
||||||
MOVD R15, R1 // Save SVC return code
|
MOVD R15, R1 // Save SVC return code
|
||||||
MOVD R2, R15 // Restore go stack pointer
|
MOVD R2, R15 // Restore go stack pointer
|
||||||
MOVD R1, rc+0(FP) // Return SVC return code
|
MOVD R1, ret+16(FP) // Return SVC return code
|
||||||
RET
|
RET
|
||||||
|
|
||||||
// func gettid() uint64
|
// func gettid() uint64
|
||||||
@ -420,7 +150,233 @@ TEXT ·gettid(SB), NOSPLIT, $0
|
|||||||
|
|
||||||
// Get CEECAATHDID
|
// Get CEECAATHDID
|
||||||
MOVD CAA(R8), R9
|
MOVD CAA(R8), R9
|
||||||
MOVD 0x3D0(R9), R9
|
MOVD CEECAATHDID(R9), R9
|
||||||
MOVD R9, ret+0(FP)
|
MOVD R9, ret+0(FP)
|
||||||
|
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
//
|
||||||
|
// Call LE function, if the return is -1
|
||||||
|
// errno and errno2 is retrieved
|
||||||
|
//
|
||||||
|
TEXT ·CallLeFuncWithErr(SB), NOSPLIT, $0
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD g, GOCB(R9)
|
||||||
|
|
||||||
|
// Restore LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9 // R9-> LE stack frame saving address
|
||||||
|
MOVD 0(R9), R4 // R4-> restore previously saved stack frame pointer
|
||||||
|
|
||||||
|
MOVD parms_base+8(FP), R7 // R7 -> argument array
|
||||||
|
MOVD parms_len+16(FP), R8 // R8 number of arguments
|
||||||
|
|
||||||
|
// arg 1 ---> R1
|
||||||
|
CMP R8, $0
|
||||||
|
BEQ docall
|
||||||
|
SUB $1, R8
|
||||||
|
MOVD 0(R7), R1
|
||||||
|
|
||||||
|
// arg 2 ---> R2
|
||||||
|
CMP R8, $0
|
||||||
|
BEQ docall
|
||||||
|
SUB $1, R8
|
||||||
|
ADD $8, R7
|
||||||
|
MOVD 0(R7), R2
|
||||||
|
|
||||||
|
// arg 3 --> R3
|
||||||
|
CMP R8, $0
|
||||||
|
BEQ docall
|
||||||
|
SUB $1, R8
|
||||||
|
ADD $8, R7
|
||||||
|
MOVD 0(R7), R3
|
||||||
|
|
||||||
|
CMP R8, $0
|
||||||
|
BEQ docall
|
||||||
|
MOVD $2176+16, R6 // starting LE stack address-8 to store 4th argument
|
||||||
|
|
||||||
|
repeat:
|
||||||
|
ADD $8, R7
|
||||||
|
MOVD 0(R7), R0 // advance arg pointer by 8 byte
|
||||||
|
ADD $8, R6 // advance LE argument address by 8 byte
|
||||||
|
MOVD R0, (R4)(R6*1) // copy argument from go-slice to le-frame
|
||||||
|
SUB $1, R8
|
||||||
|
CMP R8, $0
|
||||||
|
BNE repeat
|
||||||
|
|
||||||
|
docall:
|
||||||
|
MOVD funcdesc+0(FP), R8 // R8-> function descriptor
|
||||||
|
LMG 0(R8), R5, R6
|
||||||
|
MOVD $0, 0(R9) // R9 address of SAVSTACK_ASYNC
|
||||||
|
LE_CALL // balr R7, R6 (return #1)
|
||||||
|
NOPH
|
||||||
|
MOVD R3, ret+32(FP)
|
||||||
|
CMP R3, $-1 // compare result to -1
|
||||||
|
BNE done
|
||||||
|
|
||||||
|
// retrieve errno and errno2
|
||||||
|
MOVD zosLibVec<>(SB), R8
|
||||||
|
ADD $(__errno), R8
|
||||||
|
LMG 0(R8), R5, R6
|
||||||
|
LE_CALL // balr R7, R6 __errno (return #3)
|
||||||
|
NOPH
|
||||||
|
MOVWZ 0(R3), R3
|
||||||
|
MOVD R3, err+48(FP)
|
||||||
|
MOVD zosLibVec<>(SB), R8
|
||||||
|
ADD $(__err2ad), R8
|
||||||
|
LMG 0(R8), R5, R6
|
||||||
|
LE_CALL // balr R7, R6 __err2ad (return #2)
|
||||||
|
NOPH
|
||||||
|
MOVW (R3), R2 // retrieve errno2
|
||||||
|
MOVD R2, errno2+40(FP) // store in return area
|
||||||
|
|
||||||
|
done:
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
RET
|
||||||
|
|
||||||
|
//
|
||||||
|
// Call LE function, if the return is 0
|
||||||
|
// errno and errno2 is retrieved
|
||||||
|
//
|
||||||
|
TEXT ·CallLeFuncWithPtrReturn(SB), NOSPLIT, $0
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD g, GOCB(R9)
|
||||||
|
|
||||||
|
// Restore LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9 // R9-> LE stack frame saving address
|
||||||
|
MOVD 0(R9), R4 // R4-> restore previously saved stack frame pointer
|
||||||
|
|
||||||
|
MOVD parms_base+8(FP), R7 // R7 -> argument array
|
||||||
|
MOVD parms_len+16(FP), R8 // R8 number of arguments
|
||||||
|
|
||||||
|
// arg 1 ---> R1
|
||||||
|
CMP R8, $0
|
||||||
|
BEQ docall
|
||||||
|
SUB $1, R8
|
||||||
|
MOVD 0(R7), R1
|
||||||
|
|
||||||
|
// arg 2 ---> R2
|
||||||
|
CMP R8, $0
|
||||||
|
BEQ docall
|
||||||
|
SUB $1, R8
|
||||||
|
ADD $8, R7
|
||||||
|
MOVD 0(R7), R2
|
||||||
|
|
||||||
|
// arg 3 --> R3
|
||||||
|
CMP R8, $0
|
||||||
|
BEQ docall
|
||||||
|
SUB $1, R8
|
||||||
|
ADD $8, R7
|
||||||
|
MOVD 0(R7), R3
|
||||||
|
|
||||||
|
CMP R8, $0
|
||||||
|
BEQ docall
|
||||||
|
MOVD $2176+16, R6 // starting LE stack address-8 to store 4th argument
|
||||||
|
|
||||||
|
repeat:
|
||||||
|
ADD $8, R7
|
||||||
|
MOVD 0(R7), R0 // advance arg pointer by 8 byte
|
||||||
|
ADD $8, R6 // advance LE argument address by 8 byte
|
||||||
|
MOVD R0, (R4)(R6*1) // copy argument from go-slice to le-frame
|
||||||
|
SUB $1, R8
|
||||||
|
CMP R8, $0
|
||||||
|
BNE repeat
|
||||||
|
|
||||||
|
docall:
|
||||||
|
MOVD funcdesc+0(FP), R8 // R8-> function descriptor
|
||||||
|
LMG 0(R8), R5, R6
|
||||||
|
MOVD $0, 0(R9) // R9 address of SAVSTACK_ASYNC
|
||||||
|
LE_CALL // balr R7, R6 (return #1)
|
||||||
|
NOPH
|
||||||
|
MOVD R3, ret+32(FP)
|
||||||
|
CMP R3, $0 // compare result to 0
|
||||||
|
BNE done
|
||||||
|
|
||||||
|
// retrieve errno and errno2
|
||||||
|
MOVD zosLibVec<>(SB), R8
|
||||||
|
ADD $(__errno), R8
|
||||||
|
LMG 0(R8), R5, R6
|
||||||
|
LE_CALL // balr R7, R6 __errno (return #3)
|
||||||
|
NOPH
|
||||||
|
MOVWZ 0(R3), R3
|
||||||
|
MOVD R3, err+48(FP)
|
||||||
|
MOVD zosLibVec<>(SB), R8
|
||||||
|
ADD $(__err2ad), R8
|
||||||
|
LMG 0(R8), R5, R6
|
||||||
|
LE_CALL // balr R7, R6 __err2ad (return #2)
|
||||||
|
NOPH
|
||||||
|
MOVW (R3), R2 // retrieve errno2
|
||||||
|
MOVD R2, errno2+40(FP) // store in return area
|
||||||
|
XOR R2, R2
|
||||||
|
MOVWZ R2, (R3) // clear errno2
|
||||||
|
|
||||||
|
done:
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
RET
|
||||||
|
|
||||||
|
//
|
||||||
|
// function to test if a pointer can be safely dereferenced (content read)
|
||||||
|
// return 0 for succces
|
||||||
|
//
|
||||||
|
TEXT ·ptrtest(SB), NOSPLIT, $0-16
|
||||||
|
MOVD arg+0(FP), R10 // test pointer in R10
|
||||||
|
|
||||||
|
// set up R2 to point to CEECAADMC
|
||||||
|
BYTE $0xE3; BYTE $0x20; BYTE $0x04; BYTE $0xB8; BYTE $0x00; BYTE $0x17 // llgt 2,1208
|
||||||
|
BYTE $0xB9; BYTE $0x17; BYTE $0x00; BYTE $0x22 // llgtr 2,2
|
||||||
|
BYTE $0xA5; BYTE $0x26; BYTE $0x7F; BYTE $0xFF // nilh 2,32767
|
||||||
|
BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x58; BYTE $0x00; BYTE $0x04 // lg 2,88(2)
|
||||||
|
BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x08; BYTE $0x00; BYTE $0x04 // lg 2,8(2)
|
||||||
|
BYTE $0x41; BYTE $0x22; BYTE $0x03; BYTE $0x68 // la 2,872(2)
|
||||||
|
|
||||||
|
// set up R5 to point to the "shunt" path which set 1 to R3 (failure)
|
||||||
|
BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x33 // xgr 3,3
|
||||||
|
BYTE $0xA7; BYTE $0x55; BYTE $0x00; BYTE $0x04 // bras 5,lbl1
|
||||||
|
BYTE $0xA7; BYTE $0x39; BYTE $0x00; BYTE $0x01 // lghi 3,1
|
||||||
|
|
||||||
|
// if r3 is not zero (failed) then branch to finish
|
||||||
|
BYTE $0xB9; BYTE $0x02; BYTE $0x00; BYTE $0x33 // lbl1 ltgr 3,3
|
||||||
|
BYTE $0xA7; BYTE $0x74; BYTE $0x00; BYTE $0x08 // brc b'0111',lbl2
|
||||||
|
|
||||||
|
// stomic store shunt address in R5 into CEECAADMC
|
||||||
|
BYTE $0xE3; BYTE $0x52; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 5,0(2)
|
||||||
|
|
||||||
|
// now try reading from the test pointer in R10, if it fails it branches to the "lghi" instruction above
|
||||||
|
BYTE $0xE3; BYTE $0x9A; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x04 // lg 9,0(10)
|
||||||
|
|
||||||
|
// finish here, restore 0 into CEECAADMC
|
||||||
|
BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x99 // lbl2 xgr 9,9
|
||||||
|
BYTE $0xE3; BYTE $0x92; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 9,0(2)
|
||||||
|
MOVD R3, ret+8(FP) // result in R3
|
||||||
|
RET
|
||||||
|
|
||||||
|
//
|
||||||
|
// function to test if a untptr can be loaded from a pointer
|
||||||
|
// return 1: the 8-byte content
|
||||||
|
// 2: 0 for success, 1 for failure
|
||||||
|
//
|
||||||
|
// func safeload(ptr uintptr) ( value uintptr, error uintptr)
|
||||||
|
TEXT ·safeload(SB), NOSPLIT, $0-24
|
||||||
|
MOVD ptr+0(FP), R10 // test pointer in R10
|
||||||
|
MOVD $0x0, R6
|
||||||
|
BYTE $0xE3; BYTE $0x20; BYTE $0x04; BYTE $0xB8; BYTE $0x00; BYTE $0x17 // llgt 2,1208
|
||||||
|
BYTE $0xB9; BYTE $0x17; BYTE $0x00; BYTE $0x22 // llgtr 2,2
|
||||||
|
BYTE $0xA5; BYTE $0x26; BYTE $0x7F; BYTE $0xFF // nilh 2,32767
|
||||||
|
BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x58; BYTE $0x00; BYTE $0x04 // lg 2,88(2)
|
||||||
|
BYTE $0xE3; BYTE $0x22; BYTE $0x00; BYTE $0x08; BYTE $0x00; BYTE $0x04 // lg 2,8(2)
|
||||||
|
BYTE $0x41; BYTE $0x22; BYTE $0x03; BYTE $0x68 // la 2,872(2)
|
||||||
|
BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x33 // xgr 3,3
|
||||||
|
BYTE $0xA7; BYTE $0x55; BYTE $0x00; BYTE $0x04 // bras 5,lbl1
|
||||||
|
BYTE $0xA7; BYTE $0x39; BYTE $0x00; BYTE $0x01 // lghi 3,1
|
||||||
|
BYTE $0xB9; BYTE $0x02; BYTE $0x00; BYTE $0x33 // lbl1 ltgr 3,3
|
||||||
|
BYTE $0xA7; BYTE $0x74; BYTE $0x00; BYTE $0x08 // brc b'0111',lbl2
|
||||||
|
BYTE $0xE3; BYTE $0x52; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 5,0(2)
|
||||||
|
BYTE $0xE3; BYTE $0x6A; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x04 // lg 6,0(10)
|
||||||
|
BYTE $0xB9; BYTE $0x82; BYTE $0x00; BYTE $0x99 // lbl2 xgr 9,9
|
||||||
|
BYTE $0xE3; BYTE $0x92; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x24 // stg 9,0(2)
|
||||||
|
MOVD R6, value+8(FP) // result in R6
|
||||||
|
MOVD R3, error+16(FP) // error in R3
|
||||||
|
RET
|
||||||
|
36
vendor/golang.org/x/sys/unix/auxv.go
generated
vendored
Normal file
36
vendor/golang.org/x/sys/unix/auxv.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Copyright 2025 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 go1.21 && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos)
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:linkname runtime_getAuxv runtime.getAuxv
|
||||||
|
func runtime_getAuxv() []uintptr
|
||||||
|
|
||||||
|
// Auxv returns the ELF auxiliary vector as a sequence of key/value pairs.
|
||||||
|
// The returned slice is always a fresh copy, owned by the caller.
|
||||||
|
// It returns an error on non-ELF platforms, or if the auxiliary vector cannot be accessed,
|
||||||
|
// which happens in some locked-down environments and build modes.
|
||||||
|
func Auxv() ([][2]uintptr, error) {
|
||||||
|
vec := runtime_getAuxv()
|
||||||
|
vecLen := len(vec)
|
||||||
|
|
||||||
|
if vecLen == 0 {
|
||||||
|
return nil, syscall.ENOENT
|
||||||
|
}
|
||||||
|
|
||||||
|
if vecLen%2 != 0 {
|
||||||
|
return nil, syscall.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make([]uintptr, vecLen)
|
||||||
|
copy(result, vec)
|
||||||
|
return unsafe.Slice((*[2]uintptr)(unsafe.Pointer(&result[0])), vecLen/2), nil
|
||||||
|
}
|
13
vendor/golang.org/x/sys/unix/auxv_unsupported.go
generated
vendored
Normal file
13
vendor/golang.org/x/sys/unix/auxv_unsupported.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2025 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 !go1.21 && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos)
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func Auxv() ([][2]uintptr, error) {
|
||||||
|
return nil, syscall.ENOTSUP
|
||||||
|
}
|
657
vendor/golang.org/x/sys/unix/bpxsvc_zos.go
generated
vendored
Normal file
657
vendor/golang.org/x/sys/unix/bpxsvc_zos.go
generated
vendored
Normal file
@ -0,0 +1,657 @@
|
|||||||
|
// Copyright 2024 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 zos
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:noescape
|
||||||
|
func bpxcall(plist []unsafe.Pointer, bpx_offset int64)
|
||||||
|
|
||||||
|
//go:noescape
|
||||||
|
func A2e([]byte)
|
||||||
|
|
||||||
|
//go:noescape
|
||||||
|
func E2a([]byte)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BPX4STA = 192 // stat
|
||||||
|
BPX4FST = 104 // fstat
|
||||||
|
BPX4LST = 132 // lstat
|
||||||
|
BPX4OPN = 156 // open
|
||||||
|
BPX4CLO = 72 // close
|
||||||
|
BPX4CHR = 500 // chattr
|
||||||
|
BPX4FCR = 504 // fchattr
|
||||||
|
BPX4LCR = 1180 // lchattr
|
||||||
|
BPX4CTW = 492 // cond_timed_wait
|
||||||
|
BPX4GTH = 1056 // __getthent
|
||||||
|
BPX4PTQ = 412 // pthread_quiesc
|
||||||
|
BPX4PTR = 320 // ptrace
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
//options
|
||||||
|
//byte1
|
||||||
|
BPX_OPNFHIGH = 0x80
|
||||||
|
//byte2
|
||||||
|
BPX_OPNFEXEC = 0x80
|
||||||
|
//byte3
|
||||||
|
BPX_O_NOLARGEFILE = 0x08
|
||||||
|
BPX_O_LARGEFILE = 0x04
|
||||||
|
BPX_O_ASYNCSIG = 0x02
|
||||||
|
BPX_O_SYNC = 0x01
|
||||||
|
//byte4
|
||||||
|
BPX_O_CREXCL = 0xc0
|
||||||
|
BPX_O_CREAT = 0x80
|
||||||
|
BPX_O_EXCL = 0x40
|
||||||
|
BPX_O_NOCTTY = 0x20
|
||||||
|
BPX_O_TRUNC = 0x10
|
||||||
|
BPX_O_APPEND = 0x08
|
||||||
|
BPX_O_NONBLOCK = 0x04
|
||||||
|
BPX_FNDELAY = 0x04
|
||||||
|
BPX_O_RDWR = 0x03
|
||||||
|
BPX_O_RDONLY = 0x02
|
||||||
|
BPX_O_WRONLY = 0x01
|
||||||
|
BPX_O_ACCMODE = 0x03
|
||||||
|
BPX_O_GETFL = 0x0f
|
||||||
|
|
||||||
|
//mode
|
||||||
|
// byte1 (file type)
|
||||||
|
BPX_FT_DIR = 1
|
||||||
|
BPX_FT_CHARSPEC = 2
|
||||||
|
BPX_FT_REGFILE = 3
|
||||||
|
BPX_FT_FIFO = 4
|
||||||
|
BPX_FT_SYMLINK = 5
|
||||||
|
BPX_FT_SOCKET = 6
|
||||||
|
//byte3
|
||||||
|
BPX_S_ISUID = 0x08
|
||||||
|
BPX_S_ISGID = 0x04
|
||||||
|
BPX_S_ISVTX = 0x02
|
||||||
|
BPX_S_IRWXU1 = 0x01
|
||||||
|
BPX_S_IRUSR = 0x01
|
||||||
|
//byte4
|
||||||
|
BPX_S_IRWXU2 = 0xc0
|
||||||
|
BPX_S_IWUSR = 0x80
|
||||||
|
BPX_S_IXUSR = 0x40
|
||||||
|
BPX_S_IRWXG = 0x38
|
||||||
|
BPX_S_IRGRP = 0x20
|
||||||
|
BPX_S_IWGRP = 0x10
|
||||||
|
BPX_S_IXGRP = 0x08
|
||||||
|
BPX_S_IRWXOX = 0x07
|
||||||
|
BPX_S_IROTH = 0x04
|
||||||
|
BPX_S_IWOTH = 0x02
|
||||||
|
BPX_S_IXOTH = 0x01
|
||||||
|
|
||||||
|
CW_INTRPT = 1
|
||||||
|
CW_CONDVAR = 32
|
||||||
|
CW_TIMEOUT = 64
|
||||||
|
|
||||||
|
PGTHA_NEXT = 2
|
||||||
|
PGTHA_CURRENT = 1
|
||||||
|
PGTHA_FIRST = 0
|
||||||
|
PGTHA_LAST = 3
|
||||||
|
PGTHA_PROCESS = 0x80
|
||||||
|
PGTHA_CONTTY = 0x40
|
||||||
|
PGTHA_PATH = 0x20
|
||||||
|
PGTHA_COMMAND = 0x10
|
||||||
|
PGTHA_FILEDATA = 0x08
|
||||||
|
PGTHA_THREAD = 0x04
|
||||||
|
PGTHA_PTAG = 0x02
|
||||||
|
PGTHA_COMMANDLONG = 0x01
|
||||||
|
PGTHA_THREADFAST = 0x80
|
||||||
|
PGTHA_FILEPATH = 0x40
|
||||||
|
PGTHA_THDSIGMASK = 0x20
|
||||||
|
// thread quiece mode
|
||||||
|
QUIESCE_TERM int32 = 1
|
||||||
|
QUIESCE_FORCE int32 = 2
|
||||||
|
QUIESCE_QUERY int32 = 3
|
||||||
|
QUIESCE_FREEZE int32 = 4
|
||||||
|
QUIESCE_UNFREEZE int32 = 5
|
||||||
|
FREEZE_THIS_THREAD int32 = 6
|
||||||
|
FREEZE_EXIT int32 = 8
|
||||||
|
QUIESCE_SRB int32 = 9
|
||||||
|
)
|
||||||
|
|
||||||
|
type Pgtha struct {
|
||||||
|
Pid uint32 // 0
|
||||||
|
Tid0 uint32 // 4
|
||||||
|
Tid1 uint32
|
||||||
|
Accesspid byte // C
|
||||||
|
Accesstid byte // D
|
||||||
|
Accessasid uint16 // E
|
||||||
|
Loginname [8]byte // 10
|
||||||
|
Flag1 byte // 18
|
||||||
|
Flag1b2 byte // 19
|
||||||
|
}
|
||||||
|
|
||||||
|
type Bpxystat_t struct { // DSECT BPXYSTAT
|
||||||
|
St_id [4]uint8 // 0
|
||||||
|
St_length uint16 // 0x4
|
||||||
|
St_version uint16 // 0x6
|
||||||
|
St_mode uint32 // 0x8
|
||||||
|
St_ino uint32 // 0xc
|
||||||
|
St_dev uint32 // 0x10
|
||||||
|
St_nlink uint32 // 0x14
|
||||||
|
St_uid uint32 // 0x18
|
||||||
|
St_gid uint32 // 0x1c
|
||||||
|
St_size uint64 // 0x20
|
||||||
|
St_atime uint32 // 0x28
|
||||||
|
St_mtime uint32 // 0x2c
|
||||||
|
St_ctime uint32 // 0x30
|
||||||
|
St_rdev uint32 // 0x34
|
||||||
|
St_auditoraudit uint32 // 0x38
|
||||||
|
St_useraudit uint32 // 0x3c
|
||||||
|
St_blksize uint32 // 0x40
|
||||||
|
St_createtime uint32 // 0x44
|
||||||
|
St_auditid [4]uint32 // 0x48
|
||||||
|
St_res01 uint32 // 0x58
|
||||||
|
Ft_ccsid uint16 // 0x5c
|
||||||
|
Ft_flags uint16 // 0x5e
|
||||||
|
St_res01a [2]uint32 // 0x60
|
||||||
|
St_res02 uint32 // 0x68
|
||||||
|
St_blocks uint32 // 0x6c
|
||||||
|
St_opaque [3]uint8 // 0x70
|
||||||
|
St_visible uint8 // 0x73
|
||||||
|
St_reftime uint32 // 0x74
|
||||||
|
St_fid uint64 // 0x78
|
||||||
|
St_filefmt uint8 // 0x80
|
||||||
|
St_fspflag2 uint8 // 0x81
|
||||||
|
St_res03 [2]uint8 // 0x82
|
||||||
|
St_ctimemsec uint32 // 0x84
|
||||||
|
St_seclabel [8]uint8 // 0x88
|
||||||
|
St_res04 [4]uint8 // 0x90
|
||||||
|
// end of version 1
|
||||||
|
_ uint32 // 0x94
|
||||||
|
St_atime64 uint64 // 0x98
|
||||||
|
St_mtime64 uint64 // 0xa0
|
||||||
|
St_ctime64 uint64 // 0xa8
|
||||||
|
St_createtime64 uint64 // 0xb0
|
||||||
|
St_reftime64 uint64 // 0xb8
|
||||||
|
_ uint64 // 0xc0
|
||||||
|
St_res05 [16]uint8 // 0xc8
|
||||||
|
// end of version 2
|
||||||
|
}
|
||||||
|
|
||||||
|
type BpxFilestatus struct {
|
||||||
|
Oflag1 byte
|
||||||
|
Oflag2 byte
|
||||||
|
Oflag3 byte
|
||||||
|
Oflag4 byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type BpxMode struct {
|
||||||
|
Ftype byte
|
||||||
|
Mode1 byte
|
||||||
|
Mode2 byte
|
||||||
|
Mode3 byte
|
||||||
|
}
|
||||||
|
|
||||||
|
// Thr attribute structure for extended attributes
|
||||||
|
type Bpxyatt_t struct { // DSECT BPXYATT
|
||||||
|
Att_id [4]uint8
|
||||||
|
Att_version uint16
|
||||||
|
Att_res01 [2]uint8
|
||||||
|
Att_setflags1 uint8
|
||||||
|
Att_setflags2 uint8
|
||||||
|
Att_setflags3 uint8
|
||||||
|
Att_setflags4 uint8
|
||||||
|
Att_mode uint32
|
||||||
|
Att_uid uint32
|
||||||
|
Att_gid uint32
|
||||||
|
Att_opaquemask [3]uint8
|
||||||
|
Att_visblmaskres uint8
|
||||||
|
Att_opaque [3]uint8
|
||||||
|
Att_visibleres uint8
|
||||||
|
Att_size_h uint32
|
||||||
|
Att_size_l uint32
|
||||||
|
Att_atime uint32
|
||||||
|
Att_mtime uint32
|
||||||
|
Att_auditoraudit uint32
|
||||||
|
Att_useraudit uint32
|
||||||
|
Att_ctime uint32
|
||||||
|
Att_reftime uint32
|
||||||
|
// end of version 1
|
||||||
|
Att_filefmt uint8
|
||||||
|
Att_res02 [3]uint8
|
||||||
|
Att_filetag uint32
|
||||||
|
Att_res03 [8]uint8
|
||||||
|
// end of version 2
|
||||||
|
Att_atime64 uint64
|
||||||
|
Att_mtime64 uint64
|
||||||
|
Att_ctime64 uint64
|
||||||
|
Att_reftime64 uint64
|
||||||
|
Att_seclabel [8]uint8
|
||||||
|
Att_ver3res02 [8]uint8
|
||||||
|
// end of version 3
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxOpen(name string, options *BpxFilestatus, mode *BpxMode) (rv int32, rc int32, rn int32) {
|
||||||
|
if len(name) < 1024 {
|
||||||
|
var namebuf [1024]byte
|
||||||
|
sz := int32(copy(namebuf[:], name))
|
||||||
|
A2e(namebuf[:sz])
|
||||||
|
var parms [7]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&sz)
|
||||||
|
parms[1] = unsafe.Pointer(&namebuf[0])
|
||||||
|
parms[2] = unsafe.Pointer(options)
|
||||||
|
parms[3] = unsafe.Pointer(mode)
|
||||||
|
parms[4] = unsafe.Pointer(&rv)
|
||||||
|
parms[5] = unsafe.Pointer(&rc)
|
||||||
|
parms[6] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4OPN)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
return -1, -1, -1
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxClose(fd int32) (rv int32, rc int32, rn int32) {
|
||||||
|
var parms [4]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&fd)
|
||||||
|
parms[1] = unsafe.Pointer(&rv)
|
||||||
|
parms[2] = unsafe.Pointer(&rc)
|
||||||
|
parms[3] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4CLO)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxFileFStat(fd int32, st *Bpxystat_t) (rv int32, rc int32, rn int32) {
|
||||||
|
st.St_id = [4]uint8{0xe2, 0xe3, 0xc1, 0xe3}
|
||||||
|
st.St_version = 2
|
||||||
|
stat_sz := uint32(unsafe.Sizeof(*st))
|
||||||
|
var parms [6]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&fd)
|
||||||
|
parms[1] = unsafe.Pointer(&stat_sz)
|
||||||
|
parms[2] = unsafe.Pointer(st)
|
||||||
|
parms[3] = unsafe.Pointer(&rv)
|
||||||
|
parms[4] = unsafe.Pointer(&rc)
|
||||||
|
parms[5] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4FST)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxFileStat(name string, st *Bpxystat_t) (rv int32, rc int32, rn int32) {
|
||||||
|
if len(name) < 1024 {
|
||||||
|
var namebuf [1024]byte
|
||||||
|
sz := int32(copy(namebuf[:], name))
|
||||||
|
A2e(namebuf[:sz])
|
||||||
|
st.St_id = [4]uint8{0xe2, 0xe3, 0xc1, 0xe3}
|
||||||
|
st.St_version = 2
|
||||||
|
stat_sz := uint32(unsafe.Sizeof(*st))
|
||||||
|
var parms [7]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&sz)
|
||||||
|
parms[1] = unsafe.Pointer(&namebuf[0])
|
||||||
|
parms[2] = unsafe.Pointer(&stat_sz)
|
||||||
|
parms[3] = unsafe.Pointer(st)
|
||||||
|
parms[4] = unsafe.Pointer(&rv)
|
||||||
|
parms[5] = unsafe.Pointer(&rc)
|
||||||
|
parms[6] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4STA)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
return -1, -1, -1
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxFileLStat(name string, st *Bpxystat_t) (rv int32, rc int32, rn int32) {
|
||||||
|
if len(name) < 1024 {
|
||||||
|
var namebuf [1024]byte
|
||||||
|
sz := int32(copy(namebuf[:], name))
|
||||||
|
A2e(namebuf[:sz])
|
||||||
|
st.St_id = [4]uint8{0xe2, 0xe3, 0xc1, 0xe3}
|
||||||
|
st.St_version = 2
|
||||||
|
stat_sz := uint32(unsafe.Sizeof(*st))
|
||||||
|
var parms [7]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&sz)
|
||||||
|
parms[1] = unsafe.Pointer(&namebuf[0])
|
||||||
|
parms[2] = unsafe.Pointer(&stat_sz)
|
||||||
|
parms[3] = unsafe.Pointer(st)
|
||||||
|
parms[4] = unsafe.Pointer(&rv)
|
||||||
|
parms[5] = unsafe.Pointer(&rc)
|
||||||
|
parms[6] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4LST)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
return -1, -1, -1
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxChattr(path string, attr *Bpxyatt_t) (rv int32, rc int32, rn int32) {
|
||||||
|
if len(path) >= 1024 {
|
||||||
|
return -1, -1, -1
|
||||||
|
}
|
||||||
|
var namebuf [1024]byte
|
||||||
|
sz := int32(copy(namebuf[:], path))
|
||||||
|
A2e(namebuf[:sz])
|
||||||
|
attr_sz := uint32(unsafe.Sizeof(*attr))
|
||||||
|
var parms [7]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&sz)
|
||||||
|
parms[1] = unsafe.Pointer(&namebuf[0])
|
||||||
|
parms[2] = unsafe.Pointer(&attr_sz)
|
||||||
|
parms[3] = unsafe.Pointer(attr)
|
||||||
|
parms[4] = unsafe.Pointer(&rv)
|
||||||
|
parms[5] = unsafe.Pointer(&rc)
|
||||||
|
parms[6] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4CHR)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxLchattr(path string, attr *Bpxyatt_t) (rv int32, rc int32, rn int32) {
|
||||||
|
if len(path) >= 1024 {
|
||||||
|
return -1, -1, -1
|
||||||
|
}
|
||||||
|
var namebuf [1024]byte
|
||||||
|
sz := int32(copy(namebuf[:], path))
|
||||||
|
A2e(namebuf[:sz])
|
||||||
|
attr_sz := uint32(unsafe.Sizeof(*attr))
|
||||||
|
var parms [7]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&sz)
|
||||||
|
parms[1] = unsafe.Pointer(&namebuf[0])
|
||||||
|
parms[2] = unsafe.Pointer(&attr_sz)
|
||||||
|
parms[3] = unsafe.Pointer(attr)
|
||||||
|
parms[4] = unsafe.Pointer(&rv)
|
||||||
|
parms[5] = unsafe.Pointer(&rc)
|
||||||
|
parms[6] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4LCR)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxFchattr(fd int32, attr *Bpxyatt_t) (rv int32, rc int32, rn int32) {
|
||||||
|
attr_sz := uint32(unsafe.Sizeof(*attr))
|
||||||
|
var parms [6]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&fd)
|
||||||
|
parms[1] = unsafe.Pointer(&attr_sz)
|
||||||
|
parms[2] = unsafe.Pointer(attr)
|
||||||
|
parms[3] = unsafe.Pointer(&rv)
|
||||||
|
parms[4] = unsafe.Pointer(&rc)
|
||||||
|
parms[5] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4FCR)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
|
||||||
|
func BpxCondTimedWait(sec uint32, nsec uint32, events uint32, secrem *uint32, nsecrem *uint32) (rv int32, rc int32, rn int32) {
|
||||||
|
var parms [8]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&sec)
|
||||||
|
parms[1] = unsafe.Pointer(&nsec)
|
||||||
|
parms[2] = unsafe.Pointer(&events)
|
||||||
|
parms[3] = unsafe.Pointer(secrem)
|
||||||
|
parms[4] = unsafe.Pointer(nsecrem)
|
||||||
|
parms[5] = unsafe.Pointer(&rv)
|
||||||
|
parms[6] = unsafe.Pointer(&rc)
|
||||||
|
parms[7] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4CTW)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
func BpxGetthent(in *Pgtha, outlen *uint32, out unsafe.Pointer) (rv int32, rc int32, rn int32) {
|
||||||
|
var parms [7]unsafe.Pointer
|
||||||
|
inlen := uint32(26) // nothing else will work. Go says Pgtha is 28-byte because of alignment, but Pgtha is "packed" and must be 26-byte
|
||||||
|
parms[0] = unsafe.Pointer(&inlen)
|
||||||
|
parms[1] = unsafe.Pointer(&in)
|
||||||
|
parms[2] = unsafe.Pointer(outlen)
|
||||||
|
parms[3] = unsafe.Pointer(&out)
|
||||||
|
parms[4] = unsafe.Pointer(&rv)
|
||||||
|
parms[5] = unsafe.Pointer(&rc)
|
||||||
|
parms[6] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4GTH)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
func ZosJobname() (jobname string, err error) {
|
||||||
|
var pgtha Pgtha
|
||||||
|
pgtha.Pid = uint32(Getpid())
|
||||||
|
pgtha.Accesspid = PGTHA_CURRENT
|
||||||
|
pgtha.Flag1 = PGTHA_PROCESS
|
||||||
|
var out [256]byte
|
||||||
|
var outlen uint32
|
||||||
|
outlen = 256
|
||||||
|
rv, rc, rn := BpxGetthent(&pgtha, &outlen, unsafe.Pointer(&out[0]))
|
||||||
|
if rv == 0 {
|
||||||
|
gthc := []byte{0x87, 0xa3, 0x88, 0x83} // 'gthc' in ebcdic
|
||||||
|
ix := bytes.Index(out[:], gthc)
|
||||||
|
if ix == -1 {
|
||||||
|
err = fmt.Errorf("BPX4GTH: gthc return data not found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
jn := out[ix+80 : ix+88] // we didn't declare Pgthc, but jobname is 8-byte at offset 80
|
||||||
|
E2a(jn)
|
||||||
|
jobname = string(bytes.TrimRight(jn, " "))
|
||||||
|
|
||||||
|
} else {
|
||||||
|
err = fmt.Errorf("BPX4GTH: rc=%d errno=%d reason=code=0x%x", rv, rc, rn)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func Bpx4ptq(code int32, data string) (rv int32, rc int32, rn int32) {
|
||||||
|
var userdata [8]byte
|
||||||
|
var parms [5]unsafe.Pointer
|
||||||
|
copy(userdata[:], data+" ")
|
||||||
|
A2e(userdata[:])
|
||||||
|
parms[0] = unsafe.Pointer(&code)
|
||||||
|
parms[1] = unsafe.Pointer(&userdata[0])
|
||||||
|
parms[2] = unsafe.Pointer(&rv)
|
||||||
|
parms[3] = unsafe.Pointer(&rc)
|
||||||
|
parms[4] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4PTQ)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
PT_TRACE_ME = 0 // Debug this process
|
||||||
|
PT_READ_I = 1 // Read a full word
|
||||||
|
PT_READ_D = 2 // Read a full word
|
||||||
|
PT_READ_U = 3 // Read control info
|
||||||
|
PT_WRITE_I = 4 //Write a full word
|
||||||
|
PT_WRITE_D = 5 //Write a full word
|
||||||
|
PT_CONTINUE = 7 //Continue the process
|
||||||
|
PT_KILL = 8 //Terminate the process
|
||||||
|
PT_READ_GPR = 11 // Read GPR, CR, PSW
|
||||||
|
PT_READ_FPR = 12 // Read FPR
|
||||||
|
PT_READ_VR = 13 // Read VR
|
||||||
|
PT_WRITE_GPR = 14 // Write GPR, CR, PSW
|
||||||
|
PT_WRITE_FPR = 15 // Write FPR
|
||||||
|
PT_WRITE_VR = 16 // Write VR
|
||||||
|
PT_READ_BLOCK = 17 // Read storage
|
||||||
|
PT_WRITE_BLOCK = 19 // Write storage
|
||||||
|
PT_READ_GPRH = 20 // Read GPRH
|
||||||
|
PT_WRITE_GPRH = 21 // Write GPRH
|
||||||
|
PT_REGHSET = 22 // Read all GPRHs
|
||||||
|
PT_ATTACH = 30 // Attach to a process
|
||||||
|
PT_DETACH = 31 // Detach from a process
|
||||||
|
PT_REGSET = 32 // Read all GPRs
|
||||||
|
PT_REATTACH = 33 // Reattach to a process
|
||||||
|
PT_LDINFO = 34 // Read loader info
|
||||||
|
PT_MULTI = 35 // Multi process mode
|
||||||
|
PT_LD64INFO = 36 // RMODE64 Info Area
|
||||||
|
PT_BLOCKREQ = 40 // Block request
|
||||||
|
PT_THREAD_INFO = 60 // Read thread info
|
||||||
|
PT_THREAD_MODIFY = 61
|
||||||
|
PT_THREAD_READ_FOCUS = 62
|
||||||
|
PT_THREAD_WRITE_FOCUS = 63
|
||||||
|
PT_THREAD_HOLD = 64
|
||||||
|
PT_THREAD_SIGNAL = 65
|
||||||
|
PT_EXPLAIN = 66
|
||||||
|
PT_EVENTS = 67
|
||||||
|
PT_THREAD_INFO_EXTENDED = 68
|
||||||
|
PT_REATTACH2 = 71
|
||||||
|
PT_CAPTURE = 72
|
||||||
|
PT_UNCAPTURE = 73
|
||||||
|
PT_GET_THREAD_TCB = 74
|
||||||
|
PT_GET_ALET = 75
|
||||||
|
PT_SWAPIN = 76
|
||||||
|
PT_EXTENDED_EVENT = 98
|
||||||
|
PT_RECOVER = 99 // Debug a program check
|
||||||
|
PT_GPR0 = 0 // General purpose register 0
|
||||||
|
PT_GPR1 = 1 // General purpose register 1
|
||||||
|
PT_GPR2 = 2 // General purpose register 2
|
||||||
|
PT_GPR3 = 3 // General purpose register 3
|
||||||
|
PT_GPR4 = 4 // General purpose register 4
|
||||||
|
PT_GPR5 = 5 // General purpose register 5
|
||||||
|
PT_GPR6 = 6 // General purpose register 6
|
||||||
|
PT_GPR7 = 7 // General purpose register 7
|
||||||
|
PT_GPR8 = 8 // General purpose register 8
|
||||||
|
PT_GPR9 = 9 // General purpose register 9
|
||||||
|
PT_GPR10 = 10 // General purpose register 10
|
||||||
|
PT_GPR11 = 11 // General purpose register 11
|
||||||
|
PT_GPR12 = 12 // General purpose register 12
|
||||||
|
PT_GPR13 = 13 // General purpose register 13
|
||||||
|
PT_GPR14 = 14 // General purpose register 14
|
||||||
|
PT_GPR15 = 15 // General purpose register 15
|
||||||
|
PT_FPR0 = 16 // Floating point register 0
|
||||||
|
PT_FPR1 = 17 // Floating point register 1
|
||||||
|
PT_FPR2 = 18 // Floating point register 2
|
||||||
|
PT_FPR3 = 19 // Floating point register 3
|
||||||
|
PT_FPR4 = 20 // Floating point register 4
|
||||||
|
PT_FPR5 = 21 // Floating point register 5
|
||||||
|
PT_FPR6 = 22 // Floating point register 6
|
||||||
|
PT_FPR7 = 23 // Floating point register 7
|
||||||
|
PT_FPR8 = 24 // Floating point register 8
|
||||||
|
PT_FPR9 = 25 // Floating point register 9
|
||||||
|
PT_FPR10 = 26 // Floating point register 10
|
||||||
|
PT_FPR11 = 27 // Floating point register 11
|
||||||
|
PT_FPR12 = 28 // Floating point register 12
|
||||||
|
PT_FPR13 = 29 // Floating point register 13
|
||||||
|
PT_FPR14 = 30 // Floating point register 14
|
||||||
|
PT_FPR15 = 31 // Floating point register 15
|
||||||
|
PT_FPC = 32 // Floating point control register
|
||||||
|
PT_PSW = 40 // PSW
|
||||||
|
PT_PSW0 = 40 // Left half of the PSW
|
||||||
|
PT_PSW1 = 41 // Right half of the PSW
|
||||||
|
PT_CR0 = 42 // Control register 0
|
||||||
|
PT_CR1 = 43 // Control register 1
|
||||||
|
PT_CR2 = 44 // Control register 2
|
||||||
|
PT_CR3 = 45 // Control register 3
|
||||||
|
PT_CR4 = 46 // Control register 4
|
||||||
|
PT_CR5 = 47 // Control register 5
|
||||||
|
PT_CR6 = 48 // Control register 6
|
||||||
|
PT_CR7 = 49 // Control register 7
|
||||||
|
PT_CR8 = 50 // Control register 8
|
||||||
|
PT_CR9 = 51 // Control register 9
|
||||||
|
PT_CR10 = 52 // Control register 10
|
||||||
|
PT_CR11 = 53 // Control register 11
|
||||||
|
PT_CR12 = 54 // Control register 12
|
||||||
|
PT_CR13 = 55 // Control register 13
|
||||||
|
PT_CR14 = 56 // Control register 14
|
||||||
|
PT_CR15 = 57 // Control register 15
|
||||||
|
PT_GPRH0 = 58 // GP High register 0
|
||||||
|
PT_GPRH1 = 59 // GP High register 1
|
||||||
|
PT_GPRH2 = 60 // GP High register 2
|
||||||
|
PT_GPRH3 = 61 // GP High register 3
|
||||||
|
PT_GPRH4 = 62 // GP High register 4
|
||||||
|
PT_GPRH5 = 63 // GP High register 5
|
||||||
|
PT_GPRH6 = 64 // GP High register 6
|
||||||
|
PT_GPRH7 = 65 // GP High register 7
|
||||||
|
PT_GPRH8 = 66 // GP High register 8
|
||||||
|
PT_GPRH9 = 67 // GP High register 9
|
||||||
|
PT_GPRH10 = 68 // GP High register 10
|
||||||
|
PT_GPRH11 = 69 // GP High register 11
|
||||||
|
PT_GPRH12 = 70 // GP High register 12
|
||||||
|
PT_GPRH13 = 71 // GP High register 13
|
||||||
|
PT_GPRH14 = 72 // GP High register 14
|
||||||
|
PT_GPRH15 = 73 // GP High register 15
|
||||||
|
PT_VR0 = 74 // Vector register 0
|
||||||
|
PT_VR1 = 75 // Vector register 1
|
||||||
|
PT_VR2 = 76 // Vector register 2
|
||||||
|
PT_VR3 = 77 // Vector register 3
|
||||||
|
PT_VR4 = 78 // Vector register 4
|
||||||
|
PT_VR5 = 79 // Vector register 5
|
||||||
|
PT_VR6 = 80 // Vector register 6
|
||||||
|
PT_VR7 = 81 // Vector register 7
|
||||||
|
PT_VR8 = 82 // Vector register 8
|
||||||
|
PT_VR9 = 83 // Vector register 9
|
||||||
|
PT_VR10 = 84 // Vector register 10
|
||||||
|
PT_VR11 = 85 // Vector register 11
|
||||||
|
PT_VR12 = 86 // Vector register 12
|
||||||
|
PT_VR13 = 87 // Vector register 13
|
||||||
|
PT_VR14 = 88 // Vector register 14
|
||||||
|
PT_VR15 = 89 // Vector register 15
|
||||||
|
PT_VR16 = 90 // Vector register 16
|
||||||
|
PT_VR17 = 91 // Vector register 17
|
||||||
|
PT_VR18 = 92 // Vector register 18
|
||||||
|
PT_VR19 = 93 // Vector register 19
|
||||||
|
PT_VR20 = 94 // Vector register 20
|
||||||
|
PT_VR21 = 95 // Vector register 21
|
||||||
|
PT_VR22 = 96 // Vector register 22
|
||||||
|
PT_VR23 = 97 // Vector register 23
|
||||||
|
PT_VR24 = 98 // Vector register 24
|
||||||
|
PT_VR25 = 99 // Vector register 25
|
||||||
|
PT_VR26 = 100 // Vector register 26
|
||||||
|
PT_VR27 = 101 // Vector register 27
|
||||||
|
PT_VR28 = 102 // Vector register 28
|
||||||
|
PT_VR29 = 103 // Vector register 29
|
||||||
|
PT_VR30 = 104 // Vector register 30
|
||||||
|
PT_VR31 = 105 // Vector register 31
|
||||||
|
PT_PSWG = 106 // PSWG
|
||||||
|
PT_PSWG0 = 106 // Bytes 0-3
|
||||||
|
PT_PSWG1 = 107 // Bytes 4-7
|
||||||
|
PT_PSWG2 = 108 // Bytes 8-11 (IA high word)
|
||||||
|
PT_PSWG3 = 109 // Bytes 12-15 (IA low word)
|
||||||
|
)
|
||||||
|
|
||||||
|
func Bpx4ptr(request int32, pid int32, addr unsafe.Pointer, data unsafe.Pointer, buffer unsafe.Pointer) (rv int32, rc int32, rn int32) {
|
||||||
|
var parms [8]unsafe.Pointer
|
||||||
|
parms[0] = unsafe.Pointer(&request)
|
||||||
|
parms[1] = unsafe.Pointer(&pid)
|
||||||
|
parms[2] = unsafe.Pointer(&addr)
|
||||||
|
parms[3] = unsafe.Pointer(&data)
|
||||||
|
parms[4] = unsafe.Pointer(&buffer)
|
||||||
|
parms[5] = unsafe.Pointer(&rv)
|
||||||
|
parms[6] = unsafe.Pointer(&rc)
|
||||||
|
parms[7] = unsafe.Pointer(&rn)
|
||||||
|
bpxcall(parms[:], BPX4PTR)
|
||||||
|
return rv, rc, rn
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyU8(val uint8, dest []uint8) int {
|
||||||
|
if len(dest) < 1 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
dest[0] = val
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyU8Arr(src, dest []uint8) int {
|
||||||
|
if len(dest) < len(src) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
for i, v := range src {
|
||||||
|
dest[i] = v
|
||||||
|
}
|
||||||
|
return len(src)
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyU16(val uint16, dest []uint16) int {
|
||||||
|
if len(dest) < 1 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
dest[0] = val
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyU32(val uint32, dest []uint32) int {
|
||||||
|
if len(dest) < 1 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
dest[0] = val
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyU32Arr(src, dest []uint32) int {
|
||||||
|
if len(dest) < len(src) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
for i, v := range src {
|
||||||
|
dest[i] = v
|
||||||
|
}
|
||||||
|
return len(src)
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyU64(val uint64, dest []uint64) int {
|
||||||
|
if len(dest) < 1 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
dest[0] = val
|
||||||
|
return 1
|
||||||
|
}
|
192
vendor/golang.org/x/sys/unix/bpxsvc_zos.s
generated
vendored
Normal file
192
vendor/golang.org/x/sys/unix/bpxsvc_zos.s
generated
vendored
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
// Copyright 2024 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.
|
||||||
|
|
||||||
|
#include "go_asm.h"
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
// function to call USS assembly language services
|
||||||
|
//
|
||||||
|
// doc: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_3.1.0/com.ibm.zos.v3r1.bpxb100/bit64env.htm
|
||||||
|
//
|
||||||
|
// arg1 unsafe.Pointer array that ressembles an OS PLIST
|
||||||
|
//
|
||||||
|
// arg2 function offset as in
|
||||||
|
// doc: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_3.1.0/com.ibm.zos.v3r1.bpxb100/bpx2cr_List_of_offsets.htm
|
||||||
|
//
|
||||||
|
// func bpxcall(plist []unsafe.Pointer, bpx_offset int64)
|
||||||
|
|
||||||
|
TEXT ·bpxcall(SB), NOSPLIT|NOFRAME, $0
|
||||||
|
MOVD plist_base+0(FP), R1 // r1 points to plist
|
||||||
|
MOVD bpx_offset+24(FP), R2 // r2 offset to BPX vector table
|
||||||
|
MOVD R14, R7 // save r14
|
||||||
|
MOVD R15, R8 // save r15
|
||||||
|
MOVWZ 16(R0), R9
|
||||||
|
MOVWZ 544(R9), R9
|
||||||
|
MOVWZ 24(R9), R9 // call vector in r9
|
||||||
|
ADD R2, R9 // add offset to vector table
|
||||||
|
MOVWZ (R9), R9 // r9 points to entry point
|
||||||
|
BYTE $0x0D // BL R14,R9 --> basr r14,r9
|
||||||
|
BYTE $0xE9 // clobbers 0,1,14,15
|
||||||
|
MOVD R8, R15 // restore 15
|
||||||
|
JMP R7 // return via saved return address
|
||||||
|
|
||||||
|
// func A2e(arr [] byte)
|
||||||
|
// code page conversion from 819 to 1047
|
||||||
|
TEXT ·A2e(SB), NOSPLIT|NOFRAME, $0
|
||||||
|
MOVD arg_base+0(FP), R2 // pointer to arry of characters
|
||||||
|
MOVD arg_len+8(FP), R3 // count
|
||||||
|
XOR R0, R0
|
||||||
|
XOR R1, R1
|
||||||
|
BYTE $0xA7; BYTE $0x15; BYTE $0x00; BYTE $0x82 // BRAS 1,(2+(256/2))
|
||||||
|
|
||||||
|
// ASCII -> EBCDIC conversion table:
|
||||||
|
BYTE $0x00; BYTE $0x01; BYTE $0x02; BYTE $0x03
|
||||||
|
BYTE $0x37; BYTE $0x2d; BYTE $0x2e; BYTE $0x2f
|
||||||
|
BYTE $0x16; BYTE $0x05; BYTE $0x15; BYTE $0x0b
|
||||||
|
BYTE $0x0c; BYTE $0x0d; BYTE $0x0e; BYTE $0x0f
|
||||||
|
BYTE $0x10; BYTE $0x11; BYTE $0x12; BYTE $0x13
|
||||||
|
BYTE $0x3c; BYTE $0x3d; BYTE $0x32; BYTE $0x26
|
||||||
|
BYTE $0x18; BYTE $0x19; BYTE $0x3f; BYTE $0x27
|
||||||
|
BYTE $0x1c; BYTE $0x1d; BYTE $0x1e; BYTE $0x1f
|
||||||
|
BYTE $0x40; BYTE $0x5a; BYTE $0x7f; BYTE $0x7b
|
||||||
|
BYTE $0x5b; BYTE $0x6c; BYTE $0x50; BYTE $0x7d
|
||||||
|
BYTE $0x4d; BYTE $0x5d; BYTE $0x5c; BYTE $0x4e
|
||||||
|
BYTE $0x6b; BYTE $0x60; BYTE $0x4b; BYTE $0x61
|
||||||
|
BYTE $0xf0; BYTE $0xf1; BYTE $0xf2; BYTE $0xf3
|
||||||
|
BYTE $0xf4; BYTE $0xf5; BYTE $0xf6; BYTE $0xf7
|
||||||
|
BYTE $0xf8; BYTE $0xf9; BYTE $0x7a; BYTE $0x5e
|
||||||
|
BYTE $0x4c; BYTE $0x7e; BYTE $0x6e; BYTE $0x6f
|
||||||
|
BYTE $0x7c; BYTE $0xc1; BYTE $0xc2; BYTE $0xc3
|
||||||
|
BYTE $0xc4; BYTE $0xc5; BYTE $0xc6; BYTE $0xc7
|
||||||
|
BYTE $0xc8; BYTE $0xc9; BYTE $0xd1; BYTE $0xd2
|
||||||
|
BYTE $0xd3; BYTE $0xd4; BYTE $0xd5; BYTE $0xd6
|
||||||
|
BYTE $0xd7; BYTE $0xd8; BYTE $0xd9; BYTE $0xe2
|
||||||
|
BYTE $0xe3; BYTE $0xe4; BYTE $0xe5; BYTE $0xe6
|
||||||
|
BYTE $0xe7; BYTE $0xe8; BYTE $0xe9; BYTE $0xad
|
||||||
|
BYTE $0xe0; BYTE $0xbd; BYTE $0x5f; BYTE $0x6d
|
||||||
|
BYTE $0x79; BYTE $0x81; BYTE $0x82; BYTE $0x83
|
||||||
|
BYTE $0x84; BYTE $0x85; BYTE $0x86; BYTE $0x87
|
||||||
|
BYTE $0x88; BYTE $0x89; BYTE $0x91; BYTE $0x92
|
||||||
|
BYTE $0x93; BYTE $0x94; BYTE $0x95; BYTE $0x96
|
||||||
|
BYTE $0x97; BYTE $0x98; BYTE $0x99; BYTE $0xa2
|
||||||
|
BYTE $0xa3; BYTE $0xa4; BYTE $0xa5; BYTE $0xa6
|
||||||
|
BYTE $0xa7; BYTE $0xa8; BYTE $0xa9; BYTE $0xc0
|
||||||
|
BYTE $0x4f; BYTE $0xd0; BYTE $0xa1; BYTE $0x07
|
||||||
|
BYTE $0x20; BYTE $0x21; BYTE $0x22; BYTE $0x23
|
||||||
|
BYTE $0x24; BYTE $0x25; BYTE $0x06; BYTE $0x17
|
||||||
|
BYTE $0x28; BYTE $0x29; BYTE $0x2a; BYTE $0x2b
|
||||||
|
BYTE $0x2c; BYTE $0x09; BYTE $0x0a; BYTE $0x1b
|
||||||
|
BYTE $0x30; BYTE $0x31; BYTE $0x1a; BYTE $0x33
|
||||||
|
BYTE $0x34; BYTE $0x35; BYTE $0x36; BYTE $0x08
|
||||||
|
BYTE $0x38; BYTE $0x39; BYTE $0x3a; BYTE $0x3b
|
||||||
|
BYTE $0x04; BYTE $0x14; BYTE $0x3e; BYTE $0xff
|
||||||
|
BYTE $0x41; BYTE $0xaa; BYTE $0x4a; BYTE $0xb1
|
||||||
|
BYTE $0x9f; BYTE $0xb2; BYTE $0x6a; BYTE $0xb5
|
||||||
|
BYTE $0xbb; BYTE $0xb4; BYTE $0x9a; BYTE $0x8a
|
||||||
|
BYTE $0xb0; BYTE $0xca; BYTE $0xaf; BYTE $0xbc
|
||||||
|
BYTE $0x90; BYTE $0x8f; BYTE $0xea; BYTE $0xfa
|
||||||
|
BYTE $0xbe; BYTE $0xa0; BYTE $0xb6; BYTE $0xb3
|
||||||
|
BYTE $0x9d; BYTE $0xda; BYTE $0x9b; BYTE $0x8b
|
||||||
|
BYTE $0xb7; BYTE $0xb8; BYTE $0xb9; BYTE $0xab
|
||||||
|
BYTE $0x64; BYTE $0x65; BYTE $0x62; BYTE $0x66
|
||||||
|
BYTE $0x63; BYTE $0x67; BYTE $0x9e; BYTE $0x68
|
||||||
|
BYTE $0x74; BYTE $0x71; BYTE $0x72; BYTE $0x73
|
||||||
|
BYTE $0x78; BYTE $0x75; BYTE $0x76; BYTE $0x77
|
||||||
|
BYTE $0xac; BYTE $0x69; BYTE $0xed; BYTE $0xee
|
||||||
|
BYTE $0xeb; BYTE $0xef; BYTE $0xec; BYTE $0xbf
|
||||||
|
BYTE $0x80; BYTE $0xfd; BYTE $0xfe; BYTE $0xfb
|
||||||
|
BYTE $0xfc; BYTE $0xba; BYTE $0xae; BYTE $0x59
|
||||||
|
BYTE $0x44; BYTE $0x45; BYTE $0x42; BYTE $0x46
|
||||||
|
BYTE $0x43; BYTE $0x47; BYTE $0x9c; BYTE $0x48
|
||||||
|
BYTE $0x54; BYTE $0x51; BYTE $0x52; BYTE $0x53
|
||||||
|
BYTE $0x58; BYTE $0x55; BYTE $0x56; BYTE $0x57
|
||||||
|
BYTE $0x8c; BYTE $0x49; BYTE $0xcd; BYTE $0xce
|
||||||
|
BYTE $0xcb; BYTE $0xcf; BYTE $0xcc; BYTE $0xe1
|
||||||
|
BYTE $0x70; BYTE $0xdd; BYTE $0xde; BYTE $0xdb
|
||||||
|
BYTE $0xdc; BYTE $0x8d; BYTE $0x8e; BYTE $0xdf
|
||||||
|
|
||||||
|
retry:
|
||||||
|
WORD $0xB9931022 // TROO 2,2,b'0001'
|
||||||
|
BVS retry
|
||||||
|
RET
|
||||||
|
|
||||||
|
// func e2a(arr [] byte)
|
||||||
|
// code page conversion from 1047 to 819
|
||||||
|
TEXT ·E2a(SB), NOSPLIT|NOFRAME, $0
|
||||||
|
MOVD arg_base+0(FP), R2 // pointer to arry of characters
|
||||||
|
MOVD arg_len+8(FP), R3 // count
|
||||||
|
XOR R0, R0
|
||||||
|
XOR R1, R1
|
||||||
|
BYTE $0xA7; BYTE $0x15; BYTE $0x00; BYTE $0x82 // BRAS 1,(2+(256/2))
|
||||||
|
|
||||||
|
// EBCDIC -> ASCII conversion table:
|
||||||
|
BYTE $0x00; BYTE $0x01; BYTE $0x02; BYTE $0x03
|
||||||
|
BYTE $0x9c; BYTE $0x09; BYTE $0x86; BYTE $0x7f
|
||||||
|
BYTE $0x97; BYTE $0x8d; BYTE $0x8e; BYTE $0x0b
|
||||||
|
BYTE $0x0c; BYTE $0x0d; BYTE $0x0e; BYTE $0x0f
|
||||||
|
BYTE $0x10; BYTE $0x11; BYTE $0x12; BYTE $0x13
|
||||||
|
BYTE $0x9d; BYTE $0x0a; BYTE $0x08; BYTE $0x87
|
||||||
|
BYTE $0x18; BYTE $0x19; BYTE $0x92; BYTE $0x8f
|
||||||
|
BYTE $0x1c; BYTE $0x1d; BYTE $0x1e; BYTE $0x1f
|
||||||
|
BYTE $0x80; BYTE $0x81; BYTE $0x82; BYTE $0x83
|
||||||
|
BYTE $0x84; BYTE $0x85; BYTE $0x17; BYTE $0x1b
|
||||||
|
BYTE $0x88; BYTE $0x89; BYTE $0x8a; BYTE $0x8b
|
||||||
|
BYTE $0x8c; BYTE $0x05; BYTE $0x06; BYTE $0x07
|
||||||
|
BYTE $0x90; BYTE $0x91; BYTE $0x16; BYTE $0x93
|
||||||
|
BYTE $0x94; BYTE $0x95; BYTE $0x96; BYTE $0x04
|
||||||
|
BYTE $0x98; BYTE $0x99; BYTE $0x9a; BYTE $0x9b
|
||||||
|
BYTE $0x14; BYTE $0x15; BYTE $0x9e; BYTE $0x1a
|
||||||
|
BYTE $0x20; BYTE $0xa0; BYTE $0xe2; BYTE $0xe4
|
||||||
|
BYTE $0xe0; BYTE $0xe1; BYTE $0xe3; BYTE $0xe5
|
||||||
|
BYTE $0xe7; BYTE $0xf1; BYTE $0xa2; BYTE $0x2e
|
||||||
|
BYTE $0x3c; BYTE $0x28; BYTE $0x2b; BYTE $0x7c
|
||||||
|
BYTE $0x26; BYTE $0xe9; BYTE $0xea; BYTE $0xeb
|
||||||
|
BYTE $0xe8; BYTE $0xed; BYTE $0xee; BYTE $0xef
|
||||||
|
BYTE $0xec; BYTE $0xdf; BYTE $0x21; BYTE $0x24
|
||||||
|
BYTE $0x2a; BYTE $0x29; BYTE $0x3b; BYTE $0x5e
|
||||||
|
BYTE $0x2d; BYTE $0x2f; BYTE $0xc2; BYTE $0xc4
|
||||||
|
BYTE $0xc0; BYTE $0xc1; BYTE $0xc3; BYTE $0xc5
|
||||||
|
BYTE $0xc7; BYTE $0xd1; BYTE $0xa6; BYTE $0x2c
|
||||||
|
BYTE $0x25; BYTE $0x5f; BYTE $0x3e; BYTE $0x3f
|
||||||
|
BYTE $0xf8; BYTE $0xc9; BYTE $0xca; BYTE $0xcb
|
||||||
|
BYTE $0xc8; BYTE $0xcd; BYTE $0xce; BYTE $0xcf
|
||||||
|
BYTE $0xcc; BYTE $0x60; BYTE $0x3a; BYTE $0x23
|
||||||
|
BYTE $0x40; BYTE $0x27; BYTE $0x3d; BYTE $0x22
|
||||||
|
BYTE $0xd8; BYTE $0x61; BYTE $0x62; BYTE $0x63
|
||||||
|
BYTE $0x64; BYTE $0x65; BYTE $0x66; BYTE $0x67
|
||||||
|
BYTE $0x68; BYTE $0x69; BYTE $0xab; BYTE $0xbb
|
||||||
|
BYTE $0xf0; BYTE $0xfd; BYTE $0xfe; BYTE $0xb1
|
||||||
|
BYTE $0xb0; BYTE $0x6a; BYTE $0x6b; BYTE $0x6c
|
||||||
|
BYTE $0x6d; BYTE $0x6e; BYTE $0x6f; BYTE $0x70
|
||||||
|
BYTE $0x71; BYTE $0x72; BYTE $0xaa; BYTE $0xba
|
||||||
|
BYTE $0xe6; BYTE $0xb8; BYTE $0xc6; BYTE $0xa4
|
||||||
|
BYTE $0xb5; BYTE $0x7e; BYTE $0x73; BYTE $0x74
|
||||||
|
BYTE $0x75; BYTE $0x76; BYTE $0x77; BYTE $0x78
|
||||||
|
BYTE $0x79; BYTE $0x7a; BYTE $0xa1; BYTE $0xbf
|
||||||
|
BYTE $0xd0; BYTE $0x5b; BYTE $0xde; BYTE $0xae
|
||||||
|
BYTE $0xac; BYTE $0xa3; BYTE $0xa5; BYTE $0xb7
|
||||||
|
BYTE $0xa9; BYTE $0xa7; BYTE $0xb6; BYTE $0xbc
|
||||||
|
BYTE $0xbd; BYTE $0xbe; BYTE $0xdd; BYTE $0xa8
|
||||||
|
BYTE $0xaf; BYTE $0x5d; BYTE $0xb4; BYTE $0xd7
|
||||||
|
BYTE $0x7b; BYTE $0x41; BYTE $0x42; BYTE $0x43
|
||||||
|
BYTE $0x44; BYTE $0x45; BYTE $0x46; BYTE $0x47
|
||||||
|
BYTE $0x48; BYTE $0x49; BYTE $0xad; BYTE $0xf4
|
||||||
|
BYTE $0xf6; BYTE $0xf2; BYTE $0xf3; BYTE $0xf5
|
||||||
|
BYTE $0x7d; BYTE $0x4a; BYTE $0x4b; BYTE $0x4c
|
||||||
|
BYTE $0x4d; BYTE $0x4e; BYTE $0x4f; BYTE $0x50
|
||||||
|
BYTE $0x51; BYTE $0x52; BYTE $0xb9; BYTE $0xfb
|
||||||
|
BYTE $0xfc; BYTE $0xf9; BYTE $0xfa; BYTE $0xff
|
||||||
|
BYTE $0x5c; BYTE $0xf7; BYTE $0x53; BYTE $0x54
|
||||||
|
BYTE $0x55; BYTE $0x56; BYTE $0x57; BYTE $0x58
|
||||||
|
BYTE $0x59; BYTE $0x5a; BYTE $0xb2; BYTE $0xd4
|
||||||
|
BYTE $0xd6; BYTE $0xd2; BYTE $0xd3; BYTE $0xd5
|
||||||
|
BYTE $0x30; BYTE $0x31; BYTE $0x32; BYTE $0x33
|
||||||
|
BYTE $0x34; BYTE $0x35; BYTE $0x36; BYTE $0x37
|
||||||
|
BYTE $0x38; BYTE $0x39; BYTE $0xb3; BYTE $0xdb
|
||||||
|
BYTE $0xdc; BYTE $0xd9; BYTE $0xda; BYTE $0x9f
|
||||||
|
|
||||||
|
retry:
|
||||||
|
WORD $0xB9931022 // TROO 2,2,b'0001'
|
||||||
|
BVS retry
|
||||||
|
RET
|
1
vendor/golang.org/x/sys/unix/cap_freebsd.go
generated
vendored
1
vendor/golang.org/x/sys/unix/cap_freebsd.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build freebsd
|
//go:build freebsd
|
||||||
// +build freebsd
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/constants.go
generated
vendored
1
vendor/golang.org/x/sys/unix/constants.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/dev_aix_ppc.go
generated
vendored
1
vendor/golang.org/x/sys/unix/dev_aix_ppc.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix && ppc
|
//go:build aix && ppc
|
||||||
// +build aix,ppc
|
|
||||||
|
|
||||||
// Functions to access/create device major and minor numbers matching the
|
// Functions to access/create device major and minor numbers matching the
|
||||||
// encoding used by AIX.
|
// encoding used by AIX.
|
||||||
|
1
vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix && ppc64
|
//go:build aix && ppc64
|
||||||
// +build aix,ppc64
|
|
||||||
|
|
||||||
// Functions to access/create device major and minor numbers matching the
|
// Functions to access/create device major and minor numbers matching the
|
||||||
// encoding used AIX.
|
// encoding used AIX.
|
||||||
|
1
vendor/golang.org/x/sys/unix/dev_zos.go
generated
vendored
1
vendor/golang.org/x/sys/unix/dev_zos.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build zos && s390x
|
//go:build zos && s390x
|
||||||
// +build zos,s390x
|
|
||||||
|
|
||||||
// Functions to access/create device major and minor numbers matching the
|
// Functions to access/create device major and minor numbers matching the
|
||||||
// encoding used by z/OS.
|
// encoding used by z/OS.
|
||||||
|
1
vendor/golang.org/x/sys/unix/dirent.go
generated
vendored
1
vendor/golang.org/x/sys/unix/dirent.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/endian_big.go
generated
vendored
1
vendor/golang.org/x/sys/unix/endian_big.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
//
|
//
|
||||||
//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
|
//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
|
||||||
// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
1
vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
//
|
//
|
||||||
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
|
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
|
||||||
// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/env_unix.go
generated
vendored
1
vendor/golang.org/x/sys/unix/env_unix.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
|
||||||
|
|
||||||
// Unix environment variables.
|
// Unix environment variables.
|
||||||
|
|
||||||
|
221
vendor/golang.org/x/sys/unix/epoll_zos.go
generated
vendored
221
vendor/golang.org/x/sys/unix/epoll_zos.go
generated
vendored
@ -1,221 +0,0 @@
|
|||||||
// Copyright 2020 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 zos && s390x
|
|
||||||
// +build zos,s390x
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import (
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This file simulates epoll on z/OS using poll.
|
|
||||||
|
|
||||||
// Analogous to epoll_event on Linux.
|
|
||||||
// TODO(neeilan): Pad is because the Linux kernel expects a 96-bit struct. We never pass this to the kernel; remove?
|
|
||||||
type EpollEvent struct {
|
|
||||||
Events uint32
|
|
||||||
Fd int32
|
|
||||||
Pad int32
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
|
||||||
EPOLLERR = 0x8
|
|
||||||
EPOLLHUP = 0x10
|
|
||||||
EPOLLIN = 0x1
|
|
||||||
EPOLLMSG = 0x400
|
|
||||||
EPOLLOUT = 0x4
|
|
||||||
EPOLLPRI = 0x2
|
|
||||||
EPOLLRDBAND = 0x80
|
|
||||||
EPOLLRDNORM = 0x40
|
|
||||||
EPOLLWRBAND = 0x200
|
|
||||||
EPOLLWRNORM = 0x100
|
|
||||||
EPOLL_CTL_ADD = 0x1
|
|
||||||
EPOLL_CTL_DEL = 0x2
|
|
||||||
EPOLL_CTL_MOD = 0x3
|
|
||||||
// The following constants are part of the epoll API, but represent
|
|
||||||
// currently unsupported functionality on z/OS.
|
|
||||||
// EPOLL_CLOEXEC = 0x80000
|
|
||||||
// EPOLLET = 0x80000000
|
|
||||||
// EPOLLONESHOT = 0x40000000
|
|
||||||
// EPOLLRDHUP = 0x2000 // Typically used with edge-triggered notis
|
|
||||||
// EPOLLEXCLUSIVE = 0x10000000 // Exclusive wake-up mode
|
|
||||||
// EPOLLWAKEUP = 0x20000000 // Relies on Linux's BLOCK_SUSPEND capability
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO(neeilan): We can eliminate these epToPoll / pToEpoll calls by using identical mask values for POLL/EPOLL
|
|
||||||
// constants where possible The lower 16 bits of epoll events (uint32) can fit any system poll event (int16).
|
|
||||||
|
|
||||||
// epToPollEvt converts epoll event field to poll equivalent.
|
|
||||||
// In epoll, Events is a 32-bit field, while poll uses 16 bits.
|
|
||||||
func epToPollEvt(events uint32) int16 {
|
|
||||||
var ep2p = map[uint32]int16{
|
|
||||||
EPOLLIN: POLLIN,
|
|
||||||
EPOLLOUT: POLLOUT,
|
|
||||||
EPOLLHUP: POLLHUP,
|
|
||||||
EPOLLPRI: POLLPRI,
|
|
||||||
EPOLLERR: POLLERR,
|
|
||||||
}
|
|
||||||
|
|
||||||
var pollEvts int16 = 0
|
|
||||||
for epEvt, pEvt := range ep2p {
|
|
||||||
if (events & epEvt) != 0 {
|
|
||||||
pollEvts |= pEvt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pollEvts
|
|
||||||
}
|
|
||||||
|
|
||||||
// pToEpollEvt converts 16 bit poll event bitfields to 32-bit epoll event fields.
|
|
||||||
func pToEpollEvt(revents int16) uint32 {
|
|
||||||
var p2ep = map[int16]uint32{
|
|
||||||
POLLIN: EPOLLIN,
|
|
||||||
POLLOUT: EPOLLOUT,
|
|
||||||
POLLHUP: EPOLLHUP,
|
|
||||||
POLLPRI: EPOLLPRI,
|
|
||||||
POLLERR: EPOLLERR,
|
|
||||||
}
|
|
||||||
|
|
||||||
var epollEvts uint32 = 0
|
|
||||||
for pEvt, epEvt := range p2ep {
|
|
||||||
if (revents & pEvt) != 0 {
|
|
||||||
epollEvts |= epEvt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return epollEvts
|
|
||||||
}
|
|
||||||
|
|
||||||
// Per-process epoll implementation.
|
|
||||||
type epollImpl struct {
|
|
||||||
mu sync.Mutex
|
|
||||||
epfd2ep map[int]*eventPoll
|
|
||||||
nextEpfd int
|
|
||||||
}
|
|
||||||
|
|
||||||
// eventPoll holds a set of file descriptors being watched by the process. A process can have multiple epoll instances.
|
|
||||||
// On Linux, this is an in-kernel data structure accessed through a fd.
|
|
||||||
type eventPoll struct {
|
|
||||||
mu sync.Mutex
|
|
||||||
fds map[int]*EpollEvent
|
|
||||||
}
|
|
||||||
|
|
||||||
// epoll impl for this process.
|
|
||||||
var impl epollImpl = epollImpl{
|
|
||||||
epfd2ep: make(map[int]*eventPoll),
|
|
||||||
nextEpfd: 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *epollImpl) epollcreate(size int) (epfd int, err error) {
|
|
||||||
e.mu.Lock()
|
|
||||||
defer e.mu.Unlock()
|
|
||||||
epfd = e.nextEpfd
|
|
||||||
e.nextEpfd++
|
|
||||||
|
|
||||||
e.epfd2ep[epfd] = &eventPoll{
|
|
||||||
fds: make(map[int]*EpollEvent),
|
|
||||||
}
|
|
||||||
return epfd, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *epollImpl) epollcreate1(flag int) (fd int, err error) {
|
|
||||||
return e.epollcreate(4)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *epollImpl) epollctl(epfd int, op int, fd int, event *EpollEvent) (err error) {
|
|
||||||
e.mu.Lock()
|
|
||||||
defer e.mu.Unlock()
|
|
||||||
|
|
||||||
ep, ok := e.epfd2ep[epfd]
|
|
||||||
if !ok {
|
|
||||||
|
|
||||||
return EBADF
|
|
||||||
}
|
|
||||||
|
|
||||||
switch op {
|
|
||||||
case EPOLL_CTL_ADD:
|
|
||||||
// TODO(neeilan): When we make epfds and fds disjoint, detect epoll
|
|
||||||
// loops here (instances watching each other) and return ELOOP.
|
|
||||||
if _, ok := ep.fds[fd]; ok {
|
|
||||||
return EEXIST
|
|
||||||
}
|
|
||||||
ep.fds[fd] = event
|
|
||||||
case EPOLL_CTL_MOD:
|
|
||||||
if _, ok := ep.fds[fd]; !ok {
|
|
||||||
return ENOENT
|
|
||||||
}
|
|
||||||
ep.fds[fd] = event
|
|
||||||
case EPOLL_CTL_DEL:
|
|
||||||
if _, ok := ep.fds[fd]; !ok {
|
|
||||||
return ENOENT
|
|
||||||
}
|
|
||||||
delete(ep.fds, fd)
|
|
||||||
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Must be called while holding ep.mu
|
|
||||||
func (ep *eventPoll) getFds() []int {
|
|
||||||
fds := make([]int, len(ep.fds))
|
|
||||||
for fd := range ep.fds {
|
|
||||||
fds = append(fds, fd)
|
|
||||||
}
|
|
||||||
return fds
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *epollImpl) epollwait(epfd int, events []EpollEvent, msec int) (n int, err error) {
|
|
||||||
e.mu.Lock() // in [rare] case of concurrent epollcreate + epollwait
|
|
||||||
ep, ok := e.epfd2ep[epfd]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
e.mu.Unlock()
|
|
||||||
return 0, EBADF
|
|
||||||
}
|
|
||||||
|
|
||||||
pollfds := make([]PollFd, 4)
|
|
||||||
for fd, epollevt := range ep.fds {
|
|
||||||
pollfds = append(pollfds, PollFd{Fd: int32(fd), Events: epToPollEvt(epollevt.Events)})
|
|
||||||
}
|
|
||||||
e.mu.Unlock()
|
|
||||||
|
|
||||||
n, err = Poll(pollfds, msec)
|
|
||||||
if err != nil {
|
|
||||||
return n, err
|
|
||||||
}
|
|
||||||
|
|
||||||
i := 0
|
|
||||||
for _, pFd := range pollfds {
|
|
||||||
if pFd.Revents != 0 {
|
|
||||||
events[i] = EpollEvent{Fd: pFd.Fd, Events: pToEpollEvt(pFd.Revents)}
|
|
||||||
i++
|
|
||||||
}
|
|
||||||
|
|
||||||
if i == n {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return n, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func EpollCreate(size int) (fd int, err error) {
|
|
||||||
return impl.epollcreate(size)
|
|
||||||
}
|
|
||||||
|
|
||||||
func EpollCreate1(flag int) (fd int, err error) {
|
|
||||||
return impl.epollcreate1(flag)
|
|
||||||
}
|
|
||||||
|
|
||||||
func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
|
|
||||||
return impl.epollctl(epfd, op, fd, event)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Because EpollWait mutates events, the caller is expected to coordinate
|
|
||||||
// concurrent access if calling with the same epfd from multiple goroutines.
|
|
||||||
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
|
|
||||||
return impl.epollwait(epfd, events, msec)
|
|
||||||
}
|
|
3
vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
3
vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
@ -2,8 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build dragonfly || freebsd || linux || netbsd || openbsd
|
//go:build dragonfly || freebsd || linux || netbsd
|
||||||
// +build dragonfly freebsd linux netbsd openbsd
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
generated
vendored
1
vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc)
|
//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc)
|
||||||
// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/fdset.go
generated
vendored
1
vendor/golang.org/x/sys/unix/fdset.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
164
vendor/golang.org/x/sys/unix/fstatfs_zos.go
generated
vendored
164
vendor/golang.org/x/sys/unix/fstatfs_zos.go
generated
vendored
@ -1,164 +0,0 @@
|
|||||||
// Copyright 2020 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 zos && s390x
|
|
||||||
// +build zos,s390x
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import (
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This file simulates fstatfs on z/OS using fstatvfs and w_getmntent.
|
|
||||||
|
|
||||||
func Fstatfs(fd int, stat *Statfs_t) (err error) {
|
|
||||||
var stat_v Statvfs_t
|
|
||||||
err = Fstatvfs(fd, &stat_v)
|
|
||||||
if err == nil {
|
|
||||||
// populate stat
|
|
||||||
stat.Type = 0
|
|
||||||
stat.Bsize = stat_v.Bsize
|
|
||||||
stat.Blocks = stat_v.Blocks
|
|
||||||
stat.Bfree = stat_v.Bfree
|
|
||||||
stat.Bavail = stat_v.Bavail
|
|
||||||
stat.Files = stat_v.Files
|
|
||||||
stat.Ffree = stat_v.Ffree
|
|
||||||
stat.Fsid = stat_v.Fsid
|
|
||||||
stat.Namelen = stat_v.Namemax
|
|
||||||
stat.Frsize = stat_v.Frsize
|
|
||||||
stat.Flags = stat_v.Flag
|
|
||||||
for passn := 0; passn < 5; passn++ {
|
|
||||||
switch passn {
|
|
||||||
case 0:
|
|
||||||
err = tryGetmntent64(stat)
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
err = tryGetmntent128(stat)
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
err = tryGetmntent256(stat)
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
err = tryGetmntent512(stat)
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
err = tryGetmntent1024(stat)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
//proceed to return if: err is nil (found), err is nonnil but not ERANGE (another error occurred)
|
|
||||||
if err == nil || err != nil && err != ERANGE {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func tryGetmntent64(stat *Statfs_t) (err error) {
|
|
||||||
var mnt_ent_buffer struct {
|
|
||||||
header W_Mnth
|
|
||||||
filesys_info [64]W_Mntent
|
|
||||||
}
|
|
||||||
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
|
||||||
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ERANGE //return ERANGE if no match is found in this batch
|
|
||||||
for i := 0; i < fs_count; i++ {
|
|
||||||
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
|
||||||
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
|
||||||
err = nil
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func tryGetmntent128(stat *Statfs_t) (err error) {
|
|
||||||
var mnt_ent_buffer struct {
|
|
||||||
header W_Mnth
|
|
||||||
filesys_info [128]W_Mntent
|
|
||||||
}
|
|
||||||
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
|
||||||
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ERANGE //return ERANGE if no match is found in this batch
|
|
||||||
for i := 0; i < fs_count; i++ {
|
|
||||||
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
|
||||||
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
|
||||||
err = nil
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func tryGetmntent256(stat *Statfs_t) (err error) {
|
|
||||||
var mnt_ent_buffer struct {
|
|
||||||
header W_Mnth
|
|
||||||
filesys_info [256]W_Mntent
|
|
||||||
}
|
|
||||||
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
|
||||||
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ERANGE //return ERANGE if no match is found in this batch
|
|
||||||
for i := 0; i < fs_count; i++ {
|
|
||||||
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
|
||||||
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
|
||||||
err = nil
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func tryGetmntent512(stat *Statfs_t) (err error) {
|
|
||||||
var mnt_ent_buffer struct {
|
|
||||||
header W_Mnth
|
|
||||||
filesys_info [512]W_Mntent
|
|
||||||
}
|
|
||||||
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
|
||||||
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ERANGE //return ERANGE if no match is found in this batch
|
|
||||||
for i := 0; i < fs_count; i++ {
|
|
||||||
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
|
||||||
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
|
||||||
err = nil
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func tryGetmntent1024(stat *Statfs_t) (err error) {
|
|
||||||
var mnt_ent_buffer struct {
|
|
||||||
header W_Mnth
|
|
||||||
filesys_info [1024]W_Mntent
|
|
||||||
}
|
|
||||||
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
|
||||||
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ERANGE //return ERANGE if no match is found in this batch
|
|
||||||
for i := 0; i < fs_count; i++ {
|
|
||||||
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
|
||||||
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
|
||||||
err = nil
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
3
vendor/golang.org/x/sys/unix/gccgo.go
generated
vendored
3
vendor/golang.org/x/sys/unix/gccgo.go
generated
vendored
@ -2,8 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gccgo && !aix
|
//go:build gccgo && !aix && !hurd
|
||||||
// +build gccgo,!aix
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/gccgo_c.c
generated
vendored
3
vendor/golang.org/x/sys/unix/gccgo_c.c
generated
vendored
@ -2,8 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build gccgo
|
//go:build gccgo && !aix && !hurd
|
||||||
// +build !aix
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
1
vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build gccgo && linux && amd64
|
//go:build gccgo && linux && amd64
|
||||||
// +build gccgo,linux,amd64
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/ifreq_linux.go
generated
vendored
1
vendor/golang.org/x/sys/unix/ifreq_linux.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build linux
|
//go:build linux
|
||||||
// +build linux
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
101
vendor/golang.org/x/sys/unix/ioctl_linux.go
generated
vendored
101
vendor/golang.org/x/sys/unix/ioctl_linux.go
generated
vendored
@ -58,6 +58,102 @@ func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
|
|||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IoctlGetEthtoolTsInfo fetches ethtool timestamping and PHC
|
||||||
|
// association for the network device specified by ifname.
|
||||||
|
func IoctlGetEthtoolTsInfo(fd int, ifname string) (*EthtoolTsInfo, error) {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
value := EthtoolTsInfo{Cmd: ETHTOOL_GET_TS_INFO}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||||
|
|
||||||
|
err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlGetHwTstamp retrieves the hardware timestamping configuration
|
||||||
|
// for the network device specified by ifname.
|
||||||
|
func IoctlGetHwTstamp(fd int, ifname string) (*HwTstampConfig, error) {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
value := HwTstampConfig{}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||||
|
|
||||||
|
err = ioctlIfreqData(fd, SIOCGHWTSTAMP, &ifrd)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetHwTstamp updates the hardware timestamping configuration for
|
||||||
|
// the network device specified by ifname.
|
||||||
|
func IoctlSetHwTstamp(fd int, ifname string, cfg *HwTstampConfig) error {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(cfg))
|
||||||
|
return ioctlIfreqData(fd, SIOCSHWTSTAMP, &ifrd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FdToClockID derives the clock ID from the file descriptor number
|
||||||
|
// - see clock_gettime(3), FD_TO_CLOCKID macros. The resulting ID is
|
||||||
|
// suitable for system calls like ClockGettime.
|
||||||
|
func FdToClockID(fd int) int32 { return int32((int(^fd) << 3) | 3) }
|
||||||
|
|
||||||
|
// IoctlPtpClockGetcaps returns the description of a given PTP device.
|
||||||
|
func IoctlPtpClockGetcaps(fd int) (*PtpClockCaps, error) {
|
||||||
|
var value PtpClockCaps
|
||||||
|
err := ioctlPtr(fd, PTP_CLOCK_GETCAPS2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpSysOffsetPrecise returns a description of the clock
|
||||||
|
// offset compared to the system clock.
|
||||||
|
func IoctlPtpSysOffsetPrecise(fd int) (*PtpSysOffsetPrecise, error) {
|
||||||
|
var value PtpSysOffsetPrecise
|
||||||
|
err := ioctlPtr(fd, PTP_SYS_OFFSET_PRECISE2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpSysOffsetExtended returns an extended description of the
|
||||||
|
// clock offset compared to the system clock. The samples parameter
|
||||||
|
// specifies the desired number of measurements.
|
||||||
|
func IoctlPtpSysOffsetExtended(fd int, samples uint) (*PtpSysOffsetExtended, error) {
|
||||||
|
value := PtpSysOffsetExtended{Samples: uint32(samples)}
|
||||||
|
err := ioctlPtr(fd, PTP_SYS_OFFSET_EXTENDED2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPinGetfunc returns the configuration of the specified
|
||||||
|
// I/O pin on given PTP device.
|
||||||
|
func IoctlPtpPinGetfunc(fd int, index uint) (*PtpPinDesc, error) {
|
||||||
|
value := PtpPinDesc{Index: uint32(index)}
|
||||||
|
err := ioctlPtr(fd, PTP_PIN_GETFUNC2, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPinSetfunc updates configuration of the specified PTP
|
||||||
|
// I/O pin.
|
||||||
|
func IoctlPtpPinSetfunc(fd int, pd *PtpPinDesc) error {
|
||||||
|
return ioctlPtr(fd, PTP_PIN_SETFUNC2, unsafe.Pointer(pd))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpPeroutRequest configures the periodic output mode of the
|
||||||
|
// PTP I/O pins.
|
||||||
|
func IoctlPtpPeroutRequest(fd int, r *PtpPeroutRequest) error {
|
||||||
|
return ioctlPtr(fd, PTP_PEROUT_REQUEST2, unsafe.Pointer(r))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlPtpExttsRequest configures the external timestamping mode
|
||||||
|
// of the PTP I/O pins.
|
||||||
|
func IoctlPtpExttsRequest(fd int, r *PtpExttsRequest) error {
|
||||||
|
return ioctlPtr(fd, PTP_EXTTS_REQUEST2, unsafe.Pointer(r))
|
||||||
|
}
|
||||||
|
|
||||||
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
||||||
// Linux watchdog API. For more information, see:
|
// Linux watchdog API. For more information, see:
|
||||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||||
@ -231,3 +327,8 @@ func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) {
|
|||||||
func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error {
|
func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error {
|
||||||
return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value))
|
return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IoctlLoopConfigure configures all loop device parameters in a single step
|
||||||
|
func IoctlLoopConfigure(fd int, value *LoopConfig) error {
|
||||||
|
return ioctlPtr(fd, LOOP_CONFIGURE, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
69
vendor/golang.org/x/sys/unix/ioctl_signed.go
generated
vendored
Normal file
69
vendor/golang.org/x/sys/unix/ioctl_signed.go
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// Copyright 2018 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 || solaris
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ioctl itself should not be exposed directly, but additional get/set
|
||||||
|
// functions for specific types are permissible.
|
||||||
|
|
||||||
|
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||||
|
// on fd, using the specified request number.
|
||||||
|
func IoctlSetInt(fd int, req int, value int) error {
|
||||||
|
return ioctl(fd, req, uintptr(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetPointerInt performs an ioctl operation which sets an
|
||||||
|
// integer value on fd, using the specified request number. The ioctl
|
||||||
|
// argument is called with a pointer to the integer value, rather than
|
||||||
|
// passing the integer value directly.
|
||||||
|
func IoctlSetPointerInt(fd int, req int, value int) error {
|
||||||
|
v := int32(value)
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(&v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
||||||
|
//
|
||||||
|
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
||||||
|
func IoctlSetWinsize(fd int, req int, value *Winsize) error {
|
||||||
|
// TODO: if we get the chance, remove the req parameter and
|
||||||
|
// hardcode TIOCSWINSZ.
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||||
|
//
|
||||||
|
// The req value will usually be TCSETA or TIOCSETA.
|
||||||
|
func IoctlSetTermios(fd int, req int, value *Termios) error {
|
||||||
|
// TODO: if we get the chance, remove the req parameter.
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||||
|
// from fd, using the specified request number.
|
||||||
|
//
|
||||||
|
// A few ioctl requests use the return value as an output parameter;
|
||||||
|
// for those, IoctlRetInt should be used instead of this function.
|
||||||
|
func IoctlGetInt(fd int, req int) (int, error) {
|
||||||
|
var value int
|
||||||
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
|
return value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
|
||||||
|
var value Winsize
|
||||||
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetTermios(fd int, req int) (*Termios, error) {
|
||||||
|
var value Termios
|
||||||
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
20
vendor/golang.org/x/sys/unix/ioctl.go → vendor/golang.org/x/sys/unix/ioctl_unsigned.go
generated
vendored
20
vendor/golang.org/x/sys/unix/ioctl.go → vendor/golang.org/x/sys/unix/ioctl_unsigned.go
generated
vendored
@ -2,13 +2,11 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,7 +25,7 @@ func IoctlSetInt(fd int, req uint, value int) error {
|
|||||||
// passing the integer value directly.
|
// passing the integer value directly.
|
||||||
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
||||||
v := int32(value)
|
v := int32(value)
|
||||||
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
|
return ioctlPtr(fd, req, unsafe.Pointer(&v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
||||||
@ -36,9 +34,7 @@ func IoctlSetPointerInt(fd int, req uint, value int) error {
|
|||||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||||
// TODO: if we get the chance, remove the req parameter and
|
// TODO: if we get the chance, remove the req parameter and
|
||||||
// hardcode TIOCSWINSZ.
|
// hardcode TIOCSWINSZ.
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||||
@ -46,9 +42,7 @@ func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
|||||||
// The req value will usually be TCSETA or TIOCSETA.
|
// The req value will usually be TCSETA or TIOCSETA.
|
||||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||||
// TODO: if we get the chance, remove the req parameter.
|
// TODO: if we get the chance, remove the req parameter.
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlGetInt performs an ioctl operation which gets an integer value
|
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||||
@ -58,18 +52,18 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
|||||||
// for those, IoctlRetInt should be used instead of this function.
|
// for those, IoctlRetInt should be used instead of this function.
|
||||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
func IoctlGetInt(fd int, req uint) (int, error) {
|
||||||
var value int
|
var value int
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return value, err
|
return value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
||||||
var value Winsize
|
var value Winsize
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
var value Termios
|
var value Termios
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
21
vendor/golang.org/x/sys/unix/ioctl_zos.go
generated
vendored
21
vendor/golang.org/x/sys/unix/ioctl_zos.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build zos && s390x
|
//go:build zos && s390x
|
||||||
// +build zos,s390x
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
@ -17,25 +16,23 @@ import (
|
|||||||
|
|
||||||
// IoctlSetInt performs an ioctl operation which sets an integer value
|
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||||
// on fd, using the specified request number.
|
// on fd, using the specified request number.
|
||||||
func IoctlSetInt(fd int, req uint, value int) error {
|
func IoctlSetInt(fd int, req int, value int) error {
|
||||||
return ioctl(fd, req, uintptr(value))
|
return ioctl(fd, req, uintptr(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
||||||
//
|
//
|
||||||
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
||||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
func IoctlSetWinsize(fd int, req int, value *Winsize) error {
|
||||||
// TODO: if we get the chance, remove the req parameter and
|
// TODO: if we get the chance, remove the req parameter and
|
||||||
// hardcode TIOCSWINSZ.
|
// hardcode TIOCSWINSZ.
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||||
//
|
//
|
||||||
// The req value is expected to be TCSETS, TCSETSW, or TCSETSF
|
// The req value is expected to be TCSETS, TCSETSW, or TCSETSF
|
||||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
func IoctlSetTermios(fd int, req int, value *Termios) error {
|
||||||
if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
|
if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
|
||||||
return ENOSYS
|
return ENOSYS
|
||||||
}
|
}
|
||||||
@ -49,22 +46,22 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
|||||||
//
|
//
|
||||||
// A few ioctl requests use the return value as an output parameter;
|
// A few ioctl requests use the return value as an output parameter;
|
||||||
// for those, IoctlRetInt should be used instead of this function.
|
// for those, IoctlRetInt should be used instead of this function.
|
||||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
func IoctlGetInt(fd int, req int) (int, error) {
|
||||||
var value int
|
var value int
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return value, err
|
return value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
|
||||||
var value Winsize
|
var value Winsize
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlGetTermios performs an ioctl on fd with a *Termios.
|
// IoctlGetTermios performs an ioctl on fd with a *Termios.
|
||||||
//
|
//
|
||||||
// The req value is expected to be TCGETS
|
// The req value is expected to be TCGETS
|
||||||
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
func IoctlGetTermios(fd int, req int) (*Termios, error) {
|
||||||
var value Termios
|
var value Termios
|
||||||
if req != TCGETS {
|
if req != TCGETS {
|
||||||
return &value, ENOSYS
|
return &value, ENOSYS
|
||||||
|
6
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
6
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then
|
|||||||
# Use the Docker-based build system
|
# Use the Docker-based build system
|
||||||
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
||||||
$cmd docker build --tag generate:$GOOS $GOOS
|
$cmd docker build --tag generate:$GOOS $GOOS
|
||||||
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS
|
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -174,10 +174,10 @@ openbsd_arm64)
|
|||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
;;
|
;;
|
||||||
openbsd_mips64)
|
openbsd_mips64)
|
||||||
|
mkasm="go run mkasm.go"
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksyscall="go run mksyscall.go -openbsd"
|
mksyscall="go run mksyscall.go -openbsd -libc"
|
||||||
mksysctl="go run mksysctl_openbsd.go"
|
mksysctl="go run mksysctl_openbsd.go"
|
||||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
||||||
# Let the type of C char be signed for making the bare syscall
|
# Let the type of C char be signed for making the bare syscall
|
||||||
# API consistent across platforms.
|
# API consistent across platforms.
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
|
77
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
77
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@ -58,6 +58,7 @@ includes_Darwin='
|
|||||||
#define _DARWIN_USE_64_BIT_INODE
|
#define _DARWIN_USE_64_BIT_INODE
|
||||||
#define __APPLE_USE_RFC_3542
|
#define __APPLE_USE_RFC_3542
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <sys/stdio.h>
|
||||||
#include <sys/attr.h>
|
#include <sys/attr.h>
|
||||||
#include <sys/clonefile.h>
|
#include <sys/clonefile.h>
|
||||||
#include <sys/kern_control.h>
|
#include <sys/kern_control.h>
|
||||||
@ -66,6 +67,7 @@ includes_Darwin='
|
|||||||
#include <sys/ptrace.h>
|
#include <sys/ptrace.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#include <sys/sys_domain.h>
|
#include <sys/sys_domain.h>
|
||||||
@ -156,6 +158,16 @@ includes_Linux='
|
|||||||
#endif
|
#endif
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
// See the description in unix/linux/types.go
|
||||||
|
#if defined(__ARM_EABI__) || \
|
||||||
|
(defined(__mips__) && (_MIPS_SIM == _ABIO32)) || \
|
||||||
|
(defined(__powerpc__) && (!defined(__powerpc64__)))
|
||||||
|
# ifdef _TIME_BITS
|
||||||
|
# undef _TIME_BITS
|
||||||
|
# endif
|
||||||
|
# define _TIME_BITS 32
|
||||||
|
#endif
|
||||||
|
|
||||||
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
|
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
|
||||||
// these structures. We just include them copied from <bits/termios.h>.
|
// these structures. We just include them copied from <bits/termios.h>.
|
||||||
#if defined(__powerpc__)
|
#if defined(__powerpc__)
|
||||||
@ -203,6 +215,7 @@ struct ltchars {
|
|||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/xattr.h>
|
#include <sys/xattr.h>
|
||||||
|
#include <netinet/udp.h>
|
||||||
#include <linux/audit.h>
|
#include <linux/audit.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <linux/can.h>
|
#include <linux/can.h>
|
||||||
@ -246,12 +259,14 @@ struct ltchars {
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/mount.h>
|
#include <linux/mount.h>
|
||||||
#include <linux/netfilter/nfnetlink.h>
|
#include <linux/netfilter/nfnetlink.h>
|
||||||
|
#include <linux/netfilter/nf_tables.h>
|
||||||
#include <linux/netlink.h>
|
#include <linux/netlink.h>
|
||||||
#include <linux/net_namespace.h>
|
#include <linux/net_namespace.h>
|
||||||
#include <linux/nfc.h>
|
#include <linux/nfc.h>
|
||||||
#include <linux/nsfs.h>
|
#include <linux/nsfs.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
#include <linux/pps.h>
|
#include <linux/pps.h>
|
||||||
|
#include <linux/ptp_clock.h>
|
||||||
#include <linux/ptrace.h>
|
#include <linux/ptrace.h>
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
@ -260,6 +275,7 @@ struct ltchars {
|
|||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/seccomp.h>
|
#include <linux/seccomp.h>
|
||||||
#include <linux/serial.h>
|
#include <linux/serial.h>
|
||||||
|
#include <linux/sock_diag.h>
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
#include <linux/taskstats.h>
|
#include <linux/taskstats.h>
|
||||||
#include <linux/tipc.h>
|
#include <linux/tipc.h>
|
||||||
@ -281,10 +297,6 @@ struct ltchars {
|
|||||||
#include <asm/termbits.h>
|
#include <asm/termbits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MSG_FASTOPEN
|
|
||||||
#define MSG_FASTOPEN 0x20000000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PTRACE_GETREGS
|
#ifndef PTRACE_GETREGS
|
||||||
#define PTRACE_GETREGS 0xc
|
#define PTRACE_GETREGS 0xc
|
||||||
#endif
|
#endif
|
||||||
@ -293,14 +305,6 @@ struct ltchars {
|
|||||||
#define PTRACE_SETREGS 0xd
|
#define PTRACE_SETREGS 0xd
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SOL_NETLINK
|
|
||||||
#define SOL_NETLINK 270
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SOL_SMC
|
|
||||||
#define SOL_SMC 286
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SOL_BLUETOOTH
|
#ifdef SOL_BLUETOOTH
|
||||||
// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
|
// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
|
||||||
// but it is already in bluetooth_linux.go
|
// but it is already in bluetooth_linux.go
|
||||||
@ -317,10 +321,23 @@ struct ltchars {
|
|||||||
#undef TIPC_WAIT_FOREVER
|
#undef TIPC_WAIT_FOREVER
|
||||||
#define TIPC_WAIT_FOREVER 0xffffffff
|
#define TIPC_WAIT_FOREVER 0xffffffff
|
||||||
|
|
||||||
// Copied from linux/l2tp.h
|
// Copied from linux/netfilter/nf_nat.h
|
||||||
// Including linux/l2tp.h here causes conflicts between linux/in.h
|
// Including linux/netfilter/nf_nat.h here causes conflicts between linux/in.h
|
||||||
// and netinet/in.h included via net/route.h above.
|
// and netinet/in.h.
|
||||||
#define IPPROTO_L2TP 115
|
#define NF_NAT_RANGE_MAP_IPS (1 << 0)
|
||||||
|
#define NF_NAT_RANGE_PROTO_SPECIFIED (1 << 1)
|
||||||
|
#define NF_NAT_RANGE_PROTO_RANDOM (1 << 2)
|
||||||
|
#define NF_NAT_RANGE_PERSISTENT (1 << 3)
|
||||||
|
#define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4)
|
||||||
|
#define NF_NAT_RANGE_PROTO_OFFSET (1 << 5)
|
||||||
|
#define NF_NAT_RANGE_NETMAP (1 << 6)
|
||||||
|
#define NF_NAT_RANGE_PROTO_RANDOM_ALL \
|
||||||
|
(NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
|
||||||
|
#define NF_NAT_RANGE_MASK \
|
||||||
|
(NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \
|
||||||
|
NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \
|
||||||
|
NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET | \
|
||||||
|
NF_NAT_RANGE_NETMAP)
|
||||||
|
|
||||||
// Copied from linux/hid.h.
|
// Copied from linux/hid.h.
|
||||||
// Keep in sync with the size of the referenced fields.
|
// Keep in sync with the size of the referenced fields.
|
||||||
@ -517,10 +534,13 @@ ccflags="$@"
|
|||||||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
||||||
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
||||||
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
||||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ ||
|
$2 == "LOOP_CONFIGURE" ||
|
||||||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
||||||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||||
|
$2 ~ /^PTP_/ ||
|
||||||
$2 ~ /^RAW_PAYLOAD_/ ||
|
$2 ~ /^RAW_PAYLOAD_/ ||
|
||||||
|
$2 ~ /^[US]F_/ ||
|
||||||
$2 ~ /^TP_STATUS_/ ||
|
$2 ~ /^TP_STATUS_/ ||
|
||||||
$2 ~ /^FALLOC_/ ||
|
$2 ~ /^FALLOC_/ ||
|
||||||
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
|
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
|
||||||
@ -543,6 +563,8 @@ ccflags="$@"
|
|||||||
$2 !~ "NLA_TYPE_MASK" &&
|
$2 !~ "NLA_TYPE_MASK" &&
|
||||||
$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
|
$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
|
||||||
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
||||||
|
$2 ~ /^SOCK_|SK_DIAG_|SKNLGRP_$/ ||
|
||||||
|
$2 ~ /^(CONNECT|SAE)_/ ||
|
||||||
$2 ~ /^FIORDCHK$/ ||
|
$2 ~ /^FIORDCHK$/ ||
|
||||||
$2 ~ /^SIOC/ ||
|
$2 ~ /^SIOC/ ||
|
||||||
$2 ~ /^TIOC/ ||
|
$2 ~ /^TIOC/ ||
|
||||||
@ -557,7 +579,7 @@ ccflags="$@"
|
|||||||
$2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
|
$2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
|
||||||
$2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
|
$2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
|
||||||
$2 ~ /^CLONE_[A-Z_]+/ ||
|
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||||
$2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ &&
|
$2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+|BPF_F_LINK)$/ &&
|
||||||
$2 ~ /^(BPF|DLT)_/ ||
|
$2 ~ /^(BPF|DLT)_/ ||
|
||||||
$2 ~ /^AUDIT_/ ||
|
$2 ~ /^AUDIT_/ ||
|
||||||
$2 ~ /^(CLOCK|TIMER)_/ ||
|
$2 ~ /^(CLOCK|TIMER)_/ ||
|
||||||
@ -578,8 +600,9 @@ ccflags="$@"
|
|||||||
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
|
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
|
||||||
$2 ~ /^KEYCTL_/ ||
|
$2 ~ /^KEYCTL_/ ||
|
||||||
$2 ~ /^PERF_/ ||
|
$2 ~ /^PERF_/ ||
|
||||||
$2 ~ /^SECCOMP_MODE_/ ||
|
$2 ~ /^SECCOMP_/ ||
|
||||||
$2 ~ /^SEEK_/ ||
|
$2 ~ /^SEEK_/ ||
|
||||||
|
$2 ~ /^SCHED_/ ||
|
||||||
$2 ~ /^SPLICE_/ ||
|
$2 ~ /^SPLICE_/ ||
|
||||||
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
||||||
$2 !~ /IOC_MAGIC/ &&
|
$2 !~ /IOC_MAGIC/ &&
|
||||||
@ -598,6 +621,9 @@ ccflags="$@"
|
|||||||
$2 ~ /^FSOPT_/ ||
|
$2 ~ /^FSOPT_/ ||
|
||||||
$2 ~ /^WDIO[CFS]_/ ||
|
$2 ~ /^WDIO[CFS]_/ ||
|
||||||
$2 ~ /^NFN/ ||
|
$2 ~ /^NFN/ ||
|
||||||
|
$2 !~ /^NFT_META_IIFTYPE/ &&
|
||||||
|
$2 ~ /^NFT_/ ||
|
||||||
|
$2 ~ /^NF_NAT_/ ||
|
||||||
$2 ~ /^XDP_/ ||
|
$2 ~ /^XDP_/ ||
|
||||||
$2 ~ /^RWF_/ ||
|
$2 ~ /^RWF_/ ||
|
||||||
$2 ~ /^(HDIO|WIN|SMART)_/ ||
|
$2 ~ /^(HDIO|WIN|SMART)_/ ||
|
||||||
@ -621,7 +647,7 @@ ccflags="$@"
|
|||||||
$2 ~ /^MEM/ ||
|
$2 ~ /^MEM/ ||
|
||||||
$2 ~ /^WG/ ||
|
$2 ~ /^WG/ ||
|
||||||
$2 ~ /^FIB_RULE_/ ||
|
$2 ~ /^FIB_RULE_/ ||
|
||||||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE|IOMIN$|IOOPT$|ALIGNOFF$|DISCARD|ROTATIONAL$|ZEROOUT$|GETDISKSEQ$)/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||||
$2 ~ /^__WCOREFLAG$/ {next}
|
$2 ~ /^__WCOREFLAG$/ {next}
|
||||||
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||||
|
|
||||||
@ -642,7 +668,7 @@ errors=$(
|
|||||||
signals=$(
|
signals=$(
|
||||||
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
|
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
|
||||||
grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' |
|
grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
|
||||||
sort
|
sort
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -652,14 +678,13 @@ echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
|
|||||||
sort >_error.grep
|
sort >_error.grep
|
||||||
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
|
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
|
||||||
grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' |
|
grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
|
||||||
sort >_signal.grep
|
sort >_signal.grep
|
||||||
|
|
||||||
echo '// mkerrors.sh' "$@"
|
echo '// mkerrors.sh' "$@"
|
||||||
echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
|
echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
|
||||||
echo
|
echo
|
||||||
echo "//go:build ${GOARCH} && ${GOOS}"
|
echo "//go:build ${GOARCH} && ${GOOS}"
|
||||||
echo "// +build ${GOARCH},${GOOS}"
|
|
||||||
echo
|
echo
|
||||||
go tool cgo -godefs -- "$@" _const.go >_error.out
|
go tool cgo -godefs -- "$@" _const.go >_error.out
|
||||||
cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
|
cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
|
||||||
@ -738,7 +763,8 @@ main(void)
|
|||||||
e = errors[i].num;
|
e = errors[i].num;
|
||||||
if(i > 0 && errors[i-1].num == e)
|
if(i > 0 && errors[i-1].num == e)
|
||||||
continue;
|
continue;
|
||||||
strcpy(buf, strerror(e));
|
strncpy(buf, strerror(e), sizeof(buf) - 1);
|
||||||
|
buf[sizeof(buf) - 1] = '\0';
|
||||||
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||||
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
||||||
buf[0] += a - A;
|
buf[0] += a - A;
|
||||||
@ -757,7 +783,8 @@ main(void)
|
|||||||
e = signals[i].num;
|
e = signals[i].num;
|
||||||
if(i > 0 && signals[i-1].num == e)
|
if(i > 0 && signals[i-1].num == e)
|
||||||
continue;
|
continue;
|
||||||
strcpy(buf, strsignal(e));
|
strncpy(buf, strsignal(e), sizeof(buf) - 1);
|
||||||
|
buf[sizeof(buf) - 1] = '\0';
|
||||||
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||||
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
||||||
buf[0] += a - A;
|
buf[0] += a - A;
|
||||||
|
13
vendor/golang.org/x/sys/unix/mmap_nomremap.go
generated
vendored
Normal file
13
vendor/golang.org/x/sys/unix/mmap_nomremap.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2023 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 || darwin || dragonfly || freebsd || openbsd || solaris || zos
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
var mapper = &mmapper{
|
||||||
|
active: make(map[*byte][]byte),
|
||||||
|
mmap: mmap,
|
||||||
|
munmap: munmap,
|
||||||
|
}
|
57
vendor/golang.org/x/sys/unix/mremap.go
generated
vendored
Normal file
57
vendor/golang.org/x/sys/unix/mremap.go
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright 2023 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 linux || netbsd
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
type mremapMmapper struct {
|
||||||
|
mmapper
|
||||||
|
mremap func(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (xaddr uintptr, err error)
|
||||||
|
}
|
||||||
|
|
||||||
|
var mapper = &mremapMmapper{
|
||||||
|
mmapper: mmapper{
|
||||||
|
active: make(map[*byte][]byte),
|
||||||
|
mmap: mmap,
|
||||||
|
munmap: munmap,
|
||||||
|
},
|
||||||
|
mremap: mremap,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mremapMmapper) Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) {
|
||||||
|
if newLength <= 0 || len(oldData) == 0 || len(oldData) != cap(oldData) || flags&mremapFixed != 0 {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
pOld := &oldData[cap(oldData)-1]
|
||||||
|
m.Lock()
|
||||||
|
defer m.Unlock()
|
||||||
|
bOld := m.active[pOld]
|
||||||
|
if bOld == nil || &bOld[0] != &oldData[0] {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
newAddr, errno := m.mremap(uintptr(unsafe.Pointer(&bOld[0])), uintptr(len(bOld)), uintptr(newLength), flags, 0)
|
||||||
|
if errno != nil {
|
||||||
|
return nil, errno
|
||||||
|
}
|
||||||
|
bNew := unsafe.Slice((*byte)(unsafe.Pointer(newAddr)), newLength)
|
||||||
|
pNew := &bNew[cap(bNew)-1]
|
||||||
|
if flags&mremapDontunmap == 0 {
|
||||||
|
delete(m.active, pOld)
|
||||||
|
}
|
||||||
|
m.active[pNew] = bNew
|
||||||
|
return bNew, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) {
|
||||||
|
return mapper.Mremap(oldData, newLength, flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
func MremapPtr(oldAddr unsafe.Pointer, oldSize uintptr, newAddr unsafe.Pointer, newSize uintptr, flags int) (ret unsafe.Pointer, err error) {
|
||||||
|
xaddr, err := mapper.mremap(uintptr(oldAddr), oldSize, newSize, flags, uintptr(newAddr))
|
||||||
|
return unsafe.Pointer(xaddr), err
|
||||||
|
}
|
3
vendor/golang.org/x/sys/unix/pagesize_unix.go
generated
vendored
3
vendor/golang.org/x/sys/unix/pagesize_unix.go
generated
vendored
@ -2,8 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
||||||
|
|
||||||
// For Unix, get the pagesize from the runtime.
|
// For Unix, get the pagesize from the runtime.
|
||||||
|
|
||||||
|
110
vendor/golang.org/x/sys/unix/pledge_openbsd.go
generated
vendored
110
vendor/golang.org/x/sys/unix/pledge_openbsd.go
generated
vendored
@ -8,54 +8,31 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Pledge implements the pledge syscall.
|
// Pledge implements the pledge syscall.
|
||||||
//
|
//
|
||||||
// The pledge syscall does not accept execpromises on OpenBSD releases
|
// This changes both the promises and execpromises; use PledgePromises or
|
||||||
// before 6.3.
|
// PledgeExecpromises to only change the promises or execpromises
|
||||||
//
|
// respectively.
|
||||||
// execpromises must be empty when Pledge is called on OpenBSD
|
|
||||||
// releases predating 6.3, otherwise an error will be returned.
|
|
||||||
//
|
//
|
||||||
// For more information see pledge(2).
|
// For more information see pledge(2).
|
||||||
func Pledge(promises, execpromises string) error {
|
func Pledge(promises, execpromises string) error {
|
||||||
maj, min, err := majmin()
|
if err := pledgeAvailable(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pptr, err := BytePtrFromString(promises)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pledgeAvailable(maj, min, execpromises)
|
exptr, err := BytePtrFromString(execpromises)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
pptr, err := syscall.BytePtrFromString(promises)
|
return pledge(pptr, exptr)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// This variable will hold either a nil unsafe.Pointer or
|
|
||||||
// an unsafe.Pointer to a string (execpromises).
|
|
||||||
var expr unsafe.Pointer
|
|
||||||
|
|
||||||
// If we're running on OpenBSD > 6.2, pass execpromises to the syscall.
|
|
||||||
if maj > 6 || (maj == 6 && min > 2) {
|
|
||||||
exptr, err := syscall.BytePtrFromString(execpromises)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
expr = unsafe.Pointer(exptr)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
|
|
||||||
if e != 0 {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PledgePromises implements the pledge syscall.
|
// PledgePromises implements the pledge syscall.
|
||||||
@ -64,30 +41,16 @@ func Pledge(promises, execpromises string) error {
|
|||||||
//
|
//
|
||||||
// For more information see pledge(2).
|
// For more information see pledge(2).
|
||||||
func PledgePromises(promises string) error {
|
func PledgePromises(promises string) error {
|
||||||
maj, min, err := majmin()
|
if err := pledgeAvailable(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pptr, err := BytePtrFromString(promises)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pledgeAvailable(maj, min, "")
|
return pledge(pptr, nil)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// This variable holds the execpromises and is always nil.
|
|
||||||
var expr unsafe.Pointer
|
|
||||||
|
|
||||||
pptr, err := syscall.BytePtrFromString(promises)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
|
|
||||||
if e != 0 {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PledgeExecpromises implements the pledge syscall.
|
// PledgeExecpromises implements the pledge syscall.
|
||||||
@ -96,30 +59,16 @@ func PledgePromises(promises string) error {
|
|||||||
//
|
//
|
||||||
// For more information see pledge(2).
|
// For more information see pledge(2).
|
||||||
func PledgeExecpromises(execpromises string) error {
|
func PledgeExecpromises(execpromises string) error {
|
||||||
maj, min, err := majmin()
|
if err := pledgeAvailable(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
exptr, err := BytePtrFromString(execpromises)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pledgeAvailable(maj, min, execpromises)
|
return pledge(nil, exptr)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// This variable holds the promises and is always nil.
|
|
||||||
var pptr unsafe.Pointer
|
|
||||||
|
|
||||||
exptr, err := syscall.BytePtrFromString(execpromises)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0)
|
|
||||||
if e != 0 {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// majmin returns major and minor version number for an OpenBSD system.
|
// majmin returns major and minor version number for an OpenBSD system.
|
||||||
@ -147,16 +96,15 @@ func majmin() (major int, minor int, err error) {
|
|||||||
|
|
||||||
// pledgeAvailable checks for availability of the pledge(2) syscall
|
// pledgeAvailable checks for availability of the pledge(2) syscall
|
||||||
// based on the running OpenBSD version.
|
// based on the running OpenBSD version.
|
||||||
func pledgeAvailable(maj, min int, execpromises string) error {
|
func pledgeAvailable() error {
|
||||||
// If OpenBSD <= 5.9, pledge is not available.
|
maj, min, err := majmin()
|
||||||
if (maj == 5 && min != 9) || maj < 5 {
|
if err != nil {
|
||||||
return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If OpenBSD <= 6.2 and execpromises is not empty,
|
// Require OpenBSD 6.4 as a minimum.
|
||||||
// return an error - execpromises is not available before 6.3
|
if maj < 6 || (maj == 6 && min <= 3) {
|
||||||
if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" {
|
return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj, min)
|
||||||
return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
1
vendor/golang.org/x/sys/unix/ptrace_darwin.go
generated
vendored
1
vendor/golang.org/x/sys/unix/ptrace_darwin.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build darwin && !ios
|
//go:build darwin && !ios
|
||||||
// +build darwin,!ios
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/ptrace_ios.go
generated
vendored
1
vendor/golang.org/x/sys/unix/ptrace_ios.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build ios
|
//go:build ios
|
||||||
// +build ios
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/race.go
generated
vendored
1
vendor/golang.org/x/sys/unix/race.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build (darwin && race) || (linux && race) || (freebsd && race)
|
//go:build (darwin && race) || (linux && race) || (freebsd && race)
|
||||||
// +build darwin,race linux,race freebsd,race
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/race0.go
generated
vendored
1
vendor/golang.org/x/sys/unix/race0.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos
|
//go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos
|
||||||
// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/readdirent_getdents.go
generated
vendored
1
vendor/golang.org/x/sys/unix/readdirent_getdents.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd
|
//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd
|
||||||
// +build aix dragonfly freebsd linux netbsd openbsd
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
generated
vendored
3
vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
generated
vendored
@ -2,8 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build darwin
|
//go:build darwin || zos
|
||||||
// +build darwin
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
15
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
15
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
|
||||||
|
|
||||||
// Socket control messages
|
// Socket control messages
|
||||||
|
|
||||||
@ -52,6 +51,20 @@ func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) {
|
|||||||
return msgs, nil
|
return msgs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParseOneSocketControlMessage parses a single socket control message from b, returning the message header,
|
||||||
|
// message data (a slice of b), and the remainder of b after that single message.
|
||||||
|
// When there are no remaining messages, len(remainder) == 0.
|
||||||
|
func ParseOneSocketControlMessage(b []byte) (hdr Cmsghdr, data []byte, remainder []byte, err error) {
|
||||||
|
h, dbuf, err := socketControlMessageHeaderAndData(b)
|
||||||
|
if err != nil {
|
||||||
|
return Cmsghdr{}, nil, nil, err
|
||||||
|
}
|
||||||
|
if i := cmsgAlignOf(int(h.Len)); i < len(b) {
|
||||||
|
remainder = b[i:]
|
||||||
|
}
|
||||||
|
return *h, dbuf, remainder, nil
|
||||||
|
}
|
||||||
|
|
||||||
func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) {
|
func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) {
|
||||||
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||||
if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) {
|
if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) {
|
||||||
|
1
vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
generated
vendored
1
vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin freebsd linux netbsd openbsd solaris zos
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
58
vendor/golang.org/x/sys/unix/sockcmsg_zos.go
generated
vendored
Normal file
58
vendor/golang.org/x/sys/unix/sockcmsg_zos.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// Copyright 2024 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.
|
||||||
|
|
||||||
|
// Socket control messages
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// UnixCredentials encodes credentials into a socket control message
|
||||||
|
// for sending to another process. This can be used for
|
||||||
|
// authentication.
|
||||||
|
func UnixCredentials(ucred *Ucred) []byte {
|
||||||
|
b := make([]byte, CmsgSpace(SizeofUcred))
|
||||||
|
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||||
|
h.Level = SOL_SOCKET
|
||||||
|
h.Type = SCM_CREDENTIALS
|
||||||
|
h.SetLen(CmsgLen(SizeofUcred))
|
||||||
|
*(*Ucred)(h.data(0)) = *ucred
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseUnixCredentials decodes a socket control message that contains
|
||||||
|
// credentials in a Ucred structure. To receive such a message, the
|
||||||
|
// SO_PASSCRED option must be enabled on the socket.
|
||||||
|
func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) {
|
||||||
|
if m.Header.Level != SOL_SOCKET {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
if m.Header.Type != SCM_CREDENTIALS {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0]))
|
||||||
|
return &ucred, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PktInfo4 encodes Inet4Pktinfo into a socket control message of type IP_PKTINFO.
|
||||||
|
func PktInfo4(info *Inet4Pktinfo) []byte {
|
||||||
|
b := make([]byte, CmsgSpace(SizeofInet4Pktinfo))
|
||||||
|
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||||
|
h.Level = SOL_IP
|
||||||
|
h.Type = IP_PKTINFO
|
||||||
|
h.SetLen(CmsgLen(SizeofInet4Pktinfo))
|
||||||
|
*(*Inet4Pktinfo)(h.data(0)) = *info
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// PktInfo6 encodes Inet6Pktinfo into a socket control message of type IPV6_PKTINFO.
|
||||||
|
func PktInfo6(info *Inet6Pktinfo) []byte {
|
||||||
|
b := make([]byte, CmsgSpace(SizeofInet6Pktinfo))
|
||||||
|
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||||
|
h.Level = SOL_IPV6
|
||||||
|
h.Type = IPV6_PKTINFO
|
||||||
|
h.SetLen(CmsgLen(SizeofInet6Pktinfo))
|
||||||
|
*(*Inet6Pktinfo)(h.data(0)) = *info
|
||||||
|
return b
|
||||||
|
}
|
75
vendor/golang.org/x/sys/unix/symaddr_zos_s390x.s
generated
vendored
Normal file
75
vendor/golang.org/x/sys/unix/symaddr_zos_s390x.s
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
// Copyright 2024 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 zos && s390x && gc
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
// provide the address of function variable to be fixed up.
|
||||||
|
|
||||||
|
TEXT ·getPipe2Addr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Pipe2(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_FlockAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Flock(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_GetxattrAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Getxattr(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_NanosleepAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Nanosleep(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_SetxattrAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Setxattr(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_Wait4Addr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Wait4(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_MountAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Mount(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_UnmountAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Unmount(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_UtimesNanoAtAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·UtimesNanoAt(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_UtimesNanoAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·UtimesNano(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_MkfifoatAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Mkfifoat(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_ChtagAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Chtag(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·get_ReadlinkatAddr(SB), NOSPLIT|NOFRAME, $0-8
|
||||||
|
MOVD $·Readlinkat(SB), R8
|
||||||
|
MOVD R8, ret+0(FP)
|
||||||
|
RET
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
|
||||||
|
|
||||||
// Package unix contains an interface to the low-level operating system
|
// Package unix contains an interface to the low-level operating system
|
||||||
// primitives. OS details vary depending on the underlying system, and
|
// primitives. OS details vary depending on the underlying system, and
|
||||||
|
30
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
30
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix
|
//go:build aix
|
||||||
// +build aix
|
|
||||||
|
|
||||||
// Aix system calls.
|
// Aix system calls.
|
||||||
// This file is compiled as ordinary Go code,
|
// This file is compiled as ordinary Go code,
|
||||||
@ -107,7 +106,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||||||
if n > 0 {
|
if n > 0 {
|
||||||
sl += _Socklen(n) + 1
|
sl += _Socklen(n) + 1
|
||||||
}
|
}
|
||||||
if sa.raw.Path[0] == '@' {
|
if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) {
|
||||||
|
// Check sl > 3 so we don't change unnamed socket behavior.
|
||||||
sa.raw.Path[0] = 0
|
sa.raw.Path[0] = 0
|
||||||
// Don't count trailing NUL for abstract address.
|
// Don't count trailing NUL for abstract address.
|
||||||
sl--
|
sl--
|
||||||
@ -292,9 +292,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
|
||||||
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
|
||||||
sa.Name = string(bytes)
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
@ -362,7 +360,7 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
|
|||||||
var status _C_int
|
var status _C_int
|
||||||
var r Pid_t
|
var r Pid_t
|
||||||
err = ERESTART
|
err = ERESTART
|
||||||
// AIX wait4 may return with ERESTART errno, while the processus is still
|
// AIX wait4 may return with ERESTART errno, while the process is still
|
||||||
// active.
|
// active.
|
||||||
for err == ERESTART {
|
for err == ERESTART {
|
||||||
r, err = wait4(Pid_t(pid), &status, options, rusage)
|
r, err = wait4(Pid_t(pid), &status, options, rusage)
|
||||||
@ -410,7 +408,8 @@ func (w WaitStatus) CoreDump() bool { return w&0x80 == 0x80 }
|
|||||||
|
|
||||||
func (w WaitStatus) TrapCause() int { return -1 }
|
func (w WaitStatus) TrapCause() int { return -1 }
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req int, arg uintptr) (err error)
|
||||||
|
//sys ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) = ioctl
|
||||||
|
|
||||||
// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX
|
// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX
|
||||||
// There is no way to create a custom fcntl and to keep //sys fcntl easily,
|
// There is no way to create a custom fcntl and to keep //sys fcntl easily,
|
||||||
@ -488,8 +487,6 @@ func Fsync(fd int) error {
|
|||||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||||
//sys write(fd int, p []byte) (n int, err error)
|
//sys write(fd int, p []byte) (n int, err error)
|
||||||
//sys readlen(fd int, p *byte, np int) (n int, err error) = read
|
|
||||||
//sys writelen(fd int, p *byte, np int) (n int, err error) = write
|
|
||||||
|
|
||||||
//sys Dup2(oldfd int, newfd int) (err error)
|
//sys Dup2(oldfd int, newfd int) (err error)
|
||||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64
|
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64
|
||||||
@ -536,21 +533,6 @@ func Fsync(fd int) error {
|
|||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg
|
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg
|
||||||
|
|
||||||
//sys munmap(addr uintptr, length uintptr) (err error)
|
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||||
|
|
||||||
var mapper = &mmapper{
|
|
||||||
active: make(map[*byte][]byte),
|
|
||||||
mmap: mmap,
|
|
||||||
munmap: munmap,
|
|
||||||
}
|
|
||||||
|
|
||||||
func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
|
|
||||||
return mapper.Mmap(fd, offset, length, prot, flags)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Munmap(b []byte) (err error) {
|
|
||||||
return mapper.Munmap(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys Madvise(b []byte, advice int) (err error)
|
//sys Madvise(b []byte, advice int) (err error)
|
||||||
//sys Mprotect(b []byte, prot int) (err error)
|
//sys Mprotect(b []byte, prot int) (err error)
|
||||||
//sys Mlock(b []byte) (err error)
|
//sys Mlock(b []byte) (err error)
|
||||||
|
2
vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
generated
vendored
@ -3,12 +3,10 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix && ppc
|
//go:build aix && ppc
|
||||||
// +build aix,ppc
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64
|
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64
|
||||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64
|
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64
|
||||||
|
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||||
|
2
vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
generated
vendored
@ -3,12 +3,10 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build aix && ppc64
|
//go:build aix && ppc64
|
||||||
// +build aix,ppc64
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek
|
||||||
|
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64
|
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64
|
||||||
|
20
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
20
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
|
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
|
||||||
// +build darwin dragonfly freebsd netbsd openbsd
|
|
||||||
|
|
||||||
// BSD system call wrappers shared by *BSD based systems
|
// BSD system call wrappers shared by *BSD based systems
|
||||||
// including OS X (Darwin) and FreeBSD. Like the other
|
// including OS X (Darwin) and FreeBSD. Like the other
|
||||||
@ -245,8 +244,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
|
||||||
sa.Name = string(bytes)
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
@ -318,7 +316,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return string(buf[:vallen-1]), nil
|
return ByteSliceToString(buf[:vallen]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||||
@ -602,20 +600,6 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|||||||
// Gethostuuid(uuid *byte, timeout *Timespec) (err error)
|
// Gethostuuid(uuid *byte, timeout *Timespec) (err error)
|
||||||
// Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, err error)
|
// Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, err error)
|
||||||
|
|
||||||
var mapper = &mmapper{
|
|
||||||
active: make(map[*byte][]byte),
|
|
||||||
mmap: mmap,
|
|
||||||
munmap: munmap,
|
|
||||||
}
|
|
||||||
|
|
||||||
func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
|
|
||||||
return mapper.Mmap(fd, offset, length, prot, flags)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Munmap(b []byte) (err error) {
|
|
||||||
return mapper.Munmap(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys Madvise(b []byte, behav int) (err error)
|
//sys Madvise(b []byte, behav int) (err error)
|
||||||
//sys Mlock(b []byte) (err error)
|
//sys Mlock(b []byte) (err error)
|
||||||
//sys Mlockall(flags int) (err error)
|
//sys Mlockall(flags int) (err error)
|
||||||
|
269
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
269
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
@ -14,7 +14,6 @@ package unix
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
@ -230,6 +229,7 @@ func direntNamlen(buf []byte) (uint64, bool) {
|
|||||||
|
|
||||||
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
|
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
|
||||||
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
|
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
|
||||||
|
func PtraceDenyAttach() (err error) { return ptrace(PT_DENY_ATTACH, 0, 0, 0) }
|
||||||
|
|
||||||
//sysnb pipe(p *[2]int32) (err error)
|
//sysnb pipe(p *[2]int32) (err error)
|
||||||
|
|
||||||
@ -375,11 +375,10 @@ func Flistxattr(fd int, dest []byte) (sz int, err error) {
|
|||||||
func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) }
|
func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) }
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
|
|
||||||
func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
|
func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
|
||||||
err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo)))
|
return ioctlPtr(fd, CTLIOCGINFO, unsafe.Pointer(ctlInfo))
|
||||||
runtime.KeepAlive(ctlInfo)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IfreqMTU is struct ifreq used to get or set a network device's MTU.
|
// IfreqMTU is struct ifreq used to get or set a network device's MTU.
|
||||||
@ -393,16 +392,26 @@ type IfreqMTU struct {
|
|||||||
func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
|
func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
|
||||||
var ifreq IfreqMTU
|
var ifreq IfreqMTU
|
||||||
copy(ifreq.Name[:], ifname)
|
copy(ifreq.Name[:], ifname)
|
||||||
err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq)))
|
err := ioctlPtr(fd, SIOCGIFMTU, unsafe.Pointer(&ifreq))
|
||||||
return &ifreq, err
|
return &ifreq, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU
|
// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU
|
||||||
// of the network device specified by ifreq.Name.
|
// of the network device specified by ifreq.Name.
|
||||||
func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
|
func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
|
||||||
err := ioctl(fd, SIOCSIFMTU, uintptr(unsafe.Pointer(ifreq)))
|
return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq))
|
||||||
runtime.KeepAlive(ifreq)
|
}
|
||||||
return err
|
|
||||||
|
//sys renamexNp(from string, to string, flag uint32) (err error)
|
||||||
|
|
||||||
|
func RenamexNp(from string, to string, flag uint32) (err error) {
|
||||||
|
return renamexNp(from, to, flag)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys renameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error)
|
||||||
|
|
||||||
|
func RenameatxNp(fromfd int, from string, tofd int, to string, flag uint32) (err error) {
|
||||||
|
return renameatxNp(fromfd, from, tofd, to, flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
|
||||||
@ -513,6 +522,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
// Find size.
|
// Find size.
|
||||||
n := uintptr(0)
|
n := uintptr(0)
|
||||||
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
|
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
|
||||||
@ -528,6 +538,10 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
|||||||
// Read into buffer of that size.
|
// Read into buffer of that size.
|
||||||
buf := make([]KinfoProc, n/SizeofKinfoProc)
|
buf := make([]KinfoProc, n/SizeofKinfoProc)
|
||||||
if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil {
|
if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil {
|
||||||
|
if err == ENOMEM {
|
||||||
|
// Process table grew. Try again.
|
||||||
|
continue
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if n%SizeofKinfoProc != 0 {
|
if n%SizeofKinfoProc != 0 {
|
||||||
@ -538,7 +552,57 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
|||||||
// size so ensure we deal with that.
|
// size so ensure we deal with that.
|
||||||
return buf[:n/SizeofKinfoProc], nil
|
return buf[:n/SizeofKinfoProc], nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys pthread_chdir_np(path string) (err error)
|
||||||
|
|
||||||
|
func PthreadChdir(path string) (err error) {
|
||||||
|
return pthread_chdir_np(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys pthread_fchdir_np(fd int) (err error)
|
||||||
|
|
||||||
|
func PthreadFchdir(fd int) (err error) {
|
||||||
|
return pthread_fchdir_np(fd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connectx calls connectx(2) to initiate a connection on a socket.
|
||||||
|
//
|
||||||
|
// srcIf, srcAddr, and dstAddr are filled into a [SaEndpoints] struct and passed as the endpoints argument.
|
||||||
|
//
|
||||||
|
// - srcIf is the optional source interface index. 0 means unspecified.
|
||||||
|
// - srcAddr is the optional source address. nil means unspecified.
|
||||||
|
// - dstAddr is the destination address.
|
||||||
|
//
|
||||||
|
// On success, Connectx returns the number of bytes enqueued for transmission.
|
||||||
|
func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocID, flags uint32, iov []Iovec, connid *SaeConnID) (n uintptr, err error) {
|
||||||
|
endpoints := SaEndpoints{
|
||||||
|
Srcif: srcIf,
|
||||||
|
}
|
||||||
|
|
||||||
|
if srcAddr != nil {
|
||||||
|
addrp, addrlen, err := srcAddr.sockaddr()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
endpoints.Srcaddr = (*RawSockaddr)(addrp)
|
||||||
|
endpoints.Srcaddrlen = uint32(addrlen)
|
||||||
|
}
|
||||||
|
|
||||||
|
if dstAddr != nil {
|
||||||
|
addrp, addrlen, err := dstAddr.sockaddr()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
endpoints.Dstaddr = (*RawSockaddr)(addrp)
|
||||||
|
endpoints.Dstaddrlen = uint32(addrlen)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = connectx(fd, &endpoints, associd, flags, iov, &n, connid)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error)
|
||||||
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||||
|
|
||||||
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||||
@ -616,6 +680,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
|||||||
//sys Rmdir(path string) (err error)
|
//sys Rmdir(path string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||||
|
//sys Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error)
|
||||||
//sys Setegid(egid int) (err error)
|
//sys Setegid(egid int) (err error)
|
||||||
//sysnb Seteuid(euid int) (err error)
|
//sysnb Seteuid(euid int) (err error)
|
||||||
//sysnb Setgid(gid int) (err error)
|
//sysnb Setgid(gid int) (err error)
|
||||||
@ -625,7 +690,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
|||||||
//sys Setprivexec(flag int) (err error)
|
//sys Setprivexec(flag int) (err error)
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
//sysnb Setregid(rgid int, egid int) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sysnb Setrlimit(which int, lim *Rlimit) (err error)
|
|
||||||
//sysnb Setsid() (pid int, err error)
|
//sysnb Setsid() (pid int, err error)
|
||||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||||
//sysnb Setuid(uid int) (err error)
|
//sysnb Setuid(uid int) (err error)
|
||||||
@ -641,190 +705,3 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
|||||||
//sys write(fd int, p []byte) (n int, err error)
|
//sys write(fd int, p []byte) (n int, err error)
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||||
//sys munmap(addr uintptr, length uintptr) (err error)
|
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||||
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
|
|
||||||
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unimplemented
|
|
||||||
*/
|
|
||||||
// Profil
|
|
||||||
// Sigaction
|
|
||||||
// Sigprocmask
|
|
||||||
// Getlogin
|
|
||||||
// Sigpending
|
|
||||||
// Sigaltstack
|
|
||||||
// Ioctl
|
|
||||||
// Reboot
|
|
||||||
// Execve
|
|
||||||
// Vfork
|
|
||||||
// Sbrk
|
|
||||||
// Sstk
|
|
||||||
// Ovadvise
|
|
||||||
// Mincore
|
|
||||||
// Setitimer
|
|
||||||
// Swapon
|
|
||||||
// Select
|
|
||||||
// Sigsuspend
|
|
||||||
// Readv
|
|
||||||
// Writev
|
|
||||||
// Nfssvc
|
|
||||||
// Getfh
|
|
||||||
// Quotactl
|
|
||||||
// Csops
|
|
||||||
// Waitid
|
|
||||||
// Add_profil
|
|
||||||
// Kdebug_trace
|
|
||||||
// Sigreturn
|
|
||||||
// Atsocket
|
|
||||||
// Kqueue_from_portset_np
|
|
||||||
// Kqueue_portset
|
|
||||||
// Getattrlist
|
|
||||||
// Setattrlist
|
|
||||||
// Getdirentriesattr
|
|
||||||
// Searchfs
|
|
||||||
// Delete
|
|
||||||
// Copyfile
|
|
||||||
// Watchevent
|
|
||||||
// Waitevent
|
|
||||||
// Modwatch
|
|
||||||
// Fsctl
|
|
||||||
// Initgroups
|
|
||||||
// Posix_spawn
|
|
||||||
// Nfsclnt
|
|
||||||
// Fhopen
|
|
||||||
// Minherit
|
|
||||||
// Semsys
|
|
||||||
// Msgsys
|
|
||||||
// Shmsys
|
|
||||||
// Semctl
|
|
||||||
// Semget
|
|
||||||
// Semop
|
|
||||||
// Msgctl
|
|
||||||
// Msgget
|
|
||||||
// Msgsnd
|
|
||||||
// Msgrcv
|
|
||||||
// Shm_open
|
|
||||||
// Shm_unlink
|
|
||||||
// Sem_open
|
|
||||||
// Sem_close
|
|
||||||
// Sem_unlink
|
|
||||||
// Sem_wait
|
|
||||||
// Sem_trywait
|
|
||||||
// Sem_post
|
|
||||||
// Sem_getvalue
|
|
||||||
// Sem_init
|
|
||||||
// Sem_destroy
|
|
||||||
// Open_extended
|
|
||||||
// Umask_extended
|
|
||||||
// Stat_extended
|
|
||||||
// Lstat_extended
|
|
||||||
// Fstat_extended
|
|
||||||
// Chmod_extended
|
|
||||||
// Fchmod_extended
|
|
||||||
// Access_extended
|
|
||||||
// Settid
|
|
||||||
// Gettid
|
|
||||||
// Setsgroups
|
|
||||||
// Getsgroups
|
|
||||||
// Setwgroups
|
|
||||||
// Getwgroups
|
|
||||||
// Mkfifo_extended
|
|
||||||
// Mkdir_extended
|
|
||||||
// Identitysvc
|
|
||||||
// Shared_region_check_np
|
|
||||||
// Shared_region_map_np
|
|
||||||
// __pthread_mutex_destroy
|
|
||||||
// __pthread_mutex_init
|
|
||||||
// __pthread_mutex_lock
|
|
||||||
// __pthread_mutex_trylock
|
|
||||||
// __pthread_mutex_unlock
|
|
||||||
// __pthread_cond_init
|
|
||||||
// __pthread_cond_destroy
|
|
||||||
// __pthread_cond_broadcast
|
|
||||||
// __pthread_cond_signal
|
|
||||||
// Setsid_with_pid
|
|
||||||
// __pthread_cond_timedwait
|
|
||||||
// Aio_fsync
|
|
||||||
// Aio_return
|
|
||||||
// Aio_suspend
|
|
||||||
// Aio_cancel
|
|
||||||
// Aio_error
|
|
||||||
// Aio_read
|
|
||||||
// Aio_write
|
|
||||||
// Lio_listio
|
|
||||||
// __pthread_cond_wait
|
|
||||||
// Iopolicysys
|
|
||||||
// __pthread_kill
|
|
||||||
// __pthread_sigmask
|
|
||||||
// __sigwait
|
|
||||||
// __disable_threadsignal
|
|
||||||
// __pthread_markcancel
|
|
||||||
// __pthread_canceled
|
|
||||||
// __semwait_signal
|
|
||||||
// Proc_info
|
|
||||||
// sendfile
|
|
||||||
// Stat64_extended
|
|
||||||
// Lstat64_extended
|
|
||||||
// Fstat64_extended
|
|
||||||
// __pthread_chdir
|
|
||||||
// __pthread_fchdir
|
|
||||||
// Audit
|
|
||||||
// Auditon
|
|
||||||
// Getauid
|
|
||||||
// Setauid
|
|
||||||
// Getaudit
|
|
||||||
// Setaudit
|
|
||||||
// Getaudit_addr
|
|
||||||
// Setaudit_addr
|
|
||||||
// Auditctl
|
|
||||||
// Bsdthread_create
|
|
||||||
// Bsdthread_terminate
|
|
||||||
// Stack_snapshot
|
|
||||||
// Bsdthread_register
|
|
||||||
// Workq_open
|
|
||||||
// Workq_ops
|
|
||||||
// __mac_execve
|
|
||||||
// __mac_syscall
|
|
||||||
// __mac_get_file
|
|
||||||
// __mac_set_file
|
|
||||||
// __mac_get_link
|
|
||||||
// __mac_set_link
|
|
||||||
// __mac_get_proc
|
|
||||||
// __mac_set_proc
|
|
||||||
// __mac_get_fd
|
|
||||||
// __mac_set_fd
|
|
||||||
// __mac_get_pid
|
|
||||||
// __mac_get_lcid
|
|
||||||
// __mac_get_lctx
|
|
||||||
// __mac_set_lctx
|
|
||||||
// Setlcid
|
|
||||||
// Read_nocancel
|
|
||||||
// Write_nocancel
|
|
||||||
// Open_nocancel
|
|
||||||
// Close_nocancel
|
|
||||||
// Wait4_nocancel
|
|
||||||
// Recvmsg_nocancel
|
|
||||||
// Sendmsg_nocancel
|
|
||||||
// Recvfrom_nocancel
|
|
||||||
// Accept_nocancel
|
|
||||||
// Fcntl_nocancel
|
|
||||||
// Select_nocancel
|
|
||||||
// Fsync_nocancel
|
|
||||||
// Connect_nocancel
|
|
||||||
// Sigsuspend_nocancel
|
|
||||||
// Readv_nocancel
|
|
||||||
// Writev_nocancel
|
|
||||||
// Sendto_nocancel
|
|
||||||
// Pread_nocancel
|
|
||||||
// Pwrite_nocancel
|
|
||||||
// Waitid_nocancel
|
|
||||||
// Poll_nocancel
|
|
||||||
// Msgsnd_nocancel
|
|
||||||
// Msgrcv_nocancel
|
|
||||||
// Sem_wait_nocancel
|
|
||||||
// Aio_suspend_nocancel
|
|
||||||
// __sigwait_nocancel
|
|
||||||
// __semwait_signal_nocancel
|
|
||||||
// __mac_mount
|
|
||||||
// __mac_get_mount
|
|
||||||
// __mac_getfsstat
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build amd64 && darwin
|
//go:build amd64 && darwin
|
||||||
// +build amd64,darwin
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
1
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
@ -3,7 +3,6 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build arm64 && darwin
|
//go:build arm64 && darwin
|
||||||
// +build arm64,darwin
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
3
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
3
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
@ -2,8 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build darwin && go1.12
|
//go:build darwin
|
||||||
// +build darwin,go1.12
|
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
213
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
213
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
@ -172,6 +172,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||||
|
|
||||||
@ -245,6 +246,18 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||||||
return sendfile(outfd, infd, offset, count)
|
return sendfile(outfd, infd, offset, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Dup3(oldfd, newfd, flags int) error {
|
||||||
|
if oldfd == newfd || flags&^O_CLOEXEC != 0 {
|
||||||
|
return EINVAL
|
||||||
|
}
|
||||||
|
how := F_DUP2FD
|
||||||
|
if flags&O_CLOEXEC != 0 {
|
||||||
|
how = F_DUP2FD_CLOEXEC
|
||||||
|
}
|
||||||
|
_, err := fcntl(oldfd, how, newfd)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
@ -255,6 +268,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||||||
//sys Chmod(path string, mode uint32) (err error)
|
//sys Chmod(path string, mode uint32) (err error)
|
||||||
//sys Chown(path string, uid int, gid int) (err error)
|
//sys Chown(path string, uid int, gid int) (err error)
|
||||||
//sys Chroot(path string) (err error)
|
//sys Chroot(path string) (err error)
|
||||||
|
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||||
//sys Close(fd int) (err error)
|
//sys Close(fd int) (err error)
|
||||||
//sys Dup(fd int) (nfd int, err error)
|
//sys Dup(fd int) (nfd int, err error)
|
||||||
//sys Dup2(from int, to int) (err error)
|
//sys Dup2(from int, to int) (err error)
|
||||||
@ -324,7 +338,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||||
//sysnb Setrlimit(which int, lim *Rlimit) (err error)
|
|
||||||
//sysnb Setsid() (pid int, err error)
|
//sysnb Setsid() (pid int, err error)
|
||||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||||
//sysnb Setuid(uid int) (err error)
|
//sysnb Setuid(uid int) (err error)
|
||||||
@ -342,203 +355,5 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||||||
//sys write(fd int, p []byte) (n int, err error)
|
//sys write(fd int, p []byte) (n int, err error)
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||||
//sys munmap(addr uintptr, length uintptr) (err error)
|
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||||
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
|
|
||||||
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
|
|
||||||
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
|
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
|
||||||
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
|
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
|
||||||
|
|
||||||
/*
|
|
||||||
* Unimplemented
|
|
||||||
* TODO(jsing): Update this list for DragonFly.
|
|
||||||
*/
|
|
||||||
// Profil
|
|
||||||
// Sigaction
|
|
||||||
// Sigprocmask
|
|
||||||
// Getlogin
|
|
||||||
// Sigpending
|
|
||||||
// Sigaltstack
|
|
||||||
// Reboot
|
|
||||||
// Execve
|
|
||||||
// Vfork
|
|
||||||
// Sbrk
|
|
||||||
// Sstk
|
|
||||||
// Ovadvise
|
|
||||||
// Mincore
|
|
||||||
// Setitimer
|
|
||||||
// Swapon
|
|
||||||
// Select
|
|
||||||
// Sigsuspend
|
|
||||||
// Readv
|
|
||||||
// Writev
|
|
||||||
// Nfssvc
|
|
||||||
// Getfh
|
|
||||||
// Quotactl
|
|
||||||
// Mount
|
|
||||||
// Csops
|
|
||||||
// Waitid
|
|
||||||
// Add_profil
|
|
||||||
// Kdebug_trace
|
|
||||||
// Sigreturn
|
|
||||||
// Atsocket
|
|
||||||
// Kqueue_from_portset_np
|
|
||||||
// Kqueue_portset
|
|
||||||
// Getattrlist
|
|
||||||
// Setattrlist
|
|
||||||
// Getdirentriesattr
|
|
||||||
// Searchfs
|
|
||||||
// Delete
|
|
||||||
// Copyfile
|
|
||||||
// Watchevent
|
|
||||||
// Waitevent
|
|
||||||
// Modwatch
|
|
||||||
// Getxattr
|
|
||||||
// Fgetxattr
|
|
||||||
// Setxattr
|
|
||||||
// Fsetxattr
|
|
||||||
// Removexattr
|
|
||||||
// Fremovexattr
|
|
||||||
// Listxattr
|
|
||||||
// Flistxattr
|
|
||||||
// Fsctl
|
|
||||||
// Initgroups
|
|
||||||
// Posix_spawn
|
|
||||||
// Nfsclnt
|
|
||||||
// Fhopen
|
|
||||||
// Minherit
|
|
||||||
// Semsys
|
|
||||||
// Msgsys
|
|
||||||
// Shmsys
|
|
||||||
// Semctl
|
|
||||||
// Semget
|
|
||||||
// Semop
|
|
||||||
// Msgctl
|
|
||||||
// Msgget
|
|
||||||
// Msgsnd
|
|
||||||
// Msgrcv
|
|
||||||
// Shmat
|
|
||||||
// Shmctl
|
|
||||||
// Shmdt
|
|
||||||
// Shmget
|
|
||||||
// Shm_open
|
|
||||||
// Shm_unlink
|
|
||||||
// Sem_open
|
|
||||||
// Sem_close
|
|
||||||
// Sem_unlink
|
|
||||||
// Sem_wait
|
|
||||||
// Sem_trywait
|
|
||||||
// Sem_post
|
|
||||||
// Sem_getvalue
|
|
||||||
// Sem_init
|
|
||||||
// Sem_destroy
|
|
||||||
// Open_extended
|
|
||||||
// Umask_extended
|
|
||||||
// Stat_extended
|
|
||||||
// Lstat_extended
|
|
||||||
// Fstat_extended
|
|
||||||
// Chmod_extended
|
|
||||||
// Fchmod_extended
|
|
||||||
// Access_extended
|
|
||||||
// Settid
|
|
||||||
// Gettid
|
|
||||||
// Setsgroups
|
|
||||||
// Getsgroups
|
|
||||||
// Setwgroups
|
|
||||||
// Getwgroups
|
|
||||||
// Mkfifo_extended
|
|
||||||
// Mkdir_extended
|
|
||||||
// Identitysvc
|
|
||||||
// Shared_region_check_np
|
|
||||||
// Shared_region_map_np
|
|
||||||
// __pthread_mutex_destroy
|
|
||||||
// __pthread_mutex_init
|
|
||||||
// __pthread_mutex_lock
|
|
||||||
// __pthread_mutex_trylock
|
|
||||||
// __pthread_mutex_unlock
|
|
||||||
// __pthread_cond_init
|
|
||||||
// __pthread_cond_destroy
|
|
||||||
// __pthread_cond_broadcast
|
|
||||||
// __pthread_cond_signal
|
|
||||||
// Setsid_with_pid
|
|
||||||
// __pthread_cond_timedwait
|
|
||||||
// Aio_fsync
|
|
||||||
// Aio_return
|
|
||||||
// Aio_suspend
|
|
||||||
// Aio_cancel
|
|
||||||
// Aio_error
|
|
||||||
// Aio_read
|
|
||||||
// Aio_write
|
|
||||||
// Lio_listio
|
|
||||||
// __pthread_cond_wait
|
|
||||||
// Iopolicysys
|
|
||||||
// __pthread_kill
|
|
||||||
// __pthread_sigmask
|
|
||||||
// __sigwait
|
|
||||||
// __disable_threadsignal
|
|
||||||
// __pthread_markcancel
|
|
||||||
// __pthread_canceled
|
|
||||||
// __semwait_signal
|
|
||||||
// Proc_info
|
|
||||||
// Stat64_extended
|
|
||||||
// Lstat64_extended
|
|
||||||
// Fstat64_extended
|
|
||||||
// __pthread_chdir
|
|
||||||
// __pthread_fchdir
|
|
||||||
// Audit
|
|
||||||
// Auditon
|
|
||||||
// Getauid
|
|
||||||
// Setauid
|
|
||||||
// Getaudit
|
|
||||||
// Setaudit
|
|
||||||
// Getaudit_addr
|
|
||||||
// Setaudit_addr
|
|
||||||
// Auditctl
|
|
||||||
// Bsdthread_create
|
|
||||||
// Bsdthread_terminate
|
|
||||||
// Stack_snapshot
|
|
||||||
// Bsdthread_register
|
|
||||||
// Workq_open
|
|
||||||
// Workq_ops
|
|
||||||
// __mac_execve
|
|
||||||
// __mac_syscall
|
|
||||||
// __mac_get_file
|
|
||||||
// __mac_set_file
|
|
||||||
// __mac_get_link
|
|
||||||
// __mac_set_link
|
|
||||||
// __mac_get_proc
|
|
||||||
// __mac_set_proc
|
|
||||||
// __mac_get_fd
|
|
||||||
// __mac_set_fd
|
|
||||||
// __mac_get_pid
|
|
||||||
// __mac_get_lcid
|
|
||||||
// __mac_get_lctx
|
|
||||||
// __mac_set_lctx
|
|
||||||
// Setlcid
|
|
||||||
// Read_nocancel
|
|
||||||
// Write_nocancel
|
|
||||||
// Open_nocancel
|
|
||||||
// Close_nocancel
|
|
||||||
// Wait4_nocancel
|
|
||||||
// Recvmsg_nocancel
|
|
||||||
// Sendmsg_nocancel
|
|
||||||
// Recvfrom_nocancel
|
|
||||||
// Accept_nocancel
|
|
||||||
// Fcntl_nocancel
|
|
||||||
// Select_nocancel
|
|
||||||
// Fsync_nocancel
|
|
||||||
// Connect_nocancel
|
|
||||||
// Sigsuspend_nocancel
|
|
||||||
// Readv_nocancel
|
|
||||||
// Writev_nocancel
|
|
||||||
// Sendto_nocancel
|
|
||||||
// Pread_nocancel
|
|
||||||
// Pwrite_nocancel
|
|
||||||
// Waitid_nocancel
|
|
||||||
// Msgsnd_nocancel
|
|
||||||
// Msgrcv_nocancel
|
|
||||||
// Sem_wait_nocancel
|
|
||||||
// Aio_suspend_nocancel
|
|
||||||
// __sigwait_nocancel
|
|
||||||
// __semwait_signal_nocancel
|
|
||||||
// __mac_mount
|
|
||||||
// __mac_get_mount
|
|
||||||
// __mac_getfsstat
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user