Update vendoring

This commit is contained in:
KemoNine 2020-09-20 20:00:07 -04:00
parent 0c9bfd6a7c
commit 35e0032826
89 changed files with 4841 additions and 8349 deletions

16
go.mod
View File

@ -4,20 +4,16 @@ go 1.15
require ( require (
git.sungo.io/sungo/argon v0.0.0-20200904233623-18a98e1a4706 git.sungo.io/sungo/argon v0.0.0-20200904233623-18a98e1a4706
github.com/d2r2/go-bh1750 v0.0.0-20181222061755-1195122364ab // indirect
github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc // indirect
github.com/d2r2/go-logger v0.0.0-20181221090742-9998a510495e // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dietsche/rfsnotify v0.0.0-20200716145600-b37be6e4177f github.com/dietsche/rfsnotify v0.0.0-20200716145600-b37be6e4177f
github.com/eiannone/keyboard v0.0.0-20200508000154-caf4b762e807 github.com/eiannone/keyboard v0.0.0-20200508000154-caf4b762e807
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gdamore/tcell v1.4.0 github.com/gdamore/tcell v1.4.0
github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e
github.com/knadh/koanf v0.12.0 github.com/knadh/koanf v0.13.0
github.com/mackerelio/go-osstat v0.1.0 // indirect github.com/mitchellh/mapstructure v1.3.3 // indirect
github.com/rivo/tview v0.0.0-20200818120338-53d50e499bf9 github.com/pelletier/go-toml v1.8.1 // indirect
github.com/rivo/tview v0.0.0-20200915114512-42866ecf6ca6
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/warthog618/gpiod v0.5.0 // indirect golang.org/x/sys v0.0.0-20200918174421-af09f7315aff // indirect
golang.org/x/text v0.3.3 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect gopkg.in/fsnotify.v1 v1.4.7 // indirect
periph.io/x/periph v3.6.4+incompatible // indirect
) )

31
go.sum
View File

@ -1,8 +1,7 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
git.sungo.io/sungo/argon v0.0.0-20200829034015-23dc0c16f626 h1:HtFpcv/yMQmnYSjzYPgf2KaZn0QnAmYP+ba3fCuJMdY=
git.sungo.io/sungo/argon v0.0.0-20200829034015-23dc0c16f626/go.mod h1:GjGWfnGGw1KtipqUyjHDk9mGELjKm/pd/dwAApVBiJs=
git.sungo.io/sungo/argon v0.0.0-20200904233623-18a98e1a4706 h1:gD/4qfTLeuaG9/MqcQYzoVutiADl6JtYL05PcPfETwc= git.sungo.io/sungo/argon v0.0.0-20200904233623-18a98e1a4706 h1:gD/4qfTLeuaG9/MqcQYzoVutiADl6JtYL05PcPfETwc=
git.sungo.io/sungo/argon v0.0.0-20200904233623-18a98e1a4706/go.mod h1:3XJJhLC7vO4Yk96G/LEiiwBDXAEdj2lVB/oueweUShY= git.sungo.io/sungo/argon v0.0.0-20200904233623-18a98e1a4706/go.mod h1:3XJJhLC7vO4Yk96G/LEiiwBDXAEdj2lVB/oueweUShY=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@ -21,8 +20,6 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/d2r2/go-bh1750 v0.0.0-20181222061755-1195122364ab h1:8zeQTn3owfeyIA5KIhtvcj9wlMStdFaxbYwPkWhGVgo=
github.com/d2r2/go-bh1750 v0.0.0-20181222061755-1195122364ab/go.mod h1:3atw7ac57A1fKlJIGeLBaeXdh80Revqk6uVl7bZyH10=
github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc h1:HLRSIWzUGMLCq4ldt0W1GLs3nnAxa5EGoP+9qHgh6j0= github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc h1:HLRSIWzUGMLCq4ldt0W1GLs3nnAxa5EGoP+9qHgh6j0=
github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc/go.mod h1:AwxDPnsgIpy47jbGXZHA9Rv7pDkOJvQbezPuK1Y+nNk= github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc/go.mod h1:AwxDPnsgIpy47jbGXZHA9Rv7pDkOJvQbezPuK1Y+nNk=
github.com/d2r2/go-logger v0.0.0-20181221090742-9998a510495e h1:ZG3JBA6rPRl0xxQ+nNSfO7tor8w+CNCTs05DNJQYbLM= github.com/d2r2/go-logger v0.0.0-20181221090742-9998a510495e h1:ZG3JBA6rPRl0xxQ+nNSfO7tor8w+CNCTs05DNJQYbLM=
@ -70,8 +67,10 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf
github.com/grpc-ecosystem/grpc-gateway v1.11.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.11.2/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e h1:/6/OurM62Ddm8CR8PveE0a+ql2mL+ycAhOwd563kpdg= github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e h1:/6/OurM62Ddm8CR8PveE0a+ql2mL+ycAhOwd563kpdg=
github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e/go.mod h1:TQrLAmkOSnZ4g1eFORtCfTEbFuVZD0Zm55vdnrilBaw= github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e/go.mod h1:TQrLAmkOSnZ4g1eFORtCfTEbFuVZD0Zm55vdnrilBaw=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@ -82,16 +81,18 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/knadh/koanf v0.12.0 h1:xQo0Y43CbzOix0tTeE+plIcfs1pTuaUI1/SsvDl2ROI= github.com/knadh/koanf v0.12.0 h1:xQo0Y43CbzOix0tTeE+plIcfs1pTuaUI1/SsvDl2ROI=
github.com/knadh/koanf v0.12.0/go.mod h1:31bzRSM7vS5Vm9LNLo7B2Re1zhLOZT6EQKeodixBikE= github.com/knadh/koanf v0.12.0/go.mod h1:31bzRSM7vS5Vm9LNLo7B2Re1zhLOZT6EQKeodixBikE=
github.com/knadh/koanf v0.13.0 h1:OEjNdmrP/5oAhJkNwTtarioqOC4xe6WxRK8Q5ffW8WU=
github.com/knadh/koanf v0.13.0/go.mod h1:7XDF7OJIqSQLUZnaXkjb1HB3CgMEYHyrzmgT8A6xAaE=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s=
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mackerelio/go-osstat v0.1.0 h1:e57QHeHob8kKJ5FhcXGdzx5O6Ktuc5RHMDIkeqhgkFA=
github.com/mackerelio/go-osstat v0.1.0/go.mod h1:1K3NeYLhMHPvzUu+ePYXtoB58wkaRpxZsGClZBJyIFw=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
@ -103,6 +104,8 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4= github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4=
github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8=
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
@ -112,9 +115,11 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI= github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI=
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
github.com/pilebones/go-udev v0.0.0-20180820235104-043677e09b13/go.mod h1:MXAPLpvZeTqLpU1eO6kFXzU0uBMooSGc1MPXAcBoy1M= github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM=
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
@ -129,6 +134,8 @@ github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa
github.com/rhnvrm/simples3 v0.5.0/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= github.com/rhnvrm/simples3 v0.5.0/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
github.com/rivo/tview v0.0.0-20200818120338-53d50e499bf9 h1:csnip7QsoiE2Ee0RkELN1YggwejK2EFfcjU6tXOT0Q8= github.com/rivo/tview v0.0.0-20200818120338-53d50e499bf9 h1:csnip7QsoiE2Ee0RkELN1YggwejK2EFfcjU6tXOT0Q8=
github.com/rivo/tview v0.0.0-20200818120338-53d50e499bf9/go.mod h1:xV4Aw4WIX8cmhg71U7MUHBdpIQ7zSEXdRruGHLaEAOc= github.com/rivo/tview v0.0.0-20200818120338-53d50e499bf9/go.mod h1:xV4Aw4WIX8cmhg71U7MUHBdpIQ7zSEXdRruGHLaEAOc=
github.com/rivo/tview v0.0.0-20200915114512-42866ecf6ca6 h1:LhmHZTzElCYlOXEWXWOQXy/vgjPsdiDb7LzHV8mTKvI=
github.com/rivo/tview v0.0.0-20200915114512-42866ecf6ca6/go.mod h1:xV4Aw4WIX8cmhg71U7MUHBdpIQ7zSEXdRruGHLaEAOc=
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
@ -150,12 +157,12 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/warthog618/config v0.4.1/go.mod h1:IzcIkVay6dCubN3WBAJzPuqHyE1fTPxICvKTQ/2JA9g= github.com/warthog618/config v0.4.1/go.mod h1:IzcIkVay6dCubN3WBAJzPuqHyE1fTPxICvKTQ/2JA9g=
github.com/warthog618/gpio v1.0.0/go.mod h1:3yuGbOkcAcs8/pRFEnCnN7Qt2S+TkISbFXM+5gliAZM= github.com/warthog618/gpio v1.0.0/go.mod h1:3yuGbOkcAcs8/pRFEnCnN7Qt2S+TkISbFXM+5gliAZM=
github.com/warthog618/gpiod v0.5.0/go.mod h1:RDkm3Ur6o0Wam7cSkyLuVMghs1CHlfdlnUfRMRyDc+w=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
@ -188,7 +195,6 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190410235845-0ad05ae3009d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -200,9 +206,13 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200817155316-9781c653f443 h1:X18bCaipMcoJGm27Nv7zr4XYPKGUy92GtqboKC2Hxaw= golang.org/x/sys v0.0.0-20200817155316-9781c653f443 h1:X18bCaipMcoJGm27Nv7zr4XYPKGUy92GtqboKC2Hxaw=
golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff h1:1CPUrky56AcgSpxz/KfgzQWzfG09u5YOL8MvPYBlrL8=
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@ -222,6 +232,7 @@ google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRn
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
@ -230,8 +241,8 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
periph.io/x/periph v3.6.4+incompatible/go.mod h1:EWr+FCIU2dBWz5/wSWeiIUJTriYv9v2j2ENBmgYyy7Y=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=

View File

@ -531,8 +531,8 @@ Writing Providers and Parsers are easy. See the bundled implementations in the `
| parsers/json | `json.Parser()` | Parses JSON bytes into a nested map | | parsers/json | `json.Parser()` | Parses JSON bytes into a nested map |
| parsers/yaml | `yaml.Parser()` | Parses YAML bytes into a nested map | | parsers/yaml | `yaml.Parser()` | Parses YAML bytes into a nested map |
| parsers/toml | `toml.Parser()` | Parses TOML bytes into a nested map | | parsers/toml | `toml.Parser()` | Parses TOML bytes into a nested map |
| parsers/dotenv | `dotenv.Parser()` | Parses DotEnv bytes into a flat map |
| parsers/hcl | `hcl.Parser(flattenSlices bool)` | Parses Hashicorp HCL bytes into a nested map. `flattenSlices` is recommended to be set to true. [Read more](https://github.com/hashicorp/hcl/issues/162). | | parsers/hcl | `hcl.Parser(flattenSlices bool)` | Parses Hashicorp HCL bytes into a nested map. `flattenSlices` is recommended to be set to true. [Read more](https://github.com/hashicorp/hcl/issues/162). |
### Instance functions ### Instance functions
| Method | Description | | Method | Description |

View File

@ -6,6 +6,7 @@ require (
github.com/fatih/structs v1.1.0 github.com/fatih/structs v1.1.0
github.com/fsnotify/fsnotify v1.4.9 github.com/fsnotify/fsnotify v1.4.9
github.com/hashicorp/hcl v1.0.0 github.com/hashicorp/hcl v1.0.0
github.com/joho/godotenv v1.3.0 // indirect
github.com/mitchellh/mapstructure v1.2.2 github.com/mitchellh/mapstructure v1.2.2
github.com/pelletier/go-toml v1.7.0 github.com/pelletier/go-toml v1.7.0
github.com/rhnvrm/simples3 v0.5.0 github.com/rhnvrm/simples3 v0.5.0

View File

@ -9,6 +9,8 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4= github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4=
github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI= github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI=

View File

@ -198,7 +198,7 @@ func (ko *Koanf) MergeAt(in *Koanf, path string) {
// Marshal takes a Parser implementation and marshals the config map into bytes, // Marshal takes a Parser implementation and marshals the config map into bytes,
// for example, to TOML or JSON bytes. // for example, to TOML or JSON bytes.
func (ko *Koanf) Marshal(p Parser) ([]byte, error) { func (ko *Koanf) Marshal(p Parser) ([]byte, error) {
return p.Marshal(ko.All()) return p.Marshal(ko.Raw())
} }
// Unmarshal unmarshals a given key path into the given struct using // Unmarshal unmarshals a given key path into the given struct using

View File

@ -30,5 +30,5 @@ func (p *TOML) Marshal(o map[string]interface{}) ([]byte, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return []byte(out.String()), nil return out.Marshal()
} }

View File

@ -1,7 +1,7 @@
language: go language: go
go: go:
- "1.11.x" - "1.14.x"
- tip - tip
script: script:

View File

@ -1,3 +1,24 @@
## 1.3.3
* Decoding maps from maps creates a settable value for decode hooks [GH-203]
## 1.3.2
* Decode into interface type with a struct value is supported [GH-187]
## 1.3.1
* Squash should only squash embedded structs. [GH-194]
## 1.3.0
* Added `",omitempty"` support. This will ignore zero values in the source
structure when encoding. [GH-145]
## 1.2.3
* Fix duplicate entries in Keys list with pointer values. [GH-185]
## 1.2.2 ## 1.2.2
* Do not add unsettable (unexported) values to the unused metadata key * Do not add unsettable (unexported) values to the unused metadata key

View File

@ -100,6 +100,47 @@
// "address": "123 Maple St.", // "address": "123 Maple St.",
// } // }
// //
// Omit Empty Values
//
// When decoding from a struct to any other value, you may use the
// ",omitempty" suffix on your tag to omit that value if it equates to
// the zero value. The zero value of all types is specified in the Go
// specification.
//
// For example, the zero type of a numeric type is zero ("0"). If the struct
// field value is zero and a numeric type, the field is empty, and it won't
// be encoded into the destination type.
//
// type Source {
// Age int `mapstructure:",omitempty"`
// }
//
// Unexported fields
//
// Since unexported (private) struct fields cannot be set outside the package
// where they are defined, the decoder will simply skip them.
//
// For this output type definition:
//
// type Exported struct {
// private string // this unexported field will be skipped
// Public string
// }
//
// Using this map as input:
//
// map[string]interface{}{
// "private": "I will be ignored",
// "Public": "I made it through!",
// }
//
// The following struct will be decoded:
//
// type Exported struct {
// private: "" // field is left with an empty string (zero value)
// Public: "I made it through!"
// }
//
// Other Configuration // Other Configuration
// //
// mapstructure is highly configurable. See the DecoderConfig struct // mapstructure is highly configurable. See the DecoderConfig struct
@ -378,6 +419,7 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e
var err error var err error
outputKind := getKind(outVal) outputKind := getKind(outVal)
addMetaKey := true
switch outputKind { switch outputKind {
case reflect.Bool: case reflect.Bool:
err = d.decodeBool(name, input, outVal) err = d.decodeBool(name, input, outVal)
@ -396,7 +438,7 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e
case reflect.Map: case reflect.Map:
err = d.decodeMap(name, input, outVal) err = d.decodeMap(name, input, outVal)
case reflect.Ptr: case reflect.Ptr:
err = d.decodePtr(name, input, outVal) addMetaKey, err = d.decodePtr(name, input, outVal)
case reflect.Slice: case reflect.Slice:
err = d.decodeSlice(name, input, outVal) err = d.decodeSlice(name, input, outVal)
case reflect.Array: case reflect.Array:
@ -410,7 +452,7 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e
// If we reached here, then we successfully decoded SOMETHING, so // If we reached here, then we successfully decoded SOMETHING, so
// mark the key as used if we're tracking metainput. // mark the key as used if we're tracking metainput.
if d.config.Metadata != nil && name != "" { if addMetaKey && d.config.Metadata != nil && name != "" {
d.config.Metadata.Keys = append(d.config.Metadata.Keys, name) d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
} }
@ -421,7 +463,34 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e
// value to "data" of that type. // value to "data" of that type.
func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error {
if val.IsValid() && val.Elem().IsValid() { if val.IsValid() && val.Elem().IsValid() {
return d.decode(name, data, val.Elem()) elem := val.Elem()
// If we can't address this element, then its not writable. Instead,
// we make a copy of the value (which is a pointer and therefore
// writable), decode into that, and replace the whole value.
copied := false
if !elem.CanAddr() {
copied = true
// Make *T
copy := reflect.New(elem.Type())
// *T = elem
copy.Elem().Set(elem)
// Set elem so we decode into it
elem = copy
}
// Decode. If we have an error then return. We also return right
// away if we're not a copy because that means we decoded directly.
if err := d.decode(name, data, elem); err != nil || !copied {
return err
}
// If we're a copy, we need to set te final result
val.Set(elem.Elem())
return nil
} }
dataVal := reflect.ValueOf(data) dataVal := reflect.ValueOf(data)
@ -798,30 +867,31 @@ func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val re
} }
tagValue := f.Tag.Get(d.config.TagName) tagValue := f.Tag.Get(d.config.TagName)
tagParts := strings.Split(tagValue, ",")
// Determine the name of the key in the map
keyName := f.Name keyName := f.Name
if tagParts[0] != "" {
if tagParts[0] == "-" {
continue
}
keyName = tagParts[0]
}
// If Squash is set in the config, we squash the field down. // If Squash is set in the config, we squash the field down.
squash := d.config.Squash && v.Kind() == reflect.Struct squash := d.config.Squash && v.Kind() == reflect.Struct && f.Anonymous
// If "squash" is specified in the tag, we squash the field down. // Determine the name of the key in the map
if !squash { if index := strings.Index(tagValue, ","); index != -1 {
for _, tag := range tagParts[1:] { if tagValue[:index] == "-" {
if tag == "squash" { continue
squash = true
break
}
} }
// If "omitempty" is specified in the tag, it ignores empty values.
if strings.Index(tagValue[index+1:], "omitempty") != -1 && isEmptyValue(v) {
continue
}
// If "squash" is specified in the tag, we squash the field down.
squash = !squash && strings.Index(tagValue[index+1:], "squash") != -1
if squash && v.Kind() != reflect.Struct { if squash && v.Kind() != reflect.Struct {
return fmt.Errorf("cannot squash non-struct type '%s'", v.Type()) return fmt.Errorf("cannot squash non-struct type '%s'", v.Type())
} }
keyName = tagValue[:index]
} else if len(tagValue) > 0 {
if tagValue == "-" {
continue
}
keyName = tagValue
} }
switch v.Kind() { switch v.Kind() {
@ -836,11 +906,22 @@ func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val re
mType := reflect.MapOf(vKeyType, vElemType) mType := reflect.MapOf(vKeyType, vElemType)
vMap := reflect.MakeMap(mType) vMap := reflect.MakeMap(mType)
err := d.decode(keyName, x.Interface(), vMap) // Creating a pointer to a map so that other methods can completely
// overwrite the map if need be (looking at you decodeMapFromMap). The
// indirection allows the underlying map to be settable (CanSet() == true)
// where as reflect.MakeMap returns an unsettable map.
addrVal := reflect.New(vMap.Type())
reflect.Indirect(addrVal).Set(vMap)
err := d.decode(keyName, x.Interface(), reflect.Indirect(addrVal))
if err != nil { if err != nil {
return err return err
} }
// the underlying map may have been completely overwritten so pull
// it indirectly out of the enclosing value.
vMap = reflect.Indirect(addrVal)
if squash { if squash {
for _, k := range vMap.MapKeys() { for _, k := range vMap.MapKeys() {
valMap.SetMapIndex(k, vMap.MapIndex(k)) valMap.SetMapIndex(k, vMap.MapIndex(k))
@ -861,7 +942,7 @@ func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val re
return nil return nil
} }
func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) (bool, error) {
// If the input data is nil, then we want to just set the output // If the input data is nil, then we want to just set the output
// pointer to be nil as well. // pointer to be nil as well.
isNil := data == nil isNil := data == nil
@ -882,7 +963,7 @@ func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) er
val.Set(nilValue) val.Set(nilValue)
} }
return nil return true, nil
} }
// Create an element of the concrete (non pointer) type and decode // Create an element of the concrete (non pointer) type and decode
@ -896,16 +977,16 @@ func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) er
} }
if err := d.decode(name, data, reflect.Indirect(realVal)); err != nil { if err := d.decode(name, data, reflect.Indirect(realVal)); err != nil {
return err return false, err
} }
val.Set(realVal) val.Set(realVal)
} else { } else {
if err := d.decode(name, data, reflect.Indirect(val)); err != nil { if err := d.decode(name, data, reflect.Indirect(val)); err != nil {
return err return false, err
} }
} }
return nil return false, nil
} }
func (d *Decoder) decodeFunc(name string, data interface{}, val reflect.Value) error { func (d *Decoder) decodeFunc(name string, data interface{}, val reflect.Value) error {
@ -1084,13 +1165,23 @@ func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value)
// Not the most efficient way to do this but we can optimize later if // Not the most efficient way to do this but we can optimize later if
// we want to. To convert from struct to struct we go to map first // we want to. To convert from struct to struct we go to map first
// as an intermediary. // as an intermediary.
m := make(map[string]interface{})
mval := reflect.Indirect(reflect.ValueOf(&m)) // Make a new map to hold our result
if err := d.decodeMapFromStruct(name, dataVal, mval, mval); err != nil { mapType := reflect.TypeOf((map[string]interface{})(nil))
mval := reflect.MakeMap(mapType)
// Creating a pointer to a map so that other methods can completely
// overwrite the map if need be (looking at you decodeMapFromMap). The
// indirection allows the underlying map to be settable (CanSet() == true)
// where as reflect.MakeMap returns an unsettable map.
addrVal := reflect.New(mval.Type())
reflect.Indirect(addrVal).Set(mval)
if err := d.decodeMapFromStruct(name, dataVal, reflect.Indirect(addrVal), mval); err != nil {
return err return err
} }
result := d.decodeStructFromMap(name, mval, val) result := d.decodeStructFromMap(name, reflect.Indirect(addrVal), val)
return result return result
default: default:
@ -1144,7 +1235,7 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e
fieldKind := fieldType.Type.Kind() fieldKind := fieldType.Type.Kind()
// If "squash" is specified in the tag, we squash the field down. // If "squash" is specified in the tag, we squash the field down.
squash := d.config.Squash && fieldKind == reflect.Struct squash := d.config.Squash && fieldKind == reflect.Struct && fieldType.Anonymous
remain := false remain := false
// We always parse the tags cause we're looking for other tags too // We always parse the tags cause we're looking for other tags too
@ -1172,9 +1263,8 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e
} }
// Build our field // Build our field
fieldCurrent := field{fieldType, structVal.Field(i)}
if remain { if remain {
remainField = &fieldCurrent remainField = &field{fieldType, structVal.Field(i)}
} else { } else {
// Normal struct field, store it away // Normal struct field, store it away
fields = append(fields, field{fieldType, structVal.Field(i)}) fields = append(fields, field{fieldType, structVal.Field(i)})
@ -1293,6 +1383,24 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e
return nil return nil
} }
func isEmptyValue(v reflect.Value) bool {
switch getKind(v) {
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 getKind(val reflect.Value) reflect.Kind { func getKind(val reflect.Value) reflect.Kind {
kind := val.Kind() kind := val.Kind()

View File

@ -3,7 +3,7 @@
Go library for the [TOML](https://github.com/mojombo/toml) format. Go library for the [TOML](https://github.com/mojombo/toml) format.
This library supports TOML version This library supports TOML version
[v0.5.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.5.0.md) [v1.0.0-rc.1](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v1.0.0-rc.1.md)
[![GoDoc](https://godoc.org/github.com/pelletier/go-toml?status.svg)](http://godoc.org/github.com/pelletier/go-toml) [![GoDoc](https://godoc.org/github.com/pelletier/go-toml?status.svg)](http://godoc.org/github.com/pelletier/go-toml)
[![license](https://img.shields.io/github/license/pelletier/go-toml.svg)](https://github.com/pelletier/go-toml/blob/master/LICENSE) [![license](https://img.shields.io/github/license/pelletier/go-toml.svg)](https://github.com/pelletier/go-toml/blob/master/LICENSE)
@ -18,7 +18,7 @@ Go-toml provides the following features for using data parsed from TOML document
* Load TOML documents from files and string data * Load TOML documents from files and string data
* Easily navigate TOML structure using Tree * Easily navigate TOML structure using Tree
* Mashaling and unmarshaling to and from data structures * Marshaling and unmarshaling to and from data structures
* Line & column position data for all parsed elements * Line & column position data for all parsed elements
* [Query support similar to JSON-Path](query/) * [Query support similar to JSON-Path](query/)
* Syntax errors contain line and column numbers * Syntax errors contain line and column numbers
@ -74,7 +74,7 @@ Or use a query:
q, _ := query.Compile("$..[user,password]") q, _ := query.Compile("$..[user,password]")
results := q.Execute(config) results := q.Execute(config)
for ii, item := range results.Values() { for ii, item := range results.Values() {
fmt.Println("Query result %d: %v", ii, item) fmt.Printf("Query result %d: %v\n", ii, item)
} }
``` ```
@ -87,7 +87,7 @@ The documentation and additional examples are available at
Go-toml provides two handy command line tools: Go-toml provides two handy command line tools:
* `tomll`: Reads TOML files and lint them. * `tomll`: Reads TOML files and lints them.
``` ```
go install github.com/pelletier/go-toml/cmd/tomll go install github.com/pelletier/go-toml/cmd/tomll
@ -99,9 +99,9 @@ Go-toml provides two handy command line tools:
go install github.com/pelletier/go-toml/cmd/tomljson go install github.com/pelletier/go-toml/cmd/tomljson
tomljson --help tomljson --help
``` ```
* `jsontoml`: Reads a JSON file and outputs a TOML representation. * `jsontoml`: Reads a JSON file and outputs a TOML representation.
``` ```
go install github.com/pelletier/go-toml/cmd/jsontoml go install github.com/pelletier/go-toml/cmd/jsontoml
jsontoml --help jsontoml --help

View File

@ -13,9 +13,9 @@ stages:
vmImage: ubuntu-latest vmImage: ubuntu-latest
steps: steps:
- task: GoTool@0 - task: GoTool@0
displayName: "Install Go 1.14" displayName: "Install Go 1.15"
inputs: inputs:
version: "1.14" version: "1.15"
- script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/" - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
- script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml - script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml
- script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml - script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml
@ -36,9 +36,9 @@ stages:
vmImage: ubuntu-latest vmImage: ubuntu-latest
steps: steps:
- task: GoTool@0 - task: GoTool@0
displayName: "Install Go 1.14" displayName: "Install Go 1.15"
inputs: inputs:
version: "1.14" version: "1.15"
- task: Go@0 - task: Go@0
displayName: "go fmt ./..." displayName: "go fmt ./..."
inputs: inputs:
@ -51,9 +51,9 @@ stages:
vmImage: ubuntu-latest vmImage: ubuntu-latest
steps: steps:
- task: GoTool@0 - task: GoTool@0
displayName: "Install Go 1.14" displayName: "Install Go 1.15"
inputs: inputs:
version: "1.14" version: "1.15"
- task: Go@0 - task: Go@0
displayName: "Generate coverage" displayName: "Generate coverage"
inputs: inputs:
@ -71,9 +71,9 @@ stages:
vmImage: ubuntu-latest vmImage: ubuntu-latest
steps: steps:
- task: GoTool@0 - task: GoTool@0
displayName: "Install Go 1.14" displayName: "Install Go 1.15"
inputs: inputs:
version: "1.14" version: "1.15"
- script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/" - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
- task: Bash@3 - task: Bash@3
inputs: inputs:
@ -86,9 +86,9 @@ stages:
vmImage: ubuntu-latest vmImage: ubuntu-latest
steps: steps:
- task: GoTool@0 - task: GoTool@0
displayName: "Install Go 1.14" displayName: "Install Go 1.15"
inputs: inputs:
version: "1.14" version: "1.15"
- script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/" - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/"
- script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml - script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml
- script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml - script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml
@ -102,6 +102,15 @@ stages:
displayName: "unit tests" displayName: "unit tests"
strategy: strategy:
matrix: matrix:
linux 1.15:
goVersion: '1.15'
imageName: 'ubuntu-latest'
mac 1.15:
goVersion: '1.15'
imageName: 'macOS-latest'
windows 1.15:
goVersion: '1.15'
imageName: 'windows-latest'
linux 1.14: linux 1.14:
goVersion: '1.14' goVersion: '1.14'
imageName: 'ubuntu-latest' imageName: 'ubuntu-latest'
@ -111,15 +120,6 @@ stages:
windows 1.14: windows 1.14:
goVersion: '1.14' goVersion: '1.14'
imageName: 'windows-latest' imageName: 'windows-latest'
linux 1.13:
goVersion: '1.13'
imageName: 'ubuntu-latest'
mac 1.13:
goVersion: '1.13'
imageName: 'macOS-latest'
windows 1.13:
goVersion: '1.13'
imageName: 'windows-latest'
pool: pool:
vmImage: $(imageName) vmImage: $(imageName)
steps: steps:
@ -155,7 +155,7 @@ stages:
- task: GoTool@0 - task: GoTool@0
displayName: "Install Go" displayName: "Install Go"
inputs: inputs:
version: 1.14 version: 1.15
- task: Bash@3 - task: Bash@3
inputs: inputs:
targetType: inline targetType: inline

View File

@ -1,164 +0,0 @@
{
"array": {
"key1": [
1,
2,
3
],
"key2": [
"red",
"yellow",
"green"
],
"key3": [
[
1,
2
],
[
3,
4,
5
]
],
"key4": [
[
1,
2
],
[
"a",
"b",
"c"
]
],
"key5": [
1,
2,
3
],
"key6": [
1,
2
]
},
"boolean": {
"False": false,
"True": true
},
"datetime": {
"key1": "1979-05-27T07:32:00Z",
"key2": "1979-05-27T00:32:00-07:00",
"key3": "1979-05-27T00:32:00.999999-07:00"
},
"float": {
"both": {
"key": 6.626e-34
},
"exponent": {
"key1": 5e+22,
"key2": 1000000,
"key3": -0.02
},
"fractional": {
"key1": 1,
"key2": 3.1415,
"key3": -0.01
},
"underscores": {
"key1": 9224617.445991227,
"key2": 1e+100
}
},
"fruit": [{
"name": "apple",
"physical": {
"color": "red",
"shape": "round"
},
"variety": [{
"name": "red delicious"
},
{
"name": "granny smith"
}
]
},
{
"name": "banana",
"variety": [{
"name": "plantain"
}]
}
],
"integer": {
"key1": 99,
"key2": 42,
"key3": 0,
"key4": -17,
"underscores": {
"key1": 1000,
"key2": 5349221,
"key3": 12345
}
},
"products": [{
"name": "Hammer",
"sku": 738594937
},
{},
{
"color": "gray",
"name": "Nail",
"sku": 284758393
}
],
"string": {
"basic": {
"basic": "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."
},
"literal": {
"multiline": {
"lines": "The first newline is\ntrimmed in raw strings.\n All other whitespace\n is preserved.\n",
"regex2": "I [dw]on't need \\d{2} apples"
},
"quoted": "Tom \"Dubs\" Preston-Werner",
"regex": "\u003c\\i\\c*\\s*\u003e",
"winpath": "C:\\Users\\nodejs\\templates",
"winpath2": "\\\\ServerX\\admin$\\system32\\"
},
"multiline": {
"continued": {
"key1": "The quick brown fox jumps over the lazy dog.",
"key2": "The quick brown fox jumps over the lazy dog.",
"key3": "The quick brown fox jumps over the lazy dog."
},
"key1": "One\nTwo",
"key2": "One\nTwo",
"key3": "One\nTwo"
}
},
"table": {
"inline": {
"name": {
"first": "Tom",
"last": "Preston-Werner"
},
"point": {
"x": 1,
"y": 2
}
},
"key": "value",
"subtable": {
"key": "another value"
}
},
"x": {
"y": {
"z": {
"w": {}
}
}
}
}

View File

@ -20,11 +20,15 @@ git clone ${reference_git} ${ref_tempdir} >/dev/null 2>/dev/null
pushd ${ref_tempdir} >/dev/null pushd ${ref_tempdir} >/dev/null
git checkout ${reference_ref} >/dev/null 2>/dev/null git checkout ${reference_ref} >/dev/null 2>/dev/null
go test -bench=. -benchmem | tee ${ref_benchmark} go test -bench=. -benchmem | tee ${ref_benchmark}
cd benchmark
go test -bench=. -benchmem | tee -a ${ref_benchmark}
popd >/dev/null popd >/dev/null
echo "" echo ""
echo "=== local" echo "=== local"
go test -bench=. -benchmem | tee ${local_benchmark} go test -bench=. -benchmem | tee ${local_benchmark}
cd benchmark
go test -bench=. -benchmem | tee -a ${local_benchmark}
echo "" echo ""
echo "=== diff" echo "=== diff"

View File

@ -1,244 +0,0 @@
################################################################################
## Comment
# Speak your mind with the hash symbol. They go from the symbol to the end of
# the line.
################################################################################
## Table
# Tables (also known as hash tables or dictionaries) are collections of
# key/value pairs. They appear in square brackets on a line by themselves.
[table]
key = "value" # Yeah, you can do this.
# Nested tables are denoted by table names with dots in them. Name your tables
# whatever crap you please, just don't use #, ., [ or ].
[table.subtable]
key = "another value"
# You don't need to specify all the super-tables if you don't want to. TOML
# knows how to do it for you.
# [x] you
# [x.y] don't
# [x.y.z] need these
[x.y.z.w] # for this to work
################################################################################
## Inline Table
# Inline tables provide a more compact syntax for expressing tables. They are
# especially useful for grouped data that can otherwise quickly become verbose.
# Inline tables are enclosed in curly braces `{` and `}`. No newlines are
# allowed between the curly braces unless they are valid within a value.
[table.inline]
name = { first = "Tom", last = "Preston-Werner" }
point = { x = 1, y = 2 }
################################################################################
## String
# There are four ways to express strings: basic, multi-line basic, literal, and
# multi-line literal. All strings must contain only valid UTF-8 characters.
[string.basic]
basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
[string.multiline]
# The following strings are byte-for-byte equivalent:
key1 = "One\nTwo"
key2 = """One\nTwo"""
key3 = """
One
Two"""
[string.multiline.continued]
# The following strings are byte-for-byte equivalent:
key1 = "The quick brown fox jumps over the lazy dog."
key2 = """
The quick brown \
fox jumps over \
the lazy dog."""
key3 = """\
The quick brown \
fox jumps over \
the lazy dog.\
"""
[string.literal]
# What you see is what you get.
winpath = 'C:\Users\nodejs\templates'
winpath2 = '\\ServerX\admin$\system32\'
quoted = 'Tom "Dubs" Preston-Werner'
regex = '<\i\c*\s*>'
[string.literal.multiline]
regex2 = '''I [dw]on't need \d{2} apples'''
lines = '''
The first newline is
trimmed in raw strings.
All other whitespace
is preserved.
'''
################################################################################
## Integer
# Integers are whole numbers. Positive numbers may be prefixed with a plus sign.
# Negative numbers are prefixed with a minus sign.
[integer]
key1 = +99
key2 = 42
key3 = 0
key4 = -17
[integer.underscores]
# For large numbers, you may use underscores to enhance readability. Each
# underscore must be surrounded by at least one digit.
key1 = 1_000
key2 = 5_349_221
key3 = 1_2_3_4_5 # valid but inadvisable
################################################################################
## Float
# A float consists of an integer part (which may be prefixed with a plus or
# minus sign) followed by a fractional part and/or an exponent part.
[float.fractional]
key1 = +1.0
key2 = 3.1415
key3 = -0.01
[float.exponent]
key1 = 5e+22
key2 = 1e6
key3 = -2E-2
[float.both]
key = 6.626e-34
[float.underscores]
key1 = 9_224_617.445_991_228_313
key2 = 1e1_00
################################################################################
## Boolean
# Booleans are just the tokens you're used to. Always lowercase.
[boolean]
True = true
False = false
################################################################################
## Datetime
# Datetimes are RFC 3339 dates.
[datetime]
key1 = 1979-05-27T07:32:00Z
key2 = 1979-05-27T00:32:00-07:00
key3 = 1979-05-27T00:32:00.999999-07:00
################################################################################
## Array
# Arrays are square brackets with other primitives inside. Whitespace is
# ignored. Elements are separated by commas. Data types may not be mixed.
[array]
key1 = [ 1, 2, 3 ]
key2 = [ "red", "yellow", "green" ]
key3 = [ [ 1, 2 ], [3, 4, 5] ]
#key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok
# Arrays can also be multiline. So in addition to ignoring whitespace, arrays
# also ignore newlines between the brackets. Terminating commas are ok before
# the closing bracket.
key5 = [
1, 2, 3
]
key6 = [
1,
2, # this is ok
]
################################################################################
## Array of Tables
# These can be expressed by using a table name in double brackets. Each table
# with the same double bracketed name will be an element in the array. The
# tables are inserted in the order encountered.
[[products]]
name = "Hammer"
sku = 738594937
[[products]]
[[products]]
name = "Nail"
sku = 284758393
color = "gray"
# You can create nested arrays of tables as well.
[[fruit]]
name = "apple"
[fruit.physical]
color = "red"
shape = "round"
[[fruit.variety]]
name = "red delicious"
[[fruit.variety]]
name = "granny smith"
[[fruit]]
name = "banana"
[[fruit.variety]]
name = "plantain"

View File

@ -1,121 +0,0 @@
---
array:
key1:
- 1
- 2
- 3
key2:
- red
- yellow
- green
key3:
- - 1
- 2
- - 3
- 4
- 5
key4:
- - 1
- 2
- - a
- b
- c
key5:
- 1
- 2
- 3
key6:
- 1
- 2
boolean:
'False': false
'True': true
datetime:
key1: '1979-05-27T07:32:00Z'
key2: '1979-05-27T00:32:00-07:00'
key3: '1979-05-27T00:32:00.999999-07:00'
float:
both:
key: 6.626e-34
exponent:
key1: 5.0e+22
key2: 1000000
key3: -0.02
fractional:
key1: 1
key2: 3.1415
key3: -0.01
underscores:
key1: 9224617.445991227
key2: 1.0e+100
fruit:
- name: apple
physical:
color: red
shape: round
variety:
- name: red delicious
- name: granny smith
- name: banana
variety:
- name: plantain
integer:
key1: 99
key2: 42
key3: 0
key4: -17
underscores:
key1: 1000
key2: 5349221
key3: 12345
products:
- name: Hammer
sku: 738594937
- {}
- color: gray
name: Nail
sku: 284758393
string:
basic:
basic: "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."
literal:
multiline:
lines: |
The first newline is
trimmed in raw strings.
All other whitespace
is preserved.
regex2: I [dw]on't need \d{2} apples
quoted: Tom "Dubs" Preston-Werner
regex: "<\\i\\c*\\s*>"
winpath: C:\Users\nodejs\templates
winpath2: "\\\\ServerX\\admin$\\system32\\"
multiline:
continued:
key1: The quick brown fox jumps over the lazy dog.
key2: The quick brown fox jumps over the lazy dog.
key3: The quick brown fox jumps over the lazy dog.
key1: |-
One
Two
key2: |-
One
Two
key3: |-
One
Two
table:
inline:
name:
first: Tom
last: Preston-Werner
point:
x: 1
y: 2
key: value
subtable:
key: another value
x:
y:
z:
w: {}

View File

@ -27,3 +27,4 @@ enabled = true
[clients] [clients]
data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
score = 4e-08 # to make sure leading zeroes in exponent parts of floats are supported

View File

@ -27,3 +27,4 @@ enabled = true
[clients] [clients]
data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
score = 4e-08 # to make sure leading zeroes in exponent parts of floats are supported

View File

@ -2,8 +2,4 @@ module github.com/pelletier/go-toml
go 1.12 go 1.12
require ( require github.com/davecgh/go-spew v1.1.1
github.com/BurntSushi/toml v0.3.1
github.com/davecgh/go-spew v1.1.1
gopkg.in/yaml.v2 v2.2.8
)

View File

@ -15,3 +15,5 @@ gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -5,7 +5,6 @@ package toml
import ( import (
"errors" "errors"
"fmt" "fmt"
"unicode"
) )
// Convert the bare key group string to an array. // Convert the bare key group string to an array.
@ -109,5 +108,5 @@ func parseKey(key string) ([]string, error) {
} }
func isValidBareChar(r rune) bool { func isValidBareChar(r rune) bool {
return isAlphanumeric(r) || r == '-' || unicode.IsNumber(r) return isAlphanumeric(r) || r == '-' || isDigit(r)
} }

View File

@ -26,7 +26,7 @@ type tomlLexer struct {
currentTokenStart int currentTokenStart int
currentTokenStop int currentTokenStop int
tokens []token tokens []token
depth int brackets []rune
line int line int
col int col int
endbufferLine int endbufferLine int
@ -123,6 +123,8 @@ func (l *tomlLexer) lexVoid() tomlLexStateFn {
for { for {
next := l.peek() next := l.peek()
switch next { switch next {
case '}': // after '{'
return l.lexRightCurlyBrace
case '[': case '[':
return l.lexTableKey return l.lexTableKey
case '#': case '#':
@ -140,10 +142,6 @@ func (l *tomlLexer) lexVoid() tomlLexStateFn {
l.skip() l.skip()
} }
if l.depth > 0 {
return l.lexRvalue
}
if isKeyStartChar(next) { if isKeyStartChar(next) {
return l.lexKey return l.lexKey
} }
@ -167,10 +165,8 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
case '=': case '=':
return l.lexEqual return l.lexEqual
case '[': case '[':
l.depth++
return l.lexLeftBracket return l.lexLeftBracket
case ']': case ']':
l.depth--
return l.lexRightBracket return l.lexRightBracket
case '{': case '{':
return l.lexLeftCurlyBrace return l.lexLeftCurlyBrace
@ -188,12 +184,10 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
fallthrough fallthrough
case '\n': case '\n':
l.skip() l.skip()
if l.depth == 0 { if len(l.brackets) > 0 && l.brackets[len(l.brackets)-1] == '[' {
return l.lexVoid return l.lexRvalue
} }
return l.lexRvalue return l.lexVoid
case '_':
return l.errorf("cannot start number with underscore")
} }
if l.follow("true") { if l.follow("true") {
@ -236,10 +230,6 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
return l.lexNumber return l.lexNumber
} }
if isAlphanumeric(next) {
return l.lexKey
}
return l.errorf("no value can start with %c", next) return l.errorf("no value can start with %c", next)
} }
@ -250,12 +240,17 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
func (l *tomlLexer) lexLeftCurlyBrace() tomlLexStateFn { func (l *tomlLexer) lexLeftCurlyBrace() tomlLexStateFn {
l.next() l.next()
l.emit(tokenLeftCurlyBrace) l.emit(tokenLeftCurlyBrace)
l.brackets = append(l.brackets, '{')
return l.lexVoid return l.lexVoid
} }
func (l *tomlLexer) lexRightCurlyBrace() tomlLexStateFn { func (l *tomlLexer) lexRightCurlyBrace() tomlLexStateFn {
l.next() l.next()
l.emit(tokenRightCurlyBrace) l.emit(tokenRightCurlyBrace)
if len(l.brackets) == 0 || l.brackets[len(l.brackets)-1] != '{' {
return l.errorf("cannot have '}' here")
}
l.brackets = l.brackets[:len(l.brackets)-1]
return l.lexRvalue return l.lexRvalue
} }
@ -302,13 +297,16 @@ func (l *tomlLexer) lexEqual() tomlLexStateFn {
func (l *tomlLexer) lexComma() tomlLexStateFn { func (l *tomlLexer) lexComma() tomlLexStateFn {
l.next() l.next()
l.emit(tokenComma) l.emit(tokenComma)
if len(l.brackets) > 0 && l.brackets[len(l.brackets)-1] == '{' {
return l.lexVoid
}
return l.lexRvalue return l.lexRvalue
} }
// Parse the key and emits its value without escape sequences. // Parse the key and emits its value without escape sequences.
// bare keys, basic string keys and literal string keys are supported. // bare keys, basic string keys and literal string keys are supported.
func (l *tomlLexer) lexKey() tomlLexStateFn { func (l *tomlLexer) lexKey() tomlLexStateFn {
growingString := "" var sb strings.Builder
for r := l.peek(); isKeyChar(r) || r == '\n' || r == '\r'; r = l.peek() { for r := l.peek(); isKeyChar(r) || r == '\n' || r == '\r'; r = l.peek() {
if r == '"' { if r == '"' {
@ -317,7 +315,9 @@ func (l *tomlLexer) lexKey() tomlLexStateFn {
if err != nil { if err != nil {
return l.errorf(err.Error()) return l.errorf(err.Error())
} }
growingString += "\"" + str + "\"" sb.WriteString("\"")
sb.WriteString(str)
sb.WriteString("\"")
l.next() l.next()
continue continue
} else if r == '\'' { } else if r == '\'' {
@ -326,22 +326,45 @@ func (l *tomlLexer) lexKey() tomlLexStateFn {
if err != nil { if err != nil {
return l.errorf(err.Error()) return l.errorf(err.Error())
} }
growingString += "'" + str + "'" sb.WriteString("'")
sb.WriteString(str)
sb.WriteString("'")
l.next() l.next()
continue continue
} else if r == '\n' { } else if r == '\n' {
return l.errorf("keys cannot contain new lines") return l.errorf("keys cannot contain new lines")
} else if isSpace(r) { } else if isSpace(r) {
break var str strings.Builder
str.WriteString(" ")
// skip trailing whitespace
l.next()
for r = l.peek(); isSpace(r); r = l.peek() {
str.WriteRune(r)
l.next()
}
// break loop if not a dot
if r != '.' {
break
}
str.WriteString(".")
// skip trailing whitespace after dot
l.next()
for r = l.peek(); isSpace(r); r = l.peek() {
str.WriteRune(r)
l.next()
}
sb.WriteString(str.String())
continue
} else if r == '.' { } else if r == '.' {
// skip // skip
} else if !isValidBareChar(r) { } else if !isValidBareChar(r) {
return l.errorf("keys cannot contain %c character", r) return l.errorf("keys cannot contain %c character", r)
} }
growingString += string(r) sb.WriteRune(r)
l.next() l.next()
} }
l.emitWithValue(tokenKey, growingString) l.emitWithValue(tokenKey, sb.String())
return l.lexVoid return l.lexVoid
} }
@ -361,11 +384,12 @@ func (l *tomlLexer) lexComment(previousState tomlLexStateFn) tomlLexStateFn {
func (l *tomlLexer) lexLeftBracket() tomlLexStateFn { func (l *tomlLexer) lexLeftBracket() tomlLexStateFn {
l.next() l.next()
l.emit(tokenLeftBracket) l.emit(tokenLeftBracket)
l.brackets = append(l.brackets, '[')
return l.lexRvalue return l.lexRvalue
} }
func (l *tomlLexer) lexLiteralStringAsString(terminator string, discardLeadingNewLine bool) (string, error) { func (l *tomlLexer) lexLiteralStringAsString(terminator string, discardLeadingNewLine bool) (string, error) {
growingString := "" var sb strings.Builder
if discardLeadingNewLine { if discardLeadingNewLine {
if l.follow("\r\n") { if l.follow("\r\n") {
@ -379,14 +403,14 @@ func (l *tomlLexer) lexLiteralStringAsString(terminator string, discardLeadingNe
// find end of string // find end of string
for { for {
if l.follow(terminator) { if l.follow(terminator) {
return growingString, nil return sb.String(), nil
} }
next := l.peek() next := l.peek()
if next == eof { if next == eof {
break break
} }
growingString += string(l.next()) sb.WriteRune(l.next())
} }
return "", errors.New("unclosed string") return "", errors.New("unclosed string")
@ -420,7 +444,7 @@ func (l *tomlLexer) lexLiteralString() tomlLexStateFn {
// Terminator is the substring indicating the end of the token. // Terminator is the substring indicating the end of the token.
// The resulting string does not include the terminator. // The resulting string does not include the terminator.
func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine, acceptNewLines bool) (string, error) { func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine, acceptNewLines bool) (string, error) {
growingString := "" var sb strings.Builder
if discardLeadingNewLine { if discardLeadingNewLine {
if l.follow("\r\n") { if l.follow("\r\n") {
@ -433,7 +457,7 @@ func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine,
for { for {
if l.follow(terminator) { if l.follow(terminator) {
return growingString, nil return sb.String(), nil
} }
if l.follow("\\") { if l.follow("\\") {
@ -451,72 +475,72 @@ func (l *tomlLexer) lexStringAsString(terminator string, discardLeadingNewLine,
l.next() l.next()
} }
case '"': case '"':
growingString += "\"" sb.WriteString("\"")
l.next() l.next()
case 'n': case 'n':
growingString += "\n" sb.WriteString("\n")
l.next() l.next()
case 'b': case 'b':
growingString += "\b" sb.WriteString("\b")
l.next() l.next()
case 'f': case 'f':
growingString += "\f" sb.WriteString("\f")
l.next() l.next()
case '/': case '/':
growingString += "/" sb.WriteString("/")
l.next() l.next()
case 't': case 't':
growingString += "\t" sb.WriteString("\t")
l.next() l.next()
case 'r': case 'r':
growingString += "\r" sb.WriteString("\r")
l.next() l.next()
case '\\': case '\\':
growingString += "\\" sb.WriteString("\\")
l.next() l.next()
case 'u': case 'u':
l.next() l.next()
code := "" var code strings.Builder
for i := 0; i < 4; i++ { for i := 0; i < 4; i++ {
c := l.peek() c := l.peek()
if !isHexDigit(c) { if !isHexDigit(c) {
return "", errors.New("unfinished unicode escape") return "", errors.New("unfinished unicode escape")
} }
l.next() l.next()
code = code + string(c) code.WriteRune(c)
} }
intcode, err := strconv.ParseInt(code, 16, 32) intcode, err := strconv.ParseInt(code.String(), 16, 32)
if err != nil { if err != nil {
return "", errors.New("invalid unicode escape: \\u" + code) return "", errors.New("invalid unicode escape: \\u" + code.String())
} }
growingString += string(rune(intcode)) sb.WriteRune(rune(intcode))
case 'U': case 'U':
l.next() l.next()
code := "" var code strings.Builder
for i := 0; i < 8; i++ { for i := 0; i < 8; i++ {
c := l.peek() c := l.peek()
if !isHexDigit(c) { if !isHexDigit(c) {
return "", errors.New("unfinished unicode escape") return "", errors.New("unfinished unicode escape")
} }
l.next() l.next()
code = code + string(c) code.WriteRune(c)
} }
intcode, err := strconv.ParseInt(code, 16, 64) intcode, err := strconv.ParseInt(code.String(), 16, 64)
if err != nil { if err != nil {
return "", errors.New("invalid unicode escape: \\U" + code) return "", errors.New("invalid unicode escape: \\U" + code.String())
} }
growingString += string(rune(intcode)) sb.WriteRune(rune(intcode))
default: default:
return "", errors.New("invalid escape sequence: \\" + string(l.peek())) return "", errors.New("invalid escape sequence: \\" + string(l.peek()))
} }
} else { } else {
r := l.peek() r := l.peek()
if 0x00 <= r && r <= 0x1F && !(acceptNewLines && (r == '\n' || r == '\r')) { if 0x00 <= r && r <= 0x1F && r != '\t' && !(acceptNewLines && (r == '\n' || r == '\r')) {
return "", fmt.Errorf("unescaped control character %U", r) return "", fmt.Errorf("unescaped control character %U", r)
} }
l.next() l.next()
growingString += string(r) sb.WriteRune(r)
} }
if l.peek() == eof { if l.peek() == eof {
@ -543,7 +567,6 @@ func (l *tomlLexer) lexString() tomlLexStateFn {
} }
str, err := l.lexStringAsString(terminator, discardLeadingNewLine, acceptNewLines) str, err := l.lexStringAsString(terminator, discardLeadingNewLine, acceptNewLines)
if err != nil { if err != nil {
return l.errorf(err.Error()) return l.errorf(err.Error())
} }
@ -615,6 +638,10 @@ func (l *tomlLexer) lexInsideTableKey() tomlLexStateFn {
func (l *tomlLexer) lexRightBracket() tomlLexStateFn { func (l *tomlLexer) lexRightBracket() tomlLexStateFn {
l.next() l.next()
l.emit(tokenRightBracket) l.emit(tokenRightBracket)
if len(l.brackets) == 0 || l.brackets[len(l.brackets)-1] != '[' {
return l.errorf("cannot have ']' here")
}
l.brackets = l.brackets[:len(l.brackets)-1]
return l.lexRvalue return l.lexRvalue
} }
@ -748,19 +775,19 @@ func init() {
// /!\ also matches the empty string // /!\ also matches the empty string
// //
// Example matches: // Example matches:
//1979-05-27T07:32:00Z // 1979-05-27T07:32:00Z
//1979-05-27T00:32:00-07:00 // 1979-05-27T00:32:00-07:00
//1979-05-27T00:32:00.999999-07:00 // 1979-05-27T00:32:00.999999-07:00
//1979-05-27 07:32:00Z // 1979-05-27 07:32:00Z
//1979-05-27 00:32:00-07:00 // 1979-05-27 00:32:00-07:00
//1979-05-27 00:32:00.999999-07:00 // 1979-05-27 00:32:00.999999-07:00
//1979-05-27T07:32:00 // 1979-05-27T07:32:00
//1979-05-27T00:32:00.999999 // 1979-05-27T00:32:00.999999
//1979-05-27 07:32:00 // 1979-05-27 07:32:00
//1979-05-27 00:32:00.999999 // 1979-05-27 00:32:00.999999
//1979-05-27 // 1979-05-27
//07:32:00 // 07:32:00
//00:32:00.999999 // 00:32:00.999999
dateRegexp = regexp.MustCompile(`^(?:\d{1,4}-\d{2}-\d{2})?(?:[T ]?\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})?)?`) dateRegexp = regexp.MustCompile(`^(?:\d{1,4}-\d{2}-\d{2})?(?:[T ]?\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:\d{2})?)?`)
} }

View File

@ -2,6 +2,7 @@ package toml
import ( import (
"bytes" "bytes"
"encoding"
"errors" "errors"
"fmt" "fmt"
"io" "io"
@ -22,6 +23,7 @@ const (
type tomlOpts struct { type tomlOpts struct {
name string name string
nameFromTag bool
comment string comment string
commented bool commented bool
multiline bool multiline bool
@ -68,9 +70,13 @@ const (
var timeType = reflect.TypeOf(time.Time{}) var timeType = reflect.TypeOf(time.Time{})
var marshalerType = reflect.TypeOf(new(Marshaler)).Elem() var marshalerType = reflect.TypeOf(new(Marshaler)).Elem()
var unmarshalerType = reflect.TypeOf(new(Unmarshaler)).Elem()
var textMarshalerType = reflect.TypeOf(new(encoding.TextMarshaler)).Elem()
var textUnmarshalerType = reflect.TypeOf(new(encoding.TextUnmarshaler)).Elem()
var localDateType = reflect.TypeOf(LocalDate{}) var localDateType = reflect.TypeOf(LocalDate{})
var localTimeType = reflect.TypeOf(LocalTime{}) var localTimeType = reflect.TypeOf(LocalTime{})
var localDateTimeType = reflect.TypeOf(LocalDateTime{}) var localDateTimeType = reflect.TypeOf(LocalDateTime{})
var mapStringInterfaceType = reflect.TypeOf(map[string]interface{}{})
// Check if the given marshal type maps to a Tree primitive // Check if the given marshal type maps to a Tree primitive
func isPrimitive(mtype reflect.Type) bool { func isPrimitive(mtype reflect.Type) bool {
@ -88,12 +94,16 @@ func isPrimitive(mtype reflect.Type) bool {
case reflect.String: case reflect.String:
return true return true
case reflect.Struct: case reflect.Struct:
return mtype == timeType || mtype == localDateType || mtype == localDateTimeType || mtype == localTimeType || isCustomMarshaler(mtype) return isTimeType(mtype)
default: default:
return false return false
} }
} }
func isTimeType(mtype reflect.Type) bool {
return mtype == timeType || mtype == localDateType || mtype == localDateTimeType || mtype == localTimeType
}
// Check if the given marshal type maps to a Tree slice or array // Check if the given marshal type maps to a Tree slice or array
func isTreeSequence(mtype reflect.Type) bool { func isTreeSequence(mtype reflect.Type) bool {
switch mtype.Kind() { switch mtype.Kind() {
@ -106,6 +116,30 @@ func isTreeSequence(mtype reflect.Type) bool {
} }
} }
// Check if the given marshal type maps to a slice or array of a custom marshaler type
func isCustomMarshalerSequence(mtype reflect.Type) bool {
switch mtype.Kind() {
case reflect.Ptr:
return isCustomMarshalerSequence(mtype.Elem())
case reflect.Slice, reflect.Array:
return isCustomMarshaler(mtype.Elem()) || isCustomMarshaler(reflect.New(mtype.Elem()).Type())
default:
return false
}
}
// Check if the given marshal type maps to a slice or array of a text marshaler type
func isTextMarshalerSequence(mtype reflect.Type) bool {
switch mtype.Kind() {
case reflect.Ptr:
return isTextMarshalerSequence(mtype.Elem())
case reflect.Slice, reflect.Array:
return isTextMarshaler(mtype.Elem()) || isTextMarshaler(reflect.New(mtype.Elem()).Type())
default:
return false
}
}
// Check if the given marshal type maps to a non-Tree slice or array // Check if the given marshal type maps to a non-Tree slice or array
func isOtherSequence(mtype reflect.Type) bool { func isOtherSequence(mtype reflect.Type) bool {
switch mtype.Kind() { switch mtype.Kind() {
@ -140,12 +174,42 @@ func callCustomMarshaler(mval reflect.Value) ([]byte, error) {
return mval.Interface().(Marshaler).MarshalTOML() return mval.Interface().(Marshaler).MarshalTOML()
} }
func isTextMarshaler(mtype reflect.Type) bool {
return mtype.Implements(textMarshalerType) && !isTimeType(mtype)
}
func callTextMarshaler(mval reflect.Value) ([]byte, error) {
return mval.Interface().(encoding.TextMarshaler).MarshalText()
}
func isCustomUnmarshaler(mtype reflect.Type) bool {
return mtype.Implements(unmarshalerType)
}
func callCustomUnmarshaler(mval reflect.Value, tval interface{}) error {
return mval.Interface().(Unmarshaler).UnmarshalTOML(tval)
}
func isTextUnmarshaler(mtype reflect.Type) bool {
return mtype.Implements(textUnmarshalerType)
}
func callTextUnmarshaler(mval reflect.Value, text []byte) error {
return mval.Interface().(encoding.TextUnmarshaler).UnmarshalText(text)
}
// Marshaler is the interface implemented by types that // Marshaler is the interface implemented by types that
// can marshal themselves into valid TOML. // can marshal themselves into valid TOML.
type Marshaler interface { type Marshaler interface {
MarshalTOML() ([]byte, error) MarshalTOML() ([]byte, error)
} }
// Unmarshaler is the interface implemented by types that
// can unmarshal a TOML description of themselves.
type Unmarshaler interface {
UnmarshalTOML(interface{}) error
}
/* /*
Marshal returns the TOML encoding of v. Behavior is similar to the Go json Marshal returns the TOML encoding of v. Behavior is similar to the Go json
encoder, except that there is no concept of a Marshaler interface or MarshalTOML encoder, except that there is no concept of a Marshaler interface or MarshalTOML
@ -190,20 +254,23 @@ type Encoder struct {
w io.Writer w io.Writer
encOpts encOpts
annotation annotation
line int line int
col int col int
order marshalOrder order marshalOrder
promoteAnon bool
indentation string
} }
// NewEncoder returns a new encoder that writes to w. // NewEncoder returns a new encoder that writes to w.
func NewEncoder(w io.Writer) *Encoder { func NewEncoder(w io.Writer) *Encoder {
return &Encoder{ return &Encoder{
w: w, w: w,
encOpts: encOptsDefaults, encOpts: encOptsDefaults,
annotation: annotationDefault, annotation: annotationDefault,
line: 0, line: 0,
col: 1, col: 1,
order: OrderAlphabetical, order: OrderAlphabetical,
indentation: " ",
} }
} }
@ -255,6 +322,12 @@ func (e *Encoder) Order(ord marshalOrder) *Encoder {
return e return e
} }
// Indentation allows to change indentation when marshalling.
func (e *Encoder) Indentation(indent string) *Encoder {
e.indentation = indent
return e
}
// SetTagName allows changing default tag "toml" // SetTagName allows changing default tag "toml"
func (e *Encoder) SetTagName(v string) *Encoder { func (e *Encoder) SetTagName(v string) *Encoder {
e.tag = v e.tag = v
@ -279,8 +352,31 @@ func (e *Encoder) SetTagMultiline(v string) *Encoder {
return e return e
} }
// PromoteAnonymous allows to change how anonymous struct fields are marshaled.
// Usually, they are marshaled as if the inner exported fields were fields in
// the outer struct. However, if an anonymous struct field is given a name in
// its TOML tag, it is treated like a regular struct field with that name.
// rather than being anonymous.
//
// In case anonymous promotion is enabled, all anonymous structs are promoted
// and treated like regular struct fields.
func (e *Encoder) PromoteAnonymous(promote bool) *Encoder {
e.promoteAnon = promote
return e
}
func (e *Encoder) marshal(v interface{}) ([]byte, error) { func (e *Encoder) marshal(v interface{}) ([]byte, error) {
// Check if indentation is valid
for _, char := range e.indentation {
if !isSpace(char) {
return []byte{}, fmt.Errorf("invalid indentation: must only contains space or tab characters")
}
}
mtype := reflect.TypeOf(v) mtype := reflect.TypeOf(v)
if mtype == nil {
return []byte{}, errors.New("nil cannot be marshaled to TOML")
}
switch mtype.Kind() { switch mtype.Kind() {
case reflect.Struct, reflect.Map: case reflect.Struct, reflect.Map:
@ -288,6 +384,9 @@ func (e *Encoder) marshal(v interface{}) ([]byte, error) {
if mtype.Elem().Kind() != reflect.Struct { if mtype.Elem().Kind() != reflect.Struct {
return []byte{}, errors.New("Only pointer to struct can be marshaled to TOML") return []byte{}, errors.New("Only pointer to struct can be marshaled to TOML")
} }
if reflect.ValueOf(v).IsNil() {
return []byte{}, errors.New("nil pointer cannot be marshaled to TOML")
}
default: default:
return []byte{}, errors.New("Only a struct or map can be marshaled to TOML") return []byte{}, errors.New("Only a struct or map can be marshaled to TOML")
} }
@ -296,13 +395,16 @@ func (e *Encoder) marshal(v interface{}) ([]byte, error) {
if isCustomMarshaler(mtype) { if isCustomMarshaler(mtype) {
return callCustomMarshaler(sval) return callCustomMarshaler(sval)
} }
if isTextMarshaler(mtype) {
return callTextMarshaler(sval)
}
t, err := e.valueToTree(mtype, sval) t, err := e.valueToTree(mtype, sval)
if err != nil { if err != nil {
return []byte{}, err return []byte{}, err
} }
var buf bytes.Buffer var buf bytes.Buffer
_, err = t.writeToOrdered(&buf, "", "", 0, e.arraysOneElementPerLine, e.order, false) _, err = t.writeToOrdered(&buf, "", "", 0, e.arraysOneElementPerLine, e.order, e.indentation, false)
return buf.Bytes(), err return buf.Bytes(), err
} }
@ -332,12 +434,16 @@ func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, er
if err != nil { if err != nil {
return nil, err return nil, err
} }
if tree, ok := val.(*Tree); ok && mtypef.Anonymous && !opts.nameFromTag && !e.promoteAnon {
tval.SetWithOptions(opts.name, SetOptions{ e.appendTree(tval, tree)
Comment: opts.comment, } else {
Commented: opts.commented, val = e.wrapTomlValue(val, tval)
Multiline: opts.multiline, tval.SetPathWithOptions([]string{opts.name}, SetOptions{
}, val) Comment: opts.comment,
Commented: opts.commented,
Multiline: opts.multiline,
}, val)
}
} }
} }
} }
@ -370,14 +476,15 @@ func (e *Encoder) valueToTree(mtype reflect.Type, mval reflect.Value) (*Tree, er
if err != nil { if err != nil {
return nil, err return nil, err
} }
val = e.wrapTomlValue(val, tval)
if e.quoteMapKeys { if e.quoteMapKeys {
keyStr, err := tomlValueStringRepresentation(key.String(), "", "", e.arraysOneElementPerLine) keyStr, err := tomlValueStringRepresentation(key.String(), "", "", e.order, e.arraysOneElementPerLine)
if err != nil { if err != nil {
return nil, err return nil, err
} }
tval.SetPath([]string{keyStr}, val) tval.SetPath([]string{keyStr}, val)
} else { } else {
tval.Set(key.String(), val) tval.SetPath([]string{key.String()}, val)
} }
} }
} }
@ -399,9 +506,6 @@ func (e *Encoder) valueToTreeSlice(mtype reflect.Type, mval reflect.Value) ([]*T
// Convert given marshal slice to slice of toml values // Convert given marshal slice to slice of toml values
func (e *Encoder) valueToOtherSlice(mtype reflect.Type, mval reflect.Value) (interface{}, error) { func (e *Encoder) valueToOtherSlice(mtype reflect.Type, mval reflect.Value) (interface{}, error) {
if mtype.Elem().Kind() == reflect.Interface {
return nil, fmt.Errorf("marshal can't handle []interface{}")
}
tval := make([]interface{}, mval.Len(), mval.Len()) tval := make([]interface{}, mval.Len(), mval.Len())
for i := 0; i < mval.Len(); i++ { for i := 0; i < mval.Len(); i++ {
val, err := e.valueToToml(mtype.Elem(), mval.Index(i)) val, err := e.valueToToml(mtype.Elem(), mval.Index(i))
@ -415,9 +519,16 @@ func (e *Encoder) valueToOtherSlice(mtype reflect.Type, mval reflect.Value) (int
// Convert given marshal value to toml value // Convert given marshal value to toml value
func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface{}, error) { func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface{}, error) {
e.line++
if mtype.Kind() == reflect.Ptr { if mtype.Kind() == reflect.Ptr {
return e.valueToToml(mtype.Elem(), mval.Elem()) switch {
case isCustomMarshaler(mtype):
return callCustomMarshaler(mval)
case isTextMarshaler(mtype):
b, err := callTextMarshaler(mval)
return string(b), err
default:
return e.valueToToml(mtype.Elem(), mval.Elem())
}
} }
if mtype.Kind() == reflect.Interface { if mtype.Kind() == reflect.Interface {
return e.valueToToml(mval.Elem().Type(), mval.Elem()) return e.valueToToml(mval.Elem().Type(), mval.Elem())
@ -425,12 +536,15 @@ func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface
switch { switch {
case isCustomMarshaler(mtype): case isCustomMarshaler(mtype):
return callCustomMarshaler(mval) return callCustomMarshaler(mval)
case isTextMarshaler(mtype):
b, err := callTextMarshaler(mval)
return string(b), err
case isTree(mtype): case isTree(mtype):
return e.valueToTree(mtype, mval) return e.valueToTree(mtype, mval)
case isOtherSequence(mtype), isCustomMarshalerSequence(mtype), isTextMarshalerSequence(mtype):
return e.valueToOtherSlice(mtype, mval)
case isTreeSequence(mtype): case isTreeSequence(mtype):
return e.valueToTreeSlice(mtype, mval) return e.valueToTreeSlice(mtype, mval)
case isOtherSequence(mtype):
return e.valueToOtherSlice(mtype, mval)
default: default:
switch mtype.Kind() { switch mtype.Kind() {
case reflect.Bool: case reflect.Bool:
@ -454,6 +568,38 @@ func (e *Encoder) valueToToml(mtype reflect.Type, mval reflect.Value) (interface
} }
} }
func (e *Encoder) appendTree(t, o *Tree) error {
for key, value := range o.values {
if _, ok := t.values[key]; ok {
continue
}
if tomlValue, ok := value.(*tomlValue); ok {
tomlValue.position.Col = t.position.Col
}
t.values[key] = value
}
return nil
}
// Create a toml value with the current line number as the position line
func (e *Encoder) wrapTomlValue(val interface{}, parent *Tree) interface{} {
_, isTree := val.(*Tree)
_, isTreeS := val.([]*Tree)
if isTree || isTreeS {
return val
}
ret := &tomlValue{
value: val,
position: Position{
e.line,
parent.position.Col,
},
}
e.line++
return ret
}
// Unmarshal attempts to unmarshal the Tree into a Go struct pointed by v. // Unmarshal attempts to unmarshal the Tree into a Go struct pointed by v.
// Neither Unmarshaler interfaces nor UnmarshalTOML functions are supported for // Neither Unmarshaler interfaces nor UnmarshalTOML functions are supported for
// sub-structs, and only definite types can be unmarshaled. // sub-structs, and only definite types can be unmarshaled.
@ -506,6 +652,8 @@ type Decoder struct {
tval *Tree tval *Tree
encOpts encOpts
tagName string tagName string
strict bool
visitor visitorState
} }
// NewDecoder returns a new decoder that reads from r. // NewDecoder returns a new decoder that reads from r.
@ -536,8 +684,18 @@ func (d *Decoder) SetTagName(v string) *Decoder {
return d return d
} }
// Strict allows changing to strict decoding. Any fields that are found in the
// input data and do not have a corresponding struct member cause an error.
func (d *Decoder) Strict(strict bool) *Decoder {
d.strict = strict
return d
}
func (d *Decoder) unmarshal(v interface{}) error { func (d *Decoder) unmarshal(v interface{}) error {
mtype := reflect.TypeOf(v) mtype := reflect.TypeOf(v)
if mtype == nil {
return errors.New("nil cannot be unmarshaled from TOML")
}
if mtype.Kind() != reflect.Ptr { if mtype.Kind() != reflect.Ptr {
return errors.New("only a pointer to struct or map can be unmarshaled from TOML") return errors.New("only a pointer to struct or map can be unmarshaled from TOML")
} }
@ -546,16 +704,29 @@ func (d *Decoder) unmarshal(v interface{}) error {
switch elem.Kind() { switch elem.Kind() {
case reflect.Struct, reflect.Map: case reflect.Struct, reflect.Map:
case reflect.Interface:
elem = mapStringInterfaceType
default: default:
return errors.New("only a pointer to struct or map can be unmarshaled from TOML") return errors.New("only a pointer to struct or map can be unmarshaled from TOML")
} }
if reflect.ValueOf(v).IsNil() {
return errors.New("nil pointer cannot be unmarshaled from TOML")
}
vv := reflect.ValueOf(v).Elem() vv := reflect.ValueOf(v).Elem()
if d.strict {
d.visitor = newVisitorState(d.tval)
}
sval, err := d.valueFromTree(elem, d.tval, &vv) sval, err := d.valueFromTree(elem, d.tval, &vv)
if err != nil { if err != nil {
return err return err
} }
if err := d.visitor.validate(); err != nil {
return err
}
reflect.ValueOf(v).Elem().Set(sval) reflect.ValueOf(v).Elem().Set(sval)
return nil return nil
} }
@ -566,6 +737,21 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
if mtype.Kind() == reflect.Ptr { if mtype.Kind() == reflect.Ptr {
return d.unwrapPointer(mtype, tval, mval1) return d.unwrapPointer(mtype, tval, mval1)
} }
// Check if pointer to value implements the Unmarshaler interface.
if mvalPtr := reflect.New(mtype); isCustomUnmarshaler(mvalPtr.Type()) {
d.visitor.visitAll()
if tval == nil {
return mvalPtr.Elem(), nil
}
if err := callCustomUnmarshaler(mvalPtr, tval.ToMap()); err != nil {
return reflect.ValueOf(nil), fmt.Errorf("unmarshal toml: %v", err)
}
return mvalPtr.Elem(), nil
}
var mval reflect.Value var mval reflect.Value
switch mtype.Kind() { switch mtype.Kind() {
case reflect.Struct: case reflect.Struct:
@ -597,18 +783,21 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
found := false found := false
if tval != nil { if tval != nil {
for _, key := range keysToTry { for _, key := range keysToTry {
exists := tval.Has(key) exists := tval.HasPath([]string{key})
if !exists { if !exists {
continue continue
} }
val := tval.Get(key)
d.visitor.push(key)
val := tval.GetPath([]string{key})
fval := mval.Field(i) fval := mval.Field(i)
mvalf, err := d.valueFromToml(mtypef.Type, val, &fval) mvalf, err := d.valueFromToml(mtypef.Type, val, &fval)
if err != nil { if err != nil {
return mval, formatError(err, tval.GetPosition(key)) return mval, formatError(err, tval.GetPositionPath([]string{key}))
} }
mval.Field(i).Set(mvalf) mval.Field(i).Set(mvalf)
found = true found = true
d.visitor.pop()
break break
} }
} }
@ -618,32 +807,42 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
var val interface{} var val interface{}
var err error var err error
switch mvalf.Kind() { switch mvalf.Kind() {
case reflect.Bool:
val, err = strconv.ParseBool(opts.defaultValue)
if err != nil {
return mval.Field(i), err
}
case reflect.Int:
val, err = strconv.Atoi(opts.defaultValue)
if err != nil {
return mval.Field(i), err
}
case reflect.String: case reflect.String:
val = opts.defaultValue val = opts.defaultValue
case reflect.Bool:
val, err = strconv.ParseBool(opts.defaultValue)
case reflect.Uint:
val, err = strconv.ParseUint(opts.defaultValue, 10, 0)
case reflect.Uint8:
val, err = strconv.ParseUint(opts.defaultValue, 10, 8)
case reflect.Uint16:
val, err = strconv.ParseUint(opts.defaultValue, 10, 16)
case reflect.Uint32:
val, err = strconv.ParseUint(opts.defaultValue, 10, 32)
case reflect.Uint64:
val, err = strconv.ParseUint(opts.defaultValue, 10, 64)
case reflect.Int:
val, err = strconv.ParseInt(opts.defaultValue, 10, 0)
case reflect.Int8:
val, err = strconv.ParseInt(opts.defaultValue, 10, 8)
case reflect.Int16:
val, err = strconv.ParseInt(opts.defaultValue, 10, 16)
case reflect.Int32:
val, err = strconv.ParseInt(opts.defaultValue, 10, 32)
case reflect.Int64: case reflect.Int64:
val, err = strconv.ParseInt(opts.defaultValue, 10, 64) val, err = strconv.ParseInt(opts.defaultValue, 10, 64)
if err != nil { case reflect.Float32:
return mval.Field(i), err val, err = strconv.ParseFloat(opts.defaultValue, 32)
}
case reflect.Float64: case reflect.Float64:
val, err = strconv.ParseFloat(opts.defaultValue, 64) val, err = strconv.ParseFloat(opts.defaultValue, 64)
if err != nil {
return mval.Field(i), err
}
default: default:
return mval.Field(i), fmt.Errorf("unsuported field type for default option") return mvalf, fmt.Errorf("unsupported field type for default option")
} }
mval.Field(i).Set(reflect.ValueOf(val))
if err != nil {
return mvalf, err
}
mvalf.Set(reflect.ValueOf(val).Convert(mvalf.Type()))
} }
// save the old behavior above and try to check structs // save the old behavior above and try to check structs
@ -652,7 +851,8 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
if !mtypef.Anonymous { if !mtypef.Anonymous {
tmpTval = nil tmpTval = nil
} }
v, err := d.valueFromTree(mtypef.Type, tmpTval, nil) fval := mval.Field(i)
v, err := d.valueFromTree(mtypef.Type, tmpTval, &fval)
if err != nil { if err != nil {
return v, err return v, err
} }
@ -663,13 +863,15 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
case reflect.Map: case reflect.Map:
mval = reflect.MakeMap(mtype) mval = reflect.MakeMap(mtype)
for _, key := range tval.Keys() { for _, key := range tval.Keys() {
d.visitor.push(key)
// TODO: path splits key // TODO: path splits key
val := tval.GetPath([]string{key}) val := tval.GetPath([]string{key})
mvalf, err := d.valueFromToml(mtype.Elem(), val, nil) mvalf, err := d.valueFromToml(mtype.Elem(), val, nil)
if err != nil { if err != nil {
return mval, formatError(err, tval.GetPosition(key)) return mval, formatError(err, tval.GetPositionPath([]string{key}))
} }
mval.SetMapIndex(reflect.ValueOf(key).Convert(mtype.Key()), mvalf) mval.SetMapIndex(reflect.ValueOf(key).Convert(mtype.Key()), mvalf)
d.visitor.pop()
} }
} }
return mval, nil return mval, nil
@ -677,22 +879,52 @@ func (d *Decoder) valueFromTree(mtype reflect.Type, tval *Tree, mval1 *reflect.V
// Convert toml value to marshal struct/map slice, using marshal type // Convert toml value to marshal struct/map slice, using marshal type
func (d *Decoder) valueFromTreeSlice(mtype reflect.Type, tval []*Tree) (reflect.Value, error) { func (d *Decoder) valueFromTreeSlice(mtype reflect.Type, tval []*Tree) (reflect.Value, error) {
mval := reflect.MakeSlice(mtype, len(tval), len(tval)) mval, err := makeSliceOrArray(mtype, len(tval))
if err != nil {
return mval, err
}
for i := 0; i < len(tval); i++ { for i := 0; i < len(tval); i++ {
d.visitor.push(strconv.Itoa(i))
val, err := d.valueFromTree(mtype.Elem(), tval[i], nil) val, err := d.valueFromTree(mtype.Elem(), tval[i], nil)
if err != nil { if err != nil {
return mval, err return mval, err
} }
mval.Index(i).Set(val) mval.Index(i).Set(val)
d.visitor.pop()
}
return mval, nil
}
// Convert toml value to marshal primitive slice, using marshal type
func (d *Decoder) valueFromOtherSlice(mtype reflect.Type, tval []interface{}) (reflect.Value, error) {
mval, err := makeSliceOrArray(mtype, len(tval))
if err != nil {
return mval, err
}
for i := 0; i < len(tval); i++ {
val, err := d.valueFromToml(mtype.Elem(), tval[i], nil)
if err != nil {
return mval, err
}
mval.Index(i).Set(val)
} }
return mval, nil return mval, nil
} }
// Convert toml value to marshal primitive slice, using marshal type // Convert toml value to marshal primitive slice, using marshal type
func (d *Decoder) valueFromOtherSlice(mtype reflect.Type, tval []interface{}) (reflect.Value, error) { func (d *Decoder) valueFromOtherSliceI(mtype reflect.Type, tval interface{}) (reflect.Value, error) {
mval := reflect.MakeSlice(mtype, len(tval), len(tval)) val := reflect.ValueOf(tval)
for i := 0; i < len(tval); i++ { length := val.Len()
val, err := d.valueFromToml(mtype.Elem(), tval[i], nil)
mval, err := makeSliceOrArray(mtype, length)
if err != nil {
return mval, err
}
for i := 0; i < length; i++ {
val, err := d.valueFromToml(mtype.Elem(), val.Index(i).Interface(), nil)
if err != nil { if err != nil {
return mval, err return mval, err
} }
@ -701,6 +933,21 @@ func (d *Decoder) valueFromOtherSlice(mtype reflect.Type, tval []interface{}) (r
return mval, nil return mval, nil
} }
// Create a new slice or a new array with specified length
func makeSliceOrArray(mtype reflect.Type, tLength int) (reflect.Value, error) {
var mval reflect.Value
switch mtype.Kind() {
case reflect.Slice:
mval = reflect.MakeSlice(mtype, tLength, tLength)
case reflect.Array:
mval = reflect.New(reflect.ArrayOf(mtype.Len(), mtype.Elem())).Elem()
if tLength > mtype.Len() {
return mval, fmt.Errorf("unmarshal: TOML array length (%v) exceeds destination array length (%v)", tLength, mtype.Len())
}
}
return mval, nil
}
// Convert toml value to marshal value, using marshal type. When mval1 is non-nil // Convert toml value to marshal value, using marshal type. When mval1 is non-nil
// and the given type is a struct value, merge fields into it. // and the given type is a struct value, merge fields into it.
func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}, mval1 *reflect.Value) (reflect.Value, error) { func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}, mval1 *reflect.Value) (reflect.Value, error) {
@ -742,6 +989,7 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}, mval1 *ref
} }
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to trees", tval, tval) return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to trees", tval, tval)
case []interface{}: case []interface{}:
d.visitor.visit()
if isOtherSequence(mtype) { if isOtherSequence(mtype) {
return d.valueFromOtherSlice(mtype, t) return d.valueFromOtherSlice(mtype, t)
} }
@ -755,6 +1003,15 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}, mval1 *ref
} }
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to a slice", tval, tval) return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to a slice", tval, tval)
default: default:
d.visitor.visit()
// Check if pointer to value implements the encoding.TextUnmarshaler.
if mvalPtr := reflect.New(mtype); isTextUnmarshaler(mvalPtr.Type()) && !isTimeType(mtype) {
if err := d.unmarshalText(tval, mvalPtr); err != nil {
return reflect.ValueOf(nil), fmt.Errorf("unmarshal text: %v", err)
}
return mvalPtr.Elem(), nil
}
switch mtype.Kind() { switch mtype.Kind() {
case reflect.Bool, reflect.Struct: case reflect.Bool, reflect.Struct:
val := reflect.ValueOf(tval) val := reflect.ValueOf(tval)
@ -805,34 +1062,34 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}, mval1 *ref
} }
return reflect.ValueOf(d), nil return reflect.ValueOf(d), nil
} }
if !val.Type().ConvertibleTo(mtype) { if !val.Type().ConvertibleTo(mtype) || val.Kind() == reflect.Float64 {
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String()) return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
} }
if reflect.Indirect(reflect.New(mtype)).OverflowInt(val.Convert(mtype).Int()) { if reflect.Indirect(reflect.New(mtype)).OverflowInt(val.Convert(reflect.TypeOf(int64(0))).Int()) {
return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String()) return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String())
} }
return val.Convert(mtype), nil return val.Convert(mtype), nil
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
val := reflect.ValueOf(tval) val := reflect.ValueOf(tval)
if !val.Type().ConvertibleTo(mtype) { if !val.Type().ConvertibleTo(mtype) || val.Kind() == reflect.Float64 {
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String()) return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
} }
if val.Convert(reflect.TypeOf(int(1))).Int() < 0 { if val.Convert(reflect.TypeOf(int(1))).Int() < 0 {
return reflect.ValueOf(nil), fmt.Errorf("%v(%T) is negative so does not fit in %v", tval, tval, mtype.String()) return reflect.ValueOf(nil), fmt.Errorf("%v(%T) is negative so does not fit in %v", tval, tval, mtype.String())
} }
if reflect.Indirect(reflect.New(mtype)).OverflowUint(uint64(val.Convert(mtype).Uint())) { if reflect.Indirect(reflect.New(mtype)).OverflowUint(val.Convert(reflect.TypeOf(uint64(0))).Uint()) {
return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String()) return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String())
} }
return val.Convert(mtype), nil return val.Convert(mtype), nil
case reflect.Float32, reflect.Float64: case reflect.Float32, reflect.Float64:
val := reflect.ValueOf(tval) val := reflect.ValueOf(tval)
if !val.Type().ConvertibleTo(mtype) { if !val.Type().ConvertibleTo(mtype) || val.Kind() == reflect.Int64 {
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String()) return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v", tval, tval, mtype.String())
} }
if reflect.Indirect(reflect.New(mtype)).OverflowFloat(val.Convert(mtype).Float()) { if reflect.Indirect(reflect.New(mtype)).OverflowFloat(val.Convert(reflect.TypeOf(float64(0))).Float()) {
return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String()) return reflect.ValueOf(nil), fmt.Errorf("%v(%T) would overflow %v", tval, tval, mtype.String())
} }
@ -844,6 +1101,11 @@ func (d *Decoder) valueFromToml(mtype reflect.Type, tval interface{}, mval1 *ref
ival := mval1.Elem() ival := mval1.Elem()
return d.valueFromToml(mval1.Elem().Type(), t, &ival) return d.valueFromToml(mval1.Elem().Type(), t, &ival)
} }
case reflect.Slice, reflect.Array:
if isOtherSequence(mtype) && isOtherSequence(reflect.TypeOf(t)) {
return d.valueFromOtherSliceI(mtype, t)
}
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v(%v)", tval, tval, mtype, mtype.Kind())
default: default:
return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v(%v)", tval, tval, mtype, mtype.Kind()) return reflect.ValueOf(nil), fmt.Errorf("Can't convert %v(%T) to %v(%v)", tval, tval, mtype, mtype.Kind())
} }
@ -867,6 +1129,12 @@ func (d *Decoder) unwrapPointer(mtype reflect.Type, tval interface{}, mval1 *ref
return mval, nil return mval, nil
} }
func (d *Decoder) unmarshalText(tval interface{}, mval reflect.Value) error {
var buf bytes.Buffer
fmt.Fprint(&buf, tval)
return callTextUnmarshaler(mval, buf.Bytes())
}
func tomlOptions(vf reflect.StructField, an annotation) tomlOpts { func tomlOptions(vf reflect.StructField, an annotation) tomlOpts {
tag := vf.Tag.Get(an.tag) tag := vf.Tag.Get(an.tag)
parse := strings.Split(tag, ",") parse := strings.Split(tag, ",")
@ -879,6 +1147,7 @@ func tomlOptions(vf reflect.StructField, an annotation) tomlOpts {
defaultValue := vf.Tag.Get(tagDefault) defaultValue := vf.Tag.Get(tagDefault)
result := tomlOpts{ result := tomlOpts{
name: vf.Name, name: vf.Name,
nameFromTag: false,
comment: comment, comment: comment,
commented: commented, commented: commented,
multiline: multiline, multiline: multiline,
@ -891,6 +1160,7 @@ func tomlOptions(vf reflect.StructField, an annotation) tomlOpts {
result.include = false result.include = false
} else { } else {
result.name = strings.Trim(parse[0], " ") result.name = strings.Trim(parse[0], " ")
result.nameFromTag = true
} }
} }
if vf.PkgPath != "" { if vf.PkgPath != "" {
@ -907,11 +1177,7 @@ func tomlOptions(vf reflect.StructField, an annotation) tomlOpts {
func isZero(val reflect.Value) bool { func isZero(val reflect.Value) bool {
switch val.Type().Kind() { switch val.Type().Kind() {
case reflect.Map: case reflect.Slice, reflect.Array, reflect.Map:
fallthrough
case reflect.Array:
fallthrough
case reflect.Slice:
return val.Len() == 0 return val.Len() == 0
default: default:
return reflect.DeepEqual(val.Interface(), reflect.Zero(val.Type()).Interface()) return reflect.DeepEqual(val.Interface(), reflect.Zero(val.Type()).Interface())
@ -924,3 +1190,80 @@ func formatError(err error, pos Position) error {
} }
return fmt.Errorf("%s: %s", pos, err) return fmt.Errorf("%s: %s", pos, err)
} }
// visitorState keeps track of which keys were unmarshaled.
type visitorState struct {
tree *Tree
path []string
keys map[string]struct{}
active bool
}
func newVisitorState(tree *Tree) visitorState {
path, result := []string{}, map[string]struct{}{}
insertKeys(path, result, tree)
return visitorState{
tree: tree,
path: path[:0],
keys: result,
active: true,
}
}
func (s *visitorState) push(key string) {
if s.active {
s.path = append(s.path, key)
}
}
func (s *visitorState) pop() {
if s.active {
s.path = s.path[:len(s.path)-1]
}
}
func (s *visitorState) visit() {
if s.active {
delete(s.keys, strings.Join(s.path, "."))
}
}
func (s *visitorState) visitAll() {
if s.active {
for k := range s.keys {
if strings.HasPrefix(k, strings.Join(s.path, ".")) {
delete(s.keys, k)
}
}
}
}
func (s *visitorState) validate() error {
if !s.active {
return nil
}
undecoded := make([]string, 0, len(s.keys))
for key := range s.keys {
undecoded = append(undecoded, key)
}
sort.Strings(undecoded)
if len(undecoded) > 0 {
return fmt.Errorf("undecoded keys: %q", undecoded)
}
return nil
}
func insertKeys(path []string, m map[string]struct{}, tree *Tree) {
for k, v := range tree.values {
switch node := v.(type) {
case []*Tree:
for i, item := range node {
insertKeys(append(path, k, strconv.Itoa(i)), m, item)
}
case *Tree:
insertKeys(append(path, k), m, node)
case *tomlValue:
m[strings.Join(append(path, k), ".")] = struct{}{}
}
}
}

View File

@ -158,6 +158,11 @@ func (p *tomlParser) parseGroup() tomlParserStateFn {
if err := p.tree.createSubTree(keys, startToken.Position); err != nil { if err := p.tree.createSubTree(keys, startToken.Position); err != nil {
p.raiseError(key, "%s", err) p.raiseError(key, "%s", err)
} }
destTree := p.tree.GetPath(keys)
if target, ok := destTree.(*Tree); ok && target != nil && target.inline {
p.raiseError(key, "could not re-define exist inline table or its sub-table : %s",
strings.Join(keys, "."))
}
p.assume(tokenRightBracket) p.assume(tokenRightBracket)
p.currentTable = keys p.currentTable = keys
return p.parseStart return p.parseStart
@ -201,6 +206,11 @@ func (p *tomlParser) parseAssign() tomlParserStateFn {
strings.Join(tableKey, ".")) strings.Join(tableKey, "."))
} }
if targetNode.inline {
p.raiseError(key, "could not add key or sub-table to exist inline table or its sub-table : %s",
strings.Join(tableKey, "."))
}
// assign value to the found table // assign value to the found table
keyVal := parsedKey[len(parsedKey)-1] keyVal := parsedKey[len(parsedKey)-1]
localKey := []string{keyVal} localKey := []string{keyVal}
@ -411,12 +421,13 @@ Loop:
if tokenIsComma(previous) { if tokenIsComma(previous) {
p.raiseError(previous, "trailing comma at the end of inline table") p.raiseError(previous, "trailing comma at the end of inline table")
} }
tree.inline = true
return tree return tree
} }
func (p *tomlParser) parseArray() interface{} { func (p *tomlParser) parseArray() interface{} {
var array []interface{} var array []interface{}
arrayType := reflect.TypeOf(nil) arrayType := reflect.TypeOf(newTree())
for { for {
follow := p.peek() follow := p.peek()
if follow == nil || follow.typ == tokenEOF { if follow == nil || follow.typ == tokenEOF {
@ -427,11 +438,8 @@ func (p *tomlParser) parseArray() interface{} {
break break
} }
val := p.parseRvalue() val := p.parseRvalue()
if arrayType == nil {
arrayType = reflect.TypeOf(val)
}
if reflect.TypeOf(val) != arrayType { if reflect.TypeOf(val) != arrayType {
p.raiseError(follow, "mixed types in array") arrayType = nil
} }
array = append(array, val) array = append(array, val)
follow = p.peek() follow = p.peek()
@ -445,6 +453,12 @@ func (p *tomlParser) parseArray() interface{} {
p.getToken() p.getToken()
} }
} }
// if the array is a mixed-type array or its length is 0,
// don't convert it to a table array
if len(array) <= 0 {
arrayType = nil
}
// An array of Trees is actually an array of inline // An array of Trees is actually an array of inline
// tables, which is a shorthand for a table array. If the // tables, which is a shorthand for a table array. If the
// array was not converted from []interface{} to []*Tree, // array was not converted from []interface{} to []*Tree,

View File

@ -1,9 +1,6 @@
package toml package toml
import ( import "fmt"
"fmt"
"unicode"
)
// Define tokens // Define tokens
type tokenType int type tokenType int
@ -112,7 +109,7 @@ func isSpace(r rune) bool {
} }
func isAlphanumeric(r rune) bool { func isAlphanumeric(r rune) bool {
return unicode.IsLetter(r) || r == '_' return 'a' <= r && r <= 'z' || 'A' <= r && r <= 'Z' || r == '_'
} }
func isKeyChar(r rune) bool { func isKeyChar(r rune) bool {
@ -127,7 +124,7 @@ func isKeyStartChar(r rune) bool {
} }
func isDigit(r rune) bool { func isDigit(r rune) bool {
return unicode.IsNumber(r) return '0' <= r && r <= '9'
} }
func isHexDigit(r rune) bool { func isHexDigit(r rune) bool {

View File

@ -23,6 +23,7 @@ type Tree struct {
values map[string]interface{} // string -> *tomlValue, *Tree, []*Tree values map[string]interface{} // string -> *tomlValue, *Tree, []*Tree
comment string comment string
commented bool commented bool
inline bool
position Position position Position
} }
@ -121,6 +122,89 @@ func (t *Tree) GetPath(keys []string) interface{} {
} }
} }
// GetArray returns the value at key in the Tree.
// It returns []string, []int64, etc type if key has homogeneous lists
// Key is a dot-separated path (e.g. a.b.c) without single/double quoted strings.
// Returns nil if the path does not exist in the tree.
// If keys is of length zero, the current tree is returned.
func (t *Tree) GetArray(key string) interface{} {
if key == "" {
return t
}
return t.GetArrayPath(strings.Split(key, "."))
}
// GetArrayPath returns the element in the tree indicated by 'keys'.
// If keys is of length zero, the current tree is returned.
func (t *Tree) GetArrayPath(keys []string) interface{} {
if len(keys) == 0 {
return t
}
subtree := t
for _, intermediateKey := range keys[:len(keys)-1] {
value, exists := subtree.values[intermediateKey]
if !exists {
return nil
}
switch node := value.(type) {
case *Tree:
subtree = node
case []*Tree:
// go to most recent element
if len(node) == 0 {
return nil
}
subtree = node[len(node)-1]
default:
return nil // cannot navigate through other node types
}
}
// branch based on final node type
switch node := subtree.values[keys[len(keys)-1]].(type) {
case *tomlValue:
switch n := node.value.(type) {
case []interface{}:
return getArray(n)
default:
return node.value
}
default:
return node
}
}
// if homogeneous array, then return slice type object over []interface{}
func getArray(n []interface{}) interface{} {
var s []string
var i64 []int64
var f64 []float64
var bl []bool
for _, value := range n {
switch v := value.(type) {
case string:
s = append(s, v)
case int64:
i64 = append(i64, v)
case float64:
f64 = append(f64, v)
case bool:
bl = append(bl, v)
default:
return n
}
}
if len(s) == len(n) {
return s
} else if len(i64) == len(n) {
return i64
} else if len(f64) == len(n) {
return f64
} else if len(bl) == len(n) {
return bl
}
return n
}
// GetPosition returns the position of the given key. // GetPosition returns the position of the given key.
func (t *Tree) GetPosition(key string) Position { func (t *Tree) GetPosition(key string) Position {
if key == "" { if key == "" {
@ -129,6 +213,50 @@ func (t *Tree) GetPosition(key string) Position {
return t.GetPositionPath(strings.Split(key, ".")) return t.GetPositionPath(strings.Split(key, "."))
} }
// SetPositionPath sets the position of element in the tree indicated by 'keys'.
// If keys is of length zero, the current tree position is set.
func (t *Tree) SetPositionPath(keys []string, pos Position) {
if len(keys) == 0 {
t.position = pos
return
}
subtree := t
for _, intermediateKey := range keys[:len(keys)-1] {
value, exists := subtree.values[intermediateKey]
if !exists {
return
}
switch node := value.(type) {
case *Tree:
subtree = node
case []*Tree:
// go to most recent element
if len(node) == 0 {
return
}
subtree = node[len(node)-1]
default:
return
}
}
// branch based on final node type
switch node := subtree.values[keys[len(keys)-1]].(type) {
case *tomlValue:
node.position = pos
return
case *Tree:
node.position = pos
return
case []*Tree:
// go to most recent element
if len(node) == 0 {
return
}
node[len(node)-1].position = pos
return
}
}
// GetPositionPath returns the element in the tree indicated by 'keys'. // GetPositionPath returns the element in the tree indicated by 'keys'.
// If keys is of length zero, the current tree is returned. // If keys is of length zero, the current tree is returned.
func (t *Tree) GetPositionPath(keys []string) Position { func (t *Tree) GetPositionPath(keys []string) Position {
@ -211,7 +339,8 @@ func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interfac
// go to most recent element // go to most recent element
if len(node) == 0 { if len(node) == 0 {
// create element if it does not exist // create element if it does not exist
subtree.values[intermediateKey] = append(node, newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col})) node = append(node, newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col}))
subtree.values[intermediateKey] = node
} }
subtree = node[len(node)-1] subtree = node[len(node)-1]
} }
@ -231,6 +360,8 @@ func (t *Tree) SetPathWithOptions(keys []string, opts SetOptions, value interfac
toInsert = value toInsert = value
case *tomlValue: case *tomlValue:
v.comment = opts.Comment v.comment = opts.Comment
v.commented = opts.Commented
v.multiline = opts.Multiline
toInsert = v toInsert = v
default: default:
toInsert = &tomlValue{value: value, toInsert = &tomlValue{value: value,
@ -311,6 +442,7 @@ func (t *Tree) createSubTree(keys []string, pos Position) error {
if !exists { if !exists {
tree := newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col}) tree := newTreeWithPosition(Position{Line: t.position.Line + i, Col: t.position.Col})
tree.position = pos tree.position = pos
tree.inline = subtree.inline
subtree.values[intermediateKey] = tree subtree.values[intermediateKey] = tree
nextTree = tree nextTree = tree
} }

View File

@ -57,6 +57,19 @@ func simpleValueCoercion(object interface{}) (interface{}, error) {
return float64(original), nil return float64(original), nil
case fmt.Stringer: case fmt.Stringer:
return original.String(), nil return original.String(), nil
case []interface{}:
value := reflect.ValueOf(original)
length := value.Len()
arrayValue := reflect.MakeSlice(value.Type(), 0, length)
for i := 0; i < length; i++ {
val := value.Index(i).Interface()
simpleValue, err := simpleValueCoercion(val)
if err != nil {
return nil, err
}
arrayValue = reflect.Append(arrayValue, reflect.ValueOf(simpleValue))
}
return arrayValue.Interface(), nil
default: default:
return nil, fmt.Errorf("cannot convert type %T to Tree", object) return nil, fmt.Errorf("cannot convert type %T to Tree", object)
} }

View File

@ -30,9 +30,15 @@ type sortNode struct {
// are preserved. Quotation marks and backslashes are also not escaped. // are preserved. Quotation marks and backslashes are also not escaped.
func encodeMultilineTomlString(value string, commented string) string { func encodeMultilineTomlString(value string, commented string) string {
var b bytes.Buffer var b bytes.Buffer
adjacentQuoteCount := 0
b.WriteString(commented) b.WriteString(commented)
for _, rr := range value { for i, rr := range value {
if rr != '"' {
adjacentQuoteCount = 0
} else {
adjacentQuoteCount++
}
switch rr { switch rr {
case '\b': case '\b':
b.WriteString(`\b`) b.WriteString(`\b`)
@ -45,7 +51,12 @@ func encodeMultilineTomlString(value string, commented string) string {
case '\r': case '\r':
b.WriteString("\r") b.WriteString("\r")
case '"': case '"':
b.WriteString(`"`) if adjacentQuoteCount >= 3 || i == len(value)-1 {
adjacentQuoteCount = 0
b.WriteString(`\"`)
} else {
b.WriteString(`"`)
}
case '\\': case '\\':
b.WriteString(`\`) b.WriteString(`\`)
default: default:
@ -92,7 +103,30 @@ func encodeTomlString(value string) string {
return b.String() return b.String()
} }
func tomlValueStringRepresentation(v interface{}, commented string, indent string, arraysOneElementPerLine bool) (string, error) { func tomlTreeStringRepresentation(t *Tree, ord marshalOrder) (string, error) {
var orderedVals []sortNode
switch ord {
case OrderPreserve:
orderedVals = sortByLines(t)
default:
orderedVals = sortAlphabetical(t)
}
var values []string
for _, node := range orderedVals {
k := node.key
v := t.values[k]
repr, err := tomlValueStringRepresentation(v, "", "", ord, false)
if err != nil {
return "", err
}
values = append(values, quoteKeyIfNeeded(k)+" = "+repr)
}
return "{ " + strings.Join(values, ", ") + " }", nil
}
func tomlValueStringRepresentation(v interface{}, commented string, indent string, ord marshalOrder, arraysOneElementPerLine bool) (string, error) {
// this interface check is added to dereference the change made in the writeTo function. // this interface check is added to dereference the change made in the writeTo function.
// That change was made to allow this function to see formatting options. // That change was made to allow this function to see formatting options.
tv, ok := v.(*tomlValue) tv, ok := v.(*tomlValue)
@ -129,7 +163,7 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
return "\"" + encodeTomlString(value) + "\"", nil return "\"" + encodeTomlString(value) + "\"", nil
case []byte: case []byte:
b, _ := v.([]byte) b, _ := v.([]byte)
return tomlValueStringRepresentation(string(b), commented, indent, arraysOneElementPerLine) return string(b), nil
case bool: case bool:
if value { if value {
return "true", nil return "true", nil
@ -143,6 +177,8 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
return value.String(), nil return value.String(), nil
case LocalTime: case LocalTime:
return value.String(), nil return value.String(), nil
case *Tree:
return tomlTreeStringRepresentation(value, ord)
case nil: case nil:
return "", nil return "", nil
} }
@ -153,7 +189,7 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
var values []string var values []string
for i := 0; i < rv.Len(); i++ { for i := 0; i < rv.Len(); i++ {
item := rv.Index(i).Interface() item := rv.Index(i).Interface()
itemRepr, err := tomlValueStringRepresentation(item, commented, indent, arraysOneElementPerLine) itemRepr, err := tomlValueStringRepresentation(item, commented, indent, ord, arraysOneElementPerLine)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -176,7 +212,7 @@ func tomlValueStringRepresentation(v interface{}, commented string, indent strin
return stringBuffer.String(), nil return stringBuffer.String(), nil
} }
return "[" + strings.Join(values, ",") + "]", nil return "[" + strings.Join(values, ", ") + "]", nil
} }
return "", fmt.Errorf("unsupported value type %T: %v", v, v) return "", fmt.Errorf("unsupported value type %T: %v", v, v)
} }
@ -271,10 +307,10 @@ func sortAlphabetical(t *Tree) (vals []sortNode) {
} }
func (t *Tree) writeTo(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool) (int64, error) { func (t *Tree) writeTo(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool) (int64, error) {
return t.writeToOrdered(w, indent, keyspace, bytesCount, arraysOneElementPerLine, OrderAlphabetical, false) return t.writeToOrdered(w, indent, keyspace, bytesCount, arraysOneElementPerLine, OrderAlphabetical, " ", false)
} }
func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool, ord marshalOrder, parentCommented bool) (int64, error) { func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount int64, arraysOneElementPerLine bool, ord marshalOrder, indentString string, parentCommented bool) (int64, error) {
var orderedVals []sortNode var orderedVals []sortNode
switch ord { switch ord {
@ -290,7 +326,7 @@ func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount i
k := node.key k := node.key
v := t.values[k] v := t.values[k]
combinedKey := k combinedKey := quoteKeyIfNeeded(k)
if keyspace != "" { if keyspace != "" {
combinedKey = keyspace + "." + combinedKey combinedKey = keyspace + "." + combinedKey
} }
@ -324,7 +360,7 @@ func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount i
if err != nil { if err != nil {
return bytesCount, err return bytesCount, err
} }
bytesCount, err = node.writeToOrdered(w, indent+" ", combinedKey, bytesCount, arraysOneElementPerLine, ord, parentCommented || t.commented || tv.commented) bytesCount, err = node.writeToOrdered(w, indent+indentString, combinedKey, bytesCount, arraysOneElementPerLine, ord, indentString, parentCommented || t.commented || tv.commented)
if err != nil { if err != nil {
return bytesCount, err return bytesCount, err
} }
@ -340,7 +376,7 @@ func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount i
return bytesCount, err return bytesCount, err
} }
bytesCount, err = subTree.writeToOrdered(w, indent+" ", combinedKey, bytesCount, arraysOneElementPerLine, ord, parentCommented || t.commented || subTree.commented) bytesCount, err = subTree.writeToOrdered(w, indent+indentString, combinedKey, bytesCount, arraysOneElementPerLine, ord, indentString, parentCommented || t.commented || subTree.commented)
if err != nil { if err != nil {
return bytesCount, err return bytesCount, err
} }
@ -357,7 +393,7 @@ func (t *Tree) writeToOrdered(w io.Writer, indent, keyspace string, bytesCount i
if parentCommented || t.commented || v.commented { if parentCommented || t.commented || v.commented {
commented = "# " commented = "# "
} }
repr, err := tomlValueStringRepresentation(v, commented, indent, arraysOneElementPerLine) repr, err := tomlValueStringRepresentation(v, commented, indent, ord, arraysOneElementPerLine)
if err != nil { if err != nil {
return bytesCount, err return bytesCount, err
} }

View File

@ -573,6 +573,7 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p
} }
i.autocompleteList.SetCurrentItem(newEntry) i.autocompleteList.SetCurrentItem(newEntry)
currentText, _ = i.autocompleteList.GetItemText(newEntry) // Don't trigger changed function twice. currentText, _ = i.autocompleteList.GetItemText(newEntry) // Don't trigger changed function twice.
currentText = stripTags(currentText)
i.SetText(currentText) i.SetText(currentText)
} else { } else {
finish(key) finish(key)
@ -585,6 +586,7 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p
} }
i.autocompleteList.SetCurrentItem(newEntry) i.autocompleteList.SetCurrentItem(newEntry)
currentText, _ = i.autocompleteList.GetItemText(newEntry) // Don't trigger changed function twice. currentText, _ = i.autocompleteList.GetItemText(newEntry) // Don't trigger changed function twice.
currentText = stripTags(currentText)
i.SetText(currentText) i.SetText(currentText)
} else { } else {
finish(key) finish(key)

View File

@ -42,6 +42,11 @@ type TableCell struct {
// If set to true, this cell cannot be selected. // If set to true, this cell cannot be selected.
NotSelectable bool NotSelectable bool
// An optional handler for mouse clicks. This also fires if the cell is not
// selectable. If true is returned, no additional "selected" event is fired
// on selectable cells.
Clicked func() bool
// The position and width of the cell the last time table was drawn. // The position and width of the cell the last time table was drawn.
x, y, width int x, y, width int
} }
@ -160,6 +165,14 @@ func (c *TableCell) GetLastPosition() (x, y, width int) {
return c.x, c.y, c.width return c.x, c.y, c.width
} }
// SetClickedFunc sets a handler which fires when this cell is clicked. This is
// independent of whether the cell is selectable or not. But for selectable
// cells, if the function returns "true", the "selected" event is not fired.
func (c *TableCell) SetClickedFunc(clicked func() bool) *TableCell {
c.Clicked = clicked
return c
}
// Table visualizes two-dimensional data consisting of rows and columns. Each // Table visualizes two-dimensional data consisting of rows and columns. Each
// Table cell is defined via SetCell() by the TableCell type. They can be added // Table cell is defined via SetCell() by the TableCell type. They can be added
// dynamically to the table and changed any time. // dynamically to the table and changed any time.
@ -1247,8 +1260,21 @@ func (t *Table) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
switch action { switch action {
case MouseLeftClick: case MouseLeftClick:
if t.rowsSelectable || t.columnsSelectable { selectEvent := true
t.Select(t.cellAt(x, y)) row, column := t.cellAt(x, y)
if row >= 0 && row < len(t.cells) && column >= 0 {
cells := t.cells[row]
if column < len(cells) {
cell := cells[column]
if cell != nil && cell.Clicked != nil {
if noSelect := cell.Clicked(); noSelect {
selectEvent = false
}
}
}
}
if selectEvent && (t.rowsSelectable || t.columnsSelectable) {
t.Select(row, column)
} }
setFocus(t) setFocus(t)
consumed = true consumed = true

View File

@ -269,12 +269,13 @@ func (t *TextView) SetText(text string) *TextView {
return t return t
} }
// GetText returns the current text of this text view. If "stripTags" is set // GetText returns the current text of this text view. If "stripAllTags" is set
// to true, any region/color tags are stripped from the text. // to true, any region/color tags are stripped from the text.
func (t *TextView) GetText(stripTags bool) string { func (t *TextView) GetText(stripAllTags bool) string {
// Get the buffer. // Get the buffer.
buffer := t.buffer buffer := make([]string, len(t.buffer), len(t.buffer)+1)
if !stripTags { copy(buffer, t.buffer)
if !stripAllTags {
buffer = append(buffer, string(t.recentBytes)) buffer = append(buffer, string(t.recentBytes))
} }
@ -282,19 +283,14 @@ func (t *TextView) GetText(stripTags bool) string {
text := strings.Join(buffer, "\n") text := strings.Join(buffer, "\n")
// Strip from tags if required. // Strip from tags if required.
if stripTags { if stripAllTags {
if t.regions { if t.regions {
text = regionPattern.ReplaceAllString(text, "") text = regionPattern.ReplaceAllString(text, "")
} }
if t.dynamicColors { if t.dynamicColors {
text = colorPattern.ReplaceAllStringFunc(text, func(match string) string { text = stripTags(text)
if len(match) > 2 {
return ""
}
return match
})
} }
if t.regions || t.dynamicColors { if t.regions && !t.dynamicColors {
text = escapePattern.ReplaceAllString(text, `[$1$2]`) text = escapePattern.ReplaceAllString(text, `[$1$2]`)
} }
} }

12
vendor/github.com/rivo/tview/util.go generated vendored
View File

@ -628,3 +628,15 @@ func iterateStringReverse(text string, callback func(main rune, comb []rune, tex
return false return false
} }
// stripTags strips colour tags from the given string. (Region tags are not
// stripped.)
func stripTags(text string) string {
stripped := colorPattern.ReplaceAllStringFunc(text, func(match string) string {
if len(match) > 2 {
return ""
}
return match
})
return escapePattern.ReplaceAllString(stripped, `[$1$2]`)
}

29
vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s generated vendored Normal file
View File

@ -0,0 +1,29 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !gccgo
#include "textflag.h"
//
// System call support for mips64, OpenBSD
//
// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.
TEXT ·Syscall(SB),NOSPLIT,$0-56
JMP syscall·Syscall(SB)
TEXT ·Syscall6(SB),NOSPLIT,$0-80
JMP syscall·Syscall6(SB)
TEXT ·Syscall9(SB),NOSPLIT,$0-104
JMP syscall·Syscall9(SB)
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JMP syscall·RawSyscall(SB)
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JMP syscall·RawSyscall6(SB)

View File

@ -16,3 +16,9 @@ func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
return err return err
} }
// FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command.
func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error {
_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore))))
return err
}

View File

@ -20,6 +20,15 @@ func IoctlSetInt(fd int, req uint, value int) error {
return ioctl(fd, req, uintptr(value)) return ioctl(fd, req, uintptr(value))
} }
// IoctlSetPointerInt performs an ioctl operation which sets an
// integer value on fd, using the specified request number. The ioctl
// argument is called with a pointer to the integer value, rather than
// passing the integer value directly.
func IoctlSetPointerInt(fd int, req uint, value int) error {
v := int32(value)
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
}
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
// //
// To change fd's window size, the req argument should be TIOCSWINSZ. // To change fd's window size, the req argument should be TIOCSWINSZ.

View File

@ -73,26 +73,22 @@ aix_ppc64)
darwin_386) darwin_386)
mkerrors="$mkerrors -m32" mkerrors="$mkerrors -m32"
mksyscall="go run mksyscall.go -l32" mksyscall="go run mksyscall.go -l32"
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs" mktypes="GOARCH=$GOARCH go tool cgo -godefs"
mkasm="go run mkasm_darwin.go" mkasm="go run mkasm_darwin.go"
;; ;;
darwin_amd64) darwin_amd64)
mkerrors="$mkerrors -m64" mkerrors="$mkerrors -m64"
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs" mktypes="GOARCH=$GOARCH go tool cgo -godefs"
mkasm="go run mkasm_darwin.go" mkasm="go run mkasm_darwin.go"
;; ;;
darwin_arm) darwin_arm)
mkerrors="$mkerrors" mkerrors="$mkerrors"
mksyscall="go run mksyscall.go -l32" mksyscall="go run mksyscall.go -l32"
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs" mktypes="GOARCH=$GOARCH go tool cgo -godefs"
mkasm="go run mkasm_darwin.go" mkasm="go run mkasm_darwin.go"
;; ;;
darwin_arm64) darwin_arm64)
mkerrors="$mkerrors -m64" mkerrors="$mkerrors -m64"
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs" mktypes="GOARCH=$GOARCH go tool cgo -godefs"
mkasm="go run mkasm_darwin.go" mkasm="go run mkasm_darwin.go"
;; ;;
@ -184,6 +180,15 @@ openbsd_arm64)
# API consistent across platforms. # API consistent across platforms.
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
;; ;;
openbsd_mips64)
mkerrors="$mkerrors -m64"
mksyscall="go run mksyscall.go -openbsd"
mksysctl="go run mksysctl_openbsd.go"
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
# Let the type of C char be signed for making the bare syscall
# API consistent across platforms.
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
;;
solaris_amd64) solaris_amd64)
mksyscall="go run mksyscall_solaris.go" mksyscall="go run mksyscall_solaris.go"
mkerrors="$mkerrors -m64" mkerrors="$mkerrors -m64"
@ -217,8 +222,6 @@ esac
# aix/ppc64 script generates files instead of writing to stdin. # aix/ppc64 script generates files instead of writing to stdin.
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ; echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
elif [ "$GOOS" == "darwin" ]; then elif [ "$GOOS" == "darwin" ]; then
# pre-1.12, direct syscalls
echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos syscall_darwin_${GOARCH}.1_11.go $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
# 1.12 and later, syscalls via libSystem # 1.12 and later, syscalls via libSystem
echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
# 1.13 and later, syscalls via libSystem (including syscallPtr) # 1.13 and later, syscalls via libSystem (including syscallPtr)

View File

@ -58,6 +58,7 @@ includes_Darwin='
#define _DARWIN_USE_64_BIT_INODE #define _DARWIN_USE_64_BIT_INODE
#include <stdint.h> #include <stdint.h>
#include <sys/attr.h> #include <sys/attr.h>
#include <sys/clonefile.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/event.h> #include <sys/event.h>
#include <sys/ptrace.h> #include <sys/ptrace.h>
@ -193,6 +194,8 @@ struct ltchars {
#include <sys/xattr.h> #include <sys/xattr.h>
#include <linux/bpf.h> #include <linux/bpf.h>
#include <linux/can.h> #include <linux/can.h>
#include <linux/can/error.h>
#include <linux/can/raw.h>
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/cryptouser.h> #include <linux/cryptouser.h>
#include <linux/devlink.h> #include <linux/devlink.h>

View File

@ -10,6 +10,8 @@ import (
"unsafe" "unsafe"
) )
const _SYS_GETDIRENTRIES64 = 344
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
// To implement this using libSystem we'd need syscall_syscallPtr for // To implement this using libSystem we'd need syscall_syscallPtr for
// fdopendir. However, syscallPtr was only added in Go 1.13, so we fall // fdopendir. However, syscallPtr was only added in Go 1.13, so we fall
@ -20,7 +22,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
} else { } else {
p = unsafe.Pointer(&_zero) p = unsafe.Pointer(&_zero)
} }
r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
return n, errnoErr(e1) return n, errnoErr(e1)

View File

@ -49,6 +49,11 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
// Some external packages rely on SYS___SYSCTL being defined to implement their
// own sysctl wrappers. Provide it here, even though direct syscalls are no
// longer supported on darwin.
const SYS___SYSCTL = 202
// Translate "kern.hostname" to []_C_int{0,1,2,3}. // Translate "kern.hostname" to []_C_int{0,1,2,3}.
func nametomib(name string) (mib []_C_int, err error) { func nametomib(name string) (mib []_C_int, err error) {
const siz = unsafe.Sizeof(mib[0]) const siz = unsafe.Sizeof(mib[0])
@ -396,6 +401,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Chroot(path string) (err error) //sys Chroot(path string) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error) //sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys Close(fd int) (err error) //sys Close(fd int) (err error)
//sys Clonefile(src string, dst string, flags int) (err error)
//sys Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error)
//sys Dup(fd int) (nfd int, err error) //sys Dup(fd int) (nfd int, err error)
//sys Dup2(from int, to int) (err error) //sys Dup2(from int, to int) (err error)
//sys Exchangedata(path1 string, path2 string, options int) (err error) //sys Exchangedata(path1 string, path2 string, options int) (err error)
@ -407,6 +414,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
//sys Fchown(fd int, uid int, gid int) (err error) //sys Fchown(fd int, uid int, gid int) (err error)
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
//sys Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error)
//sys Flock(fd int, how int) (err error) //sys Flock(fd int, how int) (err error)
//sys Fpathconf(fd int, name int) (val int, err error) //sys Fpathconf(fd int, name int) (val int, err error)
//sys Fsync(fd int) (err error) //sys Fsync(fd int) (err error)

View File

@ -1,9 +0,0 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,386,!go1.12
package unix
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64

View File

@ -44,10 +44,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/386 the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64

View File

@ -1,9 +0,0 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,amd64,!go1.12
package unix
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64

View File

@ -44,10 +44,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64

View File

@ -1,11 +0,0 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,arm,!go1.12
package unix
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
return 0, ENOSYS
}

View File

@ -44,10 +44,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/arm the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstat(fd int, stat *Stat_t) (err error)
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
//sys Fstatfs(fd int, stat *Statfs_t) (err error) //sys Fstatfs(fd int, stat *Statfs_t) (err error)

View File

@ -1,11 +0,0 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin,arm64,!go1.12
package unix
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
return 0, ENOSYS
}

View File

@ -46,10 +46,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstat(fd int, stat *Stat_t) (err error)
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
//sys Fstatfs(fd int, stat *Statfs_t) (err error) //sys Fstatfs(fd int, stat *Statfs_t) (err error)

View File

@ -24,7 +24,7 @@ func bytes2iovec(bs [][]byte) []Iovec {
return iovecs return iovecs
} }
//sys readv(fd int, iovs []Iovec) (n int, err error) //sys readv(fd int, iovs []Iovec) (n int, err error)
func Readv(fd int, iovs [][]byte) (n int, err error) { func Readv(fd int, iovs [][]byte) (n int, err error) {
iovecs := bytes2iovec(iovs) iovecs := bytes2iovec(iovs)
@ -32,7 +32,7 @@ func Readv(fd int, iovs [][]byte) (n int, err error) {
return n, err return n, err
} }
//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error) //sys preadv(fd int, iovs []Iovec, off int64) (n int, err error)
func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) { func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) {
iovecs := bytes2iovec(iovs) iovecs := bytes2iovec(iovs)
@ -40,7 +40,7 @@ func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) {
return n, err return n, err
} }
//sys writev(fd int, iovs []Iovec) (n int, err error) //sys writev(fd int, iovs []Iovec) (n int, err error)
func Writev(fd int, iovs [][]byte) (n int, err error) { func Writev(fd int, iovs [][]byte) (n int, err error) {
iovecs := bytes2iovec(iovs) iovecs := bytes2iovec(iovs)
@ -48,10 +48,43 @@ func Writev(fd int, iovs [][]byte) (n int, err error) {
return n, err return n, err
} }
//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error) //sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error)
func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) { func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) {
iovecs := bytes2iovec(iovs) iovecs := bytes2iovec(iovs)
n, err = pwritev(fd, iovecs, off) n, err = pwritev(fd, iovecs, off)
return n, err return n, err
} }
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
var rsa RawSockaddrAny
var len _Socklen = SizeofSockaddrAny
nfd, err = accept4(fd, &rsa, &len, flags)
if err != nil {
return
}
if len > SizeofSockaddrAny {
panic("RawSockaddrAny too small")
}
sa, err = anyToSockaddr(fd, &rsa)
if err != nil {
Close(nfd)
nfd = 0
}
return
}
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) error {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err := pipe2(&pp, flags)
p[0] = int(pp[0])
p[1] = int(pp[1])
return err
}

View File

@ -82,15 +82,6 @@ func IoctlRetInt(fd int, req uint) (int, error) {
return int(ret), nil return int(ret), nil
} }
// IoctlSetPointerInt performs an ioctl operation which sets an
// integer value on fd, using the specified request number. The ioctl
// argument is called with a pointer to the integer value, rather than
// passing the integer value directly.
func IoctlSetPointerInt(fd int, req uint, value int) error {
v := int32(value)
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
}
func IoctlSetRTCTime(fd int, value *RTCTime) error { func IoctlSetRTCTime(fd int, value *RTCTime) error {
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value))) err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
runtime.KeepAlive(value) runtime.KeepAlive(value)
@ -145,6 +136,12 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
return openat(dirfd, path, flags|O_LARGEFILE, mode) return openat(dirfd, path, flags|O_LARGEFILE, mode)
} }
//sys openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error)
func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) {
return openat2(dirfd, path, how, SizeofOpenHow)
}
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
@ -1111,6 +1108,21 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
} }
return sa, nil return sa, nil
case AF_CAN:
pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa))
sa := &SockaddrCAN{
Ifindex: int(pp.Ifindex),
}
rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
for i := 0; i < 4; i++ {
rx[i] = pp.Addr[i]
}
tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
for i := 0; i < 4; i++ {
tx[i] = pp.Addr[i+4]
}
return sa, nil
} }
return nil, EAFNOSUPPORT return nil, EAFNOSUPPORT
} }

View File

@ -7,7 +7,6 @@
package unix package unix
import ( import (
"syscall"
"unsafe" "unsafe"
) )
@ -49,10 +48,6 @@ func Pipe2(p []int, flags int) (err error) {
return return
} }
// Underlying system call writes to newoffset via pointer.
// Implemented in assembly to avoid allocation.
func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
newoffset, errno := seek(fd, offset, whence) newoffset, errno := seek(fd, offset, whence)
if errno != 0 { if errno != 0 {

13
vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go generated vendored Normal file
View File

@ -0,0 +1,13 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build arm,!gccgo,linux
package unix
import "syscall"
// Underlying system call writes to newoffset via pointer.
// Implemented in assembly to avoid allocation.
func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)

35
vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go generated vendored Normal file
View File

@ -0,0 +1,35 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package unix
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: sec, Usec: usec}
}
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint64(fd)
k.Filter = int16(mode)
k.Flags = uint16(flags)
}
func (iov *Iovec) SetLen(length int) {
iov.Len = uint64(length)
}
func (msghdr *Msghdr) SetControllen(length int) {
msghdr.Controllen = uint32(length)
}
func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of OpenBSD the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL

View File

@ -232,6 +232,8 @@ const (
CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_THREAD_CPUTIME_ID = 0x10
CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW = 0x8
CLOCK_UPTIME_RAW_APPROX = 0x9 CLOCK_UPTIME_RAW_APPROX = 0x9
CLONE_NOFOLLOW = 0x1
CLONE_NOOWNERCOPY = 0x2
CR0 = 0x0 CR0 = 0x0
CR1 = 0x1000 CR1 = 0x1000
CR2 = 0x2000 CR2 = 0x2000

View File

@ -232,6 +232,8 @@ const (
CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_THREAD_CPUTIME_ID = 0x10
CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW = 0x8
CLOCK_UPTIME_RAW_APPROX = 0x9 CLOCK_UPTIME_RAW_APPROX = 0x9
CLONE_NOFOLLOW = 0x1
CLONE_NOOWNERCOPY = 0x2
CR0 = 0x0 CR0 = 0x0
CR1 = 0x1000 CR1 = 0x1000
CR2 = 0x2000 CR2 = 0x2000

View File

@ -232,6 +232,8 @@ const (
CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_THREAD_CPUTIME_ID = 0x10
CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW = 0x8
CLOCK_UPTIME_RAW_APPROX = 0x9 CLOCK_UPTIME_RAW_APPROX = 0x9
CLONE_NOFOLLOW = 0x1
CLONE_NOOWNERCOPY = 0x2
CR0 = 0x0 CR0 = 0x0
CR1 = 0x1000 CR1 = 0x1000
CR2 = 0x2000 CR2 = 0x2000

View File

@ -232,6 +232,8 @@ const (
CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_THREAD_CPUTIME_ID = 0x10
CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW = 0x8
CLOCK_UPTIME_RAW_APPROX = 0x9 CLOCK_UPTIME_RAW_APPROX = 0x9
CLONE_NOFOLLOW = 0x1
CLONE_NOOWNERCOPY = 0x2
CR0 = 0x0 CR0 = 0x0
CR1 = 0x1000 CR1 = 0x1000
CR2 = 0x2000 CR2 = 0x2000

View File

@ -244,8 +244,66 @@ const (
CAN_EFF_FLAG = 0x80000000 CAN_EFF_FLAG = 0x80000000
CAN_EFF_ID_BITS = 0x1d CAN_EFF_ID_BITS = 0x1d
CAN_EFF_MASK = 0x1fffffff CAN_EFF_MASK = 0x1fffffff
CAN_ERR_ACK = 0x20
CAN_ERR_BUSERROR = 0x80
CAN_ERR_BUSOFF = 0x40
CAN_ERR_CRTL = 0x4
CAN_ERR_CRTL_ACTIVE = 0x40
CAN_ERR_CRTL_RX_OVERFLOW = 0x1
CAN_ERR_CRTL_RX_PASSIVE = 0x10
CAN_ERR_CRTL_RX_WARNING = 0x4
CAN_ERR_CRTL_TX_OVERFLOW = 0x2
CAN_ERR_CRTL_TX_PASSIVE = 0x20
CAN_ERR_CRTL_TX_WARNING = 0x8
CAN_ERR_CRTL_UNSPEC = 0x0
CAN_ERR_DLC = 0x8
CAN_ERR_FLAG = 0x20000000 CAN_ERR_FLAG = 0x20000000
CAN_ERR_LOSTARB = 0x2
CAN_ERR_LOSTARB_UNSPEC = 0x0
CAN_ERR_MASK = 0x1fffffff CAN_ERR_MASK = 0x1fffffff
CAN_ERR_PROT = 0x8
CAN_ERR_PROT_ACTIVE = 0x40
CAN_ERR_PROT_BIT = 0x1
CAN_ERR_PROT_BIT0 = 0x8
CAN_ERR_PROT_BIT1 = 0x10
CAN_ERR_PROT_FORM = 0x2
CAN_ERR_PROT_LOC_ACK = 0x19
CAN_ERR_PROT_LOC_ACK_DEL = 0x1b
CAN_ERR_PROT_LOC_CRC_DEL = 0x18
CAN_ERR_PROT_LOC_CRC_SEQ = 0x8
CAN_ERR_PROT_LOC_DATA = 0xa
CAN_ERR_PROT_LOC_DLC = 0xb
CAN_ERR_PROT_LOC_EOF = 0x1a
CAN_ERR_PROT_LOC_ID04_00 = 0xe
CAN_ERR_PROT_LOC_ID12_05 = 0xf
CAN_ERR_PROT_LOC_ID17_13 = 0x7
CAN_ERR_PROT_LOC_ID20_18 = 0x6
CAN_ERR_PROT_LOC_ID28_21 = 0x2
CAN_ERR_PROT_LOC_IDE = 0x5
CAN_ERR_PROT_LOC_INTERM = 0x12
CAN_ERR_PROT_LOC_RES0 = 0x9
CAN_ERR_PROT_LOC_RES1 = 0xd
CAN_ERR_PROT_LOC_RTR = 0xc
CAN_ERR_PROT_LOC_SOF = 0x3
CAN_ERR_PROT_LOC_SRTR = 0x4
CAN_ERR_PROT_LOC_UNSPEC = 0x0
CAN_ERR_PROT_OVERLOAD = 0x20
CAN_ERR_PROT_STUFF = 0x4
CAN_ERR_PROT_TX = 0x80
CAN_ERR_PROT_UNSPEC = 0x0
CAN_ERR_RESTARTED = 0x100
CAN_ERR_TRX = 0x10
CAN_ERR_TRX_CANH_NO_WIRE = 0x4
CAN_ERR_TRX_CANH_SHORT_TO_BAT = 0x5
CAN_ERR_TRX_CANH_SHORT_TO_GND = 0x7
CAN_ERR_TRX_CANH_SHORT_TO_VCC = 0x6
CAN_ERR_TRX_CANL_NO_WIRE = 0x40
CAN_ERR_TRX_CANL_SHORT_TO_BAT = 0x50
CAN_ERR_TRX_CANL_SHORT_TO_CANH = 0x80
CAN_ERR_TRX_CANL_SHORT_TO_GND = 0x70
CAN_ERR_TRX_CANL_SHORT_TO_VCC = 0x60
CAN_ERR_TRX_UNSPEC = 0x0
CAN_ERR_TX_TIMEOUT = 0x1
CAN_INV_FILTER = 0x20000000 CAN_INV_FILTER = 0x20000000
CAN_ISOTP = 0x6 CAN_ISOTP = 0x6
CAN_J1939 = 0x7 CAN_J1939 = 0x7
@ -1985,6 +2043,7 @@ const (
SOL_ATM = 0x108 SOL_ATM = 0x108
SOL_CAIF = 0x116 SOL_CAIF = 0x116
SOL_CAN_BASE = 0x64 SOL_CAN_BASE = 0x64
SOL_CAN_RAW = 0x65
SOL_DCCP = 0x10d SOL_DCCP = 0x10d
SOL_DECNET = 0x105 SOL_DECNET = 0x105
SOL_ICMPV6 = 0x3a SOL_ICMPV6 = 0x3a

1862
vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -958,6 +958,56 @@ func libc_close_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Clonefile(src string, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(src)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_clonefile_trampoline()
//go:linkname libc_clonefile libc_clonefile
//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(src)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_clonefileat_trampoline()
//go:linkname libc_clonefileat libc_clonefileat
//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup(fd int) (nfd int, err error) { func Dup(fd int) (nfd int, err error) {
r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0)
nfd = int(r0) nfd = int(r0)
@ -1146,6 +1196,26 @@ func libc_fchownat_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_fclonefileat_trampoline()
//go:linkname libc_fclonefileat libc_fclonefileat
//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Flock(fd int, how int) (err error) { func Flock(fd int, how int) (err error) {
_, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0)
if e1 != 0 { if e1 != 0 {

View File

@ -110,6 +110,10 @@ TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0
JMP libc_clock_gettime(SB) JMP libc_clock_gettime(SB)
TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
JMP libc_close(SB) JMP libc_close(SB)
TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0
JMP libc_clonefile(SB)
TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0
JMP libc_clonefileat(SB)
TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
JMP libc_dup(SB) JMP libc_dup(SB)
TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
@ -132,6 +136,8 @@ TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
JMP libc_fchown(SB) JMP libc_fchown(SB)
TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fchownat(SB) JMP libc_fchownat(SB)
TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fclonefileat(SB)
TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
JMP libc_flock(SB) JMP libc_flock(SB)
TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
@ -164,6 +170,8 @@ TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB) JMP libc_getrusage(SB)
TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
JMP libc_getsid(SB) JMP libc_getsid(SB)
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
JMP libc_getuid(SB) JMP libc_getuid(SB)
TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
@ -266,8 +274,6 @@ TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
JMP libc_munmap(SB) JMP libc_munmap(SB)
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
JMP libc_ptrace(SB) JMP libc_ptrace(SB)
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
JMP libc_fstat64(SB) JMP libc_fstat64(SB)
TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0

File diff suppressed because it is too large Load Diff

View File

@ -958,6 +958,56 @@ func libc_close_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Clonefile(src string, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(src)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_clonefile_trampoline()
//go:linkname libc_clonefile libc_clonefile
//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(src)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_clonefileat_trampoline()
//go:linkname libc_clonefileat libc_clonefileat
//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup(fd int) (nfd int, err error) { func Dup(fd int) (nfd int, err error) {
r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0)
nfd = int(r0) nfd = int(r0)
@ -1146,6 +1196,26 @@ func libc_fchownat_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_fclonefileat_trampoline()
//go:linkname libc_fclonefileat libc_fclonefileat
//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Flock(fd int, how int) (err error) { func Flock(fd int, how int) (err error) {
_, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0)
if e1 != 0 { if e1 != 0 {

View File

@ -110,6 +110,10 @@ TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0
JMP libc_clock_gettime(SB) JMP libc_clock_gettime(SB)
TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
JMP libc_close(SB) JMP libc_close(SB)
TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0
JMP libc_clonefile(SB)
TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0
JMP libc_clonefileat(SB)
TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
JMP libc_dup(SB) JMP libc_dup(SB)
TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
@ -132,6 +136,8 @@ TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
JMP libc_fchown(SB) JMP libc_fchown(SB)
TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fchownat(SB) JMP libc_fchownat(SB)
TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fclonefileat(SB)
TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
JMP libc_flock(SB) JMP libc_flock(SB)
TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
@ -164,6 +170,8 @@ TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB) JMP libc_getrusage(SB)
TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
JMP libc_getsid(SB) JMP libc_getsid(SB)
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
JMP libc_getuid(SB) JMP libc_getuid(SB)
TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
@ -266,8 +274,6 @@ TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
JMP libc_munmap(SB) JMP libc_munmap(SB)
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
JMP libc_ptrace(SB) JMP libc_ptrace(SB)
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
JMP libc_fstat64(SB) JMP libc_fstat64(SB)
TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0

File diff suppressed because it is too large Load Diff

View File

@ -958,6 +958,56 @@ func libc_close_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Clonefile(src string, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(src)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_clonefile_trampoline()
//go:linkname libc_clonefile libc_clonefile
//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(src)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_clonefileat_trampoline()
//go:linkname libc_clonefileat libc_clonefileat
//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup(fd int) (nfd int, err error) { func Dup(fd int) (nfd int, err error) {
r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0)
nfd = int(r0) nfd = int(r0)
@ -1146,6 +1196,26 @@ func libc_fchownat_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_fclonefileat_trampoline()
//go:linkname libc_fclonefileat libc_fclonefileat
//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Flock(fd int, how int) (err error) { func Flock(fd int, how int) (err error) {
_, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0)
if e1 != 0 { if e1 != 0 {

View File

@ -110,6 +110,10 @@ TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0
JMP libc_clock_gettime(SB) JMP libc_clock_gettime(SB)
TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
JMP libc_close(SB) JMP libc_close(SB)
TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0
JMP libc_clonefile(SB)
TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0
JMP libc_clonefileat(SB)
TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
JMP libc_dup(SB) JMP libc_dup(SB)
TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
@ -132,6 +136,8 @@ TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
JMP libc_fchown(SB) JMP libc_fchown(SB)
TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fchownat(SB) JMP libc_fchownat(SB)
TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fclonefileat(SB)
TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
JMP libc_flock(SB) JMP libc_flock(SB)
TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
@ -164,6 +170,8 @@ TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB) JMP libc_getrusage(SB)
TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
JMP libc_getsid(SB) JMP libc_getsid(SB)
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
JMP libc_getuid(SB) JMP libc_getuid(SB)
TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
@ -264,8 +272,6 @@ TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
JMP libc_mmap(SB) JMP libc_mmap(SB)
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
JMP libc_munmap(SB) JMP libc_munmap(SB)
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fstat(SB) JMP libc_fstat(SB)
TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0

View File

@ -958,6 +958,56 @@ func libc_close_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Clonefile(src string, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(src)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_clonefile_trampoline()
//go:linkname libc_clonefile libc_clonefile
//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(src)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_clonefileat_trampoline()
//go:linkname libc_clonefileat libc_clonefileat
//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup(fd int) (nfd int, err error) { func Dup(fd int) (nfd int, err error) {
r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0)
nfd = int(r0) nfd = int(r0)
@ -1146,6 +1196,26 @@ func libc_fchownat_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(dst)
if err != nil {
return
}
_, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
func libc_fclonefileat_trampoline()
//go:linkname libc_fclonefileat libc_fclonefileat
//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Flock(fd int, how int) (err error) { func Flock(fd int, how int) (err error) {
_, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0)
if e1 != 0 { if e1 != 0 {

View File

@ -110,6 +110,10 @@ TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0
JMP libc_clock_gettime(SB) JMP libc_clock_gettime(SB)
TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
JMP libc_close(SB) JMP libc_close(SB)
TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0
JMP libc_clonefile(SB)
TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0
JMP libc_clonefileat(SB)
TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
JMP libc_dup(SB) JMP libc_dup(SB)
TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
@ -132,6 +136,8 @@ TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
JMP libc_fchown(SB) JMP libc_fchown(SB)
TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fchownat(SB) JMP libc_fchownat(SB)
TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fclonefileat(SB)
TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
JMP libc_flock(SB) JMP libc_flock(SB)
TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
@ -164,6 +170,8 @@ TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB) JMP libc_getrusage(SB)
TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
JMP libc_getsid(SB) JMP libc_getsid(SB)
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
JMP libc_getuid(SB) JMP libc_getuid(SB)
TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
@ -264,8 +272,6 @@ TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
JMP libc_mmap(SB) JMP libc_mmap(SB)
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
JMP libc_munmap(SB) JMP libc_munmap(SB)
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0
JMP libc_fstat(SB) JMP libc_fstat(SB)
TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0

View File

@ -13,17 +13,23 @@ import (
//go:cgo_import_dynamic libc_preadv preadv "libc.so" //go:cgo_import_dynamic libc_preadv preadv "libc.so"
//go:cgo_import_dynamic libc_writev writev "libc.so" //go:cgo_import_dynamic libc_writev writev "libc.so"
//go:cgo_import_dynamic libc_pwritev pwritev "libc.so" //go:cgo_import_dynamic libc_pwritev pwritev "libc.so"
//go:cgo_import_dynamic libc_accept4 accept4 "libc.so"
//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so"
//go:linkname procreadv libc_readv //go:linkname procreadv libc_readv
//go:linkname procpreadv libc_preadv //go:linkname procpreadv libc_preadv
//go:linkname procwritev libc_writev //go:linkname procwritev libc_writev
//go:linkname procpwritev libc_pwritev //go:linkname procpwritev libc_pwritev
//go:linkname procaccept4 libc_accept4
//go:linkname procpipe2 libc_pipe2
var ( var (
procreadv, procreadv,
procpreadv, procpreadv,
procwritev, procwritev,
procpwritev syscallFunc procpwritev,
procaccept4,
procpipe2 syscallFunc
) )
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@ -85,3 +91,24 @@ func pwritev(fd int, iovs []Iovec, off int64) (n int, err error) {
} }
return return
} }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept4)), 4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
fd = int(r0)
if e1 != 0 {
err = e1
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe2(p *[2]_C_int, flags int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0, 0, 0, 0)
if e1 != 0 {
err = e1
}
return
}

View File

@ -83,6 +83,22 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_OPENAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(open_how)), uintptr(size), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0) n = int(r0)

View File

@ -1,7 +1,7 @@
// go run mksyscall.go -tags darwin,arm64,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.1_11.go syscall_darwin_arm64.go // go run mksyscall.go -openbsd -tags openbsd,mips64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_mips64.go
// Code generated by the command above; see README.md. DO NOT EDIT. // Code generated by the command above; see README.md. DO NOT EDIT.
// +build darwin,arm64,!go1.12 // +build openbsd,mips64
package unix package unix
@ -350,8 +350,8 @@ func Munlockall() (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { func pipe2(p *[2]_C_int, flags int) (err error) {
_, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -360,10 +360,15 @@ func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintp
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe() (r int, w int, err error) { func Getdents(fd int, buf []byte) (n int, err error) {
r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) var _p0 unsafe.Pointer
r = int(r0) if len(buf) > 0 {
w = int(r1) _p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -372,163 +377,15 @@ func pipe() (r int, w int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { func Getcwd(buf []byte) (n int, err error) {
var _p0 *byte var _p0 unsafe.Pointer
_p0, err = BytePtrFromString(path) if len(buf) > 0 {
if err != nil { _p0 = unsafe.Pointer(&buf[0])
return } else {
_p0 = unsafe.Pointer(&_zero)
} }
var _p1 *byte r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
_p1, err = BytePtrFromString(attr) n = int(r0)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(attr)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func removexattr(path string, attr string, options int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fremovexattr(fd int, attr string, options int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func listxattr(path string, dest *byte, size int, options int) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0)
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) {
r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0)
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) {
_, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fcntl(fd int, cmd int, arg int) (val int, err error) {
r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func kill(pid int, signum int, posix int) (err error) {
_, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix))
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -554,7 +411,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
} else { } else {
_p0 = unsafe.Pointer(&_zero) _p0 = unsafe.Pointer(&_zero)
} }
_, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -563,8 +420,9 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -704,18 +562,8 @@ func Dup2(from int, to int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Exchangedata(path1 string, path2 string, options int) (err error) { func Dup3(from int, to int, flags int) (err error) {
var _p0 *byte _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags))
_p0, err = BytePtrFromString(path1)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(path2)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options))
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -837,6 +685,41 @@ func Fpathconf(fd int, name int) (val int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstat(fd int, stat *Stat_t) (err error) {
_, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatfs(fd int, stat *Statfs_t) (err error) {
_, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fsync(fd int) (err error) { func Fsync(fd int) (err error) {
_, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
if e1 != 0 { if e1 != 0 {
@ -848,7 +731,7 @@ func Fsync(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ftruncate(fd int, length int64) (err error) { func Ftruncate(fd int, length int64) (err error) {
_, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length))
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -857,14 +740,6 @@ func Ftruncate(fd int, length int64) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getdtablesize() (size int) {
r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0)
size = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) { func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
egid = int(r0) egid = int(r0)
@ -945,6 +820,17 @@ func Getrlimit(which int, lim *Rlimit) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrtable() (rtable int, err error) {
r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0)
rtable = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) { func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 { if e1 != 0 {
@ -966,8 +852,8 @@ func Getsid(pid int) (sid int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettimeofday(tp *Timeval) (err error) { func Gettimeofday(tv *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -985,13 +871,23 @@ func Getuid() (uid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Issetugid() (tainted bool) { func Issetugid() (tainted bool) {
r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0)
tainted = bool(r0 != 0) tainted = bool(r0 != 0)
return return
} }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kill(pid int, signum syscall.Signal) (err error) {
_, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kqueue() (fd int, err error) { func Kqueue() (fd int, err error) {
r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0)
fd = int(r0) fd = int(r0)
@ -1068,6 +964,21 @@ func Listen(s int, backlog int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lstat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkdir(path string, mode uint32) (err error) { func Mkdir(path string, mode uint32) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
@ -1113,6 +1024,21 @@ func Mkfifo(path string, mode uint32) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkfifoat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mknod(path string, mode uint32, dev int) (err error) { func Mknod(path string, mode uint32, dev int) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
@ -1128,6 +1054,31 @@ func Mknod(path string, mode uint32, dev int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
_, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Open(path string, mode int, perm uint32) (fd int, err error) { func Open(path string, mode int, perm uint32) (fd int, err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
@ -1183,7 +1134,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) {
} else { } else {
_p0 = unsafe.Pointer(&_zero) _p0 = unsafe.Pointer(&_zero)
} }
r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0)
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
@ -1200,7 +1151,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
} else { } else {
_p0 = unsafe.Pointer(&_zero) _p0 = unsafe.Pointer(&_zero)
} }
r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0)
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
@ -1342,7 +1293,7 @@ func Rmdir(path string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0)
newoffset = int64(r0) newoffset = int64(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
@ -1364,7 +1315,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setegid(egid int) (err error) { func Setegid(egid int) (err error) {
_, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -1428,16 +1379,6 @@ func Setpriority(which int, who int, prio int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setprivexec(flag int) (err error) {
_, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setregid(rgid int, egid int) (err error) { func Setregid(rgid int, egid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
if e1 != 0 { if e1 != 0 {
@ -1458,6 +1399,26 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresgid(rgid int, egid int, sgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresuid(ruid int, euid int, suid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setrlimit(which int, lim *Rlimit) (err error) { func Setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 { if e1 != 0 {
@ -1468,6 +1429,16 @@ func Setrlimit(which int, lim *Rlimit) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setrtable(rtable int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setsid() (pid int, err error) { func Setsid() (pid int, err error) {
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
pid = int(r0) pid = int(r0)
@ -1499,6 +1470,36 @@ func Setuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Stat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Statfs(path string, stat *Statfs_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Symlink(path string, link string) (err error) { func Symlink(path string, link string) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
@ -1555,7 +1556,7 @@ func Truncate(path string, length int64) (err error) {
if err != nil { if err != nil {
return return
} }
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length))
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }
@ -1572,21 +1573,6 @@ func Umask(newmask int) (oldmask int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Undelete(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unlink(path string) (err error) { func Unlink(path string) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
@ -1650,7 +1636,7 @@ func write(fd int, p []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0)
ret = uintptr(r0) ret = uintptr(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
@ -1692,89 +1678,13 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstat(fd int, stat *Stat_t) (err error) { func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
_, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
if err != nil { if err != nil {
return return
} }
_, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatfs(fd int, stat *Statfs_t) (err error) {
_, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(buf), uintptr(size), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lstat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Stat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Statfs(path string, stat *Statfs_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)
} }

279
vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go generated vendored Normal file
View File

@ -0,0 +1,279 @@
// go run mksysctl_openbsd.go
// Code generated by the command above; DO NOT EDIT.
// +build mips64,openbsd
package unix
type mibentry struct {
ctlname string
ctloid []_C_int
}
var sysctlMib = []mibentry{
{"ddb.console", []_C_int{9, 6}},
{"ddb.log", []_C_int{9, 7}},
{"ddb.max_line", []_C_int{9, 3}},
{"ddb.max_width", []_C_int{9, 2}},
{"ddb.panic", []_C_int{9, 5}},
{"ddb.profile", []_C_int{9, 9}},
{"ddb.radix", []_C_int{9, 1}},
{"ddb.tab_stop_width", []_C_int{9, 4}},
{"ddb.trigger", []_C_int{9, 8}},
{"fs.posix.setuid", []_C_int{3, 1, 1}},
{"hw.allowpowerdown", []_C_int{6, 22}},
{"hw.byteorder", []_C_int{6, 4}},
{"hw.cpuspeed", []_C_int{6, 12}},
{"hw.diskcount", []_C_int{6, 10}},
{"hw.disknames", []_C_int{6, 8}},
{"hw.diskstats", []_C_int{6, 9}},
{"hw.machine", []_C_int{6, 1}},
{"hw.model", []_C_int{6, 2}},
{"hw.ncpu", []_C_int{6, 3}},
{"hw.ncpufound", []_C_int{6, 21}},
{"hw.ncpuonline", []_C_int{6, 25}},
{"hw.pagesize", []_C_int{6, 7}},
{"hw.perfpolicy", []_C_int{6, 23}},
{"hw.physmem", []_C_int{6, 19}},
{"hw.product", []_C_int{6, 15}},
{"hw.serialno", []_C_int{6, 17}},
{"hw.setperf", []_C_int{6, 13}},
{"hw.smt", []_C_int{6, 24}},
{"hw.usermem", []_C_int{6, 20}},
{"hw.uuid", []_C_int{6, 18}},
{"hw.vendor", []_C_int{6, 14}},
{"hw.version", []_C_int{6, 16}},
{"kern.allowdt", []_C_int{1, 65}},
{"kern.allowkmem", []_C_int{1, 52}},
{"kern.argmax", []_C_int{1, 8}},
{"kern.audio", []_C_int{1, 84}},
{"kern.boottime", []_C_int{1, 21}},
{"kern.bufcachepercent", []_C_int{1, 72}},
{"kern.ccpu", []_C_int{1, 45}},
{"kern.clockrate", []_C_int{1, 12}},
{"kern.consbuf", []_C_int{1, 83}},
{"kern.consbufsize", []_C_int{1, 82}},
{"kern.consdev", []_C_int{1, 75}},
{"kern.cp_time", []_C_int{1, 40}},
{"kern.cp_time2", []_C_int{1, 71}},
{"kern.cpustats", []_C_int{1, 85}},
{"kern.domainname", []_C_int{1, 22}},
{"kern.file", []_C_int{1, 73}},
{"kern.forkstat", []_C_int{1, 42}},
{"kern.fscale", []_C_int{1, 46}},
{"kern.fsync", []_C_int{1, 33}},
{"kern.global_ptrace", []_C_int{1, 81}},
{"kern.hostid", []_C_int{1, 11}},
{"kern.hostname", []_C_int{1, 10}},
{"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}},
{"kern.job_control", []_C_int{1, 19}},
{"kern.malloc.buckets", []_C_int{1, 39, 1}},
{"kern.malloc.kmemnames", []_C_int{1, 39, 3}},
{"kern.maxclusters", []_C_int{1, 67}},
{"kern.maxfiles", []_C_int{1, 7}},
{"kern.maxlocksperuid", []_C_int{1, 70}},
{"kern.maxpartitions", []_C_int{1, 23}},
{"kern.maxproc", []_C_int{1, 6}},
{"kern.maxthread", []_C_int{1, 25}},
{"kern.maxvnodes", []_C_int{1, 5}},
{"kern.mbstat", []_C_int{1, 59}},
{"kern.msgbuf", []_C_int{1, 48}},
{"kern.msgbufsize", []_C_int{1, 38}},
{"kern.nchstats", []_C_int{1, 41}},
{"kern.netlivelocks", []_C_int{1, 76}},
{"kern.nfiles", []_C_int{1, 56}},
{"kern.ngroups", []_C_int{1, 18}},
{"kern.nosuidcoredump", []_C_int{1, 32}},
{"kern.nprocs", []_C_int{1, 47}},
{"kern.nselcoll", []_C_int{1, 43}},
{"kern.nthreads", []_C_int{1, 26}},
{"kern.numvnodes", []_C_int{1, 58}},
{"kern.osrelease", []_C_int{1, 2}},
{"kern.osrevision", []_C_int{1, 3}},
{"kern.ostype", []_C_int{1, 1}},
{"kern.osversion", []_C_int{1, 27}},
{"kern.pfstatus", []_C_int{1, 86}},
{"kern.pool_debug", []_C_int{1, 77}},
{"kern.posix1version", []_C_int{1, 17}},
{"kern.proc", []_C_int{1, 66}},
{"kern.rawpartition", []_C_int{1, 24}},
{"kern.saved_ids", []_C_int{1, 20}},
{"kern.securelevel", []_C_int{1, 9}},
{"kern.seminfo", []_C_int{1, 61}},
{"kern.shminfo", []_C_int{1, 62}},
{"kern.somaxconn", []_C_int{1, 28}},
{"kern.sominconn", []_C_int{1, 29}},
{"kern.splassert", []_C_int{1, 54}},
{"kern.stackgap_random", []_C_int{1, 50}},
{"kern.sysvipc_info", []_C_int{1, 51}},
{"kern.sysvmsg", []_C_int{1, 34}},
{"kern.sysvsem", []_C_int{1, 35}},
{"kern.sysvshm", []_C_int{1, 36}},
{"kern.timecounter.choice", []_C_int{1, 69, 4}},
{"kern.timecounter.hardware", []_C_int{1, 69, 3}},
{"kern.timecounter.tick", []_C_int{1, 69, 1}},
{"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}},
{"kern.timeout_stats", []_C_int{1, 87}},
{"kern.tty.tk_cancc", []_C_int{1, 44, 4}},
{"kern.tty.tk_nin", []_C_int{1, 44, 1}},
{"kern.tty.tk_nout", []_C_int{1, 44, 2}},
{"kern.tty.tk_rawcc", []_C_int{1, 44, 3}},
{"kern.tty.ttyinfo", []_C_int{1, 44, 5}},
{"kern.ttycount", []_C_int{1, 57}},
{"kern.utc_offset", []_C_int{1, 88}},
{"kern.version", []_C_int{1, 4}},
{"kern.watchdog.auto", []_C_int{1, 64, 2}},
{"kern.watchdog.period", []_C_int{1, 64, 1}},
{"kern.witnesswatch", []_C_int{1, 53}},
{"kern.wxabort", []_C_int{1, 74}},
{"net.bpf.bufsize", []_C_int{4, 31, 1}},
{"net.bpf.maxbufsize", []_C_int{4, 31, 2}},
{"net.inet.ah.enable", []_C_int{4, 2, 51, 1}},
{"net.inet.ah.stats", []_C_int{4, 2, 51, 2}},
{"net.inet.carp.allow", []_C_int{4, 2, 112, 1}},
{"net.inet.carp.log", []_C_int{4, 2, 112, 3}},
{"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}},
{"net.inet.carp.stats", []_C_int{4, 2, 112, 4}},
{"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}},
{"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}},
{"net.inet.divert.stats", []_C_int{4, 2, 258, 3}},
{"net.inet.esp.enable", []_C_int{4, 2, 50, 1}},
{"net.inet.esp.stats", []_C_int{4, 2, 50, 4}},
{"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}},
{"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}},
{"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}},
{"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}},
{"net.inet.gre.allow", []_C_int{4, 2, 47, 1}},
{"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}},
{"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}},
{"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}},
{"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}},
{"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}},
{"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}},
{"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}},
{"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}},
{"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}},
{"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}},
{"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}},
{"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}},
{"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}},
{"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}},
{"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}},
{"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}},
{"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}},
{"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}},
{"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}},
{"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}},
{"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}},
{"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}},
{"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}},
{"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}},
{"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}},
{"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}},
{"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}},
{"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}},
{"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}},
{"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}},
{"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}},
{"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}},
{"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}},
{"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}},
{"net.inet.ip.stats", []_C_int{4, 2, 0, 33}},
{"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}},
{"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}},
{"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}},
{"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}},
{"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}},
{"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}},
{"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}},
{"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}},
{"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}},
{"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}},
{"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}},
{"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}},
{"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}},
{"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}},
{"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}},
{"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}},
{"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}},
{"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}},
{"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}},
{"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}},
{"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}},
{"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}},
{"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}},
{"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}},
{"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}},
{"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}},
{"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}},
{"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}},
{"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}},
{"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}},
{"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}},
{"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}},
{"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}},
{"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}},
{"net.inet.udp.stats", []_C_int{4, 2, 17, 5}},
{"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}},
{"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}},
{"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}},
{"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}},
{"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}},
{"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}},
{"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}},
{"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}},
{"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}},
{"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}},
{"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}},
{"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}},
{"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}},
{"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}},
{"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}},
{"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}},
{"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}},
{"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}},
{"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}},
{"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}},
{"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}},
{"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}},
{"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}},
{"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}},
{"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}},
{"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}},
{"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}},
{"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}},
{"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}},
{"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}},
{"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}},
{"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}},
{"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}},
{"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}},
{"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}},
{"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}},
{"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}},
{"net.key.sadb_dump", []_C_int{4, 30, 1}},
{"net.key.spd_dump", []_C_int{4, 30, 2}},
{"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}},
{"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}},
{"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}},
{"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}},
{"net.mpls.mapttl_ip", []_C_int{4, 33, 5}},
{"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}},
{"net.mpls.ttl", []_C_int{4, 33, 2}},
{"net.pflow.stats", []_C_int{4, 34, 1}},
{"net.pipex.enable", []_C_int{4, 35, 1}},
{"vm.anonmin", []_C_int{2, 7}},
{"vm.loadavg", []_C_int{2, 2}},
{"vm.malloc_conf", []_C_int{2, 12}},
{"vm.maxslp", []_C_int{2, 10}},
{"vm.nkmempages", []_C_int{2, 6}},
{"vm.psstrings", []_C_int{2, 3}},
{"vm.swapencrypt.enable", []_C_int{2, 5, 0}},
{"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}},
{"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}},
{"vm.uspace", []_C_int{2, 11}},
{"vm.uvmexp", []_C_int{2, 4}},
{"vm.vmmeter", []_C_int{2, 1}},
{"vm.vnodemin", []_C_int{2, 9}},
{"vm.vtextmin", []_C_int{2, 8}},
}

View File

@ -1,436 +0,0 @@
// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build 386,darwin
package unix
const (
SYS_SYSCALL = 0
SYS_EXIT = 1
SYS_FORK = 2
SYS_READ = 3
SYS_WRITE = 4
SYS_OPEN = 5
SYS_CLOSE = 6
SYS_WAIT4 = 7
SYS_LINK = 9
SYS_UNLINK = 10
SYS_CHDIR = 12
SYS_FCHDIR = 13
SYS_MKNOD = 14
SYS_CHMOD = 15
SYS_CHOWN = 16
SYS_GETFSSTAT = 18
SYS_GETPID = 20
SYS_SETUID = 23
SYS_GETUID = 24
SYS_GETEUID = 25
SYS_PTRACE = 26
SYS_RECVMSG = 27
SYS_SENDMSG = 28
SYS_RECVFROM = 29
SYS_ACCEPT = 30
SYS_GETPEERNAME = 31
SYS_GETSOCKNAME = 32
SYS_ACCESS = 33
SYS_CHFLAGS = 34
SYS_FCHFLAGS = 35
SYS_SYNC = 36
SYS_KILL = 37
SYS_GETPPID = 39
SYS_DUP = 41
SYS_PIPE = 42
SYS_GETEGID = 43
SYS_SIGACTION = 46
SYS_GETGID = 47
SYS_SIGPROCMASK = 48
SYS_GETLOGIN = 49
SYS_SETLOGIN = 50
SYS_ACCT = 51
SYS_SIGPENDING = 52
SYS_SIGALTSTACK = 53
SYS_IOCTL = 54
SYS_REBOOT = 55
SYS_REVOKE = 56
SYS_SYMLINK = 57
SYS_READLINK = 58
SYS_EXECVE = 59
SYS_UMASK = 60
SYS_CHROOT = 61
SYS_MSYNC = 65
SYS_VFORK = 66
SYS_MUNMAP = 73
SYS_MPROTECT = 74
SYS_MADVISE = 75
SYS_MINCORE = 78
SYS_GETGROUPS = 79
SYS_SETGROUPS = 80
SYS_GETPGRP = 81
SYS_SETPGID = 82
SYS_SETITIMER = 83
SYS_SWAPON = 85
SYS_GETITIMER = 86
SYS_GETDTABLESIZE = 89
SYS_DUP2 = 90
SYS_FCNTL = 92
SYS_SELECT = 93
SYS_FSYNC = 95
SYS_SETPRIORITY = 96
SYS_SOCKET = 97
SYS_CONNECT = 98
SYS_GETPRIORITY = 100
SYS_BIND = 104
SYS_SETSOCKOPT = 105
SYS_LISTEN = 106
SYS_SIGSUSPEND = 111
SYS_GETTIMEOFDAY = 116
SYS_GETRUSAGE = 117
SYS_GETSOCKOPT = 118
SYS_READV = 120
SYS_WRITEV = 121
SYS_SETTIMEOFDAY = 122
SYS_FCHOWN = 123
SYS_FCHMOD = 124
SYS_SETREUID = 126
SYS_SETREGID = 127
SYS_RENAME = 128
SYS_FLOCK = 131
SYS_MKFIFO = 132
SYS_SENDTO = 133
SYS_SHUTDOWN = 134
SYS_SOCKETPAIR = 135
SYS_MKDIR = 136
SYS_RMDIR = 137
SYS_UTIMES = 138
SYS_FUTIMES = 139
SYS_ADJTIME = 140
SYS_GETHOSTUUID = 142
SYS_SETSID = 147
SYS_GETPGID = 151
SYS_SETPRIVEXEC = 152
SYS_PREAD = 153
SYS_PWRITE = 154
SYS_NFSSVC = 155
SYS_STATFS = 157
SYS_FSTATFS = 158
SYS_UNMOUNT = 159
SYS_GETFH = 161
SYS_QUOTACTL = 165
SYS_MOUNT = 167
SYS_CSOPS = 169
SYS_CSOPS_AUDITTOKEN = 170
SYS_WAITID = 173
SYS_KDEBUG_TYPEFILTER = 177
SYS_KDEBUG_TRACE_STRING = 178
SYS_KDEBUG_TRACE64 = 179
SYS_KDEBUG_TRACE = 180
SYS_SETGID = 181
SYS_SETEGID = 182
SYS_SETEUID = 183
SYS_SIGRETURN = 184
SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187
SYS_STAT = 188
SYS_FSTAT = 189
SYS_LSTAT = 190
SYS_PATHCONF = 191
SYS_FPATHCONF = 192
SYS_GETRLIMIT = 194
SYS_SETRLIMIT = 195
SYS_GETDIRENTRIES = 196
SYS_MMAP = 197
SYS_LSEEK = 199
SYS_TRUNCATE = 200
SYS_FTRUNCATE = 201
SYS_SYSCTL = 202
SYS_MLOCK = 203
SYS_MUNLOCK = 204
SYS_UNDELETE = 205
SYS_OPEN_DPROTECTED_NP = 216
SYS_GETATTRLIST = 220
SYS_SETATTRLIST = 221
SYS_GETDIRENTRIESATTR = 222
SYS_EXCHANGEDATA = 223
SYS_SEARCHFS = 225
SYS_DELETE = 226
SYS_COPYFILE = 227
SYS_FGETATTRLIST = 228
SYS_FSETATTRLIST = 229
SYS_POLL = 230
SYS_WATCHEVENT = 231
SYS_WAITEVENT = 232
SYS_MODWATCH = 233
SYS_GETXATTR = 234
SYS_FGETXATTR = 235
SYS_SETXATTR = 236
SYS_FSETXATTR = 237
SYS_REMOVEXATTR = 238
SYS_FREMOVEXATTR = 239
SYS_LISTXATTR = 240
SYS_FLISTXATTR = 241
SYS_FSCTL = 242
SYS_INITGROUPS = 243
SYS_POSIX_SPAWN = 244
SYS_FFSCTL = 245
SYS_NFSCLNT = 247
SYS_FHOPEN = 248
SYS_MINHERIT = 250
SYS_SEMSYS = 251
SYS_MSGSYS = 252
SYS_SHMSYS = 253
SYS_SEMCTL = 254
SYS_SEMGET = 255
SYS_SEMOP = 256
SYS_MSGCTL = 258
SYS_MSGGET = 259
SYS_MSGSND = 260
SYS_MSGRCV = 261
SYS_SHMAT = 262
SYS_SHMCTL = 263
SYS_SHMDT = 264
SYS_SHMGET = 265
SYS_SHM_OPEN = 266
SYS_SHM_UNLINK = 267
SYS_SEM_OPEN = 268
SYS_SEM_CLOSE = 269
SYS_SEM_UNLINK = 270
SYS_SEM_WAIT = 271
SYS_SEM_TRYWAIT = 272
SYS_SEM_POST = 273
SYS_SYSCTLBYNAME = 274
SYS_OPEN_EXTENDED = 277
SYS_UMASK_EXTENDED = 278
SYS_STAT_EXTENDED = 279
SYS_LSTAT_EXTENDED = 280
SYS_FSTAT_EXTENDED = 281
SYS_CHMOD_EXTENDED = 282
SYS_FCHMOD_EXTENDED = 283
SYS_ACCESS_EXTENDED = 284
SYS_SETTID = 285
SYS_GETTID = 286
SYS_SETSGROUPS = 287
SYS_GETSGROUPS = 288
SYS_SETWGROUPS = 289
SYS_GETWGROUPS = 290
SYS_MKFIFO_EXTENDED = 291
SYS_MKDIR_EXTENDED = 292
SYS_IDENTITYSVC = 293
SYS_SHARED_REGION_CHECK_NP = 294
SYS_VM_PRESSURE_MONITOR = 296
SYS_PSYNCH_RW_LONGRDLOCK = 297
SYS_PSYNCH_RW_YIELDWRLOCK = 298
SYS_PSYNCH_RW_DOWNGRADE = 299
SYS_PSYNCH_RW_UPGRADE = 300
SYS_PSYNCH_MUTEXWAIT = 301
SYS_PSYNCH_MUTEXDROP = 302
SYS_PSYNCH_CVBROAD = 303
SYS_PSYNCH_CVSIGNAL = 304
SYS_PSYNCH_CVWAIT = 305
SYS_PSYNCH_RW_RDLOCK = 306
SYS_PSYNCH_RW_WRLOCK = 307
SYS_PSYNCH_RW_UNLOCK = 308
SYS_PSYNCH_RW_UNLOCK2 = 309
SYS_GETSID = 310
SYS_SETTID_WITH_PID = 311
SYS_PSYNCH_CVCLRPREPOST = 312
SYS_AIO_FSYNC = 313
SYS_AIO_RETURN = 314
SYS_AIO_SUSPEND = 315
SYS_AIO_CANCEL = 316
SYS_AIO_ERROR = 317
SYS_AIO_READ = 318
SYS_AIO_WRITE = 319
SYS_LIO_LISTIO = 320
SYS_IOPOLICYSYS = 322
SYS_PROCESS_POLICY = 323
SYS_MLOCKALL = 324
SYS_MUNLOCKALL = 325
SYS_ISSETUGID = 327
SYS___PTHREAD_KILL = 328
SYS___PTHREAD_SIGMASK = 329
SYS___SIGWAIT = 330
SYS___DISABLE_THREADSIGNAL = 331
SYS___PTHREAD_MARKCANCEL = 332
SYS___PTHREAD_CANCELED = 333
SYS___SEMWAIT_SIGNAL = 334
SYS_PROC_INFO = 336
SYS_SENDFILE = 337
SYS_STAT64 = 338
SYS_FSTAT64 = 339
SYS_LSTAT64 = 340
SYS_STAT64_EXTENDED = 341
SYS_LSTAT64_EXTENDED = 342
SYS_FSTAT64_EXTENDED = 343
SYS_GETDIRENTRIES64 = 344
SYS_STATFS64 = 345
SYS_FSTATFS64 = 346
SYS_GETFSSTAT64 = 347
SYS___PTHREAD_CHDIR = 348
SYS___PTHREAD_FCHDIR = 349
SYS_AUDIT = 350
SYS_AUDITON = 351
SYS_GETAUID = 353
SYS_SETAUID = 354
SYS_GETAUDIT_ADDR = 357
SYS_SETAUDIT_ADDR = 358
SYS_AUDITCTL = 359
SYS_BSDTHREAD_CREATE = 360
SYS_BSDTHREAD_TERMINATE = 361
SYS_KQUEUE = 362
SYS_KEVENT = 363
SYS_LCHOWN = 364
SYS_BSDTHREAD_REGISTER = 366
SYS_WORKQ_OPEN = 367
SYS_WORKQ_KERNRETURN = 368
SYS_KEVENT64 = 369
SYS___OLD_SEMWAIT_SIGNAL = 370
SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371
SYS_THREAD_SELFID = 372
SYS_LEDGER = 373
SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382
SYS___MAC_SET_FILE = 383
SYS___MAC_GET_LINK = 384
SYS___MAC_SET_LINK = 385
SYS___MAC_GET_PROC = 386
SYS___MAC_SET_PROC = 387
SYS___MAC_GET_FD = 388
SYS___MAC_SET_FD = 389
SYS___MAC_GET_PID = 390
SYS_PSELECT = 394
SYS_PSELECT_NOCANCEL = 395
SYS_READ_NOCANCEL = 396
SYS_WRITE_NOCANCEL = 397
SYS_OPEN_NOCANCEL = 398
SYS_CLOSE_NOCANCEL = 399
SYS_WAIT4_NOCANCEL = 400
SYS_RECVMSG_NOCANCEL = 401
SYS_SENDMSG_NOCANCEL = 402
SYS_RECVFROM_NOCANCEL = 403
SYS_ACCEPT_NOCANCEL = 404
SYS_MSYNC_NOCANCEL = 405
SYS_FCNTL_NOCANCEL = 406
SYS_SELECT_NOCANCEL = 407
SYS_FSYNC_NOCANCEL = 408
SYS_CONNECT_NOCANCEL = 409
SYS_SIGSUSPEND_NOCANCEL = 410
SYS_READV_NOCANCEL = 411
SYS_WRITEV_NOCANCEL = 412
SYS_SENDTO_NOCANCEL = 413
SYS_PREAD_NOCANCEL = 414
SYS_PWRITE_NOCANCEL = 415
SYS_WAITID_NOCANCEL = 416
SYS_POLL_NOCANCEL = 417
SYS_MSGSND_NOCANCEL = 418
SYS_MSGRCV_NOCANCEL = 419
SYS_SEM_WAIT_NOCANCEL = 420
SYS_AIO_SUSPEND_NOCANCEL = 421
SYS___SIGWAIT_NOCANCEL = 422
SYS___SEMWAIT_SIGNAL_NOCANCEL = 423
SYS___MAC_MOUNT = 424
SYS___MAC_GET_MOUNT = 425
SYS___MAC_GETFSSTAT = 426
SYS_FSGETPATH = 427
SYS_AUDIT_SESSION_SELF = 428
SYS_AUDIT_SESSION_JOIN = 429
SYS_FILEPORT_MAKEPORT = 430
SYS_FILEPORT_MAKEFD = 431
SYS_AUDIT_SESSION_PORT = 432
SYS_PID_SUSPEND = 433
SYS_PID_RESUME = 434
SYS_PID_HIBERNATE = 435
SYS_PID_SHUTDOWN_SOCKETS = 436
SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438
SYS_KAS_INFO = 439
SYS_MEMORYSTATUS_CONTROL = 440
SYS_GUARDED_OPEN_NP = 441
SYS_GUARDED_CLOSE_NP = 442
SYS_GUARDED_KQUEUE_NP = 443
SYS_CHANGE_FDGUARD_NP = 444
SYS_USRCTL = 445
SYS_PROC_RLIMIT_CONTROL = 446
SYS_CONNECTX = 447
SYS_DISCONNECTX = 448
SYS_PEELOFF = 449
SYS_SOCKET_DELEGATE = 450
SYS_TELEMETRY = 451
SYS_PROC_UUID_POLICY = 452
SYS_MEMORYSTATUS_GET_LEVEL = 453
SYS_SYSTEM_OVERRIDE = 454
SYS_VFS_PURGE = 455
SYS_SFI_CTL = 456
SYS_SFI_PIDCTL = 457
SYS_COALITION = 458
SYS_COALITION_INFO = 459
SYS_NECP_MATCH_POLICY = 460
SYS_GETATTRLISTBULK = 461
SYS_CLONEFILEAT = 462
SYS_OPENAT = 463
SYS_OPENAT_NOCANCEL = 464
SYS_RENAMEAT = 465
SYS_FACCESSAT = 466
SYS_FCHMODAT = 467
SYS_FCHOWNAT = 468
SYS_FSTATAT = 469
SYS_FSTATAT64 = 470
SYS_LINKAT = 471
SYS_UNLINKAT = 472
SYS_READLINKAT = 473
SYS_SYMLINKAT = 474
SYS_MKDIRAT = 475
SYS_GETATTRLISTAT = 476
SYS_PROC_TRACE_LOG = 477
SYS_BSDTHREAD_CTL = 478
SYS_OPENBYID_NP = 479
SYS_RECVMSG_X = 480
SYS_SENDMSG_X = 481
SYS_THREAD_SELFUSAGE = 482
SYS_CSRCTL = 483
SYS_GUARDED_OPEN_DPROTECTED_NP = 484
SYS_GUARDED_WRITE_NP = 485
SYS_GUARDED_PWRITE_NP = 486
SYS_GUARDED_WRITEV_NP = 487
SYS_RENAMEATX_NP = 488
SYS_MREMAP_ENCRYPTED = 489
SYS_NETAGENT_TRIGGER = 490
SYS_STACK_SNAPSHOT_WITH_CONFIG = 491
SYS_MICROSTACKSHOT = 492
SYS_GRAB_PGO_DATA = 493
SYS_PERSONA = 494
SYS_WORK_INTERVAL_CTL = 499
SYS_GETENTROPY = 500
SYS_NECP_OPEN = 501
SYS_NECP_CLIENT_ACTION = 502
SYS___NEXUS_OPEN = 503
SYS___NEXUS_REGISTER = 504
SYS___NEXUS_DEREGISTER = 505
SYS___NEXUS_CREATE = 506
SYS___NEXUS_DESTROY = 507
SYS___NEXUS_GET_OPT = 508
SYS___NEXUS_SET_OPT = 509
SYS___CHANNEL_OPEN = 510
SYS___CHANNEL_GET_INFO = 511
SYS___CHANNEL_SYNC = 512
SYS___CHANNEL_GET_OPT = 513
SYS___CHANNEL_SET_OPT = 514
SYS_ULOCK_WAIT = 515
SYS_ULOCK_WAKE = 516
SYS_FCLONEFILEAT = 517
SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521
SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_MAXSYSCALL = 530
SYS_INVALID = 63
)

View File

@ -1,438 +0,0 @@
// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/syscall.h
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build amd64,darwin
package unix
const (
SYS_SYSCALL = 0
SYS_EXIT = 1
SYS_FORK = 2
SYS_READ = 3
SYS_WRITE = 4
SYS_OPEN = 5
SYS_CLOSE = 6
SYS_WAIT4 = 7
SYS_LINK = 9
SYS_UNLINK = 10
SYS_CHDIR = 12
SYS_FCHDIR = 13
SYS_MKNOD = 14
SYS_CHMOD = 15
SYS_CHOWN = 16
SYS_GETFSSTAT = 18
SYS_GETPID = 20
SYS_SETUID = 23
SYS_GETUID = 24
SYS_GETEUID = 25
SYS_PTRACE = 26
SYS_RECVMSG = 27
SYS_SENDMSG = 28
SYS_RECVFROM = 29
SYS_ACCEPT = 30
SYS_GETPEERNAME = 31
SYS_GETSOCKNAME = 32
SYS_ACCESS = 33
SYS_CHFLAGS = 34
SYS_FCHFLAGS = 35
SYS_SYNC = 36
SYS_KILL = 37
SYS_GETPPID = 39
SYS_DUP = 41
SYS_PIPE = 42
SYS_GETEGID = 43
SYS_SIGACTION = 46
SYS_GETGID = 47
SYS_SIGPROCMASK = 48
SYS_GETLOGIN = 49
SYS_SETLOGIN = 50
SYS_ACCT = 51
SYS_SIGPENDING = 52
SYS_SIGALTSTACK = 53
SYS_IOCTL = 54
SYS_REBOOT = 55
SYS_REVOKE = 56
SYS_SYMLINK = 57
SYS_READLINK = 58
SYS_EXECVE = 59
SYS_UMASK = 60
SYS_CHROOT = 61
SYS_MSYNC = 65
SYS_VFORK = 66
SYS_MUNMAP = 73
SYS_MPROTECT = 74
SYS_MADVISE = 75
SYS_MINCORE = 78
SYS_GETGROUPS = 79
SYS_SETGROUPS = 80
SYS_GETPGRP = 81
SYS_SETPGID = 82
SYS_SETITIMER = 83
SYS_SWAPON = 85
SYS_GETITIMER = 86
SYS_GETDTABLESIZE = 89
SYS_DUP2 = 90
SYS_FCNTL = 92
SYS_SELECT = 93
SYS_FSYNC = 95
SYS_SETPRIORITY = 96
SYS_SOCKET = 97
SYS_CONNECT = 98
SYS_GETPRIORITY = 100
SYS_BIND = 104
SYS_SETSOCKOPT = 105
SYS_LISTEN = 106
SYS_SIGSUSPEND = 111
SYS_GETTIMEOFDAY = 116
SYS_GETRUSAGE = 117
SYS_GETSOCKOPT = 118
SYS_READV = 120
SYS_WRITEV = 121
SYS_SETTIMEOFDAY = 122
SYS_FCHOWN = 123
SYS_FCHMOD = 124
SYS_SETREUID = 126
SYS_SETREGID = 127
SYS_RENAME = 128
SYS_FLOCK = 131
SYS_MKFIFO = 132
SYS_SENDTO = 133
SYS_SHUTDOWN = 134
SYS_SOCKETPAIR = 135
SYS_MKDIR = 136
SYS_RMDIR = 137
SYS_UTIMES = 138
SYS_FUTIMES = 139
SYS_ADJTIME = 140
SYS_GETHOSTUUID = 142
SYS_SETSID = 147
SYS_GETPGID = 151
SYS_SETPRIVEXEC = 152
SYS_PREAD = 153
SYS_PWRITE = 154
SYS_NFSSVC = 155
SYS_STATFS = 157
SYS_FSTATFS = 158
SYS_UNMOUNT = 159
SYS_GETFH = 161
SYS_QUOTACTL = 165
SYS_MOUNT = 167
SYS_CSOPS = 169
SYS_CSOPS_AUDITTOKEN = 170
SYS_WAITID = 173
SYS_KDEBUG_TYPEFILTER = 177
SYS_KDEBUG_TRACE_STRING = 178
SYS_KDEBUG_TRACE64 = 179
SYS_KDEBUG_TRACE = 180
SYS_SETGID = 181
SYS_SETEGID = 182
SYS_SETEUID = 183
SYS_SIGRETURN = 184
SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187
SYS_STAT = 188
SYS_FSTAT = 189
SYS_LSTAT = 190
SYS_PATHCONF = 191
SYS_FPATHCONF = 192
SYS_GETRLIMIT = 194
SYS_SETRLIMIT = 195
SYS_GETDIRENTRIES = 196
SYS_MMAP = 197
SYS_LSEEK = 199
SYS_TRUNCATE = 200
SYS_FTRUNCATE = 201
SYS_SYSCTL = 202
SYS_MLOCK = 203
SYS_MUNLOCK = 204
SYS_UNDELETE = 205
SYS_OPEN_DPROTECTED_NP = 216
SYS_GETATTRLIST = 220
SYS_SETATTRLIST = 221
SYS_GETDIRENTRIESATTR = 222
SYS_EXCHANGEDATA = 223
SYS_SEARCHFS = 225
SYS_DELETE = 226
SYS_COPYFILE = 227
SYS_FGETATTRLIST = 228
SYS_FSETATTRLIST = 229
SYS_POLL = 230
SYS_WATCHEVENT = 231
SYS_WAITEVENT = 232
SYS_MODWATCH = 233
SYS_GETXATTR = 234
SYS_FGETXATTR = 235
SYS_SETXATTR = 236
SYS_FSETXATTR = 237
SYS_REMOVEXATTR = 238
SYS_FREMOVEXATTR = 239
SYS_LISTXATTR = 240
SYS_FLISTXATTR = 241
SYS_FSCTL = 242
SYS_INITGROUPS = 243
SYS_POSIX_SPAWN = 244
SYS_FFSCTL = 245
SYS_NFSCLNT = 247
SYS_FHOPEN = 248
SYS_MINHERIT = 250
SYS_SEMSYS = 251
SYS_MSGSYS = 252
SYS_SHMSYS = 253
SYS_SEMCTL = 254
SYS_SEMGET = 255
SYS_SEMOP = 256
SYS_MSGCTL = 258
SYS_MSGGET = 259
SYS_MSGSND = 260
SYS_MSGRCV = 261
SYS_SHMAT = 262
SYS_SHMCTL = 263
SYS_SHMDT = 264
SYS_SHMGET = 265
SYS_SHM_OPEN = 266
SYS_SHM_UNLINK = 267
SYS_SEM_OPEN = 268
SYS_SEM_CLOSE = 269
SYS_SEM_UNLINK = 270
SYS_SEM_WAIT = 271
SYS_SEM_TRYWAIT = 272
SYS_SEM_POST = 273
SYS_SYSCTLBYNAME = 274
SYS_OPEN_EXTENDED = 277
SYS_UMASK_EXTENDED = 278
SYS_STAT_EXTENDED = 279
SYS_LSTAT_EXTENDED = 280
SYS_FSTAT_EXTENDED = 281
SYS_CHMOD_EXTENDED = 282
SYS_FCHMOD_EXTENDED = 283
SYS_ACCESS_EXTENDED = 284
SYS_SETTID = 285
SYS_GETTID = 286
SYS_SETSGROUPS = 287
SYS_GETSGROUPS = 288
SYS_SETWGROUPS = 289
SYS_GETWGROUPS = 290
SYS_MKFIFO_EXTENDED = 291
SYS_MKDIR_EXTENDED = 292
SYS_IDENTITYSVC = 293
SYS_SHARED_REGION_CHECK_NP = 294
SYS_VM_PRESSURE_MONITOR = 296
SYS_PSYNCH_RW_LONGRDLOCK = 297
SYS_PSYNCH_RW_YIELDWRLOCK = 298
SYS_PSYNCH_RW_DOWNGRADE = 299
SYS_PSYNCH_RW_UPGRADE = 300
SYS_PSYNCH_MUTEXWAIT = 301
SYS_PSYNCH_MUTEXDROP = 302
SYS_PSYNCH_CVBROAD = 303
SYS_PSYNCH_CVSIGNAL = 304
SYS_PSYNCH_CVWAIT = 305
SYS_PSYNCH_RW_RDLOCK = 306
SYS_PSYNCH_RW_WRLOCK = 307
SYS_PSYNCH_RW_UNLOCK = 308
SYS_PSYNCH_RW_UNLOCK2 = 309
SYS_GETSID = 310
SYS_SETTID_WITH_PID = 311
SYS_PSYNCH_CVCLRPREPOST = 312
SYS_AIO_FSYNC = 313
SYS_AIO_RETURN = 314
SYS_AIO_SUSPEND = 315
SYS_AIO_CANCEL = 316
SYS_AIO_ERROR = 317
SYS_AIO_READ = 318
SYS_AIO_WRITE = 319
SYS_LIO_LISTIO = 320
SYS_IOPOLICYSYS = 322
SYS_PROCESS_POLICY = 323
SYS_MLOCKALL = 324
SYS_MUNLOCKALL = 325
SYS_ISSETUGID = 327
SYS___PTHREAD_KILL = 328
SYS___PTHREAD_SIGMASK = 329
SYS___SIGWAIT = 330
SYS___DISABLE_THREADSIGNAL = 331
SYS___PTHREAD_MARKCANCEL = 332
SYS___PTHREAD_CANCELED = 333
SYS___SEMWAIT_SIGNAL = 334
SYS_PROC_INFO = 336
SYS_SENDFILE = 337
SYS_STAT64 = 338
SYS_FSTAT64 = 339
SYS_LSTAT64 = 340
SYS_STAT64_EXTENDED = 341
SYS_LSTAT64_EXTENDED = 342
SYS_FSTAT64_EXTENDED = 343
SYS_GETDIRENTRIES64 = 344
SYS_STATFS64 = 345
SYS_FSTATFS64 = 346
SYS_GETFSSTAT64 = 347
SYS___PTHREAD_CHDIR = 348
SYS___PTHREAD_FCHDIR = 349
SYS_AUDIT = 350
SYS_AUDITON = 351
SYS_GETAUID = 353
SYS_SETAUID = 354
SYS_GETAUDIT_ADDR = 357
SYS_SETAUDIT_ADDR = 358
SYS_AUDITCTL = 359
SYS_BSDTHREAD_CREATE = 360
SYS_BSDTHREAD_TERMINATE = 361
SYS_KQUEUE = 362
SYS_KEVENT = 363
SYS_LCHOWN = 364
SYS_BSDTHREAD_REGISTER = 366
SYS_WORKQ_OPEN = 367
SYS_WORKQ_KERNRETURN = 368
SYS_KEVENT64 = 369
SYS___OLD_SEMWAIT_SIGNAL = 370
SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371
SYS_THREAD_SELFID = 372
SYS_LEDGER = 373
SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382
SYS___MAC_SET_FILE = 383
SYS___MAC_GET_LINK = 384
SYS___MAC_SET_LINK = 385
SYS___MAC_GET_PROC = 386
SYS___MAC_SET_PROC = 387
SYS___MAC_GET_FD = 388
SYS___MAC_SET_FD = 389
SYS___MAC_GET_PID = 390
SYS_PSELECT = 394
SYS_PSELECT_NOCANCEL = 395
SYS_READ_NOCANCEL = 396
SYS_WRITE_NOCANCEL = 397
SYS_OPEN_NOCANCEL = 398
SYS_CLOSE_NOCANCEL = 399
SYS_WAIT4_NOCANCEL = 400
SYS_RECVMSG_NOCANCEL = 401
SYS_SENDMSG_NOCANCEL = 402
SYS_RECVFROM_NOCANCEL = 403
SYS_ACCEPT_NOCANCEL = 404
SYS_MSYNC_NOCANCEL = 405
SYS_FCNTL_NOCANCEL = 406
SYS_SELECT_NOCANCEL = 407
SYS_FSYNC_NOCANCEL = 408
SYS_CONNECT_NOCANCEL = 409
SYS_SIGSUSPEND_NOCANCEL = 410
SYS_READV_NOCANCEL = 411
SYS_WRITEV_NOCANCEL = 412
SYS_SENDTO_NOCANCEL = 413
SYS_PREAD_NOCANCEL = 414
SYS_PWRITE_NOCANCEL = 415
SYS_WAITID_NOCANCEL = 416
SYS_POLL_NOCANCEL = 417
SYS_MSGSND_NOCANCEL = 418
SYS_MSGRCV_NOCANCEL = 419
SYS_SEM_WAIT_NOCANCEL = 420
SYS_AIO_SUSPEND_NOCANCEL = 421
SYS___SIGWAIT_NOCANCEL = 422
SYS___SEMWAIT_SIGNAL_NOCANCEL = 423
SYS___MAC_MOUNT = 424
SYS___MAC_GET_MOUNT = 425
SYS___MAC_GETFSSTAT = 426
SYS_FSGETPATH = 427
SYS_AUDIT_SESSION_SELF = 428
SYS_AUDIT_SESSION_JOIN = 429
SYS_FILEPORT_MAKEPORT = 430
SYS_FILEPORT_MAKEFD = 431
SYS_AUDIT_SESSION_PORT = 432
SYS_PID_SUSPEND = 433
SYS_PID_RESUME = 434
SYS_PID_HIBERNATE = 435
SYS_PID_SHUTDOWN_SOCKETS = 436
SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438
SYS_KAS_INFO = 439
SYS_MEMORYSTATUS_CONTROL = 440
SYS_GUARDED_OPEN_NP = 441
SYS_GUARDED_CLOSE_NP = 442
SYS_GUARDED_KQUEUE_NP = 443
SYS_CHANGE_FDGUARD_NP = 444
SYS_USRCTL = 445
SYS_PROC_RLIMIT_CONTROL = 446
SYS_CONNECTX = 447
SYS_DISCONNECTX = 448
SYS_PEELOFF = 449
SYS_SOCKET_DELEGATE = 450
SYS_TELEMETRY = 451
SYS_PROC_UUID_POLICY = 452
SYS_MEMORYSTATUS_GET_LEVEL = 453
SYS_SYSTEM_OVERRIDE = 454
SYS_VFS_PURGE = 455
SYS_SFI_CTL = 456
SYS_SFI_PIDCTL = 457
SYS_COALITION = 458
SYS_COALITION_INFO = 459
SYS_NECP_MATCH_POLICY = 460
SYS_GETATTRLISTBULK = 461
SYS_CLONEFILEAT = 462
SYS_OPENAT = 463
SYS_OPENAT_NOCANCEL = 464
SYS_RENAMEAT = 465
SYS_FACCESSAT = 466
SYS_FCHMODAT = 467
SYS_FCHOWNAT = 468
SYS_FSTATAT = 469
SYS_FSTATAT64 = 470
SYS_LINKAT = 471
SYS_UNLINKAT = 472
SYS_READLINKAT = 473
SYS_SYMLINKAT = 474
SYS_MKDIRAT = 475
SYS_GETATTRLISTAT = 476
SYS_PROC_TRACE_LOG = 477
SYS_BSDTHREAD_CTL = 478
SYS_OPENBYID_NP = 479
SYS_RECVMSG_X = 480
SYS_SENDMSG_X = 481
SYS_THREAD_SELFUSAGE = 482
SYS_CSRCTL = 483
SYS_GUARDED_OPEN_DPROTECTED_NP = 484
SYS_GUARDED_WRITE_NP = 485
SYS_GUARDED_PWRITE_NP = 486
SYS_GUARDED_WRITEV_NP = 487
SYS_RENAMEATX_NP = 488
SYS_MREMAP_ENCRYPTED = 489
SYS_NETAGENT_TRIGGER = 490
SYS_STACK_SNAPSHOT_WITH_CONFIG = 491
SYS_MICROSTACKSHOT = 492
SYS_GRAB_PGO_DATA = 493
SYS_PERSONA = 494
SYS_WORK_INTERVAL_CTL = 499
SYS_GETENTROPY = 500
SYS_NECP_OPEN = 501
SYS_NECP_CLIENT_ACTION = 502
SYS___NEXUS_OPEN = 503
SYS___NEXUS_REGISTER = 504
SYS___NEXUS_DEREGISTER = 505
SYS___NEXUS_CREATE = 506
SYS___NEXUS_DESTROY = 507
SYS___NEXUS_GET_OPT = 508
SYS___NEXUS_SET_OPT = 509
SYS___CHANNEL_OPEN = 510
SYS___CHANNEL_GET_INFO = 511
SYS___CHANNEL_SYNC = 512
SYS___CHANNEL_GET_OPT = 513
SYS___CHANNEL_SET_OPT = 514
SYS_ULOCK_WAIT = 515
SYS_ULOCK_WAKE = 516
SYS_FCLONEFILEAT = 517
SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521
SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_KQUEUE_WORKLOOP_CTL = 530
SYS___MACH_BRIDGE_REMOTE_TIME = 531
SYS_MAXSYSCALL = 532
SYS_INVALID = 63
)

View File

@ -1,436 +0,0 @@
// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm,darwin
package unix
const (
SYS_SYSCALL = 0
SYS_EXIT = 1
SYS_FORK = 2
SYS_READ = 3
SYS_WRITE = 4
SYS_OPEN = 5
SYS_CLOSE = 6
SYS_WAIT4 = 7
SYS_LINK = 9
SYS_UNLINK = 10
SYS_CHDIR = 12
SYS_FCHDIR = 13
SYS_MKNOD = 14
SYS_CHMOD = 15
SYS_CHOWN = 16
SYS_GETFSSTAT = 18
SYS_GETPID = 20
SYS_SETUID = 23
SYS_GETUID = 24
SYS_GETEUID = 25
SYS_PTRACE = 26
SYS_RECVMSG = 27
SYS_SENDMSG = 28
SYS_RECVFROM = 29
SYS_ACCEPT = 30
SYS_GETPEERNAME = 31
SYS_GETSOCKNAME = 32
SYS_ACCESS = 33
SYS_CHFLAGS = 34
SYS_FCHFLAGS = 35
SYS_SYNC = 36
SYS_KILL = 37
SYS_GETPPID = 39
SYS_DUP = 41
SYS_PIPE = 42
SYS_GETEGID = 43
SYS_SIGACTION = 46
SYS_GETGID = 47
SYS_SIGPROCMASK = 48
SYS_GETLOGIN = 49
SYS_SETLOGIN = 50
SYS_ACCT = 51
SYS_SIGPENDING = 52
SYS_SIGALTSTACK = 53
SYS_IOCTL = 54
SYS_REBOOT = 55
SYS_REVOKE = 56
SYS_SYMLINK = 57
SYS_READLINK = 58
SYS_EXECVE = 59
SYS_UMASK = 60
SYS_CHROOT = 61
SYS_MSYNC = 65
SYS_VFORK = 66
SYS_MUNMAP = 73
SYS_MPROTECT = 74
SYS_MADVISE = 75
SYS_MINCORE = 78
SYS_GETGROUPS = 79
SYS_SETGROUPS = 80
SYS_GETPGRP = 81
SYS_SETPGID = 82
SYS_SETITIMER = 83
SYS_SWAPON = 85
SYS_GETITIMER = 86
SYS_GETDTABLESIZE = 89
SYS_DUP2 = 90
SYS_FCNTL = 92
SYS_SELECT = 93
SYS_FSYNC = 95
SYS_SETPRIORITY = 96
SYS_SOCKET = 97
SYS_CONNECT = 98
SYS_GETPRIORITY = 100
SYS_BIND = 104
SYS_SETSOCKOPT = 105
SYS_LISTEN = 106
SYS_SIGSUSPEND = 111
SYS_GETTIMEOFDAY = 116
SYS_GETRUSAGE = 117
SYS_GETSOCKOPT = 118
SYS_READV = 120
SYS_WRITEV = 121
SYS_SETTIMEOFDAY = 122
SYS_FCHOWN = 123
SYS_FCHMOD = 124
SYS_SETREUID = 126
SYS_SETREGID = 127
SYS_RENAME = 128
SYS_FLOCK = 131
SYS_MKFIFO = 132
SYS_SENDTO = 133
SYS_SHUTDOWN = 134
SYS_SOCKETPAIR = 135
SYS_MKDIR = 136
SYS_RMDIR = 137
SYS_UTIMES = 138
SYS_FUTIMES = 139
SYS_ADJTIME = 140
SYS_GETHOSTUUID = 142
SYS_SETSID = 147
SYS_GETPGID = 151
SYS_SETPRIVEXEC = 152
SYS_PREAD = 153
SYS_PWRITE = 154
SYS_NFSSVC = 155
SYS_STATFS = 157
SYS_FSTATFS = 158
SYS_UNMOUNT = 159
SYS_GETFH = 161
SYS_QUOTACTL = 165
SYS_MOUNT = 167
SYS_CSOPS = 169
SYS_CSOPS_AUDITTOKEN = 170
SYS_WAITID = 173
SYS_KDEBUG_TYPEFILTER = 177
SYS_KDEBUG_TRACE_STRING = 178
SYS_KDEBUG_TRACE64 = 179
SYS_KDEBUG_TRACE = 180
SYS_SETGID = 181
SYS_SETEGID = 182
SYS_SETEUID = 183
SYS_SIGRETURN = 184
SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187
SYS_STAT = 188
SYS_FSTAT = 189
SYS_LSTAT = 190
SYS_PATHCONF = 191
SYS_FPATHCONF = 192
SYS_GETRLIMIT = 194
SYS_SETRLIMIT = 195
SYS_GETDIRENTRIES = 196
SYS_MMAP = 197
SYS_LSEEK = 199
SYS_TRUNCATE = 200
SYS_FTRUNCATE = 201
SYS_SYSCTL = 202
SYS_MLOCK = 203
SYS_MUNLOCK = 204
SYS_UNDELETE = 205
SYS_OPEN_DPROTECTED_NP = 216
SYS_GETATTRLIST = 220
SYS_SETATTRLIST = 221
SYS_GETDIRENTRIESATTR = 222
SYS_EXCHANGEDATA = 223
SYS_SEARCHFS = 225
SYS_DELETE = 226
SYS_COPYFILE = 227
SYS_FGETATTRLIST = 228
SYS_FSETATTRLIST = 229
SYS_POLL = 230
SYS_WATCHEVENT = 231
SYS_WAITEVENT = 232
SYS_MODWATCH = 233
SYS_GETXATTR = 234
SYS_FGETXATTR = 235
SYS_SETXATTR = 236
SYS_FSETXATTR = 237
SYS_REMOVEXATTR = 238
SYS_FREMOVEXATTR = 239
SYS_LISTXATTR = 240
SYS_FLISTXATTR = 241
SYS_FSCTL = 242
SYS_INITGROUPS = 243
SYS_POSIX_SPAWN = 244
SYS_FFSCTL = 245
SYS_NFSCLNT = 247
SYS_FHOPEN = 248
SYS_MINHERIT = 250
SYS_SEMSYS = 251
SYS_MSGSYS = 252
SYS_SHMSYS = 253
SYS_SEMCTL = 254
SYS_SEMGET = 255
SYS_SEMOP = 256
SYS_MSGCTL = 258
SYS_MSGGET = 259
SYS_MSGSND = 260
SYS_MSGRCV = 261
SYS_SHMAT = 262
SYS_SHMCTL = 263
SYS_SHMDT = 264
SYS_SHMGET = 265
SYS_SHM_OPEN = 266
SYS_SHM_UNLINK = 267
SYS_SEM_OPEN = 268
SYS_SEM_CLOSE = 269
SYS_SEM_UNLINK = 270
SYS_SEM_WAIT = 271
SYS_SEM_TRYWAIT = 272
SYS_SEM_POST = 273
SYS_SYSCTLBYNAME = 274
SYS_OPEN_EXTENDED = 277
SYS_UMASK_EXTENDED = 278
SYS_STAT_EXTENDED = 279
SYS_LSTAT_EXTENDED = 280
SYS_FSTAT_EXTENDED = 281
SYS_CHMOD_EXTENDED = 282
SYS_FCHMOD_EXTENDED = 283
SYS_ACCESS_EXTENDED = 284
SYS_SETTID = 285
SYS_GETTID = 286
SYS_SETSGROUPS = 287
SYS_GETSGROUPS = 288
SYS_SETWGROUPS = 289
SYS_GETWGROUPS = 290
SYS_MKFIFO_EXTENDED = 291
SYS_MKDIR_EXTENDED = 292
SYS_IDENTITYSVC = 293
SYS_SHARED_REGION_CHECK_NP = 294
SYS_VM_PRESSURE_MONITOR = 296
SYS_PSYNCH_RW_LONGRDLOCK = 297
SYS_PSYNCH_RW_YIELDWRLOCK = 298
SYS_PSYNCH_RW_DOWNGRADE = 299
SYS_PSYNCH_RW_UPGRADE = 300
SYS_PSYNCH_MUTEXWAIT = 301
SYS_PSYNCH_MUTEXDROP = 302
SYS_PSYNCH_CVBROAD = 303
SYS_PSYNCH_CVSIGNAL = 304
SYS_PSYNCH_CVWAIT = 305
SYS_PSYNCH_RW_RDLOCK = 306
SYS_PSYNCH_RW_WRLOCK = 307
SYS_PSYNCH_RW_UNLOCK = 308
SYS_PSYNCH_RW_UNLOCK2 = 309
SYS_GETSID = 310
SYS_SETTID_WITH_PID = 311
SYS_PSYNCH_CVCLRPREPOST = 312
SYS_AIO_FSYNC = 313
SYS_AIO_RETURN = 314
SYS_AIO_SUSPEND = 315
SYS_AIO_CANCEL = 316
SYS_AIO_ERROR = 317
SYS_AIO_READ = 318
SYS_AIO_WRITE = 319
SYS_LIO_LISTIO = 320
SYS_IOPOLICYSYS = 322
SYS_PROCESS_POLICY = 323
SYS_MLOCKALL = 324
SYS_MUNLOCKALL = 325
SYS_ISSETUGID = 327
SYS___PTHREAD_KILL = 328
SYS___PTHREAD_SIGMASK = 329
SYS___SIGWAIT = 330
SYS___DISABLE_THREADSIGNAL = 331
SYS___PTHREAD_MARKCANCEL = 332
SYS___PTHREAD_CANCELED = 333
SYS___SEMWAIT_SIGNAL = 334
SYS_PROC_INFO = 336
SYS_SENDFILE = 337
SYS_STAT64 = 338
SYS_FSTAT64 = 339
SYS_LSTAT64 = 340
SYS_STAT64_EXTENDED = 341
SYS_LSTAT64_EXTENDED = 342
SYS_FSTAT64_EXTENDED = 343
SYS_GETDIRENTRIES64 = 344
SYS_STATFS64 = 345
SYS_FSTATFS64 = 346
SYS_GETFSSTAT64 = 347
SYS___PTHREAD_CHDIR = 348
SYS___PTHREAD_FCHDIR = 349
SYS_AUDIT = 350
SYS_AUDITON = 351
SYS_GETAUID = 353
SYS_SETAUID = 354
SYS_GETAUDIT_ADDR = 357
SYS_SETAUDIT_ADDR = 358
SYS_AUDITCTL = 359
SYS_BSDTHREAD_CREATE = 360
SYS_BSDTHREAD_TERMINATE = 361
SYS_KQUEUE = 362
SYS_KEVENT = 363
SYS_LCHOWN = 364
SYS_BSDTHREAD_REGISTER = 366
SYS_WORKQ_OPEN = 367
SYS_WORKQ_KERNRETURN = 368
SYS_KEVENT64 = 369
SYS___OLD_SEMWAIT_SIGNAL = 370
SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371
SYS_THREAD_SELFID = 372
SYS_LEDGER = 373
SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382
SYS___MAC_SET_FILE = 383
SYS___MAC_GET_LINK = 384
SYS___MAC_SET_LINK = 385
SYS___MAC_GET_PROC = 386
SYS___MAC_SET_PROC = 387
SYS___MAC_GET_FD = 388
SYS___MAC_SET_FD = 389
SYS___MAC_GET_PID = 390
SYS_PSELECT = 394
SYS_PSELECT_NOCANCEL = 395
SYS_READ_NOCANCEL = 396
SYS_WRITE_NOCANCEL = 397
SYS_OPEN_NOCANCEL = 398
SYS_CLOSE_NOCANCEL = 399
SYS_WAIT4_NOCANCEL = 400
SYS_RECVMSG_NOCANCEL = 401
SYS_SENDMSG_NOCANCEL = 402
SYS_RECVFROM_NOCANCEL = 403
SYS_ACCEPT_NOCANCEL = 404
SYS_MSYNC_NOCANCEL = 405
SYS_FCNTL_NOCANCEL = 406
SYS_SELECT_NOCANCEL = 407
SYS_FSYNC_NOCANCEL = 408
SYS_CONNECT_NOCANCEL = 409
SYS_SIGSUSPEND_NOCANCEL = 410
SYS_READV_NOCANCEL = 411
SYS_WRITEV_NOCANCEL = 412
SYS_SENDTO_NOCANCEL = 413
SYS_PREAD_NOCANCEL = 414
SYS_PWRITE_NOCANCEL = 415
SYS_WAITID_NOCANCEL = 416
SYS_POLL_NOCANCEL = 417
SYS_MSGSND_NOCANCEL = 418
SYS_MSGRCV_NOCANCEL = 419
SYS_SEM_WAIT_NOCANCEL = 420
SYS_AIO_SUSPEND_NOCANCEL = 421
SYS___SIGWAIT_NOCANCEL = 422
SYS___SEMWAIT_SIGNAL_NOCANCEL = 423
SYS___MAC_MOUNT = 424
SYS___MAC_GET_MOUNT = 425
SYS___MAC_GETFSSTAT = 426
SYS_FSGETPATH = 427
SYS_AUDIT_SESSION_SELF = 428
SYS_AUDIT_SESSION_JOIN = 429
SYS_FILEPORT_MAKEPORT = 430
SYS_FILEPORT_MAKEFD = 431
SYS_AUDIT_SESSION_PORT = 432
SYS_PID_SUSPEND = 433
SYS_PID_RESUME = 434
SYS_PID_HIBERNATE = 435
SYS_PID_SHUTDOWN_SOCKETS = 436
SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438
SYS_KAS_INFO = 439
SYS_MEMORYSTATUS_CONTROL = 440
SYS_GUARDED_OPEN_NP = 441
SYS_GUARDED_CLOSE_NP = 442
SYS_GUARDED_KQUEUE_NP = 443
SYS_CHANGE_FDGUARD_NP = 444
SYS_USRCTL = 445
SYS_PROC_RLIMIT_CONTROL = 446
SYS_CONNECTX = 447
SYS_DISCONNECTX = 448
SYS_PEELOFF = 449
SYS_SOCKET_DELEGATE = 450
SYS_TELEMETRY = 451
SYS_PROC_UUID_POLICY = 452
SYS_MEMORYSTATUS_GET_LEVEL = 453
SYS_SYSTEM_OVERRIDE = 454
SYS_VFS_PURGE = 455
SYS_SFI_CTL = 456
SYS_SFI_PIDCTL = 457
SYS_COALITION = 458
SYS_COALITION_INFO = 459
SYS_NECP_MATCH_POLICY = 460
SYS_GETATTRLISTBULK = 461
SYS_CLONEFILEAT = 462
SYS_OPENAT = 463
SYS_OPENAT_NOCANCEL = 464
SYS_RENAMEAT = 465
SYS_FACCESSAT = 466
SYS_FCHMODAT = 467
SYS_FCHOWNAT = 468
SYS_FSTATAT = 469
SYS_FSTATAT64 = 470
SYS_LINKAT = 471
SYS_UNLINKAT = 472
SYS_READLINKAT = 473
SYS_SYMLINKAT = 474
SYS_MKDIRAT = 475
SYS_GETATTRLISTAT = 476
SYS_PROC_TRACE_LOG = 477
SYS_BSDTHREAD_CTL = 478
SYS_OPENBYID_NP = 479
SYS_RECVMSG_X = 480
SYS_SENDMSG_X = 481
SYS_THREAD_SELFUSAGE = 482
SYS_CSRCTL = 483
SYS_GUARDED_OPEN_DPROTECTED_NP = 484
SYS_GUARDED_WRITE_NP = 485
SYS_GUARDED_PWRITE_NP = 486
SYS_GUARDED_WRITEV_NP = 487
SYS_RENAMEATX_NP = 488
SYS_MREMAP_ENCRYPTED = 489
SYS_NETAGENT_TRIGGER = 490
SYS_STACK_SNAPSHOT_WITH_CONFIG = 491
SYS_MICROSTACKSHOT = 492
SYS_GRAB_PGO_DATA = 493
SYS_PERSONA = 494
SYS_WORK_INTERVAL_CTL = 499
SYS_GETENTROPY = 500
SYS_NECP_OPEN = 501
SYS_NECP_CLIENT_ACTION = 502
SYS___NEXUS_OPEN = 503
SYS___NEXUS_REGISTER = 504
SYS___NEXUS_DEREGISTER = 505
SYS___NEXUS_CREATE = 506
SYS___NEXUS_DESTROY = 507
SYS___NEXUS_GET_OPT = 508
SYS___NEXUS_SET_OPT = 509
SYS___CHANNEL_OPEN = 510
SYS___CHANNEL_GET_INFO = 511
SYS___CHANNEL_SYNC = 512
SYS___CHANNEL_GET_OPT = 513
SYS___CHANNEL_SET_OPT = 514
SYS_ULOCK_WAIT = 515
SYS_ULOCK_WAKE = 516
SYS_FCLONEFILEAT = 517
SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521
SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_MAXSYSCALL = 530
SYS_INVALID = 63
)

View File

@ -1,436 +0,0 @@
// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm64,darwin
package unix
const (
SYS_SYSCALL = 0
SYS_EXIT = 1
SYS_FORK = 2
SYS_READ = 3
SYS_WRITE = 4
SYS_OPEN = 5
SYS_CLOSE = 6
SYS_WAIT4 = 7
SYS_LINK = 9
SYS_UNLINK = 10
SYS_CHDIR = 12
SYS_FCHDIR = 13
SYS_MKNOD = 14
SYS_CHMOD = 15
SYS_CHOWN = 16
SYS_GETFSSTAT = 18
SYS_GETPID = 20
SYS_SETUID = 23
SYS_GETUID = 24
SYS_GETEUID = 25
SYS_PTRACE = 26
SYS_RECVMSG = 27
SYS_SENDMSG = 28
SYS_RECVFROM = 29
SYS_ACCEPT = 30
SYS_GETPEERNAME = 31
SYS_GETSOCKNAME = 32
SYS_ACCESS = 33
SYS_CHFLAGS = 34
SYS_FCHFLAGS = 35
SYS_SYNC = 36
SYS_KILL = 37
SYS_GETPPID = 39
SYS_DUP = 41
SYS_PIPE = 42
SYS_GETEGID = 43
SYS_SIGACTION = 46
SYS_GETGID = 47
SYS_SIGPROCMASK = 48
SYS_GETLOGIN = 49
SYS_SETLOGIN = 50
SYS_ACCT = 51
SYS_SIGPENDING = 52
SYS_SIGALTSTACK = 53
SYS_IOCTL = 54
SYS_REBOOT = 55
SYS_REVOKE = 56
SYS_SYMLINK = 57
SYS_READLINK = 58
SYS_EXECVE = 59
SYS_UMASK = 60
SYS_CHROOT = 61
SYS_MSYNC = 65
SYS_VFORK = 66
SYS_MUNMAP = 73
SYS_MPROTECT = 74
SYS_MADVISE = 75
SYS_MINCORE = 78
SYS_GETGROUPS = 79
SYS_SETGROUPS = 80
SYS_GETPGRP = 81
SYS_SETPGID = 82
SYS_SETITIMER = 83
SYS_SWAPON = 85
SYS_GETITIMER = 86
SYS_GETDTABLESIZE = 89
SYS_DUP2 = 90
SYS_FCNTL = 92
SYS_SELECT = 93
SYS_FSYNC = 95
SYS_SETPRIORITY = 96
SYS_SOCKET = 97
SYS_CONNECT = 98
SYS_GETPRIORITY = 100
SYS_BIND = 104
SYS_SETSOCKOPT = 105
SYS_LISTEN = 106
SYS_SIGSUSPEND = 111
SYS_GETTIMEOFDAY = 116
SYS_GETRUSAGE = 117
SYS_GETSOCKOPT = 118
SYS_READV = 120
SYS_WRITEV = 121
SYS_SETTIMEOFDAY = 122
SYS_FCHOWN = 123
SYS_FCHMOD = 124
SYS_SETREUID = 126
SYS_SETREGID = 127
SYS_RENAME = 128
SYS_FLOCK = 131
SYS_MKFIFO = 132
SYS_SENDTO = 133
SYS_SHUTDOWN = 134
SYS_SOCKETPAIR = 135
SYS_MKDIR = 136
SYS_RMDIR = 137
SYS_UTIMES = 138
SYS_FUTIMES = 139
SYS_ADJTIME = 140
SYS_GETHOSTUUID = 142
SYS_SETSID = 147
SYS_GETPGID = 151
SYS_SETPRIVEXEC = 152
SYS_PREAD = 153
SYS_PWRITE = 154
SYS_NFSSVC = 155
SYS_STATFS = 157
SYS_FSTATFS = 158
SYS_UNMOUNT = 159
SYS_GETFH = 161
SYS_QUOTACTL = 165
SYS_MOUNT = 167
SYS_CSOPS = 169
SYS_CSOPS_AUDITTOKEN = 170
SYS_WAITID = 173
SYS_KDEBUG_TYPEFILTER = 177
SYS_KDEBUG_TRACE_STRING = 178
SYS_KDEBUG_TRACE64 = 179
SYS_KDEBUG_TRACE = 180
SYS_SETGID = 181
SYS_SETEGID = 182
SYS_SETEUID = 183
SYS_SIGRETURN = 184
SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187
SYS_STAT = 188
SYS_FSTAT = 189
SYS_LSTAT = 190
SYS_PATHCONF = 191
SYS_FPATHCONF = 192
SYS_GETRLIMIT = 194
SYS_SETRLIMIT = 195
SYS_GETDIRENTRIES = 196
SYS_MMAP = 197
SYS_LSEEK = 199
SYS_TRUNCATE = 200
SYS_FTRUNCATE = 201
SYS_SYSCTL = 202
SYS_MLOCK = 203
SYS_MUNLOCK = 204
SYS_UNDELETE = 205
SYS_OPEN_DPROTECTED_NP = 216
SYS_GETATTRLIST = 220
SYS_SETATTRLIST = 221
SYS_GETDIRENTRIESATTR = 222
SYS_EXCHANGEDATA = 223
SYS_SEARCHFS = 225
SYS_DELETE = 226
SYS_COPYFILE = 227
SYS_FGETATTRLIST = 228
SYS_FSETATTRLIST = 229
SYS_POLL = 230
SYS_WATCHEVENT = 231
SYS_WAITEVENT = 232
SYS_MODWATCH = 233
SYS_GETXATTR = 234
SYS_FGETXATTR = 235
SYS_SETXATTR = 236
SYS_FSETXATTR = 237
SYS_REMOVEXATTR = 238
SYS_FREMOVEXATTR = 239
SYS_LISTXATTR = 240
SYS_FLISTXATTR = 241
SYS_FSCTL = 242
SYS_INITGROUPS = 243
SYS_POSIX_SPAWN = 244
SYS_FFSCTL = 245
SYS_NFSCLNT = 247
SYS_FHOPEN = 248
SYS_MINHERIT = 250
SYS_SEMSYS = 251
SYS_MSGSYS = 252
SYS_SHMSYS = 253
SYS_SEMCTL = 254
SYS_SEMGET = 255
SYS_SEMOP = 256
SYS_MSGCTL = 258
SYS_MSGGET = 259
SYS_MSGSND = 260
SYS_MSGRCV = 261
SYS_SHMAT = 262
SYS_SHMCTL = 263
SYS_SHMDT = 264
SYS_SHMGET = 265
SYS_SHM_OPEN = 266
SYS_SHM_UNLINK = 267
SYS_SEM_OPEN = 268
SYS_SEM_CLOSE = 269
SYS_SEM_UNLINK = 270
SYS_SEM_WAIT = 271
SYS_SEM_TRYWAIT = 272
SYS_SEM_POST = 273
SYS_SYSCTLBYNAME = 274
SYS_OPEN_EXTENDED = 277
SYS_UMASK_EXTENDED = 278
SYS_STAT_EXTENDED = 279
SYS_LSTAT_EXTENDED = 280
SYS_FSTAT_EXTENDED = 281
SYS_CHMOD_EXTENDED = 282
SYS_FCHMOD_EXTENDED = 283
SYS_ACCESS_EXTENDED = 284
SYS_SETTID = 285
SYS_GETTID = 286
SYS_SETSGROUPS = 287
SYS_GETSGROUPS = 288
SYS_SETWGROUPS = 289
SYS_GETWGROUPS = 290
SYS_MKFIFO_EXTENDED = 291
SYS_MKDIR_EXTENDED = 292
SYS_IDENTITYSVC = 293
SYS_SHARED_REGION_CHECK_NP = 294
SYS_VM_PRESSURE_MONITOR = 296
SYS_PSYNCH_RW_LONGRDLOCK = 297
SYS_PSYNCH_RW_YIELDWRLOCK = 298
SYS_PSYNCH_RW_DOWNGRADE = 299
SYS_PSYNCH_RW_UPGRADE = 300
SYS_PSYNCH_MUTEXWAIT = 301
SYS_PSYNCH_MUTEXDROP = 302
SYS_PSYNCH_CVBROAD = 303
SYS_PSYNCH_CVSIGNAL = 304
SYS_PSYNCH_CVWAIT = 305
SYS_PSYNCH_RW_RDLOCK = 306
SYS_PSYNCH_RW_WRLOCK = 307
SYS_PSYNCH_RW_UNLOCK = 308
SYS_PSYNCH_RW_UNLOCK2 = 309
SYS_GETSID = 310
SYS_SETTID_WITH_PID = 311
SYS_PSYNCH_CVCLRPREPOST = 312
SYS_AIO_FSYNC = 313
SYS_AIO_RETURN = 314
SYS_AIO_SUSPEND = 315
SYS_AIO_CANCEL = 316
SYS_AIO_ERROR = 317
SYS_AIO_READ = 318
SYS_AIO_WRITE = 319
SYS_LIO_LISTIO = 320
SYS_IOPOLICYSYS = 322
SYS_PROCESS_POLICY = 323
SYS_MLOCKALL = 324
SYS_MUNLOCKALL = 325
SYS_ISSETUGID = 327
SYS___PTHREAD_KILL = 328
SYS___PTHREAD_SIGMASK = 329
SYS___SIGWAIT = 330
SYS___DISABLE_THREADSIGNAL = 331
SYS___PTHREAD_MARKCANCEL = 332
SYS___PTHREAD_CANCELED = 333
SYS___SEMWAIT_SIGNAL = 334
SYS_PROC_INFO = 336
SYS_SENDFILE = 337
SYS_STAT64 = 338
SYS_FSTAT64 = 339
SYS_LSTAT64 = 340
SYS_STAT64_EXTENDED = 341
SYS_LSTAT64_EXTENDED = 342
SYS_FSTAT64_EXTENDED = 343
SYS_GETDIRENTRIES64 = 344
SYS_STATFS64 = 345
SYS_FSTATFS64 = 346
SYS_GETFSSTAT64 = 347
SYS___PTHREAD_CHDIR = 348
SYS___PTHREAD_FCHDIR = 349
SYS_AUDIT = 350
SYS_AUDITON = 351
SYS_GETAUID = 353
SYS_SETAUID = 354
SYS_GETAUDIT_ADDR = 357
SYS_SETAUDIT_ADDR = 358
SYS_AUDITCTL = 359
SYS_BSDTHREAD_CREATE = 360
SYS_BSDTHREAD_TERMINATE = 361
SYS_KQUEUE = 362
SYS_KEVENT = 363
SYS_LCHOWN = 364
SYS_BSDTHREAD_REGISTER = 366
SYS_WORKQ_OPEN = 367
SYS_WORKQ_KERNRETURN = 368
SYS_KEVENT64 = 369
SYS___OLD_SEMWAIT_SIGNAL = 370
SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371
SYS_THREAD_SELFID = 372
SYS_LEDGER = 373
SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382
SYS___MAC_SET_FILE = 383
SYS___MAC_GET_LINK = 384
SYS___MAC_SET_LINK = 385
SYS___MAC_GET_PROC = 386
SYS___MAC_SET_PROC = 387
SYS___MAC_GET_FD = 388
SYS___MAC_SET_FD = 389
SYS___MAC_GET_PID = 390
SYS_PSELECT = 394
SYS_PSELECT_NOCANCEL = 395
SYS_READ_NOCANCEL = 396
SYS_WRITE_NOCANCEL = 397
SYS_OPEN_NOCANCEL = 398
SYS_CLOSE_NOCANCEL = 399
SYS_WAIT4_NOCANCEL = 400
SYS_RECVMSG_NOCANCEL = 401
SYS_SENDMSG_NOCANCEL = 402
SYS_RECVFROM_NOCANCEL = 403
SYS_ACCEPT_NOCANCEL = 404
SYS_MSYNC_NOCANCEL = 405
SYS_FCNTL_NOCANCEL = 406
SYS_SELECT_NOCANCEL = 407
SYS_FSYNC_NOCANCEL = 408
SYS_CONNECT_NOCANCEL = 409
SYS_SIGSUSPEND_NOCANCEL = 410
SYS_READV_NOCANCEL = 411
SYS_WRITEV_NOCANCEL = 412
SYS_SENDTO_NOCANCEL = 413
SYS_PREAD_NOCANCEL = 414
SYS_PWRITE_NOCANCEL = 415
SYS_WAITID_NOCANCEL = 416
SYS_POLL_NOCANCEL = 417
SYS_MSGSND_NOCANCEL = 418
SYS_MSGRCV_NOCANCEL = 419
SYS_SEM_WAIT_NOCANCEL = 420
SYS_AIO_SUSPEND_NOCANCEL = 421
SYS___SIGWAIT_NOCANCEL = 422
SYS___SEMWAIT_SIGNAL_NOCANCEL = 423
SYS___MAC_MOUNT = 424
SYS___MAC_GET_MOUNT = 425
SYS___MAC_GETFSSTAT = 426
SYS_FSGETPATH = 427
SYS_AUDIT_SESSION_SELF = 428
SYS_AUDIT_SESSION_JOIN = 429
SYS_FILEPORT_MAKEPORT = 430
SYS_FILEPORT_MAKEFD = 431
SYS_AUDIT_SESSION_PORT = 432
SYS_PID_SUSPEND = 433
SYS_PID_RESUME = 434
SYS_PID_HIBERNATE = 435
SYS_PID_SHUTDOWN_SOCKETS = 436
SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438
SYS_KAS_INFO = 439
SYS_MEMORYSTATUS_CONTROL = 440
SYS_GUARDED_OPEN_NP = 441
SYS_GUARDED_CLOSE_NP = 442
SYS_GUARDED_KQUEUE_NP = 443
SYS_CHANGE_FDGUARD_NP = 444
SYS_USRCTL = 445
SYS_PROC_RLIMIT_CONTROL = 446
SYS_CONNECTX = 447
SYS_DISCONNECTX = 448
SYS_PEELOFF = 449
SYS_SOCKET_DELEGATE = 450
SYS_TELEMETRY = 451
SYS_PROC_UUID_POLICY = 452
SYS_MEMORYSTATUS_GET_LEVEL = 453
SYS_SYSTEM_OVERRIDE = 454
SYS_VFS_PURGE = 455
SYS_SFI_CTL = 456
SYS_SFI_PIDCTL = 457
SYS_COALITION = 458
SYS_COALITION_INFO = 459
SYS_NECP_MATCH_POLICY = 460
SYS_GETATTRLISTBULK = 461
SYS_CLONEFILEAT = 462
SYS_OPENAT = 463
SYS_OPENAT_NOCANCEL = 464
SYS_RENAMEAT = 465
SYS_FACCESSAT = 466
SYS_FCHMODAT = 467
SYS_FCHOWNAT = 468
SYS_FSTATAT = 469
SYS_FSTATAT64 = 470
SYS_LINKAT = 471
SYS_UNLINKAT = 472
SYS_READLINKAT = 473
SYS_SYMLINKAT = 474
SYS_MKDIRAT = 475
SYS_GETATTRLISTAT = 476
SYS_PROC_TRACE_LOG = 477
SYS_BSDTHREAD_CTL = 478
SYS_OPENBYID_NP = 479
SYS_RECVMSG_X = 480
SYS_SENDMSG_X = 481
SYS_THREAD_SELFUSAGE = 482
SYS_CSRCTL = 483
SYS_GUARDED_OPEN_DPROTECTED_NP = 484
SYS_GUARDED_WRITE_NP = 485
SYS_GUARDED_PWRITE_NP = 486
SYS_GUARDED_WRITEV_NP = 487
SYS_RENAMEATX_NP = 488
SYS_MREMAP_ENCRYPTED = 489
SYS_NETAGENT_TRIGGER = 490
SYS_STACK_SNAPSHOT_WITH_CONFIG = 491
SYS_MICROSTACKSHOT = 492
SYS_GRAB_PGO_DATA = 493
SYS_PERSONA = 494
SYS_WORK_INTERVAL_CTL = 499
SYS_GETENTROPY = 500
SYS_NECP_OPEN = 501
SYS_NECP_CLIENT_ACTION = 502
SYS___NEXUS_OPEN = 503
SYS___NEXUS_REGISTER = 504
SYS___NEXUS_DEREGISTER = 505
SYS___NEXUS_CREATE = 506
SYS___NEXUS_DESTROY = 507
SYS___NEXUS_GET_OPT = 508
SYS___NEXUS_SET_OPT = 509
SYS___CHANNEL_OPEN = 510
SYS___CHANNEL_GET_INFO = 511
SYS___CHANNEL_SYNC = 512
SYS___CHANNEL_GET_OPT = 513
SYS___CHANNEL_SET_OPT = 514
SYS_ULOCK_WAIT = 515
SYS_ULOCK_WAKE = 516
SYS_FCLONEFILEAT = 517
SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521
SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_MAXSYSCALL = 530
SYS_INVALID = 63
)

220
vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go generated vendored Normal file
View File

@ -0,0 +1,220 @@
// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mips64,openbsd
package unix
const (
SYS_EXIT = 1 // { void sys_exit(int rval); }
SYS_FORK = 2 // { int sys_fork(void); }
SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); }
SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); }
SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); }
SYS_CLOSE = 6 // { int sys_close(int fd); }
SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); }
SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); }
SYS_LINK = 9 // { int sys_link(const char *path, const char *link); }
SYS_UNLINK = 10 // { int sys_unlink(const char *path); }
SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); }
SYS_CHDIR = 12 // { int sys_chdir(const char *path); }
SYS_FCHDIR = 13 // { int sys_fchdir(int fd); }
SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); }
SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); }
SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); }
SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break
SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); }
SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); }
SYS_GETPID = 20 // { pid_t sys_getpid(void); }
SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); }
SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); }
SYS_SETUID = 23 // { int sys_setuid(uid_t uid); }
SYS_GETUID = 24 // { uid_t sys_getuid(void); }
SYS_GETEUID = 25 // { uid_t sys_geteuid(void); }
SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); }
SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); }
SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); }
SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); }
SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); }
SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); }
SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); }
SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); }
SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); }
SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); }
SYS_SYNC = 36 // { void sys_sync(void); }
SYS_MSYSCALL = 37 // { int sys_msyscall(void *addr, size_t len); }
SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); }
SYS_GETPPID = 39 // { pid_t sys_getppid(void); }
SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); }
SYS_DUP = 41 // { int sys_dup(int fd); }
SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); }
SYS_GETEGID = 43 // { gid_t sys_getegid(void); }
SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); }
SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); }
SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); }
SYS_GETGID = 47 // { gid_t sys_getgid(void); }
SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); }
SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); }
SYS_ACCT = 51 // { int sys_acct(const char *path); }
SYS_SIGPENDING = 52 // { int sys_sigpending(void); }
SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); }
SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); }
SYS_REBOOT = 55 // { int sys_reboot(int opt); }
SYS_REVOKE = 56 // { int sys_revoke(const char *path); }
SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); }
SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); }
SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); }
SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); }
SYS_CHROOT = 61 // { int sys_chroot(const char *path); }
SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); }
SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); }
SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); }
SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); }
SYS_VFORK = 66 // { int sys_vfork(void); }
SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); }
SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); }
SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); }
SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); }
SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); }
SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); }
SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); }
SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); }
SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); }
SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); }
SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); }
SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); }
SYS_GETPGRP = 81 // { int sys_getpgrp(void); }
SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); }
SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); }
SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); }
SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); }
SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); }
SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); }
SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); }
SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); }
SYS_DUP2 = 90 // { int sys_dup2(int from, int to); }
SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); }
SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); }
SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); }
SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); }
SYS_FSYNC = 95 // { int sys_fsync(int fd); }
SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); }
SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); }
SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); }
SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); }
SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); }
SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); }
SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); }
SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); }
SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); }
SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); }
SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); }
SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); }
SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); }
SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); }
SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); }
SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); }
SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); }
SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); }
SYS___REALPATH = 115 // { int sys___realpath(const char *pathname, char *resolved); }
SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); }
SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); }
SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); }
SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); }
SYS_KILL = 122 // { int sys_kill(int pid, int signum); }
SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); }
SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); }
SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); }
SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); }
SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); }
SYS_FLOCK = 131 // { int sys_flock(int fd, int how); }
SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); }
SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); }
SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); }
SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); }
SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); }
SYS_RMDIR = 137 // { int sys_rmdir(const char *path); }
SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); }
SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); }
SYS_SETSID = 147 // { int sys_setsid(void); }
SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); }
SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); }
SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); }
SYS___TMPFD = 164 // { int sys___tmpfd(int flags); }
SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); }
SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); }
SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); }
SYS_SETGID = 181 // { int sys_setgid(gid_t gid); }
SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); }
SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); }
SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); }
SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); }
SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); }
SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); }
SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); }
SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); }
SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); }
SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); }
SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); }
SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); }
SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); }
SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); }
SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); }
SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); }
SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); }
SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); }
SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); }
SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); }
SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); }
SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); }
SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); }
SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); }
SYS_ISSETUGID = 253 // { int sys_issetugid(void); }
SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); }
SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); }
SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); }
SYS_PIPE = 263 // { int sys_pipe(int *fdp); }
SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); }
SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); }
SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); }
SYS_KQUEUE = 269 // { int sys_kqueue(void); }
SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); }
SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); }
SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); }
SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); }
SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); }
SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); }
SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); }
SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); }
SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); }
SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); }
SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); }
SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); }
SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); }
SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); }
SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); }
SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); }
SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); }
SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); }
SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); }
SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); }
SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); }
SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); }
SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); }
SYS_GETRTABLE = 311 // { int sys_getrtable(void); }
SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); }
SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); }
SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); }
SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); }
SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); }
SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); }
SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); }
SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); }
SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); }
SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); }
SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); }
SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); }
SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); }
SYS___GET_TCB = 330 // { void *sys___get_tcb(void); }
)

View File

@ -752,6 +752,22 @@ const (
AT_EACCESS = 0x200 AT_EACCESS = 0x200
) )
type OpenHow struct {
Flags uint64
Mode uint64
Resolve uint64
}
const SizeofOpenHow = 0x18
const (
RESOLVE_BENEATH = 0x8
RESOLVE_IN_ROOT = 0x10
RESOLVE_NO_MAGICLINKS = 0x2
RESOLVE_NO_SYMLINKS = 0x4
RESOLVE_NO_XDEV = 0x1
)
type PollFd struct { type PollFd struct {
Fd int32 Fd int32
Events int16 Events int16
@ -1016,6 +1032,13 @@ const (
PERF_SAMPLE_STREAM_ID = 0x200 PERF_SAMPLE_STREAM_ID = 0x200
PERF_SAMPLE_RAW = 0x400 PERF_SAMPLE_RAW = 0x400
PERF_SAMPLE_BRANCH_STACK = 0x800 PERF_SAMPLE_BRANCH_STACK = 0x800
PERF_SAMPLE_REGS_USER = 0x1000
PERF_SAMPLE_STACK_USER = 0x2000
PERF_SAMPLE_WEIGHT = 0x4000
PERF_SAMPLE_DATA_SRC = 0x8000
PERF_SAMPLE_IDENTIFIER = 0x10000
PERF_SAMPLE_TRANSACTION = 0x20000
PERF_SAMPLE_REGS_INTR = 0x40000
PERF_SAMPLE_BRANCH_USER = 0x1 PERF_SAMPLE_BRANCH_USER = 0x1
PERF_SAMPLE_BRANCH_KERNEL = 0x2 PERF_SAMPLE_BRANCH_KERNEL = 0x2
@ -1745,6 +1768,21 @@ const (
NFT_NG_RANDOM = 0x1 NFT_NG_RANDOM = 0x1
) )
const (
NFTA_TARGET_UNSPEC = 0x0
NFTA_TARGET_NAME = 0x1
NFTA_TARGET_REV = 0x2
NFTA_TARGET_INFO = 0x3
NFTA_MATCH_UNSPEC = 0x0
NFTA_MATCH_NAME = 0x1
NFTA_MATCH_REV = 0x2
NFTA_MATCH_INFO = 0x3
NFTA_COMPAT_UNSPEC = 0x0
NFTA_COMPAT_NAME = 0x1
NFTA_COMPAT_REV = 0x2
NFTA_COMPAT_TYPE = 0x3
)
type RTCTime struct { type RTCTime struct {
Sec int32 Sec int32
Min int32 Min int32
@ -2505,3 +2543,12 @@ const (
NHA_GROUPS = 0x9 NHA_GROUPS = 0x9
NHA_MASTER = 0xa NHA_MASTER = 0xa
) )
const (
CAN_RAW_FILTER = 0x1
CAN_RAW_ERR_FILTER = 0x2
CAN_RAW_LOOPBACK = 0x3
CAN_RAW_RECV_OWN_MSGS = 0x4
CAN_RAW_FD_FRAMES = 0x5
CAN_RAW_JOIN_FILTERS = 0x6
)

565
vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go generated vendored Normal file
View File

@ -0,0 +1,565 @@
// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mips64,openbsd
package unix
const (
SizeofPtr = 0x8
SizeofShort = 0x2
SizeofInt = 0x4
SizeofLong = 0x8
SizeofLongLong = 0x8
)
type (
_C_short int16
_C_int int32
_C_long int64
_C_long_long int64
)
type Timespec struct {
Sec int64
Nsec int64
}
type Timeval struct {
Sec int64
Usec int64
}
type Rusage struct {
Utime Timeval
Stime Timeval
Maxrss int64
Ixrss int64
Idrss int64
Isrss int64
Minflt int64
Majflt int64
Nswap int64
Inblock int64
Oublock int64
Msgsnd int64
Msgrcv int64
Nsignals int64
Nvcsw int64
Nivcsw int64
}
type Rlimit struct {
Cur uint64
Max uint64
}
type _Gid_t uint32
type Stat_t struct {
Mode uint32
Dev int32
Ino uint64
Nlink uint32
Uid uint32
Gid uint32
Rdev int32
Atim Timespec
Mtim Timespec
Ctim Timespec
Size int64
Blocks int64
Blksize int32
Flags uint32
Gen uint32
_ Timespec
}
type Statfs_t struct {
F_flags uint32
F_bsize uint32
F_iosize uint32
F_blocks uint64
F_bfree uint64
F_bavail int64
F_files uint64
F_ffree uint64
F_favail int64
F_syncwrites uint64
F_syncreads uint64
F_asyncwrites uint64
F_asyncreads uint64
F_fsid Fsid
F_namemax uint32
F_owner uint32
F_ctime uint64
F_fstypename [16]int8
F_mntonname [90]int8
F_mntfromname [90]int8
F_mntfromspec [90]int8
_ [2]byte
Mount_info [160]byte
}
type Flock_t struct {
Start int64
Len int64
Pid int32
Type int16
Whence int16
}
type Dirent struct {
Fileno uint64
Off int64
Reclen uint16
Type uint8
Namlen uint8
_ [4]uint8
Name [256]int8
}
type Fsid struct {
Val [2]int32
}
const (
PathMax = 0x400
)
type RawSockaddrInet4 struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]int8
}
type RawSockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type RawSockaddrUnix struct {
Len uint8
Family uint8
Path [104]int8
}
type RawSockaddrDatalink struct {
Len uint8
Family uint8
Index uint16
Type uint8
Nlen uint8
Alen uint8
Slen uint8
Data [24]int8
}
type RawSockaddr struct {
Len uint8
Family uint8
Data [14]int8
}
type RawSockaddrAny struct {
Addr RawSockaddr
Pad [92]int8
}
type _Socklen uint32
type Linger struct {
Onoff int32
Linger int32
}
type Iovec struct {
Base *byte
Len uint64
}
type IPMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type IPv6Mreq struct {
Multiaddr [16]byte /* in6_addr */
Interface uint32
}
type Msghdr struct {
Name *byte
Namelen uint32
Iov *Iovec
Iovlen uint32
Control *byte
Controllen uint32
Flags int32
}
type Cmsghdr struct {
Len uint32
Level int32
Type int32
}
type Inet6Pktinfo struct {
Addr [16]byte /* in6_addr */
Ifindex uint32
}
type IPv6MTUInfo struct {
Addr RawSockaddrInet6
Mtu uint32
}
type ICMPv6Filter struct {
Filt [8]uint32
}
const (
SizeofSockaddrInet4 = 0x10
SizeofSockaddrInet6 = 0x1c
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x20
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
SizeofCmsghdr = 0xc
SizeofInet6Pktinfo = 0x14
SizeofIPv6MTUInfo = 0x20
SizeofICMPv6Filter = 0x20
)
const (
PTRACE_TRACEME = 0x0
PTRACE_CONT = 0x7
PTRACE_KILL = 0x8
)
type Kevent_t struct {
Ident uint64
Filter int16
Flags uint16
Fflags uint32
Data int64
Udata *byte
}
type FdSet struct {
Bits [32]uint32
}
const (
SizeofIfMsghdr = 0xa8
SizeofIfData = 0x90
SizeofIfaMsghdr = 0x18
SizeofIfAnnounceMsghdr = 0x1a
SizeofRtMsghdr = 0x60
SizeofRtMetrics = 0x38
)
type IfMsghdr struct {
Msglen uint16
Version uint8
Type uint8
Hdrlen uint16
Index uint16
Tableid uint16
Pad1 uint8
Pad2 uint8
Addrs int32
Flags int32
Xflags int32
Data IfData
}
type IfData struct {
Type uint8
Addrlen uint8
Hdrlen uint8
Link_state uint8
Mtu uint32
Metric uint32
Rdomain uint32
Baudrate uint64
Ipackets uint64
Ierrors uint64
Opackets uint64
Oerrors uint64
Collisions uint64
Ibytes uint64
Obytes uint64
Imcasts uint64
Omcasts uint64
Iqdrops uint64
Oqdrops uint64
Noproto uint64
Capabilities uint32
Lastchange Timeval
}
type IfaMsghdr struct {
Msglen uint16
Version uint8
Type uint8
Hdrlen uint16
Index uint16
Tableid uint16
Pad1 uint8
Pad2 uint8
Addrs int32
Flags int32
Metric int32
}
type IfAnnounceMsghdr struct {
Msglen uint16
Version uint8
Type uint8
Hdrlen uint16
Index uint16
What uint16
Name [16]int8
}
type RtMsghdr struct {
Msglen uint16
Version uint8
Type uint8
Hdrlen uint16
Index uint16
Tableid uint16
Priority uint8
Mpls uint8
Addrs int32
Flags int32
Fmask int32
Pid int32
Seq int32
Errno int32
Inits uint32
Rmx RtMetrics
}
type RtMetrics struct {
Pksent uint64
Expire int64
Locks uint32
Mtu uint32
Refcnt uint32
Hopcount uint32
Recvpipe uint32
Sendpipe uint32
Ssthresh uint32
Rtt uint32
Rttvar uint32
Pad uint32
}
type Mclpool struct{}
const (
SizeofBpfVersion = 0x4
SizeofBpfStat = 0x8
SizeofBpfProgram = 0x10
SizeofBpfInsn = 0x8
SizeofBpfHdr = 0x14
)
type BpfVersion struct {
Major uint16
Minor uint16
}
type BpfStat struct {
Recv uint32
Drop uint32
}
type BpfProgram struct {
Len uint32
Insns *BpfInsn
}
type BpfInsn struct {
Code uint16
Jt uint8
Jf uint8
K uint32
}
type BpfHdr struct {
Tstamp BpfTimeval
Caplen uint32
Datalen uint32
Hdrlen uint16
_ [2]byte
}
type BpfTimeval struct {
Sec uint32
Usec uint32
}
type Termios struct {
Iflag uint32
Oflag uint32
Cflag uint32
Lflag uint32
Cc [20]uint8
Ispeed int32
Ospeed int32
}
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const (
AT_FDCWD = -0x64
AT_SYMLINK_FOLLOW = 0x4
AT_SYMLINK_NOFOLLOW = 0x2
)
type PollFd struct {
Fd int32
Events int16
Revents int16
}
const (
POLLERR = 0x8
POLLHUP = 0x10
POLLIN = 0x1
POLLNVAL = 0x20
POLLOUT = 0x4
POLLPRI = 0x2
POLLRDBAND = 0x80
POLLRDNORM = 0x40
POLLWRBAND = 0x100
POLLWRNORM = 0x4
)
type Sigset_t uint32
type Utsname struct {
Sysname [256]byte
Nodename [256]byte
Release [256]byte
Version [256]byte
Machine [256]byte
}
const SizeofUvmexp = 0x158
type Uvmexp struct {
Pagesize int32
Pagemask int32
Pageshift int32
Npages int32
Free int32
Active int32
Inactive int32
Paging int32
Wired int32
Zeropages int32
Reserve_pagedaemon int32
Reserve_kernel int32
Unused01 int32
Vnodepages int32
Vtextpages int32
Freemin int32
Freetarg int32
Inactarg int32
Wiredmax int32
Anonmin int32
Vtextmin int32
Vnodemin int32
Anonminpct int32
Vtextminpct int32
Vnodeminpct int32
Nswapdev int32
Swpages int32
Swpginuse int32
Swpgonly int32
Nswget int32
Nanon int32
Unused05 int32
Unused06 int32
Faults int32
Traps int32
Intrs int32
Swtch int32
Softs int32
Syscalls int32
Pageins int32
Unused07 int32
Unused08 int32
Pgswapin int32
Pgswapout int32
Forks int32
Forks_ppwait int32
Forks_sharevm int32
Pga_zerohit int32
Pga_zeromiss int32
Unused09 int32
Fltnoram int32
Fltnoanon int32
Fltnoamap int32
Fltpgwait int32
Fltpgrele int32
Fltrelck int32
Fltrelckok int32
Fltanget int32
Fltanretry int32
Fltamcopy int32
Fltnamap int32
Fltnomap int32
Fltlget int32
Fltget int32
Flt_anon int32
Flt_acow int32
Flt_obj int32
Flt_prcopy int32
Flt_przero int32
Pdwoke int32
Pdrevs int32
Pdswout int32
Pdfreed int32
Pdscans int32
Pdanscan int32
Pdobscan int32
Pdreact int32
Pdbusy int32
Pdpageouts int32
Pdpending int32
Pddeact int32
Unused11 int32
Unused12 int32
Unused13 int32
Fpswtch int32
Kmapent int32
}
const SizeofClockinfo = 0x14
type Clockinfo struct {
Hz int32
Tick int32
Tickadj int32
Stathz int32
Profhz int32
}

View File

@ -65,6 +65,7 @@ const (
SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 32 SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 32
SERVICE_ACCEPT_POWEREVENT = 64 SERVICE_ACCEPT_POWEREVENT = 64
SERVICE_ACCEPT_SESSIONCHANGE = 128 SERVICE_ACCEPT_SESSIONCHANGE = 128
SERVICE_ACCEPT_PRESHUTDOWN = 256
SERVICE_CONTROL_STOP = 1 SERVICE_CONTROL_STOP = 1
SERVICE_CONTROL_PAUSE = 2 SERVICE_CONTROL_PAUSE = 2
@ -80,6 +81,7 @@ const (
SERVICE_CONTROL_HARDWAREPROFILECHANGE = 12 SERVICE_CONTROL_HARDWAREPROFILECHANGE = 12
SERVICE_CONTROL_POWEREVENT = 13 SERVICE_CONTROL_POWEREVENT = 13
SERVICE_CONTROL_SESSIONCHANGE = 14 SERVICE_CONTROL_SESSIONCHANGE = 14
SERVICE_CONTROL_PRESHUTDOWN = 15
SERVICE_ACTIVE = 1 SERVICE_ACTIVE = 1
SERVICE_INACTIVE = 2 SERVICE_INACTIVE = 2

View File

@ -303,6 +303,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys ResumeThread(thread Handle) (ret uint32, err error) [failretval==0xffffffff] = kernel32.ResumeThread //sys ResumeThread(thread Handle) (ret uint32, err error) [failretval==0xffffffff] = kernel32.ResumeThread
//sys SetPriorityClass(process Handle, priorityClass uint32) (err error) = kernel32.SetPriorityClass //sys SetPriorityClass(process Handle, priorityClass uint32) (err error) = kernel32.SetPriorityClass
//sys GetPriorityClass(process Handle) (ret uint32, err error) = kernel32.GetPriorityClass //sys GetPriorityClass(process Handle) (ret uint32, err error) = kernel32.GetPriorityClass
//sys QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) = kernel32.QueryInformationJobObject
//sys SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) //sys SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error)
//sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) //sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error)
//sys GetProcessId(process Handle) (id uint32, err error) //sys GetProcessId(process Handle) (id uint32, err error)

View File

@ -1584,18 +1584,6 @@ const (
JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001 JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001
) )
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
PerProcessUserTimeLimit int64
PerJobUserTimeLimit int64
LimitFlags uint32
MinimumWorkingSetSize uintptr
MaximumWorkingSetSize uintptr
ActiveProcessLimit uint32
Affinity uintptr
PriorityClass uint32
SchedulingClass uint32
}
type IO_COUNTERS struct { type IO_COUNTERS struct {
ReadOperationCount uint64 ReadOperationCount uint64
WriteOperationCount uint64 WriteOperationCount uint64

View File

@ -20,3 +20,16 @@ type Servent struct {
Port uint16 Port uint16
Proto *byte Proto *byte
} }
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
PerProcessUserTimeLimit int64
PerJobUserTimeLimit int64
LimitFlags uint32
MinimumWorkingSetSize uintptr
MaximumWorkingSetSize uintptr
ActiveProcessLimit uint32
Affinity uintptr
PriorityClass uint32
SchedulingClass uint32
_ uint32 // pad to 8 byte boundary
}

View File

@ -20,3 +20,15 @@ type Servent struct {
Proto *byte Proto *byte
Port uint16 Port uint16
} }
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
PerProcessUserTimeLimit int64
PerJobUserTimeLimit int64
LimitFlags uint32
MinimumWorkingSetSize uintptr
MaximumWorkingSetSize uintptr
ActiveProcessLimit uint32
Affinity uintptr
PriorityClass uint32
SchedulingClass uint32
}

View File

@ -20,3 +20,16 @@ type Servent struct {
Port uint16 Port uint16
Proto *byte Proto *byte
} }
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
PerProcessUserTimeLimit int64
PerJobUserTimeLimit int64
LimitFlags uint32
MinimumWorkingSetSize uintptr
MaximumWorkingSetSize uintptr
ActiveProcessLimit uint32
Affinity uintptr
PriorityClass uint32
SchedulingClass uint32
_ uint32 // pad to 8 byte boundary
}

View File

@ -212,6 +212,7 @@ var (
procResumeThread = modkernel32.NewProc("ResumeThread") procResumeThread = modkernel32.NewProc("ResumeThread")
procSetPriorityClass = modkernel32.NewProc("SetPriorityClass") procSetPriorityClass = modkernel32.NewProc("SetPriorityClass")
procGetPriorityClass = modkernel32.NewProc("GetPriorityClass") procGetPriorityClass = modkernel32.NewProc("GetPriorityClass")
procQueryInformationJobObject = modkernel32.NewProc("QueryInformationJobObject")
procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject") procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject")
procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent") procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
procGetProcessId = modkernel32.NewProc("GetProcessId") procGetProcessId = modkernel32.NewProc("GetProcessId")
@ -2341,6 +2342,18 @@ func GetPriorityClass(process Handle) (ret uint32, err error) {
return return
} }
func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) {
r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0)
if r1 == 0 {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) {
r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0)
ret = int(r0) ret = int(r0)

View File

@ -648,7 +648,8 @@ func String(t Transformer, s string) (result string, n int, err error) {
// Transform the remaining input, growing dst and src buffers as necessary. // Transform the remaining input, growing dst and src buffers as necessary.
for { for {
n := copy(src, s[pSrc:]) n := copy(src, s[pSrc:])
nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], pSrc+n == len(s)) atEOF := pSrc+n == len(s)
nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], atEOF)
pDst += nDst pDst += nDst
pSrc += nSrc pSrc += nSrc
@ -659,6 +660,9 @@ func String(t Transformer, s string) (result string, n int, err error) {
dst = grow(dst, pDst) dst = grow(dst, pDst)
} }
} else if err == ErrShortSrc { } else if err == ErrShortSrc {
if atEOF {
return string(dst[:pDst]), pSrc, err
}
if nSrc == 0 { if nSrc == 0 {
src = grow(src, 0) src = grow(src, 0)
} }

26
vendor/modules.txt vendored
View File

@ -1,16 +1,11 @@
# git.sungo.io/sungo/argon v0.0.0-20200904233623-18a98e1a4706 # git.sungo.io/sungo/argon v0.0.0-20200904233623-18a98e1a4706
## explicit ## explicit
git.sungo.io/sungo/argon/fan git.sungo.io/sungo/argon/fan
# github.com/d2r2/go-bh1750 v0.0.0-20181222061755-1195122364ab
## explicit
# github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc # github.com/d2r2/go-i2c v0.0.0-20191123181816-73a8a799d6bc
## explicit
github.com/d2r2/go-i2c github.com/d2r2/go-i2c
# github.com/d2r2/go-logger v0.0.0-20181221090742-9998a510495e # github.com/d2r2/go-logger v0.0.0-20181221090742-9998a510495e
## explicit
github.com/d2r2/go-logger github.com/d2r2/go-logger
# github.com/davecgh/go-spew v1.1.1 # github.com/davecgh/go-spew v1.1.1
## explicit
github.com/davecgh/go-spew/spew github.com/davecgh/go-spew/spew
# github.com/dietsche/rfsnotify v0.0.0-20200716145600-b37be6e4177f # github.com/dietsche/rfsnotify v0.0.0-20200716145600-b37be6e4177f
## explicit ## explicit
@ -19,7 +14,6 @@ github.com/dietsche/rfsnotify
## explicit ## explicit
github.com/eiannone/keyboard github.com/eiannone/keyboard
# github.com/fsnotify/fsnotify v1.4.9 # github.com/fsnotify/fsnotify v1.4.9
## explicit
github.com/fsnotify/fsnotify github.com/fsnotify/fsnotify
# github.com/gdamore/encoding v1.0.0 # github.com/gdamore/encoding v1.0.0
github.com/gdamore/encoding github.com/gdamore/encoding
@ -78,7 +72,7 @@ github.com/gdamore/tcell/terminfo/x/xterm_kitty
# github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e # github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e
## explicit ## explicit
github.com/guillermo/go.procmeminfo github.com/guillermo/go.procmeminfo
# github.com/knadh/koanf v0.12.0 # github.com/knadh/koanf v0.13.0
## explicit ## explicit
github.com/knadh/koanf github.com/knadh/koanf
github.com/knadh/koanf/maps github.com/knadh/koanf/maps
@ -88,15 +82,15 @@ github.com/knadh/koanf/providers/file
github.com/knadh/koanf/providers/posflag github.com/knadh/koanf/providers/posflag
# github.com/lucasb-eyer/go-colorful v1.0.3 # github.com/lucasb-eyer/go-colorful v1.0.3
github.com/lucasb-eyer/go-colorful github.com/lucasb-eyer/go-colorful
# github.com/mackerelio/go-osstat v0.1.0
## explicit
# github.com/mattn/go-runewidth v0.0.9 # github.com/mattn/go-runewidth v0.0.9
github.com/mattn/go-runewidth github.com/mattn/go-runewidth
# github.com/mitchellh/mapstructure v1.2.2 # github.com/mitchellh/mapstructure v1.3.3
## explicit
github.com/mitchellh/mapstructure github.com/mitchellh/mapstructure
# github.com/pelletier/go-toml v1.7.0 # github.com/pelletier/go-toml v1.8.1
## explicit
github.com/pelletier/go-toml github.com/pelletier/go-toml
# github.com/rivo/tview v0.0.0-20200818120338-53d50e499bf9 # github.com/rivo/tview v0.0.0-20200915114512-42866ecf6ca6
## explicit ## explicit
github.com/rivo/tview github.com/rivo/tview
# github.com/rivo/uniseg v0.1.0 # github.com/rivo/uniseg v0.1.0
@ -104,18 +98,16 @@ github.com/rivo/uniseg
# github.com/spf13/pflag v1.0.5 # github.com/spf13/pflag v1.0.5
## explicit ## explicit
github.com/spf13/pflag github.com/spf13/pflag
# github.com/warthog618/gpiod v0.5.0 # golang.org/x/sys v0.0.0-20200918174421-af09f7315aff
## explicit ## explicit
# golang.org/x/sys v0.0.0-20200817155316-9781c653f443
golang.org/x/sys/internal/unsafeheader golang.org/x/sys/internal/unsafeheader
golang.org/x/sys/unix golang.org/x/sys/unix
golang.org/x/sys/windows golang.org/x/sys/windows
# golang.org/x/text v0.3.2 # golang.org/x/text v0.3.3
## explicit
golang.org/x/text/encoding golang.org/x/text/encoding
golang.org/x/text/encoding/internal/identifier golang.org/x/text/encoding/internal/identifier
golang.org/x/text/transform golang.org/x/text/transform
# gopkg.in/fsnotify.v1 v1.4.7 # gopkg.in/fsnotify.v1 v1.4.7
## explicit ## explicit
gopkg.in/fsnotify.v1 gopkg.in/fsnotify.v1
# periph.io/x/periph v3.6.4+incompatible
## explicit