mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
*: revendor dependencies after moving to go1.12
This commit is contained in:
parent
a47edfe5a9
commit
552284f174
371 changed files with 57445 additions and 108763 deletions
1
vendor/github.com/coreos/etcd/Documentation/README.md
generated
vendored
1
vendor/github.com/coreos/etcd/Documentation/README.md
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
docs.md
|
|
||||||
1
vendor/github.com/coreos/etcd/cmd/etcd
generated
vendored
1
vendor/github.com/coreos/etcd/cmd/etcd
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
../
|
|
||||||
1
vendor/github.com/coreos/etcd/cmd/etcdctl
generated
vendored
1
vendor/github.com/coreos/etcd/cmd/etcdctl
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
../etcdctl
|
|
||||||
1
vendor/github.com/coreos/etcd/cmd/functional
generated
vendored
1
vendor/github.com/coreos/etcd/cmd/functional
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
../functional
|
|
||||||
1
vendor/github.com/coreos/etcd/cmd/tools
generated
vendored
1
vendor/github.com/coreos/etcd/cmd/tools
generated
vendored
|
|
@ -1 +0,0 @@
|
||||||
../tools
|
|
||||||
5
vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS
generated
vendored
5
vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS
generated
vendored
|
|
@ -1,5 +0,0 @@
|
||||||
The contributors to the Go protobuf repository:
|
|
||||||
|
|
||||||
# This source code was written by the Go contributors.
|
|
||||||
# The master list of contributors is in the main Go distribution,
|
|
||||||
# visible at http://tip.golang.org/CONTRIBUTORS.
|
|
||||||
0
vendor/github.com/googleapis/gnostic/extensions/COMPILE-EXTENSION.sh
generated
vendored
Executable file → Normal file
0
vendor/github.com/googleapis/gnostic/extensions/COMPILE-EXTENSION.sh
generated
vendored
Executable file → Normal file
4
vendor/github.com/imdario/mergo/testdata/license.yml
generated
vendored
4
vendor/github.com/imdario/mergo/testdata/license.yml
generated
vendored
|
|
@ -1,4 +0,0 @@
|
||||||
import: ../../../../fossene/db/schema/thing.yml
|
|
||||||
fields:
|
|
||||||
site: string
|
|
||||||
author: root
|
|
||||||
0
vendor/github.com/json-iterator/go/build.sh
generated
vendored
Executable file → Normal file
0
vendor/github.com/json-iterator/go/build.sh
generated
vendored
Executable file → Normal file
0
vendor/github.com/json-iterator/go/test.sh
generated
vendored
Executable file → Normal file
0
vendor/github.com/json-iterator/go/test.sh
generated
vendored
Executable file → Normal file
0
vendor/github.com/modern-go/concurrent/test.sh
generated
vendored
Executable file → Normal file
0
vendor/github.com/modern-go/concurrent/test.sh
generated
vendored
Executable file → Normal file
0
vendor/github.com/modern-go/reflect2/test.sh
generated
vendored
Executable file → Normal file
0
vendor/github.com/modern-go/reflect2/test.sh
generated
vendored
Executable file → Normal file
201
vendor/github.com/prometheus/client_model/ruby/LICENSE
generated
vendored
201
vendor/github.com/prometheus/client_model/ruby/LICENSE
generated
vendored
|
|
@ -1,201 +0,0 @@
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
0
vendor/github.com/prometheus/procfs/ttar
generated
vendored
Executable file → Normal file
0
vendor/github.com/prometheus/procfs/ttar
generated
vendored
Executable file → Normal file
202
vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden
generated
vendored
202
vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden
generated
vendored
|
|
@ -1,202 +0,0 @@
|
||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
5
vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go
generated
vendored
5
vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go
generated
vendored
|
|
@ -2,18 +2,15 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build go1.7
|
|
||||||
|
|
||||||
// Package ctxhttp provides helper functions for performing context-aware HTTP requests.
|
// Package ctxhttp provides helper functions for performing context-aware HTTP requests.
|
||||||
package ctxhttp // import "golang.org/x/net/context/ctxhttp"
|
package ctxhttp // import "golang.org/x/net/context/ctxhttp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Do sends an HTTP request with the provided http.Client and returns
|
// Do sends an HTTP request with the provided http.Client and returns
|
||||||
|
|
|
||||||
147
vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go
generated
vendored
147
vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go
generated
vendored
|
|
@ -1,147 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !go1.7
|
|
||||||
|
|
||||||
package ctxhttp // import "golang.org/x/net/context/ctxhttp"
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
|
||||||
|
|
||||||
func nop() {}
|
|
||||||
|
|
||||||
var (
|
|
||||||
testHookContextDoneBeforeHeaders = nop
|
|
||||||
testHookDoReturned = nop
|
|
||||||
testHookDidBodyClose = nop
|
|
||||||
)
|
|
||||||
|
|
||||||
// Do sends an HTTP request with the provided http.Client and returns an HTTP response.
|
|
||||||
// If the client is nil, http.DefaultClient is used.
|
|
||||||
// If the context is canceled or times out, ctx.Err() will be returned.
|
|
||||||
func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
|
|
||||||
if client == nil {
|
|
||||||
client = http.DefaultClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(djd): Respect any existing value of req.Cancel.
|
|
||||||
cancel := make(chan struct{})
|
|
||||||
req.Cancel = cancel
|
|
||||||
|
|
||||||
type responseAndError struct {
|
|
||||||
resp *http.Response
|
|
||||||
err error
|
|
||||||
}
|
|
||||||
result := make(chan responseAndError, 1)
|
|
||||||
|
|
||||||
// Make local copies of test hooks closed over by goroutines below.
|
|
||||||
// Prevents data races in tests.
|
|
||||||
testHookDoReturned := testHookDoReturned
|
|
||||||
testHookDidBodyClose := testHookDidBodyClose
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
resp, err := client.Do(req)
|
|
||||||
testHookDoReturned()
|
|
||||||
result <- responseAndError{resp, err}
|
|
||||||
}()
|
|
||||||
|
|
||||||
var resp *http.Response
|
|
||||||
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
testHookContextDoneBeforeHeaders()
|
|
||||||
close(cancel)
|
|
||||||
// Clean up after the goroutine calling client.Do:
|
|
||||||
go func() {
|
|
||||||
if r := <-result; r.resp != nil {
|
|
||||||
testHookDidBodyClose()
|
|
||||||
r.resp.Body.Close()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return nil, ctx.Err()
|
|
||||||
case r := <-result:
|
|
||||||
var err error
|
|
||||||
resp, err = r.resp, r.err
|
|
||||||
if err != nil {
|
|
||||||
return resp, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c := make(chan struct{})
|
|
||||||
go func() {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
close(cancel)
|
|
||||||
case <-c:
|
|
||||||
// The response's Body is closed.
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
resp.Body = ¬ifyingReader{resp.Body, c}
|
|
||||||
|
|
||||||
return resp, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get issues a GET request via the Do function.
|
|
||||||
func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
|
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return Do(ctx, client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Head issues a HEAD request via the Do function.
|
|
||||||
func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
|
|
||||||
req, err := http.NewRequest("HEAD", url, nil)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return Do(ctx, client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Post issues a POST request via the Do function.
|
|
||||||
func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) {
|
|
||||||
req, err := http.NewRequest("POST", url, body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
req.Header.Set("Content-Type", bodyType)
|
|
||||||
return Do(ctx, client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// PostForm issues a POST request via the Do function.
|
|
||||||
func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) {
|
|
||||||
return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
|
|
||||||
}
|
|
||||||
|
|
||||||
// notifyingReader is an io.ReadCloser that closes the notify channel after
|
|
||||||
// Close is called or a Read fails on the underlying ReadCloser.
|
|
||||||
type notifyingReader struct {
|
|
||||||
io.ReadCloser
|
|
||||||
notify chan<- struct{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *notifyingReader) Read(p []byte) (int, error) {
|
|
||||||
n, err := r.ReadCloser.Read(p)
|
|
||||||
if err != nil && r.notify != nil {
|
|
||||||
close(r.notify)
|
|
||||||
r.notify = nil
|
|
||||||
}
|
|
||||||
return n, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *notifyingReader) Close() error {
|
|
||||||
err := r.ReadCloser.Close()
|
|
||||||
if r.notify != nil {
|
|
||||||
close(r.notify)
|
|
||||||
r.notify = nil
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
10
vendor/golang.org/x/net/html/const.go
generated
vendored
10
vendor/golang.org/x/net/html/const.go
generated
vendored
|
|
@ -97,8 +97,16 @@ func isSpecialElement(element *Node) bool {
|
||||||
switch element.Namespace {
|
switch element.Namespace {
|
||||||
case "", "html":
|
case "", "html":
|
||||||
return isSpecialElementMap[element.Data]
|
return isSpecialElementMap[element.Data]
|
||||||
|
case "math":
|
||||||
|
switch element.Data {
|
||||||
|
case "mi", "mo", "mn", "ms", "mtext", "annotation-xml":
|
||||||
|
return true
|
||||||
|
}
|
||||||
case "svg":
|
case "svg":
|
||||||
return element.Data == "foreignObject"
|
switch element.Data {
|
||||||
|
case "foreignObject", "desc", "title":
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
vendor/golang.org/x/net/html/parse.go
generated
vendored
10
vendor/golang.org/x/net/html/parse.go
generated
vendored
|
|
@ -470,6 +470,10 @@ func (p *parser) resetInsertionMode() {
|
||||||
case a.Table:
|
case a.Table:
|
||||||
p.im = inTableIM
|
p.im = inTableIM
|
||||||
case a.Template:
|
case a.Template:
|
||||||
|
// TODO: remove this divergence from the HTML5 spec.
|
||||||
|
if n.Namespace != "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
p.im = p.templateStack.top()
|
p.im = p.templateStack.top()
|
||||||
case a.Head:
|
case a.Head:
|
||||||
// TODO: remove this divergence from the HTML5 spec.
|
// TODO: remove this divergence from the HTML5 spec.
|
||||||
|
|
@ -1260,12 +1264,6 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) {
|
||||||
switch commonAncestor.DataAtom {
|
switch commonAncestor.DataAtom {
|
||||||
case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
|
case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
|
||||||
p.fosterParent(lastNode)
|
p.fosterParent(lastNode)
|
||||||
case a.Template:
|
|
||||||
// TODO: remove namespace checking
|
|
||||||
if commonAncestor.Namespace == "html" {
|
|
||||||
commonAncestor = commonAncestor.LastChild
|
|
||||||
}
|
|
||||||
fallthrough
|
|
||||||
default:
|
default:
|
||||||
commonAncestor.AppendChild(lastNode)
|
commonAncestor.AppendChild(lastNode)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
82
vendor/golang.org/x/net/http2/configure_transport.go
generated
vendored
82
vendor/golang.org/x/net/http2/configure_transport.go
generated
vendored
|
|
@ -1,82 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build go1.6
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func configureTransport(t1 *http.Transport) (*Transport, error) {
|
|
||||||
connPool := new(clientConnPool)
|
|
||||||
t2 := &Transport{
|
|
||||||
ConnPool: noDialClientConnPool{connPool},
|
|
||||||
t1: t1,
|
|
||||||
}
|
|
||||||
connPool.t = t2
|
|
||||||
if err := registerHTTPSProtocol(t1, noDialH2RoundTripper{t2}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if t1.TLSClientConfig == nil {
|
|
||||||
t1.TLSClientConfig = new(tls.Config)
|
|
||||||
}
|
|
||||||
if !strSliceContains(t1.TLSClientConfig.NextProtos, "h2") {
|
|
||||||
t1.TLSClientConfig.NextProtos = append([]string{"h2"}, t1.TLSClientConfig.NextProtos...)
|
|
||||||
}
|
|
||||||
if !strSliceContains(t1.TLSClientConfig.NextProtos, "http/1.1") {
|
|
||||||
t1.TLSClientConfig.NextProtos = append(t1.TLSClientConfig.NextProtos, "http/1.1")
|
|
||||||
}
|
|
||||||
upgradeFn := func(authority string, c *tls.Conn) http.RoundTripper {
|
|
||||||
addr := authorityAddr("https", authority)
|
|
||||||
if used, err := connPool.addConnIfNeeded(addr, t2, c); err != nil {
|
|
||||||
go c.Close()
|
|
||||||
return erringRoundTripper{err}
|
|
||||||
} else if !used {
|
|
||||||
// Turns out we don't need this c.
|
|
||||||
// For example, two goroutines made requests to the same host
|
|
||||||
// at the same time, both kicking off TCP dials. (since protocol
|
|
||||||
// was unknown)
|
|
||||||
go c.Close()
|
|
||||||
}
|
|
||||||
return t2
|
|
||||||
}
|
|
||||||
if m := t1.TLSNextProto; len(m) == 0 {
|
|
||||||
t1.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{
|
|
||||||
"h2": upgradeFn,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
m["h2"] = upgradeFn
|
|
||||||
}
|
|
||||||
return t2, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// registerHTTPSProtocol calls Transport.RegisterProtocol but
|
|
||||||
// converting panics into errors.
|
|
||||||
func registerHTTPSProtocol(t *http.Transport, rt noDialH2RoundTripper) (err error) {
|
|
||||||
defer func() {
|
|
||||||
if e := recover(); e != nil {
|
|
||||||
err = fmt.Errorf("%v", e)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
t.RegisterProtocol("https", rt)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// noDialH2RoundTripper is a RoundTripper which only tries to complete the request
|
|
||||||
// if there's already has a cached connection to the host.
|
|
||||||
// (The field is exported so it can be accessed via reflect from net/http; tested
|
|
||||||
// by TestNoDialH2RoundTripperType)
|
|
||||||
type noDialH2RoundTripper struct{ *Transport }
|
|
||||||
|
|
||||||
func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
||||||
res, err := rt.Transport.RoundTrip(req)
|
|
||||||
if isNoCachedConnError(err) {
|
|
||||||
return nil, http.ErrSkipAltProtocol
|
|
||||||
}
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
2
vendor/golang.org/x/net/http2/frame.go
generated
vendored
2
vendor/golang.org/x/net/http2/frame.go
generated
vendored
|
|
@ -1477,7 +1477,7 @@ func (fr *Framer) maxHeaderStringLen() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// readMetaFrame returns 0 or more CONTINUATION frames from fr and
|
// readMetaFrame returns 0 or more CONTINUATION frames from fr and
|
||||||
// merge them into into the provided hf and returns a MetaHeadersFrame
|
// merge them into the provided hf and returns a MetaHeadersFrame
|
||||||
// with the decoded hpack values.
|
// with the decoded hpack values.
|
||||||
func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
|
func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
|
||||||
if fr.AllowIllegalReads {
|
if fr.AllowIllegalReads {
|
||||||
|
|
|
||||||
11
vendor/golang.org/x/net/http2/go111.go
generated
vendored
11
vendor/golang.org/x/net/http2/go111.go
generated
vendored
|
|
@ -6,19 +6,22 @@
|
||||||
|
|
||||||
package http2
|
package http2
|
||||||
|
|
||||||
import "net/textproto"
|
import (
|
||||||
|
"net/http/httptrace"
|
||||||
|
"net/textproto"
|
||||||
|
)
|
||||||
|
|
||||||
func traceHasWroteHeaderField(trace *clientTrace) bool {
|
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
|
||||||
return trace != nil && trace.WroteHeaderField != nil
|
return trace != nil && trace.WroteHeaderField != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func traceWroteHeaderField(trace *clientTrace, k, v string) {
|
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
|
||||||
if trace != nil && trace.WroteHeaderField != nil {
|
if trace != nil && trace.WroteHeaderField != nil {
|
||||||
trace.WroteHeaderField(k, []string{v})
|
trace.WroteHeaderField(k, []string{v})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func traceGot1xxResponseFunc(trace *clientTrace) func(int, textproto.MIMEHeader) error {
|
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
|
||||||
if trace != nil {
|
if trace != nil {
|
||||||
return trace.Got1xxResponse
|
return trace.Got1xxResponse
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
vendor/golang.org/x/net/http2/go16.go
generated
vendored
16
vendor/golang.org/x/net/http2/go16.go
generated
vendored
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build go1.6
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func transportExpectContinueTimeout(t1 *http.Transport) time.Duration {
|
|
||||||
return t1.ExpectContinueTimeout
|
|
||||||
}
|
|
||||||
121
vendor/golang.org/x/net/http2/go17.go
generated
vendored
121
vendor/golang.org/x/net/http2/go17.go
generated
vendored
|
|
@ -1,121 +0,0 @@
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build go1.7
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net"
|
|
||||||
"net/http"
|
|
||||||
"net/http/httptrace"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contextContext interface {
|
|
||||||
context.Context
|
|
||||||
}
|
|
||||||
|
|
||||||
var errCanceled = context.Canceled
|
|
||||||
|
|
||||||
func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx contextContext, cancel func()) {
|
|
||||||
ctx, cancel = context.WithCancel(context.Background())
|
|
||||||
ctx = context.WithValue(ctx, http.LocalAddrContextKey, c.LocalAddr())
|
|
||||||
if hs := opts.baseConfig(); hs != nil {
|
|
||||||
ctx = context.WithValue(ctx, http.ServerContextKey, hs)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func contextWithCancel(ctx contextContext) (_ contextContext, cancel func()) {
|
|
||||||
return context.WithCancel(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func requestWithContext(req *http.Request, ctx contextContext) *http.Request {
|
|
||||||
return req.WithContext(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
type clientTrace httptrace.ClientTrace
|
|
||||||
|
|
||||||
func reqContext(r *http.Request) context.Context { return r.Context() }
|
|
||||||
|
|
||||||
func (t *Transport) idleConnTimeout() time.Duration {
|
|
||||||
if t.t1 != nil {
|
|
||||||
return t.t1.IdleConnTimeout
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func setResponseUncompressed(res *http.Response) { res.Uncompressed = true }
|
|
||||||
|
|
||||||
func traceGetConn(req *http.Request, hostPort string) {
|
|
||||||
trace := httptrace.ContextClientTrace(req.Context())
|
|
||||||
if trace == nil || trace.GetConn == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
trace.GetConn(hostPort)
|
|
||||||
}
|
|
||||||
|
|
||||||
func traceGotConn(req *http.Request, cc *ClientConn) {
|
|
||||||
trace := httptrace.ContextClientTrace(req.Context())
|
|
||||||
if trace == nil || trace.GotConn == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ci := httptrace.GotConnInfo{Conn: cc.tconn}
|
|
||||||
cc.mu.Lock()
|
|
||||||
ci.Reused = cc.nextStreamID > 1
|
|
||||||
ci.WasIdle = len(cc.streams) == 0 && ci.Reused
|
|
||||||
if ci.WasIdle && !cc.lastActive.IsZero() {
|
|
||||||
ci.IdleTime = time.Now().Sub(cc.lastActive)
|
|
||||||
}
|
|
||||||
cc.mu.Unlock()
|
|
||||||
|
|
||||||
trace.GotConn(ci)
|
|
||||||
}
|
|
||||||
|
|
||||||
func traceWroteHeaders(trace *clientTrace) {
|
|
||||||
if trace != nil && trace.WroteHeaders != nil {
|
|
||||||
trace.WroteHeaders()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func traceGot100Continue(trace *clientTrace) {
|
|
||||||
if trace != nil && trace.Got100Continue != nil {
|
|
||||||
trace.Got100Continue()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func traceWait100Continue(trace *clientTrace) {
|
|
||||||
if trace != nil && trace.Wait100Continue != nil {
|
|
||||||
trace.Wait100Continue()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func traceWroteRequest(trace *clientTrace, err error) {
|
|
||||||
if trace != nil && trace.WroteRequest != nil {
|
|
||||||
trace.WroteRequest(httptrace.WroteRequestInfo{Err: err})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func traceFirstResponseByte(trace *clientTrace) {
|
|
||||||
if trace != nil && trace.GotFirstResponseByte != nil {
|
|
||||||
trace.GotFirstResponseByte()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func requestTrace(req *http.Request) *clientTrace {
|
|
||||||
trace := httptrace.ContextClientTrace(req.Context())
|
|
||||||
return (*clientTrace)(trace)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ping sends a PING frame to the server and waits for the ack.
|
|
||||||
func (cc *ClientConn) Ping(ctx context.Context) error {
|
|
||||||
return cc.ping(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shutdown gracefully closes the client connection, waiting for running streams to complete.
|
|
||||||
func (cc *ClientConn) Shutdown(ctx context.Context) error {
|
|
||||||
return cc.shutdown(ctx)
|
|
||||||
}
|
|
||||||
36
vendor/golang.org/x/net/http2/go17_not18.go
generated
vendored
36
vendor/golang.org/x/net/http2/go17_not18.go
generated
vendored
|
|
@ -1,36 +0,0 @@
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build go1.7,!go1.8
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import "crypto/tls"
|
|
||||||
|
|
||||||
// temporary copy of Go 1.7's private tls.Config.clone:
|
|
||||||
func cloneTLSConfig(c *tls.Config) *tls.Config {
|
|
||||||
return &tls.Config{
|
|
||||||
Rand: c.Rand,
|
|
||||||
Time: c.Time,
|
|
||||||
Certificates: c.Certificates,
|
|
||||||
NameToCertificate: c.NameToCertificate,
|
|
||||||
GetCertificate: c.GetCertificate,
|
|
||||||
RootCAs: c.RootCAs,
|
|
||||||
NextProtos: c.NextProtos,
|
|
||||||
ServerName: c.ServerName,
|
|
||||||
ClientAuth: c.ClientAuth,
|
|
||||||
ClientCAs: c.ClientCAs,
|
|
||||||
InsecureSkipVerify: c.InsecureSkipVerify,
|
|
||||||
CipherSuites: c.CipherSuites,
|
|
||||||
PreferServerCipherSuites: c.PreferServerCipherSuites,
|
|
||||||
SessionTicketsDisabled: c.SessionTicketsDisabled,
|
|
||||||
SessionTicketKey: c.SessionTicketKey,
|
|
||||||
ClientSessionCache: c.ClientSessionCache,
|
|
||||||
MinVersion: c.MinVersion,
|
|
||||||
MaxVersion: c.MaxVersion,
|
|
||||||
CurvePreferences: c.CurvePreferences,
|
|
||||||
DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled,
|
|
||||||
Renegotiation: c.Renegotiation,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
56
vendor/golang.org/x/net/http2/go18.go
generated
vendored
56
vendor/golang.org/x/net/http2/go18.go
generated
vendored
|
|
@ -1,56 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build go1.8
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func cloneTLSConfig(c *tls.Config) *tls.Config {
|
|
||||||
c2 := c.Clone()
|
|
||||||
c2.GetClientCertificate = c.GetClientCertificate // golang.org/issue/19264
|
|
||||||
return c2
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ http.Pusher = (*responseWriter)(nil)
|
|
||||||
|
|
||||||
// Push implements http.Pusher.
|
|
||||||
func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
|
|
||||||
internalOpts := pushOptions{}
|
|
||||||
if opts != nil {
|
|
||||||
internalOpts.Method = opts.Method
|
|
||||||
internalOpts.Header = opts.Header
|
|
||||||
}
|
|
||||||
return w.push(target, internalOpts)
|
|
||||||
}
|
|
||||||
|
|
||||||
func configureServer18(h1 *http.Server, h2 *Server) error {
|
|
||||||
if h2.IdleTimeout == 0 {
|
|
||||||
if h1.IdleTimeout != 0 {
|
|
||||||
h2.IdleTimeout = h1.IdleTimeout
|
|
||||||
} else {
|
|
||||||
h2.IdleTimeout = h1.ReadTimeout
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func shouldLogPanic(panicValue interface{}) bool {
|
|
||||||
return panicValue != nil && panicValue != http.ErrAbortHandler
|
|
||||||
}
|
|
||||||
|
|
||||||
func reqGetBody(req *http.Request) func() (io.ReadCloser, error) {
|
|
||||||
return req.GetBody
|
|
||||||
}
|
|
||||||
|
|
||||||
func reqBodyIsNoBody(body io.ReadCloser) bool {
|
|
||||||
return body == http.NoBody
|
|
||||||
}
|
|
||||||
|
|
||||||
func go18httpNoBody() io.ReadCloser { return http.NoBody } // for tests only
|
|
||||||
16
vendor/golang.org/x/net/http2/go19.go
generated
vendored
16
vendor/golang.org/x/net/http2/go19.go
generated
vendored
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build go1.9
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func configureServer19(s *http.Server, conf *Server) error {
|
|
||||||
s.RegisterOnShutdown(conf.state.startGracefulShutdown)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
10
vendor/golang.org/x/net/http2/hpack/hpack.go
generated
vendored
10
vendor/golang.org/x/net/http2/hpack/hpack.go
generated
vendored
|
|
@ -92,6 +92,8 @@ type Decoder struct {
|
||||||
// saveBuf is previous data passed to Write which we weren't able
|
// saveBuf is previous data passed to Write which we weren't able
|
||||||
// to fully parse before. Unlike buf, we own this data.
|
// to fully parse before. Unlike buf, we own this data.
|
||||||
saveBuf bytes.Buffer
|
saveBuf bytes.Buffer
|
||||||
|
|
||||||
|
firstField bool // processing the first field of the header block
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDecoder returns a new decoder with the provided maximum dynamic
|
// NewDecoder returns a new decoder with the provided maximum dynamic
|
||||||
|
|
@ -101,6 +103,7 @@ func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decod
|
||||||
d := &Decoder{
|
d := &Decoder{
|
||||||
emit: emitFunc,
|
emit: emitFunc,
|
||||||
emitEnabled: true,
|
emitEnabled: true,
|
||||||
|
firstField: true,
|
||||||
}
|
}
|
||||||
d.dynTab.table.init()
|
d.dynTab.table.init()
|
||||||
d.dynTab.allowedMaxSize = maxDynamicTableSize
|
d.dynTab.allowedMaxSize = maxDynamicTableSize
|
||||||
|
|
@ -226,11 +229,15 @@ func (d *Decoder) DecodeFull(p []byte) ([]HeaderField, error) {
|
||||||
return hf, nil
|
return hf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close declares that the decoding is complete and resets the Decoder
|
||||||
|
// to be reused again for a new header block. If there is any remaining
|
||||||
|
// data in the decoder's buffer, Close returns an error.
|
||||||
func (d *Decoder) Close() error {
|
func (d *Decoder) Close() error {
|
||||||
if d.saveBuf.Len() > 0 {
|
if d.saveBuf.Len() > 0 {
|
||||||
d.saveBuf.Reset()
|
d.saveBuf.Reset()
|
||||||
return DecodingError{errors.New("truncated headers")}
|
return DecodingError{errors.New("truncated headers")}
|
||||||
}
|
}
|
||||||
|
d.firstField = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,6 +273,7 @@ func (d *Decoder) Write(p []byte) (n int, err error) {
|
||||||
d.saveBuf.Write(d.buf)
|
d.saveBuf.Write(d.buf)
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
d.firstField = false
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -391,7 +399,7 @@ func (d *Decoder) callEmit(hf HeaderField) error {
|
||||||
func (d *Decoder) parseDynamicTableSizeUpdate() error {
|
func (d *Decoder) parseDynamicTableSizeUpdate() error {
|
||||||
// RFC 7541, sec 4.2: This dynamic table size update MUST occur at the
|
// RFC 7541, sec 4.2: This dynamic table size update MUST occur at the
|
||||||
// beginning of the first header block following the change to the dynamic table size.
|
// beginning of the first header block following the change to the dynamic table size.
|
||||||
if d.dynTab.size > 0 {
|
if !d.firstField && d.dynTab.size > 0 {
|
||||||
return DecodingError{errors.New("dynamic table size update MUST occur at the beginning of a header block")}
|
return DecodingError{errors.New("dynamic table size update MUST occur at the beginning of a header block")}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
11
vendor/golang.org/x/net/http2/not_go111.go
generated
vendored
11
vendor/golang.org/x/net/http2/not_go111.go
generated
vendored
|
|
@ -6,12 +6,15 @@
|
||||||
|
|
||||||
package http2
|
package http2
|
||||||
|
|
||||||
import "net/textproto"
|
import (
|
||||||
|
"net/http/httptrace"
|
||||||
|
"net/textproto"
|
||||||
|
)
|
||||||
|
|
||||||
func traceHasWroteHeaderField(trace *clientTrace) bool { return false }
|
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { return false }
|
||||||
|
|
||||||
func traceWroteHeaderField(trace *clientTrace, k, v string) {}
|
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {}
|
||||||
|
|
||||||
func traceGot1xxResponseFunc(trace *clientTrace) func(int, textproto.MIMEHeader) error {
|
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
21
vendor/golang.org/x/net/http2/not_go16.go
generated
vendored
21
vendor/golang.org/x/net/http2/not_go16.go
generated
vendored
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !go1.6
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func configureTransport(t1 *http.Transport) (*Transport, error) {
|
|
||||||
return nil, errTransportVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
func transportExpectContinueTimeout(t1 *http.Transport) time.Duration {
|
|
||||||
return 0
|
|
||||||
|
|
||||||
}
|
|
||||||
95
vendor/golang.org/x/net/http2/not_go17.go
generated
vendored
95
vendor/golang.org/x/net/http2/not_go17.go
generated
vendored
|
|
@ -1,95 +0,0 @@
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !go1.7
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
"errors"
|
|
||||||
"net"
|
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contextContext interface {
|
|
||||||
Done() <-chan struct{}
|
|
||||||
Err() error
|
|
||||||
}
|
|
||||||
|
|
||||||
var errCanceled = errors.New("canceled")
|
|
||||||
|
|
||||||
type fakeContext struct{}
|
|
||||||
|
|
||||||
func (fakeContext) Done() <-chan struct{} { return nil }
|
|
||||||
func (fakeContext) Err() error { panic("should not be called") }
|
|
||||||
|
|
||||||
func reqContext(r *http.Request) fakeContext {
|
|
||||||
return fakeContext{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setResponseUncompressed(res *http.Response) {
|
|
||||||
// Nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
type clientTrace struct{}
|
|
||||||
|
|
||||||
func requestTrace(*http.Request) *clientTrace { return nil }
|
|
||||||
func traceGetConn(*http.Request, string) {}
|
|
||||||
func traceGotConn(*http.Request, *ClientConn) {}
|
|
||||||
func traceFirstResponseByte(*clientTrace) {}
|
|
||||||
func traceWroteHeaders(*clientTrace) {}
|
|
||||||
func traceWroteRequest(*clientTrace, error) {}
|
|
||||||
func traceGot100Continue(trace *clientTrace) {}
|
|
||||||
func traceWait100Continue(trace *clientTrace) {}
|
|
||||||
|
|
||||||
func nop() {}
|
|
||||||
|
|
||||||
func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx contextContext, cancel func()) {
|
|
||||||
return nil, nop
|
|
||||||
}
|
|
||||||
|
|
||||||
func contextWithCancel(ctx contextContext) (_ contextContext, cancel func()) {
|
|
||||||
return ctx, nop
|
|
||||||
}
|
|
||||||
|
|
||||||
func requestWithContext(req *http.Request, ctx contextContext) *http.Request {
|
|
||||||
return req
|
|
||||||
}
|
|
||||||
|
|
||||||
// temporary copy of Go 1.6's private tls.Config.clone:
|
|
||||||
func cloneTLSConfig(c *tls.Config) *tls.Config {
|
|
||||||
return &tls.Config{
|
|
||||||
Rand: c.Rand,
|
|
||||||
Time: c.Time,
|
|
||||||
Certificates: c.Certificates,
|
|
||||||
NameToCertificate: c.NameToCertificate,
|
|
||||||
GetCertificate: c.GetCertificate,
|
|
||||||
RootCAs: c.RootCAs,
|
|
||||||
NextProtos: c.NextProtos,
|
|
||||||
ServerName: c.ServerName,
|
|
||||||
ClientAuth: c.ClientAuth,
|
|
||||||
ClientCAs: c.ClientCAs,
|
|
||||||
InsecureSkipVerify: c.InsecureSkipVerify,
|
|
||||||
CipherSuites: c.CipherSuites,
|
|
||||||
PreferServerCipherSuites: c.PreferServerCipherSuites,
|
|
||||||
SessionTicketsDisabled: c.SessionTicketsDisabled,
|
|
||||||
SessionTicketKey: c.SessionTicketKey,
|
|
||||||
ClientSessionCache: c.ClientSessionCache,
|
|
||||||
MinVersion: c.MinVersion,
|
|
||||||
MaxVersion: c.MaxVersion,
|
|
||||||
CurvePreferences: c.CurvePreferences,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cc *ClientConn) Ping(ctx contextContext) error {
|
|
||||||
return cc.ping(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cc *ClientConn) Shutdown(ctx contextContext) error {
|
|
||||||
return cc.shutdown(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Transport) idleConnTimeout() time.Duration { return 0 }
|
|
||||||
29
vendor/golang.org/x/net/http2/not_go18.go
generated
vendored
29
vendor/golang.org/x/net/http2/not_go18.go
generated
vendored
|
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !go1.8
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func configureServer18(h1 *http.Server, h2 *Server) error {
|
|
||||||
// No IdleTimeout to sync prior to Go 1.8.
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func shouldLogPanic(panicValue interface{}) bool {
|
|
||||||
return panicValue != nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func reqGetBody(req *http.Request) func() (io.ReadCloser, error) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func reqBodyIsNoBody(io.ReadCloser) bool { return false }
|
|
||||||
|
|
||||||
func go18httpNoBody() io.ReadCloser { return nil } // for tests only
|
|
||||||
16
vendor/golang.org/x/net/http2/not_go19.go
generated
vendored
16
vendor/golang.org/x/net/http2/not_go19.go
generated
vendored
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2016 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !go1.9
|
|
||||||
|
|
||||||
package http2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func configureServer19(s *http.Server, conf *Server) error {
|
|
||||||
// not supported prior to go1.9
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
47
vendor/golang.org/x/net/http2/server.go
generated
vendored
47
vendor/golang.org/x/net/http2/server.go
generated
vendored
|
|
@ -28,6 +28,7 @@ package http2
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -209,12 +210,14 @@ func ConfigureServer(s *http.Server, conf *Server) error {
|
||||||
conf = new(Server)
|
conf = new(Server)
|
||||||
}
|
}
|
||||||
conf.state = &serverInternalState{activeConns: make(map[*serverConn]struct{})}
|
conf.state = &serverInternalState{activeConns: make(map[*serverConn]struct{})}
|
||||||
if err := configureServer18(s, conf); err != nil {
|
if h1, h2 := s, conf; h2.IdleTimeout == 0 {
|
||||||
return err
|
if h1.IdleTimeout != 0 {
|
||||||
}
|
h2.IdleTimeout = h1.IdleTimeout
|
||||||
if err := configureServer19(s, conf); err != nil {
|
} else {
|
||||||
return err
|
h2.IdleTimeout = h1.ReadTimeout
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
s.RegisterOnShutdown(conf.state.startGracefulShutdown)
|
||||||
|
|
||||||
if s.TLSConfig == nil {
|
if s.TLSConfig == nil {
|
||||||
s.TLSConfig = new(tls.Config)
|
s.TLSConfig = new(tls.Config)
|
||||||
|
|
@ -435,6 +438,15 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) {
|
||||||
sc.serve()
|
sc.serve()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx context.Context, cancel func()) {
|
||||||
|
ctx, cancel = context.WithCancel(context.Background())
|
||||||
|
ctx = context.WithValue(ctx, http.LocalAddrContextKey, c.LocalAddr())
|
||||||
|
if hs := opts.baseConfig(); hs != nil {
|
||||||
|
ctx = context.WithValue(ctx, http.ServerContextKey, hs)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (sc *serverConn) rejectConn(err ErrCode, debug string) {
|
func (sc *serverConn) rejectConn(err ErrCode, debug string) {
|
||||||
sc.vlogf("http2: server rejecting conn: %v, %s", err, debug)
|
sc.vlogf("http2: server rejecting conn: %v, %s", err, debug)
|
||||||
// ignoring errors. hanging up anyway.
|
// ignoring errors. hanging up anyway.
|
||||||
|
|
@ -450,7 +462,7 @@ type serverConn struct {
|
||||||
conn net.Conn
|
conn net.Conn
|
||||||
bw *bufferedWriter // writing to conn
|
bw *bufferedWriter // writing to conn
|
||||||
handler http.Handler
|
handler http.Handler
|
||||||
baseCtx contextContext
|
baseCtx context.Context
|
||||||
framer *Framer
|
framer *Framer
|
||||||
doneServing chan struct{} // closed when serverConn.serve ends
|
doneServing chan struct{} // closed when serverConn.serve ends
|
||||||
readFrameCh chan readFrameResult // written by serverConn.readFrames
|
readFrameCh chan readFrameResult // written by serverConn.readFrames
|
||||||
|
|
@ -530,7 +542,7 @@ type stream struct {
|
||||||
id uint32
|
id uint32
|
||||||
body *pipe // non-nil if expecting DATA frames
|
body *pipe // non-nil if expecting DATA frames
|
||||||
cw closeWaiter // closed wait stream transitions to closed state
|
cw closeWaiter // closed wait stream transitions to closed state
|
||||||
ctx contextContext
|
ctx context.Context
|
||||||
cancelCtx func()
|
cancelCtx func()
|
||||||
|
|
||||||
// owned by serverConn's serve loop:
|
// owned by serverConn's serve loop:
|
||||||
|
|
@ -1110,7 +1122,7 @@ func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) {
|
||||||
|
|
||||||
// errHandlerPanicked is the error given to any callers blocked in a read from
|
// errHandlerPanicked is the error given to any callers blocked in a read from
|
||||||
// Request.Body when the main goroutine panics. Since most handlers read in the
|
// Request.Body when the main goroutine panics. Since most handlers read in the
|
||||||
// the main ServeHTTP goroutine, this will show up rarely.
|
// main ServeHTTP goroutine, this will show up rarely.
|
||||||
var errHandlerPanicked = errors.New("http2: handler panicked")
|
var errHandlerPanicked = errors.New("http2: handler panicked")
|
||||||
|
|
||||||
// wroteFrame is called on the serve goroutine with the result of
|
// wroteFrame is called on the serve goroutine with the result of
|
||||||
|
|
@ -1882,7 +1894,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
|
||||||
panic("internal error: cannot create stream with id 0")
|
panic("internal error: cannot create stream with id 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancelCtx := contextWithCancel(sc.baseCtx)
|
ctx, cancelCtx := context.WithCancel(sc.baseCtx)
|
||||||
st := &stream{
|
st := &stream{
|
||||||
sc: sc,
|
sc: sc,
|
||||||
id: id,
|
id: id,
|
||||||
|
|
@ -2048,7 +2060,7 @@ func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*r
|
||||||
Body: body,
|
Body: body,
|
||||||
Trailer: trailer,
|
Trailer: trailer,
|
||||||
}
|
}
|
||||||
req = requestWithContext(req, st.ctx)
|
req = req.WithContext(st.ctx)
|
||||||
|
|
||||||
rws := responseWriterStatePool.Get().(*responseWriterState)
|
rws := responseWriterStatePool.Get().(*responseWriterState)
|
||||||
bwSave := rws.bw
|
bwSave := rws.bw
|
||||||
|
|
@ -2076,7 +2088,7 @@ func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler
|
||||||
stream: rw.rws.stream,
|
stream: rw.rws.stream,
|
||||||
})
|
})
|
||||||
// Same as net/http:
|
// Same as net/http:
|
||||||
if shouldLogPanic(e) {
|
if e != nil && e != http.ErrAbortHandler {
|
||||||
const size = 64 << 10
|
const size = 64 << 10
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
buf = buf[:runtime.Stack(buf, false)]
|
buf = buf[:runtime.Stack(buf, false)]
|
||||||
|
|
@ -2638,14 +2650,9 @@ var (
|
||||||
ErrPushLimitReached = errors.New("http2: push would exceed peer's SETTINGS_MAX_CONCURRENT_STREAMS")
|
ErrPushLimitReached = errors.New("http2: push would exceed peer's SETTINGS_MAX_CONCURRENT_STREAMS")
|
||||||
)
|
)
|
||||||
|
|
||||||
// pushOptions is the internal version of http.PushOptions, which we
|
var _ http.Pusher = (*responseWriter)(nil)
|
||||||
// cannot include here because it's only defined in Go 1.8 and later.
|
|
||||||
type pushOptions struct {
|
|
||||||
Method string
|
|
||||||
Header http.Header
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *responseWriter) push(target string, opts pushOptions) error {
|
func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
|
||||||
st := w.rws.stream
|
st := w.rws.stream
|
||||||
sc := st.sc
|
sc := st.sc
|
||||||
sc.serveG.checkNotOn()
|
sc.serveG.checkNotOn()
|
||||||
|
|
@ -2656,6 +2663,10 @@ func (w *responseWriter) push(target string, opts pushOptions) error {
|
||||||
return ErrRecursivePush
|
return ErrRecursivePush
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opts == nil {
|
||||||
|
opts = new(http.PushOptions)
|
||||||
|
}
|
||||||
|
|
||||||
// Default options.
|
// Default options.
|
||||||
if opts.Method == "" {
|
if opts.Method == "" {
|
||||||
opts.Method = "GET"
|
opts.Method = "GET"
|
||||||
|
|
|
||||||
202
vendor/golang.org/x/net/http2/transport.go
generated
vendored
202
vendor/golang.org/x/net/http2/transport.go
generated
vendored
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
@ -21,6 +22,7 @@ import (
|
||||||
mathrand "math/rand"
|
mathrand "math/rand"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/http/httptrace"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
@ -95,6 +97,16 @@ type Transport struct {
|
||||||
// to mean no limit.
|
// to mean no limit.
|
||||||
MaxHeaderListSize uint32
|
MaxHeaderListSize uint32
|
||||||
|
|
||||||
|
// StrictMaxConcurrentStreams controls whether the server's
|
||||||
|
// SETTINGS_MAX_CONCURRENT_STREAMS should be respected
|
||||||
|
// globally. If false, new TCP connections are created to the
|
||||||
|
// server as needed to keep each under the per-connection
|
||||||
|
// SETTINGS_MAX_CONCURRENT_STREAMS limit. If true, the
|
||||||
|
// server's SETTINGS_MAX_CONCURRENT_STREAMS is interpreted as
|
||||||
|
// a global limit and callers of RoundTrip block when needed,
|
||||||
|
// waiting for their turn.
|
||||||
|
StrictMaxConcurrentStreams bool
|
||||||
|
|
||||||
// t1, if non-nil, is the standard library Transport using
|
// t1, if non-nil, is the standard library Transport using
|
||||||
// this transport. Its settings are used (but not its
|
// this transport. Its settings are used (but not its
|
||||||
// RoundTrip method, etc).
|
// RoundTrip method, etc).
|
||||||
|
|
@ -118,16 +130,56 @@ func (t *Transport) disableCompression() bool {
|
||||||
return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression)
|
return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression)
|
||||||
}
|
}
|
||||||
|
|
||||||
var errTransportVersion = errors.New("http2: ConfigureTransport is only supported starting at Go 1.6")
|
|
||||||
|
|
||||||
// ConfigureTransport configures a net/http HTTP/1 Transport to use HTTP/2.
|
// ConfigureTransport configures a net/http HTTP/1 Transport to use HTTP/2.
|
||||||
// It requires Go 1.6 or later and returns an error if the net/http package is too old
|
// It returns an error if t1 has already been HTTP/2-enabled.
|
||||||
// or if t1 has already been HTTP/2-enabled.
|
|
||||||
func ConfigureTransport(t1 *http.Transport) error {
|
func ConfigureTransport(t1 *http.Transport) error {
|
||||||
_, err := configureTransport(t1) // in configure_transport.go (go1.6) or not_go16.go
|
_, err := configureTransport(t1)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func configureTransport(t1 *http.Transport) (*Transport, error) {
|
||||||
|
connPool := new(clientConnPool)
|
||||||
|
t2 := &Transport{
|
||||||
|
ConnPool: noDialClientConnPool{connPool},
|
||||||
|
t1: t1,
|
||||||
|
}
|
||||||
|
connPool.t = t2
|
||||||
|
if err := registerHTTPSProtocol(t1, noDialH2RoundTripper{t2}); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if t1.TLSClientConfig == nil {
|
||||||
|
t1.TLSClientConfig = new(tls.Config)
|
||||||
|
}
|
||||||
|
if !strSliceContains(t1.TLSClientConfig.NextProtos, "h2") {
|
||||||
|
t1.TLSClientConfig.NextProtos = append([]string{"h2"}, t1.TLSClientConfig.NextProtos...)
|
||||||
|
}
|
||||||
|
if !strSliceContains(t1.TLSClientConfig.NextProtos, "http/1.1") {
|
||||||
|
t1.TLSClientConfig.NextProtos = append(t1.TLSClientConfig.NextProtos, "http/1.1")
|
||||||
|
}
|
||||||
|
upgradeFn := func(authority string, c *tls.Conn) http.RoundTripper {
|
||||||
|
addr := authorityAddr("https", authority)
|
||||||
|
if used, err := connPool.addConnIfNeeded(addr, t2, c); err != nil {
|
||||||
|
go c.Close()
|
||||||
|
return erringRoundTripper{err}
|
||||||
|
} else if !used {
|
||||||
|
// Turns out we don't need this c.
|
||||||
|
// For example, two goroutines made requests to the same host
|
||||||
|
// at the same time, both kicking off TCP dials. (since protocol
|
||||||
|
// was unknown)
|
||||||
|
go c.Close()
|
||||||
|
}
|
||||||
|
return t2
|
||||||
|
}
|
||||||
|
if m := t1.TLSNextProto; len(m) == 0 {
|
||||||
|
t1.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{
|
||||||
|
"h2": upgradeFn,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m["h2"] = upgradeFn
|
||||||
|
}
|
||||||
|
return t2, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Transport) connPool() ClientConnPool {
|
func (t *Transport) connPool() ClientConnPool {
|
||||||
t.connPoolOnce.Do(t.initConnPool)
|
t.connPoolOnce.Do(t.initConnPool)
|
||||||
return t.connPoolOrDef
|
return t.connPoolOrDef
|
||||||
|
|
@ -192,7 +244,7 @@ type ClientConn struct {
|
||||||
type clientStream struct {
|
type clientStream struct {
|
||||||
cc *ClientConn
|
cc *ClientConn
|
||||||
req *http.Request
|
req *http.Request
|
||||||
trace *clientTrace // or nil
|
trace *httptrace.ClientTrace // or nil
|
||||||
ID uint32
|
ID uint32
|
||||||
resc chan resAndError
|
resc chan resAndError
|
||||||
bufPipe pipe // buffered pipe with the flow-controlled response payload
|
bufPipe pipe // buffered pipe with the flow-controlled response payload
|
||||||
|
|
@ -226,7 +278,7 @@ type clientStream struct {
|
||||||
// channel to be signaled. A non-nil error is returned only if the request was
|
// channel to be signaled. A non-nil error is returned only if the request was
|
||||||
// canceled.
|
// canceled.
|
||||||
func awaitRequestCancel(req *http.Request, done <-chan struct{}) error {
|
func awaitRequestCancel(req *http.Request, done <-chan struct{}) error {
|
||||||
ctx := reqContext(req)
|
ctx := req.Context()
|
||||||
if req.Cancel == nil && ctx.Done() == nil {
|
if req.Cancel == nil && ctx.Done() == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -401,8 +453,8 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res
|
||||||
select {
|
select {
|
||||||
case <-time.After(time.Second * time.Duration(backoff)):
|
case <-time.After(time.Second * time.Duration(backoff)):
|
||||||
continue
|
continue
|
||||||
case <-reqContext(req).Done():
|
case <-req.Context().Done():
|
||||||
return nil, reqContext(req).Err()
|
return nil, req.Context().Err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -439,16 +491,15 @@ func shouldRetryRequest(req *http.Request, err error, afterBodyWrite bool) (*htt
|
||||||
}
|
}
|
||||||
// If the Body is nil (or http.NoBody), it's safe to reuse
|
// If the Body is nil (or http.NoBody), it's safe to reuse
|
||||||
// this request and its Body.
|
// this request and its Body.
|
||||||
if req.Body == nil || reqBodyIsNoBody(req.Body) {
|
if req.Body == nil || req.Body == http.NoBody {
|
||||||
return req, nil
|
return req, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the request body can be reset back to its original
|
// If the request body can be reset back to its original
|
||||||
// state via the optional req.GetBody, do that.
|
// state via the optional req.GetBody, do that.
|
||||||
getBody := reqGetBody(req) // Go 1.8: getBody = req.GetBody
|
if req.GetBody != nil {
|
||||||
if getBody != nil {
|
|
||||||
// TODO: consider a req.Body.Close here? or audit that all caller paths do?
|
// TODO: consider a req.Body.Close here? or audit that all caller paths do?
|
||||||
body, err := getBody()
|
body, err := req.GetBody()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -494,7 +545,7 @@ func (t *Transport) dialClientConn(addr string, singleUse bool) (*ClientConn, er
|
||||||
func (t *Transport) newTLSConfig(host string) *tls.Config {
|
func (t *Transport) newTLSConfig(host string) *tls.Config {
|
||||||
cfg := new(tls.Config)
|
cfg := new(tls.Config)
|
||||||
if t.TLSClientConfig != nil {
|
if t.TLSClientConfig != nil {
|
||||||
*cfg = *cloneTLSConfig(t.TLSClientConfig)
|
*cfg = *t.TLSClientConfig.Clone()
|
||||||
}
|
}
|
||||||
if !strSliceContains(cfg.NextProtos, NextProtoTLS) {
|
if !strSliceContains(cfg.NextProtos, NextProtoTLS) {
|
||||||
cfg.NextProtos = append([]string{NextProtoTLS}, cfg.NextProtos...)
|
cfg.NextProtos = append([]string{NextProtoTLS}, cfg.NextProtos...)
|
||||||
|
|
@ -545,7 +596,7 @@ func (t *Transport) expectContinueTimeout() time.Duration {
|
||||||
if t.t1 == nil {
|
if t.t1 == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return transportExpectContinueTimeout(t.t1)
|
return t.t1.ExpectContinueTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
|
func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
|
||||||
|
|
@ -670,8 +721,19 @@ func (cc *ClientConn) idleStateLocked() (st clientConnIdleState) {
|
||||||
if cc.singleUse && cc.nextStreamID > 1 {
|
if cc.singleUse && cc.nextStreamID > 1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
st.canTakeNewRequest = cc.goAway == nil && !cc.closed && !cc.closing &&
|
var maxConcurrentOkay bool
|
||||||
int64(cc.nextStreamID)+int64(cc.pendingRequests) < math.MaxInt32
|
if cc.t.StrictMaxConcurrentStreams {
|
||||||
|
// We'll tell the caller we can take a new request to
|
||||||
|
// prevent the caller from dialing a new TCP
|
||||||
|
// connection, but then we'll block later before
|
||||||
|
// writing it.
|
||||||
|
maxConcurrentOkay = true
|
||||||
|
} else {
|
||||||
|
maxConcurrentOkay = int64(len(cc.streams)+1) < int64(cc.maxConcurrentStreams)
|
||||||
|
}
|
||||||
|
|
||||||
|
st.canTakeNewRequest = cc.goAway == nil && !cc.closed && !cc.closing && maxConcurrentOkay &&
|
||||||
|
int64(cc.nextStreamID)+2*int64(cc.pendingRequests) < math.MaxInt32
|
||||||
st.freshConn = cc.nextStreamID == 1 && st.canTakeNewRequest
|
st.freshConn = cc.nextStreamID == 1 && st.canTakeNewRequest
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -711,8 +773,7 @@ func (cc *ClientConn) closeIfIdle() {
|
||||||
var shutdownEnterWaitStateHook = func() {}
|
var shutdownEnterWaitStateHook = func() {}
|
||||||
|
|
||||||
// Shutdown gracefully close the client connection, waiting for running streams to complete.
|
// Shutdown gracefully close the client connection, waiting for running streams to complete.
|
||||||
// Public implementation is in go17.go and not_go17.go
|
func (cc *ClientConn) Shutdown(ctx context.Context) error {
|
||||||
func (cc *ClientConn) shutdown(ctx contextContext) error {
|
|
||||||
if err := cc.sendGoAway(); err != nil {
|
if err := cc.sendGoAway(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -882,7 +943,7 @@ func checkConnHeaders(req *http.Request) error {
|
||||||
// req.ContentLength, where 0 actually means zero (not unknown) and -1
|
// req.ContentLength, where 0 actually means zero (not unknown) and -1
|
||||||
// means unknown.
|
// means unknown.
|
||||||
func actualContentLength(req *http.Request) int64 {
|
func actualContentLength(req *http.Request) int64 {
|
||||||
if req.Body == nil || reqBodyIsNoBody(req.Body) {
|
if req.Body == nil || req.Body == http.NoBody {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if req.ContentLength != 0 {
|
if req.ContentLength != 0 {
|
||||||
|
|
@ -952,7 +1013,7 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf
|
||||||
|
|
||||||
cs := cc.newStream()
|
cs := cc.newStream()
|
||||||
cs.req = req
|
cs.req = req
|
||||||
cs.trace = requestTrace(req)
|
cs.trace = httptrace.ContextClientTrace(req.Context())
|
||||||
cs.requestedGzip = requestedGzip
|
cs.requestedGzip = requestedGzip
|
||||||
bodyWriter := cc.t.getBodyWriterState(cs, body)
|
bodyWriter := cc.t.getBodyWriterState(cs, body)
|
||||||
cs.on100 = bodyWriter.on100
|
cs.on100 = bodyWriter.on100
|
||||||
|
|
@ -990,7 +1051,7 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf
|
||||||
|
|
||||||
readLoopResCh := cs.resc
|
readLoopResCh := cs.resc
|
||||||
bodyWritten := false
|
bodyWritten := false
|
||||||
ctx := reqContext(req)
|
ctx := req.Context()
|
||||||
|
|
||||||
handleReadLoopResponse := func(re resAndError) (*http.Response, bool, error) {
|
handleReadLoopResponse := func(re resAndError) (*http.Response, bool, error) {
|
||||||
res := re.res
|
res := re.res
|
||||||
|
|
@ -1060,6 +1121,7 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
cc.forgetStreamID(cs.ID)
|
||||||
return nil, cs.getStartedWrite(), err
|
return nil, cs.getStartedWrite(), err
|
||||||
}
|
}
|
||||||
bodyWritten = true
|
bodyWritten = true
|
||||||
|
|
@ -1181,6 +1243,7 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (
|
||||||
sawEOF = true
|
sawEOF = true
|
||||||
err = nil
|
err = nil
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
|
cc.writeStreamReset(cs.ID, ErrCodeCancel, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1416,7 +1479,7 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail
|
||||||
return nil, errRequestHeaderListSize
|
return nil, errRequestHeaderListSize
|
||||||
}
|
}
|
||||||
|
|
||||||
trace := requestTrace(req)
|
trace := httptrace.ContextClientTrace(req.Context())
|
||||||
traceHeaders := traceHasWroteHeaderField(trace)
|
traceHeaders := traceHasWroteHeaderField(trace)
|
||||||
|
|
||||||
// Header list size is ok. Write the headers.
|
// Header list size is ok. Write the headers.
|
||||||
|
|
@ -1839,7 +1902,7 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra
|
||||||
res.Header.Del("Content-Length")
|
res.Header.Del("Content-Length")
|
||||||
res.ContentLength = -1
|
res.ContentLength = -1
|
||||||
res.Body = &gzipReader{body: res.Body}
|
res.Body = &gzipReader{body: res.Body}
|
||||||
setResponseUncompressed(res)
|
res.Uncompressed = true
|
||||||
}
|
}
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
@ -2216,8 +2279,7 @@ func (rl *clientConnReadLoop) processResetStream(f *RSTStreamFrame) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ping sends a PING frame to the server and waits for the ack.
|
// Ping sends a PING frame to the server and waits for the ack.
|
||||||
// Public implementation is in go17.go and not_go17.go
|
func (cc *ClientConn) Ping(ctx context.Context) error {
|
||||||
func (cc *ClientConn) ping(ctx contextContext) error {
|
|
||||||
c := make(chan struct{})
|
c := make(chan struct{})
|
||||||
// Generate a random payload
|
// Generate a random payload
|
||||||
var p [8]byte
|
var p [8]byte
|
||||||
|
|
@ -2451,3 +2513,91 @@ func (s bodyWriterState) scheduleBodyWrite() {
|
||||||
func isConnectionCloseRequest(req *http.Request) bool {
|
func isConnectionCloseRequest(req *http.Request) bool {
|
||||||
return req.Close || httpguts.HeaderValuesContainsToken(req.Header["Connection"], "close")
|
return req.Close || httpguts.HeaderValuesContainsToken(req.Header["Connection"], "close")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// registerHTTPSProtocol calls Transport.RegisterProtocol but
|
||||||
|
// converting panics into errors.
|
||||||
|
func registerHTTPSProtocol(t *http.Transport, rt noDialH2RoundTripper) (err error) {
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
err = fmt.Errorf("%v", e)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
t.RegisterProtocol("https", rt)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// noDialH2RoundTripper is a RoundTripper which only tries to complete the request
|
||||||
|
// if there's already has a cached connection to the host.
|
||||||
|
// (The field is exported so it can be accessed via reflect from net/http; tested
|
||||||
|
// by TestNoDialH2RoundTripperType)
|
||||||
|
type noDialH2RoundTripper struct{ *Transport }
|
||||||
|
|
||||||
|
func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
|
res, err := rt.Transport.RoundTrip(req)
|
||||||
|
if isNoCachedConnError(err) {
|
||||||
|
return nil, http.ErrSkipAltProtocol
|
||||||
|
}
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *Transport) idleConnTimeout() time.Duration {
|
||||||
|
if t.t1 != nil {
|
||||||
|
return t.t1.IdleConnTimeout
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceGetConn(req *http.Request, hostPort string) {
|
||||||
|
trace := httptrace.ContextClientTrace(req.Context())
|
||||||
|
if trace == nil || trace.GetConn == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
trace.GetConn(hostPort)
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceGotConn(req *http.Request, cc *ClientConn) {
|
||||||
|
trace := httptrace.ContextClientTrace(req.Context())
|
||||||
|
if trace == nil || trace.GotConn == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ci := httptrace.GotConnInfo{Conn: cc.tconn}
|
||||||
|
cc.mu.Lock()
|
||||||
|
ci.Reused = cc.nextStreamID > 1
|
||||||
|
ci.WasIdle = len(cc.streams) == 0 && ci.Reused
|
||||||
|
if ci.WasIdle && !cc.lastActive.IsZero() {
|
||||||
|
ci.IdleTime = time.Now().Sub(cc.lastActive)
|
||||||
|
}
|
||||||
|
cc.mu.Unlock()
|
||||||
|
|
||||||
|
trace.GotConn(ci)
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceWroteHeaders(trace *httptrace.ClientTrace) {
|
||||||
|
if trace != nil && trace.WroteHeaders != nil {
|
||||||
|
trace.WroteHeaders()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceGot100Continue(trace *httptrace.ClientTrace) {
|
||||||
|
if trace != nil && trace.Got100Continue != nil {
|
||||||
|
trace.Got100Continue()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceWait100Continue(trace *httptrace.ClientTrace) {
|
||||||
|
if trace != nil && trace.Wait100Continue != nil {
|
||||||
|
trace.Wait100Continue()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceWroteRequest(trace *httptrace.ClientTrace, err error) {
|
||||||
|
if trace != nil && trace.WroteRequest != nil {
|
||||||
|
trace.WroteRequest(httptrace.WroteRequestInfo{Err: err})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traceFirstResponseByte(trace *httptrace.ClientTrace) {
|
||||||
|
if trace != nil && trace.GotFirstResponseByte != nil {
|
||||||
|
trace.GotFirstResponseByte()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
4
vendor/golang.org/x/net/http2/write.go
generated
vendored
4
vendor/golang.org/x/net/http2/write.go
generated
vendored
|
|
@ -199,7 +199,7 @@ func (w *writeResHeaders) staysWithinBuffer(max int) bool {
|
||||||
// TODO: this is a common one. It'd be nice to return true
|
// TODO: this is a common one. It'd be nice to return true
|
||||||
// here and get into the fast path if we could be clever and
|
// here and get into the fast path if we could be clever and
|
||||||
// calculate the size fast enough, or at least a conservative
|
// calculate the size fast enough, or at least a conservative
|
||||||
// uppper bound that usually fires. (Maybe if w.h and
|
// upper bound that usually fires. (Maybe if w.h and
|
||||||
// w.trailers are nil, so we don't need to enumerate it.)
|
// w.trailers are nil, so we don't need to enumerate it.)
|
||||||
// Otherwise I'm afraid that just calculating the length to
|
// Otherwise I'm afraid that just calculating the length to
|
||||||
// answer this question would be slower than the ~2µs benefit.
|
// answer this question would be slower than the ~2µs benefit.
|
||||||
|
|
@ -329,7 +329,7 @@ func (wu writeWindowUpdate) writeFrame(ctx writeContext) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// encodeHeaders encodes an http.Header. If keys is not nil, then (k, h[k])
|
// encodeHeaders encodes an http.Header. If keys is not nil, then (k, h[k])
|
||||||
// is encoded only only if k is in keys.
|
// is encoded only if k is in keys.
|
||||||
func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) {
|
func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) {
|
||||||
if keys == nil {
|
if keys == nil {
|
||||||
sorter := sorterPool.Get().(*sorter)
|
sorter := sorterPool.Get().(*sorter)
|
||||||
|
|
|
||||||
13
vendor/golang.org/x/net/trace/trace.go
generated
vendored
13
vendor/golang.org/x/net/trace/trace.go
generated
vendored
|
|
@ -64,6 +64,7 @@ package trace // import "golang.org/x/net/trace"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -124,6 +125,18 @@ func init() {
|
||||||
http.HandleFunc("/debug/events", Events)
|
http.HandleFunc("/debug/events", Events)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewContext returns a copy of the parent context
|
||||||
|
// and associates it with a Trace.
|
||||||
|
func NewContext(ctx context.Context, tr Trace) context.Context {
|
||||||
|
return context.WithValue(ctx, contextKey, tr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromContext returns the Trace bound to the context, if any.
|
||||||
|
func FromContext(ctx context.Context) (tr Trace, ok bool) {
|
||||||
|
tr, ok = ctx.Value(contextKey).(Trace)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Traces responds with traces from the program.
|
// Traces responds with traces from the program.
|
||||||
// The package initialization registers it in http.DefaultServeMux
|
// The package initialization registers it in http.DefaultServeMux
|
||||||
// at /debug/requests.
|
// at /debug/requests.
|
||||||
|
|
|
||||||
21
vendor/golang.org/x/net/trace/trace_go16.go
generated
vendored
21
vendor/golang.org/x/net/trace/trace_go16.go
generated
vendored
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !go1.7
|
|
||||||
|
|
||||||
package trace
|
|
||||||
|
|
||||||
import "golang.org/x/net/context"
|
|
||||||
|
|
||||||
// NewContext returns a copy of the parent context
|
|
||||||
// and associates it with a Trace.
|
|
||||||
func NewContext(ctx context.Context, tr Trace) context.Context {
|
|
||||||
return context.WithValue(ctx, contextKey, tr)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FromContext returns the Trace bound to the context, if any.
|
|
||||||
func FromContext(ctx context.Context) (tr Trace, ok bool) {
|
|
||||||
tr, ok = ctx.Value(contextKey).(Trace)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
21
vendor/golang.org/x/net/trace/trace_go17.go
generated
vendored
21
vendor/golang.org/x/net/trace/trace_go17.go
generated
vendored
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build go1.7
|
|
||||||
|
|
||||||
package trace
|
|
||||||
|
|
||||||
import "context"
|
|
||||||
|
|
||||||
// NewContext returns a copy of the parent context
|
|
||||||
// and associates it with a Trace.
|
|
||||||
func NewContext(ctx context.Context, tr Trace) context.Context {
|
|
||||||
return context.WithValue(ctx, contextKey, tr)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FromContext returns the Trace bound to the context, if any.
|
|
||||||
func FromContext(ctx context.Context) (tr Trace, ok bool) {
|
|
||||||
tr, ok = ctx.Value(contextKey).(Trace)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
20
vendor/golang.org/x/sys/unix/README.md
generated
vendored
20
vendor/golang.org/x/sys/unix/README.md
generated
vendored
|
|
@ -14,7 +14,7 @@ migrating the build system to use containers so the builds are reproducible.
|
||||||
This is being done on an OS-by-OS basis. Please update this documentation as
|
This is being done on an OS-by-OS basis. Please update this documentation as
|
||||||
components of the build system change.
|
components of the build system change.
|
||||||
|
|
||||||
### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`)
|
### Old Build System (currently for `GOOS != "linux"`)
|
||||||
|
|
||||||
The old build system generates the Go files based on the C header files
|
The old build system generates the Go files based on the C header files
|
||||||
present on your system. This means that files
|
present on your system. This means that files
|
||||||
|
|
@ -32,9 +32,9 @@ To build the files for your current OS and architecture, make sure GOOS and
|
||||||
GOARCH are set correctly and run `mkall.sh`. This will generate the files for
|
GOARCH are set correctly and run `mkall.sh`. This will generate the files for
|
||||||
your specific system. Running `mkall.sh -n` shows the commands that will be run.
|
your specific system. Running `mkall.sh -n` shows the commands that will be run.
|
||||||
|
|
||||||
Requirements: bash, perl, go
|
Requirements: bash, go
|
||||||
|
|
||||||
### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`)
|
### New Build System (currently for `GOOS == "linux"`)
|
||||||
|
|
||||||
The new build system uses a Docker container to generate the go files directly
|
The new build system uses a Docker container to generate the go files directly
|
||||||
from source checkouts of the kernel and various system libraries. This means
|
from source checkouts of the kernel and various system libraries. This means
|
||||||
|
|
@ -52,14 +52,14 @@ system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
|
||||||
then generate all of the files for all of the GOOS/GOARCH pairs in the new build
|
then generate all of the files for all of the GOOS/GOARCH pairs in the new build
|
||||||
system. Running `mkall.sh -n` shows the commands that will be run.
|
system. Running `mkall.sh -n` shows the commands that will be run.
|
||||||
|
|
||||||
Requirements: bash, perl, go, docker
|
Requirements: bash, go, docker
|
||||||
|
|
||||||
## Component files
|
## Component files
|
||||||
|
|
||||||
This section describes the various files used in the code generation process.
|
This section describes the various files used in the code generation process.
|
||||||
It also contains instructions on how to modify these files to add a new
|
It also contains instructions on how to modify these files to add a new
|
||||||
architecture/OS or to add additional syscalls, types, or constants. Note that
|
architecture/OS or to add additional syscalls, types, or constants. Note that
|
||||||
if you are using the new build system, the scripts cannot be called normally.
|
if you are using the new build system, the scripts/programs cannot be called normally.
|
||||||
They must be called from within the docker container.
|
They must be called from within the docker container.
|
||||||
|
|
||||||
### asm files
|
### asm files
|
||||||
|
|
@ -81,8 +81,8 @@ each GOOS/GOARCH pair.
|
||||||
|
|
||||||
### mksysnum
|
### mksysnum
|
||||||
|
|
||||||
Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl`
|
Mksysnum is a Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go`
|
||||||
for the old system). This script takes in a list of header files containing the
|
for the old system). This program takes in a list of header files containing the
|
||||||
syscall number declarations and parses them to produce the corresponding list of
|
syscall number declarations and parses them to produce the corresponding list of
|
||||||
Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
|
Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
|
||||||
constants.
|
constants.
|
||||||
|
|
@ -92,14 +92,14 @@ new installation of the target OS (or updating the source checkouts for the
|
||||||
new build system). However, depending on the OS, you make need to update the
|
new build system). However, depending on the OS, you make need to update the
|
||||||
parsing in mksysnum.
|
parsing in mksysnum.
|
||||||
|
|
||||||
### mksyscall.pl
|
### mksyscall.go
|
||||||
|
|
||||||
The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
|
The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
|
||||||
hand-written Go files which implement system calls (for unix, the specific OS,
|
hand-written Go files which implement system calls (for unix, the specific OS,
|
||||||
or the specific OS/Architecture pair respectively) that need special handling
|
or the specific OS/Architecture pair respectively) that need special handling
|
||||||
and list `//sys` comments giving prototypes for ones that can be generated.
|
and list `//sys` comments giving prototypes for ones that can be generated.
|
||||||
|
|
||||||
The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts
|
The mksyscall.go program takes the `//sys` and `//sysnb` comments and converts
|
||||||
them into syscalls. This requires the name of the prototype in the comment to
|
them into syscalls. This requires the name of the prototype in the comment to
|
||||||
match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
|
match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
|
||||||
prototype can be exported (capitalized) or not.
|
prototype can be exported (capitalized) or not.
|
||||||
|
|
@ -160,7 +160,7 @@ signal numbers, and constants. Generated by `mkerrors.sh` (see above).
|
||||||
### `zsyscall_${GOOS}_${GOARCH}.go`
|
### `zsyscall_${GOOS}_${GOARCH}.go`
|
||||||
|
|
||||||
A file containing all the generated syscalls for a specific GOOS and GOARCH.
|
A file containing all the generated syscalls for a specific GOOS and GOARCH.
|
||||||
Generated by `mksyscall.pl` (see above).
|
Generated by `mksyscall.go` (see above).
|
||||||
|
|
||||||
### `zsysnum_${GOOS}_${GOARCH}.go`
|
### `zsysnum_${GOOS}_${GOARCH}.go`
|
||||||
|
|
||||||
|
|
|
||||||
17
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
generated
vendored
Normal file
17
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !gccgo
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go
|
||||||
|
//
|
||||||
|
|
||||||
|
TEXT ·syscall6(SB),NOSPLIT,$0-88
|
||||||
|
JMP syscall·syscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·rawSyscall6(SB),NOSPLIT,$0-88
|
||||||
|
JMP syscall·rawSyscall6(SB)
|
||||||
29
vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
generated
vendored
Normal file
29
vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !gccgo
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// System call support for ARM64, FreeBSD
|
||||||
|
//
|
||||||
|
|
||||||
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
|
// The runtime may know about them.
|
||||||
|
|
||||||
|
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||||
|
JMP syscall·Syscall(SB)
|
||||||
|
|
||||||
|
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||||
|
JMP syscall·Syscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
||||||
|
JMP syscall·Syscall9(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||||
|
JMP syscall·RawSyscall(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||||
|
JMP syscall·RawSyscall6(SB)
|
||||||
12
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
generated
vendored
12
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
generated
vendored
|
|
@ -15,12 +15,6 @@
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
// The runtime may know about them.
|
// The runtime may know about them.
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
BR syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
BR syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
||||||
BL runtime·entersyscall(SB)
|
BL runtime·entersyscall(SB)
|
||||||
MOVD a1+8(FP), R3
|
MOVD a1+8(FP), R3
|
||||||
|
|
@ -36,12 +30,6 @@ TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
||||||
BL runtime·exitsyscall(SB)
|
BL runtime·exitsyscall(SB)
|
||||||
RET
|
RET
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
BR syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
BR syscall·RawSyscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
|
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
|
||||||
MOVD a1+8(FP), R3
|
MOVD a1+8(FP), R3
|
||||||
MOVD a2+16(FP), R4
|
MOVD a2+16(FP), R4
|
||||||
|
|
|
||||||
29
vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
generated
vendored
Normal file
29
vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !gccgo
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// System call support for ARM64, NetBSD
|
||||||
|
//
|
||||||
|
|
||||||
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
|
// The runtime may know about them.
|
||||||
|
|
||||||
|
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||||
|
B syscall·Syscall(SB)
|
||||||
|
|
||||||
|
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||||
|
B syscall·Syscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
||||||
|
B syscall·Syscall9(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||||
|
B syscall·RawSyscall(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||||
|
B syscall·RawSyscall6(SB)
|
||||||
2
vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
2
vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
// +build dragonfly freebsd linux netbsd openbsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
||||||
18
vendor/golang.org/x/sys/unix/fcntl_darwin.go
generated
vendored
Normal file
18
vendor/golang.org/x/sys/unix/fcntl_darwin.go
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
|
||||||
|
func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
|
||||||
|
return fcntl(int(fd), cmd, arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||||
|
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
|
||||||
|
_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
|
||||||
|
return err
|
||||||
|
}
|
||||||
92
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
Executable file → Normal file
92
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
Executable file → Normal file
|
|
@ -10,13 +10,14 @@
|
||||||
GOOSARCH="${GOOS}_${GOARCH}"
|
GOOSARCH="${GOOS}_${GOARCH}"
|
||||||
|
|
||||||
# defaults
|
# defaults
|
||||||
mksyscall="./mksyscall.pl"
|
mksyscall="go run mksyscall.go"
|
||||||
mkerrors="./mkerrors.sh"
|
mkerrors="./mkerrors.sh"
|
||||||
zerrors="zerrors_$GOOSARCH.go"
|
zerrors="zerrors_$GOOSARCH.go"
|
||||||
mksysctl=""
|
mksysctl=""
|
||||||
zsysctl="zsysctl_$GOOSARCH.go"
|
zsysctl="zsysctl_$GOOSARCH.go"
|
||||||
mksysnum=
|
mksysnum=
|
||||||
mktypes=
|
mktypes=
|
||||||
|
mkasm=
|
||||||
run="sh"
|
run="sh"
|
||||||
cmd=""
|
cmd=""
|
||||||
|
|
||||||
|
|
@ -45,8 +46,8 @@ case "$#" in
|
||||||
exit 2
|
exit 2
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
|
if [[ "$GOOS" = "linux" ]]; then
|
||||||
# Use then new build system
|
# Use the Docker-based build system
|
||||||
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
||||||
$cmd docker build --tag generate:$GOOS $GOOS
|
$cmd docker build --tag generate:$GOOS $GOOS
|
||||||
$cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
|
$cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
|
||||||
|
|
@ -61,112 +62,115 @@ _* | *_ | _)
|
||||||
;;
|
;;
|
||||||
aix_ppc)
|
aix_ppc)
|
||||||
mkerrors="$mkerrors -maix32"
|
mkerrors="$mkerrors -maix32"
|
||||||
mksyscall="perl mksyscall_aix.pl -aix"
|
mksyscall="go run mksyscall_aix_ppc.go -aix"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
aix_ppc64)
|
aix_ppc64)
|
||||||
mkerrors="$mkerrors -maix64"
|
mkerrors="$mkerrors -maix64"
|
||||||
mksyscall="perl mksyscall_aix.pl -aix"
|
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
darwin_386)
|
darwin_386)
|
||||||
mkerrors="$mkerrors -m32"
|
mkerrors="$mkerrors -m32"
|
||||||
mksyscall="./mksyscall.pl -l32"
|
mksyscall="go run mksyscall.go -l32"
|
||||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
mkasm="go run mkasm_darwin.go"
|
||||||
;;
|
;;
|
||||||
darwin_amd64)
|
darwin_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
mkasm="go run mkasm_darwin.go"
|
||||||
;;
|
;;
|
||||||
darwin_arm)
|
darwin_arm)
|
||||||
mkerrors="$mkerrors"
|
mkerrors="$mkerrors"
|
||||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
mksyscall="go run mksyscall.go -l32"
|
||||||
|
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
mkasm="go run mkasm_darwin.go"
|
||||||
;;
|
;;
|
||||||
darwin_arm64)
|
darwin_arm64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
mkasm="go run mkasm_darwin.go"
|
||||||
;;
|
;;
|
||||||
dragonfly_amd64)
|
dragonfly_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksyscall="./mksyscall.pl -dragonfly"
|
mksyscall="go run mksyscall.go -dragonfly"
|
||||||
mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
|
mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
freebsd_386)
|
freebsd_386)
|
||||||
mkerrors="$mkerrors -m32"
|
mkerrors="$mkerrors -m32"
|
||||||
mksyscall="./mksyscall.pl -l32"
|
mksyscall="go run mksyscall.go -l32"
|
||||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
freebsd_amd64)
|
freebsd_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
freebsd_arm)
|
freebsd_arm)
|
||||||
mkerrors="$mkerrors"
|
mkerrors="$mkerrors"
|
||||||
mksyscall="./mksyscall.pl -l32 -arm"
|
mksyscall="go run mksyscall.go -l32 -arm"
|
||||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||||
# Let the type of C char be signed for making the bare syscall
|
# Let the type of C char be signed for making the bare syscall
|
||||||
# API consistent across platforms.
|
# API consistent across platforms.
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
;;
|
;;
|
||||||
linux_sparc64)
|
freebsd_arm64)
|
||||||
GOOSARCH_in=syscall_linux_sparc64.go
|
|
||||||
unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h
|
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
netbsd_386)
|
netbsd_386)
|
||||||
mkerrors="$mkerrors -m32"
|
mkerrors="$mkerrors -m32"
|
||||||
mksyscall="./mksyscall.pl -l32 -netbsd"
|
mksyscall="go run mksyscall.go -l32 -netbsd"
|
||||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
netbsd_amd64)
|
netbsd_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksyscall="./mksyscall.pl -netbsd"
|
mksyscall="go run mksyscall.go -netbsd"
|
||||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
netbsd_arm)
|
netbsd_arm)
|
||||||
mkerrors="$mkerrors"
|
mkerrors="$mkerrors"
|
||||||
mksyscall="./mksyscall.pl -l32 -netbsd -arm"
|
mksyscall="go run mksyscall.go -l32 -netbsd -arm"
|
||||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||||
# Let the type of C char be signed for making the bare syscall
|
# Let the type of C char be signed for making the bare syscall
|
||||||
# API consistent across platforms.
|
# API consistent across platforms.
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
;;
|
;;
|
||||||
openbsd_386)
|
openbsd_386)
|
||||||
mkerrors="$mkerrors -m32"
|
mkerrors="$mkerrors -m32"
|
||||||
mksyscall="./mksyscall.pl -l32 -openbsd"
|
mksyscall="go run mksyscall.go -l32 -openbsd"
|
||||||
mksysctl="./mksysctl_openbsd.pl"
|
mksysctl="./mksysctl_openbsd.pl"
|
||||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
openbsd_amd64)
|
openbsd_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksyscall="./mksyscall.pl -openbsd"
|
mksyscall="go run mksyscall.go -openbsd"
|
||||||
mksysctl="./mksysctl_openbsd.pl"
|
mksysctl="./mksysctl_openbsd.pl"
|
||||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
openbsd_arm)
|
openbsd_arm)
|
||||||
mkerrors="$mkerrors"
|
mkerrors="$mkerrors"
|
||||||
mksyscall="./mksyscall.pl -l32 -openbsd -arm"
|
mksyscall="go run mksyscall.go -l32 -openbsd -arm"
|
||||||
mksysctl="./mksysctl_openbsd.pl"
|
mksysctl="./mksysctl_openbsd.pl"
|
||||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||||
# Let the type of C char be signed for making the bare syscall
|
# Let the type of C char be signed for making the bare syscall
|
||||||
# API consistent across platforms.
|
# API consistent across platforms.
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
;;
|
;;
|
||||||
solaris_amd64)
|
solaris_amd64)
|
||||||
mksyscall="./mksyscall_solaris.pl"
|
mksyscall="go run mksyscall_solaris.go"
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksysnum=
|
mksysnum=
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
|
@ -187,12 +191,22 @@ esac
|
||||||
syscall_goos="syscall_bsd.go $syscall_goos"
|
syscall_goos="syscall_bsd.go $syscall_goos"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [ -n "$mksyscall" ]; then echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
|
if [ -n "$mksyscall" ]; then
|
||||||
;;
|
if [ "$GOOSARCH" == "aix_ppc64" ]; then
|
||||||
|
# aix/ppc64 script generates files instead of writing to stdin.
|
||||||
|
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
|
||||||
|
elif [ "$GOOS" == "darwin" ]; then
|
||||||
|
# pre-1.12, direct syscalls
|
||||||
|
echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
|
||||||
|
# 1.12 and later, syscalls via libSystem
|
||||||
|
echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
||||||
|
else
|
||||||
|
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
||||||
|
fi
|
||||||
|
fi
|
||||||
esac
|
esac
|
||||||
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
||||||
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
||||||
if [ -n "$mktypes" ]; then
|
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
|
||||||
echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
|
if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
|
||||||
fi
|
|
||||||
) | $run
|
) | $run
|
||||||
|
|
|
||||||
61
vendor/golang.org/x/sys/unix/mkasm_darwin.go
generated
vendored
Normal file
61
vendor/golang.org/x/sys/unix/mkasm_darwin.go
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go.
|
||||||
|
//This program must be run after mksyscall.go.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
in1, err := ioutil.ReadFile("syscall_darwin.go")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("can't open syscall_darwin.go: %s", err)
|
||||||
|
}
|
||||||
|
arch := os.Args[1]
|
||||||
|
in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch))
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err)
|
||||||
|
}
|
||||||
|
in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch))
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err)
|
||||||
|
}
|
||||||
|
in := string(in1) + string(in2) + string(in3)
|
||||||
|
|
||||||
|
trampolines := map[string]bool{}
|
||||||
|
|
||||||
|
var out bytes.Buffer
|
||||||
|
|
||||||
|
fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " "))
|
||||||
|
fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n")
|
||||||
|
fmt.Fprintf(&out, "\n")
|
||||||
|
fmt.Fprintf(&out, "// +build go1.12\n")
|
||||||
|
fmt.Fprintf(&out, "\n")
|
||||||
|
fmt.Fprintf(&out, "#include \"textflag.h\"\n")
|
||||||
|
for _, line := range strings.Split(in, "\n") {
|
||||||
|
if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fn := line[5 : len(line)-13]
|
||||||
|
if !trampolines[fn] {
|
||||||
|
trampolines[fn] = true
|
||||||
|
fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
|
||||||
|
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
47
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
Executable file → Normal file
47
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
Executable file → Normal file
|
|
@ -17,12 +17,10 @@ if test -z "$GOARCH" -o -z "$GOOS"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that we are using the new build system if we should
|
# Check that we are using the new build system if we should
|
||||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
|
if [[ "$GOOS" = "linux" ]] && [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
|
||||||
if [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
|
echo 1>&2 "In the Docker based build system, mkerrors should not be called directly."
|
||||||
echo 1>&2 "In the new build system, mkerrors should not be called directly."
|
echo 1>&2 "See README.md"
|
||||||
echo 1>&2 "See README.md"
|
exit 1
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$GOOS" = "aix" ]]; then
|
if [[ "$GOOS" = "aix" ]]; then
|
||||||
|
|
@ -101,7 +99,7 @@ includes_DragonFly='
|
||||||
'
|
'
|
||||||
|
|
||||||
includes_FreeBSD='
|
includes_FreeBSD='
|
||||||
#include <sys/capability.h>
|
#include <sys/capsicum.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/event.h>
|
#include <sys/event.h>
|
||||||
|
|
@ -181,21 +179,27 @@ struct ltchars {
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/signalfd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/xattr.h>
|
#include <sys/xattr.h>
|
||||||
|
#include <linux/errqueue.h>
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
#include <linux/if_alg.h>
|
#include <linux/if_alg.h>
|
||||||
#include <linux/if_arp.h>
|
#include <linux/if_arp.h>
|
||||||
#include <linux/if_ether.h>
|
#include <linux/if_ether.h>
|
||||||
|
#include <linux/if_ppp.h>
|
||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
#include <linux/if_addr.h>
|
#include <linux/if_addr.h>
|
||||||
#include <linux/falloc.h>
|
#include <linux/falloc.h>
|
||||||
|
#include <linux/fanotify.h>
|
||||||
#include <linux/filter.h>
|
#include <linux/filter.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
|
#include <linux/kexec.h>
|
||||||
#include <linux/keyctl.h>
|
#include <linux/keyctl.h>
|
||||||
#include <linux/magic.h>
|
#include <linux/magic.h>
|
||||||
#include <linux/memfd.h>
|
#include <linux/memfd.h>
|
||||||
|
#include <linux/module.h>
|
||||||
#include <linux/netfilter/nfnetlink.h>
|
#include <linux/netfilter/nfnetlink.h>
|
||||||
#include <linux/netlink.h>
|
#include <linux/netlink.h>
|
||||||
#include <linux/net_namespace.h>
|
#include <linux/net_namespace.h>
|
||||||
|
|
@ -220,7 +224,15 @@ struct ltchars {
|
||||||
#include <linux/if_xdp.h>
|
#include <linux/if_xdp.h>
|
||||||
#include <mtd/ubi-user.h>
|
#include <mtd/ubi-user.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
|
|
||||||
|
#if defined(__sparc__)
|
||||||
|
// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
|
||||||
|
// definition in glibc. As only the error constants are needed here, include the
|
||||||
|
// generic termibits.h (which is included by termbits.h on sparc).
|
||||||
|
#include <asm-generic/termbits.h>
|
||||||
|
#else
|
||||||
#include <asm/termbits.h>
|
#include <asm/termbits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef MSG_FASTOPEN
|
#ifndef MSG_FASTOPEN
|
||||||
#define MSG_FASTOPEN 0x20000000
|
#define MSG_FASTOPEN 0x20000000
|
||||||
|
|
@ -248,16 +260,6 @@ struct ltchars {
|
||||||
#define FS_KEY_DESC_PREFIX "fscrypt:"
|
#define FS_KEY_DESC_PREFIX "fscrypt:"
|
||||||
#define FS_KEY_DESC_PREFIX_SIZE 8
|
#define FS_KEY_DESC_PREFIX_SIZE 8
|
||||||
#define FS_MAX_KEY_SIZE 64
|
#define FS_MAX_KEY_SIZE 64
|
||||||
|
|
||||||
// XDP socket constants do not appear to be picked up otherwise.
|
|
||||||
// Copied from samples/bpf/xdpsock_user.c.
|
|
||||||
#ifndef SOL_XDP
|
|
||||||
#define SOL_XDP 283
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef AF_XDP
|
|
||||||
#define AF_XDP 44
|
|
||||||
#endif
|
|
||||||
'
|
'
|
||||||
|
|
||||||
includes_NetBSD='
|
includes_NetBSD='
|
||||||
|
|
@ -292,6 +294,7 @@ includes_OpenBSD='
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/event.h>
|
#include <sys/event.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
@ -440,11 +443,14 @@ ccflags="$@"
|
||||||
$2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
|
$2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
|
||||||
$2 ~ /^HW_MACHINE$/ ||
|
$2 ~ /^HW_MACHINE$/ ||
|
||||||
$2 ~ /^SYSCTL_VERS/ ||
|
$2 ~ /^SYSCTL_VERS/ ||
|
||||||
|
$2 !~ "MNT_BITS" &&
|
||||||
$2 ~ /^(MS|MNT|UMOUNT)_/ ||
|
$2 ~ /^(MS|MNT|UMOUNT)_/ ||
|
||||||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
||||||
$2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ ||
|
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT)_/ ||
|
||||||
|
$2 ~ /^KEXEC_/ ||
|
||||||
$2 ~ /^LINUX_REBOOT_CMD_/ ||
|
$2 ~ /^LINUX_REBOOT_CMD_/ ||
|
||||||
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
|
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
|
||||||
|
$2 ~ /^MODULE_INIT_/ ||
|
||||||
$2 !~ "NLA_TYPE_MASK" &&
|
$2 !~ "NLA_TYPE_MASK" &&
|
||||||
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
||||||
$2 ~ /^SIOC/ ||
|
$2 ~ /^SIOC/ ||
|
||||||
|
|
@ -461,12 +467,13 @@ ccflags="$@"
|
||||||
$2 ~ /^CLONE_[A-Z_]+/ ||
|
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||||
$2 !~ /^(BPF_TIMEVAL)$/ &&
|
$2 !~ /^(BPF_TIMEVAL)$/ &&
|
||||||
$2 ~ /^(BPF|DLT)_/ ||
|
$2 ~ /^(BPF|DLT)_/ ||
|
||||||
$2 ~ /^CLOCK_/ ||
|
$2 ~ /^(CLOCK|TIMER)_/ ||
|
||||||
$2 ~ /^CAN_/ ||
|
$2 ~ /^CAN_/ ||
|
||||||
$2 ~ /^CAP_/ ||
|
$2 ~ /^CAP_/ ||
|
||||||
$2 ~ /^ALG_/ ||
|
$2 ~ /^ALG_/ ||
|
||||||
$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ ||
|
$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ ||
|
||||||
$2 ~ /^GRND_/ ||
|
$2 ~ /^GRND_/ ||
|
||||||
|
$2 ~ /^RND/ ||
|
||||||
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
|
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
|
||||||
$2 ~ /^KEYCTL_/ ||
|
$2 ~ /^KEYCTL_/ ||
|
||||||
$2 ~ /^PERF_EVENT_IOC_/ ||
|
$2 ~ /^PERF_EVENT_IOC_/ ||
|
||||||
|
|
@ -494,6 +501,8 @@ ccflags="$@"
|
||||||
$2 ~ /^(HDIO|WIN|SMART)_/ ||
|
$2 ~ /^(HDIO|WIN|SMART)_/ ||
|
||||||
$2 !~ "WMESGLEN" &&
|
$2 !~ "WMESGLEN" &&
|
||||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||||
|
$2 ~/^PPPIOC/ ||
|
||||||
|
$2 ~ /^FAN_|FANOTIFY_/ ||
|
||||||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||||
$2 ~ /^__WCOREFLAG$/ {next}
|
$2 ~ /^__WCOREFLAG$/ {next}
|
||||||
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||||
|
|
|
||||||
14
vendor/golang.org/x/sys/unix/mkpost.go
generated
vendored
14
vendor/golang.org/x/sys/unix/mkpost.go
generated
vendored
|
|
@ -28,10 +28,10 @@ func main() {
|
||||||
if goarch == "" {
|
if goarch == "" {
|
||||||
goarch = os.Getenv("GOARCH")
|
goarch = os.Getenv("GOARCH")
|
||||||
}
|
}
|
||||||
// Check that we are using the new build system if we should be.
|
// Check that we are using the Docker-based build system if we should be.
|
||||||
if goos == "linux" && goarch != "sparc64" {
|
if goos == "linux" {
|
||||||
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
|
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
|
||||||
os.Stderr.WriteString("In the new build system, mkpost should not be called directly.\n")
|
os.Stderr.WriteString("In the Docker-based build system, mkpost should not be called directly.\n")
|
||||||
os.Stderr.WriteString("See README.md\n")
|
os.Stderr.WriteString("See README.md\n")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +46,10 @@ func main() {
|
||||||
valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`)
|
valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`)
|
||||||
b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}"))
|
b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}"))
|
||||||
|
|
||||||
|
// Intentionally export __fds_bits field in FdSet
|
||||||
|
fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`)
|
||||||
|
b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$3}"))
|
||||||
|
|
||||||
// If we have empty Ptrace structs, we should delete them. Only s390x emits
|
// If we have empty Ptrace structs, we should delete them. Only s390x emits
|
||||||
// nonempty Ptrace structs.
|
// nonempty Ptrace structs.
|
||||||
ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
|
ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
|
||||||
|
|
@ -65,6 +69,10 @@ func main() {
|
||||||
convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`)
|
convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`)
|
||||||
b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))
|
b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))
|
||||||
|
|
||||||
|
// Convert [1024]int8 to [1024]byte in Ptmget members
|
||||||
|
convertPtmget := regexp.MustCompile(`([SC]n)(\s+)\[(\d+)\]u?int8`)
|
||||||
|
b = convertPtmget.ReplaceAll(b, []byte("$1[$3]byte"))
|
||||||
|
|
||||||
// Remove spare fields (e.g. in Statx_t)
|
// Remove spare fields (e.g. in Statx_t)
|
||||||
spareFieldsRegex := regexp.MustCompile(`X__spare\S*`)
|
spareFieldsRegex := regexp.MustCompile(`X__spare\S*`)
|
||||||
b = spareFieldsRegex.ReplaceAll(b, []byte("_"))
|
b = spareFieldsRegex.ReplaceAll(b, []byte("_"))
|
||||||
|
|
|
||||||
407
vendor/golang.org/x/sys/unix/mksyscall.go
generated
vendored
Normal file
407
vendor/golang.org/x/sys/unix/mksyscall.go
generated
vendored
Normal file
|
|
@ -0,0 +1,407 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
/*
|
||||||
|
This program reads a file containing function prototypes
|
||||||
|
(like syscall_darwin.go) and generates system call bodies.
|
||||||
|
The prototypes are marked by lines beginning with "//sys"
|
||||||
|
and read like func declarations if //sys is replaced by func, but:
|
||||||
|
* The parameter lists must give a name for each argument.
|
||||||
|
This includes return parameters.
|
||||||
|
* The parameter lists must give a type for each argument:
|
||||||
|
the (x, y, z int) shorthand is not allowed.
|
||||||
|
* If the return parameter is an error number, it must be named errno.
|
||||||
|
|
||||||
|
A line beginning with //sysnb is like //sys, except that the
|
||||||
|
goroutine will not be suspended during the execution of the system
|
||||||
|
call. This must only be used for system calls which can never
|
||||||
|
block, as otherwise the system call could cause all goroutines to
|
||||||
|
hang.
|
||||||
|
*/
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
b32 = flag.Bool("b32", false, "32bit big-endian")
|
||||||
|
l32 = flag.Bool("l32", false, "32bit little-endian")
|
||||||
|
plan9 = flag.Bool("plan9", false, "plan9")
|
||||||
|
openbsd = flag.Bool("openbsd", false, "openbsd")
|
||||||
|
netbsd = flag.Bool("netbsd", false, "netbsd")
|
||||||
|
dragonfly = flag.Bool("dragonfly", false, "dragonfly")
|
||||||
|
arm = flag.Bool("arm", false, "arm") // 64-bit value should use (even, odd)-pair
|
||||||
|
tags = flag.String("tags", "", "build tags")
|
||||||
|
filename = flag.String("output", "", "output file name (standard output if omitted)")
|
||||||
|
)
|
||||||
|
|
||||||
|
// cmdLine returns this programs's commandline arguments
|
||||||
|
func cmdLine() string {
|
||||||
|
return "go run mksyscall.go " + strings.Join(os.Args[1:], " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// buildTags returns build tags
|
||||||
|
func buildTags() string {
|
||||||
|
return *tags
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is function parameter
|
||||||
|
type Param struct {
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
}
|
||||||
|
|
||||||
|
// usage prints the program usage
|
||||||
|
func usage() {
|
||||||
|
fmt.Fprintf(os.Stderr, "usage: go run mksyscall.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseParamList parses parameter list and returns a slice of parameters
|
||||||
|
func parseParamList(list string) []string {
|
||||||
|
list = strings.TrimSpace(list)
|
||||||
|
if list == "" {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
|
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseParam splits a parameter into name and type
|
||||||
|
func parseParam(p string) Param {
|
||||||
|
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
||||||
|
if ps == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
return Param{ps[1], ps[2]}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Get the OS and architecture (using GOARCH_TARGET if it exists)
|
||||||
|
goos := os.Getenv("GOOS")
|
||||||
|
if goos == "" {
|
||||||
|
fmt.Fprintln(os.Stderr, "GOOS not defined in environment")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
goarch := os.Getenv("GOARCH_TARGET")
|
||||||
|
if goarch == "" {
|
||||||
|
goarch = os.Getenv("GOARCH")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that we are using the Docker-based build system if we should
|
||||||
|
if goos == "linux" {
|
||||||
|
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
|
||||||
|
fmt.Fprintf(os.Stderr, "In the Docker-based build system, mksyscall should not be called directly.\n")
|
||||||
|
fmt.Fprintf(os.Stderr, "See README.md\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flag.Usage = usage
|
||||||
|
flag.Parse()
|
||||||
|
if len(flag.Args()) <= 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
||||||
|
usage()
|
||||||
|
}
|
||||||
|
|
||||||
|
endianness := ""
|
||||||
|
if *b32 {
|
||||||
|
endianness = "big-endian"
|
||||||
|
} else if *l32 {
|
||||||
|
endianness = "little-endian"
|
||||||
|
}
|
||||||
|
|
||||||
|
libc := false
|
||||||
|
if goos == "darwin" && strings.Contains(buildTags(), ",go1.12") {
|
||||||
|
libc = true
|
||||||
|
}
|
||||||
|
trampolines := map[string]bool{}
|
||||||
|
|
||||||
|
text := ""
|
||||||
|
for _, path := range flag.Args() {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
s := bufio.NewScanner(file)
|
||||||
|
for s.Scan() {
|
||||||
|
t := s.Text()
|
||||||
|
t = strings.TrimSpace(t)
|
||||||
|
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
||||||
|
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
||||||
|
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Line must be of the form
|
||||||
|
// func Open(path string, mode int, perm int) (fd int, errno error)
|
||||||
|
// Split into name, in params, out params.
|
||||||
|
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$`).FindStringSubmatch(t)
|
||||||
|
if f == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
funct, inps, outps, sysname := f[2], f[3], f[4], f[5]
|
||||||
|
|
||||||
|
// ClockGettime doesn't have a syscall number on Darwin, only generate libc wrappers.
|
||||||
|
if goos == "darwin" && !libc && funct == "ClockGettime" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split argument lists on comma.
|
||||||
|
in := parseParamList(inps)
|
||||||
|
out := parseParamList(outps)
|
||||||
|
|
||||||
|
// Try in vain to keep people from editing this file.
|
||||||
|
// The theory is that they jump into the middle of the file
|
||||||
|
// without reading the header.
|
||||||
|
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||||
|
|
||||||
|
// Go function header.
|
||||||
|
outDecl := ""
|
||||||
|
if len(out) > 0 {
|
||||||
|
outDecl = fmt.Sprintf(" (%s)", strings.Join(out, ", "))
|
||||||
|
}
|
||||||
|
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outDecl)
|
||||||
|
|
||||||
|
// Check if err return available
|
||||||
|
errvar := ""
|
||||||
|
for _, param := range out {
|
||||||
|
p := parseParam(param)
|
||||||
|
if p.Type == "error" {
|
||||||
|
errvar = p.Name
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare arguments to Syscall.
|
||||||
|
var args []string
|
||||||
|
n := 0
|
||||||
|
for _, param := range in {
|
||||||
|
p := parseParam(param)
|
||||||
|
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
|
||||||
|
} else if p.Type == "string" && errvar != "" {
|
||||||
|
text += fmt.Sprintf("\tvar _p%d *byte\n", n)
|
||||||
|
text += fmt.Sprintf("\t_p%d, %s = BytePtrFromString(%s)\n", n, errvar, p.Name)
|
||||||
|
text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||||
|
n++
|
||||||
|
} else if p.Type == "string" {
|
||||||
|
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
||||||
|
text += fmt.Sprintf("\tvar _p%d *byte\n", n)
|
||||||
|
text += fmt.Sprintf("\t_p%d, _ = BytePtrFromString(%s)\n", n, p.Name)
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||||
|
n++
|
||||||
|
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
// Convert slice into pointer, length.
|
||||||
|
// Have to be careful not to take address of &a[0] if len == 0:
|
||||||
|
// pass dummy pointer in that case.
|
||||||
|
// Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
|
||||||
|
text += fmt.Sprintf("\tvar _p%d unsafe.Pointer\n", n)
|
||||||
|
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = unsafe.Pointer(&%s[0])\n\t}", p.Name, n, p.Name)
|
||||||
|
text += fmt.Sprintf(" else {\n\t\t_p%d = unsafe.Pointer(&_zero)\n\t}\n", n)
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(_p%d)", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
|
||||||
|
n++
|
||||||
|
} else if p.Type == "int64" && (*openbsd || *netbsd) {
|
||||||
|
args = append(args, "0")
|
||||||
|
if endianness == "big-endian" {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
} else if endianness == "little-endian" {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
}
|
||||||
|
} else if p.Type == "int64" && *dragonfly {
|
||||||
|
if regexp.MustCompile(`^(?i)extp(read|write)`).FindStringSubmatch(funct) == nil {
|
||||||
|
args = append(args, "0")
|
||||||
|
}
|
||||||
|
if endianness == "big-endian" {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
} else if endianness == "little-endian" {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
}
|
||||||
|
} else if (p.Type == "int64" || p.Type == "uint64") && endianness != "" {
|
||||||
|
if len(args)%2 == 1 && *arm {
|
||||||
|
// arm abi specifies 64-bit argument uses
|
||||||
|
// (even, odd) pair
|
||||||
|
args = append(args, "0")
|
||||||
|
}
|
||||||
|
if endianness == "big-endian" {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine which form to use; pad args with zeros.
|
||||||
|
asm := "Syscall"
|
||||||
|
if nonblock != nil {
|
||||||
|
if errvar == "" && goos == "linux" {
|
||||||
|
asm = "RawSyscallNoError"
|
||||||
|
} else {
|
||||||
|
asm = "RawSyscall"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if errvar == "" && goos == "linux" {
|
||||||
|
asm = "SyscallNoError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(args) <= 3 {
|
||||||
|
for len(args) < 3 {
|
||||||
|
args = append(args, "0")
|
||||||
|
}
|
||||||
|
} else if len(args) <= 6 {
|
||||||
|
asm += "6"
|
||||||
|
for len(args) < 6 {
|
||||||
|
args = append(args, "0")
|
||||||
|
}
|
||||||
|
} else if len(args) <= 9 {
|
||||||
|
asm += "9"
|
||||||
|
for len(args) < 9 {
|
||||||
|
args = append(args, "0")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s:%s too many arguments to system call\n", path, funct)
|
||||||
|
}
|
||||||
|
|
||||||
|
// System call number.
|
||||||
|
if sysname == "" {
|
||||||
|
sysname = "SYS_" + funct
|
||||||
|
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
||||||
|
sysname = strings.ToUpper(sysname)
|
||||||
|
}
|
||||||
|
|
||||||
|
var libcFn string
|
||||||
|
if libc {
|
||||||
|
asm = "syscall_" + strings.ToLower(asm[:1]) + asm[1:] // internal syscall call
|
||||||
|
sysname = strings.TrimPrefix(sysname, "SYS_") // remove SYS_
|
||||||
|
sysname = strings.ToLower(sysname) // lowercase
|
||||||
|
if sysname == "getdirentries64" {
|
||||||
|
// Special case - libSystem name and
|
||||||
|
// raw syscall name don't match.
|
||||||
|
sysname = "__getdirentries64"
|
||||||
|
}
|
||||||
|
libcFn = sysname
|
||||||
|
sysname = "funcPC(libc_" + sysname + "_trampoline)"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actual call.
|
||||||
|
arglist := strings.Join(args, ", ")
|
||||||
|
call := fmt.Sprintf("%s(%s, %s)", asm, sysname, arglist)
|
||||||
|
|
||||||
|
// Assign return values.
|
||||||
|
body := ""
|
||||||
|
ret := []string{"_", "_", "_"}
|
||||||
|
doErrno := false
|
||||||
|
for i := 0; i < len(out); i++ {
|
||||||
|
p := parseParam(out[i])
|
||||||
|
reg := ""
|
||||||
|
if p.Name == "err" && !*plan9 {
|
||||||
|
reg = "e1"
|
||||||
|
ret[2] = reg
|
||||||
|
doErrno = true
|
||||||
|
} else if p.Name == "err" && *plan9 {
|
||||||
|
ret[0] = "r0"
|
||||||
|
ret[2] = "e1"
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
reg = fmt.Sprintf("r%d", i)
|
||||||
|
ret[i] = reg
|
||||||
|
}
|
||||||
|
if p.Type == "bool" {
|
||||||
|
reg = fmt.Sprintf("%s != 0", reg)
|
||||||
|
}
|
||||||
|
if p.Type == "int64" && endianness != "" {
|
||||||
|
// 64-bit number in r1:r0 or r0:r1.
|
||||||
|
if i+2 > len(out) {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s:%s not enough registers for int64 return\n", path, funct)
|
||||||
|
}
|
||||||
|
if endianness == "big-endian" {
|
||||||
|
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
|
||||||
|
} else {
|
||||||
|
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
|
||||||
|
}
|
||||||
|
ret[i] = fmt.Sprintf("r%d", i)
|
||||||
|
ret[i+1] = fmt.Sprintf("r%d", i+1)
|
||||||
|
}
|
||||||
|
if reg != "e1" || *plan9 {
|
||||||
|
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
|
||||||
|
text += fmt.Sprintf("\t%s\n", call)
|
||||||
|
} else {
|
||||||
|
if errvar == "" && goos == "linux" {
|
||||||
|
// raw syscall without error on Linux, see golang.org/issue/22924
|
||||||
|
text += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], call)
|
||||||
|
} else {
|
||||||
|
text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text += body
|
||||||
|
|
||||||
|
if *plan9 && ret[2] == "e1" {
|
||||||
|
text += "\tif int32(r0) == -1 {\n"
|
||||||
|
text += "\t\terr = e1\n"
|
||||||
|
text += "\t}\n"
|
||||||
|
} else if doErrno {
|
||||||
|
text += "\tif e1 != 0 {\n"
|
||||||
|
text += "\t\terr = errnoErr(e1)\n"
|
||||||
|
text += "\t}\n"
|
||||||
|
}
|
||||||
|
text += "\treturn\n"
|
||||||
|
text += "}\n\n"
|
||||||
|
|
||||||
|
if libc && !trampolines[libcFn] {
|
||||||
|
// some system calls share a trampoline, like read and readlen.
|
||||||
|
trampolines[libcFn] = true
|
||||||
|
// Declare assembly trampoline.
|
||||||
|
text += fmt.Sprintf("func libc_%s_trampoline()\n", libcFn)
|
||||||
|
// Assembly trampoline calls the libc_* function, which this magic
|
||||||
|
// redirects to use the function from libSystem.
|
||||||
|
text += fmt.Sprintf("//go:linkname libc_%s libc_%s\n", libcFn, libcFn)
|
||||||
|
text += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"/usr/lib/libSystem.B.dylib\"\n", libcFn, libcFn)
|
||||||
|
text += "\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := s.Err(); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
file.Close()
|
||||||
|
}
|
||||||
|
fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
|
||||||
|
}
|
||||||
|
|
||||||
|
const srcTemplate = `// %s
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build %s
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ syscall.Errno
|
||||||
|
|
||||||
|
%s
|
||||||
|
`
|
||||||
341
vendor/golang.org/x/sys/unix/mksyscall.pl
generated
vendored
341
vendor/golang.org/x/sys/unix/mksyscall.pl
generated
vendored
|
|
@ -1,341 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
# Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
# This program reads a file containing function prototypes
|
|
||||||
# (like syscall_darwin.go) and generates system call bodies.
|
|
||||||
# The prototypes are marked by lines beginning with "//sys"
|
|
||||||
# and read like func declarations if //sys is replaced by func, but:
|
|
||||||
# * The parameter lists must give a name for each argument.
|
|
||||||
# This includes return parameters.
|
|
||||||
# * The parameter lists must give a type for each argument:
|
|
||||||
# the (x, y, z int) shorthand is not allowed.
|
|
||||||
# * If the return parameter is an error number, it must be named errno.
|
|
||||||
|
|
||||||
# A line beginning with //sysnb is like //sys, except that the
|
|
||||||
# goroutine will not be suspended during the execution of the system
|
|
||||||
# call. This must only be used for system calls which can never
|
|
||||||
# block, as otherwise the system call could cause all goroutines to
|
|
||||||
# hang.
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
my $cmdline = "mksyscall.pl " . join(' ', @ARGV);
|
|
||||||
my $errors = 0;
|
|
||||||
my $_32bit = "";
|
|
||||||
my $plan9 = 0;
|
|
||||||
my $openbsd = 0;
|
|
||||||
my $netbsd = 0;
|
|
||||||
my $dragonfly = 0;
|
|
||||||
my $arm = 0; # 64-bit value should use (even, odd)-pair
|
|
||||||
my $tags = ""; # build tags
|
|
||||||
|
|
||||||
if($ARGV[0] eq "-b32") {
|
|
||||||
$_32bit = "big-endian";
|
|
||||||
shift;
|
|
||||||
} elsif($ARGV[0] eq "-l32") {
|
|
||||||
$_32bit = "little-endian";
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-plan9") {
|
|
||||||
$plan9 = 1;
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-openbsd") {
|
|
||||||
$openbsd = 1;
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-netbsd") {
|
|
||||||
$netbsd = 1;
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-dragonfly") {
|
|
||||||
$dragonfly = 1;
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-arm") {
|
|
||||||
$arm = 1;
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-tags") {
|
|
||||||
shift;
|
|
||||||
$tags = $ARGV[0];
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($ARGV[0] =~ /^-/) {
|
|
||||||
print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check that we are using the new build system if we should
|
|
||||||
if($ENV{'GOOS'} eq "linux" && $ENV{'GOARCH'} ne "sparc64") {
|
|
||||||
if($ENV{'GOLANG_SYS_BUILD'} ne "docker") {
|
|
||||||
print STDERR "In the new build system, mksyscall should not be called directly.\n";
|
|
||||||
print STDERR "See README.md\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub parseparamlist($) {
|
|
||||||
my ($list) = @_;
|
|
||||||
$list =~ s/^\s*//;
|
|
||||||
$list =~ s/\s*$//;
|
|
||||||
if($list eq "") {
|
|
||||||
return ();
|
|
||||||
}
|
|
||||||
return split(/\s*,\s*/, $list);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parseparam($) {
|
|
||||||
my ($p) = @_;
|
|
||||||
if($p !~ /^(\S*) (\S*)$/) {
|
|
||||||
print STDERR "$ARGV:$.: malformed parameter: $p\n";
|
|
||||||
$errors = 1;
|
|
||||||
return ("xx", "int");
|
|
||||||
}
|
|
||||||
return ($1, $2);
|
|
||||||
}
|
|
||||||
|
|
||||||
my $text = "";
|
|
||||||
while(<>) {
|
|
||||||
chomp;
|
|
||||||
s/\s+/ /g;
|
|
||||||
s/^\s+//;
|
|
||||||
s/\s+$//;
|
|
||||||
my $nonblock = /^\/\/sysnb /;
|
|
||||||
next if !/^\/\/sys / && !$nonblock;
|
|
||||||
|
|
||||||
# Line must be of the form
|
|
||||||
# func Open(path string, mode int, perm int) (fd int, errno error)
|
|
||||||
# Split into name, in params, out params.
|
|
||||||
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) {
|
|
||||||
print STDERR "$ARGV:$.: malformed //sys declaration\n";
|
|
||||||
$errors = 1;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
my ($func, $in, $out, $sysname) = ($2, $3, $4, $5);
|
|
||||||
|
|
||||||
# Split argument lists on comma.
|
|
||||||
my @in = parseparamlist($in);
|
|
||||||
my @out = parseparamlist($out);
|
|
||||||
|
|
||||||
# Try in vain to keep people from editing this file.
|
|
||||||
# The theory is that they jump into the middle of the file
|
|
||||||
# without reading the header.
|
|
||||||
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
|
|
||||||
|
|
||||||
# Go function header.
|
|
||||||
my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : "";
|
|
||||||
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl;
|
|
||||||
|
|
||||||
# Check if err return available
|
|
||||||
my $errvar = "";
|
|
||||||
foreach my $p (@out) {
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
if($type eq "error") {
|
|
||||||
$errvar = $name;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Prepare arguments to Syscall.
|
|
||||||
my @args = ();
|
|
||||||
my $n = 0;
|
|
||||||
foreach my $p (@in) {
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
if($type =~ /^\*/) {
|
|
||||||
push @args, "uintptr(unsafe.Pointer($name))";
|
|
||||||
} elsif($type eq "string" && $errvar ne "") {
|
|
||||||
$text .= "\tvar _p$n *byte\n";
|
|
||||||
$text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
|
|
||||||
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
|
|
||||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
|
||||||
$n++;
|
|
||||||
} elsif($type eq "string") {
|
|
||||||
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
|
|
||||||
$text .= "\tvar _p$n *byte\n";
|
|
||||||
$text .= "\t_p$n, _ = BytePtrFromString($name)\n";
|
|
||||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
|
||||||
$n++;
|
|
||||||
} elsif($type =~ /^\[\](.*)/) {
|
|
||||||
# Convert slice into pointer, length.
|
|
||||||
# Have to be careful not to take address of &a[0] if len == 0:
|
|
||||||
# pass dummy pointer in that case.
|
|
||||||
# Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
|
|
||||||
$text .= "\tvar _p$n unsafe.Pointer\n";
|
|
||||||
$text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}";
|
|
||||||
$text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}";
|
|
||||||
$text .= "\n";
|
|
||||||
push @args, "uintptr(_p$n)", "uintptr(len($name))";
|
|
||||||
$n++;
|
|
||||||
} elsif($type eq "int64" && ($openbsd || $netbsd)) {
|
|
||||||
push @args, "0";
|
|
||||||
if($_32bit eq "big-endian") {
|
|
||||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
|
||||||
} elsif($_32bit eq "little-endian") {
|
|
||||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
|
||||||
} else {
|
|
||||||
push @args, "uintptr($name)";
|
|
||||||
}
|
|
||||||
} elsif($type eq "int64" && $dragonfly) {
|
|
||||||
if ($func !~ /^extp(read|write)/i) {
|
|
||||||
push @args, "0";
|
|
||||||
}
|
|
||||||
if($_32bit eq "big-endian") {
|
|
||||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
|
||||||
} elsif($_32bit eq "little-endian") {
|
|
||||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
|
||||||
} else {
|
|
||||||
push @args, "uintptr($name)";
|
|
||||||
}
|
|
||||||
} elsif($type eq "int64" && $_32bit ne "") {
|
|
||||||
if(@args % 2 && $arm) {
|
|
||||||
# arm abi specifies 64-bit argument uses
|
|
||||||
# (even, odd) pair
|
|
||||||
push @args, "0"
|
|
||||||
}
|
|
||||||
if($_32bit eq "big-endian") {
|
|
||||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
|
||||||
} else {
|
|
||||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
push @args, "uintptr($name)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Determine which form to use; pad args with zeros.
|
|
||||||
my $asm = "Syscall";
|
|
||||||
if ($nonblock) {
|
|
||||||
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
|
|
||||||
$asm = "RawSyscallNoError";
|
|
||||||
} else {
|
|
||||||
$asm = "RawSyscall";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
|
|
||||||
$asm = "SyscallNoError";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(@args <= 3) {
|
|
||||||
while(@args < 3) {
|
|
||||||
push @args, "0";
|
|
||||||
}
|
|
||||||
} elsif(@args <= 6) {
|
|
||||||
$asm .= "6";
|
|
||||||
while(@args < 6) {
|
|
||||||
push @args, "0";
|
|
||||||
}
|
|
||||||
} elsif(@args <= 9) {
|
|
||||||
$asm .= "9";
|
|
||||||
while(@args < 9) {
|
|
||||||
push @args, "0";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print STDERR "$ARGV:$.: too many arguments to system call\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# System call number.
|
|
||||||
if($sysname eq "") {
|
|
||||||
$sysname = "SYS_$func";
|
|
||||||
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar
|
|
||||||
$sysname =~ y/a-z/A-Z/;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Actual call.
|
|
||||||
my $args = join(', ', @args);
|
|
||||||
my $call = "$asm($sysname, $args)";
|
|
||||||
|
|
||||||
# Assign return values.
|
|
||||||
my $body = "";
|
|
||||||
my @ret = ("_", "_", "_");
|
|
||||||
my $do_errno = 0;
|
|
||||||
for(my $i=0; $i<@out; $i++) {
|
|
||||||
my $p = $out[$i];
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
my $reg = "";
|
|
||||||
if($name eq "err" && !$plan9) {
|
|
||||||
$reg = "e1";
|
|
||||||
$ret[2] = $reg;
|
|
||||||
$do_errno = 1;
|
|
||||||
} elsif($name eq "err" && $plan9) {
|
|
||||||
$ret[0] = "r0";
|
|
||||||
$ret[2] = "e1";
|
|
||||||
next;
|
|
||||||
} else {
|
|
||||||
$reg = sprintf("r%d", $i);
|
|
||||||
$ret[$i] = $reg;
|
|
||||||
}
|
|
||||||
if($type eq "bool") {
|
|
||||||
$reg = "$reg != 0";
|
|
||||||
}
|
|
||||||
if($type eq "int64" && $_32bit ne "") {
|
|
||||||
# 64-bit number in r1:r0 or r0:r1.
|
|
||||||
if($i+2 > @out) {
|
|
||||||
print STDERR "$ARGV:$.: not enough registers for int64 return\n";
|
|
||||||
}
|
|
||||||
if($_32bit eq "big-endian") {
|
|
||||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
|
|
||||||
} else {
|
|
||||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
|
|
||||||
}
|
|
||||||
$ret[$i] = sprintf("r%d", $i);
|
|
||||||
$ret[$i+1] = sprintf("r%d", $i+1);
|
|
||||||
}
|
|
||||||
if($reg ne "e1" || $plan9) {
|
|
||||||
$body .= "\t$name = $type($reg)\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
|
|
||||||
$text .= "\t$call\n";
|
|
||||||
} else {
|
|
||||||
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
|
|
||||||
# raw syscall without error on Linux, see golang.org/issue/22924
|
|
||||||
$text .= "\t$ret[0], $ret[1] := $call\n";
|
|
||||||
} else {
|
|
||||||
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$text .= $body;
|
|
||||||
|
|
||||||
if ($plan9 && $ret[2] eq "e1") {
|
|
||||||
$text .= "\tif int32(r0) == -1 {\n";
|
|
||||||
$text .= "\t\terr = e1\n";
|
|
||||||
$text .= "\t}\n";
|
|
||||||
} elsif ($do_errno) {
|
|
||||||
$text .= "\tif e1 != 0 {\n";
|
|
||||||
$text .= "\t\terr = errnoErr(e1)\n";
|
|
||||||
$text .= "\t}\n";
|
|
||||||
}
|
|
||||||
$text .= "\treturn\n";
|
|
||||||
$text .= "}\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
chomp $text;
|
|
||||||
chomp $text;
|
|
||||||
|
|
||||||
if($errors) {
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
// $cmdline
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build $tags
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
var _ syscall.Errno
|
|
||||||
|
|
||||||
$text
|
|
||||||
EOF
|
|
||||||
exit 0;
|
|
||||||
385
vendor/golang.org/x/sys/unix/mksyscall_aix.pl
generated
vendored
385
vendor/golang.org/x/sys/unix/mksyscall_aix.pl
generated
vendored
|
|
@ -1,385 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
# Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
# This program reads a file containing function prototypes
|
|
||||||
# (like syscall_aix.go) and generates system call bodies.
|
|
||||||
# The prototypes are marked by lines beginning with "//sys"
|
|
||||||
# and read like func declarations if //sys is replaced by func, but:
|
|
||||||
# * The parameter lists must give a name for each argument.
|
|
||||||
# This includes return parameters.
|
|
||||||
# * The parameter lists must give a type for each argument:
|
|
||||||
# the (x, y, z int) shorthand is not allowed.
|
|
||||||
# * If the return parameter is an error number, it must be named err.
|
|
||||||
# * If go func name needs to be different than its libc name,
|
|
||||||
# * or the function is not in libc, name could be specified
|
|
||||||
# * at the end, after "=" sign, like
|
|
||||||
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
my $cmdline = "mksyscall_aix.pl " . join(' ', @ARGV);
|
|
||||||
my $errors = 0;
|
|
||||||
my $_32bit = "";
|
|
||||||
my $tags = ""; # build tags
|
|
||||||
my $aix = 0;
|
|
||||||
my $solaris = 0;
|
|
||||||
|
|
||||||
binmode STDOUT;
|
|
||||||
|
|
||||||
if($ARGV[0] eq "-b32") {
|
|
||||||
$_32bit = "big-endian";
|
|
||||||
shift;
|
|
||||||
} elsif($ARGV[0] eq "-l32") {
|
|
||||||
$_32bit = "little-endian";
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-aix") {
|
|
||||||
$aix = 1;
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-tags") {
|
|
||||||
shift;
|
|
||||||
$tags = $ARGV[0];
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($ARGV[0] =~ /^-/) {
|
|
||||||
print STDERR "usage: mksyscall_aix.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parseparamlist($) {
|
|
||||||
my ($list) = @_;
|
|
||||||
$list =~ s/^\s*//;
|
|
||||||
$list =~ s/\s*$//;
|
|
||||||
if($list eq "") {
|
|
||||||
return ();
|
|
||||||
}
|
|
||||||
return split(/\s*,\s*/, $list);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parseparam($) {
|
|
||||||
my ($p) = @_;
|
|
||||||
if($p !~ /^(\S*) (\S*)$/) {
|
|
||||||
print STDERR "$ARGV:$.: malformed parameter: $p\n";
|
|
||||||
$errors = 1;
|
|
||||||
return ("xx", "int");
|
|
||||||
}
|
|
||||||
return ($1, $2);
|
|
||||||
}
|
|
||||||
|
|
||||||
my $package = "";
|
|
||||||
my $text = "";
|
|
||||||
my $c_extern = "/*\n#include <stdint.h>\n";
|
|
||||||
my @vars = ();
|
|
||||||
while(<>) {
|
|
||||||
chomp;
|
|
||||||
s/\s+/ /g;
|
|
||||||
s/^\s+//;
|
|
||||||
s/\s+$//;
|
|
||||||
$package = $1 if !$package && /^package (\S+)$/;
|
|
||||||
my $nonblock = /^\/\/sysnb /;
|
|
||||||
next if !/^\/\/sys / && !$nonblock;
|
|
||||||
|
|
||||||
# Line must be of the form
|
|
||||||
# func Open(path string, mode int, perm int) (fd int, err error)
|
|
||||||
# Split into name, in params, out params.
|
|
||||||
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
|
|
||||||
print STDERR "$ARGV:$.: malformed //sys declaration\n";
|
|
||||||
$errors = 1;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
|
|
||||||
|
|
||||||
# Split argument lists on comma.
|
|
||||||
my @in = parseparamlist($in);
|
|
||||||
my @out = parseparamlist($out);
|
|
||||||
|
|
||||||
$in = join(', ', @in);
|
|
||||||
$out = join(', ', @out);
|
|
||||||
|
|
||||||
# Try in vain to keep people from editing this file.
|
|
||||||
# The theory is that they jump into the middle of the file
|
|
||||||
# without reading the header.
|
|
||||||
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
|
|
||||||
|
|
||||||
# Check if value return, err return available
|
|
||||||
my $errvar = "";
|
|
||||||
my $retvar = "";
|
|
||||||
my $rettype = "";
|
|
||||||
foreach my $p (@out) {
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
if($type eq "error") {
|
|
||||||
$errvar = $name;
|
|
||||||
} else {
|
|
||||||
$retvar = $name;
|
|
||||||
$rettype = $type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# System call name.
|
|
||||||
#if($func ne "fcntl") {
|
|
||||||
|
|
||||||
if($sysname eq "") {
|
|
||||||
$sysname = "$func";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g;
|
|
||||||
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
|
|
||||||
|
|
||||||
my $C_rettype = "";
|
|
||||||
if($rettype eq "unsafe.Pointer") {
|
|
||||||
$C_rettype = "uintptr_t";
|
|
||||||
} elsif($rettype eq "uintptr") {
|
|
||||||
$C_rettype = "uintptr_t";
|
|
||||||
} elsif($rettype =~ /^_/) {
|
|
||||||
$C_rettype = "uintptr_t";
|
|
||||||
} elsif($rettype eq "int") {
|
|
||||||
$C_rettype = "int";
|
|
||||||
} elsif($rettype eq "int32") {
|
|
||||||
$C_rettype = "int";
|
|
||||||
} elsif($rettype eq "int64") {
|
|
||||||
$C_rettype = "long long";
|
|
||||||
} elsif($rettype eq "uint32") {
|
|
||||||
$C_rettype = "unsigned int";
|
|
||||||
} elsif($rettype eq "uint64") {
|
|
||||||
$C_rettype = "unsigned long long";
|
|
||||||
} else {
|
|
||||||
$C_rettype = "int";
|
|
||||||
}
|
|
||||||
if($sysname eq "exit") {
|
|
||||||
$C_rettype = "void";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Change types to c
|
|
||||||
my @c_in = ();
|
|
||||||
foreach my $p (@in) {
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
if($type =~ /^\*/) {
|
|
||||||
push @c_in, "uintptr_t";
|
|
||||||
} elsif($type eq "string") {
|
|
||||||
push @c_in, "uintptr_t";
|
|
||||||
} elsif($type =~ /^\[\](.*)/) {
|
|
||||||
push @c_in, "uintptr_t", "size_t";
|
|
||||||
} elsif($type eq "unsafe.Pointer") {
|
|
||||||
push @c_in, "uintptr_t";
|
|
||||||
} elsif($type eq "uintptr") {
|
|
||||||
push @c_in, "uintptr_t";
|
|
||||||
} elsif($type =~ /^_/) {
|
|
||||||
push @c_in, "uintptr_t";
|
|
||||||
} elsif($type eq "int") {
|
|
||||||
push @c_in, "int";
|
|
||||||
} elsif($type eq "int32") {
|
|
||||||
push @c_in, "int";
|
|
||||||
} elsif($type eq "int64") {
|
|
||||||
push @c_in, "long long";
|
|
||||||
} elsif($type eq "uint32") {
|
|
||||||
push @c_in, "unsigned int";
|
|
||||||
} elsif($type eq "uint64") {
|
|
||||||
push @c_in, "unsigned long long";
|
|
||||||
} else {
|
|
||||||
push @c_in, "int";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($func ne "fcntl" && $func ne "FcntlInt" && $func ne "readlen" && $func ne "writelen") {
|
|
||||||
# Imports of system calls from libc
|
|
||||||
$c_extern .= "$C_rettype $sysname";
|
|
||||||
my $c_in = join(', ', @c_in);
|
|
||||||
$c_extern .= "($c_in);\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# So file name.
|
|
||||||
if($aix) {
|
|
||||||
if($modname eq "") {
|
|
||||||
$modname = "libc.a/shr_64.o";
|
|
||||||
} else {
|
|
||||||
print STDERR "$func: only syscall using libc are available\n";
|
|
||||||
$errors = 1;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my $strconvfunc = "C.CString";
|
|
||||||
my $strconvtype = "*byte";
|
|
||||||
|
|
||||||
# Go function header.
|
|
||||||
if($out ne "") {
|
|
||||||
$out = " ($out)";
|
|
||||||
}
|
|
||||||
if($text ne "") {
|
|
||||||
$text .= "\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ;
|
|
||||||
|
|
||||||
# Prepare arguments to call.
|
|
||||||
my @args = ();
|
|
||||||
my $n = 0;
|
|
||||||
my $arg_n = 0;
|
|
||||||
foreach my $p (@in) {
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
if($type =~ /^\*/) {
|
|
||||||
push @args, "C.uintptr_t(uintptr(unsafe.Pointer($name)))";
|
|
||||||
} elsif($type eq "string" && $errvar ne "") {
|
|
||||||
$text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n";
|
|
||||||
push @args, "C.uintptr_t(_p$n)";
|
|
||||||
$n++;
|
|
||||||
} elsif($type eq "string") {
|
|
||||||
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
|
|
||||||
$text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n";
|
|
||||||
push @args, "C.uintptr_t(_p$n)";
|
|
||||||
$n++;
|
|
||||||
} elsif($type =~ /^\[\](.*)/) {
|
|
||||||
# Convert slice into pointer, length.
|
|
||||||
# Have to be careful not to take address of &a[0] if len == 0:
|
|
||||||
# pass nil in that case.
|
|
||||||
$text .= "\tvar _p$n *$1\n";
|
|
||||||
$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
|
|
||||||
push @args, "C.uintptr_t(uintptr(unsafe.Pointer(_p$n)))";
|
|
||||||
$n++;
|
|
||||||
$text .= "\tvar _p$n int\n";
|
|
||||||
$text .= "\t_p$n = len($name)\n";
|
|
||||||
push @args, "C.size_t(_p$n)";
|
|
||||||
$n++;
|
|
||||||
} elsif($type eq "int64" && $_32bit ne "") {
|
|
||||||
if($_32bit eq "big-endian") {
|
|
||||||
push @args, "uintptr($name >> 32)", "uintptr($name)";
|
|
||||||
} else {
|
|
||||||
push @args, "uintptr($name)", "uintptr($name >> 32)";
|
|
||||||
}
|
|
||||||
$n++;
|
|
||||||
} elsif($type eq "bool") {
|
|
||||||
$text .= "\tvar _p$n uint32\n";
|
|
||||||
$text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
|
|
||||||
push @args, "_p$n";
|
|
||||||
$n++;
|
|
||||||
} elsif($type =~ /^_/) {
|
|
||||||
push @args, "C.uintptr_t(uintptr($name))";
|
|
||||||
} elsif($type eq "unsafe.Pointer") {
|
|
||||||
push @args, "C.uintptr_t(uintptr($name))";
|
|
||||||
} elsif($type eq "int") {
|
|
||||||
if (($arg_n == 2) && (($func eq "readlen") || ($func eq "writelen"))) {
|
|
||||||
push @args, "C.size_t($name)";
|
|
||||||
} elsif ($arg_n == 0 && $func eq "fcntl") {
|
|
||||||
push @args, "C.uintptr_t($name)";
|
|
||||||
} elsif (($arg_n == 2) && (($func eq "fcntl") || ($func eq "FcntlInt"))) {
|
|
||||||
push @args, "C.uintptr_t($name)";
|
|
||||||
} else {
|
|
||||||
push @args, "C.int($name)";
|
|
||||||
}
|
|
||||||
} elsif($type eq "int32") {
|
|
||||||
push @args, "C.int($name)";
|
|
||||||
} elsif($type eq "int64") {
|
|
||||||
push @args, "C.longlong($name)";
|
|
||||||
} elsif($type eq "uint32") {
|
|
||||||
push @args, "C.uint($name)";
|
|
||||||
} elsif($type eq "uint64") {
|
|
||||||
push @args, "C.ulonglong($name)";
|
|
||||||
} elsif($type eq "uintptr") {
|
|
||||||
push @args, "C.uintptr_t($name)";
|
|
||||||
} else {
|
|
||||||
push @args, "C.int($name)";
|
|
||||||
}
|
|
||||||
$arg_n++;
|
|
||||||
}
|
|
||||||
my $nargs = @args;
|
|
||||||
|
|
||||||
|
|
||||||
# Determine which form to use; pad args with zeros.
|
|
||||||
if ($nonblock) {
|
|
||||||
}
|
|
||||||
|
|
||||||
my $args = join(', ', @args);
|
|
||||||
my $call = "";
|
|
||||||
if ($sysname eq "exit") {
|
|
||||||
if ($errvar ne "") {
|
|
||||||
$call .= "er :=";
|
|
||||||
} else {
|
|
||||||
$call .= "";
|
|
||||||
}
|
|
||||||
} elsif ($errvar ne "") {
|
|
||||||
$call .= "r0,er :=";
|
|
||||||
} elsif ($retvar ne "") {
|
|
||||||
$call .= "r0,_ :=";
|
|
||||||
} else {
|
|
||||||
$call .= ""
|
|
||||||
}
|
|
||||||
$call .= "C.$sysname($args)";
|
|
||||||
|
|
||||||
# Assign return values.
|
|
||||||
my $body = "";
|
|
||||||
my $failexpr = "";
|
|
||||||
|
|
||||||
for(my $i=0; $i<@out; $i++) {
|
|
||||||
my $p = $out[$i];
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
my $reg = "";
|
|
||||||
if($name eq "err") {
|
|
||||||
$reg = "e1";
|
|
||||||
} else {
|
|
||||||
$reg = "r0";
|
|
||||||
}
|
|
||||||
if($reg ne "e1" ) {
|
|
||||||
$body .= "\t$name = $type($reg)\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# verify return
|
|
||||||
if ($sysname ne "exit" && $errvar ne "") {
|
|
||||||
if ($C_rettype =~ /^uintptr/) {
|
|
||||||
$body .= "\tif \(uintptr\(r0\) ==\^uintptr\(0\) && er != nil\) {\n";
|
|
||||||
$body .= "\t\t$errvar = er\n";
|
|
||||||
$body .= "\t}\n";
|
|
||||||
} else {
|
|
||||||
$body .= "\tif \(r0 ==-1 && er != nil\) {\n";
|
|
||||||
$body .= "\t\t$errvar = er\n";
|
|
||||||
$body .= "\t}\n";
|
|
||||||
}
|
|
||||||
} elsif ($errvar ne "") {
|
|
||||||
$body .= "\tif \(er != nil\) {\n";
|
|
||||||
$body .= "\t\t$errvar = er\n";
|
|
||||||
$body .= "\t}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= "\t$call\n";
|
|
||||||
$text .= $body;
|
|
||||||
|
|
||||||
$text .= "\treturn\n";
|
|
||||||
$text .= "}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($errors) {
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
// $cmdline
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build $tags
|
|
||||||
|
|
||||||
package $package
|
|
||||||
|
|
||||||
|
|
||||||
$c_extern
|
|
||||||
*/
|
|
||||||
import "C"
|
|
||||||
import (
|
|
||||||
"unsafe"
|
|
||||||
"syscall"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
|
|
||||||
|
|
||||||
chomp($_=<<EOF);
|
|
||||||
|
|
||||||
$text
|
|
||||||
EOF
|
|
||||||
print $_;
|
|
||||||
exit 0;
|
|
||||||
415
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go
generated
vendored
Normal file
415
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,415 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
/*
|
||||||
|
This program reads a file containing function prototypes
|
||||||
|
(like syscall_aix.go) and generates system call bodies.
|
||||||
|
The prototypes are marked by lines beginning with "//sys"
|
||||||
|
and read like func declarations if //sys is replaced by func, but:
|
||||||
|
* The parameter lists must give a name for each argument.
|
||||||
|
This includes return parameters.
|
||||||
|
* The parameter lists must give a type for each argument:
|
||||||
|
the (x, y, z int) shorthand is not allowed.
|
||||||
|
* If the return parameter is an error number, it must be named err.
|
||||||
|
* If go func name needs to be different than its libc name,
|
||||||
|
* or the function is not in libc, name could be specified
|
||||||
|
* at the end, after "=" sign, like
|
||||||
|
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||||
|
*/
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
b32 = flag.Bool("b32", false, "32bit big-endian")
|
||||||
|
l32 = flag.Bool("l32", false, "32bit little-endian")
|
||||||
|
aix = flag.Bool("aix", false, "aix")
|
||||||
|
tags = flag.String("tags", "", "build tags")
|
||||||
|
)
|
||||||
|
|
||||||
|
// cmdLine returns this programs's commandline arguments
|
||||||
|
func cmdLine() string {
|
||||||
|
return "go run mksyscall_aix_ppc.go " + strings.Join(os.Args[1:], " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// buildTags returns build tags
|
||||||
|
func buildTags() string {
|
||||||
|
return *tags
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is function parameter
|
||||||
|
type Param struct {
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
}
|
||||||
|
|
||||||
|
// usage prints the program usage
|
||||||
|
func usage() {
|
||||||
|
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseParamList parses parameter list and returns a slice of parameters
|
||||||
|
func parseParamList(list string) []string {
|
||||||
|
list = strings.TrimSpace(list)
|
||||||
|
if list == "" {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
|
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseParam splits a parameter into name and type
|
||||||
|
func parseParam(p string) Param {
|
||||||
|
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
||||||
|
if ps == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
return Param{ps[1], ps[2]}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Usage = usage
|
||||||
|
flag.Parse()
|
||||||
|
if len(flag.Args()) <= 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
||||||
|
usage()
|
||||||
|
}
|
||||||
|
|
||||||
|
endianness := ""
|
||||||
|
if *b32 {
|
||||||
|
endianness = "big-endian"
|
||||||
|
} else if *l32 {
|
||||||
|
endianness = "little-endian"
|
||||||
|
}
|
||||||
|
|
||||||
|
pack := ""
|
||||||
|
text := ""
|
||||||
|
cExtern := "/*\n#include <stdint.h>\n#include <stddef.h>\n"
|
||||||
|
for _, path := range flag.Args() {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
s := bufio.NewScanner(file)
|
||||||
|
for s.Scan() {
|
||||||
|
t := s.Text()
|
||||||
|
t = strings.TrimSpace(t)
|
||||||
|
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
||||||
|
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
|
||||||
|
pack = p[1]
|
||||||
|
}
|
||||||
|
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
||||||
|
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Line must be of the form
|
||||||
|
// func Open(path string, mode int, perm int) (fd int, err error)
|
||||||
|
// Split into name, in params, out params.
|
||||||
|
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
|
||||||
|
if f == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
|
||||||
|
|
||||||
|
// Split argument lists on comma.
|
||||||
|
in := parseParamList(inps)
|
||||||
|
out := parseParamList(outps)
|
||||||
|
|
||||||
|
inps = strings.Join(in, ", ")
|
||||||
|
outps = strings.Join(out, ", ")
|
||||||
|
|
||||||
|
// Try in vain to keep people from editing this file.
|
||||||
|
// The theory is that they jump into the middle of the file
|
||||||
|
// without reading the header.
|
||||||
|
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||||
|
|
||||||
|
// Check if value return, err return available
|
||||||
|
errvar := ""
|
||||||
|
retvar := ""
|
||||||
|
rettype := ""
|
||||||
|
for _, param := range out {
|
||||||
|
p := parseParam(param)
|
||||||
|
if p.Type == "error" {
|
||||||
|
errvar = p.Name
|
||||||
|
} else {
|
||||||
|
retvar = p.Name
|
||||||
|
rettype = p.Type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// System call name.
|
||||||
|
if sysname == "" {
|
||||||
|
sysname = funct
|
||||||
|
}
|
||||||
|
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
||||||
|
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
|
||||||
|
|
||||||
|
cRettype := ""
|
||||||
|
if rettype == "unsafe.Pointer" {
|
||||||
|
cRettype = "uintptr_t"
|
||||||
|
} else if rettype == "uintptr" {
|
||||||
|
cRettype = "uintptr_t"
|
||||||
|
} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
|
||||||
|
cRettype = "uintptr_t"
|
||||||
|
} else if rettype == "int" {
|
||||||
|
cRettype = "int"
|
||||||
|
} else if rettype == "int32" {
|
||||||
|
cRettype = "int"
|
||||||
|
} else if rettype == "int64" {
|
||||||
|
cRettype = "long long"
|
||||||
|
} else if rettype == "uint32" {
|
||||||
|
cRettype = "unsigned int"
|
||||||
|
} else if rettype == "uint64" {
|
||||||
|
cRettype = "unsigned long long"
|
||||||
|
} else {
|
||||||
|
cRettype = "int"
|
||||||
|
}
|
||||||
|
if sysname == "exit" {
|
||||||
|
cRettype = "void"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change p.Types to c
|
||||||
|
var cIn []string
|
||||||
|
for _, param := range in {
|
||||||
|
p := parseParam(param)
|
||||||
|
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if p.Type == "string" {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
cIn = append(cIn, "uintptr_t", "size_t")
|
||||||
|
} else if p.Type == "unsafe.Pointer" {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if p.Type == "uintptr" {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if p.Type == "int" {
|
||||||
|
cIn = append(cIn, "int")
|
||||||
|
} else if p.Type == "int32" {
|
||||||
|
cIn = append(cIn, "int")
|
||||||
|
} else if p.Type == "int64" {
|
||||||
|
cIn = append(cIn, "long long")
|
||||||
|
} else if p.Type == "uint32" {
|
||||||
|
cIn = append(cIn, "unsigned int")
|
||||||
|
} else if p.Type == "uint64" {
|
||||||
|
cIn = append(cIn, "unsigned long long")
|
||||||
|
} else {
|
||||||
|
cIn = append(cIn, "int")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" {
|
||||||
|
if sysname == "select" {
|
||||||
|
// select is a keyword of Go. Its name is
|
||||||
|
// changed to c_select.
|
||||||
|
cExtern += "#define c_select select\n"
|
||||||
|
}
|
||||||
|
// Imports of system calls from libc
|
||||||
|
cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
|
||||||
|
cIn := strings.Join(cIn, ", ")
|
||||||
|
cExtern += fmt.Sprintf("(%s);\n", cIn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// So file name.
|
||||||
|
if *aix {
|
||||||
|
if modname == "" {
|
||||||
|
modname = "libc.a/shr_64.o"
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
strconvfunc := "C.CString"
|
||||||
|
|
||||||
|
// Go function header.
|
||||||
|
if outps != "" {
|
||||||
|
outps = fmt.Sprintf(" (%s)", outps)
|
||||||
|
}
|
||||||
|
if text != "" {
|
||||||
|
text += "\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
|
||||||
|
|
||||||
|
// Prepare arguments to Syscall.
|
||||||
|
var args []string
|
||||||
|
n := 0
|
||||||
|
argN := 0
|
||||||
|
for _, param := range in {
|
||||||
|
p := parseParam(param)
|
||||||
|
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
args = append(args, "C.uintptr_t(uintptr(unsafe.Pointer("+p.Name+")))")
|
||||||
|
} else if p.Type == "string" && errvar != "" {
|
||||||
|
text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
|
||||||
|
args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
||||||
|
n++
|
||||||
|
} else if p.Type == "string" {
|
||||||
|
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
||||||
|
text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
|
||||||
|
args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
||||||
|
n++
|
||||||
|
} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
|
||||||
|
// Convert slice into pointer, length.
|
||||||
|
// Have to be careful not to take address of &a[0] if len == 0:
|
||||||
|
// pass nil in that case.
|
||||||
|
text += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
|
||||||
|
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
|
||||||
|
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(unsafe.Pointer(_p%d)))", n))
|
||||||
|
n++
|
||||||
|
text += fmt.Sprintf("\tvar _p%d int\n", n)
|
||||||
|
text += fmt.Sprintf("\t_p%d = len(%s)\n", n, p.Name)
|
||||||
|
args = append(args, fmt.Sprintf("C.size_t(_p%d)", n))
|
||||||
|
n++
|
||||||
|
} else if p.Type == "int64" && endianness != "" {
|
||||||
|
if endianness == "big-endian" {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||||
|
}
|
||||||
|
n++
|
||||||
|
} else if p.Type == "bool" {
|
||||||
|
text += fmt.Sprintf("\tvar _p%d uint32\n", n)
|
||||||
|
text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
|
||||||
|
args = append(args, fmt.Sprintf("_p%d", n))
|
||||||
|
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
|
||||||
|
} else if p.Type == "unsafe.Pointer" {
|
||||||
|
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
|
||||||
|
} else if p.Type == "int" {
|
||||||
|
if (argN == 2) && ((funct == "readlen") || (funct == "writelen")) {
|
||||||
|
args = append(args, fmt.Sprintf("C.size_t(%s)", p.Name))
|
||||||
|
} else if argN == 0 && funct == "fcntl" {
|
||||||
|
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||||
|
} else if (argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt")) {
|
||||||
|
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
||||||
|
}
|
||||||
|
} else if p.Type == "int32" {
|
||||||
|
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
||||||
|
} else if p.Type == "int64" {
|
||||||
|
args = append(args, fmt.Sprintf("C.longlong(%s)", p.Name))
|
||||||
|
} else if p.Type == "uint32" {
|
||||||
|
args = append(args, fmt.Sprintf("C.uint(%s)", p.Name))
|
||||||
|
} else if p.Type == "uint64" {
|
||||||
|
args = append(args, fmt.Sprintf("C.ulonglong(%s)", p.Name))
|
||||||
|
} else if p.Type == "uintptr" {
|
||||||
|
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
|
||||||
|
}
|
||||||
|
argN++
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actual call.
|
||||||
|
arglist := strings.Join(args, ", ")
|
||||||
|
call := ""
|
||||||
|
if sysname == "exit" {
|
||||||
|
if errvar != "" {
|
||||||
|
call += "er :="
|
||||||
|
} else {
|
||||||
|
call += ""
|
||||||
|
}
|
||||||
|
} else if errvar != "" {
|
||||||
|
call += "r0,er :="
|
||||||
|
} else if retvar != "" {
|
||||||
|
call += "r0,_ :="
|
||||||
|
} else {
|
||||||
|
call += ""
|
||||||
|
}
|
||||||
|
if sysname == "select" {
|
||||||
|
// select is a keyword of Go. Its name is
|
||||||
|
// changed to c_select.
|
||||||
|
call += fmt.Sprintf("C.c_%s(%s)", sysname, arglist)
|
||||||
|
} else {
|
||||||
|
call += fmt.Sprintf("C.%s(%s)", sysname, arglist)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign return values.
|
||||||
|
body := ""
|
||||||
|
for i := 0; i < len(out); i++ {
|
||||||
|
p := parseParam(out[i])
|
||||||
|
reg := ""
|
||||||
|
if p.Name == "err" {
|
||||||
|
reg = "e1"
|
||||||
|
} else {
|
||||||
|
reg = "r0"
|
||||||
|
}
|
||||||
|
if reg != "e1" {
|
||||||
|
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify return
|
||||||
|
if sysname != "exit" && errvar != "" {
|
||||||
|
if regexp.MustCompile(`^uintptr`).FindStringSubmatch(cRettype) != nil {
|
||||||
|
body += "\tif (uintptr(r0) ==^uintptr(0) && er != nil) {\n"
|
||||||
|
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
||||||
|
body += "\t}\n"
|
||||||
|
} else {
|
||||||
|
body += "\tif (r0 ==-1 && er != nil) {\n"
|
||||||
|
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
||||||
|
body += "\t}\n"
|
||||||
|
}
|
||||||
|
} else if errvar != "" {
|
||||||
|
body += "\tif (er != nil) {\n"
|
||||||
|
body += fmt.Sprintf("\t\t%s = er\n", errvar)
|
||||||
|
body += "\t}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
text += fmt.Sprintf("\t%s\n", call)
|
||||||
|
text += body
|
||||||
|
|
||||||
|
text += "\treturn\n"
|
||||||
|
text += "}\n"
|
||||||
|
}
|
||||||
|
if err := s.Err(); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
file.Close()
|
||||||
|
}
|
||||||
|
imp := ""
|
||||||
|
if pack != "unix" {
|
||||||
|
imp = "import \"golang.org/x/sys/unix\"\n"
|
||||||
|
|
||||||
|
}
|
||||||
|
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, cExtern, imp, text)
|
||||||
|
}
|
||||||
|
|
||||||
|
const srcTemplate = `// %s
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build %s
|
||||||
|
|
||||||
|
package %s
|
||||||
|
|
||||||
|
|
||||||
|
%s
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
%s
|
||||||
|
|
||||||
|
%s
|
||||||
|
`
|
||||||
614
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go
generated
vendored
Normal file
614
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go
generated
vendored
Normal file
|
|
@ -0,0 +1,614 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
/*
|
||||||
|
This program reads a file containing function prototypes
|
||||||
|
(like syscall_aix.go) and generates system call bodies.
|
||||||
|
The prototypes are marked by lines beginning with "//sys"
|
||||||
|
and read like func declarations if //sys is replaced by func, but:
|
||||||
|
* The parameter lists must give a name for each argument.
|
||||||
|
This includes return parameters.
|
||||||
|
* The parameter lists must give a type for each argument:
|
||||||
|
the (x, y, z int) shorthand is not allowed.
|
||||||
|
* If the return parameter is an error number, it must be named err.
|
||||||
|
* If go func name needs to be different than its libc name,
|
||||||
|
* or the function is not in libc, name could be specified
|
||||||
|
* at the end, after "=" sign, like
|
||||||
|
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||||
|
|
||||||
|
|
||||||
|
This program will generate three files and handle both gc and gccgo implementation:
|
||||||
|
- zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation)
|
||||||
|
- zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6
|
||||||
|
- zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type.
|
||||||
|
|
||||||
|
The generated code looks like this
|
||||||
|
|
||||||
|
zsyscall_aix_ppc64.go
|
||||||
|
func asyscall(...) (n int, err error) {
|
||||||
|
// Pointer Creation
|
||||||
|
r1, e1 := callasyscall(...)
|
||||||
|
// Type Conversion
|
||||||
|
// Error Handler
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
zsyscall_aix_ppc64_gc.go
|
||||||
|
//go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o"
|
||||||
|
//go:linkname libc_asyscall libc_asyscall
|
||||||
|
var asyscall syscallFunc
|
||||||
|
|
||||||
|
func callasyscall(...) (r1 uintptr, e1 Errno) {
|
||||||
|
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... )
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
zsyscall_aix_ppc64_ggcgo.go
|
||||||
|
|
||||||
|
// int asyscall(...)
|
||||||
|
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
func callasyscall(...) (r1 uintptr, e1 Errno) {
|
||||||
|
r1 = uintptr(C.asyscall(...))
|
||||||
|
e1 = syscall.GetErrno()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
b32 = flag.Bool("b32", false, "32bit big-endian")
|
||||||
|
l32 = flag.Bool("l32", false, "32bit little-endian")
|
||||||
|
aix = flag.Bool("aix", false, "aix")
|
||||||
|
tags = flag.String("tags", "", "build tags")
|
||||||
|
)
|
||||||
|
|
||||||
|
// cmdLine returns this programs's commandline arguments
|
||||||
|
func cmdLine() string {
|
||||||
|
return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// buildTags returns build tags
|
||||||
|
func buildTags() string {
|
||||||
|
return *tags
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is function parameter
|
||||||
|
type Param struct {
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
}
|
||||||
|
|
||||||
|
// usage prints the program usage
|
||||||
|
func usage() {
|
||||||
|
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc64.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseParamList parses parameter list and returns a slice of parameters
|
||||||
|
func parseParamList(list string) []string {
|
||||||
|
list = strings.TrimSpace(list)
|
||||||
|
if list == "" {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
|
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseParam splits a parameter into name and type
|
||||||
|
func parseParam(p string) Param {
|
||||||
|
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
||||||
|
if ps == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
return Param{ps[1], ps[2]}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Usage = usage
|
||||||
|
flag.Parse()
|
||||||
|
if len(flag.Args()) <= 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
||||||
|
usage()
|
||||||
|
}
|
||||||
|
|
||||||
|
endianness := ""
|
||||||
|
if *b32 {
|
||||||
|
endianness = "big-endian"
|
||||||
|
} else if *l32 {
|
||||||
|
endianness = "little-endian"
|
||||||
|
}
|
||||||
|
|
||||||
|
pack := ""
|
||||||
|
// GCCGO
|
||||||
|
textgccgo := ""
|
||||||
|
cExtern := "/*\n#include <stdint.h>\n"
|
||||||
|
// GC
|
||||||
|
textgc := ""
|
||||||
|
dynimports := ""
|
||||||
|
linknames := ""
|
||||||
|
var vars []string
|
||||||
|
// COMMON
|
||||||
|
textcommon := ""
|
||||||
|
for _, path := range flag.Args() {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
s := bufio.NewScanner(file)
|
||||||
|
for s.Scan() {
|
||||||
|
t := s.Text()
|
||||||
|
t = strings.TrimSpace(t)
|
||||||
|
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
||||||
|
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
|
||||||
|
pack = p[1]
|
||||||
|
}
|
||||||
|
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
||||||
|
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Line must be of the form
|
||||||
|
// func Open(path string, mode int, perm int) (fd int, err error)
|
||||||
|
// Split into name, in params, out params.
|
||||||
|
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
|
||||||
|
if f == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
|
||||||
|
|
||||||
|
// Split argument lists on comma.
|
||||||
|
in := parseParamList(inps)
|
||||||
|
out := parseParamList(outps)
|
||||||
|
|
||||||
|
inps = strings.Join(in, ", ")
|
||||||
|
outps = strings.Join(out, ", ")
|
||||||
|
|
||||||
|
if sysname == "" {
|
||||||
|
sysname = funct
|
||||||
|
}
|
||||||
|
|
||||||
|
onlyCommon := false
|
||||||
|
if funct == "readlen" || funct == "writelen" || funct == "FcntlInt" || funct == "FcntlFlock" {
|
||||||
|
// This function call another syscall which is already implemented.
|
||||||
|
// Therefore, the gc and gccgo part must not be generated.
|
||||||
|
onlyCommon = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try in vain to keep people from editing this file.
|
||||||
|
// The theory is that they jump into the middle of the file
|
||||||
|
// without reading the header.
|
||||||
|
|
||||||
|
textcommon += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||||
|
if !onlyCommon {
|
||||||
|
textgccgo += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||||
|
textgc += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if value return, err return available
|
||||||
|
errvar := ""
|
||||||
|
rettype := ""
|
||||||
|
for _, param := range out {
|
||||||
|
p := parseParam(param)
|
||||||
|
if p.Type == "error" {
|
||||||
|
errvar = p.Name
|
||||||
|
} else {
|
||||||
|
rettype = p.Type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
|
||||||
|
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
|
||||||
|
|
||||||
|
// GCCGO Prototype return type
|
||||||
|
cRettype := ""
|
||||||
|
if rettype == "unsafe.Pointer" {
|
||||||
|
cRettype = "uintptr_t"
|
||||||
|
} else if rettype == "uintptr" {
|
||||||
|
cRettype = "uintptr_t"
|
||||||
|
} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
|
||||||
|
cRettype = "uintptr_t"
|
||||||
|
} else if rettype == "int" {
|
||||||
|
cRettype = "int"
|
||||||
|
} else if rettype == "int32" {
|
||||||
|
cRettype = "int"
|
||||||
|
} else if rettype == "int64" {
|
||||||
|
cRettype = "long long"
|
||||||
|
} else if rettype == "uint32" {
|
||||||
|
cRettype = "unsigned int"
|
||||||
|
} else if rettype == "uint64" {
|
||||||
|
cRettype = "unsigned long long"
|
||||||
|
} else {
|
||||||
|
cRettype = "int"
|
||||||
|
}
|
||||||
|
if sysname == "exit" {
|
||||||
|
cRettype = "void"
|
||||||
|
}
|
||||||
|
|
||||||
|
// GCCGO Prototype arguments type
|
||||||
|
var cIn []string
|
||||||
|
for i, param := range in {
|
||||||
|
p := parseParam(param)
|
||||||
|
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if p.Type == "string" {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
cIn = append(cIn, "uintptr_t", "size_t")
|
||||||
|
} else if p.Type == "unsafe.Pointer" {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if p.Type == "uintptr" {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else if p.Type == "int" {
|
||||||
|
if (i == 0 || i == 2) && funct == "fcntl" {
|
||||||
|
// These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock
|
||||||
|
cIn = append(cIn, "uintptr_t")
|
||||||
|
} else {
|
||||||
|
cIn = append(cIn, "int")
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if p.Type == "int32" {
|
||||||
|
cIn = append(cIn, "int")
|
||||||
|
} else if p.Type == "int64" {
|
||||||
|
cIn = append(cIn, "long long")
|
||||||
|
} else if p.Type == "uint32" {
|
||||||
|
cIn = append(cIn, "unsigned int")
|
||||||
|
} else if p.Type == "uint64" {
|
||||||
|
cIn = append(cIn, "unsigned long long")
|
||||||
|
} else {
|
||||||
|
cIn = append(cIn, "int")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !onlyCommon {
|
||||||
|
// GCCGO Prototype Generation
|
||||||
|
// Imports of system calls from libc
|
||||||
|
if sysname == "select" {
|
||||||
|
// select is a keyword of Go. Its name is
|
||||||
|
// changed to c_select.
|
||||||
|
cExtern += "#define c_select select\n"
|
||||||
|
}
|
||||||
|
cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
|
||||||
|
cIn := strings.Join(cIn, ", ")
|
||||||
|
cExtern += fmt.Sprintf("(%s);\n", cIn)
|
||||||
|
}
|
||||||
|
// GC Library name
|
||||||
|
if modname == "" {
|
||||||
|
modname = "libc.a/shr_64.o"
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
sysvarname := fmt.Sprintf("libc_%s", sysname)
|
||||||
|
|
||||||
|
if !onlyCommon {
|
||||||
|
// GC Runtime import of function to allow cross-platform builds.
|
||||||
|
dynimports += fmt.Sprintf("//go:cgo_import_dynamic %s %s \"%s\"\n", sysvarname, sysname, modname)
|
||||||
|
// GC Link symbol to proc address variable.
|
||||||
|
linknames += fmt.Sprintf("//go:linkname %s %s\n", sysvarname, sysvarname)
|
||||||
|
// GC Library proc address variable.
|
||||||
|
vars = append(vars, sysvarname)
|
||||||
|
}
|
||||||
|
|
||||||
|
strconvfunc := "BytePtrFromString"
|
||||||
|
strconvtype := "*byte"
|
||||||
|
|
||||||
|
// Go function header.
|
||||||
|
if outps != "" {
|
||||||
|
outps = fmt.Sprintf(" (%s)", outps)
|
||||||
|
}
|
||||||
|
if textcommon != "" {
|
||||||
|
textcommon += "\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
textcommon += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
|
||||||
|
|
||||||
|
// Prepare arguments tocall.
|
||||||
|
var argscommon []string // Arguments in the common part
|
||||||
|
var argscall []string // Arguments for call prototype
|
||||||
|
var argsgc []string // Arguments for gc call (with syscall6)
|
||||||
|
var argsgccgo []string // Arguments for gccgo call (with C.name_of_syscall)
|
||||||
|
n := 0
|
||||||
|
argN := 0
|
||||||
|
for _, param := range in {
|
||||||
|
p := parseParam(param)
|
||||||
|
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(%s))", p.Name))
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
||||||
|
argsgc = append(argsgc, p.Name)
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||||
|
} else if p.Type == "string" && errvar != "" {
|
||||||
|
textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
||||||
|
textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
|
||||||
|
textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
||||||
|
|
||||||
|
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||||
|
argscall = append(argscall, fmt.Sprintf("_p%d uintptr ", n))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
||||||
|
n++
|
||||||
|
} else if p.Type == "string" {
|
||||||
|
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
||||||
|
textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
||||||
|
textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
|
||||||
|
textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
||||||
|
|
||||||
|
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||||
|
argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
|
||||||
|
n++
|
||||||
|
} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
|
||||||
|
// Convert slice into pointer, length.
|
||||||
|
// Have to be careful not to take address of &a[0] if len == 0:
|
||||||
|
// pass nil in that case.
|
||||||
|
textcommon += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
|
||||||
|
textcommon += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
|
||||||
|
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("len(%s)", p.Name))
|
||||||
|
argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n), fmt.Sprintf("_lenp%d int", n))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("_p%d", n), fmt.Sprintf("uintptr(_lenp%d)", n))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n), fmt.Sprintf("C.size_t(_lenp%d)", n))
|
||||||
|
n++
|
||||||
|
} else if p.Type == "int64" && endianness != "" {
|
||||||
|
fmt.Fprintf(os.Stderr, path+":"+funct+" uses int64 with 32 bits mode. Case not yet implemented\n")
|
||||||
|
} else if p.Type == "bool" {
|
||||||
|
fmt.Fprintf(os.Stderr, path+":"+funct+" uses bool. Case not yet implemented\n")
|
||||||
|
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil || p.Type == "unsafe.Pointer" {
|
||||||
|
argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
||||||
|
argsgc = append(argsgc, p.Name)
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||||
|
} else if p.Type == "int" {
|
||||||
|
if (argN == 0 || argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt") || (funct == "FcntlFlock")) {
|
||||||
|
// These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock
|
||||||
|
argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
||||||
|
argsgc = append(argsgc, p.Name)
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||||
|
|
||||||
|
} else {
|
||||||
|
argscommon = append(argscommon, p.Name)
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
||||||
|
}
|
||||||
|
} else if p.Type == "int32" {
|
||||||
|
argscommon = append(argscommon, p.Name)
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s int32", p.Name))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
||||||
|
} else if p.Type == "int64" {
|
||||||
|
argscommon = append(argscommon, p.Name)
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s int64", p.Name))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.longlong(%s)", p.Name))
|
||||||
|
} else if p.Type == "uint32" {
|
||||||
|
argscommon = append(argscommon, p.Name)
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s uint32", p.Name))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uint(%s)", p.Name))
|
||||||
|
} else if p.Type == "uint64" {
|
||||||
|
argscommon = append(argscommon, p.Name)
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s uint64", p.Name))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.ulonglong(%s)", p.Name))
|
||||||
|
} else if p.Type == "uintptr" {
|
||||||
|
argscommon = append(argscommon, p.Name)
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
|
||||||
|
argsgc = append(argsgc, p.Name)
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
|
||||||
|
} else {
|
||||||
|
argscommon = append(argscommon, fmt.Sprintf("int(%s)", p.Name))
|
||||||
|
argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
|
||||||
|
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
|
||||||
|
}
|
||||||
|
argN++
|
||||||
|
}
|
||||||
|
nargs := len(argsgc)
|
||||||
|
|
||||||
|
// COMMON function generation
|
||||||
|
argscommonlist := strings.Join(argscommon, ", ")
|
||||||
|
callcommon := fmt.Sprintf("call%s(%s)", sysname, argscommonlist)
|
||||||
|
ret := []string{"_", "_"}
|
||||||
|
body := ""
|
||||||
|
doErrno := false
|
||||||
|
for i := 0; i < len(out); i++ {
|
||||||
|
p := parseParam(out[i])
|
||||||
|
reg := ""
|
||||||
|
if p.Name == "err" {
|
||||||
|
reg = "e1"
|
||||||
|
ret[1] = reg
|
||||||
|
doErrno = true
|
||||||
|
} else {
|
||||||
|
reg = "r0"
|
||||||
|
ret[0] = reg
|
||||||
|
}
|
||||||
|
if p.Type == "bool" {
|
||||||
|
reg = fmt.Sprintf("%s != 0", reg)
|
||||||
|
}
|
||||||
|
if reg != "e1" {
|
||||||
|
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ret[0] == "_" && ret[1] == "_" {
|
||||||
|
textcommon += fmt.Sprintf("\t%s\n", callcommon)
|
||||||
|
} else {
|
||||||
|
textcommon += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], callcommon)
|
||||||
|
}
|
||||||
|
textcommon += body
|
||||||
|
|
||||||
|
if doErrno {
|
||||||
|
textcommon += "\tif e1 != 0 {\n"
|
||||||
|
textcommon += "\t\terr = errnoErr(e1)\n"
|
||||||
|
textcommon += "\t}\n"
|
||||||
|
}
|
||||||
|
textcommon += "\treturn\n"
|
||||||
|
textcommon += "}\n"
|
||||||
|
|
||||||
|
if onlyCommon {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// CALL Prototype
|
||||||
|
callProto := fmt.Sprintf("func call%s(%s) (r1 uintptr, e1 Errno) {\n", sysname, strings.Join(argscall, ", "))
|
||||||
|
|
||||||
|
// GC function generation
|
||||||
|
asm := "syscall6"
|
||||||
|
if nonblock != nil {
|
||||||
|
asm = "rawSyscall6"
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(argsgc) <= 6 {
|
||||||
|
for len(argsgc) < 6 {
|
||||||
|
argsgc = append(argsgc, "0")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s: too many arguments to system call", funct)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
argsgclist := strings.Join(argsgc, ", ")
|
||||||
|
callgc := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, argsgclist)
|
||||||
|
|
||||||
|
textgc += callProto
|
||||||
|
textgc += fmt.Sprintf("\tr1, _, e1 = %s\n", callgc)
|
||||||
|
textgc += "\treturn\n}\n"
|
||||||
|
|
||||||
|
// GCCGO function generation
|
||||||
|
argsgccgolist := strings.Join(argsgccgo, ", ")
|
||||||
|
var callgccgo string
|
||||||
|
if sysname == "select" {
|
||||||
|
// select is a keyword of Go. Its name is
|
||||||
|
// changed to c_select.
|
||||||
|
callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist)
|
||||||
|
} else {
|
||||||
|
callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist)
|
||||||
|
}
|
||||||
|
textgccgo += callProto
|
||||||
|
textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo)
|
||||||
|
textgccgo += "\te1 = syscall.GetErrno()\n"
|
||||||
|
textgccgo += "\treturn\n}\n"
|
||||||
|
}
|
||||||
|
if err := s.Err(); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
file.Close()
|
||||||
|
}
|
||||||
|
imp := ""
|
||||||
|
if pack != "unix" {
|
||||||
|
imp = "import \"golang.org/x/sys/unix\"\n"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print zsyscall_aix_ppc64.go
|
||||||
|
err := ioutil.WriteFile("zsyscall_aix_ppc64.go",
|
||||||
|
[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), buildTags(), pack, imp, textcommon)),
|
||||||
|
0644)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print zsyscall_aix_ppc64_gc.go
|
||||||
|
vardecls := "\t" + strings.Join(vars, ",\n\t")
|
||||||
|
vardecls += " syscallFunc"
|
||||||
|
err = ioutil.WriteFile("zsyscall_aix_ppc64_gc.go",
|
||||||
|
[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
|
||||||
|
0644)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print zsyscall_aix_ppc64_gccgo.go
|
||||||
|
err = ioutil.WriteFile("zsyscall_aix_ppc64_gccgo.go",
|
||||||
|
[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), buildTags(), pack, cExtern, imp, textgccgo)),
|
||||||
|
0644)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const srcTemplate1 = `// %s
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build %s
|
||||||
|
|
||||||
|
package %s
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
%s
|
||||||
|
|
||||||
|
%s
|
||||||
|
`
|
||||||
|
const srcTemplate2 = `// %s
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build %s
|
||||||
|
// +build !gccgo
|
||||||
|
|
||||||
|
package %s
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
type syscallFunc uintptr
|
||||||
|
|
||||||
|
var (
|
||||||
|
%s
|
||||||
|
)
|
||||||
|
|
||||||
|
// Implemented in runtime/syscall_aix.go.
|
||||||
|
func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
|
||||||
|
%s
|
||||||
|
`
|
||||||
|
const srcTemplate3 = `// %s
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build %s
|
||||||
|
// +build gccgo
|
||||||
|
|
||||||
|
package %s
|
||||||
|
|
||||||
|
%s
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
%s
|
||||||
|
|
||||||
|
%s
|
||||||
|
`
|
||||||
335
vendor/golang.org/x/sys/unix/mksyscall_solaris.go
generated
vendored
Normal file
335
vendor/golang.org/x/sys/unix/mksyscall_solaris.go
generated
vendored
Normal file
|
|
@ -0,0 +1,335 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
/*
|
||||||
|
This program reads a file containing function prototypes
|
||||||
|
(like syscall_solaris.go) and generates system call bodies.
|
||||||
|
The prototypes are marked by lines beginning with "//sys"
|
||||||
|
and read like func declarations if //sys is replaced by func, but:
|
||||||
|
* The parameter lists must give a name for each argument.
|
||||||
|
This includes return parameters.
|
||||||
|
* The parameter lists must give a type for each argument:
|
||||||
|
the (x, y, z int) shorthand is not allowed.
|
||||||
|
* If the return parameter is an error number, it must be named err.
|
||||||
|
* If go func name needs to be different than its libc name,
|
||||||
|
* or the function is not in libc, name could be specified
|
||||||
|
* at the end, after "=" sign, like
|
||||||
|
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||||
|
*/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
b32 = flag.Bool("b32", false, "32bit big-endian")
|
||||||
|
l32 = flag.Bool("l32", false, "32bit little-endian")
|
||||||
|
tags = flag.String("tags", "", "build tags")
|
||||||
|
)
|
||||||
|
|
||||||
|
// cmdLine returns this programs's commandline arguments
|
||||||
|
func cmdLine() string {
|
||||||
|
return "go run mksyscall_solaris.go " + strings.Join(os.Args[1:], " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// buildTags returns build tags
|
||||||
|
func buildTags() string {
|
||||||
|
return *tags
|
||||||
|
}
|
||||||
|
|
||||||
|
// Param is function parameter
|
||||||
|
type Param struct {
|
||||||
|
Name string
|
||||||
|
Type string
|
||||||
|
}
|
||||||
|
|
||||||
|
// usage prints the program usage
|
||||||
|
func usage() {
|
||||||
|
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_solaris.go [-b32 | -l32] [-tags x,y] [file ...]\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseParamList parses parameter list and returns a slice of parameters
|
||||||
|
func parseParamList(list string) []string {
|
||||||
|
list = strings.TrimSpace(list)
|
||||||
|
if list == "" {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
|
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseParam splits a parameter into name and type
|
||||||
|
func parseParam(p string) Param {
|
||||||
|
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
|
||||||
|
if ps == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
return Param{ps[1], ps[2]}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Usage = usage
|
||||||
|
flag.Parse()
|
||||||
|
if len(flag.Args()) <= 0 {
|
||||||
|
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
|
||||||
|
usage()
|
||||||
|
}
|
||||||
|
|
||||||
|
endianness := ""
|
||||||
|
if *b32 {
|
||||||
|
endianness = "big-endian"
|
||||||
|
} else if *l32 {
|
||||||
|
endianness = "little-endian"
|
||||||
|
}
|
||||||
|
|
||||||
|
pack := ""
|
||||||
|
text := ""
|
||||||
|
dynimports := ""
|
||||||
|
linknames := ""
|
||||||
|
var vars []string
|
||||||
|
for _, path := range flag.Args() {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
s := bufio.NewScanner(file)
|
||||||
|
for s.Scan() {
|
||||||
|
t := s.Text()
|
||||||
|
t = strings.TrimSpace(t)
|
||||||
|
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
|
||||||
|
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
|
||||||
|
pack = p[1]
|
||||||
|
}
|
||||||
|
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
|
||||||
|
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Line must be of the form
|
||||||
|
// func Open(path string, mode int, perm int) (fd int, err error)
|
||||||
|
// Split into name, in params, out params.
|
||||||
|
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
|
||||||
|
if f == nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
|
||||||
|
|
||||||
|
// Split argument lists on comma.
|
||||||
|
in := parseParamList(inps)
|
||||||
|
out := parseParamList(outps)
|
||||||
|
|
||||||
|
inps = strings.Join(in, ", ")
|
||||||
|
outps = strings.Join(out, ", ")
|
||||||
|
|
||||||
|
// Try in vain to keep people from editing this file.
|
||||||
|
// The theory is that they jump into the middle of the file
|
||||||
|
// without reading the header.
|
||||||
|
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
|
||||||
|
|
||||||
|
// So file name.
|
||||||
|
if modname == "" {
|
||||||
|
modname = "libc"
|
||||||
|
}
|
||||||
|
|
||||||
|
// System call name.
|
||||||
|
if sysname == "" {
|
||||||
|
sysname = funct
|
||||||
|
}
|
||||||
|
|
||||||
|
// System call pointer variable name.
|
||||||
|
sysvarname := fmt.Sprintf("proc%s", sysname)
|
||||||
|
|
||||||
|
strconvfunc := "BytePtrFromString"
|
||||||
|
strconvtype := "*byte"
|
||||||
|
|
||||||
|
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
|
||||||
|
|
||||||
|
// Runtime import of function to allow cross-platform builds.
|
||||||
|
dynimports += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"%s.so\"\n", sysname, sysname, modname)
|
||||||
|
// Link symbol to proc address variable.
|
||||||
|
linknames += fmt.Sprintf("//go:linkname %s libc_%s\n", sysvarname, sysname)
|
||||||
|
// Library proc address variable.
|
||||||
|
vars = append(vars, sysvarname)
|
||||||
|
|
||||||
|
// Go function header.
|
||||||
|
outlist := strings.Join(out, ", ")
|
||||||
|
if outlist != "" {
|
||||||
|
outlist = fmt.Sprintf(" (%s)", outlist)
|
||||||
|
}
|
||||||
|
if text != "" {
|
||||||
|
text += "\n"
|
||||||
|
}
|
||||||
|
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outlist)
|
||||||
|
|
||||||
|
// Check if err return available
|
||||||
|
errvar := ""
|
||||||
|
for _, param := range out {
|
||||||
|
p := parseParam(param)
|
||||||
|
if p.Type == "error" {
|
||||||
|
errvar = p.Name
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare arguments to Syscall.
|
||||||
|
var args []string
|
||||||
|
n := 0
|
||||||
|
for _, param := range in {
|
||||||
|
p := parseParam(param)
|
||||||
|
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
|
||||||
|
args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
|
||||||
|
} else if p.Type == "string" && errvar != "" {
|
||||||
|
text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
||||||
|
text += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
|
||||||
|
text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||||
|
n++
|
||||||
|
} else if p.Type == "string" {
|
||||||
|
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
|
||||||
|
text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
|
||||||
|
text += fmt.Sprintf("\t_p%d, _ = %s(%s)\n", n, strconvfunc, p.Name)
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
|
||||||
|
n++
|
||||||
|
} else if s := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); s != nil {
|
||||||
|
// Convert slice into pointer, length.
|
||||||
|
// Have to be careful not to take address of &a[0] if len == 0:
|
||||||
|
// pass nil in that case.
|
||||||
|
text += fmt.Sprintf("\tvar _p%d *%s\n", n, s[1])
|
||||||
|
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
|
||||||
|
n++
|
||||||
|
} else if p.Type == "int64" && endianness != "" {
|
||||||
|
if endianness == "big-endian" {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
|
||||||
|
}
|
||||||
|
} else if p.Type == "bool" {
|
||||||
|
text += fmt.Sprintf("\tvar _p%d uint32\n", n)
|
||||||
|
text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(_p%d)", n))
|
||||||
|
n++
|
||||||
|
} else {
|
||||||
|
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nargs := len(args)
|
||||||
|
|
||||||
|
// Determine which form to use; pad args with zeros.
|
||||||
|
asm := "sysvicall6"
|
||||||
|
if nonblock != nil {
|
||||||
|
asm = "rawSysvicall6"
|
||||||
|
}
|
||||||
|
if len(args) <= 6 {
|
||||||
|
for len(args) < 6 {
|
||||||
|
args = append(args, "0")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s: too many arguments to system call\n", path)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actual call.
|
||||||
|
arglist := strings.Join(args, ", ")
|
||||||
|
call := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, arglist)
|
||||||
|
|
||||||
|
// Assign return values.
|
||||||
|
body := ""
|
||||||
|
ret := []string{"_", "_", "_"}
|
||||||
|
doErrno := false
|
||||||
|
for i := 0; i < len(out); i++ {
|
||||||
|
p := parseParam(out[i])
|
||||||
|
reg := ""
|
||||||
|
if p.Name == "err" {
|
||||||
|
reg = "e1"
|
||||||
|
ret[2] = reg
|
||||||
|
doErrno = true
|
||||||
|
} else {
|
||||||
|
reg = fmt.Sprintf("r%d", i)
|
||||||
|
ret[i] = reg
|
||||||
|
}
|
||||||
|
if p.Type == "bool" {
|
||||||
|
reg = fmt.Sprintf("%d != 0", reg)
|
||||||
|
}
|
||||||
|
if p.Type == "int64" && endianness != "" {
|
||||||
|
// 64-bit number in r1:r0 or r0:r1.
|
||||||
|
if i+2 > len(out) {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s: not enough registers for int64 return\n", path)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
if endianness == "big-endian" {
|
||||||
|
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
|
||||||
|
} else {
|
||||||
|
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
|
||||||
|
}
|
||||||
|
ret[i] = fmt.Sprintf("r%d", i)
|
||||||
|
ret[i+1] = fmt.Sprintf("r%d", i+1)
|
||||||
|
}
|
||||||
|
if reg != "e1" {
|
||||||
|
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
|
||||||
|
text += fmt.Sprintf("\t%s\n", call)
|
||||||
|
} else {
|
||||||
|
text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
|
||||||
|
}
|
||||||
|
text += body
|
||||||
|
|
||||||
|
if doErrno {
|
||||||
|
text += "\tif e1 != 0 {\n"
|
||||||
|
text += "\t\terr = e1\n"
|
||||||
|
text += "\t}\n"
|
||||||
|
}
|
||||||
|
text += "\treturn\n"
|
||||||
|
text += "}\n"
|
||||||
|
}
|
||||||
|
if err := s.Err(); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
file.Close()
|
||||||
|
}
|
||||||
|
imp := ""
|
||||||
|
if pack != "unix" {
|
||||||
|
imp = "import \"golang.org/x/sys/unix\"\n"
|
||||||
|
|
||||||
|
}
|
||||||
|
vardecls := "\t" + strings.Join(vars, ",\n\t")
|
||||||
|
vardecls += " syscallFunc"
|
||||||
|
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, text)
|
||||||
|
}
|
||||||
|
|
||||||
|
const srcTemplate = `// %s
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build %s
|
||||||
|
|
||||||
|
package %s
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
var (
|
||||||
|
%s
|
||||||
|
)
|
||||||
|
|
||||||
|
%s
|
||||||
|
`
|
||||||
289
vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
generated
vendored
289
vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
generated
vendored
|
|
@ -1,289 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
# Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
# This program reads a file containing function prototypes
|
|
||||||
# (like syscall_solaris.go) and generates system call bodies.
|
|
||||||
# The prototypes are marked by lines beginning with "//sys"
|
|
||||||
# and read like func declarations if //sys is replaced by func, but:
|
|
||||||
# * The parameter lists must give a name for each argument.
|
|
||||||
# This includes return parameters.
|
|
||||||
# * The parameter lists must give a type for each argument:
|
|
||||||
# the (x, y, z int) shorthand is not allowed.
|
|
||||||
# * If the return parameter is an error number, it must be named err.
|
|
||||||
# * If go func name needs to be different than its libc name,
|
|
||||||
# * or the function is not in libc, name could be specified
|
|
||||||
# * at the end, after "=" sign, like
|
|
||||||
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV);
|
|
||||||
my $errors = 0;
|
|
||||||
my $_32bit = "";
|
|
||||||
my $tags = ""; # build tags
|
|
||||||
|
|
||||||
binmode STDOUT;
|
|
||||||
|
|
||||||
if($ARGV[0] eq "-b32") {
|
|
||||||
$_32bit = "big-endian";
|
|
||||||
shift;
|
|
||||||
} elsif($ARGV[0] eq "-l32") {
|
|
||||||
$_32bit = "little-endian";
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
if($ARGV[0] eq "-tags") {
|
|
||||||
shift;
|
|
||||||
$tags = $ARGV[0];
|
|
||||||
shift;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($ARGV[0] =~ /^-/) {
|
|
||||||
print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parseparamlist($) {
|
|
||||||
my ($list) = @_;
|
|
||||||
$list =~ s/^\s*//;
|
|
||||||
$list =~ s/\s*$//;
|
|
||||||
if($list eq "") {
|
|
||||||
return ();
|
|
||||||
}
|
|
||||||
return split(/\s*,\s*/, $list);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parseparam($) {
|
|
||||||
my ($p) = @_;
|
|
||||||
if($p !~ /^(\S*) (\S*)$/) {
|
|
||||||
print STDERR "$ARGV:$.: malformed parameter: $p\n";
|
|
||||||
$errors = 1;
|
|
||||||
return ("xx", "int");
|
|
||||||
}
|
|
||||||
return ($1, $2);
|
|
||||||
}
|
|
||||||
|
|
||||||
my $package = "";
|
|
||||||
my $text = "";
|
|
||||||
my $dynimports = "";
|
|
||||||
my $linknames = "";
|
|
||||||
my @vars = ();
|
|
||||||
while(<>) {
|
|
||||||
chomp;
|
|
||||||
s/\s+/ /g;
|
|
||||||
s/^\s+//;
|
|
||||||
s/\s+$//;
|
|
||||||
$package = $1 if !$package && /^package (\S+)$/;
|
|
||||||
my $nonblock = /^\/\/sysnb /;
|
|
||||||
next if !/^\/\/sys / && !$nonblock;
|
|
||||||
|
|
||||||
# Line must be of the form
|
|
||||||
# func Open(path string, mode int, perm int) (fd int, err error)
|
|
||||||
# Split into name, in params, out params.
|
|
||||||
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
|
|
||||||
print STDERR "$ARGV:$.: malformed //sys declaration\n";
|
|
||||||
$errors = 1;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
|
|
||||||
|
|
||||||
# Split argument lists on comma.
|
|
||||||
my @in = parseparamlist($in);
|
|
||||||
my @out = parseparamlist($out);
|
|
||||||
|
|
||||||
# So file name.
|
|
||||||
if($modname eq "") {
|
|
||||||
$modname = "libc";
|
|
||||||
}
|
|
||||||
|
|
||||||
# System call name.
|
|
||||||
if($sysname eq "") {
|
|
||||||
$sysname = "$func";
|
|
||||||
}
|
|
||||||
|
|
||||||
# System call pointer variable name.
|
|
||||||
my $sysvarname = "proc$sysname";
|
|
||||||
|
|
||||||
my $strconvfunc = "BytePtrFromString";
|
|
||||||
my $strconvtype = "*byte";
|
|
||||||
|
|
||||||
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
|
|
||||||
|
|
||||||
# Runtime import of function to allow cross-platform builds.
|
|
||||||
$dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n";
|
|
||||||
# Link symbol to proc address variable.
|
|
||||||
$linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n";
|
|
||||||
# Library proc address variable.
|
|
||||||
push @vars, $sysvarname;
|
|
||||||
|
|
||||||
# Go function header.
|
|
||||||
$out = join(', ', @out);
|
|
||||||
if($out ne "") {
|
|
||||||
$out = " ($out)";
|
|
||||||
}
|
|
||||||
if($text ne "") {
|
|
||||||
$text .= "\n"
|
|
||||||
}
|
|
||||||
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out;
|
|
||||||
|
|
||||||
# Check if err return available
|
|
||||||
my $errvar = "";
|
|
||||||
foreach my $p (@out) {
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
if($type eq "error") {
|
|
||||||
$errvar = $name;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Prepare arguments to Syscall.
|
|
||||||
my @args = ();
|
|
||||||
my $n = 0;
|
|
||||||
foreach my $p (@in) {
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
if($type =~ /^\*/) {
|
|
||||||
push @args, "uintptr(unsafe.Pointer($name))";
|
|
||||||
} elsif($type eq "string" && $errvar ne "") {
|
|
||||||
$text .= "\tvar _p$n $strconvtype\n";
|
|
||||||
$text .= "\t_p$n, $errvar = $strconvfunc($name)\n";
|
|
||||||
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
|
|
||||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
|
||||||
$n++;
|
|
||||||
} elsif($type eq "string") {
|
|
||||||
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
|
|
||||||
$text .= "\tvar _p$n $strconvtype\n";
|
|
||||||
$text .= "\t_p$n, _ = $strconvfunc($name)\n";
|
|
||||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
|
||||||
$n++;
|
|
||||||
} elsif($type =~ /^\[\](.*)/) {
|
|
||||||
# Convert slice into pointer, length.
|
|
||||||
# Have to be careful not to take address of &a[0] if len == 0:
|
|
||||||
# pass nil in that case.
|
|
||||||
$text .= "\tvar _p$n *$1\n";
|
|
||||||
$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
|
|
||||||
push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))";
|
|
||||||
$n++;
|
|
||||||
} elsif($type eq "int64" && $_32bit ne "") {
|
|
||||||
if($_32bit eq "big-endian") {
|
|
||||||
push @args, "uintptr($name >> 32)", "uintptr($name)";
|
|
||||||
} else {
|
|
||||||
push @args, "uintptr($name)", "uintptr($name >> 32)";
|
|
||||||
}
|
|
||||||
} elsif($type eq "bool") {
|
|
||||||
$text .= "\tvar _p$n uint32\n";
|
|
||||||
$text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
|
|
||||||
push @args, "uintptr(_p$n)";
|
|
||||||
$n++;
|
|
||||||
} else {
|
|
||||||
push @args, "uintptr($name)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
my $nargs = @args;
|
|
||||||
|
|
||||||
# Determine which form to use; pad args with zeros.
|
|
||||||
my $asm = "sysvicall6";
|
|
||||||
if ($nonblock) {
|
|
||||||
$asm = "rawSysvicall6";
|
|
||||||
}
|
|
||||||
if(@args <= 6) {
|
|
||||||
while(@args < 6) {
|
|
||||||
push @args, "0";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print STDERR "$ARGV:$.: too many arguments to system call\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Actual call.
|
|
||||||
my $args = join(', ', @args);
|
|
||||||
my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)";
|
|
||||||
|
|
||||||
# Assign return values.
|
|
||||||
my $body = "";
|
|
||||||
my $failexpr = "";
|
|
||||||
my @ret = ("_", "_", "_");
|
|
||||||
my @pout= ();
|
|
||||||
my $do_errno = 0;
|
|
||||||
for(my $i=0; $i<@out; $i++) {
|
|
||||||
my $p = $out[$i];
|
|
||||||
my ($name, $type) = parseparam($p);
|
|
||||||
my $reg = "";
|
|
||||||
if($name eq "err") {
|
|
||||||
$reg = "e1";
|
|
||||||
$ret[2] = $reg;
|
|
||||||
$do_errno = 1;
|
|
||||||
} else {
|
|
||||||
$reg = sprintf("r%d", $i);
|
|
||||||
$ret[$i] = $reg;
|
|
||||||
}
|
|
||||||
if($type eq "bool") {
|
|
||||||
$reg = "$reg != 0";
|
|
||||||
}
|
|
||||||
if($type eq "int64" && $_32bit ne "") {
|
|
||||||
# 64-bit number in r1:r0 or r0:r1.
|
|
||||||
if($i+2 > @out) {
|
|
||||||
print STDERR "$ARGV:$.: not enough registers for int64 return\n";
|
|
||||||
}
|
|
||||||
if($_32bit eq "big-endian") {
|
|
||||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
|
|
||||||
} else {
|
|
||||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
|
|
||||||
}
|
|
||||||
$ret[$i] = sprintf("r%d", $i);
|
|
||||||
$ret[$i+1] = sprintf("r%d", $i+1);
|
|
||||||
}
|
|
||||||
if($reg ne "e1") {
|
|
||||||
$body .= "\t$name = $type($reg)\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
|
|
||||||
$text .= "\t$call\n";
|
|
||||||
} else {
|
|
||||||
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
|
|
||||||
}
|
|
||||||
$text .= $body;
|
|
||||||
|
|
||||||
if ($do_errno) {
|
|
||||||
$text .= "\tif e1 != 0 {\n";
|
|
||||||
$text .= "\t\terr = e1\n";
|
|
||||||
$text .= "\t}\n";
|
|
||||||
}
|
|
||||||
$text .= "\treturn\n";
|
|
||||||
$text .= "}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($errors) {
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
// $cmdline
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build $tags
|
|
||||||
|
|
||||||
package $package
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
|
|
||||||
|
|
||||||
my $vardecls = "\t" . join(",\n\t", @vars);
|
|
||||||
$vardecls .= " syscallFunc";
|
|
||||||
|
|
||||||
chomp($_=<<EOF);
|
|
||||||
|
|
||||||
$dynimports
|
|
||||||
$linknames
|
|
||||||
var (
|
|
||||||
$vardecls
|
|
||||||
)
|
|
||||||
|
|
||||||
$text
|
|
||||||
EOF
|
|
||||||
print $_;
|
|
||||||
exit 0;
|
|
||||||
1
vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl
generated
vendored
Executable file → Normal file
1
vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl
generated
vendored
Executable file → Normal file
|
|
@ -32,6 +32,7 @@ my @headers = qw (
|
||||||
sys/sem.h
|
sys/sem.h
|
||||||
sys/shm.h
|
sys/shm.h
|
||||||
sys/vmmeter.h
|
sys/vmmeter.h
|
||||||
|
uvm/uvmexp.h
|
||||||
uvm/uvm_param.h
|
uvm/uvm_param.h
|
||||||
uvm/uvm_swap_encrypt.h
|
uvm/uvm_swap_encrypt.h
|
||||||
ddb/db_var.h
|
ddb/db_var.h
|
||||||
|
|
|
||||||
190
vendor/golang.org/x/sys/unix/mksysnum.go
generated
vendored
Normal file
190
vendor/golang.org/x/sys/unix/mksysnum.go
generated
vendored
Normal file
|
|
@ -0,0 +1,190 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build ignore
|
||||||
|
|
||||||
|
// Generate system call table for DragonFly, NetBSD,
|
||||||
|
// FreeBSD, OpenBSD or Darwin from master list
|
||||||
|
// (for example, /usr/src/sys/kern/syscalls.master or
|
||||||
|
// sys/syscall.h).
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
goos, goarch string
|
||||||
|
)
|
||||||
|
|
||||||
|
// cmdLine returns this programs's commandline arguments
|
||||||
|
func cmdLine() string {
|
||||||
|
return "go run mksysnum.go " + strings.Join(os.Args[1:], " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// buildTags returns build tags
|
||||||
|
func buildTags() string {
|
||||||
|
return fmt.Sprintf("%s,%s", goarch, goos)
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkErr(err error) {
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// source string and substring slice for regexp
|
||||||
|
type re struct {
|
||||||
|
str string // source string
|
||||||
|
sub []string // matched sub-string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match performs regular expression match
|
||||||
|
func (r *re) Match(exp string) bool {
|
||||||
|
r.sub = regexp.MustCompile(exp).FindStringSubmatch(r.str)
|
||||||
|
if r.sub != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// fetchFile fetches a text file from URL
|
||||||
|
func fetchFile(URL string) io.Reader {
|
||||||
|
resp, err := http.Get(URL)
|
||||||
|
checkErr(err)
|
||||||
|
defer resp.Body.Close()
|
||||||
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
|
checkErr(err)
|
||||||
|
return strings.NewReader(string(body))
|
||||||
|
}
|
||||||
|
|
||||||
|
// readFile reads a text file from path
|
||||||
|
func readFile(path string) io.Reader {
|
||||||
|
file, err := os.Open(os.Args[1])
|
||||||
|
checkErr(err)
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
|
||||||
|
func format(name, num, proto string) string {
|
||||||
|
name = strings.ToUpper(name)
|
||||||
|
// There are multiple entries for enosys and nosys, so comment them out.
|
||||||
|
nm := re{str: name}
|
||||||
|
if nm.Match(`^SYS_E?NOSYS$`) {
|
||||||
|
name = fmt.Sprintf("// %s", name)
|
||||||
|
}
|
||||||
|
if name == `SYS_SYS_EXIT` {
|
||||||
|
name = `SYS_EXIT`
|
||||||
|
}
|
||||||
|
return fmt.Sprintf(" %s = %s; // %s\n", name, num, proto)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Get the OS (using GOOS_TARGET if it exist)
|
||||||
|
goos = os.Getenv("GOOS_TARGET")
|
||||||
|
if goos == "" {
|
||||||
|
goos = os.Getenv("GOOS")
|
||||||
|
}
|
||||||
|
// Get the architecture (using GOARCH_TARGET if it exists)
|
||||||
|
goarch = os.Getenv("GOARCH_TARGET")
|
||||||
|
if goarch == "" {
|
||||||
|
goarch = os.Getenv("GOARCH")
|
||||||
|
}
|
||||||
|
// Check if GOOS and GOARCH environment variables are defined
|
||||||
|
if goarch == "" || goos == "" {
|
||||||
|
fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
file := strings.TrimSpace(os.Args[1])
|
||||||
|
var syscalls io.Reader
|
||||||
|
if strings.HasPrefix(file, "https://") || strings.HasPrefix(file, "http://") {
|
||||||
|
// Download syscalls.master file
|
||||||
|
syscalls = fetchFile(file)
|
||||||
|
} else {
|
||||||
|
syscalls = readFile(file)
|
||||||
|
}
|
||||||
|
|
||||||
|
var text, line string
|
||||||
|
s := bufio.NewScanner(syscalls)
|
||||||
|
for s.Scan() {
|
||||||
|
t := re{str: line}
|
||||||
|
if t.Match(`^(.*)\\$`) {
|
||||||
|
// Handle continuation
|
||||||
|
line = t.sub[1]
|
||||||
|
line += strings.TrimLeft(s.Text(), " \t")
|
||||||
|
} else {
|
||||||
|
// New line
|
||||||
|
line = s.Text()
|
||||||
|
}
|
||||||
|
t = re{str: line}
|
||||||
|
if t.Match(`\\$`) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
t = re{str: line}
|
||||||
|
|
||||||
|
switch goos {
|
||||||
|
case "dragonfly":
|
||||||
|
if t.Match(`^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$`) {
|
||||||
|
num, proto := t.sub[1], t.sub[2]
|
||||||
|
name := fmt.Sprintf("SYS_%s", t.sub[3])
|
||||||
|
text += format(name, num, proto)
|
||||||
|
}
|
||||||
|
case "freebsd":
|
||||||
|
if t.Match(`^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$`) {
|
||||||
|
num, proto := t.sub[1], t.sub[2]
|
||||||
|
name := fmt.Sprintf("SYS_%s", t.sub[3])
|
||||||
|
text += format(name, num, proto)
|
||||||
|
}
|
||||||
|
case "openbsd":
|
||||||
|
if t.Match(`^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$`) {
|
||||||
|
num, proto, name := t.sub[1], t.sub[3], t.sub[4]
|
||||||
|
text += format(name, num, proto)
|
||||||
|
}
|
||||||
|
case "netbsd":
|
||||||
|
if t.Match(`^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$`) {
|
||||||
|
num, proto, compat := t.sub[1], t.sub[6], t.sub[8]
|
||||||
|
name := t.sub[7] + "_" + t.sub[9]
|
||||||
|
if t.sub[11] != "" {
|
||||||
|
name = t.sub[7] + "_" + t.sub[11]
|
||||||
|
}
|
||||||
|
name = strings.ToUpper(name)
|
||||||
|
if compat == "" || compat == "13" || compat == "30" || compat == "50" {
|
||||||
|
text += fmt.Sprintf(" %s = %s; // %s\n", name, num, proto)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "darwin":
|
||||||
|
if t.Match(`^#define\s+SYS_(\w+)\s+([0-9]+)`) {
|
||||||
|
name, num := t.sub[1], t.sub[2]
|
||||||
|
name = strings.ToUpper(name)
|
||||||
|
text += fmt.Sprintf(" SYS_%s = %s;\n", name, num)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
fmt.Fprintf(os.Stderr, "unrecognized GOOS=%s\n", goos)
|
||||||
|
os.Exit(1)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err := s.Err()
|
||||||
|
checkErr(err)
|
||||||
|
|
||||||
|
fmt.Printf(template, cmdLine(), buildTags(), text)
|
||||||
|
}
|
||||||
|
|
||||||
|
const template = `// %s
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build %s
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
const(
|
||||||
|
%s)`
|
||||||
39
vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
generated
vendored
39
vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
generated
vendored
|
|
@ -1,39 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
# Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
#
|
|
||||||
# Generate system call table for Darwin from sys/syscall.h
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
|
||||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
// $command
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
EOF
|
|
||||||
|
|
||||||
while(<>){
|
|
||||||
if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
|
|
||||||
my $name = $1;
|
|
||||||
my $num = $2;
|
|
||||||
$name =~ y/a-z/A-Z/;
|
|
||||||
print " SYS_$name = $num;"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
50
vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
generated
vendored
50
vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
generated
vendored
|
|
@ -1,50 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
# Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
#
|
|
||||||
# Generate system call table for DragonFly from master list
|
|
||||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
|
||||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
// $command
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
EOF
|
|
||||||
|
|
||||||
while(<>){
|
|
||||||
if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
|
|
||||||
my $num = $1;
|
|
||||||
my $proto = $2;
|
|
||||||
my $name = "SYS_$3";
|
|
||||||
$name =~ y/a-z/A-Z/;
|
|
||||||
|
|
||||||
# There are multiple entries for enosys and nosys, so comment them out.
|
|
||||||
if($name =~ /^SYS_E?NOSYS$/){
|
|
||||||
$name = "// $name";
|
|
||||||
}
|
|
||||||
if($name eq 'SYS_SYS_EXIT'){
|
|
||||||
$name = 'SYS_EXIT';
|
|
||||||
}
|
|
||||||
|
|
||||||
print " $name = $num; // $proto\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
50
vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
generated
vendored
50
vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
generated
vendored
|
|
@ -1,50 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
# Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
#
|
|
||||||
# Generate system call table for FreeBSD from master list
|
|
||||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
|
||||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
// $command
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
EOF
|
|
||||||
|
|
||||||
while(<>){
|
|
||||||
if(/^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$/){
|
|
||||||
my $num = $1;
|
|
||||||
my $proto = $2;
|
|
||||||
my $name = "SYS_$3";
|
|
||||||
$name =~ y/a-z/A-Z/;
|
|
||||||
|
|
||||||
# There are multiple entries for enosys and nosys, so comment them out.
|
|
||||||
if($name =~ /^SYS_E?NOSYS$/){
|
|
||||||
$name = "// $name";
|
|
||||||
}
|
|
||||||
if($name eq 'SYS_SYS_EXIT'){
|
|
||||||
$name = 'SYS_EXIT';
|
|
||||||
}
|
|
||||||
|
|
||||||
print " $name = $num; // $proto\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
58
vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
generated
vendored
58
vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
generated
vendored
|
|
@ -1,58 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
# Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
#
|
|
||||||
# Generate system call table for OpenBSD from master list
|
|
||||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
|
||||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
// $command
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
EOF
|
|
||||||
|
|
||||||
my $line = '';
|
|
||||||
while(<>){
|
|
||||||
if($line =~ /^(.*)\\$/) {
|
|
||||||
# Handle continuation
|
|
||||||
$line = $1;
|
|
||||||
$_ =~ s/^\s+//;
|
|
||||||
$line .= $_;
|
|
||||||
} else {
|
|
||||||
# New line
|
|
||||||
$line = $_;
|
|
||||||
}
|
|
||||||
next if $line =~ /\\$/;
|
|
||||||
if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
|
|
||||||
my $num = $1;
|
|
||||||
my $proto = $6;
|
|
||||||
my $compat = $8;
|
|
||||||
my $name = "$7_$9";
|
|
||||||
|
|
||||||
$name = "$7_$11" if $11 ne '';
|
|
||||||
$name =~ y/a-z/A-Z/;
|
|
||||||
|
|
||||||
if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') {
|
|
||||||
print " $name = $num; // $proto\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
50
vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
generated
vendored
50
vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
generated
vendored
|
|
@ -1,50 +0,0 @@
|
||||||
#!/usr/bin/env perl
|
|
||||||
# Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
# Use of this source code is governed by a BSD-style
|
|
||||||
# license that can be found in the LICENSE file.
|
|
||||||
#
|
|
||||||
# Generate system call table for OpenBSD from master list
|
|
||||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
|
||||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
// $command
|
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
|
||||||
|
|
||||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
EOF
|
|
||||||
|
|
||||||
while(<>){
|
|
||||||
if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
|
|
||||||
my $num = $1;
|
|
||||||
my $proto = $3;
|
|
||||||
my $name = $4;
|
|
||||||
$name =~ y/a-z/A-Z/;
|
|
||||||
|
|
||||||
# There are multiple entries for enosys and nosys, so comment them out.
|
|
||||||
if($name =~ /^SYS_E?NOSYS$/){
|
|
||||||
$name = "// $name";
|
|
||||||
}
|
|
||||||
if($name eq 'SYS_SYS_EXIT'){
|
|
||||||
$name = 'SYS_EXIT';
|
|
||||||
}
|
|
||||||
|
|
||||||
print " $name = $num; // $proto\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print <<EOF;
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
99
vendor/golang.org/x/sys/unix/openbsd_pledge.go
generated
vendored
99
vendor/golang.org/x/sys/unix/openbsd_pledge.go
generated
vendored
|
|
@ -15,10 +15,6 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
_SYS_PLEDGE = 108
|
|
||||||
)
|
|
||||||
|
|
||||||
// Pledge implements the pledge syscall.
|
// Pledge implements the pledge syscall.
|
||||||
//
|
//
|
||||||
// The pledge syscall does not accept execpromises on OpenBSD releases
|
// The pledge syscall does not accept execpromises on OpenBSD releases
|
||||||
|
|
@ -34,15 +30,9 @@ func Pledge(promises, execpromises string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If OpenBSD <= 5.9, pledge is not available.
|
err = pledgeAvailable(maj, min, execpromises)
|
||||||
if (maj == 5 && min != 9) || maj < 5 {
|
if err != nil {
|
||||||
return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min)
|
return err
|
||||||
}
|
|
||||||
|
|
||||||
// If OpenBSD <= 6.2 and execpromises is not empty
|
|
||||||
// return an error - execpromises is not available before 6.3
|
|
||||||
if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" {
|
|
||||||
return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pptr, err := syscall.BytePtrFromString(promises)
|
pptr, err := syscall.BytePtrFromString(promises)
|
||||||
|
|
@ -63,7 +53,71 @@ func Pledge(promises, execpromises string) error {
|
||||||
expr = unsafe.Pointer(exptr)
|
expr = unsafe.Pointer(exptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, e := syscall.Syscall(_SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
|
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
|
||||||
|
if e != 0 {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PledgePromises implements the pledge syscall.
|
||||||
|
//
|
||||||
|
// This changes the promises and leaves the execpromises untouched.
|
||||||
|
//
|
||||||
|
// For more information see pledge(2).
|
||||||
|
func PledgePromises(promises string) error {
|
||||||
|
maj, min, err := majmin()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = pledgeAvailable(maj, min, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// This variable holds the execpromises and is always nil.
|
||||||
|
var expr unsafe.Pointer
|
||||||
|
|
||||||
|
pptr, err := syscall.BytePtrFromString(promises)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
|
||||||
|
if e != 0 {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PledgeExecpromises implements the pledge syscall.
|
||||||
|
//
|
||||||
|
// This changes the execpromises and leaves the promises untouched.
|
||||||
|
//
|
||||||
|
// For more information see pledge(2).
|
||||||
|
func PledgeExecpromises(execpromises string) error {
|
||||||
|
maj, min, err := majmin()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = pledgeAvailable(maj, min, execpromises)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// This variable holds the promises and is always nil.
|
||||||
|
var pptr unsafe.Pointer
|
||||||
|
|
||||||
|
exptr, err := syscall.BytePtrFromString(execpromises)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0)
|
||||||
if e != 0 {
|
if e != 0 {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
@ -93,3 +147,20 @@ func majmin() (major int, minor int, err error) {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pledgeAvailable checks for availability of the pledge(2) syscall
|
||||||
|
// based on the running OpenBSD version.
|
||||||
|
func pledgeAvailable(maj, min int, execpromises string) error {
|
||||||
|
// If OpenBSD <= 5.9, pledge is not available.
|
||||||
|
if (maj == 5 && min != 9) || maj < 5 {
|
||||||
|
return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If OpenBSD <= 6.2 and execpromises is not empty,
|
||||||
|
// return an error - execpromises is not available before 6.3
|
||||||
|
if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" {
|
||||||
|
return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
||||||
44
vendor/golang.org/x/sys/unix/openbsd_unveil.go
generated
vendored
Normal file
44
vendor/golang.org/x/sys/unix/openbsd_unveil.go
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build openbsd
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Unveil implements the unveil syscall.
|
||||||
|
// For more information see unveil(2).
|
||||||
|
// Note that the special case of blocking further
|
||||||
|
// unveil calls is handled by UnveilBlock.
|
||||||
|
func Unveil(path string, flags string) error {
|
||||||
|
pathPtr, err := syscall.BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
flagsPtr, err := syscall.BytePtrFromString(flags)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0)
|
||||||
|
if e != 0 {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnveilBlock blocks future unveil calls.
|
||||||
|
// For more information see unveil(2).
|
||||||
|
func UnveilBlock() error {
|
||||||
|
// Both pointers must be nil.
|
||||||
|
var pathUnsafe, flagsUnsafe unsafe.Pointer
|
||||||
|
_, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0)
|
||||||
|
if e != 0 {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
30
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
30
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
|
|
@ -8,17 +8,33 @@
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import "unsafe"
|
import (
|
||||||
|
"runtime"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
// Round the length of a raw sockaddr up to align it properly.
|
// Round the length of a raw sockaddr up to align it properly.
|
||||||
func cmsgAlignOf(salen int) int {
|
func cmsgAlignOf(salen int) int {
|
||||||
salign := sizeofPtr
|
salign := SizeofPtr
|
||||||
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and
|
|
||||||
// Solaris kernels still require 32-bit aligned access to
|
switch runtime.GOOS {
|
||||||
// network subsystem.
|
case "aix":
|
||||||
if darwin64Bit || dragonfly64Bit || solaris64Bit {
|
// There is no alignment on AIX.
|
||||||
salign = 4
|
salign = 1
|
||||||
|
case "darwin", "dragonfly", "solaris":
|
||||||
|
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and
|
||||||
|
// Solaris kernels still require 32-bit aligned access to
|
||||||
|
// network subsystem.
|
||||||
|
if SizeofPtr == 8 {
|
||||||
|
salign = 4
|
||||||
|
}
|
||||||
|
case "netbsd", "openbsd":
|
||||||
|
// NetBSD and OpenBSD armv7 require 64-bit alignment.
|
||||||
|
if runtime.GOARCH == "arm" {
|
||||||
|
salign = 8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (salen + salign - 1) & ^(salign - 1)
|
return (salen + salign - 1) & ^(salign - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
69
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
69
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
|
|
@ -13,10 +13,7 @@
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import "unsafe"
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wrapped
|
* Wrapped
|
||||||
|
|
@ -230,7 +227,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
|
|
||||||
// Some versions of AIX have a bug in getsockname (see IV78655).
|
// Some versions of AIX have a bug in getsockname (see IV78655).
|
||||||
// We can't rely on sa.Len being set correctly.
|
// We can't rely on sa.Len being set correctly.
|
||||||
n := SizeofSockaddrUnix - 3 // substract leading Family, Len, terminating NUL.
|
n := SizeofSockaddrUnix - 3 // subtract leading Family, Len, terminating NUL.
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
if pp.Path[i] == 0 {
|
if pp.Path[i] == 0 {
|
||||||
n = i
|
n = i
|
||||||
|
|
@ -271,6 +268,13 @@ func Gettimeofday(tv *Timeval) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
return -1, ENOSYS
|
return -1, ENOSYS
|
||||||
|
|
@ -305,11 +309,11 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
|
||||||
type WaitStatus uint32
|
type WaitStatus uint32
|
||||||
|
|
||||||
func (w WaitStatus) Stopped() bool { return w&0x40 != 0 }
|
func (w WaitStatus) Stopped() bool { return w&0x40 != 0 }
|
||||||
func (w WaitStatus) StopSignal() syscall.Signal {
|
func (w WaitStatus) StopSignal() Signal {
|
||||||
if !w.Stopped() {
|
if !w.Stopped() {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
return syscall.Signal(w>>8) & 0xFF
|
return Signal(w>>8) & 0xFF
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WaitStatus) Exited() bool { return w&0xFF == 0 }
|
func (w WaitStatus) Exited() bool { return w&0xFF == 0 }
|
||||||
|
|
@ -321,11 +325,11 @@ func (w WaitStatus) ExitStatus() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WaitStatus) Signaled() bool { return w&0x40 == 0 && w&0xFF != 0 }
|
func (w WaitStatus) Signaled() bool { return w&0x40 == 0 && w&0xFF != 0 }
|
||||||
func (w WaitStatus) Signal() syscall.Signal {
|
func (w WaitStatus) Signal() Signal {
|
||||||
if !w.Signaled() {
|
if !w.Signaled() {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
return syscall.Signal(w>>16) & 0xFF
|
return Signal(w>>16) & 0xFF
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w WaitStatus) Continued() bool { return w&0x01000000 != 0 }
|
func (w WaitStatus) Continued() bool { return w&0x01000000 != 0 }
|
||||||
|
|
@ -383,9 +387,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||||
//sys FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) = fcntl
|
//sys FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) = fcntl
|
||||||
|
|
||||||
func Flock(fd int, how int) (err error) {
|
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||||
return syscall.Flock(fd, how)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Direct access
|
* Direct access
|
||||||
|
|
@ -396,15 +398,12 @@ func Flock(fd int, how int) (err error) {
|
||||||
//sys Chroot(path string) (err error)
|
//sys Chroot(path string) (err error)
|
||||||
//sys Close(fd int) (err error)
|
//sys Close(fd int) (err error)
|
||||||
//sys Dup(oldfd int) (fd int, err error)
|
//sys Dup(oldfd int) (fd int, err error)
|
||||||
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
|
||||||
//sys Exit(code int)
|
//sys Exit(code int)
|
||||||
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error)
|
|
||||||
//sys Fchdir(fd int) (err error)
|
//sys Fchdir(fd int) (err error)
|
||||||
//sys Fchmod(fd int, mode uint32) (err error)
|
//sys Fchmod(fd int, mode uint32) (err error)
|
||||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
|
||||||
//sys Fdatasync(fd int) (err error)
|
//sys Fdatasync(fd int) (err error)
|
||||||
//sys Fsync(fd int) (err error)
|
//sys Fsync(fd int) (err error)
|
||||||
// readdir_r
|
// readdir_r
|
||||||
|
|
@ -417,7 +416,7 @@ func Flock(fd int, how int) (err error) {
|
||||||
//sys Getpriority(which int, who int) (prio int, err error)
|
//sys Getpriority(which int, who int) (prio int, err error)
|
||||||
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
||||||
//sysnb Getsid(pid int) (sid int, err error)
|
//sysnb Getsid(pid int) (sid int, err error)
|
||||||
//sysnb Kill(pid int, sig syscall.Signal) (err error)
|
//sysnb Kill(pid int, sig Signal) (err error)
|
||||||
//sys Klogctl(typ int, buf []byte) (n int, err error) = syslog
|
//sys Klogctl(typ int, buf []byte) (n int, err error) = syslog
|
||||||
//sys Mkdir(dirfd int, path string, mode uint32) (err error)
|
//sys Mkdir(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
|
|
@ -429,7 +428,6 @@ func Flock(fd int, how int) (err error) {
|
||||||
//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
|
//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||||
//sys Removexattr(path string, attr string) (err error)
|
|
||||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Setdomainname(p []byte) (err error)
|
//sys Setdomainname(p []byte) (err error)
|
||||||
//sys Sethostname(p []byte) (err error)
|
//sys Sethostname(p []byte) (err error)
|
||||||
|
|
@ -443,15 +441,11 @@ func Flock(fd int, how int) (err error) {
|
||||||
//sys Setpriority(which int, who int, prio int) (err error)
|
//sys Setpriority(which int, who int, prio int) (err error)
|
||||||
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
||||||
//sys Sync()
|
//sys Sync()
|
||||||
//sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
|
|
||||||
//sysnb Times(tms *Tms) (ticks uintptr, err error)
|
//sysnb Times(tms *Tms) (ticks uintptr, err error)
|
||||||
//sysnb Umask(mask int) (oldmask int)
|
//sysnb Umask(mask int) (oldmask int)
|
||||||
//sysnb Uname(buf *Utsname) (err error)
|
//sysnb Uname(buf *Utsname) (err error)
|
||||||
//TODO umount
|
|
||||||
// //sys Unmount(target string, flags int) (err error) = umount
|
|
||||||
//sys Unlink(path string) (err error)
|
//sys Unlink(path string) (err error)
|
||||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||||
//sys Unshare(flags int) (err error)
|
|
||||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||||
//sys write(fd int, p []byte) (n int, err error)
|
//sys write(fd int, p []byte) (n int, err error)
|
||||||
//sys readlen(fd int, p *byte, np int) (n int, err error) = read
|
//sys readlen(fd int, p *byte, np int) (n int, err error) = read
|
||||||
|
|
@ -474,8 +468,7 @@ func Flock(fd int, how int) (err error) {
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
|
||||||
//TODO Select
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||||
// //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
|
||||||
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
//sysnb Setregid(rgid int, egid int) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
|
|
@ -497,8 +490,10 @@ func Flock(fd int, how int) (err error) {
|
||||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
||||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
|
||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
// In order to use msghdr structure with Control, Controllen, nrecvmsg and nsendmsg must be used.
|
||||||
|
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = nrecvmsg
|
||||||
|
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg
|
||||||
|
|
||||||
//sys munmap(addr uintptr, length uintptr) (err error)
|
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||||
|
|
||||||
|
|
@ -537,19 +532,6 @@ func Pipe(p []int) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, flags)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
|
|
@ -562,3 +544,14 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
//sys gettimeofday(tv *Timeval, tzp *Timezone) (err error)
|
//sys gettimeofday(tv *Timeval, tzp *Timezone) (err error)
|
||||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||||
|
|
||||||
|
//sys Getsystemcfg(label int) (n uint64)
|
||||||
|
|
||||||
|
//sys umount(target string) (err error)
|
||||||
|
func Unmount(target string, flags int) (err error) {
|
||||||
|
if flags != 0 {
|
||||||
|
// AIX doesn't have any flags for umount.
|
||||||
|
return ENOSYS
|
||||||
|
}
|
||||||
|
return umount(target)
|
||||||
|
}
|
||||||
|
|
|
||||||
80
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
80
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
|
|
@ -108,17 +108,8 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, e1 := Syscall6(
|
if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil {
|
||||||
SYS_GETATTRLIST,
|
return nil, err
|
||||||
uintptr(unsafe.Pointer(_p0)),
|
|
||||||
uintptr(unsafe.Pointer(&attrList)),
|
|
||||||
uintptr(unsafe.Pointer(&attrBuf[0])),
|
|
||||||
uintptr(len(attrBuf)),
|
|
||||||
uintptr(options),
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
if e1 != 0 {
|
|
||||||
return nil, e1
|
|
||||||
}
|
}
|
||||||
size := *(*uint32)(unsafe.Pointer(&attrBuf[0]))
|
size := *(*uint32)(unsafe.Pointer(&attrBuf[0]))
|
||||||
|
|
||||||
|
|
@ -151,6 +142,25 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
|
||||||
|
|
||||||
|
func SysctlClockinfo(name string) (*Clockinfo, error) {
|
||||||
|
mib, err := sysctlmib(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
n := uintptr(SizeofClockinfo)
|
||||||
|
var ci Clockinfo
|
||||||
|
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n != SizeofClockinfo {
|
||||||
|
return nil, EIO
|
||||||
|
}
|
||||||
|
return &ci, nil
|
||||||
|
}
|
||||||
|
|
||||||
//sysnb pipe() (r int, w int, err error)
|
//sysnb pipe() (r int, w int, err error)
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
func Pipe(p []int) (err error) {
|
||||||
|
|
@ -168,12 +178,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||||
_p0 = unsafe.Pointer(&buf[0])
|
_p0 = unsafe.Pointer(&buf[0])
|
||||||
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
||||||
}
|
}
|
||||||
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
|
return getfsstat(_p0, bufsize, flags)
|
||||||
n = int(r0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = e1
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func xattrPointer(dest []byte) *byte {
|
func xattrPointer(dest []byte) *byte {
|
||||||
|
|
@ -298,21 +303,16 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
|
||||||
if flags&AT_SYMLINK_NOFOLLOW != 0 {
|
if flags&AT_SYMLINK_NOFOLLOW != 0 {
|
||||||
options |= FSOPT_NOFOLLOW
|
options |= FSOPT_NOFOLLOW
|
||||||
}
|
}
|
||||||
_, _, e1 := Syscall6(
|
return setattrlist(
|
||||||
SYS_SETATTRLIST,
|
_p0,
|
||||||
uintptr(unsafe.Pointer(_p0)),
|
unsafe.Pointer(&attrList),
|
||||||
uintptr(unsafe.Pointer(&attrList)),
|
unsafe.Pointer(&attributes),
|
||||||
uintptr(unsafe.Pointer(&attributes)),
|
unsafe.Sizeof(attributes),
|
||||||
uintptr(unsafe.Sizeof(attributes)),
|
options)
|
||||||
uintptr(options),
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
if e1 != 0 {
|
|
||||||
return e1
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
|
||||||
|
|
||||||
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error {
|
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error {
|
||||||
// Darwin doesn't support SYS_UTIMENSAT
|
// Darwin doesn't support SYS_UTIMENSAT
|
||||||
return ENOSYS
|
return ENOSYS
|
||||||
|
|
@ -411,6 +411,18 @@ func Uname(uname *Utsname) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
var length = int64(count)
|
||||||
|
err = sendfile(infd, outfd, *offset, &length, nil, 0)
|
||||||
|
written = int(length)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
|
|
@ -421,6 +433,7 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Chmod(path string, mode uint32) (err error)
|
//sys Chmod(path string, mode uint32) (err error)
|
||||||
//sys Chown(path string, uid int, gid int) (err error)
|
//sys Chown(path string, uid int, gid int) (err error)
|
||||||
//sys Chroot(path string) (err error)
|
//sys Chroot(path string) (err error)
|
||||||
|
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||||
//sys Close(fd int) (err error)
|
//sys Close(fd int) (err error)
|
||||||
//sys Dup(fd int) (nfd int, err error)
|
//sys Dup(fd int) (nfd int, err error)
|
||||||
//sys Dup2(from int, to int) (err error)
|
//sys Dup2(from int, to int) (err error)
|
||||||
|
|
@ -435,12 +448,8 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||||
//sys Flock(fd int, how int) (err error)
|
//sys Flock(fd int, how int) (err error)
|
||||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
|
||||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
|
||||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
|
||||||
//sys Fsync(fd int) (err error)
|
//sys Fsync(fd int) (err error)
|
||||||
//sys Ftruncate(fd int, length int64) (err error)
|
//sys Ftruncate(fd int, length int64) (err error)
|
||||||
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
|
||||||
//sys Getdtablesize() (size int)
|
//sys Getdtablesize() (size int)
|
||||||
//sysnb Getegid() (egid int)
|
//sysnb Getegid() (egid int)
|
||||||
//sysnb Geteuid() (uid int)
|
//sysnb Geteuid() (uid int)
|
||||||
|
|
@ -460,7 +469,6 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Link(path string, link string) (err error)
|
//sys Link(path string, link string) (err error)
|
||||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||||
//sys Listen(s int, backlog int) (err error)
|
//sys Listen(s int, backlog int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
|
||||||
//sys Mkdir(path string, mode uint32) (err error)
|
//sys Mkdir(path string, mode uint32) (err error)
|
||||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mkfifo(path string, mode uint32) (err error)
|
//sys Mkfifo(path string, mode uint32) (err error)
|
||||||
|
|
@ -492,8 +500,6 @@ func Uname(uname *Utsname) error {
|
||||||
//sysnb Setsid() (pid int, err error)
|
//sysnb Setsid() (pid int, err error)
|
||||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||||
//sysnb Setuid(uid int) (err error)
|
//sysnb Setuid(uid int) (err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
|
||||||
//sys Symlink(path string, link string) (err error)
|
//sys Symlink(path string, link string) (err error)
|
||||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Sync() (err error)
|
//sys Sync() (err error)
|
||||||
|
|
|
||||||
23
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
23
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
|
|
@ -8,7 +8,6 @@ package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
|
|
@ -48,21 +47,17 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
|
||||||
var length = uint64(count)
|
|
||||||
|
|
||||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
|
|
||||||
|
|
||||||
written = int(length)
|
|
||||||
|
|
||||||
if e1 != 0 {
|
|
||||||
err = e1
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
|
||||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||||
// of darwin/386 the syscall is called sysctl instead of __sysctl.
|
// of darwin/386 the syscall is called sysctl instead of __sysctl.
|
||||||
const SYS___SYSCTL = SYS_SYSCTL
|
const SYS___SYSCTL = SYS_SYSCTL
|
||||||
|
|
||||||
|
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||||
|
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||||
|
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
||||||
|
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
||||||
|
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
|
||||||
|
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||||
|
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||||
|
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||||
|
|
|
||||||
23
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
23
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
|
|
@ -8,7 +8,6 @@ package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
|
|
@ -48,21 +47,17 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
|
||||||
var length = uint64(count)
|
|
||||||
|
|
||||||
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
|
|
||||||
|
|
||||||
written = int(length)
|
|
||||||
|
|
||||||
if e1 != 0 {
|
|
||||||
err = e1
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
|
||||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||||
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
|
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
|
||||||
const SYS___SYSCTL = SYS_SYSCTL
|
const SYS___SYSCTL = SYS_SYSCTL
|
||||||
|
|
||||||
|
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||||
|
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||||
|
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
||||||
|
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
||||||
|
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
|
||||||
|
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||||
|
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||||
|
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||||
|
|
|
||||||
26
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
26
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
|
|
@ -6,7 +6,6 @@ package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
|
|
@ -46,21 +45,20 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
|
||||||
var length = uint64(count)
|
|
||||||
|
|
||||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
|
|
||||||
|
|
||||||
written = int(length)
|
|
||||||
|
|
||||||
if e1 != 0 {
|
|
||||||
err = e1
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
||||||
|
|
||||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||||
// of darwin/arm the syscall is called sysctl instead of __sysctl.
|
// of darwin/arm the syscall is called sysctl instead of __sysctl.
|
||||||
const SYS___SYSCTL = SYS_SYSCTL
|
const SYS___SYSCTL = SYS_SYSCTL
|
||||||
|
|
||||||
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
|
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||||
|
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
||||||
|
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
|
||||||
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
|
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||||
|
|
||||||
|
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||||
|
return 0, ENOSYS
|
||||||
|
}
|
||||||
|
|
|
||||||
26
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
26
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
|
|
@ -8,7 +8,6 @@ package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
|
|
@ -48,21 +47,20 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
|
||||||
var length = uint64(count)
|
|
||||||
|
|
||||||
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
|
|
||||||
|
|
||||||
written = int(length)
|
|
||||||
|
|
||||||
if e1 != 0 {
|
|
||||||
err = e1
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
||||||
|
|
||||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||||
// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
|
// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
|
||||||
const SYS___SYSCTL = SYS_SYSCTL
|
const SYS___SYSCTL = SYS_SYSCTL
|
||||||
|
|
||||||
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
|
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||||
|
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
||||||
|
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
|
||||||
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
|
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||||
|
|
||||||
|
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||||
|
return 0, ENOSYS
|
||||||
|
}
|
||||||
|
|
|
||||||
31
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
Normal file
31
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build darwin,go1.12
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// Implemented in the runtime package (runtime/sys_darwin.go)
|
||||||
|
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only
|
||||||
|
func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
|
||||||
|
//go:linkname syscall_syscall syscall.syscall
|
||||||
|
//go:linkname syscall_syscall6 syscall.syscall6
|
||||||
|
//go:linkname syscall_syscall6X syscall.syscall6X
|
||||||
|
//go:linkname syscall_syscall9 syscall.syscall9
|
||||||
|
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
||||||
|
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
||||||
|
|
||||||
|
// Find the entry point for f. See comments in runtime/proc.go for the
|
||||||
|
// function of the same name.
|
||||||
|
//go:nosplit
|
||||||
|
func funcPC(f func()) uintptr {
|
||||||
|
return **(**uintptr)(unsafe.Pointer(&f))
|
||||||
|
}
|
||||||
16
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
16
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
|
|
@ -234,6 +234,13 @@ func Uname(uname *Utsname) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
|
|
@ -248,11 +255,13 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Dup(fd int) (nfd int, err error)
|
//sys Dup(fd int) (nfd int, err error)
|
||||||
//sys Dup2(from int, to int) (err error)
|
//sys Dup2(from int, to int) (err error)
|
||||||
//sys Exit(code int)
|
//sys Exit(code int)
|
||||||
|
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
//sys Fchdir(fd int) (err error)
|
//sys Fchdir(fd int) (err error)
|
||||||
//sys Fchflags(fd int, flags int) (err error)
|
//sys Fchflags(fd int, flags int) (err error)
|
||||||
//sys Fchmod(fd int, mode uint32) (err error)
|
//sys Fchmod(fd int, mode uint32) (err error)
|
||||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||||
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||||
//sys Flock(fd int, how int) (err error)
|
//sys Flock(fd int, how int) (err error)
|
||||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
|
|
@ -280,17 +289,22 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Kqueue() (fd int, err error)
|
//sys Kqueue() (fd int, err error)
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
//sys Lchown(path string, uid int, gid int) (err error)
|
||||||
//sys Link(path string, link string) (err error)
|
//sys Link(path string, link string) (err error)
|
||||||
|
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||||
//sys Listen(s int, backlog int) (err error)
|
//sys Listen(s int, backlog int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys Mkdir(path string, mode uint32) (err error)
|
//sys Mkdir(path string, mode uint32) (err error)
|
||||||
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mkfifo(path string, mode uint32) (err error)
|
//sys Mkfifo(path string, mode uint32) (err error)
|
||||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||||
|
//sys Mknodat(fd int, path string, mode uint32, dev int) (err error)
|
||||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||||
|
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Pathconf(path string, name int) (val int, err error)
|
//sys Pathconf(path string, name int) (val int, err error)
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||||
//sys Rename(from string, to string) (err error)
|
//sys Rename(from string, to string) (err error)
|
||||||
|
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
|
||||||
//sys Revoke(path string) (err error)
|
//sys Revoke(path string) (err error)
|
||||||
//sys Rmdir(path string) (err error)
|
//sys Rmdir(path string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||||
|
|
@ -312,11 +326,13 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||||
//sys Symlink(path string, link string) (err error)
|
//sys Symlink(path string, link string) (err error)
|
||||||
|
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Sync() (err error)
|
//sys Sync() (err error)
|
||||||
//sys Truncate(path string, length int64) (err error)
|
//sys Truncate(path string, length int64) (err error)
|
||||||
//sys Umask(newmask int) (oldmask int)
|
//sys Umask(newmask int) (oldmask int)
|
||||||
//sys Undelete(path string) (err error)
|
//sys Undelete(path string) (err error)
|
||||||
//sys Unlink(path string) (err error)
|
//sys Unlink(path string) (err error)
|
||||||
|
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||||
//sys Unmount(path string, flags int) (err error)
|
//sys Unmount(path string, flags int) (err error)
|
||||||
//sys write(fd int, p []byte) (n int, err error)
|
//sys write(fd int, p []byte) (n int, err error)
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||||
|
|
|
||||||
317
vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
317
vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
|
|
@ -13,9 +13,34 @@
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sync"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
SYS_FSTAT_FREEBSD12 = 551 // { int fstat(int fd, _Out_ struct stat *sb); }
|
||||||
|
SYS_FSTATAT_FREEBSD12 = 552 // { int fstatat(int fd, _In_z_ char *path, \
|
||||||
|
SYS_GETDIRENTRIES_FREEBSD12 = 554 // { ssize_t getdirentries(int fd, \
|
||||||
|
SYS_STATFS_FREEBSD12 = 555 // { int statfs(_In_z_ char *path, \
|
||||||
|
SYS_FSTATFS_FREEBSD12 = 556 // { int fstatfs(int fd, \
|
||||||
|
SYS_GETFSSTAT_FREEBSD12 = 557 // { int getfsstat( \
|
||||||
|
SYS_MKNODAT_FREEBSD12 = 559 // { int mknodat(int fd, _In_z_ char *path, \
|
||||||
|
)
|
||||||
|
|
||||||
|
// See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html.
|
||||||
|
var (
|
||||||
|
osreldateOnce sync.Once
|
||||||
|
osreldate uint32
|
||||||
|
)
|
||||||
|
|
||||||
|
// INO64_FIRST from /usr/src/lib/libc/sys/compat-ino64.h
|
||||||
|
const _ino64First = 1200031
|
||||||
|
|
||||||
|
func supportsABI(ver uint32) bool {
|
||||||
|
osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") })
|
||||||
|
return osreldate >= ver
|
||||||
|
}
|
||||||
|
|
||||||
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
|
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
|
||||||
type SockaddrDatalink struct {
|
type SockaddrDatalink struct {
|
||||||
Len uint8
|
Len uint8
|
||||||
|
|
@ -121,17 +146,39 @@ func Getwd() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||||
var _p0 unsafe.Pointer
|
var (
|
||||||
var bufsize uintptr
|
_p0 unsafe.Pointer
|
||||||
|
bufsize uintptr
|
||||||
|
oldBuf []statfs_freebsd11_t
|
||||||
|
needsConvert bool
|
||||||
|
)
|
||||||
|
|
||||||
if len(buf) > 0 {
|
if len(buf) > 0 {
|
||||||
_p0 = unsafe.Pointer(&buf[0])
|
if supportsABI(_ino64First) {
|
||||||
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
_p0 = unsafe.Pointer(&buf[0])
|
||||||
|
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
||||||
|
} else {
|
||||||
|
n := len(buf)
|
||||||
|
oldBuf = make([]statfs_freebsd11_t, n)
|
||||||
|
_p0 = unsafe.Pointer(&oldBuf[0])
|
||||||
|
bufsize = unsafe.Sizeof(statfs_freebsd11_t{}) * uintptr(n)
|
||||||
|
needsConvert = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
|
var sysno uintptr = SYS_GETFSSTAT
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
sysno = SYS_GETFSSTAT_FREEBSD12
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(sysno, uintptr(_p0), bufsize, uintptr(flags))
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = e1
|
err = e1
|
||||||
}
|
}
|
||||||
|
if e1 == 0 && needsConvert {
|
||||||
|
for i := range oldBuf {
|
||||||
|
buf[i].convertFrom(&oldBuf[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,6 +272,241 @@ func Uname(uname *Utsname) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Stat(path string, st *Stat_t) (err error) {
|
||||||
|
var oldStat stat_freebsd11_t
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return fstatat_freebsd12(AT_FDCWD, path, st, 0)
|
||||||
|
}
|
||||||
|
err = stat(path, &oldStat)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
st.convertFrom(&oldStat)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Lstat(path string, st *Stat_t) (err error) {
|
||||||
|
var oldStat stat_freebsd11_t
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return fstatat_freebsd12(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW)
|
||||||
|
}
|
||||||
|
err = lstat(path, &oldStat)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
st.convertFrom(&oldStat)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fstat(fd int, st *Stat_t) (err error) {
|
||||||
|
var oldStat stat_freebsd11_t
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return fstat_freebsd12(fd, st)
|
||||||
|
}
|
||||||
|
err = fstat(fd, &oldStat)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
st.convertFrom(&oldStat)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fstatat(fd int, path string, st *Stat_t, flags int) (err error) {
|
||||||
|
var oldStat stat_freebsd11_t
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return fstatat_freebsd12(fd, path, st, flags)
|
||||||
|
}
|
||||||
|
err = fstatat(fd, path, &oldStat, flags)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
st.convertFrom(&oldStat)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Statfs(path string, st *Statfs_t) (err error) {
|
||||||
|
var oldStatfs statfs_freebsd11_t
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return statfs_freebsd12(path, st)
|
||||||
|
}
|
||||||
|
err = statfs(path, &oldStatfs)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
st.convertFrom(&oldStatfs)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fstatfs(fd int, st *Statfs_t) (err error) {
|
||||||
|
var oldStatfs statfs_freebsd11_t
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return fstatfs_freebsd12(fd, st)
|
||||||
|
}
|
||||||
|
err = fstatfs(fd, &oldStatfs)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
st.convertFrom(&oldStatfs)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Getdents(fd int, buf []byte) (n int, err error) {
|
||||||
|
return Getdirentries(fd, buf, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return getdirentries_freebsd12(fd, buf, basep)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The old syscall entries are smaller than the new. Use 1/4 of the original
|
||||||
|
// buffer size rounded up to DIRBLKSIZ (see /usr/src/lib/libc/sys/getdirentries.c).
|
||||||
|
oldBufLen := roundup(len(buf)/4, _dirblksiz)
|
||||||
|
oldBuf := make([]byte, oldBufLen)
|
||||||
|
n, err = getdirentries(fd, oldBuf, basep)
|
||||||
|
if err == nil && n > 0 {
|
||||||
|
n = convertFromDirents11(buf, oldBuf[:n])
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Mknod(path string, mode uint32, dev uint64) (err error) {
|
||||||
|
var oldDev int
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return mknodat_freebsd12(AT_FDCWD, path, mode, dev)
|
||||||
|
}
|
||||||
|
oldDev = int(dev)
|
||||||
|
return mknod(path, mode, oldDev)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) {
|
||||||
|
var oldDev int
|
||||||
|
if supportsABI(_ino64First) {
|
||||||
|
return mknodat_freebsd12(fd, path, mode, dev)
|
||||||
|
}
|
||||||
|
oldDev = int(dev)
|
||||||
|
return mknodat(fd, path, mode, oldDev)
|
||||||
|
}
|
||||||
|
|
||||||
|
// round x to the nearest multiple of y, larger or equal to x.
|
||||||
|
//
|
||||||
|
// from /usr/include/sys/param.h Macros for counting and rounding.
|
||||||
|
// #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
||||||
|
func roundup(x, y int) int {
|
||||||
|
return ((x + y - 1) / y) * y
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Stat_t) convertFrom(old *stat_freebsd11_t) {
|
||||||
|
*s = Stat_t{
|
||||||
|
Dev: uint64(old.Dev),
|
||||||
|
Ino: uint64(old.Ino),
|
||||||
|
Nlink: uint64(old.Nlink),
|
||||||
|
Mode: old.Mode,
|
||||||
|
Uid: old.Uid,
|
||||||
|
Gid: old.Gid,
|
||||||
|
Rdev: uint64(old.Rdev),
|
||||||
|
Atim: old.Atim,
|
||||||
|
Mtim: old.Mtim,
|
||||||
|
Ctim: old.Ctim,
|
||||||
|
Birthtim: old.Birthtim,
|
||||||
|
Size: old.Size,
|
||||||
|
Blocks: old.Blocks,
|
||||||
|
Blksize: old.Blksize,
|
||||||
|
Flags: old.Flags,
|
||||||
|
Gen: uint64(old.Gen),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Statfs_t) convertFrom(old *statfs_freebsd11_t) {
|
||||||
|
*s = Statfs_t{
|
||||||
|
Version: _statfsVersion,
|
||||||
|
Type: old.Type,
|
||||||
|
Flags: old.Flags,
|
||||||
|
Bsize: old.Bsize,
|
||||||
|
Iosize: old.Iosize,
|
||||||
|
Blocks: old.Blocks,
|
||||||
|
Bfree: old.Bfree,
|
||||||
|
Bavail: old.Bavail,
|
||||||
|
Files: old.Files,
|
||||||
|
Ffree: old.Ffree,
|
||||||
|
Syncwrites: old.Syncwrites,
|
||||||
|
Asyncwrites: old.Asyncwrites,
|
||||||
|
Syncreads: old.Syncreads,
|
||||||
|
Asyncreads: old.Asyncreads,
|
||||||
|
// Spare
|
||||||
|
Namemax: old.Namemax,
|
||||||
|
Owner: old.Owner,
|
||||||
|
Fsid: old.Fsid,
|
||||||
|
// Charspare
|
||||||
|
// Fstypename
|
||||||
|
// Mntfromname
|
||||||
|
// Mntonname
|
||||||
|
}
|
||||||
|
|
||||||
|
sl := old.Fstypename[:]
|
||||||
|
n := clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
||||||
|
copy(s.Fstypename[:], old.Fstypename[:n])
|
||||||
|
|
||||||
|
sl = old.Mntfromname[:]
|
||||||
|
n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
||||||
|
copy(s.Mntfromname[:], old.Mntfromname[:n])
|
||||||
|
|
||||||
|
sl = old.Mntonname[:]
|
||||||
|
n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
||||||
|
copy(s.Mntonname[:], old.Mntonname[:n])
|
||||||
|
}
|
||||||
|
|
||||||
|
func convertFromDirents11(buf []byte, old []byte) int {
|
||||||
|
const (
|
||||||
|
fixedSize = int(unsafe.Offsetof(Dirent{}.Name))
|
||||||
|
oldFixedSize = int(unsafe.Offsetof(dirent_freebsd11{}.Name))
|
||||||
|
)
|
||||||
|
|
||||||
|
dstPos := 0
|
||||||
|
srcPos := 0
|
||||||
|
for dstPos+fixedSize < len(buf) && srcPos+oldFixedSize < len(old) {
|
||||||
|
dstDirent := (*Dirent)(unsafe.Pointer(&buf[dstPos]))
|
||||||
|
srcDirent := (*dirent_freebsd11)(unsafe.Pointer(&old[srcPos]))
|
||||||
|
|
||||||
|
reclen := roundup(fixedSize+int(srcDirent.Namlen)+1, 8)
|
||||||
|
if dstPos+reclen > len(buf) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
dstDirent.Fileno = uint64(srcDirent.Fileno)
|
||||||
|
dstDirent.Off = 0
|
||||||
|
dstDirent.Reclen = uint16(reclen)
|
||||||
|
dstDirent.Type = srcDirent.Type
|
||||||
|
dstDirent.Pad0 = 0
|
||||||
|
dstDirent.Namlen = uint16(srcDirent.Namlen)
|
||||||
|
dstDirent.Pad1 = 0
|
||||||
|
|
||||||
|
copy(dstDirent.Name[:], srcDirent.Name[:srcDirent.Namlen])
|
||||||
|
padding := buf[dstPos+fixedSize+int(dstDirent.Namlen) : dstPos+reclen]
|
||||||
|
for i := range padding {
|
||||||
|
padding[i] = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
dstPos += int(dstDirent.Reclen)
|
||||||
|
srcPos += int(srcDirent.Reclen)
|
||||||
|
}
|
||||||
|
|
||||||
|
return dstPos
|
||||||
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
|
|
@ -264,13 +546,16 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||||
//sys Flock(fd int, how int) (err error)
|
//sys Flock(fd int, how int) (err error)
|
||||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
//sys fstat(fd int, stat *stat_freebsd11_t) (err error)
|
||||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
//sys fstat_freebsd12(fd int, stat *Stat_t) (err error)
|
||||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
//sys fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error)
|
||||||
|
//sys fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||||
|
//sys fstatfs(fd int, stat *statfs_freebsd11_t) (err error)
|
||||||
|
//sys fstatfs_freebsd12(fd int, stat *Statfs_t) (err error)
|
||||||
//sys Fsync(fd int) (err error)
|
//sys Fsync(fd int) (err error)
|
||||||
//sys Ftruncate(fd int, length int64) (err error)
|
//sys Ftruncate(fd int, length int64) (err error)
|
||||||
//sys Getdents(fd int, buf []byte) (n int, err error)
|
//sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
|
||||||
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
|
//sys getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error)
|
||||||
//sys Getdtablesize() (size int)
|
//sys Getdtablesize() (size int)
|
||||||
//sysnb Getegid() (egid int)
|
//sysnb Getegid() (egid int)
|
||||||
//sysnb Geteuid() (uid int)
|
//sysnb Geteuid() (uid int)
|
||||||
|
|
@ -292,11 +577,13 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Link(path string, link string) (err error)
|
//sys Link(path string, link string) (err error)
|
||||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||||
//sys Listen(s int, backlog int) (err error)
|
//sys Listen(s int, backlog int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys lstat(path string, stat *stat_freebsd11_t) (err error)
|
||||||
//sys Mkdir(path string, mode uint32) (err error)
|
//sys Mkdir(path string, mode uint32) (err error)
|
||||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mkfifo(path string, mode uint32) (err error)
|
//sys Mkfifo(path string, mode uint32) (err error)
|
||||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
//sys mknod(path string, mode uint32, dev int) (err error)
|
||||||
|
//sys mknodat(fd int, path string, mode uint32, dev int) (err error)
|
||||||
|
//sys mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error)
|
||||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error)
|
//sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error)
|
||||||
|
|
@ -326,8 +613,9 @@ func Uname(uname *Utsname) error {
|
||||||
//sysnb Setsid() (pid int, err error)
|
//sysnb Setsid() (pid int, err error)
|
||||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||||
//sysnb Setuid(uid int) (err error)
|
//sysnb Setuid(uid int) (err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys stat(path string, stat *stat_freebsd11_t) (err error)
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
//sys statfs(path string, stat *statfs_freebsd11_t) (err error)
|
||||||
|
//sys statfs_freebsd12(path string, stat *Statfs_t) (err error)
|
||||||
//sys Symlink(path string, link string) (err error)
|
//sys Symlink(path string, link string) (err error)
|
||||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Sync() (err error)
|
//sys Sync() (err error)
|
||||||
|
|
@ -382,6 +670,7 @@ func Uname(uname *Utsname) error {
|
||||||
// Kqueue_portset
|
// Kqueue_portset
|
||||||
// Getattrlist
|
// Getattrlist
|
||||||
// Setattrlist
|
// Setattrlist
|
||||||
|
// Getdents
|
||||||
// Getdirentriesattr
|
// Getdirentriesattr
|
||||||
// Searchfs
|
// Searchfs
|
||||||
// Delete
|
// Delete
|
||||||
|
|
|
||||||
52
vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
generated
vendored
Normal file
52
vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build arm64,freebsd
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
|
return Timespec{Sec: sec, Nsec: nsec}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setTimeval(sec, usec int64) Timeval {
|
||||||
|
return Timeval{Sec: sec, Usec: usec}
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||||
|
k.Ident = uint64(fd)
|
||||||
|
k.Filter = int16(mode)
|
||||||
|
k.Flags = uint16(flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (iov *Iovec) SetLen(length int) {
|
||||||
|
iov.Len = uint64(length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msghdr *Msghdr) SetControllen(length int) {
|
||||||
|
msghdr.Controllen = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
|
cmsg.Len = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
var writtenOut uint64 = 0
|
||||||
|
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
||||||
|
|
||||||
|
written = int(writtenOut)
|
||||||
|
|
||||||
|
if e1 != 0 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
212
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
212
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
|
|
@ -12,6 +12,9 @@
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/binary"
|
||||||
|
"net"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
@ -36,6 +39,20 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
||||||
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error)
|
||||||
|
//sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error)
|
||||||
|
|
||||||
|
func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) (err error) {
|
||||||
|
if pathname == "" {
|
||||||
|
return fanotifyMark(fd, flags, mask, dirFd, nil)
|
||||||
|
}
|
||||||
|
p, err := BytePtrFromString(pathname)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return fanotifyMark(fd, flags, mask, dirFd, p)
|
||||||
|
}
|
||||||
|
|
||||||
//sys fchmodat(dirfd int, path string, mode uint32) (err error)
|
//sys fchmodat(dirfd int, path string, mode uint32) (err error)
|
||||||
|
|
||||||
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
|
|
@ -55,6 +72,15 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
// ioctl itself should not be exposed directly, but additional get/set
|
// ioctl itself should not be exposed directly, but additional get/set
|
||||||
// functions for specific types are permissible.
|
// functions for specific types are permissible.
|
||||||
|
|
||||||
|
// IoctlSetPointerInt performs an ioctl operation which sets an
|
||||||
|
// integer value on fd, using the specified request number. The ioctl
|
||||||
|
// argument is called with a pointer to the integer value, rather than
|
||||||
|
// passing the integer value directly.
|
||||||
|
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
||||||
|
v := int32(value)
|
||||||
|
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
|
||||||
|
}
|
||||||
|
|
||||||
// IoctlSetInt performs an ioctl operation which sets an integer value
|
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||||
// on fd, using the specified request number.
|
// on fd, using the specified request number.
|
||||||
func IoctlSetInt(fd int, req uint, value int) error {
|
func IoctlSetInt(fd int, req uint, value int) error {
|
||||||
|
|
@ -69,6 +95,12 @@ func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
||||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IoctlSetRTCTime(fd int, value *RTCTime) error {
|
||||||
|
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
|
||||||
|
runtime.KeepAlive(value)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// IoctlGetInt performs an ioctl operation which gets an integer value
|
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||||
// from fd, using the specified request number.
|
// from fd, using the specified request number.
|
||||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
func IoctlGetInt(fd int, req uint) (int, error) {
|
||||||
|
|
@ -89,6 +121,12 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IoctlGetRTCTime(fd int) (*RTCTime, error) {
|
||||||
|
var value RTCTime
|
||||||
|
err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value)))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
||||||
|
|
||||||
func Link(oldpath string, newpath string) (err error) {
|
func Link(oldpath string, newpath string) (err error) {
|
||||||
|
|
@ -710,6 +748,51 @@ func (sa *SockaddrXDP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrXDP, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrXDP, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This constant mirrors the #define of PX_PROTO_OE in
|
||||||
|
// linux/if_pppox.h. We're defining this by hand here instead of
|
||||||
|
// autogenerating through mkerrors.sh because including
|
||||||
|
// linux/if_pppox.h causes some declaration conflicts with other
|
||||||
|
// includes (linux/if_pppox.h includes linux/in.h, which conflicts
|
||||||
|
// with netinet/in.h). Given that we only need a single zero constant
|
||||||
|
// out of that file, it's cleaner to just define it by hand here.
|
||||||
|
const px_proto_oe = 0
|
||||||
|
|
||||||
|
type SockaddrPPPoE struct {
|
||||||
|
SID uint16
|
||||||
|
Remote net.HardwareAddr
|
||||||
|
Dev string
|
||||||
|
raw RawSockaddrPPPoX
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sa *SockaddrPPPoE) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
|
if len(sa.Remote) != 6 {
|
||||||
|
return nil, 0, EINVAL
|
||||||
|
}
|
||||||
|
if len(sa.Dev) > IFNAMSIZ-1 {
|
||||||
|
return nil, 0, EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
*(*uint16)(unsafe.Pointer(&sa.raw[0])) = AF_PPPOX
|
||||||
|
// This next field is in host-endian byte order. We can't use the
|
||||||
|
// same unsafe pointer cast as above, because this value is not
|
||||||
|
// 32-bit aligned and some architectures don't allow unaligned
|
||||||
|
// access.
|
||||||
|
//
|
||||||
|
// However, the value of px_proto_oe is 0, so we can use
|
||||||
|
// encoding/binary helpers to write the bytes without worrying
|
||||||
|
// about the ordering.
|
||||||
|
binary.BigEndian.PutUint32(sa.raw[2:6], px_proto_oe)
|
||||||
|
// This field is deliberately big-endian, unlike the previous
|
||||||
|
// one. The kernel expects SID to be in network byte order.
|
||||||
|
binary.BigEndian.PutUint16(sa.raw[6:8], sa.SID)
|
||||||
|
copy(sa.raw[8:14], sa.Remote)
|
||||||
|
for i := 14; i < 14+IFNAMSIZ; i++ {
|
||||||
|
sa.raw[i] = 0
|
||||||
|
}
|
||||||
|
copy(sa.raw[14:], sa.Dev)
|
||||||
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil
|
||||||
|
}
|
||||||
|
|
||||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
switch rsa.Addr.Family {
|
switch rsa.Addr.Family {
|
||||||
case AF_NETLINK:
|
case AF_NETLINK:
|
||||||
|
|
@ -820,6 +903,22 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
SharedUmemFD: pp.Shared_umem_fd,
|
SharedUmemFD: pp.Shared_umem_fd,
|
||||||
}
|
}
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
case AF_PPPOX:
|
||||||
|
pp := (*RawSockaddrPPPoX)(unsafe.Pointer(rsa))
|
||||||
|
if binary.BigEndian.Uint32(pp[2:6]) != px_proto_oe {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
sa := &SockaddrPPPoE{
|
||||||
|
SID: binary.BigEndian.Uint16(pp[6:8]),
|
||||||
|
Remote: net.HardwareAddr(pp[8:14]),
|
||||||
|
}
|
||||||
|
for i := 14; i < 14+IFNAMSIZ; i++ {
|
||||||
|
if pp[i] == 0 {
|
||||||
|
sa.Dev = string(pp[14:i])
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sa, nil
|
||||||
}
|
}
|
||||||
return nil, EAFNOSUPPORT
|
return nil, EAFNOSUPPORT
|
||||||
}
|
}
|
||||||
|
|
@ -905,10 +1004,50 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
return string(buf[:vallen-1]), nil
|
return string(buf[:vallen-1]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) {
|
||||||
|
var value TpacketStats
|
||||||
|
vallen := _Socklen(SizeofTpacketStats)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetsockoptTpacketStatsV3(fd, level, opt int) (*TpacketStatsV3, error) {
|
||||||
|
var value TpacketStatsV3
|
||||||
|
vallen := _Socklen(SizeofTpacketStatsV3)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
|
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
|
||||||
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetsockoptPacketMreq(fd, level, opt int, mreq *PacketMreq) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetsockoptSockFprog attaches a classic BPF or an extended BPF program to a
|
||||||
|
// socket to filter incoming packets. See 'man 7 socket' for usage information.
|
||||||
|
func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(fprog), unsafe.Sizeof(*fprog))
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetsockoptCanRawFilter(fd, level, opt int, filter []CanFilter) error {
|
||||||
|
var p unsafe.Pointer
|
||||||
|
if len(filter) > 0 {
|
||||||
|
p = unsafe.Pointer(&filter[0])
|
||||||
|
}
|
||||||
|
return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter))
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetsockoptTpacketReq(fd, level, opt int, tp *TpacketReq) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
|
||||||
|
}
|
||||||
|
|
||||||
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
||||||
|
|
||||||
// KeyctlInt calls keyctl commands in which each argument is an int.
|
// KeyctlInt calls keyctl commands in which each argument is an int.
|
||||||
|
|
@ -1122,7 +1261,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
|
||||||
// The ptrace syscall differs from glibc's ptrace.
|
// The ptrace syscall differs from glibc's ptrace.
|
||||||
// Peeks returns the word in *data, not as the return value.
|
// Peeks returns the word in *data, not as the return value.
|
||||||
|
|
||||||
var buf [sizeofPtr]byte
|
var buf [SizeofPtr]byte
|
||||||
|
|
||||||
// Leading edge. PEEKTEXT/PEEKDATA don't require aligned
|
// Leading edge. PEEKTEXT/PEEKDATA don't require aligned
|
||||||
// access (PEEKUSER warns that it might), but if we don't
|
// access (PEEKUSER warns that it might), but if we don't
|
||||||
|
|
@ -1130,12 +1269,12 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
|
||||||
// boundary and not get the bytes leading up to the page
|
// boundary and not get the bytes leading up to the page
|
||||||
// boundary.
|
// boundary.
|
||||||
n := 0
|
n := 0
|
||||||
if addr%sizeofPtr != 0 {
|
if addr%SizeofPtr != 0 {
|
||||||
err = ptrace(req, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
n += copy(out, buf[addr%sizeofPtr:])
|
n += copy(out, buf[addr%SizeofPtr:])
|
||||||
out = out[n:]
|
out = out[n:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1173,15 +1312,15 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
|
||||||
|
|
||||||
// Leading edge.
|
// Leading edge.
|
||||||
n := 0
|
n := 0
|
||||||
if addr%sizeofPtr != 0 {
|
if addr%SizeofPtr != 0 {
|
||||||
var buf [sizeofPtr]byte
|
var buf [SizeofPtr]byte
|
||||||
err = ptrace(peekReq, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
n += copy(buf[addr%sizeofPtr:], data)
|
n += copy(buf[addr%SizeofPtr:], data)
|
||||||
word := *((*uintptr)(unsafe.Pointer(&buf[0])))
|
word := *((*uintptr)(unsafe.Pointer(&buf[0])))
|
||||||
err = ptrace(pokeReq, pid, addr-addr%sizeofPtr, word)
|
err = ptrace(pokeReq, pid, addr-addr%SizeofPtr, word)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
@ -1189,19 +1328,19 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interior.
|
// Interior.
|
||||||
for len(data) > sizeofPtr {
|
for len(data) > SizeofPtr {
|
||||||
word := *((*uintptr)(unsafe.Pointer(&data[0])))
|
word := *((*uintptr)(unsafe.Pointer(&data[0])))
|
||||||
err = ptrace(pokeReq, pid, addr+uintptr(n), word)
|
err = ptrace(pokeReq, pid, addr+uintptr(n), word)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
n += sizeofPtr
|
n += SizeofPtr
|
||||||
data = data[sizeofPtr:]
|
data = data[SizeofPtr:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trailing edge.
|
// Trailing edge.
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
var buf [sizeofPtr]byte
|
var buf [SizeofPtr]byte
|
||||||
err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
|
err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return n, err
|
return n, err
|
||||||
|
|
@ -1288,6 +1427,13 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
||||||
return mount(source, target, fstype, flags, datap)
|
return mount(source, target, fstype, flags, datap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
// Sendto
|
// Sendto
|
||||||
// Recvfrom
|
// Recvfrom
|
||||||
// Socketpair
|
// Socketpair
|
||||||
|
|
@ -1300,9 +1446,12 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
||||||
//sys Adjtimex(buf *Timex) (state int, err error)
|
//sys Adjtimex(buf *Timex) (state int, err error)
|
||||||
//sys Chdir(path string) (err error)
|
//sys Chdir(path string) (err error)
|
||||||
//sys Chroot(path string) (err error)
|
//sys Chroot(path string) (err error)
|
||||||
|
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
||||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||||
|
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
||||||
//sys Close(fd int) (err error)
|
//sys Close(fd int) (err error)
|
||||||
//sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
//sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||||
|
//sys DeleteModule(name string, flags int) (err error)
|
||||||
//sys Dup(oldfd int) (fd int, err error)
|
//sys Dup(oldfd int) (fd int, err error)
|
||||||
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
||||||
//sysnb EpollCreate1(flag int) (fd int, err error)
|
//sysnb EpollCreate1(flag int) (fd int, err error)
|
||||||
|
|
@ -1316,6 +1465,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
||||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||||
//sys Fdatasync(fd int) (err error)
|
//sys Fdatasync(fd int) (err error)
|
||||||
//sys Fgetxattr(fd int, attr string, dest []byte) (sz int, err error)
|
//sys Fgetxattr(fd int, attr string, dest []byte) (sz int, err error)
|
||||||
|
//sys FinitModule(fd int, params string, flags int) (err error)
|
||||||
//sys Flistxattr(fd int, dest []byte) (sz int, err error)
|
//sys Flistxattr(fd int, dest []byte) (sz int, err error)
|
||||||
//sys Flock(fd int, how int) (err error)
|
//sys Flock(fd int, how int) (err error)
|
||||||
//sys Fremovexattr(fd int, attr string) (err error)
|
//sys Fremovexattr(fd int, attr string) (err error)
|
||||||
|
|
@ -1337,6 +1487,7 @@ func Getpgrp() (pid int) {
|
||||||
//sysnb Getsid(pid int) (sid int, err error)
|
//sysnb Getsid(pid int) (sid int, err error)
|
||||||
//sysnb Gettid() (tid int)
|
//sysnb Gettid() (tid int)
|
||||||
//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
|
//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
|
||||||
|
//sys InitModule(moduleImage []byte, params string) (err error)
|
||||||
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
|
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
|
||||||
//sysnb InotifyInit1(flags int) (fd int, err error)
|
//sysnb InotifyInit1(flags int) (fd int, err error)
|
||||||
//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
|
//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
|
||||||
|
|
@ -1358,7 +1509,6 @@ func Getpgrp() (pid int) {
|
||||||
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
|
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
//sys Removexattr(path string, attr string) (err error)
|
//sys Removexattr(path string, attr string) (err error)
|
||||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
|
||||||
//sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error)
|
//sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error)
|
||||||
//sys RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error)
|
//sys RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error)
|
||||||
//sys Setdomainname(p []byte) (err error)
|
//sys Setdomainname(p []byte) (err error)
|
||||||
|
|
@ -1383,6 +1533,7 @@ func Setgid(uid int) (err error) {
|
||||||
|
|
||||||
//sys Setpriority(which int, who int, prio int) (err error)
|
//sys Setpriority(which int, who int, prio int) (err error)
|
||||||
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
|
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
|
||||||
|
//sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4
|
||||||
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
||||||
//sys Sync()
|
//sys Sync()
|
||||||
//sys Syncfs(fd int) (err error)
|
//sys Syncfs(fd int) (err error)
|
||||||
|
|
@ -1427,15 +1578,12 @@ func Munmap(b []byte) (err error) {
|
||||||
// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
|
// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
|
||||||
// using the specified flags.
|
// using the specified flags.
|
||||||
func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||||
n, _, errno := Syscall6(
|
var p unsafe.Pointer
|
||||||
SYS_VMSPLICE,
|
if len(iovs) > 0 {
|
||||||
uintptr(fd),
|
p = unsafe.Pointer(&iovs[0])
|
||||||
uintptr(unsafe.Pointer(&iovs[0])),
|
}
|
||||||
uintptr(len(iovs)),
|
|
||||||
uintptr(flags),
|
n, _, errno := Syscall6(SYS_VMSPLICE, uintptr(fd), uintptr(p), uintptr(len(iovs)), uintptr(flags), 0, 0)
|
||||||
0,
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
if errno != 0 {
|
if errno != 0 {
|
||||||
return 0, syscall.Errno(errno)
|
return 0, syscall.Errno(errno)
|
||||||
}
|
}
|
||||||
|
|
@ -1514,6 +1662,19 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
return EACCES
|
return EACCES
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT
|
||||||
|
//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT
|
||||||
|
|
||||||
|
// fileHandle is the argument to nameToHandleAt and openByHandleAt. We
|
||||||
|
// originally tried to generate it via unix/linux/types.go with "type
|
||||||
|
// fileHandle C.struct_file_handle" but that generated empty structs
|
||||||
|
// for mips64 and mips64le. Instead, hard code it for now (it's the
|
||||||
|
// same everywhere else) until the mips64 generator issue is fixed.
|
||||||
|
type fileHandle struct {
|
||||||
|
Bytes uint32
|
||||||
|
Type int32
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unimplemented
|
* Unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
@ -1523,12 +1684,9 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
// Brk
|
// Brk
|
||||||
// Capget
|
// Capget
|
||||||
// Capset
|
// Capset
|
||||||
// ClockGetres
|
|
||||||
// ClockNanosleep
|
// ClockNanosleep
|
||||||
// ClockSettime
|
// ClockSettime
|
||||||
// Clone
|
// Clone
|
||||||
// CreateModule
|
|
||||||
// DeleteModule
|
|
||||||
// EpollCtlOld
|
// EpollCtlOld
|
||||||
// EpollPwait
|
// EpollPwait
|
||||||
// EpollWaitOld
|
// EpollWaitOld
|
||||||
|
|
@ -1572,7 +1730,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
// Pselect6
|
// Pselect6
|
||||||
// Ptrace
|
// Ptrace
|
||||||
// Putpmsg
|
// Putpmsg
|
||||||
// QueryModule
|
|
||||||
// Quotactl
|
// Quotactl
|
||||||
// Readahead
|
// Readahead
|
||||||
// Readv
|
// Readv
|
||||||
|
|
@ -1606,7 +1763,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
// Shmdt
|
// Shmdt
|
||||||
// Shmget
|
// Shmget
|
||||||
// Sigaltstack
|
// Sigaltstack
|
||||||
// Signalfd
|
|
||||||
// Swapoff
|
// Swapoff
|
||||||
// Swapon
|
// Swapon
|
||||||
// Sysfs
|
// Sysfs
|
||||||
|
|
|
||||||
1
vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
|
|
@ -68,6 +68,7 @@ func Pipe2(p []int, flags int) (err error) {
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||||
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
|
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
|
||||||
//sys Setfsuid(uid int) (err error) = SYS_SETFSUID32
|
//sys Setfsuid(uid int) (err error) = SYS_SETFSUID32
|
||||||
|
|
|
||||||
32
vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
generated
vendored
32
vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
generated
vendored
|
|
@ -20,15 +20,30 @@ package unix
|
||||||
//sysnb Getgid() (gid int)
|
//sysnb Getgid() (gid int)
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Getuid() (uid int)
|
//sysnb Getuid() (uid int)
|
||||||
//sysnb InotifyInit() (fd int, err error)
|
//sysnb inotifyInit() (fd int, err error)
|
||||||
|
|
||||||
|
func InotifyInit() (fd int, err error) {
|
||||||
|
// First try inotify_init1, because Android's seccomp policy blocks the latter.
|
||||||
|
fd, err = InotifyInit1(0)
|
||||||
|
if err == ENOSYS {
|
||||||
|
fd, err = inotifyInit()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//sys Ioperm(from int, num int, on int) (err error)
|
//sys Ioperm(from int, num int, on int) (err error)
|
||||||
//sys Iopl(level int) (err error)
|
//sys Iopl(level int) (err error)
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
//sys Lchown(path string, uid int, gid int) (err error)
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
|
||||||
|
func Lstat(path string, stat *Stat_t) (err error) {
|
||||||
|
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
|
||||||
|
}
|
||||||
|
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
|
|
||||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||||
|
|
@ -160,3 +175,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
}
|
}
|
||||||
return poll(&fds[0], len(fds), timeout)
|
return poll(&fds[0], len(fds), timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||||
|
|
||||||
|
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||||
|
cmdlineLen := len(cmdline)
|
||||||
|
if cmdlineLen > 0 {
|
||||||
|
// Account for the additional NULL byte added by
|
||||||
|
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||||
|
// syscall expects a NULL-terminated string.
|
||||||
|
cmdlineLen++
|
||||||
|
}
|
||||||
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
|
}
|
||||||
|
|
|
||||||
15
vendor/golang.org/x/sys/unix/syscall_linux_arm.go
generated
vendored
15
vendor/golang.org/x/sys/unix/syscall_linux_arm.go
generated
vendored
|
|
@ -19,12 +19,18 @@ func setTimeval(sec, usec int64) Timeval {
|
||||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sysnb pipe(p *[2]_C_int) (err error)
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
func Pipe(p []int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
var pp [2]_C_int
|
var pp [2]_C_int
|
||||||
|
// Try pipe2 first for Android O, then try pipe for kernel 2.6.23.
|
||||||
err = pipe2(&pp, 0)
|
err = pipe2(&pp, 0)
|
||||||
|
if err == ENOSYS {
|
||||||
|
err = pipe(&pp)
|
||||||
|
}
|
||||||
p[0] = int(pp[0])
|
p[0] = int(pp[0])
|
||||||
p[1] = int(pp[1])
|
p[1] = int(pp[1])
|
||||||
return
|
return
|
||||||
|
|
@ -89,6 +95,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||||
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
|
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
|
||||||
|
|
@ -257,3 +264,11 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
}
|
}
|
||||||
return poll(&fds[0], len(fds), timeout)
|
return poll(&fds[0], len(fds), timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE
|
||||||
|
|
||||||
|
func SyncFileRange(fd int, off int64, n int64, flags int) error {
|
||||||
|
// The sync_file_range and arm_sync_file_range syscalls differ only in the
|
||||||
|
// order of their arguments.
|
||||||
|
return armSyncFileRange(fd, flags, off, n)
|
||||||
|
}
|
||||||
|
|
|
||||||
23
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
23
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
|
|
@ -30,6 +30,7 @@ func EpollCreate(size int) (fd int, err error) {
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
|
|
||||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||||
|
|
@ -191,12 +192,9 @@ func Dup2(oldfd int, newfd int) (err error) {
|
||||||
return Dup3(oldfd, newfd, 0)
|
return Dup3(oldfd, newfd, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Pause() (err error) {
|
func Pause() error {
|
||||||
_, _, e1 := Syscall6(SYS_PPOLL, 0, 0, 0, 0, 0, 0)
|
_, err := ppoll(nil, 0, nil, nil)
|
||||||
if e1 != 0 {
|
return err
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
|
|
@ -210,3 +208,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
}
|
}
|
||||||
return ppoll(&fds[0], len(fds), ts, nil)
|
return ppoll(&fds[0], len(fds), ts, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||||
|
|
||||||
|
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||||
|
cmdlineLen := len(cmdline)
|
||||||
|
if cmdlineLen > 0 {
|
||||||
|
// Account for the additional NULL byte added by
|
||||||
|
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||||
|
// syscall expects a NULL-terminated string.
|
||||||
|
cmdlineLen++
|
||||||
|
}
|
||||||
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
|
}
|
||||||
|
|
|
||||||
10
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
generated
vendored
10
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
generated
vendored
|
|
@ -12,7 +12,6 @@ package unix
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
|
|
||||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||||
//sys Ftruncate(fd int, length int64) (err error)
|
//sys Ftruncate(fd int, length int64) (err error)
|
||||||
//sysnb Getegid() (egid int)
|
//sysnb Getegid() (egid int)
|
||||||
|
|
@ -25,6 +24,7 @@ package unix
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
|
|
||||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||||
|
|
@ -148,6 +148,7 @@ type stat_t struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys fstat(fd int, st *stat_t) (err error)
|
//sys fstat(fd int, st *stat_t) (err error)
|
||||||
|
//sys fstatat(dirfd int, path string, st *stat_t, flags int) (err error) = SYS_NEWFSTATAT
|
||||||
//sys lstat(path string, st *stat_t) (err error)
|
//sys lstat(path string, st *stat_t) (err error)
|
||||||
//sys stat(path string, st *stat_t) (err error)
|
//sys stat(path string, st *stat_t) (err error)
|
||||||
|
|
||||||
|
|
@ -158,6 +159,13 @@ func Fstat(fd int, s *Stat_t) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Fstatat(dirfd int, path string, s *Stat_t, flags int) (err error) {
|
||||||
|
st := &stat_t{}
|
||||||
|
err = fstatat(dirfd, path, st, flags)
|
||||||
|
fillStat_t(s, st)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func Lstat(path string, s *Stat_t) (err error) {
|
func Lstat(path string, s *Stat_t) (err error) {
|
||||||
st := &stat_t{}
|
st := &stat_t{}
|
||||||
err = lstat(path, st)
|
err = lstat(path, st)
|
||||||
|
|
|
||||||
1
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
generated
vendored
|
|
@ -28,6 +28,7 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||||
//sys Setfsgid(gid int) (err error)
|
//sys Setfsgid(gid int) (err error)
|
||||||
|
|
|
||||||
14
vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
generated
vendored
14
vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
generated
vendored
|
|
@ -30,6 +30,7 @@ package unix
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
|
|
@ -136,3 +137,16 @@ func SyncFileRange(fd int, off int64, n int64, flags int) error {
|
||||||
// order of their arguments.
|
// order of their arguments.
|
||||||
return syncFileRange2(fd, flags, off, n)
|
return syncFileRange2(fd, flags, off, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||||
|
|
||||||
|
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||||
|
cmdlineLen := len(cmdline)
|
||||||
|
if cmdlineLen > 0 {
|
||||||
|
// Account for the additional NULL byte added by
|
||||||
|
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||||
|
// syscall expects a NULL-terminated string.
|
||||||
|
cmdlineLen++
|
||||||
|
}
|
||||||
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
|
}
|
||||||
|
|
|
||||||
26
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
generated
vendored
26
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
generated
vendored
|
|
@ -191,12 +191,9 @@ func Dup2(oldfd int, newfd int) (err error) {
|
||||||
return Dup3(oldfd, newfd, 0)
|
return Dup3(oldfd, newfd, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Pause() (err error) {
|
func Pause() error {
|
||||||
_, _, e1 := Syscall6(SYS_PPOLL, 0, 0, 0, 0, 0, 0)
|
_, err := ppoll(nil, 0, nil, nil)
|
||||||
if e1 != 0 {
|
return err
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
|
|
@ -210,3 +207,20 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
}
|
}
|
||||||
return ppoll(&fds[0], len(fds), ts, nil)
|
return ppoll(&fds[0], len(fds), ts, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
|
||||||
|
return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||||
|
|
||||||
|
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||||
|
cmdlineLen := len(cmdline)
|
||||||
|
if cmdlineLen > 0 {
|
||||||
|
// Account for the additional NULL byte added by
|
||||||
|
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||||
|
// syscall expects a NULL-terminated string.
|
||||||
|
cmdlineLen++
|
||||||
|
}
|
||||||
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
|
}
|
||||||
|
|
|
||||||
14
vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
generated
vendored
14
vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
generated
vendored
|
|
@ -30,6 +30,7 @@ import (
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
|
|
@ -322,3 +323,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
}
|
}
|
||||||
return poll(&fds[0], len(fds), timeout)
|
return poll(&fds[0], len(fds), timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||||
|
|
||||||
|
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||||
|
cmdlineLen := len(cmdline)
|
||||||
|
if cmdlineLen > 0 {
|
||||||
|
// Account for the additional NULL byte added by
|
||||||
|
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||||
|
// syscall expects a NULL-terminated string.
|
||||||
|
cmdlineLen++
|
||||||
|
}
|
||||||
|
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||||
|
}
|
||||||
|
|
|
||||||
1
vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
generated
vendored
|
|
@ -26,6 +26,7 @@ package unix
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
|
|
|
||||||
42
vendor/golang.org/x/sys/unix/syscall_netbsd.go
generated
vendored
42
vendor/golang.org/x/sys/unix/syscall_netbsd.go
generated
vendored
|
|
@ -13,6 +13,7 @@
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
@ -93,6 +94,23 @@ func nametomib(name string) (mib []_C_int, err error) {
|
||||||
return mib, nil
|
return mib, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SysctlClockinfo(name string) (*Clockinfo, error) {
|
||||||
|
mib, err := sysctlmib(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
n := uintptr(SizeofClockinfo)
|
||||||
|
var ci Clockinfo
|
||||||
|
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n != SizeofClockinfo {
|
||||||
|
return nil, EIO
|
||||||
|
}
|
||||||
|
return &ci, nil
|
||||||
|
}
|
||||||
|
|
||||||
//sysnb pipe() (fd1 int, fd2 int, err error)
|
//sysnb pipe() (fd1 int, fd2 int, err error)
|
||||||
func Pipe(p []int) (err error) {
|
func Pipe(p []int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
|
|
@ -173,6 +191,13 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) {
|
||||||
|
var value Ptmget
|
||||||
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||||
|
runtime.KeepAlive(value)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
func Uname(uname *Utsname) error {
|
func Uname(uname *Utsname) error {
|
||||||
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
||||||
n := unsafe.Sizeof(uname.Sysname)
|
n := unsafe.Sizeof(uname.Sysname)
|
||||||
|
|
@ -219,6 +244,13 @@ func Uname(uname *Utsname) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
|
|
@ -252,6 +284,7 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Fchmod(fd int, mode uint32) (err error)
|
//sys Fchmod(fd int, mode uint32) (err error)
|
||||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||||
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||||
//sys Flock(fd int, how int) (err error)
|
//sys Flock(fd int, how int) (err error)
|
||||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
|
|
@ -276,19 +309,26 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Kqueue() (fd int, err error)
|
//sys Kqueue() (fd int, err error)
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
//sys Lchown(path string, uid int, gid int) (err error)
|
||||||
//sys Link(path string, link string) (err error)
|
//sys Link(path string, link string) (err error)
|
||||||
|
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||||
//sys Listen(s int, backlog int) (err error)
|
//sys Listen(s int, backlog int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys Mkdir(path string, mode uint32) (err error)
|
//sys Mkdir(path string, mode uint32) (err error)
|
||||||
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mkfifo(path string, mode uint32) (err error)
|
//sys Mkfifo(path string, mode uint32) (err error)
|
||||||
|
//sys Mkfifoat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||||
|
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||||
|
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Pathconf(path string, name int) (val int, err error)
|
//sys Pathconf(path string, name int) (val int, err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||||
|
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||||
//sys Rename(from string, to string) (err error)
|
//sys Rename(from string, to string) (err error)
|
||||||
|
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
|
||||||
//sys Revoke(path string) (err error)
|
//sys Revoke(path string) (err error)
|
||||||
//sys Rmdir(path string) (err error)
|
//sys Rmdir(path string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||||
|
|
@ -306,10 +346,12 @@ func Uname(uname *Utsname) error {
|
||||||
//sysnb Setuid(uid int) (err error)
|
//sysnb Setuid(uid int) (err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
//sys Symlink(path string, link string) (err error)
|
//sys Symlink(path string, link string) (err error)
|
||||||
|
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Sync() (err error)
|
//sys Sync() (err error)
|
||||||
//sys Truncate(path string, length int64) (err error)
|
//sys Truncate(path string, length int64) (err error)
|
||||||
//sys Umask(newmask int) (oldmask int)
|
//sys Umask(newmask int) (oldmask int)
|
||||||
//sys Unlink(path string) (err error)
|
//sys Unlink(path string) (err error)
|
||||||
|
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||||
//sys Unmount(path string, flags int) (err error)
|
//sys Unmount(path string, flags int) (err error)
|
||||||
//sys write(fd int, p []byte) (n int, err error)
|
//sys write(fd int, p []byte) (n int, err error)
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||||
|
|
|
||||||
33
vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go
generated
vendored
Normal file
33
vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build arm64,netbsd
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
func setTimespec(sec, nsec int64) Timespec {
|
||||||
|
return Timespec{Sec: sec, Nsec: nsec}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setTimeval(sec, usec int64) Timeval {
|
||||||
|
return Timeval{Sec: sec, Usec: int32(usec)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||||
|
k.Ident = uint64(fd)
|
||||||
|
k.Filter = uint32(mode)
|
||||||
|
k.Flags = uint32(flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (iov *Iovec) SetLen(length int) {
|
||||||
|
iov.Len = uint64(length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msghdr *Msghdr) SetControllen(length int) {
|
||||||
|
msghdr.Controllen = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
|
cmsg.Len = uint32(length)
|
||||||
|
}
|
||||||
72
vendor/golang.org/x/sys/unix/syscall_openbsd.go
generated
vendored
72
vendor/golang.org/x/sys/unix/syscall_openbsd.go
generated
vendored
|
|
@ -43,6 +43,40 @@ func nametomib(name string) (mib []_C_int, err error) {
|
||||||
return nil, EINVAL
|
return nil, EINVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SysctlClockinfo(name string) (*Clockinfo, error) {
|
||||||
|
mib, err := sysctlmib(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
n := uintptr(SizeofClockinfo)
|
||||||
|
var ci Clockinfo
|
||||||
|
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n != SizeofClockinfo {
|
||||||
|
return nil, EIO
|
||||||
|
}
|
||||||
|
return &ci, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func SysctlUvmexp(name string) (*Uvmexp, error) {
|
||||||
|
mib, err := sysctlmib(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
n := uintptr(SizeofUvmexp)
|
||||||
|
var u Uvmexp
|
||||||
|
if err := sysctl(mib, (*byte)(unsafe.Pointer(&u)), &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n != SizeofUvmexp {
|
||||||
|
return nil, EIO
|
||||||
|
}
|
||||||
|
return &u, nil
|
||||||
|
}
|
||||||
|
|
||||||
//sysnb pipe(p *[2]_C_int) (err error)
|
//sysnb pipe(p *[2]_C_int) (err error)
|
||||||
func Pipe(p []int) (err error) {
|
func Pipe(p []int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
|
|
@ -77,6 +111,13 @@ func Getwd() (string, error) {
|
||||||
return string(buf[:n]), nil
|
return string(buf[:n]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
return -1, ENOSYS
|
return -1, ENOSYS
|
||||||
|
|
@ -141,6 +182,15 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
||||||
|
|
||||||
|
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
|
if len(fds) == 0 {
|
||||||
|
return ppoll(nil, 0, timeout, sigmask)
|
||||||
|
}
|
||||||
|
return ppoll(&fds[0], len(fds), timeout, sigmask)
|
||||||
|
}
|
||||||
|
|
||||||
func Uname(uname *Utsname) error {
|
func Uname(uname *Utsname) error {
|
||||||
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
||||||
n := unsafe.Sizeof(uname.Sysname)
|
n := unsafe.Sizeof(uname.Sysname)
|
||||||
|
|
@ -207,6 +257,7 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Fchmod(fd int, mode uint32) (err error)
|
//sys Fchmod(fd int, mode uint32) (err error)
|
||||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||||
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||||
//sys Flock(fd int, how int) (err error)
|
//sys Flock(fd int, how int) (err error)
|
||||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
|
|
@ -233,19 +284,26 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Kqueue() (fd int, err error)
|
//sys Kqueue() (fd int, err error)
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
//sys Lchown(path string, uid int, gid int) (err error)
|
||||||
//sys Link(path string, link string) (err error)
|
//sys Link(path string, link string) (err error)
|
||||||
|
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||||
//sys Listen(s int, backlog int) (err error)
|
//sys Listen(s int, backlog int) (err error)
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys Mkdir(path string, mode uint32) (err error)
|
//sys Mkdir(path string, mode uint32) (err error)
|
||||||
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mkfifo(path string, mode uint32) (err error)
|
//sys Mkfifo(path string, mode uint32) (err error)
|
||||||
|
//sys Mkfifoat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||||
|
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||||
|
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Pathconf(path string, name int) (val int, err error)
|
//sys Pathconf(path string, name int) (val int, err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||||
|
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||||
//sys Rename(from string, to string) (err error)
|
//sys Rename(from string, to string) (err error)
|
||||||
|
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
|
||||||
//sys Revoke(path string) (err error)
|
//sys Revoke(path string) (err error)
|
||||||
//sys Rmdir(path string) (err error)
|
//sys Rmdir(path string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||||
|
|
@ -268,10 +326,12 @@ func Uname(uname *Utsname) error {
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||||
//sys Symlink(path string, link string) (err error)
|
//sys Symlink(path string, link string) (err error)
|
||||||
|
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Sync() (err error)
|
//sys Sync() (err error)
|
||||||
//sys Truncate(path string, length int64) (err error)
|
//sys Truncate(path string, length int64) (err error)
|
||||||
//sys Umask(newmask int) (oldmask int)
|
//sys Umask(newmask int) (oldmask int)
|
||||||
//sys Unlink(path string) (err error)
|
//sys Unlink(path string) (err error)
|
||||||
|
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||||
//sys Unmount(path string, flags int) (err error)
|
//sys Unmount(path string, flags int) (err error)
|
||||||
//sys write(fd int, p []byte) (n int, err error)
|
//sys write(fd int, p []byte) (n int, err error)
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||||
|
|
@ -294,15 +354,11 @@ func Uname(uname *Utsname) error {
|
||||||
// clock_settime
|
// clock_settime
|
||||||
// closefrom
|
// closefrom
|
||||||
// execve
|
// execve
|
||||||
// faccessat
|
|
||||||
// fchmodat
|
|
||||||
// fchownat
|
|
||||||
// fcntl
|
// fcntl
|
||||||
// fhopen
|
// fhopen
|
||||||
// fhstat
|
// fhstat
|
||||||
// fhstatfs
|
// fhstatfs
|
||||||
// fork
|
// fork
|
||||||
// fstatat
|
|
||||||
// futimens
|
// futimens
|
||||||
// getfh
|
// getfh
|
||||||
// getgid
|
// getgid
|
||||||
|
|
@ -316,12 +372,8 @@ func Uname(uname *Utsname) error {
|
||||||
// lfs_markv
|
// lfs_markv
|
||||||
// lfs_segclean
|
// lfs_segclean
|
||||||
// lfs_segwait
|
// lfs_segwait
|
||||||
// linkat
|
|
||||||
// mincore
|
// mincore
|
||||||
// minherit
|
// minherit
|
||||||
// mkdirat
|
|
||||||
// mkfifoat
|
|
||||||
// mknodat
|
|
||||||
// mount
|
// mount
|
||||||
// mquery
|
// mquery
|
||||||
// msgctl
|
// msgctl
|
||||||
|
|
@ -330,12 +382,10 @@ func Uname(uname *Utsname) error {
|
||||||
// msgsnd
|
// msgsnd
|
||||||
// nfssvc
|
// nfssvc
|
||||||
// nnpfspioctl
|
// nnpfspioctl
|
||||||
// openat
|
|
||||||
// preadv
|
// preadv
|
||||||
// profil
|
// profil
|
||||||
// pwritev
|
// pwritev
|
||||||
// quotactl
|
// quotactl
|
||||||
// readlinkat
|
|
||||||
// readv
|
// readv
|
||||||
// reboot
|
// reboot
|
||||||
// renameat
|
// renameat
|
||||||
|
|
@ -356,13 +406,11 @@ func Uname(uname *Utsname) error {
|
||||||
// sigprocmask
|
// sigprocmask
|
||||||
// sigreturn
|
// sigreturn
|
||||||
// sigsuspend
|
// sigsuspend
|
||||||
// symlinkat
|
|
||||||
// sysarch
|
// sysarch
|
||||||
// syscall
|
// syscall
|
||||||
// threxit
|
// threxit
|
||||||
// thrsigdivert
|
// thrsigdivert
|
||||||
// thrsleep
|
// thrsleep
|
||||||
// thrwakeup
|
// thrwakeup
|
||||||
// unlinkat
|
|
||||||
// vfork
|
// vfork
|
||||||
// writev
|
// writev
|
||||||
|
|
|
||||||
4
vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
generated
vendored
|
|
@ -31,3 +31,7 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||||
|
// of openbsd/386 the syscall is called sysctl instead of __sysctl.
|
||||||
|
const SYS___SYSCTL = SYS_SYSCTL
|
||||||
|
|
|
||||||
4
vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go
generated
vendored
|
|
@ -31,3 +31,7 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||||
|
// of openbsd/arm the syscall is called sysctl instead of __sysctl.
|
||||||
|
const SYS___SYSCTL = SYS_SYSCTL
|
||||||
|
|
|
||||||
7
vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
7
vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
|
|
@ -585,6 +585,13 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
return poll(&fds[0], len(fds), timeout)
|
return poll(&fds[0], len(fds), timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
if raceenabled {
|
||||||
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
}
|
||||||
|
return sendfile(outfd, infd, offset, count)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
69
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
69
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
|
|
@ -8,7 +8,6 @@ package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"runtime"
|
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
@ -21,13 +20,6 @@ var (
|
||||||
Stderr = 2
|
Stderr = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8
|
|
||||||
dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8
|
|
||||||
netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4
|
|
||||||
solaris64Bit = runtime.GOOS == "solaris" && sizeofPtr == 8
|
|
||||||
)
|
|
||||||
|
|
||||||
// Do the interface allocations only once for common
|
// Do the interface allocations only once for common
|
||||||
// Errno values.
|
// Errno values.
|
||||||
var (
|
var (
|
||||||
|
|
@ -36,6 +28,11 @@ var (
|
||||||
errENOENT error = syscall.ENOENT
|
errENOENT error = syscall.ENOENT
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
signalNameMapOnce sync.Once
|
||||||
|
signalNameMap map[string]syscall.Signal
|
||||||
|
)
|
||||||
|
|
||||||
// errnoErr returns common boxed Errno values, to prevent
|
// errnoErr returns common boxed Errno values, to prevent
|
||||||
// allocations at runtime.
|
// allocations at runtime.
|
||||||
func errnoErr(e syscall.Errno) error {
|
func errnoErr(e syscall.Errno) error {
|
||||||
|
|
@ -74,6 +71,19 @@ func SignalName(s syscall.Signal) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SignalNum returns the syscall.Signal for signal named s,
|
||||||
|
// or 0 if a signal with such name is not found.
|
||||||
|
// The signal name should start with "SIG".
|
||||||
|
func SignalNum(s string) syscall.Signal {
|
||||||
|
signalNameMapOnce.Do(func() {
|
||||||
|
signalNameMap = make(map[string]syscall.Signal)
|
||||||
|
for _, signal := range signalList {
|
||||||
|
signalNameMap[signal.name] = signal.num
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return signalNameMap[s]
|
||||||
|
}
|
||||||
|
|
||||||
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
|
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
|
||||||
func clen(n []byte) int {
|
func clen(n []byte) int {
|
||||||
i := bytes.IndexByte(n, 0)
|
i := bytes.IndexByte(n, 0)
|
||||||
|
|
@ -284,6 +294,13 @@ func GetsockoptTimeval(fd, level, opt int) (*Timeval, error) {
|
||||||
return &tv, err
|
return &tv, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetsockoptUint64(fd, level, opt int) (value uint64, err error) {
|
||||||
|
var n uint64
|
||||||
|
vallen := _Socklen(8)
|
||||||
|
err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
|
func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
|
||||||
var rsa RawSockaddrAny
|
var rsa RawSockaddrAny
|
||||||
var len _Socklen = SizeofSockaddrAny
|
var len _Socklen = SizeofSockaddrAny
|
||||||
|
|
@ -334,13 +351,21 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetsockoptString(fd, level, opt int, s string) (err error) {
|
func SetsockoptString(fd, level, opt int, s string) (err error) {
|
||||||
return setsockopt(fd, level, opt, unsafe.Pointer(&[]byte(s)[0]), uintptr(len(s)))
|
var p unsafe.Pointer
|
||||||
|
if len(s) > 0 {
|
||||||
|
p = unsafe.Pointer(&[]byte(s)[0])
|
||||||
|
}
|
||||||
|
return setsockopt(fd, level, opt, p, uintptr(len(s)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) {
|
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) {
|
||||||
return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv))
|
return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetsockoptUint64(fd, level, opt int, value uint64) (err error) {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(&value), 8)
|
||||||
|
}
|
||||||
|
|
||||||
func Socket(domain, typ, proto int) (fd int, err error) {
|
func Socket(domain, typ, proto int) (fd int, err error) {
|
||||||
if domain == AF_INET6 && SocketDisableIPv6 {
|
if domain == AF_INET6 && SocketDisableIPv6 {
|
||||||
return -1, EAFNOSUPPORT
|
return -1, EAFNOSUPPORT
|
||||||
|
|
@ -359,13 +384,6 @@ func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
|
||||||
if raceenabled {
|
|
||||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
|
||||||
}
|
|
||||||
return sendfile(outfd, infd, offset, count)
|
|
||||||
}
|
|
||||||
|
|
||||||
var ioSync int64
|
var ioSync int64
|
||||||
|
|
||||||
func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
|
func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
|
||||||
|
|
@ -392,3 +410,22 @@ func SetNonblock(fd int, nonblocking bool) (err error) {
|
||||||
func Exec(argv0 string, argv []string, envv []string) error {
|
func Exec(argv0 string, argv []string, envv []string) error {
|
||||||
return syscall.Exec(argv0, argv, envv)
|
return syscall.Exec(argv0, argv, envv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lutimes sets the access and modification times tv on path. If path refers to
|
||||||
|
// a symlink, it is not dereferenced and the timestamps are set on the symlink.
|
||||||
|
// If tv is nil, the access and modification times are set to the current time.
|
||||||
|
// Otherwise tv must contain exactly 2 elements, with access time as the first
|
||||||
|
// element and modification time as the second element.
|
||||||
|
func Lutimes(path string, tv []Timeval) error {
|
||||||
|
if tv == nil {
|
||||||
|
return UtimesNanoAt(AT_FDCWD, path, nil, AT_SYMLINK_NOFOLLOW)
|
||||||
|
}
|
||||||
|
if len(tv) != 2 {
|
||||||
|
return EINVAL
|
||||||
|
}
|
||||||
|
ts := []Timespec{
|
||||||
|
NsecToTimespec(TimevalToNsec(tv[0])),
|
||||||
|
NsecToTimespec(TimevalToNsec(tv[1])),
|
||||||
|
}
|
||||||
|
return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW)
|
||||||
|
}
|
||||||
|
|
|
||||||
2
vendor/golang.org/x/sys/unix/syscall_unix_gc.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_unix_gc.go
generated
vendored
|
|
@ -3,7 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
// +build !gccgo
|
// +build !gccgo,!ppc64le,!ppc64
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
||||||
24
vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
generated
vendored
Normal file
24
vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build linux
|
||||||
|
// +build ppc64le ppc64
|
||||||
|
// +build !gccgo
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||||
|
return syscall.Syscall(trap, a1, a2, a3)
|
||||||
|
}
|
||||||
|
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||||
|
return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6)
|
||||||
|
}
|
||||||
|
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||||
|
return syscall.RawSyscall(trap, a1, a2, a3)
|
||||||
|
}
|
||||||
|
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||||
|
return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6)
|
||||||
|
}
|
||||||
12
vendor/golang.org/x/sys/unix/types_aix.go
generated
vendored
12
vendor/golang.org/x/sys/unix/types_aix.go
generated
vendored
|
|
@ -59,14 +59,14 @@ struct sockaddr_any {
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Machine characteristics; for internal use.
|
// Machine characteristics
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sizeofPtr = C.sizeofPtr
|
SizeofPtr = C.sizeofPtr
|
||||||
sizeofShort = C.sizeof_short
|
SizeofShort = C.sizeof_short
|
||||||
sizeofInt = C.sizeof_int
|
SizeofInt = C.sizeof_int
|
||||||
sizeofLong = C.sizeof_long
|
SizeofLong = C.sizeof_long
|
||||||
sizeofLongLong = C.sizeof_longlong
|
SizeofLongLong = C.sizeof_longlong
|
||||||
PathMax = C.PATH_MAX
|
PathMax = C.PATH_MAX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
18
vendor/golang.org/x/sys/unix/types_darwin.go
generated
vendored
18
vendor/golang.org/x/sys/unix/types_darwin.go
generated
vendored
|
|
@ -70,14 +70,14 @@ struct sockaddr_any {
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Machine characteristics; for internal use.
|
// Machine characteristics
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sizeofPtr = C.sizeofPtr
|
SizeofPtr = C.sizeofPtr
|
||||||
sizeofShort = C.sizeof_short
|
SizeofShort = C.sizeof_short
|
||||||
sizeofInt = C.sizeof_int
|
SizeofInt = C.sizeof_int
|
||||||
sizeofLong = C.sizeof_long
|
SizeofLong = C.sizeof_long
|
||||||
sizeofLongLong = C.sizeof_longlong
|
SizeofLongLong = C.sizeof_longlong
|
||||||
)
|
)
|
||||||
|
|
||||||
// Basic types
|
// Basic types
|
||||||
|
|
@ -275,3 +275,9 @@ const (
|
||||||
// uname
|
// uname
|
||||||
|
|
||||||
type Utsname C.struct_utsname
|
type Utsname C.struct_utsname
|
||||||
|
|
||||||
|
// Clockinfo
|
||||||
|
|
||||||
|
const SizeofClockinfo = C.sizeof_struct_clockinfo
|
||||||
|
|
||||||
|
type Clockinfo C.struct_clockinfo
|
||||||
|
|
|
||||||
12
vendor/golang.org/x/sys/unix/types_dragonfly.go
generated
vendored
12
vendor/golang.org/x/sys/unix/types_dragonfly.go
generated
vendored
|
|
@ -65,14 +65,14 @@ struct sockaddr_any {
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
// Machine characteristics; for internal use.
|
// Machine characteristics
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sizeofPtr = C.sizeofPtr
|
SizeofPtr = C.sizeofPtr
|
||||||
sizeofShort = C.sizeof_short
|
SizeofShort = C.sizeof_short
|
||||||
sizeofInt = C.sizeof_int
|
SizeofInt = C.sizeof_int
|
||||||
sizeofLong = C.sizeof_long
|
SizeofLong = C.sizeof_long
|
||||||
sizeofLongLong = C.sizeof_longlong
|
SizeofLongLong = C.sizeof_longlong
|
||||||
)
|
)
|
||||||
|
|
||||||
// Basic types
|
// Basic types
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue