Update vendor (whatsapp)

pull/1773/head
Wim 2 years ago
parent d64eed49bc
commit 2623a412c4

@ -45,7 +45,7 @@ require (
github.com/writeas/go-strip-markdown v2.0.1+incompatible
github.com/yaegashi/msgraph.go v0.1.4
github.com/zfjagann/golang-ring v0.0.0-20210116075443-7c86fdb43134
go.mau.fi/whatsmeow v0.0.0-20220312175208-0c4681a6ff52
go.mau.fi/whatsmeow v0.0.0-20220319105109-ee347f8c0a14
golang.org/x/image v0.0.0-20220302094943-723b81ca9867
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a
golang.org/x/text v0.3.7
@ -53,7 +53,7 @@ require (
google.golang.org/protobuf v1.27.1
gopkg.in/olahol/melody.v1 v1.0.0-20170518105555-d52139073376
layeh.com/gumble v0.0.0-20200818122324-146f9205029b
modernc.org/sqlite v1.14.8
modernc.org/sqlite v1.15.2
)
require (
@ -123,11 +123,11 @@ require (
github.com/wiggin77/cfg v1.0.2 // indirect
github.com/wiggin77/merror v1.0.3 // indirect
github.com/wiggin77/srslog v1.0.1 // indirect
go.mau.fi/libsignal v0.0.0-20220308120827-0d87a03fd7c7 // indirect
go.mau.fi/libsignal v0.0.0-20220315232917-871a40435d3b // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
@ -141,11 +141,11 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
lukechampine.com/uint128 v1.1.1 // indirect
modernc.org/cc/v3 v3.35.22 // indirect
modernc.org/ccgo/v3 v3.15.14 // indirect
modernc.org/libc v1.14.6 // indirect
modernc.org/cc/v3 v3.35.24 // indirect
modernc.org/ccgo/v3 v3.15.17 // indirect
modernc.org/libc v1.14.11 // indirect
modernc.org/mathutil v1.4.1 // indirect
modernc.org/memory v1.0.5 // indirect
modernc.org/memory v1.0.6 // indirect
modernc.org/opt v0.1.1 // indirect
modernc.org/strutil v1.1.1 // indirect
modernc.org/token v1.0.0 // indirect

@ -1703,10 +1703,10 @@ go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3
go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs=
go.mau.fi/libsignal v0.0.0-20220308120827-0d87a03fd7c7 h1:L09XYQRGJwC6KbJumz3cD/6JTUAPNZHfnu8hroqm1KE=
go.mau.fi/libsignal v0.0.0-20220308120827-0d87a03fd7c7/go.mod h1:LjEYzdnRUcRArJJUUHQUfMU1A+WzEM73qBTirXluuaY=
go.mau.fi/whatsmeow v0.0.0-20220312175208-0c4681a6ff52 h1:CVJ4dVzluwsUFI8zBLQBlrtYHuMcEYM6oLeAbplCrI4=
go.mau.fi/whatsmeow v0.0.0-20220312175208-0c4681a6ff52/go.mod h1:nH4IwHZf+Ks61nM5p71jZqLXiT0NpG+0uR/WqzCqHH8=
go.mau.fi/libsignal v0.0.0-20220315232917-871a40435d3b h1:BGm0ceth6OtoXgBksEyeruiCL2ngZCwt86DUmUI6TmQ=
go.mau.fi/libsignal v0.0.0-20220315232917-871a40435d3b/go.mod h1:XYWsswZT1LfDmguWKYDuj+OugtdGX6CP3iwTtOcAGt4=
go.mau.fi/whatsmeow v0.0.0-20220319105109-ee347f8c0a14 h1:ExTTrre0VoTljTf08nGeE24i2aqNF4CxQVnlFYEiQUg=
go.mau.fi/whatsmeow v0.0.0-20220319105109-ee347f8c0a14/go.mod h1:P7OA9XyJ/0dWHhUPKNESpC1wVOErnhY4pLEaMC1a8yg=
go.mongodb.org/mongo-driver v1.1.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.7.0/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8=
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk=
@ -1788,8 +1788,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 h1:syTAU9FwmvzEoIYMqcPHOcVm4H3U5u90WsvuYgwpETU=
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38=
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -2529,8 +2529,9 @@ modernc.org/cc/v3 v3.35.16/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g
modernc.org/cc/v3 v3.35.17/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.18/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.20/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.22 h1:BzShpwCAP7TWzFppM4k2t03RhXhgYqaibROWkrWq7lE=
modernc.org/cc/v3 v3.35.22/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.24 h1:vlCqjhVwX15t1uwlMPpOpNRC7JTjMZ9lT9DYHKQTFuA=
modernc.org/cc/v3 v3.35.24/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
modernc.org/ccgo/v3 v3.9.2/go.mod h1:gnJpy6NIVqkETT+L5zPsQFj7L2kkhfPMzOghRNv/CFo=
modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw=
@ -2570,12 +2571,14 @@ modernc.org/ccgo/v3 v3.12.86/go.mod h1:dN7S26DLTgVSni1PVA3KxxHTcykyDurf3OgUzNqTS
modernc.org/ccgo/v3 v3.12.90/go.mod h1:obhSc3CdivCRpYZmrvO88TXlW0NvoSVvdh/ccRjJYko=
modernc.org/ccgo/v3 v3.12.92/go.mod h1:5yDdN7ti9KWPi5bRVWPl8UNhpEAtCjuEE7ayQnzzqHA=
modernc.org/ccgo/v3 v3.13.1/go.mod h1:aBYVOUfIlcSnrsRVU8VRS35y2DIfpgkmVkYZ0tpIXi4=
modernc.org/ccgo/v3 v3.15.1/go.mod h1:md59wBwDT2LznX/OTCPoVS6KIsdRgY8xqQwBV+hkTH0=
modernc.org/ccgo/v3 v3.15.9/go.mod h1:md59wBwDT2LznX/OTCPoVS6KIsdRgY8xqQwBV+hkTH0=
modernc.org/ccgo/v3 v3.15.10/go.mod h1:wQKxoFn0ynxMuCLfFD09c8XPUCc8obfchoVR9Cn0fI8=
modernc.org/ccgo/v3 v3.15.12/go.mod h1:VFePOWoCd8uDGRJpq/zfJ29D0EVzMSyID8LCMWYbX6I=
modernc.org/ccgo/v3 v3.15.14 h1:/Pcjoc5mPznDMH3CErDeX4mHLAAQyR5lzr3s2FpqDY0=
modernc.org/ccgo/v3 v3.15.14/go.mod h1:144Sz2iBCKogb9OKwsu7hQEub3EVgOlyI8wMUPGKUXQ=
modernc.org/ccgo/v3 v3.15.15/go.mod h1:z5qltXjU4PJl0pE5nhYQCvA9DhPHiWsl5GWl89+NSYE=
modernc.org/ccgo/v3 v3.15.16/go.mod h1:XbKRMeMWMdq712Tr5ECgATYMrzJ+g9zAZEj2ktzBe24=
modernc.org/ccgo/v3 v3.15.17 h1:svaDk4rfh7XQPBwkqzjKK8bta/vK4VVL3JP6ZLbcr0w=
modernc.org/ccgo/v3 v3.15.17/go.mod h1:bofnFkpRFf5gLY+mBZIyTW6FEcp26xi2lgOFk2Rlvs0=
modernc.org/ccorpus v1.11.1/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
@ -2629,8 +2632,12 @@ modernc.org/libc v1.12.0/go.mod h1:2MH3DaF/gCU8i/UBiVE1VFRos4o523M7zipmwH8SIgQ=
modernc.org/libc v1.14.1/go.mod h1:npFeGWjmZTjFeWALQLrvklVmAxv4m80jnG3+xI8FdJk=
modernc.org/libc v1.14.2/go.mod h1:MX1GBLnRLNdvmK9azU9LCxZ5lMyhrbEMK8rG3X/Fe34=
modernc.org/libc v1.14.3/go.mod h1:GPIvQVOVPizzlqyRX3l756/3ppsAgg1QgPxjr5Q4agQ=
modernc.org/libc v1.14.6 h1:SSiZiE5199iYsGM9gtkDj90xqcXVwubWG8CtoYE+Mnk=
modernc.org/libc v1.14.6/go.mod h1:2PJHINagVxO4QW/5OQdRrvMYo+bm5ClpUFfyXCYl9ak=
modernc.org/libc v1.14.7/go.mod h1:f8xfWXW8LW41qb4X5+huVQo5dcfPlq7Cbny2TDheMv0=
modernc.org/libc v1.14.8/go.mod h1:9+JCLb1MWSY23smyOpIPbd5ED+rSS/ieiDWUpdyO3mo=
modernc.org/libc v1.14.10/go.mod h1:y1MtIWhwpJFpLYm6grAThtuXJKEsY6xkdZmXbRngIdo=
modernc.org/libc v1.14.11 h1:ivxNmUkfp5iSGAGMIjylvx5R53s6QTJW9qUru1yrnk4=
modernc.org/libc v1.14.11/go.mod h1:l5/Mz/GrZwOqzwRHA3abgSCnSeJzzTl+Ify0bAwKbAw=
modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
@ -2639,28 +2646,28 @@ modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6
modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc=
modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14=
modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM=
modernc.org/memory v1.0.6 h1:5IaT/LChMrMdxLCy/a4qmb+7SzGiU8/ozPgkEOrfvFw=
modernc.org/memory v1.0.6/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw=
modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A=
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY=
modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k=
modernc.org/sqlite v1.10.6/go.mod h1:Z9FEjUtZP4qFEg6/SiADg9XCER7aYy9a/j7Pg9P7CPs=
modernc.org/sqlite v1.14.8 h1:2OOqfZAyU4x4qusilvHoRXXqsAgaZobi1o+mjQ5MUpw=
modernc.org/sqlite v1.14.8/go.mod h1:TFmXjym+/jR31fxc2B5eHnKMuJJGY7i1L/T5A0jzVww=
modernc.org/sqlite v1.15.2 h1:Es0SrEJUQHH7rt6uC/Zh2gHQ0AUhgB+F2RQqpXf3MNs=
modernc.org/sqlite v1.15.2/go.mod h1:2P9bWfawhYMpYsBELqKREE+LFZo4uPApOuqszlZ7QX8=
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs=
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
modernc.org/tcl v1.5.2/go.mod h1:pmJYOLgpiys3oI4AeAafkcUfE+TKKilminxNyU/+Zlo=
modernc.org/tcl v1.11.0 h1:B/zzEYjINeaki38KcIqdQRQx7W3WE7TkrlTwGnbm2II=
modernc.org/tcl v1.11.0/go.mod h1:zsTUpbQ+NxQEjOjCUlImDLPv1sG8Ww0qp66ZvyOxCgw=
modernc.org/tcl v1.11.2 h1:mXpsx3AZqJt83uDiFu9UYQVBjNjaWKGCF1YDSlpCL6Y=
modernc.org/tcl v1.11.2/go.mod h1:BRzgpajcGdS2qTxniOx9c/dcxjlbA7p12eJNmiriQYo=
modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.0.1-0.20210308123920-1f282aa71362/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA=
modernc.org/z v1.3.0/go.mod h1:+mvgLH814oDjtATDdT3rs84JnUIpkvAF5B8AVkNlE2g=
modernc.org/z v1.3.1 h1:jd/XnJ5W82v0cEpDQOQPpDJSH7H8olKpMqPFKEcM49E=
modernc.org/z v1.3.1/go.mod h1:0RBFPpdFNiKpjTza1WYaB4+6ySjS6dLBoo09OQZ4E3w=
modernc.org/z v1.3.2 h1:4GWBVMa48UDC7KQ9tnaggN/yTlXg+CdCX9bhgHPQ9AM=
modernc.org/z v1.3.2/go.mod h1:PEU2oK2OEA1CfzDTd+8E908qEXhC9s0MfyKp5LZsd+k=
modernc.org/zappy v1.0.0/go.mod h1:hHe+oGahLVII/aTTyWK/b53VDHMAGCBYYeZ9sn83HC4=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/goversion v1.2.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo=

@ -74,7 +74,7 @@ func (vc WAVersionContainer) ProtoAppVersion() *waProto.AppVersion {
}
// waVersion is the WhatsApp web client version
var waVersion = WAVersionContainer{2, 2208, 7}
var waVersion = WAVersionContainer{2, 2208, 14}
// waVersionHash is the md5 hash of a dot-separated waVersion
var waVersionHash [16]byte

@ -33,7 +33,7 @@ const CheckUpdateURL = "https://web.whatsapp.com/check-update"
// CheckUpdate asks the WhatsApp servers if there is an update available
// (using the HTTP client and proxy settings of this whatsmeow Client instance).
func (cli *Client) CheckUpdate() (respData CheckUpdateResponse, err error) {
return CheckUpdate(http.DefaultClient)
return CheckUpdate(cli.http)
}
// CheckUpdate asks the WhatsApp servers if there is an update available.

@ -14,8 +14,10 @@ import (
"time"
)
// These constants from [PROTOCOL.certkeys] represent the key algorithm names
// for certificate types supported by this package.
// Certificate algorithm names from [PROTOCOL.certkeys]. These values can appear
// in Certificate.Type, PublicKey.Type, and ClientConfig.HostKeyAlgorithms.
// Unlike key algorithm names, these are not passed to AlgorithmSigner and don't
// appear in the Signature.Format field.
const (
CertAlgoRSAv01 = "ssh-rsa-cert-v01@openssh.com"
CertAlgoDSAv01 = "ssh-dss-cert-v01@openssh.com"
@ -25,14 +27,21 @@ const (
CertAlgoSKECDSA256v01 = "sk-ecdsa-sha2-nistp256-cert-v01@openssh.com"
CertAlgoED25519v01 = "ssh-ed25519-cert-v01@openssh.com"
CertAlgoSKED25519v01 = "sk-ssh-ed25519-cert-v01@openssh.com"
// CertAlgoRSASHA256v01 and CertAlgoRSASHA512v01 can't appear as a
// Certificate.Type (or PublicKey.Type), but only in
// ClientConfig.HostKeyAlgorithms.
CertAlgoRSASHA256v01 = "rsa-sha2-256-cert-v01@openssh.com"
CertAlgoRSASHA512v01 = "rsa-sha2-512-cert-v01@openssh.com"
)
// These constants from [PROTOCOL.certkeys] represent additional signature
// algorithm names for certificate types supported by this package.
const (
CertSigAlgoRSAv01 = "ssh-rsa-cert-v01@openssh.com"
CertSigAlgoRSASHA2256v01 = "rsa-sha2-256-cert-v01@openssh.com"
CertSigAlgoRSASHA2512v01 = "rsa-sha2-512-cert-v01@openssh.com"
// Deprecated: use CertAlgoRSAv01.
CertSigAlgoRSAv01 = CertAlgoRSAv01
// Deprecated: use CertAlgoRSASHA256v01.
CertSigAlgoRSASHA2256v01 = CertAlgoRSASHA256v01
// Deprecated: use CertAlgoRSASHA512v01.
CertSigAlgoRSASHA2512v01 = CertAlgoRSASHA512v01
)
// Certificate types distinguish between host and user
@ -431,10 +440,14 @@ func (c *Certificate) SignCert(rand io.Reader, authority Signer) error {
}
c.SignatureKey = authority.PublicKey()
if v, ok := authority.(AlgorithmSigner); ok {
if v.PublicKey().Type() == KeyAlgoRSA {
authority = &rsaSigner{v, SigAlgoRSASHA2512}
// Default to KeyAlgoRSASHA512 for ssh-rsa signers.
if v, ok := authority.(AlgorithmSigner); ok && v.PublicKey().Type() == KeyAlgoRSA {
sig, err := v.SignWithAlgorithm(rand, c.bytesForSigning(), KeyAlgoRSASHA512)
if err != nil {
return err
}
c.Signature = sig
return nil
}
sig, err := authority.Sign(rand, c.bytesForSigning())
@ -445,32 +458,40 @@ func (c *Certificate) SignCert(rand io.Reader, authority Signer) error {
return nil
}
// certAlgoNames includes a mapping from signature algorithms to the
// corresponding certificate signature algorithm. When a key type (such
// as ED25516) is associated with only one algorithm, the KeyAlgo
// constant is used instead of the SigAlgo.
var certAlgoNames = map[string]string{
SigAlgoRSA: CertSigAlgoRSAv01,
SigAlgoRSASHA2256: CertSigAlgoRSASHA2256v01,
SigAlgoRSASHA2512: CertSigAlgoRSASHA2512v01,
KeyAlgoDSA: CertAlgoDSAv01,
KeyAlgoECDSA256: CertAlgoECDSA256v01,
KeyAlgoECDSA384: CertAlgoECDSA384v01,
KeyAlgoECDSA521: CertAlgoECDSA521v01,
KeyAlgoSKECDSA256: CertAlgoSKECDSA256v01,
KeyAlgoED25519: CertAlgoED25519v01,
KeyAlgoSKED25519: CertAlgoSKED25519v01,
// certKeyAlgoNames is a mapping from known certificate algorithm names to the
// corresponding public key signature algorithm.
var certKeyAlgoNames = map[string]string{
CertAlgoRSAv01: KeyAlgoRSA,
CertAlgoRSASHA256v01: KeyAlgoRSASHA256,
CertAlgoRSASHA512v01: KeyAlgoRSASHA512,
CertAlgoDSAv01: KeyAlgoDSA,
CertAlgoECDSA256v01: KeyAlgoECDSA256,
CertAlgoECDSA384v01: KeyAlgoECDSA384,
CertAlgoECDSA521v01: KeyAlgoECDSA521,
CertAlgoSKECDSA256v01: KeyAlgoSKECDSA256,
CertAlgoED25519v01: KeyAlgoED25519,
CertAlgoSKED25519v01: KeyAlgoSKED25519,
}
// underlyingAlgo returns the signature algorithm associated with algo (which is
// an advertised or negotiated public key or host key algorithm). These are
// usually the same, except for certificate algorithms.
func underlyingAlgo(algo string) string {
if a, ok := certKeyAlgoNames[algo]; ok {
return a
}
return algo
}
// certToPrivAlgo returns the underlying algorithm for a certificate algorithm.
// Panics if a non-certificate algorithm is passed.
func certToPrivAlgo(algo string) string {
for privAlgo, pubAlgo := range certAlgoNames {
if pubAlgo == algo {
return privAlgo
// certificateAlgo returns the certificate algorithms that uses the provided
// underlying signature algorithm.
func certificateAlgo(algo string) (certAlgo string, ok bool) {
for certName, algoName := range certKeyAlgoNames {
if algoName == algo {
return certName, true
}
}
panic("unknown cert algorithm")
return "", false
}
func (cert *Certificate) bytesForSigning() []byte {
@ -514,13 +535,13 @@ func (c *Certificate) Marshal() []byte {
return result
}
// Type returns the key name. It is part of the PublicKey interface.
// Type returns the certificate algorithm name. It is part of the PublicKey interface.
func (c *Certificate) Type() string {
algo, ok := certAlgoNames[c.Key.Type()]
certName, ok := certificateAlgo(c.Key.Type())
if !ok {
panic("unknown cert key type " + c.Key.Type())
panic("unknown certificate type for key type " + c.Key.Type())
}
return algo
return certName
}
// Verify verifies a signature against the certificate's public

@ -113,25 +113,16 @@ func (c *connection) clientHandshake(dialAddress string, config *ClientConfig) e
return c.clientAuthenticate(config)
}
// verifyHostKeySignature verifies the host key obtained in the key
// exchange.
// verifyHostKeySignature verifies the host key obtained in the key exchange.
// algo is the negotiated algorithm, and may be a certificate type.
func verifyHostKeySignature(hostKey PublicKey, algo string, result *kexResult) error {
sig, rest, ok := parseSignatureBody(result.Signature)
if len(rest) > 0 || !ok {
return errors.New("ssh: signature parse error")
}
// For keys, underlyingAlgo is exactly algo. For certificates,
// we have to look up the underlying key algorithm that SSH
// uses to evaluate signatures.
underlyingAlgo := algo
for sigAlgo, certAlgo := range certAlgoNames {
if certAlgo == algo {
underlyingAlgo = sigAlgo
}
}
if sig.Format != underlyingAlgo {
return fmt.Errorf("ssh: invalid signature algorithm %q, expected %q", sig.Format, underlyingAlgo)
if a := underlyingAlgo(algo); sig.Format != a {
return fmt.Errorf("ssh: invalid signature algorithm %q, expected %q", sig.Format, a)
}
return hostKey.Verify(result.H, sig)
@ -237,11 +228,11 @@ type ClientConfig struct {
// be used for the connection. If empty, a reasonable default is used.
ClientVersion string
// HostKeyAlgorithms lists the key types that the client will
// accept from the server as host key, in order of
// HostKeyAlgorithms lists the public key algorithms that the client will
// accept from the server for host key authentication, in order of
// preference. If empty, a reasonable default is used. Any
// string returned from PublicKey.Type method may be used, or
// any of the CertAlgoXxxx and KeyAlgoXxxx constants.
// string returned from a PublicKey.Type method may be used, or
// any of the CertAlgo and KeyAlgo constants.
HostKeyAlgorithms []string
// Timeout is the maximum amount of time for the TCP connection to establish.

@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"io"
"strings"
)
type authResult int
@ -29,6 +30,33 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error {
if err != nil {
return err
}
// The server may choose to send a SSH_MSG_EXT_INFO at this point (if we
// advertised willingness to receive one, which we always do) or not. See
// RFC 8308, Section 2.4.
extensions := make(map[string][]byte)
if len(packet) > 0 && packet[0] == msgExtInfo {
var extInfo extInfoMsg
if err := Unmarshal(packet, &extInfo); err != nil {
return err
}
payload := extInfo.Payload
for i := uint32(0); i < extInfo.NumExtensions; i++ {
name, rest, ok := parseString(payload)
if !ok {
return parseError(msgExtInfo)
}
value, rest, ok := parseString(rest)
if !ok {
return parseError(msgExtInfo)
}
extensions[string(name)] = value
payload = rest
}
packet, err = c.transport.readPacket()
if err != nil {
return err
}
}
var serviceAccept serviceAcceptMsg
if err := Unmarshal(packet, &serviceAccept); err != nil {
return err
@ -41,7 +69,7 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error {
sessionID := c.transport.getSessionID()
for auth := AuthMethod(new(noneAuth)); auth != nil; {
ok, methods, err := auth.auth(sessionID, config.User, c.transport, config.Rand)
ok, methods, err := auth.auth(sessionID, config.User, c.transport, config.Rand, extensions)
if err != nil {
return err
}
@ -93,7 +121,7 @@ type AuthMethod interface {
// If authentication is not successful, a []string of alternative
// method names is returned. If the slice is nil, it will be ignored
// and the previous set of possible methods will be reused.
auth(session []byte, user string, p packetConn, rand io.Reader) (authResult, []string, error)
auth(session []byte, user string, p packetConn, rand io.Reader, extensions map[string][]byte) (authResult, []string, error)
// method returns the RFC 4252 method name.
method() string
@ -102,7 +130,7 @@ type AuthMethod interface {
// "none" authentication, RFC 4252 section 5.2.
type noneAuth int
func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
if err := c.writePacket(Marshal(&userAuthRequestMsg{
User: user,
Service: serviceSSH,
@ -122,7 +150,7 @@ func (n *noneAuth) method() string {
// a function call, e.g. by prompting the user.
type passwordCallback func() (password string, err error)
func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
type passwordAuthMsg struct {
User string `sshtype:"50"`
Service string
@ -189,7 +217,46 @@ func (cb publicKeyCallback) method() string {
return "publickey"
}
func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
func pickSignatureAlgorithm(signer Signer, extensions map[string][]byte) (as AlgorithmSigner, algo string) {
keyFormat := signer.PublicKey().Type()
// Like in sendKexInit, if the public key implements AlgorithmSigner we
// assume it supports all algorithms, otherwise only the key format one.
as, ok := signer.(AlgorithmSigner)
if !ok {
return algorithmSignerWrapper{signer}, keyFormat
}
extPayload, ok := extensions["server-sig-algs"]
if !ok {
// If there is no "server-sig-algs" extension, fall back to the key
// format algorithm.
return as, keyFormat
}
// The server-sig-algs extension only carries underlying signature
// algorithm, but we are trying to select a protocol-level public key
// algorithm, which might be a certificate type. Extend the list of server
// supported algorithms to include the corresponding certificate algorithms.
serverAlgos := strings.Split(string(extPayload), ",")
for _, algo := range serverAlgos {
if certAlgo, ok := certificateAlgo(algo); ok {
serverAlgos = append(serverAlgos, certAlgo)
}
}
keyAlgos := algorithmsForKeyFormat(keyFormat)
algo, err := findCommon("public key signature algorithm", keyAlgos, serverAlgos)
if err != nil {
// If there is no overlap, try the key anyway with the key format
// algorithm, to support servers that fail to list all supported
// algorithms.
return as, keyFormat
}
return as, algo
}
func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader, extensions map[string][]byte) (authResult, []string, error) {
// Authentication is performed by sending an enquiry to test if a key is
// acceptable to the remote. If the key is acceptable, the client will
// attempt to authenticate with the valid key. If not the client will repeat
@ -201,7 +268,10 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand
}
var methods []string
for _, signer := range signers {
ok, err := validateKey(signer.PublicKey(), user, c)
pub := signer.PublicKey()
as, algo := pickSignatureAlgorithm(signer, extensions)
ok, err := validateKey(pub, algo, user, c)
if err != nil {
return authFailure, nil, err
}
@ -209,13 +279,13 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand
continue
}
pub := signer.PublicKey()
pubKey := pub.Marshal()
sign, err := signer.Sign(rand, buildDataSignedForAuth(session, userAuthRequestMsg{
data := buildDataSignedForAuth(session, userAuthRequestMsg{
User: user,
Service: serviceSSH,
Method: cb.method(),
}, []byte(pub.Type()), pubKey))
}, algo, pubKey)
sign, err := as.SignWithAlgorithm(rand, data, underlyingAlgo(algo))
if err != nil {
return authFailure, nil, err
}
@ -229,7 +299,7 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand
Service: serviceSSH,
Method: cb.method(),
HasSig: true,
Algoname: pub.Type(),
Algoname: algo,
PubKey: pubKey,
Sig: sig,
}
@ -266,26 +336,25 @@ func containsMethod(methods []string, method string) bool {
}
// validateKey validates the key provided is acceptable to the server.
func validateKey(key PublicKey, user string, c packetConn) (bool, error) {
func validateKey(key PublicKey, algo string, user string, c packetConn) (bool, error) {
pubKey := key.Marshal()
msg := publickeyAuthMsg{
User: user,
Service: serviceSSH,
Method: "publickey",
HasSig: false,
Algoname: key.Type(),
Algoname: algo,
PubKey: pubKey,
}
if err := c.writePacket(Marshal(&msg)); err != nil {
return false, err
}
return confirmKeyAck(key, c)
return confirmKeyAck(key, algo, c)
}
func confirmKeyAck(key PublicKey, c packetConn) (bool, error) {
func confirmKeyAck(key PublicKey, algo string, c packetConn) (bool, error) {
pubKey := key.Marshal()
algoname := key.Type()
for {
packet, err := c.readPacket()
@ -302,14 +371,14 @@ func confirmKeyAck(key PublicKey, c packetConn) (bool, error) {
if err := Unmarshal(packet, &msg); err != nil {
return false, err
}
if msg.Algo != algoname || !bytes.Equal(msg.PubKey, pubKey) {
if msg.Algo != algo || !bytes.Equal(msg.PubKey, pubKey) {
return false, nil
}
return true, nil
case msgUserAuthFailure:
return false, nil
default:
return false, unexpectedMessageError(msgUserAuthSuccess, packet[0])
return false, unexpectedMessageError(msgUserAuthPubKeyOk, packet[0])
}
}
}
@ -330,6 +399,7 @@ func PublicKeysCallback(getSigners func() (signers []Signer, err error)) AuthMet
// along with a list of remaining authentication methods to try next and
// an error if an unexpected response was received.
func handleAuthResponse(c packetConn) (authResult, []string, error) {
gotMsgExtInfo := false
for {
packet, err := c.readPacket()
if err != nil {
@ -341,6 +411,12 @@ func handleAuthResponse(c packetConn) (authResult, []string, error) {
if err := handleBannerResponse(c, packet); err != nil {
return authFailure, nil, err
}
case msgExtInfo:
// Ignore post-authentication RFC 8308 extensions, once.
if gotMsgExtInfo {
return authFailure, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0])
}
gotMsgExtInfo = true
case msgUserAuthFailure:
var msg userAuthFailureMsg
if err := Unmarshal(packet, &msg); err != nil {
@ -380,10 +456,10 @@ func handleBannerResponse(c packetConn, packet []byte) error {
// disabling echoing (e.g. for passwords), and return all the answers.
// Challenge may be called multiple times in a single session. After
// successful authentication, the server may send a challenge with no
// questions, for which the user and instruction messages should be
// questions, for which the name and instruction messages should be
// printed. RFC 4256 section 3.3 details how the UI should behave for
// both CLI and GUI environments.
type KeyboardInteractiveChallenge func(user, instruction string, questions []string, echos []bool) (answers []string, err error)
type KeyboardInteractiveChallenge func(name, instruction string, questions []string, echos []bool) (answers []string, err error)
// KeyboardInteractive returns an AuthMethod using a prompt/response
// sequence controlled by the server.
@ -395,7 +471,7 @@ func (cb KeyboardInteractiveChallenge) method() string {
return "keyboard-interactive"
}
func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
type initiateMsg struct {
User string `sshtype:"50"`
Service string
@ -412,6 +488,7 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe
return authFailure, nil, err
}
gotMsgExtInfo := false
for {
packet, err := c.readPacket()
if err != nil {
@ -425,6 +502,13 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe
return authFailure, nil, err
}
continue
case msgExtInfo:
// Ignore post-authentication RFC 8308 extensions, once.
if gotMsgExtInfo {
return authFailure, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
}
gotMsgExtInfo = true
continue
case msgUserAuthInfoRequest:
// OK
case msgUserAuthFailure:
@ -465,7 +549,7 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe
return authFailure, nil, errors.New("ssh: extra data following keyboard-interactive pairs")
}
answers, err := cb(msg.User, msg.Instruction, prompts, echos)
answers, err := cb(msg.Name, msg.Instruction, prompts, echos)
if err != nil {
return authFailure, nil, err
}
@ -497,9 +581,9 @@ type retryableAuthMethod struct {
maxTries int
}
func (r *retryableAuthMethod) auth(session []byte, user string, c packetConn, rand io.Reader) (ok authResult, methods []string, err error) {
func (r *retryableAuthMethod) auth(session []byte, user string, c packetConn, rand io.Reader, extensions map[string][]byte) (ok authResult, methods []string, err error) {
for i := 0; r.maxTries <= 0 || i < r.maxTries; i++ {
ok, methods, err = r.authMethod.auth(session, user, c, rand)
ok, methods, err = r.authMethod.auth(session, user, c, rand, extensions)
if ok != authFailure || err != nil { // either success, partial success or error terminate
return ok, methods, err
}
@ -542,7 +626,7 @@ type gssAPIWithMICCallback struct {
target string
}
func (g *gssAPIWithMICCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) {
func (g *gssAPIWithMICCallback) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
m := &userAuthRequestMsg{
User: user,
Service: serviceSSH,

@ -44,11 +44,11 @@ var preferredCiphers = []string{
// supportedKexAlgos specifies the supported key-exchange algorithms in
// preference order.
var supportedKexAlgos = []string{
kexAlgoCurve25519SHA256,
kexAlgoCurve25519SHA256, kexAlgoCurve25519SHA256LibSSH,
// P384 and P521 are not constant-time yet, but since we don't
// reuse ephemeral keys, using them for ECDH should be OK.
kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
kexAlgoDH14SHA1, kexAlgoDH1SHA1,
kexAlgoDH14SHA256, kexAlgoDH14SHA1, kexAlgoDH1SHA1,
}
// serverForbiddenKexAlgos contains key exchange algorithms, that are forbidden
@ -61,21 +61,21 @@ var serverForbiddenKexAlgos = map[string]struct{}{
// preferredKexAlgos specifies the default preference for key-exchange algorithms
// in preference order.
var preferredKexAlgos = []string{
kexAlgoCurve25519SHA256,
kexAlgoCurve25519SHA256, kexAlgoCurve25519SHA256LibSSH,
kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
kexAlgoDH14SHA1,
kexAlgoDH14SHA256, kexAlgoDH14SHA1,
}
// supportedHostKeyAlgos specifies the supported host-key algorithms (i.e. methods
// of authenticating servers) in preference order.
var supportedHostKeyAlgos = []string{
CertSigAlgoRSASHA2512v01, CertSigAlgoRSASHA2256v01,
CertSigAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,
CertAlgoRSASHA512v01, CertAlgoRSASHA256v01,
CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,
CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoED25519v01,
KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
SigAlgoRSASHA2512, SigAlgoRSASHA2256,
SigAlgoRSA, KeyAlgoDSA,
KeyAlgoRSASHA512, KeyAlgoRSASHA256,
KeyAlgoRSA, KeyAlgoDSA,
KeyAlgoED25519,
}
@ -89,23 +89,33 @@ var supportedMACs = []string{
var supportedCompressions = []string{compressionNone}
// hashFuncs keeps the mapping of supported algorithms to their respective
// hashes needed for signature verification.
// hashFuncs keeps the mapping of supported signature algorithms to their
// respective hashes needed for signing and verification.
var hashFuncs = map[string]crypto.Hash{
SigAlgoRSA: crypto.SHA1,
SigAlgoRSASHA2256: crypto.SHA256,
SigAlgoRSASHA2512: crypto.SHA512,
KeyAlgoDSA: crypto.SHA1,
KeyAlgoECDSA256: crypto.SHA256,
KeyAlgoECDSA384: crypto.SHA384,
KeyAlgoECDSA521: crypto.SHA512,
CertSigAlgoRSAv01: crypto.SHA1,
CertSigAlgoRSASHA2256v01: crypto.SHA256,
CertSigAlgoRSASHA2512v01: crypto.SHA512,
CertAlgoDSAv01: crypto.SHA1,
CertAlgoECDSA256v01: crypto.SHA256,
CertAlgoECDSA384v01: crypto.SHA384,
CertAlgoECDSA521v01: crypto.SHA512,
KeyAlgoRSA: crypto.SHA1,
KeyAlgoRSASHA256: crypto.SHA256,
KeyAlgoRSASHA512: crypto.SHA512,
KeyAlgoDSA: crypto.SHA1,
KeyAlgoECDSA256: crypto.SHA256,
KeyAlgoECDSA384: crypto.SHA384,
KeyAlgoECDSA521: crypto.SHA512,
// KeyAlgoED25519 doesn't pre-hash.
KeyAlgoSKECDSA256: crypto.SHA256,
KeyAlgoSKED25519: crypto.SHA256,
}
// algorithmsForKeyFormat returns the supported signature algorithms for a given
// public key format (PublicKey.Type), in order of preference. See RFC 8332,
// Section 2. See also the note in sendKexInit on backwards compatibility.
func algorithmsForKeyFormat(keyFormat string) []string {
switch keyFormat {
case KeyAlgoRSA:
return []string{KeyAlgoRSASHA256, KeyAlgoRSASHA512, KeyAlgoRSA}
case CertAlgoRSAv01:
return []string{CertAlgoRSASHA256v01, CertAlgoRSASHA512v01, CertAlgoRSAv01}
default:
return []string{keyFormat}
}
}
// unexpectedMessageError results when the SSH message that we received didn't
@ -152,6 +162,11 @@ func (a *directionAlgorithms) rekeyBytes() int64 {
return 1 << 30
}
var aeadCiphers = map[string]bool{
gcmCipherID: true,
chacha20Poly1305ID: true,
}
type algorithms struct {
kex string
hostKey string
@ -187,14 +202,18 @@ func findAgreedAlgorithms(isClient bool, clientKexInit, serverKexInit *kexInitMs
return
}
ctos.MAC, err = findCommon("client to server MAC", clientKexInit.MACsClientServer, serverKexInit.MACsClientServer)
if err != nil {
return
if !aeadCiphers[ctos.Cipher] {
ctos.MAC, err = findCommon("client to server MAC", clientKexInit.MACsClientServer, serverKexInit.MACsClientServer)
if err != nil {
return
}
}
stoc.MAC, err = findCommon("server to client MAC", clientKexInit.MACsServerClient, serverKexInit.MACsServerClient)
if err != nil {
return
if !aeadCiphers[stoc.Cipher] {
stoc.MAC, err = findCommon("server to client MAC", clientKexInit.MACsServerClient, serverKexInit.MACsServerClient)
if err != nil {
return
}
}
ctos.Compression, err = findCommon("client to server compression", clientKexInit.CompressionClientServer, serverKexInit.CompressionClientServer)
@ -278,8 +297,9 @@ func (c *Config) SetDefaults() {
}
// buildDataSignedForAuth returns the data that is signed in order to prove
// possession of a private key. See RFC 4252, section 7.
func buildDataSignedForAuth(sessionID []byte, req userAuthRequestMsg, algo, pubKey []byte) []byte {
// possession of a private key. See RFC 4252, section 7. algo is the advertised
// algorithm, and may be a certificate type.
func buildDataSignedForAuth(sessionID []byte, req userAuthRequestMsg, algo string, pubKey []byte) []byte {
data := struct {
Session []byte
Type byte
@ -287,7 +307,7 @@ func buildDataSignedForAuth(sessionID []byte, req userAuthRequestMsg, algo, pubK
Service string
Method string
Sign bool
Algo []byte
Algo string
PubKey []byte
}{
sessionID,

@ -455,21 +455,36 @@ func (t *handshakeTransport) sendKexInit() error {
}
io.ReadFull(rand.Reader, msg.Cookie[:])
if len(t.hostKeys) > 0 {
isServer := len(t.hostKeys) > 0
if isServer {
for _, k := range t.hostKeys {
algo := k.PublicKey().Type()
switch algo {
case KeyAlgoRSA:
msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, []string{SigAlgoRSASHA2512, SigAlgoRSASHA2256, SigAlgoRSA}...)
case CertAlgoRSAv01:
msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, []string{CertSigAlgoRSASHA2512v01, CertSigAlgoRSASHA2256v01, CertSigAlgoRSAv01}...)
default:
msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, algo)
// If k is an AlgorithmSigner, presume it supports all signature algorithms
// associated with the key format. (Ideally AlgorithmSigner would have a
// method to advertise supported algorithms, but it doesn't. This means that
// adding support for a new algorithm is a breaking change, as we will
// immediately negotiate it even if existing implementations don't support
// it. If that ever happens, we'll have to figure something out.)
// If k is not an AlgorithmSigner, we can only assume it only supports the
// algorithms that matches the key format. (This means that Sign can't pick
// a different default.)
keyFormat := k.PublicKey().Type()
if _, ok := k.(AlgorithmSigner); ok {
msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, algorithmsForKeyFormat(keyFormat)...)
} else {
msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, keyFormat)
}
}
} else {
msg.ServerHostKeyAlgos = t.hostKeyAlgorithms
// As a client we opt in to receiving SSH_MSG_EXT_INFO so we know what
// algorithms the server supports for public key authentication. See RFC
// 8303, Section 2.1.
msg.KexAlgos = make([]string, 0, len(t.config.KeyExchanges)+1)
msg.KexAlgos = append(msg.KexAlgos, t.config.KeyExchanges...)
msg.KexAlgos = append(msg.KexAlgos, "ext-info-c")
}
packet := Marshal(msg)
// writePacket destroys the contents, so save a copy.
@ -589,9 +604,9 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error {
var result *kexResult
if len(t.hostKeys) > 0 {
result, err = t.server(kex, t.algorithms, &magics)
result, err = t.server(kex, &magics)
} else {
result, err = t.client(kex, t.algorithms, &magics)
result, err = t.client(kex, &magics)
}
if err != nil {
@ -618,33 +633,52 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error {
return nil
}
func (t *handshakeTransport) server(kex kexAlgorithm, algs *algorithms, magics *handshakeMagics) (*kexResult, error) {
var hostKey Signer
for _, k := range t.hostKeys {
kt := k.PublicKey().Type()
if kt == algs.hostKey {
hostKey = k
} else if signer, ok := k.(AlgorithmSigner); ok {
// Some signature algorithms don't show up as key types
// so we have to manually check for a compatible host key.
switch kt {
case KeyAlgoRSA:
if algs.hostKey == SigAlgoRSASHA2256 || algs.hostKey == SigAlgoRSASHA2512 {
hostKey = &rsaSigner{signer, algs.hostKey}
}
case CertAlgoRSAv01:
if algs.hostKey == CertSigAlgoRSASHA2256v01 || algs.hostKey == CertSigAlgoRSASHA2512v01 {
hostKey = &rsaSigner{signer, certToPrivAlgo(algs.hostKey)}
}
// algorithmSignerWrapper is an AlgorithmSigner that only supports the default
// key format algorithm.
//
// This is technically a violation of the AlgorithmSigner interface, but it
// should be unreachable given where we use this. Anyway, at least it returns an
// error instead of panicing or producing an incorrect signature.
type algorithmSignerWrapper struct {
Signer
}
func (a algorithmSignerWrapper) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
if algorithm != underlyingAlgo(a.PublicKey().Type()) {
return nil, errors.New("ssh: internal error: algorithmSignerWrapper invoked with non-default algorithm")
}
return a.Sign(rand, data)
}
func pickHostKey(hostKeys []Signer, algo string) AlgorithmSigner {
for _, k := range hostKeys {
if algo == k.PublicKey().Type() {
return algorithmSignerWrapper{k}
}
k, ok := k.(AlgorithmSigner)
if !ok {
continue
}
for _, a := range algorithmsForKeyFormat(k.PublicKey().Type()) {
if algo == a {
return k
}
}
}
return nil
}
func (t *handshakeTransport) server(kex kexAlgorithm, magics *handshakeMagics) (*kexResult, error) {
hostKey := pickHostKey(t.hostKeys, t.algorithms.hostKey)
if hostKey == nil {
return nil, errors.New("ssh: internal error: negotiated unsupported signature type")
}
r, err := kex.Server(t.conn, t.config.Rand, magics, hostKey)
r, err := kex.Server(t.conn, t.config.Rand, magics, hostKey, t.algorithms.hostKey)
return r, err
}
func (t *handshakeTransport) client(kex kexAlgorithm, algs *algorithms, magics *handshakeMagics) (*kexResult, error) {
func (t *handshakeTransport) client(kex kexAlgorithm, magics *handshakeMagics) (*kexResult, error) {
result, err := kex.Client(t.conn, t.config.Rand, magics)
if err != nil {
return nil, err
@ -655,7 +689,7 @@ func (t *handshakeTransport) client(kex kexAlgorithm, algs *algorithms, magics *
return nil, err
}
if err := verifyHostKeySignature(hostKey, algs.hostKey, result); err != nil {
if err := verifyHostKeySignature(hostKey, t.algorithms.hostKey, result); err != nil {
return nil, err
}

@ -20,12 +20,14 @@ import (
)
const (
kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1"
kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1"
kexAlgoECDH256 = "ecdh-sha2-nistp256"
kexAlgoECDH384 = "ecdh-sha2-nistp384"
kexAlgoECDH521 = "ecdh-sha2-nistp521"
kexAlgoCurve25519SHA256 = "curve25519-sha256@libssh.org"
kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1"
kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1"
kexAlgoDH14SHA256 = "diffie-hellman-group14-sha256"
kexAlgoECDH256 = "ecdh-sha2-nistp256"
kexAlgoECDH384 = "ecdh-sha2-nistp384"
kexAlgoECDH521 = "ecdh-sha2-nistp521"
kexAlgoCurve25519SHA256LibSSH = "curve25519-sha256@libssh.org"
kexAlgoCurve25519SHA256 = "curve25519-sha256"
// For the following kex only the client half contains a production
// ready implementation. The server half only consists of a minimal
@ -75,8 +77,9 @@ func (m *handshakeMagics) write(w io.Writer) {
// kexAlgorithm abstracts different key exchange algorithms.
type kexAlgorithm interface {
// Server runs server-side key agreement, signing the result
// with a hostkey.
Server(p packetConn, rand io.Reader, magics *handshakeMagics, s Signer) (*kexResult, error)
// with a hostkey. algo is the negotiated algorithm, and may
// be a certificate type.
Server(p packetConn, rand io.Reader, magics *handshakeMagics, s AlgorithmSigner, algo string) (*kexResult, error)
// Client runs the client-side key agreement. Caller is
// responsible for verifying the host key signature.
@ -86,6 +89,7 @@ type kexAlgorithm interface {
// dhGroup is a multiplicative group suitable for implementing Diffie-Hellman key agreement.
type dhGroup struct {
g, p, pMinus1 *big.Int
hashFunc crypto.Hash
}
func (group *dhGroup) diffieHellman(theirPublic, myPrivate *big.Int) (*big.Int, error) {
@ -96,8 +100,6 @@ func (group *dhGroup) diffieHellman(theirPublic, myPrivate *big.Int) (*big.Int,
}
func (group *dhGroup) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
hashFunc := crypto.SHA1
var x *big.Int
for {
var err error
@ -132,7 +134,7 @@ func (group *dhGroup) Client(c packetConn, randSource io.Reader, magics *handsha
return nil, err
}
h := hashFunc.New()
h := group.hashFunc.New()
magics.write(h)
writeString(h, kexDHReply.HostKey)
writeInt(h, X)
@ -146,12 +148,11 @@ func (group *dhGroup) Client(c packetConn, randSource io.Reader, magics *handsha
K: K,
HostKey: kexDHReply.HostKey,
Signature: kexDHReply.Signature,
Hash: crypto.SHA1,
Hash: group.hashFunc,
}, nil
}
func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
hashFunc := crypto.SHA1
func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
packet, err := c.readPacket()
if err != nil {
return
@ -179,7 +180,7 @@ func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handsha
hostKeyBytes := priv.PublicKey().Marshal()
h := hashFunc.New()
h := group.hashFunc.New()
magics.write(h)
writeString(h, hostKeyBytes)
writeInt(h, kexDHInit.X)
@ -193,7 +194,7 @@ func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handsha
// H is already a hash, but the hostkey signing will apply its
// own key-specific hash algorithm.
sig, err := signAndMarshal(priv, randSource, H)
sig, err := signAndMarshal(priv, randSource, H, algo)
if err != nil {
return nil, err
}
@ -211,7 +212,7 @@ func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handsha
K: K,
HostKey: hostKeyBytes,
Signature: sig,
Hash: crypto.SHA1,
Hash: group.hashFunc,
}, err
}
@ -314,7 +315,7 @@ func validateECPublicKey(curve elliptic.Curve, x, y *big.Int) bool {
return true
}
func (kex *ecdh) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
func (kex *ecdh) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
packet, err := c.readPacket()
if err != nil {
return nil, err
@ -359,7 +360,7 @@ func (kex *ecdh) Server(c packetConn, rand io.Reader, magics *handshakeMagics, p
// H is already a hash, but the hostkey signing will apply its
// own key-specific hash algorithm.
sig, err := signAndMarshal(priv, rand, H)
sig, err := signAndMarshal(priv, rand, H, algo)
if err != nil {
return nil, err
}
@ -384,39 +385,62 @@ func (kex *ecdh) Server(c packetConn, rand io.Reader, magics *handshakeMagics, p
}, nil
}
// ecHash returns the hash to match the given elliptic curve, see RFC
// 5656, section 6.2.1
func ecHash(curve elliptic.Curve) crypto.Hash {
bitSize := curve.Params().BitSize
switch {
case bitSize <= 256:
return crypto.SHA256
case bitSize <= 384:
return crypto.SHA384
}
return crypto.SHA512
}
var kexAlgoMap = map[string]kexAlgorithm{}
func init() {
// This is the group called diffie-hellman-group1-sha1 in RFC
// 4253 and Oakley Group 2 in RFC 2409.
// This is the group called diffie-hellman-group1-sha1 in
// RFC 4253 and Oakley Group 2 in RFC 2409.
p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16)
kexAlgoMap[kexAlgoDH1SHA1] = &dhGroup{
g: new(big.Int).SetInt64(2),
p: p,
pMinus1: new(big.Int).Sub(p, bigOne),
g: new(big.Int).SetInt64(2),
p: p,
pMinus1: new(big.Int).Sub(p, bigOne),
hashFunc: crypto.SHA1,
}
// This is the group called diffie-hellman-group14-sha1 in RFC
// 4253 and Oakley Group 14 in RFC 3526.
// This are the groups called diffie-hellman-group14-sha1 and
// diffie-hellman-group14-sha256 in RFC 4253 and RFC 8268,
// and Oakley Group 14 in RFC 3526.
p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
kexAlgoMap[kexAlgoDH14SHA1] = &dhGroup{
group14 := &dhGroup{
g: new(big.Int).SetInt64(2),
p: p,
pMinus1: new(big.Int).Sub(p, bigOne),
}
kexAlgoMap[kexAlgoDH14SHA1] = &dhGroup{
g: group14.g, p: group14.p, pMinus1: group14.pMinus1,
hashFunc: crypto.SHA1,
}
kexAlgoMap[kexAlgoDH14SHA256] = &dhGroup{
g: group14.g, p: group14.p, pMinus1: group14.pMinus1,
hashFunc: crypto.SHA256,
}
kexAlgoMap[kexAlgoECDH521] = &ecdh{elliptic.P521()}
kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()}
kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()}
kexAlgoMap[kexAlgoCurve25519SHA256] = &curve25519sha256{}
kexAlgoMap[kexAlgoCurve25519SHA256LibSSH] = &curve25519sha256{}
kexAlgoMap[kexAlgoDHGEXSHA1] = &dhGEXSHA{hashFunc: crypto.SHA1}
kexAlgoMap[kexAlgoDHGEXSHA256] = &dhGEXSHA{hashFunc: crypto.SHA256}
}
// curve25519sha256 implements the curve25519-sha256@libssh.org key
// agreement protocol, as described in
// https://git.libssh.org/projects/libssh.git/tree/doc/curve25519-sha256@libssh.org.txt
// curve25519sha256 implements the curve25519-sha256 (formerly known as
// curve25519-sha256@libssh.org) key exchange method, as described in RFC 8731.
type curve25519sha256 struct{}
type curve25519KeyPair struct {
@ -486,7 +510,7 @@ func (kex *curve25519sha256) Client(c packetConn, rand io.Reader, magics *handsh
}, nil
}
func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
packet, err := c.readPacket()
if err != nil {
return
@ -527,7 +551,7 @@ func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handsh
H := h.Sum(nil)
sig, err := signAndMarshal(priv, rand, H)
sig, err := signAndMarshal(priv, rand, H, algo)
if err != nil {
return nil, err
}
@ -553,7 +577,6 @@ func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handsh
// diffie-hellman-group-exchange-sha256 key agreement protocols,
// as described in RFC 4419
type dhGEXSHA struct {
g, p *big.Int
hashFunc crypto.Hash
}
@ -563,14 +586,7 @@ const (
dhGroupExchangeMaximumBits = 8192
)
func (gex *dhGEXSHA) diffieHellman(theirPublic, myPrivate *big.Int) (*big.Int, error) {
if theirPublic.Sign() <= 0 || theirPublic.Cmp(gex.p) >= 0 {
return nil, fmt.Errorf("ssh: DH parameter out of bounds")
}
return new(big.Int).Exp(theirPublic, myPrivate, gex.p), nil
}
func (gex dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
func (gex *dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
// Send GexRequest
kexDHGexRequest := kexDHGexRequestMsg{
MinBits: dhGroupExchangeMinimumBits,
@ -587,35 +603,29 @@ func (gex dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshake
return nil, err
}
var kexDHGexGroup kexDHGexGroupMsg
if err = Unmarshal(packet, &kexDHGexGroup); err != nil {
var msg kexDHGexGroupMsg
if err = Unmarshal(packet, &msg); err != nil {
return nil, err
}
// reject if p's bit length < dhGroupExchangeMinimumBits or > dhGroupExchangeMaximumBits
if kexDHGexGroup.P.BitLen() < dhGroupExchangeMinimumBits || kexDHGexGroup.P.BitLen() > dhGroupExchangeMaximumBits {
return nil, fmt.Errorf("ssh: server-generated gex p is out of range (%d bits)", kexDHGexGroup.P.BitLen())
if msg.P.BitLen() < dhGroupExchangeMinimumBits || msg.P.BitLen() > dhGroupExchangeMaximumBits {
return nil, fmt.Errorf("ssh: server-generated gex p is out of range (%d bits)", msg.P.BitLen())
}
gex.p = kexDHGexGroup.P
gex.g = kexDHGexGroup.G
// Check if g is safe by verifing that g > 1 and g < p - 1
one := big.NewInt(1)
var pMinusOne = &big.Int{}
pMinusOne.Sub(gex.p, one)
if gex.g.Cmp(one) != 1 && gex.g.Cmp(pMinusOne) != -1 {
// Check if g is safe by verifying that 1 < g < p-1
pMinusOne := new(big.Int).Sub(msg.P, bigOne)
if msg.G.Cmp(bigOne) <= 0 || msg.G.Cmp(pMinusOne) >= 0 {
return nil, fmt.Errorf("ssh: server provided gex g is not safe")
}
// Send GexInit
var pHalf = &big.Int{}
pHalf.Rsh(gex.p, 1)
pHalf := new(big.Int).Rsh(msg.P, 1)
x, err := rand.Int(randSource, pHalf)
if err != nil {
return nil, err
}
X := new(big.Int).Exp(gex.g, x, gex.p)
X := new(big.Int).Exp(msg.G, x, msg.P)
kexDHGexInit := kexDHGexInitMsg{
X: X,
}
@ -634,13 +644,13 @@ func (gex dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshake
return nil, err
}
kInt, err := gex.diffieHellman(kexDHGexReply.Y, x)
if err != nil {
return nil, err
if kexDHGexReply.Y.Cmp(bigOne) <= 0 || kexDHGexReply.Y.Cmp(pMinusOne) >= 0 {
return nil, errors.New("ssh: DH parameter out of bounds")
}
kInt := new(big.Int).Exp(kexDHGexReply.Y, x, msg.P)
// Check if k is safe by verifing that k > 1 and k < p - 1
if kInt.Cmp(one) != 1 && kInt.Cmp(pMinusOne) != -1 {
// Check if k is safe by verifying that k > 1 and k < p - 1
if kInt.Cmp(bigOne) <= 0 || kInt.Cmp(pMinusOne) >= 0 {
return nil, fmt.Errorf("ssh: derived k is not safe")
}
@ -650,8 +660,8 @@ func (gex dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshake
binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMinimumBits))
binary.Write(h, binary.BigEndian, uint32(dhGroupExchangePreferredBits))
binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMaximumBits))
writeInt(h, gex.p)
writeInt(h, gex.g)
writeInt(h, msg.P)
writeInt(h, msg.G)
writeInt(h, X)
writeInt(h, kexDHGexReply.Y)
K := make([]byte, intLength(kInt))
@ -670,7 +680,7 @@ func (gex dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshake
// Server half implementation of the Diffie Hellman Key Exchange with SHA1 and SHA256.
//
// This is a minimal implementation to satisfy the automated tests.
func (gex dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) {
func (gex dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
// Receive GexRequest
packet, err := c.readPacket()
if err != nil {
@ -681,35 +691,17 @@ func (gex dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshake
return
}
// smoosh the user's preferred size into our own limits
if kexDHGexRequest.PreferedBits > dhGroupExchangeMaximumBits {
kexDHGexRequest.PreferedBits = dhGroupExchangeMaximumBits
}
if kexDHGexRequest.PreferedBits < dhGroupExchangeMinimumBits {
kexDHGexRequest.PreferedBits = dhGroupExchangeMinimumBits
}
// fix min/max if they're inconsistent. technically, we could just pout
// and hang up, but there's no harm in giving them the benefit of the
// doubt and just picking a bitsize for them.
if kexDHGexRequest.MinBits > kexDHGexRequest.PreferedBits {
kexDHGexRequest.MinBits = kexDHGexRequest.PreferedBits
}
if kexDHGexRequest.MaxBits < kexDHGexRequest.PreferedBits {
kexDHGexRequest.MaxBits = kexDHGexRequest.PreferedBits
}
// Send GexGroup
// This is the group called diffie-hellman-group14-sha1 in RFC
// 4253 and Oakley Group 14 in RFC 3526.
p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
gex.p = p
gex.g = big.NewInt(2)
g := big.NewInt(2)
kexDHGexGroup := kexDHGexGroupMsg{
P: gex.p,
G: gex.g,
msg := &kexDHGexGroupMsg{
P: p,
G: g,
}
if err := c.writePacket(Marshal(&kexDHGexGroup)); err != nil {
if err := c.writePacket(Marshal(msg)); err != nil {
return nil, err
}
@ -723,19 +715,19 @@ func (gex dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshake
return
}
var pHalf = &big.Int{}
pHalf.Rsh(gex.p, 1)
pHalf := new(big.Int).Rsh(p, 1)
y, err := rand.Int(randSource, pHalf)
if err != nil {
return
}
Y := new(big.Int).Exp(g, y, p)
Y := new(big.Int).Exp(gex.g, y, gex.p)
kInt, err := gex.diffieHellman(kexDHGexInit.X, y)
if err != nil {
return nil, err
pMinusOne := new(big.Int).Sub(p, bigOne)
if kexDHGexInit.X.Cmp(bigOne) <= 0 || kexDHGexInit.X.Cmp(pMinusOne) >= 0 {
return nil, errors.New("ssh: DH parameter out of bounds")
}
kInt := new(big.Int).Exp(kexDHGexInit.X, y, p)
hostKeyBytes := priv.PublicKey().Marshal()
@ -745,8 +737,8 @@ func (gex dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshake
binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMinimumBits))
binary.Write(h, binary.BigEndian, uint32(dhGroupExchangePreferredBits))
binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMaximumBits))
writeInt(h, gex.p)
writeInt(h, gex.g)
writeInt(h, p)
writeInt(h, g)
writeInt(h, kexDHGexInit.X)
writeInt(h, Y)
@ -758,7 +750,7 @@ func (gex dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshake
// H is already a hash, but the hostkey signing will apply its
// own key-specific hash algorithm.
sig, err := signAndMarshal(priv, randSource, H)
sig, err := signAndMarshal(priv, randSource, H, algo)
if err != nil {
return nil, err
}

@ -30,8 +30,9 @@ import (
"golang.org/x/crypto/ssh/internal/bcrypt_pbkdf"
)
// These constants represent the algorithm names for key types supported by this
// package.
// Public key algorithms names. These values can appear in PublicKey.Type,
// ClientConfig.HostKeyAlgorithms, Signature.Format, or as AlgorithmSigner
// arguments.
const (
KeyAlgoRSA = "ssh-rsa"
KeyAlgoDSA = "ssh-dss"
@ -41,16 +42,21 @@ const (
KeyAlgoECDSA521 = "ecdsa-sha2-nistp521"
KeyAlgoED25519 = "ssh-ed25519"
KeyAlgoSKED25519 = "sk-ssh-ed25519@openssh.com"
// KeyAlgoRSASHA256 and KeyAlgoRSASHA512 are only public key algorithms, not
// public key formats, so they can't appear as a PublicKey.Type. The
// corresponding PublicKey.Type is KeyAlgoRSA. See RFC 8332, Section 2.
KeyAlgoRSASHA256 = "rsa-sha2-256"
KeyAlgoRSASHA512 = "rsa-sha2-512"
)
// These constants represent non-default signature algorithms that are supported
// as algorithm parameters to AlgorithmSigner.SignWithAlgorithm methods. See
// [PROTOCOL.agent] section 4.5.1 and
// https://tools.ietf.org/html/draft-ietf-curdle-rsa-sha2-10
const (
SigAlgoRSA = "ssh-rsa"
SigAlgoRSASHA2256 = "rsa-sha2-256"
SigAlgoRSASHA2512 = "rsa-sha2-512"
// Deprecated: use KeyAlgoRSA.
SigAlgoRSA = KeyAlgoRSA
// Deprecated: use KeyAlgoRSASHA256.
SigAlgoRSASHA2256 = KeyAlgoRSASHA256
// Deprecated: use KeyAlgoRSASHA512.
SigAlgoRSASHA2512 = KeyAlgoRSASHA512
)
// parsePubKey parses a public key of the given algorithm.
@ -70,7 +76,7 @@ func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err err
case KeyAlgoSKED25519:
return parseSKEd25519(in)
case CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoSKECDSA256v01, CertAlgoED25519v01, CertAlgoSKED25519v01:
cert, err := parseCert(in, certToPrivAlgo(algo))
cert, err := parseCert(in, certKeyAlgoNames[algo])
if err != nil {
return nil, nil, err
}
@ -289,18 +295,21 @@ func MarshalAuthorizedKey(key PublicKey) []byte {
return b.Bytes()
}
// PublicKey is an abstraction of different types of public keys.
// PublicKey represents a public key using an unspecified algorithm.
//
// Some PublicKeys provided by this package also implement CryptoPublicKey.
type PublicKey interface {
// Type returns the key's type, e.g. "ssh-rsa".
// Type returns the key format name, e.g. "ssh-rsa".
Type() string
// Marshal returns the serialized key data in SSH wire format,
// with the name prefix. To unmarshal the returned data, use
// the ParsePublicKey function.
// Marshal returns the serialized key data in SSH wire format, with the name
// prefix. To unmarshal the returned data, use the ParsePublicKey function.
Marshal() []byte
// Verify that sig is a signature on the given data using this
// key. This function will hash the data appropriately first.
// Verify that sig is a signature on the given data using this key. This
// method will hash the data appropriately first. sig.Format is allowed to
// be any signature algorithm compatible with the key type, the caller
// should check if it has more stringent requirements.
Verify(data []byte, sig *Signature) error
}
@ -311,25 +320,32 @@ type CryptoPublicKey interface {
}
// A Signer can create signatures that verify against a public key.
//
// Some Signers provided by this package also implement AlgorithmSigner.
type Signer interface {
// PublicKey returns an associated PublicKey instance.
// PublicKey returns the associated PublicKey.
PublicKey() PublicKey
// Sign returns raw signature for the given data. This method
// will apply the hash specified for the keytype to the data.
// Sign returns a signature for the given data. This method will hash the
// data appropriately first. The signature algorithm is expected to match
// the key format returned by the PublicKey.Type method (and not to be any
// alternative algorithm supported by the key format).
Sign(rand io.Reader, data []byte) (*Signature, error)
}
// A AlgorithmSigner is a Signer that also supports specifying a specific
// algorithm to use for signing.
// An AlgorithmSigner is a Signer that also supports specifying an algorithm to
// use for signing.
//
// An AlgorithmSigner can't advertise the algorithms it supports, so it should
// be prepared to be invoked with every algorithm supported by the public key
// format.
type AlgorithmSigner interface {
Signer
// SignWithAlgorithm is like Signer.Sign, but allows specification of a
// non-default signing algorithm. See the SigAlgo* constants in this
// package for signature algorithms supported by this package. Callers may
// pass an empty string for the algorithm in which case the AlgorithmSigner
// will use its default algorithm.
// SignWithAlgorithm is like Signer.Sign, but allows specifying a desired
// signing algorithm. Callers may pass an empty string for the algorithm in
// which case the AlgorithmSigner will use a default algorithm. This default
// doesn't currently control any behavior in this package.
SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error)
}
@ -381,17 +397,11 @@ func (r *rsaPublicKey) Marshal() []byte {
}
func (r *rsaPublicKey) Verify(data []byte, sig *Signature) error {
var hash crypto.Hash
switch sig.Format {
case SigAlgoRSA:
hash = crypto.SHA1
case SigAlgoRSASHA2256:
hash = crypto.SHA256
case SigAlgoRSASHA2512:
hash = crypto.SHA512
default:
supportedAlgos := algorithmsForKeyFormat(r.Type())
if !contains(supportedAlgos, sig.Format) {
return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, r.Type())
}
hash := hashFuncs[sig.Format]
h := hash.New()
h.Write(data)
digest := h.Sum(nil)
@ -466,7 +476,7 @@ func (k *dsaPublicKey) Verify(data []byte, sig *Signature) error {
if sig.Format != k.Type() {
return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
}
h := crypto.SHA1.New()
h := hashFuncs[sig.Format].New()
h.Write(data)
digest := h.Sum(nil)
@ -499,7 +509,7 @@ func (k *dsaPrivateKey) PublicKey() PublicKey {
}
func (k *dsaPrivateKey) Sign(rand io.Reader, data []byte) (*Signature, error) {
return k.SignWithAlgorithm(rand, data, "")
return k.SignWithAlgorithm(rand, data, k.PublicKey().Type())
}
func (k *dsaPrivateKey) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
@ -507,7 +517,7 @@ func (k *dsaPrivateKey) SignWithAlgorithm(rand io.Reader, data []byte, algorithm
return nil, fmt.Errorf("ssh: unsupported signature algorithm %s", algorithm)
}
h := crypto.SHA1.New()
h := hashFuncs[k.PublicKey().Type()].New()
h.Write(data)
digest := h.Sum(nil)
r, s, err := dsa.Sign(rand, k.PrivateKey, digest)
@ -603,19 +613,6 @@ func supportedEllipticCurve(curve elliptic.Curve) bool {
return curve == elliptic.P256() || curve == elliptic.P384() || curve == elliptic.P521()
}
// ecHash returns the hash to match the given elliptic curve, see RFC
// 5656, section 6.2.1
func ecHash(curve elliptic.Curve) crypto.Hash {
bitSize := curve.Params().BitSize
switch {
case bitSize <= 256:
return crypto.SHA256
case bitSize <= 384:
return crypto.SHA384
}
return crypto.SHA512
}
// parseECDSA parses an ECDSA key according to RFC 5656, section 3.1.
func parseECDSA(in []byte) (out PublicKey, rest []byte, err error) {
var w struct {
@ -671,7 +668,7 @@ func (k *ecdsaPublicKey) Verify(data []byte, sig *Signature) error {
return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
}
h := ecHash(k.Curve).New()
h := hashFuncs[sig.Format].New()
h.Write(data)
digest := h.Sum(nil)
@ -775,7 +772,7 @@ func (k *skECDSAPublicKey) Verify(data []byte, sig *Signature) error {
return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
}
h := ecHash(k.Curve).New()
h := hashFuncs[sig.Format].New()
h.Write([]byte(k.application))
appDigest := h.Sum(nil)
@ -874,7 +871,7 @@ func (k *skEd25519PublicKey) Verify(data []byte, sig *Signature) error {
return fmt.Errorf("invalid size %d for Ed25519 public key", l)
}
h := sha256.New()
h := hashFuncs[sig.Format].New()
h.Write([]byte(k.application))
appDigest := h.Sum(nil)
@ -939,15 +936,6 @@ func newDSAPrivateKey(key *dsa.PrivateKey) (Signer, error) {
return &dsaPrivateKey{key}, nil
}
type rsaSigner struct {
AlgorithmSigner
defaultAlgorithm string
}
func (s *rsaSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
return s.AlgorithmSigner.SignWithAlgorithm(rand, data, s.defaultAlgorithm)
}
type wrappedSigner struct {
signer crypto.Signer
pubKey PublicKey
@ -970,44 +958,20 @@ func (s *wrappedSigner) PublicKey() PublicKey {
}
func (s *wrappedSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
return s.SignWithAlgorithm(rand, data, "")
return s.SignWithAlgorithm(rand, data, s.pubKey.Type())
}
func (s *wrappedSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
var hashFunc crypto.Hash
if _, ok := s.pubKey.(*rsaPublicKey); ok {
// RSA keys support a few hash functions determined by the requested signature algorithm
switch algorithm {
case "", SigAlgoRSA:
algorithm = SigAlgoRSA
hashFunc = crypto.SHA1
case SigAlgoRSASHA2256:
hashFunc = crypto.SHA256
case SigAlgoRSASHA2512:
hashFunc = crypto.SHA512
default:
return nil, fmt.Errorf("ssh: unsupported signature algorithm %s", algorithm)
}
} else {
// The only supported algorithm for all other key types is the same as the type of the key
if algorithm == "" {
algorithm = s.pubKey.Type()
} else if algorithm != s.pubKey.Type() {
return nil, fmt.Errorf("ssh: unsupported signature algorithm %s", algorithm)
}
if algorithm == "" {
algorithm = s.pubKey.Type()
}
switch key := s.pubKey.(type) {
case *dsaPublicKey:
hashFunc = crypto.SHA1
case *ecdsaPublicKey:
hashFunc = ecHash(key.Curve)
case ed25519PublicKey:
default:
return nil, fmt.Errorf("ssh: unsupported key type %T", key)
}
supportedAlgos := algorithmsForKeyFormat(s.pubKey.Type())
if !contains(supportedAlgos, algorithm) {
return nil, fmt.Errorf("ssh: unsupported signature algorithm %q for key format %q", algorithm, s.pubKey.Type())
}
hashFunc := hashFuncs[algorithm]
var digest []byte
if hashFunc != 0 {
h := hashFunc.New()

@ -141,6 +141,14 @@ type serviceAcceptMsg struct {
Service string `sshtype:"6"`
}
// See RFC 8308, section 2.3
const msgExtInfo = 7
type extInfoMsg struct {
NumExtensions uint32 `sshtype:"7"`
Payload []byte `ssh:"rest"`
}
// See RFC 4252, section 5.
const msgUserAuthRequest = 50
@ -180,11 +188,11 @@ const msgUserAuthInfoRequest = 60
const msgUserAuthInfoResponse = 61
type userAuthInfoRequestMsg struct {
User string `sshtype:"60"`
Instruction string
DeprecatedLanguage string
NumPrompts uint32
Prompts []byte `ssh:"rest"`
Name string `sshtype:"60"`
Instruction string
Language string
NumPrompts uint32
Prompts []byte `ssh:"rest"`
}
// See RFC 4254, section 5.1.
@ -782,6 +790,8 @@ func decode(packet []byte) (interface{}, error) {
msg = new(serviceRequestMsg)
case msgServiceAccept:
msg = new(serviceAcceptMsg)
case msgExtInfo:
msg = new(extInfoMsg)
case msgKexInit:
msg = new(kexInitMsg)
case msgKexDHInit:
@ -843,6 +853,7 @@ var packetTypeNames = map[byte]string{
msgDisconnect: "disconnectMsg",
msgServiceRequest: "serviceRequestMsg",
msgServiceAccept: "serviceAcceptMsg",
msgExtInfo: "extInfoMsg",
msgKexInit: "kexInitMsg",
msgKexDHInit: "kexDHInitMsg",
msgKexDHReply: "kexDHReplyMsg",

@ -120,7 +120,7 @@ type ServerConfig struct {
}
// AddHostKey adds a private key as a host key. If an existing host
// key exists with the same algorithm, it is overwritten. Each server
// key exists with the same public key format, it is replaced. Each server
// config must have at least one host key.
func (s *ServerConfig) AddHostKey(key Signer) {
for i, k := range s.hostKeys {
@ -212,9 +212,10 @@ func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewCha
}
// signAndMarshal signs the data with the appropriate algorithm,
// and serializes the result in SSH wire format.
func signAndMarshal(k Signer, rand io.Reader, data []byte) ([]byte, error) {
sig, err := k.Sign(rand, data)
// and serializes the result in SSH wire format. algo is the negotiate
// algorithm and may be a certificate type.
func signAndMarshal(k AlgorithmSigner, rand io.Reader, data []byte, algo string) ([]byte, error) {
sig, err := k.SignWithAlgorithm(rand, data, underlyingAlgo(algo))
if err != nil {
return nil, err
}
@ -284,7 +285,7 @@ func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error)
func isAcceptableAlgo(algo string) bool {
switch algo {
case SigAlgoRSA, SigAlgoRSASHA2256, SigAlgoRSASHA2512, KeyAlgoDSA, KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521, KeyAlgoSKECDSA256, KeyAlgoED25519, KeyAlgoSKED25519,
case KeyAlgoRSA, KeyAlgoRSASHA256, KeyAlgoRSASHA512, KeyAlgoDSA, KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521, KeyAlgoSKECDSA256, KeyAlgoED25519, KeyAlgoSKED25519,
CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoSKECDSA256v01, CertAlgoED25519v01, CertAlgoSKED25519v01:
return true
}
@ -553,6 +554,7 @@ userAuthLoop:
if !ok || len(payload) > 0 {
return nil, parseError(msgUserAuthRequest)
}
// Ensure the public key algo and signature algo
// are supported. Compare the private key
// algorithm name that corresponds to algo with
@ -562,7 +564,12 @@ userAuthLoop:
authErr = fmt.Errorf("ssh: algorithm %q not accepted", sig.Format)
break
}
signedData := buildDataSignedForAuth(sessionID, userAuthReq, algoBytes, pubKeyData)
if underlyingAlgo(algo) != sig.Format {
authErr = fmt.Errorf("ssh: signature %q not compatible with selected algorithm %q", sig.Format, algo)
break
}
signedData := buildDataSignedForAuth(sessionID, userAuthReq, algo, pubKeyData)
if err := pubKey.Verify(signedData, sig); err != nil {
return nil, err
@ -694,7 +701,7 @@ type sshClientKeyboardInteractive struct {
*connection
}
func (c *sshClientKeyboardInteractive) Challenge(user, instruction string, questions []string, echos []bool) (answers []string, err error) {
func (c *sshClientKeyboardInteractive) Challenge(name, instruction string, questions []string, echos []bool) (answers []string, err error) {
if len(questions) != len(echos) {
return nil, errors.New("ssh: echos and questions must have equal length")
}
@ -706,6 +713,7 @@ func (c *sshClientKeyboardInteractive) Challenge(user, instruction string, quest
}
if err := c.transport.writePacket(Marshal(&userAuthInfoRequestMsg{
Name: name,
Instruction: instruction,
NumPrompts: uint32(len(questions)),
Prompts: prompts,

@ -85,6 +85,7 @@ const (
IXANY = 39
IXOFF = 40
IMAXBEL = 41
IUTF8 = 42 // RFC 8160
ISIG = 50
ICANON = 51
XCASE = 52

@ -238,15 +238,19 @@ var (
// (to setup server->client keys) or clientKeys (for client->server keys).
func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (packetCipher, error) {
cipherMode := cipherModes[algs.Cipher]
macMode := macModes[algs.MAC]
iv := make([]byte, cipherMode.ivSize)
key := make([]byte, cipherMode.keySize)
macKey := make([]byte, macMode.keySize)
generateKeyMaterial(iv, d.ivTag, kex)
generateKeyMaterial(key, d.keyTag, kex)
generateKeyMaterial(macKey, d.macKeyTag, kex)
var macKey []byte
if !aeadCiphers[algs.Cipher] {
macMode := macModes[algs.MAC]
macKey = make([]byte, macMode.keySize)
generateKeyMaterial(macKey, d.macKeyTag, kex)
}
return cipherModes[algs.Cipher].create(key, iv, macKey, algs)
}

@ -61,12 +61,14 @@ test_windows386:
build_all_targets:
GOOS=darwin GOARCH=amd64 go build -v ./...
GOOS=darwin GOARCH=arm64 go build -v ./...
GOOS=freebsd GOARCH=amd64 go build -v ./...
GOOS=freebsd GOARCH=386 go build -v ./...
GOOS=freebsd GOARCH=amd64 go build -v ./...
GOOS=linux GOARCH=386 go build -v ./...
GOOS=linux GOARCH=amd64 go build -v ./...
GOOS=linux GOARCH=arm go build -v ./...
GOOS=linux GOARCH=arm64 go build -v ./...
GOOS=linux GOARCH=riscv64 go build -v ./...
GOOS=linux GOARCH=s390x go build -v ./...
GOOS=netbsd GOARCH=amd64 go build -v ./...
GOOS=windows GOARCH=386 go build -v ./...
GOOS=windows GOARCH=amd64 go build -v ./...

@ -5,17 +5,19 @@ import "encoding/binary"
// abiByteOrders contains byte order information for known architectures.
var (
abiByteOrders = map[string]binary.ByteOrder{
"amd64": binary.LittleEndian,
"386": binary.LittleEndian,
"arm": binary.LittleEndian,
"arm64": binary.LittleEndian,
"s390x": binary.BigEndian,
"386": binary.LittleEndian,
"amd64": binary.LittleEndian,
"arm": binary.LittleEndian,
"arm64": binary.LittleEndian,
"riscv64": binary.LittleEndian,
"s390x": binary.BigEndian,
}
abiSignedChar = map[[2]string]bool{
{"linux", "arm"}: false,
{"linux", "arm64"}: false,
{"linux", "s390x"}: false,
{"linux", "arm"}: false,
{"linux", "arm64"}: false,
{"linux", "s390x"}: false,
{"linux", "riscv64"}: false,
{"darwin", "amd64"}: true,
{"darwin", "arm64"}: true,
@ -487,4 +489,41 @@ var abiTypes = map[[2]string]map[Kind]ABIType{
Int128: {16, 16, 16},
UInt128: {16, 16, 16},
},
// gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
{"linux", "riscv64"}: {
Void: {1, 1, 1},
Bool: {1, 1, 1},
Char: {1, 1, 1},
SChar: {1, 1, 1},
UChar: {1, 1, 1},
Short: {2, 2, 2},
UShort: {2, 2, 2},
Enum: {4, 4, 4},
Int: {4, 4, 4},
UInt: {4, 4, 4},
Long: {8, 8, 8},
ULong: {8, 8, 8},
LongLong: {8, 8, 8},
ULongLong: {8, 8, 8},
Ptr: {8, 8, 8},
Function: {8, 8, 8},
Float: {4, 4, 4},
Double: {8, 8, 8},
LongDouble: {16, 16, 16},
Int8: {1, 1, 1},
UInt8: {1, 1, 1},
Int16: {2, 2, 2},
UInt16: {2, 2, 2},
Int32: {4, 4, 4},
UInt32: {4, 4, 4},
Int64: {8, 8, 8},
UInt64: {8, 8, 8},
Int128: {16, 16, 16},
UInt128: {16, 16, 16},
Float32: {4, 4, 4},
Float32x: {8, 8, 8},
Float64: {8, 8, 8},
Float64x: {16, 16, 16},
Float128: {16, 16, 16},
},
}

@ -80,6 +80,7 @@ build_all_targets:
GOOS=linux GOARCH=amd64 go test -c -o /dev/null
GOOS=linux GOARCH=arm go test -c -o /dev/null
GOOS=linux GOARCH=arm64 go test -c -o /dev/null
GOOS=linux GOARCH=riscv64 go test -c -o /dev/null
GOOS=linux GOARCH=s390x go test -c -o /dev/null
GOOS=netbsd GOARCH=amd64 go test -c -o /dev/null
GOOS=openbsd GOARCH=amd64 go test -c -o /dev/null

@ -14,3 +14,4 @@ Jason DeBettencourt <jasond17@gmail.com>
Koichi Shiraishi <zchee.io@gmail.com>
Marius Orcsik <marius@federated.id>
Steffen Butzer <steffen(dot)butzer@outlook.com>
ZHU Zijia <piggynl@outlook.com>

@ -0,0 +1,509 @@
// Code generated by 'go generate' - DO NOT EDIT.
package libc // import "modernc.org/libc"
var CAPI = map[string]struct{}{
"_IO_putc": {},
"___errno_location": {},
"__assert_fail": {},
"__builtin___memcpy_chk": {},
"__builtin___memmove_chk": {},
"__builtin___memset_chk": {},
"__builtin___snprintf_chk": {},
"__builtin___sprintf_chk": {},
"__builtin___strcat_chk": {},
"__builtin___strcpy_chk": {},
"__builtin___strncpy_chk": {},
"__builtin___vsnprintf_chk": {},
"__builtin_abort": {},
"__builtin_abs": {},
"__builtin_add_overflowInt64": {},
"__builtin_add_overflowUint32": {},
"__builtin_add_overflowUint64": {},
"__builtin_bswap16": {},
"__builtin_bswap32": {},
"__builtin_bswap64": {},
"__builtin_bzero": {},
"__builtin_clz": {},
"__builtin_clzl": {},
"__builtin_clzll": {},
"__builtin_constant_p_impl": {},
"__builtin_copysign": {},
"__builtin_copysignf": {},
"__builtin_copysignl": {},
"__builtin_exit": {},
"__builtin_expect": {},
"__builtin_fabs": {},
"__builtin_fabsf": {},
"__builtin_fabsl": {},
"__builtin_free": {},
"__builtin_getentropy": {},
"__builtin_huge_val": {},
"__builtin_huge_valf": {},
"__builtin_inf": {},
"__builtin_inff": {},
"__builtin_infl": {},
"__builtin_isnan": {},
"__builtin_isunordered": {},
"__builtin_malloc": {},
"__builtin_memcmp": {},
"__builtin_memcpy": {},
"__builtin_memset": {},
"__builtin_mmap": {},
"__builtin_mul_overflowInt64": {},
"__builtin_mul_overflowUint128": {},
"__builtin_mul_overflowUint64": {},
"__builtin_nan": {},
"__builtin_nanf": {},
"__builtin_nanl": {},
"__builtin_object_size": {},
"__builtin_popcount": {},
"__builtin_popcountl": {},
"__builtin_prefetch": {},
"__builtin_printf": {},
"__builtin_snprintf": {},
"__builtin_sprintf": {},
"__builtin_strchr": {},
"__builtin_strcmp": {},
"__builtin_strcpy": {},
"__builtin_strlen": {},
"__builtin_sub_overflowInt64": {},
"__builtin_trap": {},
"__builtin_unreachable": {},
"__ccgo_dmesg": {},
"__ccgo_getMutexType": {},
"__ccgo_in6addr_anyp": {},
"__ccgo_pthreadAttrGetDetachState": {},
"__ccgo_pthreadMutexattrGettype": {},
"__ccgo_sqlite3_log": {},
"__cmsg_nxthdr": {},
"__ctype_b_loc": {},
"__ctype_get_mb_cur_max": {},
"__errno_location": {},
"__floatscan": {},
"__fpclassify": {},
"__fpclassifyf": {},
"__fpclassifyl": {},
"__fsmu8": {},
"__h_errno_location": {},
"__inet_aton": {},
"__intscan": {},
"__isalnum_l": {},
"__isalpha_l": {},
"__isdigit_l": {},
"__islower_l": {},
"__isnan": {},
"__isnanf": {},
"__isnanl": {},
"__isoc99_sscanf": {},
"__isprint_l": {},
"__isupper_l": {},
"__isxdigit_l": {},
"__lockfile": {},
"__lookup_ipliteral": {},
"__lookup_name": {},
"__lookup_serv": {},
"__shgetc": {},
"__shlim": {},
"__strncasecmp_l": {},
"__sync_add_and_fetch_uint32": {},
"__sync_sub_and_fetch_uint32": {},
"__syscall1": {},
"__syscall3": {},
"__syscall4": {},
"__toread": {},
"__toread_needs_stdio_exit": {},
"__uflow": {},
"__unlockfile": {},
"_exit": {},
"_longjmp": {},
"_obstack_begin": {},
"_obstack_newchunk": {},
"_setjmp": {},
"abort": {},
"abs": {},
"accept": {},
"access": {},
"acos": {},
"acosh": {},
"alarm": {},
"asin": {},
"asinh": {},
"atan": {},
"atan2": {},
"atanh": {},
"atexit": {},
"atof": {},
"atoi": {},
"atol": {},
"backtrace": {},
"backtrace_symbols_fd": {},
"bind": {},
"bsearch": {},
"bzero": {},
"calloc": {},
"ceil": {},
"ceilf": {},
"cfgetospeed": {},
"cfsetispeed": {},
"cfsetospeed": {},
"chdir": {},
"chmod": {},
"chown": {},
"clock_gettime": {},
"close": {},
"closedir": {},
"confstr": {},
"connect": {},
"copysign": {},
"copysignf": {},
"copysignl": {},
"cos": {},
"cosf": {},
"cosh": {},
"ctime": {},
"ctime_r": {},
"dlclose": {},
"dlerror": {},
"dlopen": {},
"dlsym": {},
"dup2": {},
"endpwent": {},
"environ": {},
"execvp": {},
"exit": {},
"exp": {},
"fabs": {},
"fabsf": {},
"fabsl": {},
"fchmod": {},
"fchown": {},
"fclose": {},
"fcntl": {},
"fcntl64": {},
"fdopen": {},
"ferror": {},
"fflush": {},
"fgetc": {},
"fgets": {},
"fileno": {},
"floor": {},
"fmod": {},
"fmodl": {},
"fopen": {},
"fopen64": {},
"fork": {},
"fprintf": {},
"fputc": {},
"fputs": {},
"fread": {},
"free": {},
"freeaddrinfo": {},
"frexp": {},
"fscanf": {},
"fseek": {},
"fstat": {},
"fstat64": {},
"fstatfs": {},
"fsync": {},
"ftell": {},
"ftruncate": {},
"ftruncate64": {},
"fts64_close": {},
"fts64_open": {},
"fts64_read": {},
"fts_close": {},
"fts_open": {},
"fts_read": {},
"fwrite": {},
"gai_strerror": {},
"getaddrinfo": {},
"getc": {},
"getcwd": {},
"getegid": {},
"getentropy": {},
"getenv": {},
"geteuid": {},
"getgid": {},
"getgrgid": {},
"getgrgid_r": {},
"getgrnam": {},
"getgrnam_r": {},
"gethostbyaddr": {},
"gethostbyaddr_r": {},
"gethostbyname": {},
"gethostbyname2": {},
"gethostbyname2_r": {},
"gethostbyname_r": {},
"gethostname": {},
"getnameinfo": {},
"getpeername": {},
"getpid": {},
"getpwnam": {},
"getpwnam_r": {},
"getpwuid": {},
"getpwuid_r": {},
"getrandom": {},
"getresgid": {},
"getresuid": {},
"getrlimit": {},
"getrlimit64": {},
"getrusage": {},
"getservbyname": {},
"getsockname": {},
"getsockopt": {},
"gettimeofday": {},
"getuid": {},
"gmtime_r": {},
"h_errno": {},
"htonl": {},
"htons": {},
"hypot": {},
"inet_ntoa": {},
"inet_ntop": {},
"inet_pton": {},
"initstate": {},
"initstate_r": {},
"ioctl": {},
"isalnum": {},
"isalpha": {},
"isascii": {},
"isatty": {},
"isdigit": {},
"islower": {},
"isnan": {},
"isnanf": {},
"isnanl": {},
"isprint": {},
"isupper": {},
"iswalnum": {},
"iswspace": {},
"isxdigit": {},
"kill": {},
"ldexp": {},
"link": {},
"listen": {},
"localeconv": {},
"localtime": {},
"localtime_r": {},
"log": {},
"log10": {},
"longjmp": {},
"lrand48": {},
"lseek": {},
"lseek64": {},
"lstat": {},
"lstat64": {},
"malloc": {},
"mblen": {},
"mbrtowc": {},
"mbsinit": {},
"mbstowcs": {},
"mbtowc": {},
"memchr": {},
"memcmp": {},
"memcpy": {},
"memmove": {},
"memset": {},
"mkdir": {},
"mkfifo": {},
"mknod": {},
"mkostemp": {},
"mkstemp": {},
"mkstemp64": {},
"mkstemps": {},
"mkstemps64": {},
"mktime": {},
"mmap": {},
"mmap64": {},
"modf": {},
"mremap": {},
"munmap": {},
"nanf": {},
"nl_langinfo": {},
"ntohs": {},
"obstack_free": {},
"obstack_vprintf": {},
"open": {},
"open64": {},
"opendir": {},
"openpty": {},
"pathconf": {},
"pause": {},
"pclose": {},
"perror": {},
"pipe": {},
"poll": {},
"popen": {},
"posix_fadvise": {},
"pow": {},
"printf": {},
"pselect": {},
"pthread_attr_destroy": {},
"pthread_attr_getdetachstate": {},
"pthread_attr_init": {},
"pthread_attr_setdetachstate": {},
"pthread_attr_setscope": {},
"pthread_attr_setstacksize": {},
"pthread_cond_broadcast": {},
"pthread_cond_destroy": {},
"pthread_cond_init": {},
"pthread_cond_signal": {},
"pthread_cond_timedwait": {},
"pthread_cond_wait": {},
"pthread_create": {},
"pthread_detach": {},
"pthread_equal": {},
"pthread_exit": {},
"pthread_getspecific": {},
"pthread_join": {},
"pthread_key_create": {},
"pthread_key_delete": {},
"pthread_mutex_destroy": {},
"pthread_mutex_init": {},
"pthread_mutex_lock": {},
"pthread_mutex_trylock": {},
"pthread_mutex_unlock": {},
"pthread_mutexattr_destroy": {},
"pthread_mutexattr_init": {},
"pthread_mutexattr_settype": {},
"pthread_self": {},
"pthread_setspecific": {},
"putc": {},
"putchar": {},
"puts": {},
"pwrite": {},
"qsort": {},
"raise": {},
"rand": {},
"rand_r": {},
"random": {},
"random_r": {},
"read": {},
"readdir": {},
"readdir64": {},
"readlink": {},
"readv": {},
"realloc": {},
"reallocarray": {},
"realpath": {},
"recv": {},
"recvfrom": {},
"recvmsg": {},
"remove": {},
"rename": {},
"rewind": {},
"rindex": {},
"rint": {},
"rmdir": {},
"round": {},
"scalbn": {},
"scalbnl": {},
"sched_yield": {},
"select": {},
"send": {},
"sendmsg": {},
"sendto": {},
"setbuf": {},
"setenv": {},
"setjmp": {},
"setlocale": {},
"setrlimit": {},
"setrlimit64": {},
"setsid": {},
"setsockopt": {},
"setstate": {},
"setvbuf": {},
"shmat": {},
"shmctl": {},
"shmdt": {},
"shutdown": {},
"sigaction": {},
"signal": {},
"sin": {},
"sinf": {},
"sinh": {},
"sleep": {},
"snprintf": {},
"socket": {},
"sprintf": {},
"sqrt": {},
"srand48": {},
"sscanf": {},
"stat": {},
"stat64": {},
"stderr": {},
"stdin": {},
"stdout": {},
"strcasecmp": {},
"strcat": {},
"strchr": {},
"strcmp": {},
"strcpy": {},
"strcspn": {},
"strdup": {},
"strerror": {},
"strerror_r": {},
"strlcat": {},
"strlcpy": {},
"strlen": {},
"strncasecmp": {},
"strncat": {},
"strncmp": {},
"strncpy": {},
"strnlen": {},
"strpbrk": {},
"strrchr": {},
"strspn": {},
"strstr": {},
"strtod": {},
"strtof": {},
"strtoimax": {},
"strtok": {},
"strtol": {},
"strtold": {},
"strtoll": {},
"strtoul": {},
"strtoull": {},
"strtoumax": {},
"symlink": {},
"sysconf": {},
"system": {},
"tan": {},
"tanh": {},
"tcgetattr": {},
"tcsendbreak": {},
"tcsetattr": {},
"time": {},
"tmpfile": {},
"tolower": {},
"toupper": {},
"trunc": {},
"tzset": {},
"umask": {},
"uname": {},
"ungetc": {},
"unlink": {},
"unsetenv": {},
"usleep": {},
"utime": {},
"utimes": {},
"uuid_copy": {},
"uuid_generate_random": {},
"uuid_parse": {},
"uuid_unparse": {},
"vasprintf": {},
"vfprintf": {},
"vfscanf": {},
"vprintf": {},
"vsnprintf": {},
"vsprintf": {},
"vsscanf": {},
"waitpid": {},
"wcschr": {},
"wctomb": {},
"wcwidth": {},
"write": {},
"writev": {},
"zero_struct_address": {},
}

@ -0,0 +1,5 @@
// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_riscv64.go -pkgname errno', DO NOT EDIT.
package errno
var CAPI = map[string]struct{}{}

@ -0,0 +1,187 @@
// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_riscv64.go -pkgname errno', DO NOT EDIT.
package errno
import (
"math"
"reflect"
"sync/atomic"
"unsafe"
)
var _ = math.Pi
var _ reflect.Kind
var _ atomic.Value
var _ unsafe.Pointer
const (
E2BIG = 7
EACCES = 13
EADDRINUSE = 98
EADDRNOTAVAIL = 99
EADV = 68
EAFNOSUPPORT = 97
EAGAIN = 11
EALREADY = 114
EBADE = 52
EBADF = 9
EBADFD = 77
EBADMSG = 74
EBADR = 53
EBADRQC = 56
EBADSLT = 57
EBFONT = 59
EBUSY = 16
ECANCELED = 125
ECHILD = 10
ECHRNG = 44
ECOMM = 70
ECONNABORTED = 103
ECONNREFUSED = 111
ECONNRESET = 104
EDEADLK = 35
EDEADLOCK = 35
EDESTADDRREQ = 89
EDOM = 33
EDOTDOT = 73
EDQUOT = 122
EEXIST = 17
EFAULT = 14
EFBIG = 27
EHOSTDOWN = 112
EHOSTUNREACH = 113
EHWPOISON = 133
EIDRM = 43
EILSEQ = 84
EINPROGRESS = 115
EINTR = 4
EINVAL = 22
EIO = 5
EISCONN = 106
EISDIR = 21
EISNAM = 120
EKEYEXPIRED = 127
EKEYREJECTED = 129
EKEYREVOKED = 128
EL2HLT = 51
EL2NSYNC = 45
EL3HLT = 46
EL3RST = 47
ELIBACC = 79
ELIBBAD = 80
ELIBEXEC = 83
ELIBMAX = 82
ELIBSCN = 81
ELNRNG = 48
ELOOP = 40
EMEDIUMTYPE = 124
EMFILE = 24
EMLINK = 31
EMSGSIZE = 90
EMULTIHOP = 72
ENAMETOOLONG = 36
ENAVAIL = 119
ENETDOWN = 100
ENETRESET = 102
ENETUNREACH = 101
ENFILE = 23
ENOANO = 55
ENOBUFS = 105
ENOCSI = 50
ENODATA = 61
ENODEV = 19
ENOENT = 2
ENOEXEC = 8
ENOKEY = 126
ENOLCK = 37
ENOLINK = 67
ENOMEDIUM = 123
ENOMEM = 12
ENOMSG = 42
ENONET = 64
ENOPKG = 65
ENOPROTOOPT = 92
ENOSPC = 28
ENOSR = 63
ENOSTR = 60
ENOSYS = 38
ENOTBLK = 15
ENOTCONN = 107
ENOTDIR = 20
ENOTEMPTY = 39
ENOTNAM = 118
ENOTRECOVERABLE = 131
ENOTSOCK = 88
ENOTSUP = 95
ENOTTY = 25
ENOTUNIQ = 76
ENXIO = 6
EOPNOTSUPP = 95
EOVERFLOW = 75
EOWNERDEAD = 130
EPERM = 1
EPFNOSUPPORT = 96
EPIPE = 32
EPROTO = 71
EPROTONOSUPPORT = 93
EPROTOTYPE = 91
ERANGE = 34
EREMCHG = 78
EREMOTE = 66
EREMOTEIO = 121
ERESTART = 85
ERFKILL = 132
EROFS = 30
ESHUTDOWN = 108
ESOCKTNOSUPPORT = 94
ESPIPE = 29
ESRCH = 3
ESRMNT = 69
ESTALE = 116
ESTRPIPE = 86
ETIME = 62
ETIMEDOUT = 110
ETOOMANYREFS = 109
ETXTBSY = 26
EUCLEAN = 117
EUNATCH = 49
EUSERS = 87
EWOULDBLOCK = 11
EXDEV = 18
EXFULL = 54
X_ASM_GENERIC_ERRNO_BASE_H = 0
X_ASM_GENERIC_ERRNO_H = 0
X_ATFILE_SOURCE = 1
X_BITS_ERRNO_H = 1
X_DEFAULT_SOURCE = 1
X_ERRNO_H = 1
X_FEATURES_H = 1
X_FILE_OFFSET_BITS = 64
X_LP64 = 1
X_POSIX_C_SOURCE = 200809
X_POSIX_SOURCE = 1
X_STDC_PREDEF_H = 1
X_SYS_CDEFS_H = 1
Linux = 1
Unix = 1
)
type Ptrdiff_t = int64 /* <builtin>:3:26 */
type Size_t = uint64 /* <builtin>:9:23 */
type Wchar_t = int32 /* <builtin>:15:24 */
type X__int128_t = struct {
Flo int64
Fhi int64
} /* <builtin>:21:43 */ // must match modernc.org/mathutil.Int128
type X__uint128_t = struct {
Flo uint64
Fhi uint64
} /* <builtin>:22:44 */ // must match modernc.org/mathutil.Int128
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
type X__float128 = float64 /* <builtin>:47:21 */
var _ uint8 /* gen.c:2:13: */

@ -0,0 +1,5 @@
// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_riscv64.go -pkgname fcntl', DO NOT EDIT.
package fcntl
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_riscv64.go -pkgname fts', DO NOT EDIT.
package fts
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_riscv64.go -pkgname grp', DO NOT EDIT.
package grp
var CAPI = map[string]struct{}{}

@ -0,0 +1,953 @@
// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_riscv64.go -pkgname grp', DO NOT EDIT.
package grp
import (
"math"
"reflect"
"sync/atomic"
"unsafe"
)
var _ = math.Pi
var _ reflect.Kind
var _ atomic.Value
var _ unsafe.Pointer
const (
NSS_BUFLEN_GROUP = 1024
X_ATFILE_SOURCE = 1
X_BITS_TIME64_H = 1
X_BITS_TYPESIZES_H = 1
X_BITS_TYPES_H = 1
X_BSD_SIZE_T_ = 0
X_BSD_SIZE_T_DEFINED_ = 0
X_DEFAULT_SOURCE = 1
X_FEATURES_H = 1
X_FILE_OFFSET_BITS = 64
X_GCC_SIZE_T = 0
X_GRP_H = 1
X_LP64 = 1
X_POSIX_C_SOURCE = 200809
X_POSIX_SOURCE = 1
X_SIZET_ = 0
X_SIZE_T = 0
X_SIZE_T_ = 0
X_SIZE_T_DECLARED = 0
X_SIZE_T_DEFINED = 0
X_SIZE_T_DEFINED_ = 0
X_STDC_PREDEF_H = 1
X_SYS_CDEFS_H = 1
X_SYS_SIZE_T_H = 0
X_T_SIZE = 0
X_T_SIZE_ = 0
Linux = 1
Unix = 1
)
type Ptrdiff_t = int64 /* <builtin>:3:26 */
type Size_t = uint64 /* <builtin>:9:23 */
type Wchar_t = int32 /* <builtin>:15:24 */
type X__int128_t = struct {
Flo int64
Fhi int64
} /* <builtin>:21:43 */ // must match modernc.org/mathutil.Int128
type X__uint128_t = struct {
Flo uint64
Fhi uint64
} /* <builtin>:22:44 */ // must match modernc.org/mathutil.Int128
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
type X__float128 = float64 /* <builtin>:47:21 */
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// POSIX Standard: 9.2.1 Group Database Access <grp.h>
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// These are defined by the user (or the compiler)
// to specify the desired environment:
//
// __STRICT_ANSI__ ISO Standard C.
// _ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
// _ISOC11_SOURCE Extensions to ISO C99 from ISO C11.
// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X.
// __STDC_WANT_LIB_EXT2__
// Extensions to ISO C99 from TR 27431-2:2010.
// __STDC_WANT_IEC_60559_BFP_EXT__
// Extensions to ISO C11 from TS 18661-1:2014.
// __STDC_WANT_IEC_60559_FUNCS_EXT__
// Extensions to ISO C11 from TS 18661-4:2015.
// __STDC_WANT_IEC_60559_TYPES_EXT__
// Extensions to ISO C11 from TS 18661-3:2015.
// __STDC_WANT_IEC_60559_EXT__
// ISO C2X interfaces defined only in Annex F.
//
// _POSIX_SOURCE IEEE Std 1003.1.
// _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
// if >=199309L, add IEEE Std 1003.1b-1993;
// if >=199506L, add IEEE Std 1003.1c-1995;
// if >=200112L, all of IEEE 1003.1-2004
// if >=200809L, all of IEEE 1003.1-2008
// _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
// Single Unix conformance is wanted, to 600 for the
// sixth revision, to 700 for the seventh revision.
// _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
// _LARGEFILE_SOURCE Some more functions for correct standard I/O.
// _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
// _FILE_OFFSET_BITS=N Select default filesystem interface.
// _ATFILE_SOURCE Additional *at interfaces.
// _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant)
// MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
// _GNU_SOURCE All of the above, plus GNU extensions.
// _DEFAULT_SOURCE The default set of features (taking precedence over
// __STRICT_ANSI__).
//
// _FORTIFY_SOURCE Add security hardening to many library functions.
// Set to 1 or 2; 2 performs stricter checks than 1.
//
// _REENTRANT, _THREAD_SAFE
// Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
//
// The `-ansi' switch to the GNU C compiler, and standards conformance
// options such as `-std=c99', define __STRICT_ANSI__. If none of
// these are defined, or if _DEFAULT_SOURCE is defined, the default is
// to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
// 200809L, as well as enabling miscellaneous functions from BSD and
// SVID. If more than one of these are defined, they accumulate. For
// example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
// give you ISO C, 1003.1, and 1003.2, but nothing else.
//
// These are defined by this file and are used by the
// header files to decide what to declare or define:
//
// __GLIBC_USE (F) Define things from feature set F. This is defined
// to 1 or 0; the subsequent macros are either defined
// or undefined, and those tests should be moved to
// __GLIBC_USE.
// __USE_ISOC11 Define ISO C11 things.
// __USE_ISOC99 Define ISO C99 things.
// __USE_ISOC95 Define ISO C90 AMD1 (C95) things.
// __USE_ISOCXX11 Define ISO C++11 things.
// __USE_POSIX Define IEEE Std 1003.1 things.
// __USE_POSIX2 Define IEEE Std 1003.2 things.
// __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
// __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things.
// __USE_XOPEN Define XPG things.
// __USE_XOPEN_EXTENDED Define X/Open Unix things.
// __USE_UNIX98 Define Single Unix V2 things.
// __USE_XOPEN2K Define XPG6 things.
// __USE_XOPEN2KXSI Define XPG6 XSI things.
// __USE_XOPEN2K8 Define XPG7 things.
// __USE_XOPEN2K8XSI Define XPG7 XSI things.
// __USE_LARGEFILE Define correct standard I/O things.
// __USE_LARGEFILE64 Define LFS things with separate names.
// __USE_FILE_OFFSET64 Define 64bit interface as default.
// __USE_MISC Define things from 4.3BSD or System V Unix.
// __USE_ATFILE Define *at interfaces and AT_* constants for them.
// __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant)
// MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
// __USE_GNU Define GNU extensions.
// __USE_FORTIFY_LEVEL Additional security measures used, according to level.
//
// The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
// defined by this file unconditionally. `__GNU_LIBRARY__' is provided
// only for compatibility. All new code should use the other symbols
// to test for features.
//
// All macros listed above as possibly being defined by this file are
// explicitly undefined if they are not explicitly defined.
// Feature-test macros that are not defined by the user or compiler
// but are implied by the other feature-test macros defined (or by the
// lack of any definitions) are defined by the file.
//
// ISO C feature test macros depend on the definition of the macro
// when an affected header is included, not when the first system
// header is included, and so they are handled in
// <bits/libc-header-start.h>, which does not have a multiple include
// guard. Feature test macros that can be handled from the first
// system header included are handled here.
// Undefine everything, so we get a clean slate.
// Suppress kernel-name space pollution unless user expressedly asks
// for it.
// Convenience macro to test the version of gcc.
// Use like this:
// #if __GNUC_PREREQ (2,8)
// ... code requiring gcc 2.8 or later ...
// #endif
// Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
// added in 2.0.
// Similarly for clang. Features added to GCC after version 4.2 may
// or may not also be available in clang, and clang's definitions of
// __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such
// features can be queried via __has_extension/__has_feature.
// Whether to use feature set F.
// _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
// _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not
// issue a warning; the expectation is that the source is being
// transitioned to use the new macro.
// If _GNU_SOURCE was defined by the user, turn on all the other features.
// If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
// define _DEFAULT_SOURCE.
// This is to enable the ISO C2X extension.
// This is to enable the ISO C11 extension.
// This is to enable the ISO C99 extension.
// This is to enable the ISO C90 Amendment 1:1995 extension.
// If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
// is defined, use POSIX.1-2008 (or another version depending on
// _XOPEN_SOURCE).
// Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
// defined in all multithreaded code. GNU libc has not required this
// for many years. We now treat them as compatibility synonyms for
// _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
// comprehensive support for multithreaded code. Using them never
// lowers the selected level of POSIX conformance, only raises it.
// Features part to handle 64-bit time_t support.
// Copyright (C) 2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// We need to know the word size in order to check the time size.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// The function 'gets' existed in C89, but is impossible to use
// safely. It has been removed from ISO C11 and ISO C++14. Note: for
// compatibility with various implementations of <cstdio>, this test
// must consider only the value of __cplusplus when compiling C++.
// GNU formerly extended the scanf functions with modified format
// specifiers %as, %aS, and %a[...] that allocate a buffer for the
// input using malloc. This extension conflicts with ISO C99, which
// defines %a as a standalone format specifier that reads a floating-
// point number; moreover, POSIX.1-2008 provides the same feature
// using the modifier letter 'm' instead (%ms, %mS, %m[...]).
//
// We now follow C99 unless GNU extensions are active and the compiler
// is specifically in C89 or C++98 mode (strict or not). For
// instance, with GCC, -std=gnu11 will have C99-compliant scanf with
// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
// old extension.
// Get definitions of __STDC_* predefined macros, if the compiler has
// not preincluded this header automatically.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// This macro indicates that the installed library is the GNU C Library.
// For historic reasons the value now is 6 and this will stay from now
// on. The use of this variable is deprecated. Use __GLIBC__ and
// __GLIBC_MINOR__ now (see below) when you want to test for a specific
// GNU C library version and use the values in <gnu/lib-names.h> to get
// the sonames of the shared libraries.
// Major and minor version number of the GNU C library package. Use
// these macros to test for features in specific releases.
// This is here only because every header file already includes this one.
// Copyright (C) 1992-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// We are almost always included from features.h.
// The GNU libc does not support any K&R compilers or the traditional mode
// of ISO C compilers anymore. Check for some of the combinations not
// supported anymore.
// Some user header file might have defined this before.
// Compilers that lack __has_attribute may object to
// #if defined __has_attribute && __has_attribute (...)
// even though they do not need to evaluate the right-hand side of the &&.
// Similarly for __has_builtin, etc.
// All functions, except those with callbacks or those that
// synchronize memory, are leaf functions.
// GCC can always grok prototypes. For C++ programs we add throw()
// to help it optimize the function calls. But this only works with
// gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
// as non-throwing using a function attribute since programs can use
// the -fexceptions options for C code as well.
// These two macros are not used in glibc anymore. They are kept here
// only because some other projects expect the macros to be defined.
// For these things, GCC behaves the ANSI way normally,
// and the non-ANSI way under -traditional.
// This is not a typedef so `const __ptr_t' does the right thing.
// C++ needs to know that types and declarations are C, not C++.
// Fortify support.
// Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available.
// Support for flexible arrays.
// Headers that should use flexible arrays only if they're "real"
// (e.g. only if they won't affect sizeof()) should test
// #if __glibc_c99_flexarr_available.
// __asm__ ("xyz") is used throughout the headers to rename functions
// at the assembly language level. This is wrapped by the __REDIRECT
// macro, in order to support compilers that can do this some other
// way. When compilers don't support asm-names at all, we have to do
// preprocessor tricks instead (which don't have exactly the right
// semantics, but it's the best we can do).
//
// Example:
// int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid);
//
// #elif __SOME_OTHER_COMPILER__
//
// # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
// GCC and clang have various useful declarations that can be made with
// the '__attribute__' syntax. All of the ways we use this do fine if
// they are omitted for compilers that don't understand it.
// At some point during the gcc 2.96 development the `malloc' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// Tell the compiler which arguments to an allocation function
// indicate the size of the allocation.
// At some point during the gcc 2.96 development the `pure' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// This declaration tells the compiler that the value is constant.
// At some point during the gcc 3.1 development the `used' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// Since version 3.2, gcc allows marking deprecated functions.
// Since version 4.5, gcc also allows one to specify the message printed
// when a deprecated function is used. clang claims to be gcc 4.2, but
// may also support this feature.
// At some point during the gcc 2.8 development the `format_arg' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// If several `format_arg' attributes are given for the same function, in
// gcc-3.0 and older, all but the last one are ignored. In newer gccs,
// all designated arguments are considered.
// At some point during the gcc 2.97 development the `strfmon' format
// attribute for functions was introduced. We don't want to use it
// unconditionally (although this would be possible) since it
// generates warnings.
// The nonnull function attribute marks pointer parameters that
// must not be NULL.
// The returns_nonnull function attribute marks the return type of the function
// as always being non-null.
// If fortification mode, we warn about unused results of certain
// function calls which can lead to problems.
// Forces a function to be always inlined.
// The Linux kernel defines __always_inline in stddef.h (283d7573), and
// it conflicts with this definition. Therefore undefine it first to
// allow either header to be included first.
// Associate error messages with the source location of the call site rather
// than with the source location inside the function.
// GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
// inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
// or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
// older than 4.3 may define these macros and still not guarantee GNU inlining
// semantics.
//
// clang++ identifies itself as gcc-4.2, but has support for GNU inlining
// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
// __GNUC_GNU_INLINE__ macro definitions.
// GCC 4.3 and above allow passing all anonymous arguments of an
// __extern_always_inline function to some other vararg function.
// It is possible to compile containing GCC extensions even if GCC is
// run in pedantic mode if the uses are carefully marked using the
// `__extension__' keyword. But this is not generally available before
// version 2.8.
// __restrict is known in EGCS 1.2 and above, and in clang.
// It works also in C++ mode (outside of arrays), but only when spelled
// as '__restrict', not 'restrict'.
// ISO C99 also allows to declare arrays as non-overlapping. The syntax is
// array_name[restrict]
// GCC 3.1 and clang support this.
// This syntax is not usable in C++ mode.
// Describes a char array whose address can safely be passed as the first
// argument to strncpy and strncat, as the char array is not necessarily
// a NUL-terminated string.
// Undefine (also defined in libc-symbols.h).
// Copies attributes from the declaration or type referenced by
// the argument.
// The #ifndef lets Gnulib avoid including these on non-glibc
// platforms, where the includes typically do not exist.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Properties of long double type. ldbl-128 version.
// Copyright (C) 2016-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// long double is distinct from double, so there is nothing to
// define here.
// __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
// intended for use in preprocessor macros.
//
// Note: MESSAGE must be a _single_ string; concatenation of string
// literals is not supported.
// Generic selection (ISO C11) is a C-only feature, available in GCC
// since version 4.9. Previous versions do not provide generic
// selection, even though they might set __STDC_VERSION__ to 201112L,
// when in -std=c11 mode. Thus, we must check for !defined __GNUC__
// when testing __STDC_VERSION__ for generic selection support.
// On the other hand, Clang also defines __GNUC__, so a clang-specific
// check is required to enable the use of generic selection.
// Designates a 1-based positional argument ref-index of pointer type
// that can be used to access size-index elements of the pointed-to
// array according to access mode, or at least one element when
// size-index is not provided:
// access (access-mode, <ref-index> [, <size-index>])
// Designates dealloc as a function to call to deallocate objects
// allocated by the declared function.
// Specify that a function such as setjmp or vfork may return
// twice.
// If we don't have __REDIRECT, prototypes will be missing if
// __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64].
// Decide whether we can define 'extern inline' functions in headers.
// This is here only because every header file already includes this one.
// Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
// <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
// that will always return failure (and set errno to ENOSYS).
// This file is automatically generated.
// This file selects the right generated file of `__stub_FUNCTION' macros
// based on the architecture being compiled for.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// This file is automatically generated.
// It defines a symbol `__stub_FUNCTION' for each function
// in the C library which is a stub, meaning it will fail
// every time called, usually setting errno to ENOSYS.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// Convenience types.
type X__u_char = uint8 /* types.h:31:23 */
type X__u_short = uint16 /* types.h:32:28 */
type X__u_int = uint32 /* types.h:33:22 */
type X__u_long = uint64 /* types.h:34:27 */
// Fixed-size types, underlying types depend on word size and compiler.
type X__int8_t = int8 /* types.h:37:21 */
type X__uint8_t = uint8 /* types.h:38:23 */
type X__int16_t = int16 /* types.h:39:26 */
type X__uint16_t = uint16 /* types.h:40:28 */
type X__int32_t = int32 /* types.h:41:20 */
type X__uint32_t = uint32 /* types.h:42:22 */
type X__int64_t = int64 /* types.h:44:25 */
type X__uint64_t = uint64 /* types.h:45:27 */
// Smallest types with at least a given width.
type X__int_least8_t = X__int8_t /* types.h:52:18 */
type X__uint_least8_t = X__uint8_t /* types.h:53:19 */
type X__int_least16_t = X__int16_t /* types.h:54:19 */
type X__uint_least16_t = X__uint16_t /* types.h:55:20 */
type X__int_least32_t = X__int32_t /* types.h:56:19 */
type X__uint_least32_t = X__uint32_t /* types.h:57:20 */
type X__int_least64_t = X__int64_t /* types.h:58:19 */
type X__uint_least64_t = X__uint64_t /* types.h:59:20 */
// quad_t is also 64 bits.
type X__quad_t = int64 /* types.h:63:18 */
type X__u_quad_t = uint64 /* types.h:64:27 */
// Largest integral types.
type X__intmax_t = int64 /* types.h:72:18 */
type X__uintmax_t = uint64 /* types.h:73:27 */
// The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
// macros for each of the OS types we define below. The definitions
// of those macros must use the following macros for underlying types.
// We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
// variants of each of the following integer types on this machine.
//
// 16 -- "natural" 16-bit type (always short)
// 32 -- "natural" 32-bit type (always int)
// 64 -- "natural" 64-bit type (long or long long)
// LONG32 -- 32-bit type, traditionally long
// QUAD -- 64-bit type, traditionally long long
// WORD -- natural type of __WORDSIZE bits (int or long)
// LONGWORD -- type of __WORDSIZE bits, traditionally long
//
// We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
// conventional uses of `long' or `long long' type modifiers match the
// types we define, even when a less-adorned type would be the same size.
// This matters for (somewhat) portably writing printf/scanf formats for
// these types, where using the appropriate l or ll format modifiers can
// make the typedefs and the formats match up across all GNU platforms. If
// we used `long' when it's 64 bits where `long long' is expected, then the
// compiler would warn about the formats not matching the argument types,
// and the programmer changing them to shut up the compiler would break the
// program's portability.
//
// Here we assume what is presently the case in all the GCC configurations
// we support: long long is always 64 bits, long is always word/address size,
// and int is always 32 bits.
// No need to mark the typedef with __extension__.
// bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.
// Copyright (C) 2011-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
// Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// See <bits/types.h> for the meaning of these macros. This file exists so
// that <bits/types.h> need not vary across different GNU platforms.
// Tell the libc code that off_t and off64_t are actually the same type
// for all ABI purposes, even if possibly expressed as different base types
// for C type-checking purposes.
// Same for ino_t and ino64_t.
// And for __rlim_t and __rlim64_t.
// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.
// And for getitimer, setitimer and rusage
// Number of descriptors that can fit in an `fd_set'.
// bits/time64.h -- underlying types for __time64_t. RISC-V version.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Define __TIME64_T_TYPE so that it is always a 64-bit type.
// If we already have 64-bit time type then use it.
type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers.
type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications.
type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications.
type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers.
type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS).
type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks.
type X__nlink_t = uint32 /* types.h:151:27 */ // Type of file link counts.
type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets.
type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS).
type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications.
type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs.
type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts.
type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement.
type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS).
type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs.
type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch.
type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds.
type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds.
type X__suseconds64_t = int64 /* types.h:163:33 */
type X__daddr_t = int32 /* types.h:165:27 */ // The type of a disk address.
type X__key_t = int32 /* types.h:166:25 */ // Type of an IPC key.
// Clock ID used in clock and timer functions.
type X__clockid_t = int32 /* types.h:169:29 */
// Timer ID returned by `timer_create'.
type X__timer_t = uintptr /* types.h:172:12 */
// Type to represent block size.
type X__blksize_t = int32 /* types.h:175:29 */
// Types from the Large File Support interface.
// Type to count number of disk blocks.
type X__blkcnt_t = int64 /* types.h:180:28 */
type X__blkcnt64_t = int64 /* types.h:181:30 */
// Type to count file system blocks.
type X__fsblkcnt_t = uint64 /* types.h:184:30 */
type X__fsblkcnt64_t = uint64 /* types.h:185:32 */
// Type to count file system nodes.
type X__fsfilcnt_t = uint64 /* types.h:188:30 */
type X__fsfilcnt64_t = uint64 /* types.h:189:32 */
// Type of miscellaneous file system fields.
type X__fsword_t = int64 /* types.h:192:28 */
type X__ssize_t = int64 /* types.h:194:27 */ // Type of a byte count, or error.
// Signed long type used in system calls.
type X__syscall_slong_t = int64 /* types.h:197:33 */
// Unsigned long type used in system calls.
type X__syscall_ulong_t = uint64 /* types.h:199:33 */
// These few don't really vary by system, they always correspond
// to one of the other defined types.
type X__loff_t = X__off64_t /* types.h:203:19 */ // Type of file sizes and offsets (LFS).
type X__caddr_t = uintptr /* types.h:204:14 */
// Duplicates info from stdint.h but this is used in unistd.h.
type X__intptr_t = int64 /* types.h:207:25 */
// Duplicate info from sys/socket.h.
type X__socklen_t = uint32 /* types.h:210:23 */
// C99: An integer type that can be accessed as an atomic entity,
// even in the presence of asynchronous interrupts.
// It is not currently necessary for this to be machine-specific.
type X__sig_atomic_t = int32 /* types.h:215:13 */
// Wide character type.
// Locale-writers should change this as necessary to
// be big enough to hold unique values not between 0 and 127,
// and not (wchar_t) -1, for each defined multibyte character.
// Define this type if we are doing the whole job,
// or if we want this type in particular.
// A null pointer constant.
// For the Single Unix specification we must define this type here.
type Gid_t = X__gid_t /* grp.h:37:17 */
// The group structure.
type Group = struct {
Fgr_name uintptr
Fgr_passwd uintptr
Fgr_gid X__gid_t
F__ccgo_pad1 [4]byte
Fgr_mem uintptr
} /* grp.h:42:1 */
var _ uint8 /* gen.c:2:13: */

@ -751,7 +751,10 @@ func init() {
portproto := strings.SplitN(fields[1], "/", 2)
port, err := strconv.ParseInt(portproto[0], 10, 32)
if err != nil {
panic(err)
// If we find lines that don't match the expected format we skip over them.
// The expected format is <service-name> <port>/<protocol> [aliases ...]
// As we're using strings.Fields for splitting the line, failures can happen if the service name field contains white spaces.
continue
}
proto := portproto[1]

@ -0,0 +1,5 @@
// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_riscv64.go -pkgname langinfo', DO NOT EDIT.
package langinfo
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build amd64 || arm64 || s390x
// +build amd64 arm64 s390x
//go:build amd64 || arm64 || riscv64 || s390x
// +build amd64 arm64 riscv64 s390x
package libc // import "modernc.org/libc"

@ -200,6 +200,18 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
return int32(n)
}
// int openat(int dirfd, const char *pathname, int flags, mode_t mode);
func Xopenat(t *TLS, dirfd int32, pathname uintptr, flags int32, mode types.Mode_t) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
fd, _, err := unix.Syscall6(unix.SYS_OPENAT, uintptr(dirfd), pathname, uintptr(flags), uintptr(mode), 0, 0)
if err != 0 {
t.setErrno(err)
return -1
}
return int32(fd)
}
// off_t lseek(int fd, off_t offset, int whence);
func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
return types.Off_t(Xlseek64(t, fd, offset, whence))
@ -347,6 +359,29 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
return 0
}
// int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);
func Xfchmodat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t, flags int32) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
// Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior
// and check the flags. Otherwise the mode would be applied to the symlink
// destination which is not what the user expects.
if flags&^unix.AT_SYMLINK_NOFOLLOW != 0 {
t.setErrno(unix.EINVAL)
return -1
} else if flags&unix.AT_SYMLINK_NOFOLLOW != 0 {
t.setErrno(unix.EOPNOTSUPP)
return -1
}
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_FCHMODAT, uintptr(dirfd), pathname, uintptr(mode)); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int fchown(int fd, uid_t owner, gid_t group);
func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 {
@ -1421,3 +1456,136 @@ func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
copy((*RawMem)(unsafe.Pointer(uu))[:unsafe.Sizeof(uuid.Uuid_t{})], r[:])
return 0
}
// int mkdirat(int dirfd, const char *pathname, mode_t mode);
func Xmkdirat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_MKDIRAT, uintptr(dirfd), pathname, uintptr(mode)); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int symlinkat(const char *target, int newdirfd, const char *linkpath);
func Xsymlinkat(t *TLS, target uintptr, newdirfd int32, linkpath uintptr) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_SYMLINKAT, target, uintptr(newdirfd), linkpath); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags);
func Xutimensat(t *TLS, dirfd int32, pathname, times uintptr, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_UTIMENSAT, uintptr(dirfd), pathname, times, uintptr(flags), 0, 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int unlinkat(int dirfd, const char *pathname, int flags);
func Xunlinkat(t *TLS, dirfd int32, pathname uintptr, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_UNLINKAT, uintptr(dirfd), pathname, uintptr(flags)); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int faccessat(int dirfd, const char *pathname, int mode, int flags);
func Xfaccessat(t *TLS, dirfd int32, pathname uintptr, mode, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_FACCESSAT, uintptr(dirfd), pathname, uintptr(mode)); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags);
func Xrenameat2(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_RENAMEAT2, uintptr(olddirfd), oldpath, uintptr(newdirfd), newpath, uintptr(flags), 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev);
func Xmknodat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_MKNODAT, uintptr(dirfd), pathname, uintptr(mode), uintptr(dev), 0, 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags);
func Xfchownat(t *TLS, dirfd int32, pathname uintptr, uid types.Uid_t, gid types.Gid_t, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_FCHOWNAT, uintptr(dirfd), pathname, uintptr(uid), uintptr(gid), uintptr(flags), 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int linkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags);
func Xlinkat(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_LINKAT, uintptr(olddirfd), oldpath, uintptr(newdirfd), newpath, uintptr(flags), 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int pipe2(int pipefd[2], int flags);
func Xpipe2(t *TLS, pipefd uintptr, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_PIPE2, pipefd, uintptr(flags), 0); err != 0 {
t.setErrno(t)
return -1
}
return 0
}
// int dup3(int oldfd, int newfd, int flags);
func Xdup3(t *TLS, oldfd int32, newfd int32, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// ssize_t readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);
func Xreadlinkat(t *TLS, dirfd int32, pathname, buf uintptr, bufsiz types.Size_t) types.Ssize_t {
// From golang.org/x/sys/unix/zsyscall_linux.go
n, _, err := unix.Syscall6(unix.SYS_READLINKAT, uintptr(dirfd), pathname, buf, uintptr(bufsiz), 0, 0)
if err != 0 {
t.setErrno(err)
return -1
}
return types.Ssize_t(n)
}

@ -0,0 +1,413 @@
// Copyright 2020 The Libc 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 libc // import "modernc.org/libc"
import (
"os"
"strings"
"unicode"
"unsafe"
"golang.org/x/sys/unix"
"modernc.org/libc/errno"
"modernc.org/libc/fcntl"
"modernc.org/libc/signal"
"modernc.org/libc/sys/types"
"modernc.org/libc/utime"
"modernc.org/libc/wctype"
)
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// musl/arch/x86_64/ksigaction.h
//
// struct k_sigaction {
// void (*handler)(int);
// unsigned long flags;
// void (*restorer)(void);
// unsigned mask[2];
// };
type k_sigaction struct {
handler uintptr
flags ulong
restorer uintptr
mask [2]uint32
}
var kact, koldact uintptr
if act != 0 {
sz := int(unsafe.Sizeof(k_sigaction{}))
kact = t.Alloc(sz)
defer t.Free(sz)
*(*k_sigaction)(unsafe.Pointer(kact)) = k_sigaction{
handler: (*signal.Sigaction)(unsafe.Pointer(act)).F__sigaction_handler.Fsa_handler,
flags: ulong((*signal.Sigaction)(unsafe.Pointer(act)).Fsa_flags),
restorer: (*signal.Sigaction)(unsafe.Pointer(act)).Fsa_restorer,
}
Xmemcpy(t, kact+unsafe.Offsetof(k_sigaction{}.mask), act+unsafe.Offsetof(signal.Sigaction{}.Fsa_mask), types.Size_t(unsafe.Sizeof(k_sigaction{}.mask)))
}
if oldact != 0 {
panic(todo(""))
}
if _, _, err := unix.Syscall6(unix.SYS_RT_SIGACTION, uintptr(signum), kact, koldact, unsafe.Sizeof(k_sigaction{}.mask), 0, 0); err != 0 {
t.setErrno(err)
return -1
}
if oldact != 0 {
panic(todo(""))
}
return 0
}
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
}
if cmd == fcntl.F_SETFL {
arg |= unix.O_LARGEFILE
}
n, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(fd), uintptr(cmd), arg)
if err != 0 {
// if dmesgs {
// dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd)
// }
t.setErrno(err)
return -1
}
// if dmesgs {
// dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n)
// }
return int32(n)
}
// int fstatat(int dirfd, const char *pathname, struct stat *statbuf, int flags);
func Xfstatat(t *TLS, dirfd int32, pathname, statbuf uintptr, flags int32) int32 {
// From golang.org/x/sys/unix/zsyscall_linux_riscv64.go
if _, _, err := unix.Syscall6(unix.SYS_FSTATAT, uintptr(dirfd), pathname, statbuf, uintptr(flags), 0, 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xfstatat(t, unix.AT_FDCWD, pathname, statbuf, unix.AT_SYMLINK_NOFOLLOW)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xfstatat(t, unix.AT_FDCWD, pathname, statbuf, 0)
}
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
// }
t.setErrno(err)
return -1
}
// if dmesgs {
// dmesg("%v: %d size %#x: ok\n%+v", origin(1), fd, (*stat.Stat)(unsafe.Pointer(statbuf)).Fst_size, (*stat.Stat)(unsafe.Pointer(statbuf)))
// }
return 0
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
// if dmesgs {
// dmesg("%v: %v", origin(1), err)
// }
t.setErrno(err)
return ^uintptr(0) // (void*)-1
}
// if dmesgs {
// dmesg("%v: %#x", origin(1), data)
// }
return data
}
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
}
data, _, err := unix.Syscall6(unix.SYS_MREMAP, old_address, uintptr(old_size), uintptr(new_size), uintptr(flags), arg, 0)
if err != 0 {
// if dmesgs {
// dmesg("%v: %v", origin(1), err)
// }
t.setErrno(err)
return ^uintptr(0) // (void*)-1
}
// if dmesgs {
// dmesg("%v: %#x", origin(1), data)
// }
return data
}
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
// }
t.setErrno(err)
return -1
}
// if dmesgs {
// dmesg("%v: %d %#x: ok", origin(1), fd, length)
// }
return 0
}
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
if err != 0 {
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), fd, offset, whenceStr(whence), err)
// }
t.setErrno(err)
return -1
}
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: %#x", origin(1), fd, offset, whenceStr(whence), n)
// }
return types.Off_t(n)
}
// From man utime executed on linux/riscv64:
//
// The utimbuf structure is:
//
// struct utimbuf {
// time_t actime; /* access time */
// time_t modtime; /* modification time */
// };
type utimbuf struct {
actime utime.Time_t
modtime utime.Time_t
}
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
if times == 0 {
return Xutimes(t, filename, 0)
}
n := int(unsafe.Sizeof([2]types.Timeval{}))
p := t.Alloc(n)
defer t.Free(n)
*(*[2]types.Timeval)(unsafe.Pointer(p)) = [2]types.Timeval{
{Ftv_sec: (*utimbuf)(unsafe.Pointer(times)).actime},
{Ftv_sec: (*utimbuf)(unsafe.Pointer(times)).modtime},
}
return Xutimes(t, filename, p)
}
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
panic(todo(""))
// No alarm syscall on linux/riscv64. And cannot implement with setitimer as in musl,
// because of missing defination to constant ITIMER_REAL in types_linux_riscv64.go.
}
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
var tv types.Timeval
if err := Xgettimeofday(t, uintptr(unsafe.Pointer(&tv)), 0); err != 0 {
t.setErrno(err)
return -1
}
if tloc != 0 {
*(*types.Time_t)(unsafe.Pointer(tloc)) = tv.Ftv_sec
}
return tv.Ftv_sec
}
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
}
return 0
}
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xmkdirat(t, unix.AT_FDCWD, path, mode)
}
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xsymlinkat(t, target, unix.AT_FDCWD, linkpath)
}
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xfchmodat(t, unix.AT_FDCWD, pathname, mode, 0)
}
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
return Xutimensat(t, unix.AT_FDCWD, filename, times, 0)
}
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xunlinkat(t, unix.AT_FDCWD, pathname, 0)
}
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xfaccessat(t, unix.AT_FDCWD, pathname, mode, 0)
}
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xunlinkat(t, unix.AT_FDCWD, pathname, unix.AT_REMOVEDIR)
}
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xrenameat(t, unix.AT_FDCWD, oldpath, unix.AT_FDCWD, newpath)
}
// int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
func Xrenameat(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xrenameat2(t, olddirfd, oldpath, newdirfd, newpath, 0)
}
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xmknodat(t, unix.AT_FDCWD, pathname, mode, dev)
}
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xfchownat(t, unix.AT_FDCWD, pathname, owner, group, 0)
}
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xlinkat(t, unix.AT_FDCWD, oldpath, unix.AT_FDCWD, newpath, 0)
}
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xpipe2(t, pipefd, 0)
}
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// From golang.org/x/sys/unix/syscall_linux.go
return Xdup3(t, oldfd, newfd, 0)
}
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// From golang.org/x/sys/unix/syscall_linux.go
return Xreadlinkat(t, unix.AT_FDCWD, path, buf, bufsize)
}
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
case "r":
flags = os.O_RDONLY
case "r+":
flags = os.O_RDWR
case "w":
flags = os.O_WRONLY | os.O_CREATE | os.O_TRUNC
case "w+":
flags = os.O_RDWR | os.O_CREATE | os.O_TRUNC
case "a":
flags = os.O_WRONLY | os.O_CREATE | os.O_APPEND
case "a+":
flags = os.O_RDWR | os.O_CREATE | os.O_APPEND
default:
panic(m)
}
//TODO- flags |= fcntl.O_LARGEFILE
// From golang.org/x/sys/unix/syscall_linux.go
fd := Xopenat(t, unix.AT_FDCWD, pathname, int32(flags|unix.O_LARGEFILE), 0666)
if fd == -1 {
return 0
}
if p := newFile(t, fd); p != 0 {
return p
}
Xclose(t, fd)
t.setErrno(errno.ENOMEM)
return 0
}
// int iswspace(wint_t wc);
func Xiswspace(t *TLS, wc wctype.Wint_t) int32 {
return Bool32(unicode.IsSpace(rune(wc)))
}
// int iswalnum(wint_t wc);
func Xiswalnum(t *TLS, wc wctype.Wint_t) int32 {
return Bool32(unicode.IsLetter(rune(wc)) || unicode.IsNumber(rune(wc)))
}
func __syscall1(t *TLS, trap, p1 long) long {
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0))
}
func __syscall3(t *TLS, trap, p1, p2, p3 long) long {
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3)))
}
func __syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0))
}

@ -0,0 +1,5 @@
// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_riscv64.go -pkgname limits', DO NOT EDIT.
package limits
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_riscv64.go -pkgname netdb', DO NOT EDIT.
package netdb
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_riscv64.go -pkgname in', DO NOT EDIT.
package in
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_riscv64.go -pkgname poll', DO NOT EDIT.
package poll
var CAPI = map[string]struct{}{}

@ -0,0 +1,677 @@
// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_riscv64.go -pkgname poll', DO NOT EDIT.
package poll
import (
"math"
"reflect"
"sync/atomic"
"unsafe"
)
var _ = math.Pi
var _ reflect.Kind
var _ atomic.Value
var _ unsafe.Pointer
const (
POLLERR = 0x008
POLLHUP = 0x010
POLLIN = 0x001
POLLNVAL = 0x020
POLLOUT = 0x004
POLLPRI = 0x002
POLLRDBAND = 0x080
POLLRDNORM = 0x040
POLLWRBAND = 0x200
POLLWRNORM = 0x100
X_ATFILE_SOURCE = 1
X_DEFAULT_SOURCE = 1
X_FEATURES_H = 1
X_FILE_OFFSET_BITS = 64
X_LP64 = 1
X_POSIX_C_SOURCE = 200809
X_POSIX_SOURCE = 1
X_STDC_PREDEF_H = 1
X_SYS_CDEFS_H = 1
X_SYS_POLL_H = 1
Linux = 1
Unix = 1
)
type Ptrdiff_t = int64 /* <builtin>:3:26 */
type Size_t = uint64 /* <builtin>:9:23 */
type Wchar_t = int32 /* <builtin>:15:24 */
type X__int128_t = struct {
Flo int64
Fhi int64
} /* <builtin>:21:43 */ // must match modernc.org/mathutil.Int128
type X__uint128_t = struct {
Flo uint64
Fhi uint64
} /* <builtin>:22:44 */ // must match modernc.org/mathutil.Int128
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
type X__float128 = float64 /* <builtin>:47:21 */
// Compatibility definitions for System V `poll' interface.
// Copyright (C) 1994-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// These are defined by the user (or the compiler)
// to specify the desired environment:
//
// __STRICT_ANSI__ ISO Standard C.
// _ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
// _ISOC11_SOURCE Extensions to ISO C99 from ISO C11.
// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X.
// __STDC_WANT_LIB_EXT2__
// Extensions to ISO C99 from TR 27431-2:2010.
// __STDC_WANT_IEC_60559_BFP_EXT__
// Extensions to ISO C11 from TS 18661-1:2014.
// __STDC_WANT_IEC_60559_FUNCS_EXT__
// Extensions to ISO C11 from TS 18661-4:2015.
// __STDC_WANT_IEC_60559_TYPES_EXT__
// Extensions to ISO C11 from TS 18661-3:2015.
// __STDC_WANT_IEC_60559_EXT__
// ISO C2X interfaces defined only in Annex F.
//
// _POSIX_SOURCE IEEE Std 1003.1.
// _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
// if >=199309L, add IEEE Std 1003.1b-1993;
// if >=199506L, add IEEE Std 1003.1c-1995;
// if >=200112L, all of IEEE 1003.1-2004
// if >=200809L, all of IEEE 1003.1-2008
// _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
// Single Unix conformance is wanted, to 600 for the
// sixth revision, to 700 for the seventh revision.
// _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
// _LARGEFILE_SOURCE Some more functions for correct standard I/O.
// _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
// _FILE_OFFSET_BITS=N Select default filesystem interface.
// _ATFILE_SOURCE Additional *at interfaces.
// _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant)
// MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
// _GNU_SOURCE All of the above, plus GNU extensions.
// _DEFAULT_SOURCE The default set of features (taking precedence over
// __STRICT_ANSI__).
//
// _FORTIFY_SOURCE Add security hardening to many library functions.
// Set to 1 or 2; 2 performs stricter checks than 1.
//
// _REENTRANT, _THREAD_SAFE
// Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
//
// The `-ansi' switch to the GNU C compiler, and standards conformance
// options such as `-std=c99', define __STRICT_ANSI__. If none of
// these are defined, or if _DEFAULT_SOURCE is defined, the default is
// to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
// 200809L, as well as enabling miscellaneous functions from BSD and
// SVID. If more than one of these are defined, they accumulate. For
// example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
// give you ISO C, 1003.1, and 1003.2, but nothing else.
//
// These are defined by this file and are used by the
// header files to decide what to declare or define:
//
// __GLIBC_USE (F) Define things from feature set F. This is defined
// to 1 or 0; the subsequent macros are either defined
// or undefined, and those tests should be moved to
// __GLIBC_USE.
// __USE_ISOC11 Define ISO C11 things.
// __USE_ISOC99 Define ISO C99 things.
// __USE_ISOC95 Define ISO C90 AMD1 (C95) things.
// __USE_ISOCXX11 Define ISO C++11 things.
// __USE_POSIX Define IEEE Std 1003.1 things.
// __USE_POSIX2 Define IEEE Std 1003.2 things.
// __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
// __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things.
// __USE_XOPEN Define XPG things.
// __USE_XOPEN_EXTENDED Define X/Open Unix things.
// __USE_UNIX98 Define Single Unix V2 things.
// __USE_XOPEN2K Define XPG6 things.
// __USE_XOPEN2KXSI Define XPG6 XSI things.
// __USE_XOPEN2K8 Define XPG7 things.
// __USE_XOPEN2K8XSI Define XPG7 XSI things.
// __USE_LARGEFILE Define correct standard I/O things.
// __USE_LARGEFILE64 Define LFS things with separate names.
// __USE_FILE_OFFSET64 Define 64bit interface as default.
// __USE_MISC Define things from 4.3BSD or System V Unix.
// __USE_ATFILE Define *at interfaces and AT_* constants for them.
// __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant)
// MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
// __USE_GNU Define GNU extensions.
// __USE_FORTIFY_LEVEL Additional security measures used, according to level.
//
// The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
// defined by this file unconditionally. `__GNU_LIBRARY__' is provided
// only for compatibility. All new code should use the other symbols
// to test for features.
//
// All macros listed above as possibly being defined by this file are
// explicitly undefined if they are not explicitly defined.
// Feature-test macros that are not defined by the user or compiler
// but are implied by the other feature-test macros defined (or by the
// lack of any definitions) are defined by the file.
//
// ISO C feature test macros depend on the definition of the macro
// when an affected header is included, not when the first system
// header is included, and so they are handled in
// <bits/libc-header-start.h>, which does not have a multiple include
// guard. Feature test macros that can be handled from the first
// system header included are handled here.
// Undefine everything, so we get a clean slate.
// Suppress kernel-name space pollution unless user expressedly asks
// for it.
// Convenience macro to test the version of gcc.
// Use like this:
// #if __GNUC_PREREQ (2,8)
// ... code requiring gcc 2.8 or later ...
// #endif
// Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
// added in 2.0.
// Similarly for clang. Features added to GCC after version 4.2 may
// or may not also be available in clang, and clang's definitions of
// __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such
// features can be queried via __has_extension/__has_feature.
// Whether to use feature set F.
// _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
// _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not
// issue a warning; the expectation is that the source is being
// transitioned to use the new macro.
// If _GNU_SOURCE was defined by the user, turn on all the other features.
// If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
// define _DEFAULT_SOURCE.
// This is to enable the ISO C2X extension.
// This is to enable the ISO C11 extension.
// This is to enable the ISO C99 extension.
// This is to enable the ISO C90 Amendment 1:1995 extension.
// If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
// is defined, use POSIX.1-2008 (or another version depending on
// _XOPEN_SOURCE).
// Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
// defined in all multithreaded code. GNU libc has not required this
// for many years. We now treat them as compatibility synonyms for
// _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
// comprehensive support for multithreaded code. Using them never
// lowers the selected level of POSIX conformance, only raises it.
// Features part to handle 64-bit time_t support.
// Copyright (C) 2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// We need to know the word size in order to check the time size.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// The function 'gets' existed in C89, but is impossible to use
// safely. It has been removed from ISO C11 and ISO C++14. Note: for
// compatibility with various implementations of <cstdio>, this test
// must consider only the value of __cplusplus when compiling C++.
// GNU formerly extended the scanf functions with modified format
// specifiers %as, %aS, and %a[...] that allocate a buffer for the
// input using malloc. This extension conflicts with ISO C99, which
// defines %a as a standalone format specifier that reads a floating-
// point number; moreover, POSIX.1-2008 provides the same feature
// using the modifier letter 'm' instead (%ms, %mS, %m[...]).
//
// We now follow C99 unless GNU extensions are active and the compiler
// is specifically in C89 or C++98 mode (strict or not). For
// instance, with GCC, -std=gnu11 will have C99-compliant scanf with
// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
// old extension.
// Get definitions of __STDC_* predefined macros, if the compiler has
// not preincluded this header automatically.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// This macro indicates that the installed library is the GNU C Library.
// For historic reasons the value now is 6 and this will stay from now
// on. The use of this variable is deprecated. Use __GLIBC__ and
// __GLIBC_MINOR__ now (see below) when you want to test for a specific
// GNU C library version and use the values in <gnu/lib-names.h> to get
// the sonames of the shared libraries.
// Major and minor version number of the GNU C library package. Use
// these macros to test for features in specific releases.
// This is here only because every header file already includes this one.
// Copyright (C) 1992-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// We are almost always included from features.h.
// The GNU libc does not support any K&R compilers or the traditional mode
// of ISO C compilers anymore. Check for some of the combinations not
// supported anymore.
// Some user header file might have defined this before.
// Compilers that lack __has_attribute may object to
// #if defined __has_attribute && __has_attribute (...)
// even though they do not need to evaluate the right-hand side of the &&.
// Similarly for __has_builtin, etc.
// All functions, except those with callbacks or those that
// synchronize memory, are leaf functions.
// GCC can always grok prototypes. For C++ programs we add throw()
// to help it optimize the function calls. But this only works with
// gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
// as non-throwing using a function attribute since programs can use
// the -fexceptions options for C code as well.
// These two macros are not used in glibc anymore. They are kept here
// only because some other projects expect the macros to be defined.
// For these things, GCC behaves the ANSI way normally,
// and the non-ANSI way under -traditional.
// This is not a typedef so `const __ptr_t' does the right thing.
// C++ needs to know that types and declarations are C, not C++.
// Fortify support.
// Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available.
// Support for flexible arrays.
// Headers that should use flexible arrays only if they're "real"
// (e.g. only if they won't affect sizeof()) should test
// #if __glibc_c99_flexarr_available.
// __asm__ ("xyz") is used throughout the headers to rename functions
// at the assembly language level. This is wrapped by the __REDIRECT
// macro, in order to support compilers that can do this some other
// way. When compilers don't support asm-names at all, we have to do
// preprocessor tricks instead (which don't have exactly the right
// semantics, but it's the best we can do).
//
// Example:
// int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid);
//
// #elif __SOME_OTHER_COMPILER__
//
// # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
// GCC and clang have various useful declarations that can be made with
// the '__attribute__' syntax. All of the ways we use this do fine if
// they are omitted for compilers that don't understand it.
// At some point during the gcc 2.96 development the `malloc' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// Tell the compiler which arguments to an allocation function
// indicate the size of the allocation.
// At some point during the gcc 2.96 development the `pure' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// This declaration tells the compiler that the value is constant.
// At some point during the gcc 3.1 development the `used' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// Since version 3.2, gcc allows marking deprecated functions.
// Since version 4.5, gcc also allows one to specify the message printed
// when a deprecated function is used. clang claims to be gcc 4.2, but
// may also support this feature.
// At some point during the gcc 2.8 development the `format_arg' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// If several `format_arg' attributes are given for the same function, in
// gcc-3.0 and older, all but the last one are ignored. In newer gccs,
// all designated arguments are considered.
// At some point during the gcc 2.97 development the `strfmon' format
// attribute for functions was introduced. We don't want to use it
// unconditionally (although this would be possible) since it
// generates warnings.
// The nonnull function attribute marks pointer parameters that
// must not be NULL.
// The returns_nonnull function attribute marks the return type of the function
// as always being non-null.
// If fortification mode, we warn about unused results of certain
// function calls which can lead to problems.
// Forces a function to be always inlined.
// The Linux kernel defines __always_inline in stddef.h (283d7573), and
// it conflicts with this definition. Therefore undefine it first to
// allow either header to be included first.
// Associate error messages with the source location of the call site rather
// than with the source location inside the function.
// GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
// inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
// or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
// older than 4.3 may define these macros and still not guarantee GNU inlining
// semantics.
//
// clang++ identifies itself as gcc-4.2, but has support for GNU inlining
// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
// __GNUC_GNU_INLINE__ macro definitions.
// GCC 4.3 and above allow passing all anonymous arguments of an
// __extern_always_inline function to some other vararg function.
// It is possible to compile containing GCC extensions even if GCC is
// run in pedantic mode if the uses are carefully marked using the
// `__extension__' keyword. But this is not generally available before
// version 2.8.
// __restrict is known in EGCS 1.2 and above, and in clang.
// It works also in C++ mode (outside of arrays), but only when spelled
// as '__restrict', not 'restrict'.
// ISO C99 also allows to declare arrays as non-overlapping. The syntax is
// array_name[restrict]
// GCC 3.1 and clang support this.
// This syntax is not usable in C++ mode.
// Describes a char array whose address can safely be passed as the first
// argument to strncpy and strncat, as the char array is not necessarily
// a NUL-terminated string.
// Undefine (also defined in libc-symbols.h).
// Copies attributes from the declaration or type referenced by
// the argument.
// The #ifndef lets Gnulib avoid including these on non-glibc
// platforms, where the includes typically do not exist.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Properties of long double type. ldbl-128 version.
// Copyright (C) 2016-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// long double is distinct from double, so there is nothing to
// define here.
// __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
// intended for use in preprocessor macros.
//
// Note: MESSAGE must be a _single_ string; concatenation of string
// literals is not supported.
// Generic selection (ISO C11) is a C-only feature, available in GCC
// since version 4.9. Previous versions do not provide generic
// selection, even though they might set __STDC_VERSION__ to 201112L,
// when in -std=c11 mode. Thus, we must check for !defined __GNUC__
// when testing __STDC_VERSION__ for generic selection support.
// On the other hand, Clang also defines __GNUC__, so a clang-specific
// check is required to enable the use of generic selection.
// Designates a 1-based positional argument ref-index of pointer type
// that can be used to access size-index elements of the pointed-to
// array according to access mode, or at least one element when
// size-index is not provided:
// access (access-mode, <ref-index> [, <size-index>])
// Designates dealloc as a function to call to deallocate objects
// allocated by the declared function.
// Specify that a function such as setjmp or vfork may return
// twice.
// If we don't have __REDIRECT, prototypes will be missing if
// __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64].
// Decide whether we can define 'extern inline' functions in headers.
// This is here only because every header file already includes this one.
// Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
// <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
// that will always return failure (and set errno to ENOSYS).
// This file is automatically generated.
// This file selects the right generated file of `__stub_FUNCTION' macros
// based on the architecture being compiled for.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// This file is automatically generated.
// It defines a symbol `__stub_FUNCTION' for each function
// in the C library which is a stub, meaning it will fail
// every time called, usually setting errno to ENOSYS.
// Get the platform dependent bits of `poll'.
// Copyright (C) 1997-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Event types that can be polled for. These bits may be set in `events'
// to indicate the interesting event types; they will appear in `revents'
// to indicate the status of the file descriptor.
// These values are defined in XPG4.2.
// Event types always implicitly polled for. These bits need not be set in
// `events', but they will appear in `revents' to indicate the status of
// the file descriptor.
// Type used for the number of file descriptors.
type Nfds_t = uint64 /* poll.h:33:27 */
// Data structure describing a polling request.
type Pollfd = struct {
Ffd int32
Fevents int16
Frevents int16
} /* poll.h:36:1 */
// Define some inlines helping to catch common problems.
var _ uint8 /* gen.c:2:13: */

@ -0,0 +1,5 @@
// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_riscv64.go -pkgname pthread', DO NOT EDIT.
package pthread
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_riscv64.go -pkgname pwd', DO NOT EDIT.
package pwd
var CAPI = map[string]struct{}{}

@ -0,0 +1,958 @@
// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_riscv64.go -pkgname pwd', DO NOT EDIT.
package pwd
import (
"math"
"reflect"
"sync/atomic"
"unsafe"
)
var _ = math.Pi
var _ reflect.Kind
var _ atomic.Value
var _ unsafe.Pointer
const (
NSS_BUFLEN_PASSWD = 1024
X_ATFILE_SOURCE = 1
X_BITS_TIME64_H = 1
X_BITS_TYPESIZES_H = 1
X_BITS_TYPES_H = 1
X_BSD_SIZE_T_ = 0
X_BSD_SIZE_T_DEFINED_ = 0
X_DEFAULT_SOURCE = 1
X_FEATURES_H = 1
X_FILE_OFFSET_BITS = 64
X_GCC_SIZE_T = 0
X_LP64 = 1
X_POSIX_C_SOURCE = 200809
X_POSIX_SOURCE = 1
X_PWD_H = 1
X_SIZET_ = 0
X_SIZE_T = 0
X_SIZE_T_ = 0
X_SIZE_T_DECLARED = 0
X_SIZE_T_DEFINED = 0
X_SIZE_T_DEFINED_ = 0
X_STDC_PREDEF_H = 1
X_SYS_CDEFS_H = 1
X_SYS_SIZE_T_H = 0
X_T_SIZE = 0
X_T_SIZE_ = 0
Linux = 1
Unix = 1
)
type Ptrdiff_t = int64 /* <builtin>:3:26 */
type Size_t = uint64 /* <builtin>:9:23 */
type Wchar_t = int32 /* <builtin>:15:24 */
type X__int128_t = struct {
Flo int64
Fhi int64
} /* <builtin>:21:43 */ // must match modernc.org/mathutil.Int128
type X__uint128_t = struct {
Flo uint64
Fhi uint64
} /* <builtin>:22:44 */ // must match modernc.org/mathutil.Int128
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
type X__float128 = float64 /* <builtin>:47:21 */
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// POSIX Standard: 9.2.2 User Database Access <pwd.h>
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// These are defined by the user (or the compiler)
// to specify the desired environment:
//
// __STRICT_ANSI__ ISO Standard C.
// _ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
// _ISOC11_SOURCE Extensions to ISO C99 from ISO C11.
// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X.
// __STDC_WANT_LIB_EXT2__
// Extensions to ISO C99 from TR 27431-2:2010.
// __STDC_WANT_IEC_60559_BFP_EXT__
// Extensions to ISO C11 from TS 18661-1:2014.
// __STDC_WANT_IEC_60559_FUNCS_EXT__
// Extensions to ISO C11 from TS 18661-4:2015.
// __STDC_WANT_IEC_60559_TYPES_EXT__
// Extensions to ISO C11 from TS 18661-3:2015.
// __STDC_WANT_IEC_60559_EXT__
// ISO C2X interfaces defined only in Annex F.
//
// _POSIX_SOURCE IEEE Std 1003.1.
// _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
// if >=199309L, add IEEE Std 1003.1b-1993;
// if >=199506L, add IEEE Std 1003.1c-1995;
// if >=200112L, all of IEEE 1003.1-2004
// if >=200809L, all of IEEE 1003.1-2008
// _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
// Single Unix conformance is wanted, to 600 for the
// sixth revision, to 700 for the seventh revision.
// _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
// _LARGEFILE_SOURCE Some more functions for correct standard I/O.
// _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
// _FILE_OFFSET_BITS=N Select default filesystem interface.
// _ATFILE_SOURCE Additional *at interfaces.
// _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant)
// MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
// _GNU_SOURCE All of the above, plus GNU extensions.
// _DEFAULT_SOURCE The default set of features (taking precedence over
// __STRICT_ANSI__).
//
// _FORTIFY_SOURCE Add security hardening to many library functions.
// Set to 1 or 2; 2 performs stricter checks than 1.
//
// _REENTRANT, _THREAD_SAFE
// Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
//
// The `-ansi' switch to the GNU C compiler, and standards conformance
// options such as `-std=c99', define __STRICT_ANSI__. If none of
// these are defined, or if _DEFAULT_SOURCE is defined, the default is
// to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
// 200809L, as well as enabling miscellaneous functions from BSD and
// SVID. If more than one of these are defined, they accumulate. For
// example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
// give you ISO C, 1003.1, and 1003.2, but nothing else.
//
// These are defined by this file and are used by the
// header files to decide what to declare or define:
//
// __GLIBC_USE (F) Define things from feature set F. This is defined
// to 1 or 0; the subsequent macros are either defined
// or undefined, and those tests should be moved to
// __GLIBC_USE.
// __USE_ISOC11 Define ISO C11 things.
// __USE_ISOC99 Define ISO C99 things.
// __USE_ISOC95 Define ISO C90 AMD1 (C95) things.
// __USE_ISOCXX11 Define ISO C++11 things.
// __USE_POSIX Define IEEE Std 1003.1 things.
// __USE_POSIX2 Define IEEE Std 1003.2 things.
// __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
// __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things.
// __USE_XOPEN Define XPG things.
// __USE_XOPEN_EXTENDED Define X/Open Unix things.
// __USE_UNIX98 Define Single Unix V2 things.
// __USE_XOPEN2K Define XPG6 things.
// __USE_XOPEN2KXSI Define XPG6 XSI things.
// __USE_XOPEN2K8 Define XPG7 things.
// __USE_XOPEN2K8XSI Define XPG7 XSI things.
// __USE_LARGEFILE Define correct standard I/O things.
// __USE_LARGEFILE64 Define LFS things with separate names.
// __USE_FILE_OFFSET64 Define 64bit interface as default.
// __USE_MISC Define things from 4.3BSD or System V Unix.
// __USE_ATFILE Define *at interfaces and AT_* constants for them.
// __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant)
// MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
// __USE_GNU Define GNU extensions.
// __USE_FORTIFY_LEVEL Additional security measures used, according to level.
//
// The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
// defined by this file unconditionally. `__GNU_LIBRARY__' is provided
// only for compatibility. All new code should use the other symbols
// to test for features.
//
// All macros listed above as possibly being defined by this file are
// explicitly undefined if they are not explicitly defined.
// Feature-test macros that are not defined by the user or compiler
// but are implied by the other feature-test macros defined (or by the
// lack of any definitions) are defined by the file.
//
// ISO C feature test macros depend on the definition of the macro
// when an affected header is included, not when the first system
// header is included, and so they are handled in
// <bits/libc-header-start.h>, which does not have a multiple include
// guard. Feature test macros that can be handled from the first
// system header included are handled here.
// Undefine everything, so we get a clean slate.
// Suppress kernel-name space pollution unless user expressedly asks
// for it.
// Convenience macro to test the version of gcc.
// Use like this:
// #if __GNUC_PREREQ (2,8)
// ... code requiring gcc 2.8 or later ...
// #endif
// Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
// added in 2.0.
// Similarly for clang. Features added to GCC after version 4.2 may
// or may not also be available in clang, and clang's definitions of
// __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such
// features can be queried via __has_extension/__has_feature.
// Whether to use feature set F.
// _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
// _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not
// issue a warning; the expectation is that the source is being
// transitioned to use the new macro.
// If _GNU_SOURCE was defined by the user, turn on all the other features.
// If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
// define _DEFAULT_SOURCE.
// This is to enable the ISO C2X extension.
// This is to enable the ISO C11 extension.
// This is to enable the ISO C99 extension.
// This is to enable the ISO C90 Amendment 1:1995 extension.
// If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
// is defined, use POSIX.1-2008 (or another version depending on
// _XOPEN_SOURCE).
// Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
// defined in all multithreaded code. GNU libc has not required this
// for many years. We now treat them as compatibility synonyms for
// _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
// comprehensive support for multithreaded code. Using them never
// lowers the selected level of POSIX conformance, only raises it.
// Features part to handle 64-bit time_t support.
// Copyright (C) 2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// We need to know the word size in order to check the time size.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// The function 'gets' existed in C89, but is impossible to use
// safely. It has been removed from ISO C11 and ISO C++14. Note: for
// compatibility with various implementations of <cstdio>, this test
// must consider only the value of __cplusplus when compiling C++.
// GNU formerly extended the scanf functions with modified format
// specifiers %as, %aS, and %a[...] that allocate a buffer for the
// input using malloc. This extension conflicts with ISO C99, which
// defines %a as a standalone format specifier that reads a floating-
// point number; moreover, POSIX.1-2008 provides the same feature
// using the modifier letter 'm' instead (%ms, %mS, %m[...]).
//
// We now follow C99 unless GNU extensions are active and the compiler
// is specifically in C89 or C++98 mode (strict or not). For
// instance, with GCC, -std=gnu11 will have C99-compliant scanf with
// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
// old extension.
// Get definitions of __STDC_* predefined macros, if the compiler has
// not preincluded this header automatically.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// This macro indicates that the installed library is the GNU C Library.
// For historic reasons the value now is 6 and this will stay from now
// on. The use of this variable is deprecated. Use __GLIBC__ and
// __GLIBC_MINOR__ now (see below) when you want to test for a specific
// GNU C library version and use the values in <gnu/lib-names.h> to get
// the sonames of the shared libraries.
// Major and minor version number of the GNU C library package. Use
// these macros to test for features in specific releases.
// This is here only because every header file already includes this one.
// Copyright (C) 1992-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// We are almost always included from features.h.
// The GNU libc does not support any K&R compilers or the traditional mode
// of ISO C compilers anymore. Check for some of the combinations not
// supported anymore.
// Some user header file might have defined this before.
// Compilers that lack __has_attribute may object to
// #if defined __has_attribute && __has_attribute (...)
// even though they do not need to evaluate the right-hand side of the &&.
// Similarly for __has_builtin, etc.
// All functions, except those with callbacks or those that
// synchronize memory, are leaf functions.
// GCC can always grok prototypes. For C++ programs we add throw()
// to help it optimize the function calls. But this only works with
// gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
// as non-throwing using a function attribute since programs can use
// the -fexceptions options for C code as well.
// These two macros are not used in glibc anymore. They are kept here
// only because some other projects expect the macros to be defined.
// For these things, GCC behaves the ANSI way normally,
// and the non-ANSI way under -traditional.
// This is not a typedef so `const __ptr_t' does the right thing.
// C++ needs to know that types and declarations are C, not C++.
// Fortify support.
// Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available.
// Support for flexible arrays.
// Headers that should use flexible arrays only if they're "real"
// (e.g. only if they won't affect sizeof()) should test
// #if __glibc_c99_flexarr_available.
// __asm__ ("xyz") is used throughout the headers to rename functions
// at the assembly language level. This is wrapped by the __REDIRECT
// macro, in order to support compilers that can do this some other
// way. When compilers don't support asm-names at all, we have to do
// preprocessor tricks instead (which don't have exactly the right
// semantics, but it's the best we can do).
//
// Example:
// int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid);
//
// #elif __SOME_OTHER_COMPILER__
//
// # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
// GCC and clang have various useful declarations that can be made with
// the '__attribute__' syntax. All of the ways we use this do fine if
// they are omitted for compilers that don't understand it.
// At some point during the gcc 2.96 development the `malloc' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// Tell the compiler which arguments to an allocation function
// indicate the size of the allocation.
// At some point during the gcc 2.96 development the `pure' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// This declaration tells the compiler that the value is constant.
// At some point during the gcc 3.1 development the `used' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// Since version 3.2, gcc allows marking deprecated functions.
// Since version 4.5, gcc also allows one to specify the message printed
// when a deprecated function is used. clang claims to be gcc 4.2, but
// may also support this feature.
// At some point during the gcc 2.8 development the `format_arg' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// If several `format_arg' attributes are given for the same function, in
// gcc-3.0 and older, all but the last one are ignored. In newer gccs,
// all designated arguments are considered.
// At some point during the gcc 2.97 development the `strfmon' format
// attribute for functions was introduced. We don't want to use it
// unconditionally (although this would be possible) since it
// generates warnings.
// The nonnull function attribute marks pointer parameters that
// must not be NULL.
// The returns_nonnull function attribute marks the return type of the function
// as always being non-null.
// If fortification mode, we warn about unused results of certain
// function calls which can lead to problems.
// Forces a function to be always inlined.
// The Linux kernel defines __always_inline in stddef.h (283d7573), and
// it conflicts with this definition. Therefore undefine it first to
// allow either header to be included first.
// Associate error messages with the source location of the call site rather
// than with the source location inside the function.
// GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
// inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
// or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
// older than 4.3 may define these macros and still not guarantee GNU inlining
// semantics.
//
// clang++ identifies itself as gcc-4.2, but has support for GNU inlining
// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
// __GNUC_GNU_INLINE__ macro definitions.
// GCC 4.3 and above allow passing all anonymous arguments of an
// __extern_always_inline function to some other vararg function.
// It is possible to compile containing GCC extensions even if GCC is
// run in pedantic mode if the uses are carefully marked using the
// `__extension__' keyword. But this is not generally available before
// version 2.8.
// __restrict is known in EGCS 1.2 and above, and in clang.
// It works also in C++ mode (outside of arrays), but only when spelled
// as '__restrict', not 'restrict'.
// ISO C99 also allows to declare arrays as non-overlapping. The syntax is
// array_name[restrict]
// GCC 3.1 and clang support this.
// This syntax is not usable in C++ mode.
// Describes a char array whose address can safely be passed as the first
// argument to strncpy and strncat, as the char array is not necessarily
// a NUL-terminated string.
// Undefine (also defined in libc-symbols.h).
// Copies attributes from the declaration or type referenced by
// the argument.
// The #ifndef lets Gnulib avoid including these on non-glibc
// platforms, where the includes typically do not exist.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Properties of long double type. ldbl-128 version.
// Copyright (C) 2016-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// long double is distinct from double, so there is nothing to
// define here.
// __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
// intended for use in preprocessor macros.
//
// Note: MESSAGE must be a _single_ string; concatenation of string
// literals is not supported.
// Generic selection (ISO C11) is a C-only feature, available in GCC
// since version 4.9. Previous versions do not provide generic
// selection, even though they might set __STDC_VERSION__ to 201112L,
// when in -std=c11 mode. Thus, we must check for !defined __GNUC__
// when testing __STDC_VERSION__ for generic selection support.
// On the other hand, Clang also defines __GNUC__, so a clang-specific
// check is required to enable the use of generic selection.
// Designates a 1-based positional argument ref-index of pointer type
// that can be used to access size-index elements of the pointed-to
// array according to access mode, or at least one element when
// size-index is not provided:
// access (access-mode, <ref-index> [, <size-index>])
// Designates dealloc as a function to call to deallocate objects
// allocated by the declared function.
// Specify that a function such as setjmp or vfork may return
// twice.
// If we don't have __REDIRECT, prototypes will be missing if
// __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64].
// Decide whether we can define 'extern inline' functions in headers.
// This is here only because every header file already includes this one.
// Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
// <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
// that will always return failure (and set errno to ENOSYS).
// This file is automatically generated.
// This file selects the right generated file of `__stub_FUNCTION' macros
// based on the architecture being compiled for.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// This file is automatically generated.
// It defines a symbol `__stub_FUNCTION' for each function
// in the C library which is a stub, meaning it will fail
// every time called, usually setting errno to ENOSYS.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// Convenience types.
type X__u_char = uint8 /* types.h:31:23 */
type X__u_short = uint16 /* types.h:32:28 */
type X__u_int = uint32 /* types.h:33:22 */
type X__u_long = uint64 /* types.h:34:27 */
// Fixed-size types, underlying types depend on word size and compiler.
type X__int8_t = int8 /* types.h:37:21 */
type X__uint8_t = uint8 /* types.h:38:23 */
type X__int16_t = int16 /* types.h:39:26 */
type X__uint16_t = uint16 /* types.h:40:28 */
type X__int32_t = int32 /* types.h:41:20 */
type X__uint32_t = uint32 /* types.h:42:22 */
type X__int64_t = int64 /* types.h:44:25 */
type X__uint64_t = uint64 /* types.h:45:27 */
// Smallest types with at least a given width.
type X__int_least8_t = X__int8_t /* types.h:52:18 */
type X__uint_least8_t = X__uint8_t /* types.h:53:19 */
type X__int_least16_t = X__int16_t /* types.h:54:19 */
type X__uint_least16_t = X__uint16_t /* types.h:55:20 */
type X__int_least32_t = X__int32_t /* types.h:56:19 */
type X__uint_least32_t = X__uint32_t /* types.h:57:20 */
type X__int_least64_t = X__int64_t /* types.h:58:19 */
type X__uint_least64_t = X__uint64_t /* types.h:59:20 */
// quad_t is also 64 bits.
type X__quad_t = int64 /* types.h:63:18 */
type X__u_quad_t = uint64 /* types.h:64:27 */
// Largest integral types.
type X__intmax_t = int64 /* types.h:72:18 */
type X__uintmax_t = uint64 /* types.h:73:27 */
// The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
// macros for each of the OS types we define below. The definitions
// of those macros must use the following macros for underlying types.
// We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
// variants of each of the following integer types on this machine.
//
// 16 -- "natural" 16-bit type (always short)
// 32 -- "natural" 32-bit type (always int)
// 64 -- "natural" 64-bit type (long or long long)
// LONG32 -- 32-bit type, traditionally long
// QUAD -- 64-bit type, traditionally long long
// WORD -- natural type of __WORDSIZE bits (int or long)
// LONGWORD -- type of __WORDSIZE bits, traditionally long
//
// We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
// conventional uses of `long' or `long long' type modifiers match the
// types we define, even when a less-adorned type would be the same size.
// This matters for (somewhat) portably writing printf/scanf formats for
// these types, where using the appropriate l or ll format modifiers can
// make the typedefs and the formats match up across all GNU platforms. If
// we used `long' when it's 64 bits where `long long' is expected, then the
// compiler would warn about the formats not matching the argument types,
// and the programmer changing them to shut up the compiler would break the
// program's portability.
//
// Here we assume what is presently the case in all the GCC configurations
// we support: long long is always 64 bits, long is always word/address size,
// and int is always 32 bits.
// No need to mark the typedef with __extension__.
// bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.
// Copyright (C) 2011-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
// Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// See <bits/types.h> for the meaning of these macros. This file exists so
// that <bits/types.h> need not vary across different GNU platforms.
// Tell the libc code that off_t and off64_t are actually the same type
// for all ABI purposes, even if possibly expressed as different base types
// for C type-checking purposes.
// Same for ino_t and ino64_t.
// And for __rlim_t and __rlim64_t.
// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.
// And for getitimer, setitimer and rusage
// Number of descriptors that can fit in an `fd_set'.
// bits/time64.h -- underlying types for __time64_t. RISC-V version.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Define __TIME64_T_TYPE so that it is always a 64-bit type.
// If we already have 64-bit time type then use it.
type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers.
type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications.
type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications.
type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers.
type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS).
type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks.
type X__nlink_t = uint32 /* types.h:151:27 */ // Type of file link counts.
type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets.
type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS).
type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications.
type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs.
type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts.
type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement.
type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS).
type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs.
type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch.
type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds.
type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds.
type X__suseconds64_t = int64 /* types.h:163:33 */
type X__daddr_t = int32 /* types.h:165:27 */ // The type of a disk address.
type X__key_t = int32 /* types.h:166:25 */ // Type of an IPC key.
// Clock ID used in clock and timer functions.
type X__clockid_t = int32 /* types.h:169:29 */
// Timer ID returned by `timer_create'.
type X__timer_t = uintptr /* types.h:172:12 */
// Type to represent block size.
type X__blksize_t = int32 /* types.h:175:29 */
// Types from the Large File Support interface.
// Type to count number of disk blocks.
type X__blkcnt_t = int64 /* types.h:180:28 */
type X__blkcnt64_t = int64 /* types.h:181:30 */
// Type to count file system blocks.
type X__fsblkcnt_t = uint64 /* types.h:184:30 */
type X__fsblkcnt64_t = uint64 /* types.h:185:32 */
// Type to count file system nodes.
type X__fsfilcnt_t = uint64 /* types.h:188:30 */
type X__fsfilcnt64_t = uint64 /* types.h:189:32 */
// Type of miscellaneous file system fields.
type X__fsword_t = int64 /* types.h:192:28 */
type X__ssize_t = int64 /* types.h:194:27 */ // Type of a byte count, or error.
// Signed long type used in system calls.
type X__syscall_slong_t = int64 /* types.h:197:33 */
// Unsigned long type used in system calls.
type X__syscall_ulong_t = uint64 /* types.h:199:33 */
// These few don't really vary by system, they always correspond
// to one of the other defined types.
type X__loff_t = X__off64_t /* types.h:203:19 */ // Type of file sizes and offsets (LFS).
type X__caddr_t = uintptr /* types.h:204:14 */
// Duplicates info from stdint.h but this is used in unistd.h.
type X__intptr_t = int64 /* types.h:207:25 */
// Duplicate info from sys/socket.h.
type X__socklen_t = uint32 /* types.h:210:23 */
// C99: An integer type that can be accessed as an atomic entity,
// even in the presence of asynchronous interrupts.
// It is not currently necessary for this to be machine-specific.
type X__sig_atomic_t = int32 /* types.h:215:13 */
// Wide character type.
// Locale-writers should change this as necessary to
// be big enough to hold unique values not between 0 and 127,
// and not (wchar_t) -1, for each defined multibyte character.
// Define this type if we are doing the whole job,
// or if we want this type in particular.
// A null pointer constant.
// The Single Unix specification says that some more types are
// available here.
type Gid_t = X__gid_t /* pwd.h:38:17 */
type Uid_t = X__uid_t /* pwd.h:43:17 */
// A record in the user database.
type Passwd = struct {
Fpw_name uintptr
Fpw_passwd uintptr
Fpw_uid X__uid_t
Fpw_gid X__gid_t
Fpw_gecos uintptr
Fpw_dir uintptr
Fpw_shell uintptr
} /* pwd.h:49:1 */
var _ uint8 /* gen.c:2:13: */

@ -0,0 +1,5 @@
// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_riscv64.go -pkgname signal', DO NOT EDIT.
package signal
var CAPI = map[string]struct{}{}

@ -0,0 +1,12 @@
// Copyright 2020 The Libc 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 signal
const (
// /usr/include/asm-generic/signal-defs.h:24:#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
SIG_DFL = 0
// /usr/include/asm-generic/signal-defs.h:25:#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
SIG_IGN = 1
)

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_riscv64.go -pkgname stdio', DO NOT EDIT.
package stdio
var CAPI = map[string]struct{}{}

@ -0,0 +1,589 @@
// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_riscv64.go -pkgname stdio', DO NOT EDIT.
package stdio
import (
"math"
"reflect"
"sync/atomic"
"unsafe"
)
var _ = math.Pi
var _ reflect.Kind
var _ atomic.Value
var _ unsafe.Pointer
const (
BUFSIZ = 8192
EOF = -1
FILENAME_MAX = 4096
FOPEN_MAX = 16
L_ctermid = 9
L_tmpnam = 20
P_tmpdir = "/tmp"
SEEK_CUR = 1
SEEK_END = 2
SEEK_SET = 0
TMP_MAX = 238328
X_ATFILE_SOURCE = 1
X_BITS_FLOATN_COMMON_H = 0
X_BITS_FLOATN_H = 0
X_BITS_STDIO_LIM_H = 1
X_BITS_TIME64_H = 1
X_BITS_TYPESIZES_H = 1
X_BITS_TYPES_H = 1
X_BSD_SIZE_T_ = 0
X_BSD_SIZE_T_DEFINED_ = 0
X_DEFAULT_SOURCE = 1
X_FEATURES_H = 1
X_FILE_OFFSET_BITS = 64
X_GCC_SIZE_T = 0
X_IOFBF = 0
X_IOLBF = 1
X_IONBF = 2
X_IO_EOF_SEEN = 0x0010
X_IO_ERR_SEEN = 0x0020
X_IO_USER_LOCK = 0x8000
X_LP64 = 1
X_POSIX_C_SOURCE = 200809
X_POSIX_SOURCE = 1
X_SIZET_ = 0
X_SIZE_T = 0
X_SIZE_T_ = 0
X_SIZE_T_DECLARED = 0
X_SIZE_T_DEFINED = 0
X_SIZE_T_DEFINED_ = 0
X_STDC_PREDEF_H = 1
X_STDIO_H = 1
X_SYS_CDEFS_H = 1
X_SYS_SIZE_T_H = 0
X_T_SIZE = 0
X_T_SIZE_ = 0
X_VA_LIST_DEFINED = 0
Linux = 1
Unix = 1
)
type Ptrdiff_t = int64 /* <builtin>:3:26 */
type Size_t = uint64 /* <builtin>:9:23 */
type Wchar_t = int32 /* <builtin>:15:24 */
type X__int128_t = struct {
Flo int64
Fhi int64
} /* <builtin>:21:43 */ // must match modernc.org/mathutil.Int128
type X__uint128_t = struct {
Flo uint64
Fhi uint64
} /* <builtin>:22:44 */ // must match modernc.org/mathutil.Int128
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
type X__float128 = float64 /* <builtin>:47:21 */
// Wide character type.
// Locale-writers should change this as necessary to
// be big enough to hold unique values not between 0 and 127,
// and not (wchar_t) -1, for each defined multibyte character.
// Define this type if we are doing the whole job,
// or if we want this type in particular.
// A null pointer constant.
// Copyright (C) 1989-2021 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
// GCC is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// GCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
//
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// ISO C Standard: 7.15 Variable arguments <stdarg.h>
// Define __gnuc_va_list.
type X__gnuc_va_list = X__builtin_va_list /* stdarg.h:40:27 */
// Define the standard macros for the user,
// if this invocation was from the user program.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// Convenience types.
type X__u_char = uint8 /* types.h:31:23 */
type X__u_short = uint16 /* types.h:32:28 */
type X__u_int = uint32 /* types.h:33:22 */
type X__u_long = uint64 /* types.h:34:27 */
// Fixed-size types, underlying types depend on word size and compiler.
type X__int8_t = int8 /* types.h:37:21 */
type X__uint8_t = uint8 /* types.h:38:23 */
type X__int16_t = int16 /* types.h:39:26 */
type X__uint16_t = uint16 /* types.h:40:28 */
type X__int32_t = int32 /* types.h:41:20 */
type X__uint32_t = uint32 /* types.h:42:22 */
type X__int64_t = int64 /* types.h:44:25 */
type X__uint64_t = uint64 /* types.h:45:27 */
// Smallest types with at least a given width.
type X__int_least8_t = X__int8_t /* types.h:52:18 */
type X__uint_least8_t = X__uint8_t /* types.h:53:19 */
type X__int_least16_t = X__int16_t /* types.h:54:19 */
type X__uint_least16_t = X__uint16_t /* types.h:55:20 */
type X__int_least32_t = X__int32_t /* types.h:56:19 */
type X__uint_least32_t = X__uint32_t /* types.h:57:20 */
type X__int_least64_t = X__int64_t /* types.h:58:19 */
type X__uint_least64_t = X__uint64_t /* types.h:59:20 */
// quad_t is also 64 bits.
type X__quad_t = int64 /* types.h:63:18 */
type X__u_quad_t = uint64 /* types.h:64:27 */
// Largest integral types.
type X__intmax_t = int64 /* types.h:72:18 */
type X__uintmax_t = uint64 /* types.h:73:27 */
// The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
// macros for each of the OS types we define below. The definitions
// of those macros must use the following macros for underlying types.
// We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
// variants of each of the following integer types on this machine.
//
// 16 -- "natural" 16-bit type (always short)
// 32 -- "natural" 32-bit type (always int)
// 64 -- "natural" 64-bit type (long or long long)
// LONG32 -- 32-bit type, traditionally long
// QUAD -- 64-bit type, traditionally long long
// WORD -- natural type of __WORDSIZE bits (int or long)
// LONGWORD -- type of __WORDSIZE bits, traditionally long
//
// We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
// conventional uses of `long' or `long long' type modifiers match the
// types we define, even when a less-adorned type would be the same size.
// This matters for (somewhat) portably writing printf/scanf formats for
// these types, where using the appropriate l or ll format modifiers can
// make the typedefs and the formats match up across all GNU platforms. If
// we used `long' when it's 64 bits where `long long' is expected, then the
// compiler would warn about the formats not matching the argument types,
// and the programmer changing them to shut up the compiler would break the
// program's portability.
//
// Here we assume what is presently the case in all the GCC configurations
// we support: long long is always 64 bits, long is always word/address size,
// and int is always 32 bits.
// No need to mark the typedef with __extension__.
// bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.
// Copyright (C) 2011-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
// Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// See <bits/types.h> for the meaning of these macros. This file exists so
// that <bits/types.h> need not vary across different GNU platforms.
// Tell the libc code that off_t and off64_t are actually the same type
// for all ABI purposes, even if possibly expressed as different base types
// for C type-checking purposes.
// Same for ino_t and ino64_t.
// And for __rlim_t and __rlim64_t.
// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.
// And for getitimer, setitimer and rusage
// Number of descriptors that can fit in an `fd_set'.
// bits/time64.h -- underlying types for __time64_t. RISC-V version.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Define __TIME64_T_TYPE so that it is always a 64-bit type.
// If we already have 64-bit time type then use it.
type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers.
type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications.
type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications.
type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers.
type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS).
type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks.
type X__nlink_t = uint32 /* types.h:151:27 */ // Type of file link counts.
type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets.
type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS).
type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications.
type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs.
type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts.
type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement.
type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS).
type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs.
type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch.
type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds.
type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds.
type X__suseconds64_t = int64 /* types.h:163:33 */
type X__daddr_t = int32 /* types.h:165:27 */ // The type of a disk address.
type X__key_t = int32 /* types.h:166:25 */ // Type of an IPC key.
// Clock ID used in clock and timer functions.
type X__clockid_t = int32 /* types.h:169:29 */
// Timer ID returned by `timer_create'.
type X__timer_t = uintptr /* types.h:172:12 */
// Type to represent block size.
type X__blksize_t = int32 /* types.h:175:29 */
// Types from the Large File Support interface.
// Type to count number of disk blocks.
type X__blkcnt_t = int64 /* types.h:180:28 */
type X__blkcnt64_t = int64 /* types.h:181:30 */
// Type to count file system blocks.
type X__fsblkcnt_t = uint64 /* types.h:184:30 */
type X__fsblkcnt64_t = uint64 /* types.h:185:32 */
// Type to count file system nodes.
type X__fsfilcnt_t = uint64 /* types.h:188:30 */
type X__fsfilcnt64_t = uint64 /* types.h:189:32 */
// Type of miscellaneous file system fields.
type X__fsword_t = int64 /* types.h:192:28 */
type X__ssize_t = int64 /* types.h:194:27 */ // Type of a byte count, or error.
// Signed long type used in system calls.
type X__syscall_slong_t = int64 /* types.h:197:33 */
// Unsigned long type used in system calls.
type X__syscall_ulong_t = uint64 /* types.h:199:33 */
// These few don't really vary by system, they always correspond
// to one of the other defined types.
type X__loff_t = X__off64_t /* types.h:203:19 */ // Type of file sizes and offsets (LFS).
type X__caddr_t = uintptr /* types.h:204:14 */
// Duplicates info from stdint.h but this is used in unistd.h.
type X__intptr_t = int64 /* types.h:207:25 */
// Duplicate info from sys/socket.h.
type X__socklen_t = uint32 /* types.h:210:23 */
// C99: An integer type that can be accessed as an atomic entity,
// even in the presence of asynchronous interrupts.
// It is not currently necessary for this to be machine-specific.
type X__sig_atomic_t = int32 /* types.h:215:13 */
// Seconds since the Epoch, visible to user code when time_t is too
// narrow only for consistency with the old way of widening too-narrow
// types. User code should never use __time64_t.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Integral type unchanged by default argument promotions that can
// hold any value corresponding to members of the extended character
// set, as well as at least one value that does not correspond to any
// member of the extended character set.
// Conversion state information.
type X__mbstate_t = struct {
F__count int32
F__value struct{ F__wch uint32 }
} /* __mbstate_t.h:21:3 */
// The tag name of this struct is _G_fpos_t to preserve historic
// C++ mangled names for functions taking fpos_t arguments.
// That name should not be used in new code.
type X_G_fpos_t = struct {
F__pos X__off_t
F__state X__mbstate_t
} /* __fpos_t.h:10:9 */
// The tag name of this struct is _G_fpos_t to preserve historic
// C++ mangled names for functions taking fpos_t arguments.
// That name should not be used in new code.
type X__fpos_t = X_G_fpos_t /* __fpos_t.h:14:3 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// The tag name of this struct is _G_fpos64_t to preserve historic
// C++ mangled names for functions taking fpos_t and/or fpos64_t
// arguments. That name should not be used in new code.
type X_G_fpos64_t = struct {
F__pos X__off64_t
F__state X__mbstate_t
} /* __fpos64_t.h:10:9 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// The tag name of this struct is _G_fpos64_t to preserve historic
// C++ mangled names for functions taking fpos_t and/or fpos64_t
// arguments. That name should not be used in new code.
type X__fpos64_t = X_G_fpos64_t /* __fpos64_t.h:14:3 */
type X_IO_FILE = struct {
F_flags int32
F__ccgo_pad1 [4]byte
F_IO_read_ptr uintptr
F_IO_read_end uintptr
F_IO_read_base uintptr
F_IO_write_base uintptr
F_IO_write_ptr uintptr
F_IO_write_end uintptr
F_IO_buf_base uintptr
F_IO_buf_end uintptr
F_IO_save_base uintptr
F_IO_backup_base uintptr
F_IO_save_end uintptr
F_markers uintptr
F_chain uintptr
F_fileno int32
F_flags2 int32
F_old_offset X__off_t
F_cur_column uint16
F_vtable_offset int8
F_shortbuf [1]uint8
F__ccgo_pad2 [4]byte
F_lock uintptr
F_offset X__off64_t
F_codecvt uintptr
F_wide_data uintptr
F_freeres_list uintptr
F_freeres_buf uintptr
F__pad5 Size_t
F_mode int32
F_unused2 [20]uint8
} /* __FILE.h:4:1 */
type X__FILE = X_IO_FILE /* __FILE.h:5:25 */
// The opaque type of streams. This is the definition used elsewhere.
type FILE = X_IO_FILE /* FILE.h:7:25 */
// These macros are used by bits/stdio.h and internal headers.
// Many more flag bits are defined internally.
type Va_list = X__gnuc_va_list /* stdio.h:52:24 */
type Off_t = X__off64_t /* stdio.h:65:19 */
type Ssize_t = X__ssize_t /* stdio.h:77:19 */
// The type of the second argument to `fgetpos' and `fsetpos'.
type Fpos_t = X__fpos64_t /* stdio.h:86:20 */
// If we are compiling with optimizing read this file. It contains
// several optimizing inline functions and macros.
// Macros to control TS 18661-3 glibc features on ldbl-128 platforms.
// Copyright (C) 2017-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
var _ uint8 /* gen.c:2:13: */

@ -0,0 +1,5 @@
// Code generated by 'ccgo stdlib/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdlib/stdlib_linux_riscv64.go -pkgname stdlib', DO NOT EDIT.
package stdlib
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_riscv64.go -pkgname socket', DO NOT EDIT.
package socket
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_riscv64.go -pkgname stat', DO NOT EDIT.
package stat
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_riscv64.go -pkgname types', DO NOT EDIT.
package types
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_riscv64.go -pkgname termios', DO NOT EDIT.
package termios
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_riscv64.go -pkgname time', DO NOT EDIT.
package time
var CAPI = map[string]struct{}{}

@ -0,0 +1,711 @@
// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_riscv64.go -pkgname time', DO NOT EDIT.
package time
import (
"math"
"reflect"
"sync/atomic"
"unsafe"
)
var _ = math.Pi
var _ reflect.Kind
var _ atomic.Value
var _ unsafe.Pointer
const (
CLOCK_BOOTTIME = 7
CLOCK_BOOTTIME_ALARM = 9
CLOCK_MONOTONIC = 1
CLOCK_MONOTONIC_COARSE = 6
CLOCK_MONOTONIC_RAW = 4
CLOCK_PROCESS_CPUTIME_ID = 2
CLOCK_REALTIME = 0
CLOCK_REALTIME_ALARM = 8
CLOCK_REALTIME_COARSE = 5
CLOCK_TAI = 11
CLOCK_THREAD_CPUTIME_ID = 3
TIMER_ABSTIME = 1
TIME_UTC = 1
X_ATFILE_SOURCE = 1
X_BITS_ENDIANNESS_H = 1
X_BITS_ENDIAN_H = 1
X_BITS_TIME64_H = 1
X_BITS_TIME_H = 1
X_BITS_TYPESIZES_H = 1
X_BITS_TYPES_H = 1
X_BITS_TYPES_LOCALE_T_H = 1
X_BITS_TYPES___LOCALE_T_H = 1
X_BSD_SIZE_T_ = 0
X_BSD_SIZE_T_DEFINED_ = 0
X_DEFAULT_SOURCE = 1
X_FEATURES_H = 1
X_FILE_OFFSET_BITS = 64
X_GCC_SIZE_T = 0
X_LP64 = 1
X_POSIX_C_SOURCE = 200809
X_POSIX_SOURCE = 1
X_SIZET_ = 0
X_SIZE_T = 0
X_SIZE_T_ = 0
X_SIZE_T_DECLARED = 0
X_SIZE_T_DEFINED = 0
X_SIZE_T_DEFINED_ = 0
X_STDC_PREDEF_H = 1
X_STRUCT_TIMESPEC = 1
X_SYS_CDEFS_H = 1
X_SYS_SIZE_T_H = 0
X_TIME_H = 1
X_T_SIZE = 0
X_T_SIZE_ = 0
Linux = 1
Unix = 1
)
type Ptrdiff_t = int64 /* <builtin>:3:26 */
type Size_t = uint64 /* <builtin>:9:23 */
type Wchar_t = int32 /* <builtin>:15:24 */
type X__int128_t = struct {
Flo int64
Fhi int64
} /* <builtin>:21:43 */ // must match modernc.org/mathutil.Int128
type X__uint128_t = struct {
Flo uint64
Fhi uint64
} /* <builtin>:22:44 */ // must match modernc.org/mathutil.Int128
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
type X__float128 = float64 /* <builtin>:47:21 */
// Wide character type.
// Locale-writers should change this as necessary to
// be big enough to hold unique values not between 0 and 127,
// and not (wchar_t) -1, for each defined multibyte character.
// Define this type if we are doing the whole job,
// or if we want this type in particular.
// A null pointer constant.
// This defines CLOCKS_PER_SEC, which is the number of processor clock
// ticks per second, and possibly a number of other constants.
// System-dependent timing definitions. Linux version.
// Copyright (C) 1996-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <time.h> instead.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// Convenience types.
type X__u_char = uint8 /* types.h:31:23 */
type X__u_short = uint16 /* types.h:32:28 */
type X__u_int = uint32 /* types.h:33:22 */
type X__u_long = uint64 /* types.h:34:27 */
// Fixed-size types, underlying types depend on word size and compiler.
type X__int8_t = int8 /* types.h:37:21 */
type X__uint8_t = uint8 /* types.h:38:23 */
type X__int16_t = int16 /* types.h:39:26 */
type X__uint16_t = uint16 /* types.h:40:28 */
type X__int32_t = int32 /* types.h:41:20 */
type X__uint32_t = uint32 /* types.h:42:22 */
type X__int64_t = int64 /* types.h:44:25 */
type X__uint64_t = uint64 /* types.h:45:27 */
// Smallest types with at least a given width.
type X__int_least8_t = X__int8_t /* types.h:52:18 */
type X__uint_least8_t = X__uint8_t /* types.h:53:19 */
type X__int_least16_t = X__int16_t /* types.h:54:19 */
type X__uint_least16_t = X__uint16_t /* types.h:55:20 */
type X__int_least32_t = X__int32_t /* types.h:56:19 */
type X__uint_least32_t = X__uint32_t /* types.h:57:20 */
type X__int_least64_t = X__int64_t /* types.h:58:19 */
type X__uint_least64_t = X__uint64_t /* types.h:59:20 */
// quad_t is also 64 bits.
type X__quad_t = int64 /* types.h:63:18 */
type X__u_quad_t = uint64 /* types.h:64:27 */
// Largest integral types.
type X__intmax_t = int64 /* types.h:72:18 */
type X__uintmax_t = uint64 /* types.h:73:27 */
// The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
// macros for each of the OS types we define below. The definitions
// of those macros must use the following macros for underlying types.
// We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
// variants of each of the following integer types on this machine.
//
// 16 -- "natural" 16-bit type (always short)
// 32 -- "natural" 32-bit type (always int)
// 64 -- "natural" 64-bit type (long or long long)
// LONG32 -- 32-bit type, traditionally long
// QUAD -- 64-bit type, traditionally long long
// WORD -- natural type of __WORDSIZE bits (int or long)
// LONGWORD -- type of __WORDSIZE bits, traditionally long
//
// We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
// conventional uses of `long' or `long long' type modifiers match the
// types we define, even when a less-adorned type would be the same size.
// This matters for (somewhat) portably writing printf/scanf formats for
// these types, where using the appropriate l or ll format modifiers can
// make the typedefs and the formats match up across all GNU platforms. If
// we used `long' when it's 64 bits where `long long' is expected, then the
// compiler would warn about the formats not matching the argument types,
// and the programmer changing them to shut up the compiler would break the
// program's portability.
//
// Here we assume what is presently the case in all the GCC configurations
// we support: long long is always 64 bits, long is always word/address size,
// and int is always 32 bits.
// No need to mark the typedef with __extension__.
// bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.
// Copyright (C) 2011-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
// Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// See <bits/types.h> for the meaning of these macros. This file exists so
// that <bits/types.h> need not vary across different GNU platforms.
// Tell the libc code that off_t and off64_t are actually the same type
// for all ABI purposes, even if possibly expressed as different base types
// for C type-checking purposes.
// Same for ino_t and ino64_t.
// And for __rlim_t and __rlim64_t.
// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.
// And for getitimer, setitimer and rusage
// Number of descriptors that can fit in an `fd_set'.
// bits/time64.h -- underlying types for __time64_t. RISC-V version.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Define __TIME64_T_TYPE so that it is always a 64-bit type.
// If we already have 64-bit time type then use it.
type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers.
type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications.
type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications.
type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers.
type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS).
type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks.
type X__nlink_t = uint32 /* types.h:151:27 */ // Type of file link counts.
type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets.
type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS).
type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications.
type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs.
type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts.
type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement.
type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS).
type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs.
type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch.
type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds.
type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds.
type X__suseconds64_t = int64 /* types.h:163:33 */
type X__daddr_t = int32 /* types.h:165:27 */ // The type of a disk address.
type X__key_t = int32 /* types.h:166:25 */ // Type of an IPC key.
// Clock ID used in clock and timer functions.
type X__clockid_t = int32 /* types.h:169:29 */
// Timer ID returned by `timer_create'.
type X__timer_t = uintptr /* types.h:172:12 */
// Type to represent block size.
type X__blksize_t = int32 /* types.h:175:29 */
// Types from the Large File Support interface.
// Type to count number of disk blocks.
type X__blkcnt_t = int64 /* types.h:180:28 */
type X__blkcnt64_t = int64 /* types.h:181:30 */
// Type to count file system blocks.
type X__fsblkcnt_t = uint64 /* types.h:184:30 */
type X__fsblkcnt64_t = uint64 /* types.h:185:32 */
// Type to count file system nodes.
type X__fsfilcnt_t = uint64 /* types.h:188:30 */
type X__fsfilcnt64_t = uint64 /* types.h:189:32 */
// Type of miscellaneous file system fields.
type X__fsword_t = int64 /* types.h:192:28 */
type X__ssize_t = int64 /* types.h:194:27 */ // Type of a byte count, or error.
// Signed long type used in system calls.
type X__syscall_slong_t = int64 /* types.h:197:33 */
// Unsigned long type used in system calls.
type X__syscall_ulong_t = uint64 /* types.h:199:33 */
// These few don't really vary by system, they always correspond
// to one of the other defined types.
type X__loff_t = X__off64_t /* types.h:203:19 */ // Type of file sizes and offsets (LFS).
type X__caddr_t = uintptr /* types.h:204:14 */
// Duplicates info from stdint.h but this is used in unistd.h.
type X__intptr_t = int64 /* types.h:207:25 */
// Duplicate info from sys/socket.h.
type X__socklen_t = uint32 /* types.h:210:23 */
// C99: An integer type that can be accessed as an atomic entity,
// even in the presence of asynchronous interrupts.
// It is not currently necessary for this to be machine-specific.
type X__sig_atomic_t = int32 /* types.h:215:13 */
// Seconds since the Epoch, visible to user code when time_t is too
// narrow only for consistency with the old way of widening too-narrow
// types. User code should never use __time64_t.
// ISO/IEC 9899:1999 7.23.1: Components of time
// The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
// the number per second of the value returned by the `clock' function.
// CAE XSH, Issue 4, Version 2: <time.h>
// The value of CLOCKS_PER_SEC is required to be 1 million on all
// XSI-conformant systems.
// Identifier for system-wide realtime clock.
// Monotonic system-wide clock.
// High-resolution timer from the CPU.
// Thread-specific CPU-time clock.
// Monotonic system-wide clock, not adjusted for frequency scaling.
// Identifier for system-wide realtime clock, updated only on ticks.
// Monotonic system-wide clock, updated only on ticks.
// Monotonic system-wide clock that includes time spent in suspension.
// Like CLOCK_REALTIME but also wakes suspended system.
// Like CLOCK_BOOTTIME but also wakes suspended system.
// Like CLOCK_REALTIME but in International Atomic Time.
// Flag to indicate time is absolute.
// Many of the typedefs and structs whose official home is this header
// may also need to be defined by other headers.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Returned by `clock'.
type Clock_t = X__clock_t /* clock_t.h:7:19 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Returned by `time'.
type Time_t = X__time_t /* time_t.h:10:18 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// ISO C `broken-down time' structure.
type Tm = struct {
Ftm_sec int32
Ftm_min int32
Ftm_hour int32
Ftm_mday int32
Ftm_mon int32
Ftm_year int32
Ftm_wday int32
Ftm_yday int32
Ftm_isdst int32
F__ccgo_pad1 [4]byte
Ftm_gmtoff int64
Ftm_zone uintptr
} /* struct_tm.h:7:1 */
// NB: Include guard matches what <linux/time.h> uses.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Endian macros for string.h functions
// Copyright (C) 1992-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <http://www.gnu.org/licenses/>.
// Definitions for byte order, according to significance of bytes,
// from low addresses to high addresses. The value is what you get by
// putting '4' in the most significant byte, '3' in the second most
// significant byte, '2' in the second least significant byte, and '1'
// in the least significant byte, and then writing down one digit for
// each byte, starting with the byte at the lowest address at the left,
// and proceeding to the byte with the highest address at the right.
// This file defines `__BYTE_ORDER' for the particular machine.
// RISC-V is little-endian.
// Some machines may need to use a different endianness for floating point
// values.
// POSIX.1b structure for a time value. This is like a `struct timeval' but
// has nanoseconds instead of microseconds.
type Timespec = struct {
Ftv_sec X__time_t
Ftv_nsec X__syscall_slong_t
} /* struct_timespec.h:11:1 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Clock ID used in clock and timer functions.
type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Timer ID returned by `timer_create'.
type Timer_t = X__timer_t /* timer_t.h:7:19 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// NB: Include guard matches what <linux/time.h> uses.
// POSIX.1b structure for timer start values and intervals.
type Itimerspec = struct {
Fit_interval struct {
Ftv_sec X__time_t
Ftv_nsec X__syscall_slong_t
}
Fit_value struct {
Ftv_sec X__time_t
Ftv_nsec X__syscall_slong_t
}
} /* struct_itimerspec.h:8:1 */
type Pid_t = X__pid_t /* time.h:54:17 */
// Definition of locale_t.
// Copyright (C) 2017-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Definition of struct __locale_struct and __locale_t.
// Copyright (C) 1997-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
// Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// POSIX.1-2008: the locale_t type, representing a locale context
// (implementation-namespace version). This type should be treated
// as opaque by applications; some details are exposed for the sake of
// efficiency in e.g. ctype functions.
type X__locale_struct = struct {
F__locales [13]uintptr
F__ctype_b uintptr
F__ctype_tolower uintptr
F__ctype_toupper uintptr
F__names [13]uintptr
} /* __locale_t.h:28:1 */
type X__locale_t = uintptr /* __locale_t.h:42:32 */
type Locale_t = X__locale_t /* locale_t.h:24:20 */
var _ uint8 /* gen.c:2:13: */

@ -0,0 +1,5 @@
// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_riscv64.go -pkgname unistd', DO NOT EDIT.
package unistd
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_riscv64.go -pkgname utime', DO NOT EDIT.
package utime
var CAPI = map[string]struct{}{}

@ -0,0 +1,951 @@
// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_riscv64.go -pkgname utime', DO NOT EDIT.
package utime
import (
"math"
"reflect"
"sync/atomic"
"unsafe"
)
var _ = math.Pi
var _ reflect.Kind
var _ atomic.Value
var _ unsafe.Pointer
const (
X_ATFILE_SOURCE = 1
X_BITS_TIME64_H = 1
X_BITS_TYPESIZES_H = 1
X_BITS_TYPES_H = 1
X_DEFAULT_SOURCE = 1
X_FEATURES_H = 1
X_FILE_OFFSET_BITS = 64
X_LP64 = 1
X_POSIX_C_SOURCE = 200809
X_POSIX_SOURCE = 1
X_STDC_PREDEF_H = 1
X_SYS_CDEFS_H = 1
X_UTIME_H = 1
Linux = 1
Unix = 1
)
type Ptrdiff_t = int64 /* <builtin>:3:26 */
type Size_t = uint64 /* <builtin>:9:23 */
type Wchar_t = int32 /* <builtin>:15:24 */
type X__int128_t = struct {
Flo int64
Fhi int64
} /* <builtin>:21:43 */ // must match modernc.org/mathutil.Int128
type X__uint128_t = struct {
Flo uint64
Fhi uint64
} /* <builtin>:22:44 */ // must match modernc.org/mathutil.Int128
type X__builtin_va_list = uintptr /* <builtin>:46:14 */
type X__float128 = float64 /* <builtin>:47:21 */
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// POSIX Standard: 5.6.6 Set File Access and Modification Times <utime.h>
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// These are defined by the user (or the compiler)
// to specify the desired environment:
//
// __STRICT_ANSI__ ISO Standard C.
// _ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
// _ISOC11_SOURCE Extensions to ISO C99 from ISO C11.
// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X.
// __STDC_WANT_LIB_EXT2__
// Extensions to ISO C99 from TR 27431-2:2010.
// __STDC_WANT_IEC_60559_BFP_EXT__
// Extensions to ISO C11 from TS 18661-1:2014.
// __STDC_WANT_IEC_60559_FUNCS_EXT__
// Extensions to ISO C11 from TS 18661-4:2015.
// __STDC_WANT_IEC_60559_TYPES_EXT__
// Extensions to ISO C11 from TS 18661-3:2015.
// __STDC_WANT_IEC_60559_EXT__
// ISO C2X interfaces defined only in Annex F.
//
// _POSIX_SOURCE IEEE Std 1003.1.
// _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
// if >=199309L, add IEEE Std 1003.1b-1993;
// if >=199506L, add IEEE Std 1003.1c-1995;
// if >=200112L, all of IEEE 1003.1-2004
// if >=200809L, all of IEEE 1003.1-2008
// _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
// Single Unix conformance is wanted, to 600 for the
// sixth revision, to 700 for the seventh revision.
// _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
// _LARGEFILE_SOURCE Some more functions for correct standard I/O.
// _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
// _FILE_OFFSET_BITS=N Select default filesystem interface.
// _ATFILE_SOURCE Additional *at interfaces.
// _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant)
// MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
// _GNU_SOURCE All of the above, plus GNU extensions.
// _DEFAULT_SOURCE The default set of features (taking precedence over
// __STRICT_ANSI__).
//
// _FORTIFY_SOURCE Add security hardening to many library functions.
// Set to 1 or 2; 2 performs stricter checks than 1.
//
// _REENTRANT, _THREAD_SAFE
// Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
//
// The `-ansi' switch to the GNU C compiler, and standards conformance
// options such as `-std=c99', define __STRICT_ANSI__. If none of
// these are defined, or if _DEFAULT_SOURCE is defined, the default is
// to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
// 200809L, as well as enabling miscellaneous functions from BSD and
// SVID. If more than one of these are defined, they accumulate. For
// example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
// give you ISO C, 1003.1, and 1003.2, but nothing else.
//
// These are defined by this file and are used by the
// header files to decide what to declare or define:
//
// __GLIBC_USE (F) Define things from feature set F. This is defined
// to 1 or 0; the subsequent macros are either defined
// or undefined, and those tests should be moved to
// __GLIBC_USE.
// __USE_ISOC11 Define ISO C11 things.
// __USE_ISOC99 Define ISO C99 things.
// __USE_ISOC95 Define ISO C90 AMD1 (C95) things.
// __USE_ISOCXX11 Define ISO C++11 things.
// __USE_POSIX Define IEEE Std 1003.1 things.
// __USE_POSIX2 Define IEEE Std 1003.2 things.
// __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
// __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things.
// __USE_XOPEN Define XPG things.
// __USE_XOPEN_EXTENDED Define X/Open Unix things.
// __USE_UNIX98 Define Single Unix V2 things.
// __USE_XOPEN2K Define XPG6 things.
// __USE_XOPEN2KXSI Define XPG6 XSI things.
// __USE_XOPEN2K8 Define XPG7 things.
// __USE_XOPEN2K8XSI Define XPG7 XSI things.
// __USE_LARGEFILE Define correct standard I/O things.
// __USE_LARGEFILE64 Define LFS things with separate names.
// __USE_FILE_OFFSET64 Define 64bit interface as default.
// __USE_MISC Define things from 4.3BSD or System V Unix.
// __USE_ATFILE Define *at interfaces and AT_* constants for them.
// __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant)
// MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
// __USE_GNU Define GNU extensions.
// __USE_FORTIFY_LEVEL Additional security measures used, according to level.
//
// The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
// defined by this file unconditionally. `__GNU_LIBRARY__' is provided
// only for compatibility. All new code should use the other symbols
// to test for features.
//
// All macros listed above as possibly being defined by this file are
// explicitly undefined if they are not explicitly defined.
// Feature-test macros that are not defined by the user or compiler
// but are implied by the other feature-test macros defined (or by the
// lack of any definitions) are defined by the file.
//
// ISO C feature test macros depend on the definition of the macro
// when an affected header is included, not when the first system
// header is included, and so they are handled in
// <bits/libc-header-start.h>, which does not have a multiple include
// guard. Feature test macros that can be handled from the first
// system header included are handled here.
// Undefine everything, so we get a clean slate.
// Suppress kernel-name space pollution unless user expressedly asks
// for it.
// Convenience macro to test the version of gcc.
// Use like this:
// #if __GNUC_PREREQ (2,8)
// ... code requiring gcc 2.8 or later ...
// #endif
// Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
// added in 2.0.
// Similarly for clang. Features added to GCC after version 4.2 may
// or may not also be available in clang, and clang's definitions of
// __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such
// features can be queried via __has_extension/__has_feature.
// Whether to use feature set F.
// _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
// _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not
// issue a warning; the expectation is that the source is being
// transitioned to use the new macro.
// If _GNU_SOURCE was defined by the user, turn on all the other features.
// If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
// define _DEFAULT_SOURCE.
// This is to enable the ISO C2X extension.
// This is to enable the ISO C11 extension.
// This is to enable the ISO C99 extension.
// This is to enable the ISO C90 Amendment 1:1995 extension.
// If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
// is defined, use POSIX.1-2008 (or another version depending on
// _XOPEN_SOURCE).
// Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
// defined in all multithreaded code. GNU libc has not required this
// for many years. We now treat them as compatibility synonyms for
// _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
// comprehensive support for multithreaded code. Using them never
// lowers the selected level of POSIX conformance, only raises it.
// Features part to handle 64-bit time_t support.
// Copyright (C) 2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// We need to know the word size in order to check the time size.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// The function 'gets' existed in C89, but is impossible to use
// safely. It has been removed from ISO C11 and ISO C++14. Note: for
// compatibility with various implementations of <cstdio>, this test
// must consider only the value of __cplusplus when compiling C++.
// GNU formerly extended the scanf functions with modified format
// specifiers %as, %aS, and %a[...] that allocate a buffer for the
// input using malloc. This extension conflicts with ISO C99, which
// defines %a as a standalone format specifier that reads a floating-
// point number; moreover, POSIX.1-2008 provides the same feature
// using the modifier letter 'm' instead (%ms, %mS, %m[...]).
//
// We now follow C99 unless GNU extensions are active and the compiler
// is specifically in C89 or C++98 mode (strict or not). For
// instance, with GCC, -std=gnu11 will have C99-compliant scanf with
// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
// old extension.
// Get definitions of __STDC_* predefined macros, if the compiler has
// not preincluded this header automatically.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// This macro indicates that the installed library is the GNU C Library.
// For historic reasons the value now is 6 and this will stay from now
// on. The use of this variable is deprecated. Use __GLIBC__ and
// __GLIBC_MINOR__ now (see below) when you want to test for a specific
// GNU C library version and use the values in <gnu/lib-names.h> to get
// the sonames of the shared libraries.
// Major and minor version number of the GNU C library package. Use
// these macros to test for features in specific releases.
// This is here only because every header file already includes this one.
// Copyright (C) 1992-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// We are almost always included from features.h.
// The GNU libc does not support any K&R compilers or the traditional mode
// of ISO C compilers anymore. Check for some of the combinations not
// supported anymore.
// Some user header file might have defined this before.
// Compilers that lack __has_attribute may object to
// #if defined __has_attribute && __has_attribute (...)
// even though they do not need to evaluate the right-hand side of the &&.
// Similarly for __has_builtin, etc.
// All functions, except those with callbacks or those that
// synchronize memory, are leaf functions.
// GCC can always grok prototypes. For C++ programs we add throw()
// to help it optimize the function calls. But this only works with
// gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
// as non-throwing using a function attribute since programs can use
// the -fexceptions options for C code as well.
// These two macros are not used in glibc anymore. They are kept here
// only because some other projects expect the macros to be defined.
// For these things, GCC behaves the ANSI way normally,
// and the non-ANSI way under -traditional.
// This is not a typedef so `const __ptr_t' does the right thing.
// C++ needs to know that types and declarations are C, not C++.
// Fortify support.
// Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available.
// Support for flexible arrays.
// Headers that should use flexible arrays only if they're "real"
// (e.g. only if they won't affect sizeof()) should test
// #if __glibc_c99_flexarr_available.
// __asm__ ("xyz") is used throughout the headers to rename functions
// at the assembly language level. This is wrapped by the __REDIRECT
// macro, in order to support compilers that can do this some other
// way. When compilers don't support asm-names at all, we have to do
// preprocessor tricks instead (which don't have exactly the right
// semantics, but it's the best we can do).
//
// Example:
// int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid);
//
// #elif __SOME_OTHER_COMPILER__
//
// # define __REDIRECT(name, proto, alias) name proto; _Pragma("let " #name " = " #alias)
// GCC and clang have various useful declarations that can be made with
// the '__attribute__' syntax. All of the ways we use this do fine if
// they are omitted for compilers that don't understand it.
// At some point during the gcc 2.96 development the `malloc' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// Tell the compiler which arguments to an allocation function
// indicate the size of the allocation.
// At some point during the gcc 2.96 development the `pure' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// This declaration tells the compiler that the value is constant.
// At some point during the gcc 3.1 development the `used' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// Since version 3.2, gcc allows marking deprecated functions.
// Since version 4.5, gcc also allows one to specify the message printed
// when a deprecated function is used. clang claims to be gcc 4.2, but
// may also support this feature.
// At some point during the gcc 2.8 development the `format_arg' attribute
// for functions was introduced. We don't want to use it unconditionally
// (although this would be possible) since it generates warnings.
// If several `format_arg' attributes are given for the same function, in
// gcc-3.0 and older, all but the last one are ignored. In newer gccs,
// all designated arguments are considered.
// At some point during the gcc 2.97 development the `strfmon' format
// attribute for functions was introduced. We don't want to use it
// unconditionally (although this would be possible) since it
// generates warnings.
// The nonnull function attribute marks pointer parameters that
// must not be NULL.
// The returns_nonnull function attribute marks the return type of the function
// as always being non-null.
// If fortification mode, we warn about unused results of certain
// function calls which can lead to problems.
// Forces a function to be always inlined.
// The Linux kernel defines __always_inline in stddef.h (283d7573), and
// it conflicts with this definition. Therefore undefine it first to
// allow either header to be included first.
// Associate error messages with the source location of the call site rather
// than with the source location inside the function.
// GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
// inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
// or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
// older than 4.3 may define these macros and still not guarantee GNU inlining
// semantics.
//
// clang++ identifies itself as gcc-4.2, but has support for GNU inlining
// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
// __GNUC_GNU_INLINE__ macro definitions.
// GCC 4.3 and above allow passing all anonymous arguments of an
// __extern_always_inline function to some other vararg function.
// It is possible to compile containing GCC extensions even if GCC is
// run in pedantic mode if the uses are carefully marked using the
// `__extension__' keyword. But this is not generally available before
// version 2.8.
// __restrict is known in EGCS 1.2 and above, and in clang.
// It works also in C++ mode (outside of arrays), but only when spelled
// as '__restrict', not 'restrict'.
// ISO C99 also allows to declare arrays as non-overlapping. The syntax is
// array_name[restrict]
// GCC 3.1 and clang support this.
// This syntax is not usable in C++ mode.
// Describes a char array whose address can safely be passed as the first
// argument to strncpy and strncat, as the char array is not necessarily
// a NUL-terminated string.
// Undefine (also defined in libc-symbols.h).
// Copies attributes from the declaration or type referenced by
// the argument.
// The #ifndef lets Gnulib avoid including these on non-glibc
// platforms, where the includes typically do not exist.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Properties of long double type. ldbl-128 version.
// Copyright (C) 2016-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// long double is distinct from double, so there is nothing to
// define here.
// __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
// intended for use in preprocessor macros.
//
// Note: MESSAGE must be a _single_ string; concatenation of string
// literals is not supported.
// Generic selection (ISO C11) is a C-only feature, available in GCC
// since version 4.9. Previous versions do not provide generic
// selection, even though they might set __STDC_VERSION__ to 201112L,
// when in -std=c11 mode. Thus, we must check for !defined __GNUC__
// when testing __STDC_VERSION__ for generic selection support.
// On the other hand, Clang also defines __GNUC__, so a clang-specific
// check is required to enable the use of generic selection.
// Designates a 1-based positional argument ref-index of pointer type
// that can be used to access size-index elements of the pointed-to
// array according to access mode, or at least one element when
// size-index is not provided:
// access (access-mode, <ref-index> [, <size-index>])
// Designates dealloc as a function to call to deallocate objects
// allocated by the declared function.
// Specify that a function such as setjmp or vfork may return
// twice.
// If we don't have __REDIRECT, prototypes will be missing if
// __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64].
// Decide whether we can define 'extern inline' functions in headers.
// This is here only because every header file already includes this one.
// Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
// <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
// that will always return failure (and set errno to ENOSYS).
// This file is automatically generated.
// This file selects the right generated file of `__stub_FUNCTION' macros
// based on the architecture being compiled for.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// This file is automatically generated.
// It defines a symbol `__stub_FUNCTION' for each function
// in the C library which is a stub, meaning it will fail
// every time called, usually setting errno to ENOSYS.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Copyright (C) 1991-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// Bit size of the time_t type at glibc build time, RISC-V case.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Determine the wordsize from the preprocessor defines. RISC-V version.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// RV32 and RV64 both use 64-bit time_t
// Convenience types.
type X__u_char = uint8 /* types.h:31:23 */
type X__u_short = uint16 /* types.h:32:28 */
type X__u_int = uint32 /* types.h:33:22 */
type X__u_long = uint64 /* types.h:34:27 */
// Fixed-size types, underlying types depend on word size and compiler.
type X__int8_t = int8 /* types.h:37:21 */
type X__uint8_t = uint8 /* types.h:38:23 */
type X__int16_t = int16 /* types.h:39:26 */
type X__uint16_t = uint16 /* types.h:40:28 */
type X__int32_t = int32 /* types.h:41:20 */
type X__uint32_t = uint32 /* types.h:42:22 */
type X__int64_t = int64 /* types.h:44:25 */
type X__uint64_t = uint64 /* types.h:45:27 */
// Smallest types with at least a given width.
type X__int_least8_t = X__int8_t /* types.h:52:18 */
type X__uint_least8_t = X__uint8_t /* types.h:53:19 */
type X__int_least16_t = X__int16_t /* types.h:54:19 */
type X__uint_least16_t = X__uint16_t /* types.h:55:20 */
type X__int_least32_t = X__int32_t /* types.h:56:19 */
type X__uint_least32_t = X__uint32_t /* types.h:57:20 */
type X__int_least64_t = X__int64_t /* types.h:58:19 */
type X__uint_least64_t = X__uint64_t /* types.h:59:20 */
// quad_t is also 64 bits.
type X__quad_t = int64 /* types.h:63:18 */
type X__u_quad_t = uint64 /* types.h:64:27 */
// Largest integral types.
type X__intmax_t = int64 /* types.h:72:18 */
type X__uintmax_t = uint64 /* types.h:73:27 */
// The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
// macros for each of the OS types we define below. The definitions
// of those macros must use the following macros for underlying types.
// We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
// variants of each of the following integer types on this machine.
//
// 16 -- "natural" 16-bit type (always short)
// 32 -- "natural" 32-bit type (always int)
// 64 -- "natural" 64-bit type (long or long long)
// LONG32 -- 32-bit type, traditionally long
// QUAD -- 64-bit type, traditionally long long
// WORD -- natural type of __WORDSIZE bits (int or long)
// LONGWORD -- type of __WORDSIZE bits, traditionally long
//
// We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
// conventional uses of `long' or `long long' type modifiers match the
// types we define, even when a less-adorned type would be the same size.
// This matters for (somewhat) portably writing printf/scanf formats for
// these types, where using the appropriate l or ll format modifiers can
// make the typedefs and the formats match up across all GNU platforms. If
// we used `long' when it's 64 bits where `long long' is expected, then the
// compiler would warn about the formats not matching the argument types,
// and the programmer changing them to shut up the compiler would break the
// program's portability.
//
// Here we assume what is presently the case in all the GCC configurations
// we support: long long is always 64 bits, long is always word/address size,
// and int is always 32 bits.
// No need to mark the typedef with __extension__.
// bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.
// Copyright (C) 2011-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
// Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library. If not, see
// <https://www.gnu.org/licenses/>.
// See <bits/types.h> for the meaning of these macros. This file exists so
// that <bits/types.h> need not vary across different GNU platforms.
// Tell the libc code that off_t and off64_t are actually the same type
// for all ABI purposes, even if possibly expressed as different base types
// for C type-checking purposes.
// Same for ino_t and ino64_t.
// And for __rlim_t and __rlim64_t.
// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.
// And for getitimer, setitimer and rusage
// Number of descriptors that can fit in an `fd_set'.
// bits/time64.h -- underlying types for __time64_t. RISC-V version.
// Copyright (C) 2020-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Define __TIME64_T_TYPE so that it is always a 64-bit type.
// If we already have 64-bit time type then use it.
type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers.
type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications.
type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications.
type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers.
type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS).
type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks.
type X__nlink_t = uint32 /* types.h:151:27 */ // Type of file link counts.
type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets.
type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS).
type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications.
type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs.
type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts.
type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement.
type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS).
type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs.
type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch.
type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds.
type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds.
type X__suseconds64_t = int64 /* types.h:163:33 */
type X__daddr_t = int32 /* types.h:165:27 */ // The type of a disk address.
type X__key_t = int32 /* types.h:166:25 */ // Type of an IPC key.
// Clock ID used in clock and timer functions.
type X__clockid_t = int32 /* types.h:169:29 */
// Timer ID returned by `timer_create'.
type X__timer_t = uintptr /* types.h:172:12 */
// Type to represent block size.
type X__blksize_t = int32 /* types.h:175:29 */
// Types from the Large File Support interface.
// Type to count number of disk blocks.
type X__blkcnt_t = int64 /* types.h:180:28 */
type X__blkcnt64_t = int64 /* types.h:181:30 */
// Type to count file system blocks.
type X__fsblkcnt_t = uint64 /* types.h:184:30 */
type X__fsblkcnt64_t = uint64 /* types.h:185:32 */
// Type to count file system nodes.
type X__fsfilcnt_t = uint64 /* types.h:188:30 */
type X__fsfilcnt64_t = uint64 /* types.h:189:32 */
// Type of miscellaneous file system fields.
type X__fsword_t = int64 /* types.h:192:28 */
type X__ssize_t = int64 /* types.h:194:27 */ // Type of a byte count, or error.
// Signed long type used in system calls.
type X__syscall_slong_t = int64 /* types.h:197:33 */
// Unsigned long type used in system calls.
type X__syscall_ulong_t = uint64 /* types.h:199:33 */
// These few don't really vary by system, they always correspond
// to one of the other defined types.
type X__loff_t = X__off64_t /* types.h:203:19 */ // Type of file sizes and offsets (LFS).
type X__caddr_t = uintptr /* types.h:204:14 */
// Duplicates info from stdint.h but this is used in unistd.h.
type X__intptr_t = int64 /* types.h:207:25 */
// Duplicate info from sys/socket.h.
type X__socklen_t = uint32 /* types.h:210:23 */
// C99: An integer type that can be accessed as an atomic entity,
// even in the presence of asynchronous interrupts.
// It is not currently necessary for this to be machine-specific.
type X__sig_atomic_t = int32 /* types.h:215:13 */
// Seconds since the Epoch, visible to user code when time_t is too
// narrow only for consistency with the old way of widening too-narrow
// types. User code should never use __time64_t.
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2021 Free Software Foundation, Inc.
// This file is part of the GNU C Library.
//
// The GNU C Library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// The GNU C Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with the GNU C Library; if not, see
// <https://www.gnu.org/licenses/>.
// Never include this file directly; use <sys/types.h> instead.
// Returned by `time'.
type Time_t = X__time_t /* time_t.h:10:18 */
// Structure describing file times.
type Utimbuf = struct {
Factime X__time_t
Fmodtime X__time_t
} /* utime.h:36:1 */
var _ uint8 /* gen.c:2:13: */

@ -0,0 +1,5 @@
// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_amd64.go -pkgname uuid', DO NOT EDIT.
package uuid
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
// Code generated by 'ccgo wctype/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o wctype/wctype_linux_riscv64.go -pkgname wctype', DO NOT EDIT.
package wctype
var CAPI = map[string]struct{}{}

File diff suppressed because it is too large Load Diff

@ -8,3 +8,4 @@
Jan Mercl <0xjnml@gmail.com>
Steffen Butzer <steffen(dot)butzer@outlook.com>
ZHU Zijia <piggynl@outlook.com>

@ -0,0 +1,27 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@ -36,14 +36,23 @@ editor:
gofmt -l -s -w *.go
GOOS=darwin GOARCH=amd64 go build
GOOS=darwin GOARCH=arm64 go build
GOOS=freebsd GOARCH=386 go build
GOOS=freebsd GOARCH=amd64 go build
GOOS=linux GOARCH=386 go build
GOOS=linux GOARCH=amd64 go build
GOOS=linux GOARCH=arm go build
GOOS=linux GOARCH=arm64 go build
GOOS=linux GOARCH=mips go build
GOOS=linux GOARCH=mips64le go build
GOOS=linux GOARCH=mipsle go build
GOOS=linux GOARCH=riscv64 go build
GOOS=linux GOARCH=s390x go build
GOOS=netbsd GOARCH=386 go build
GOOS=netbsd GOARCH=amd64 go build
GOOS=openbsd GOARCH=386 go build
GOOS=openbsd GOARCH=amd64 go build
GOOS=windows GOARCH=386 go build
GOOS=windows GOARCH=amd64 go build
go test 2>&1 | tee log
internalError:
egrep -ho '"internal error.*"' *.go | sort | cat -n

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build memory.counters
// +build memory.counters
package memory // import "modernc.org/memory"

@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build 386 || arm || armbe || mips || mipsle || ppc || ppc64le || s390 || s390x || sparc
// +build 386 arm armbe mips mipsle ppc ppc64le s390 s390x sparc
package memory // import "modernc.org/memory"
type rawmem [1<<31 - 1]byte
type rawmem [1<<31 - 2]byte

@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build amd64 amd64p32 arm64 arm64be mips64 mips64le mips64p32 mips64p32le ppc64 sparc64
//go:build amd64 || amd64p32 || arm64 || arm64be || mips64 || mips64le || mips64p32 || mips64p32le || ppc64 || sparc64 || riscv64
// +build amd64 amd64p32 arm64 arm64be mips64 mips64le mips64p32 mips64p32le ppc64 sparc64 riscv64
package memory // import "modernc.org/memory"

@ -0,0 +1,17 @@
// Copyright 2017 The Memory Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (darwin && (amd64 || arm64)) || (openbsd && (386 || amd64))
package memory
import (
_ "unsafe"
)
// Function syscall.mmap for darwin and openbsd calls internal/abi.FuncPCABI0,
// which is implemented as a compile intrinsic so the code cannot be reused.
// Using go:linkname directive to link mmapSyscall to syscall.mmap
//go:linkname mmapSyscall syscall.mmap
func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)

@ -0,0 +1,21 @@
// 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-GO file.
//go:build freebsd && 386
package memory
import (
"syscall"
)
// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_freebsd_386.go
func mmapSyscall(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
r0, _, e1 := syscall.Syscall9(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
ret = uintptr(r0)
if e1 != 0 {
err = e1
}
return
}

@ -0,0 +1,21 @@
// 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-GO file.
//go:build freebsd && amd64
package memory
import (
"syscall"
)
// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_freebsd_amd64.go;l=1337-1346
func mmapSyscall(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
r0, _, e1 := syscall.Syscall6(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
ret = uintptr(r0)
if e1 != 0 {
err = e1
}
return
}

@ -0,0 +1,33 @@
// 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-GO file.
//go:build linux && (386 || arm || mips || mipsle)
package memory
import (
"syscall"
)
// Function syscall.mmap and syscall.mmap2 are same for linux/386, linux/arm,
// linux/mips and linux/mipsle
// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/syscall_linux_386.go;l=99-105
func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
page := uintptr(offset / 4096)
if offset != int64(page)*4096 {
return 0, syscall.EINVAL
}
return mmap2Syscall(addr, length, prot, flags, fd, page)
}
// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_linux_386.go;l=1361-1370
func mmap2Syscall(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) {
r0, _, e1 := syscall.Syscall6(syscall.SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset))
xaddr = uintptr(r0)
if e1 != 0 {
err = e1
}
return
}

@ -0,0 +1,24 @@
// 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-GO file.
//go:build linux && (amd64 || arm64 || mips64 || mips64le || riscv64)
package memory
import (
"syscall"
)
// Function syscall.mmap is same for linux/amd64, linux/arm64, linux/mips64,
// linux/mips64le and linux/riscv64.
// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_linux_amd64.go;l=1575-1584
func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
r0, _, e1 := syscall.Syscall6(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
xaddr = uintptr(r0)
if e1 != 0 {
err = e1
}
return
}

@ -0,0 +1,23 @@
// 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-GO file.
package memory
import (
"syscall"
"unsafe"
)
// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/syscall_linux_s390x.go;l=105-115
// Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct.
// mmap2 also requires arguments to be passed in a struct; it is currently not exposed in <asm/unistd.h>.
func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)}
r0, _, e1 := syscall.Syscall(syscall.SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0)
xaddr = uintptr(r0)
if e1 != 0 {
err = e1
}
return
}

@ -0,0 +1,21 @@
// 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-GO file.
//go:build netbsd && 386
package memory
import (
"syscall"
)
// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_freebsd_386.go
func mmapSyscall(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
r0, _, e1 := syscall.Syscall9(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0)
ret = uintptr(r0)
if e1 != 0 {
err = e1
}
return
}

@ -0,0 +1,21 @@
// 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-GO file.
//go:build netbsd && amd64
package memory
import (
"syscall"
)
// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_netbsd_amd64.go;l=1190
func mmapSyscall(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
r0, _, e1 := syscall.Syscall9(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0)
ret = uintptr(r0)
if e1 != 0 {
err = e1
}
return
}

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE-MMAP-GO file.
//go:build darwin || dragonfly || freebsd || linux || openbsd || solaris || netbsd
// +build darwin dragonfly freebsd linux openbsd solaris netbsd
// Modifications (c) 2017 The Memory Authors.
@ -11,7 +12,6 @@ package memory // import "modernc.org/memory"
import (
"os"
"syscall"
"unsafe"
)
const pageSizeLog = 20
@ -33,13 +33,17 @@ func unmap(addr uintptr, size int) error {
// pageSize aligned.
func mmap(size int) (uintptr, int, error) {
size = roundup(size, osPageSize)
b, err := syscall.Mmap(-1, 0, size+pageSize, syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_SHARED|syscall.MAP_ANON)
// The actual mmap syscall varies by architecture. mmapSyscall provides same
// functionality as the unexported funtion syscall.mmap and is declared in
// mmap_*_*.go and mmap_fallback.go. To add support for a new architecture,
// check function mmap in src/syscall/syscall_*_*.go or
// src/syscall/zsyscall_*_*.go in Go's source code.
p, err := mmapSyscall(0, uintptr(size+pageSize), syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_PRIVATE|syscall.MAP_ANON, -1, 0)
if err != nil {
return 0, 0, err
}
n := len(b)
p := uintptr(unsafe.Pointer(&b[0]))
n := size + pageSize
if p&uintptr(osPageMask) != 0 {
panic("internal error")
}

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !memory.counters
// +build !memory.counters
package memory // import "modernc.org/memory"

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !memory.trace
// +build !memory.trace
package memory // import "modernc.org/memory"

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build memory.trace
// +build memory.trace
package memory // import "modernc.org/memory"

@ -23,6 +23,7 @@ all: editor
GOOS=linux GOARCH=amd64 go build -v ./...
GOOS=linux GOARCH=arm go build -v ./...
GOOS=linux GOARCH=arm64 go build -v ./...
GOOS=linux GOARCH=riscv64 go build -v ./...
GOOS=linux GOARCH=s390x go build -v ./...
#GOOS=windows GOARCH=386 go build -v ./...
GOOS=windows GOARCH=amd64 go build -v ./...
@ -52,6 +53,8 @@ build_all_targets:
GOOS=linux GOARCH=arm go test -c -o /dev/null
GOOS=linux GOARCH=arm64 go build -v ./...
GOOS=linux GOARCH=arm64 go test -c -o /dev/null
GOOS=linux GOARCH=riscv64 go build -v ./...
GOOS=linux GOARCH=riscv64 go test -c -o /dev/null
GOOS=linux GOARCH=s390x go build -v ./...
GOOS=linux GOARCH=s390x go test -c -o /dev/null
GOOS=netbsd GOARCH=amd64 go build -v ./...
@ -130,6 +133,12 @@ linux_arm64:
CCGO_CPP=aarch64-linux-gnu-cpp TARGET_GOARCH=arm64 TARGET_GOOS=linux go generate 2>&1 | tee log-generate
GOOS=linux GOARCH=arm64 go build -v ./...
# linux/riscv64
linux_riscv64:
@echo "Should be executed only on linux/riscv64."
go generate 2>&1 | tee log-generate
go build -v ./...
# 3900x
linux_s390x:
@echo "Should be executed only on linux/amd64."

21
vendor/modernc.org/sqlite/doc.go generated vendored

@ -14,14 +14,15 @@
//
// OS Arch SQLite version
// ------------------------------
// darwin amd64 3.38.0
// darwin arm64 3.38.0
// freebsd amd64 3.38.0
// linux 386 3.38.0
// linux amd64 3.38.0
// linux arm 3.38.0
// linux arm64 3.38.0
// windows amd64 3.38.0
// darwin amd64 3.38.1
// darwin arm64 3.38.1
// freebsd amd64 3.38.1
// linux 386 3.38.1
// linux amd64 3.38.1
// linux arm 3.38.1
// linux arm64 3.38.1
// linux riscv64 3.38.1
// windows amd64 3.38.1
//
// Builders
//
@ -31,6 +32,10 @@
//
// Changelog
//
// 2022-03-13 v1.15.0:
//
// Support linux/riscv64.
//
// 2021-11-13 v1.14.0:
//
// Support windows/amd64. This target had previously only experimental status

@ -254,12 +254,12 @@ var (
sz int
dev bool
}{
{sqliteDir, "https://www.sqlite.org/2022/sqlite-amalgamation-3380000.zip", 2457, false},
{sqliteSrcDir, "https://www.sqlite.org/2022/sqlite-src-3380000.zip", 12814, false},
{sqliteDir, "https://www.sqlite.org/2022/sqlite-amalgamation-3380100.zip", 2457, false},
{sqliteSrcDir, "https://www.sqlite.org/2022/sqlite-src-3380100.zip", 12814, false},
}
sqliteDir = filepath.FromSlash("testdata/sqlite-amalgamation-3380000")
sqliteSrcDir = filepath.FromSlash("testdata/sqlite-src-3380000")
sqliteDir = filepath.FromSlash("testdata/sqlite-amalgamation-3380100")
sqliteSrcDir = filepath.FromSlash("testdata/sqlite-src-3380100")
)
func download() {

@ -1,4 +1,4 @@
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_darwin_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3380000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT.
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_darwin_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3380100/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT.
package sqlite3

@ -1,4 +1,4 @@
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_darwin_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3380000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT.
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_darwin_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3380100/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT.
package sqlite3

@ -1,4 +1,4 @@
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_freebsd_386.go -trace-translation-units testdata/sqlite-amalgamation-3380000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_freebsd_386.go -trace-translation-units testdata/sqlite-amalgamation-3380100/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
package sqlite3

@ -1,4 +1,4 @@
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_freebsd_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3380000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_freebsd_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3380100/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
package sqlite3

@ -1,4 +1,4 @@
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_linux_386.go -trace-translation-units testdata/sqlite-amalgamation-3380000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_linux_386.go -trace-translation-units testdata/sqlite-amalgamation-3380100/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
package sqlite3

@ -1,4 +1,4 @@
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_linux_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3380000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_linux_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3380100/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
package sqlite3

@ -1,4 +1,4 @@
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_linux_arm.go -trace-translation-units testdata/sqlite-amalgamation-3380000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -ignore-unsupported-alignment -pkgname sqlite3 -o lib/sqlite_linux_arm.go -trace-translation-units testdata/sqlite-amalgamation-3380100/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_MUTEX_NOOP -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT.
package sqlite3

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save