mirror of
https://git.proxmox.com/git/wasi-libc
synced 2025-10-04 22:12:31 +00:00
New upstream version 0.0~git20200319.9efc2f4
This commit is contained in:
commit
e176eadaa1
@ -1,55 +0,0 @@
|
|||||||
trigger:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- job: Build
|
|
||||||
timeoutInMinutes: 360
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
windows:
|
|
||||||
imageName: 'vs2017-win2016'
|
|
||||||
mac:
|
|
||||||
imageName: 'macos-10.14'
|
|
||||||
linux:
|
|
||||||
imageName: 'ubuntu-16.04'
|
|
||||||
|
|
||||||
pool:
|
|
||||||
vmImage: $(imageName)
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %TEMP%\LLVM-8.0.0-win64.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/LLVM-8.0.0-win64.exe"
|
|
||||||
set CLANG_DIR=%CD%\citools\clang-rust
|
|
||||||
start "" /WAIT %TEMP%\LLVM-8.0.0-win64.exe /S /NCRC /D=%CLANG_DIR%
|
|
||||||
echo ##vso[task.prependpath]%CLANG_DIR%/bin
|
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
|
||||||
displayName: Install clang (Windows)
|
|
||||||
- bash: |
|
|
||||||
set -euo pipefail
|
|
||||||
curl -f http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz | tar xJf -
|
|
||||||
export CLANG_DIR=`pwd`/clang+llvm-8.0.0-x86_64-apple-darwin/bin
|
|
||||||
echo "##vso[task.prependpath]$CLANG_DIR"
|
|
||||||
displayName: Install clang (OSX)
|
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
|
||||||
- bash: |
|
|
||||||
set -euo pipefail
|
|
||||||
curl -f http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar xJf -
|
|
||||||
export CLANG_DIR=`pwd`/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin
|
|
||||||
echo "##vso[task.prependpath]$CLANG_DIR"
|
|
||||||
displayName: Install clang (Linux)
|
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
|
||||||
- bash: |
|
|
||||||
# Windows releases of LLVM don't include the llvm-nm tool, which is needed for building
|
|
||||||
# wasi-libc. Rust's llvm-tools include llvm-nm, and Rust is installed on Azure's Windows
|
|
||||||
# images, so we can use that to make llvm-nm available without too much overhead.
|
|
||||||
set -euo pipefail
|
|
||||||
# Add --no-self-update as a workaround for
|
|
||||||
# https://github.com/microsoft/azure-pipelines-image-generation/issues/1224
|
|
||||||
rustup update stable --no-self-update
|
|
||||||
rustup default stable
|
|
||||||
rustup component add llvm-tools-preview
|
|
||||||
echo "##vso[task.setvariable variable=WASM_NM;]$(rustc --print sysroot|sed 's|C:|/c|'|sed 's|\\|/|g')/lib/rustlib/x86_64-pc-windows-msvc/bin/llvm-nm.exe"
|
|
||||||
displayName: Install llvm-nm (Windows)
|
|
||||||
condition: and(succeeded(), eq( variables['Agent.OS'], 'Windows_NT' ))
|
|
||||||
- script: make -j4
|
|
||||||
displayName: Build
|
|
61
.github/workflows/main.yml
vendored
61
.github/workflows/main.yml
vendored
@ -2,8 +2,65 @@ name: CI
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
buildlibc:
|
||||||
name: Test
|
name: Build libc
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
|
||||||
|
- name: Install clang (Windows)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -fsSLO https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe
|
||||||
|
7z x LLVM-9.0.0-win64.exe -y -o"llvm"
|
||||||
|
echo "::add-path::$(pwd)/llvm/bin"
|
||||||
|
echo "::set-env name=WASM_AR::$(pwd)/llvm/bin/llvm-ar.exe"
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
|
||||||
|
- name: Install llvm-nm (Windows)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
rustup update stable
|
||||||
|
rustup default stable
|
||||||
|
rustup component add llvm-tools-preview
|
||||||
|
echo "::set-env name=WASM_NM::$(rustc --print sysroot|sed 's|C:|/c|'|sed 's|\\|/|g')/lib/rustlib/x86_64-pc-windows-msvc/bin/llvm-nm.exe"
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
|
||||||
|
- name: Install clang (MacOS)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -sSf http://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-darwin-apple.tar.xz | tar xJf -
|
||||||
|
export CLANG_DIR=`pwd`/clang+llvm-9.0.0-x86_64-darwin-apple/bin
|
||||||
|
echo "::add-path::$CLANG_DIR"
|
||||||
|
echo "::set-env name=WASM_CC::$CLANG_DIR/clang"
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
|
||||||
|
- name: Install clang (Linux)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -sSf https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar xJf -
|
||||||
|
export CLANG_DIR=`pwd`/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/bin
|
||||||
|
echo "::add-path::$CLANG_DIR"
|
||||||
|
echo "::set-env name=WASM_CC::$CLANG_DIR/clang"
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
|
||||||
|
- name: Build libc
|
||||||
|
shell: bash
|
||||||
|
run: make -j4
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
# Upload the sysroot folder. Give it a name according to the OS it was built for.
|
||||||
|
name: ${{ format( 'sysroot-{0}.tgz', matrix.os) }}
|
||||||
|
path: sysroot
|
||||||
|
|
||||||
|
headerstest:
|
||||||
|
name: wasi-headers test
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
26
LICENSE
26
LICENSE
@ -1,14 +1,16 @@
|
|||||||
Please see the LICENSE file in each top-level directory for the terms applicable to that directory and its relative sub-directories.
|
wasi-libc as a whole is multi-licensed under the
|
||||||
|
Apache License v2.0 with LLVM Exceptions, the Apache License v2.0, and
|
||||||
|
the MIT License. See the LICENSE-APACHE-LLVM, LICENSE-APACHE and LICENSE-MIT
|
||||||
|
files, respectively, for details.
|
||||||
|
|
||||||
The relevant directories and licenses are:
|
Portions of this software are derived from third-party works covered by
|
||||||
|
their own licenses:
|
||||||
|
|
||||||
basics/ - CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
dlmalloc/ - CC0; see the notice in malloc.c for details
|
||||||
dlmalloc/ - CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
libc-bottom-half/cloudlibc/ - BSD-2-Clause; see the LICENSE file for details
|
||||||
libc-bottom-half/cloudlibc/ - BSD-2-Clause; see libc-bottom-half/cloudlibc/LICENSE for details
|
libc-bottom-half/libpreopen/ - BSD-2-Clause; see the notice in libpreopen.c for details
|
||||||
libc-bottom-half/libpreopen/ - BSD-2-Clause; see the individual files for details
|
libc-top-half/musl/ - MIT; see the COPYRIGHT file for details
|
||||||
libc-bottom-half/headers/ - CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
|
||||||
libc-bottom-half/sources/ - CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
wasi-libc's changes to these files are multi-licensed under the
|
||||||
libc-bottom-half/mman/ - CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
Apache License v2.0 with LLVM Exceptions, the Apache License v2.0,
|
||||||
libc-top-half/musl - MIT; see libc-top-half/musl/COPYRIGHT for details
|
the MIT License, and the original licenses of the third-party works.
|
||||||
libc-top-half/headers - CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
|
||||||
libc-top-half/sources - CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
|
||||||
|
201
LICENSE-APACHE
Normal file
201
LICENSE-APACHE
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
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.
|
220
LICENSE-APACHE-LLVM
Normal file
220
LICENSE-APACHE-LLVM
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
--- LLVM Exceptions to the Apache 2.0 License ----
|
||||||
|
|
||||||
|
As an exception, if, as a result of your compiling your source code, portions
|
||||||
|
of this Software are embedded into an Object form of such source code, you
|
||||||
|
may redistribute such embedded portions in such Object form without complying
|
||||||
|
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
|
||||||
|
|
||||||
|
In addition, if you combine or link compiled forms of this Software with
|
||||||
|
software that is licensed under the GPLv2 ("Combined Software") and if a
|
||||||
|
court of competent jurisdiction determines that the patent provision (Section
|
||||||
|
3), the indemnity provision (Section 9) or other Section of the License
|
||||||
|
conflicts with the conditions of the GPLv2, you may retroactively and
|
||||||
|
prospectively choose to deem waived or otherwise exclude such Section(s) of
|
||||||
|
the License, but only in their entirety and only with respect to the Combined
|
||||||
|
Software.
|
||||||
|
|
23
LICENSE-MIT
Normal file
23
LICENSE-MIT
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Permission is hereby granted, free of charge, to any
|
||||||
|
person obtaining a copy of this software and associated
|
||||||
|
documentation files (the "Software"), to deal in the
|
||||||
|
Software without restriction, including without
|
||||||
|
limitation the rights to use, copy, modify, merge,
|
||||||
|
publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software
|
||||||
|
is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice
|
||||||
|
shall be included in all copies or substantial portions
|
||||||
|
of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||||
|
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||||
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
1
Makefile
1
Makefile
@ -480,6 +480,7 @@ finish: startup_files libc
|
|||||||
# TODO: Filter out __FLT16_* for now, as not all versions of clang have these.
|
# TODO: Filter out __FLT16_* for now, as not all versions of clang have these.
|
||||||
"$(WASM_CC)" $(WASM_CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \
|
"$(WASM_CC)" $(WASM_CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \
|
||||||
-isystem $(SYSROOT_INC) \
|
-isystem $(SYSROOT_INC) \
|
||||||
|
-std=gnu17 \
|
||||||
-E -dM -Wno-\#warnings \
|
-E -dM -Wno-\#warnings \
|
||||||
-D_ALL_SOURCE \
|
-D_ALL_SOURCE \
|
||||||
-U__llvm__ \
|
-U__llvm__ \
|
||||||
|
38
README.md
38
README.md
@ -1,30 +1,18 @@
|
|||||||
# WASI Libc
|
# WASI Libc
|
||||||
|
|
||||||
This is a work in progress. It's usable for many purposes, though the APIs
|
WASI Libc is a libc for WebAssembly programs built on top of WASI system calls.
|
||||||
aren't stable yet.
|
It provides a wide array of POSIX-compatible C APIs, including support for
|
||||||
|
standard I/O, file I/O, filesystem manipulation, memory management, time, string,
|
||||||
|
environment variables, program startup, and many other APIs.
|
||||||
|
|
||||||
## What is this?
|
WASI Libc is sufficiently stable and usable for many purposes, as most of the
|
||||||
|
POSIX-compatible APIs are stable, though it is continuing to evolve to better
|
||||||
It's several things.
|
align with wasm and WASI.
|
||||||
|
|
||||||
First, it's a usable libc. It builds a "libc" which can be used by
|
|
||||||
compilers, such as Clang 8.0, using the wasm32-wasi target. It's a work in
|
|
||||||
progress, but it is already sufficient to run basic programs.
|
|
||||||
|
|
||||||
Second, it's a "reference" implementation, which means the interfaces defined
|
|
||||||
here can be used by other tools and libraries, even if they don't use all the
|
|
||||||
actual implementations here. For example, we don't expect everyone will want
|
|
||||||
to use the exact `malloc` implementation provided here, but tools and
|
|
||||||
libraries using an ABI-compatible `malloc` interface will be able to
|
|
||||||
interoperate regardless of which actual implementation is used.
|
|
||||||
|
|
||||||
Third, it's an example showing the use of the WASI API. The libc functionality
|
|
||||||
is implemented using calls to WASI functions.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The easiest way to get started with this is to use one of the
|
The easiest way to get started with this is to use [wasi-sdk], which includes a
|
||||||
[prepackaged releases](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-intro.md#how-can-i-write-programs-that-use-wasi).
|
build of WASI Libc in its sysroot.
|
||||||
|
|
||||||
## Building from source
|
## Building from source
|
||||||
|
|
||||||
@ -48,3 +36,11 @@ To use the sysroot, use the `--sysroot=` option:
|
|||||||
```
|
```
|
||||||
|
|
||||||
to run the compiler using the newly built sysroot.
|
to run the compiler using the newly built sysroot.
|
||||||
|
|
||||||
|
Note that Clang packages typically don't include cross-compiled builds of
|
||||||
|
compiler-rt, libcxx, or libcxxabi, for `libclang_rt.builtins-wasm32.a`, libc++.a,
|
||||||
|
or libc++abi.a, respectively, so they may not be usable without
|
||||||
|
extra setup. This is one of the things [wasi-sdk] simplifies, as it includes
|
||||||
|
cross-compiled builds of compiler-rt, libc++.a, and libc++abi.a.
|
||||||
|
|
||||||
|
[wasi-sdk]: https://github.com/WebAssembly/wasi-sdk
|
||||||
|
121
basics/LICENSE
121
basics/LICENSE
@ -1,121 +0,0 @@
|
|||||||
Creative Commons Legal Code
|
|
||||||
|
|
||||||
CC0 1.0 Universal
|
|
||||||
|
|
||||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
||||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
||||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
||||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
||||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
||||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
||||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
||||||
HEREUNDER.
|
|
||||||
|
|
||||||
Statement of Purpose
|
|
||||||
|
|
||||||
The laws of most jurisdictions throughout the world automatically confer
|
|
||||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
||||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
||||||
authorship and/or a database (each, a "Work").
|
|
||||||
|
|
||||||
Certain owners wish to permanently relinquish those rights to a Work for
|
|
||||||
the purpose of contributing to a commons of creative, cultural and
|
|
||||||
scientific works ("Commons") that the public can reliably and without fear
|
|
||||||
of later claims of infringement build upon, modify, incorporate in other
|
|
||||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
||||||
and for any purposes, including without limitation commercial purposes.
|
|
||||||
These owners may contribute to the Commons to promote the ideal of a free
|
|
||||||
culture and the further production of creative, cultural and scientific
|
|
||||||
works, or to gain reputation or greater distribution for their Work in
|
|
||||||
part through the use and efforts of others.
|
|
||||||
|
|
||||||
For these and/or other purposes and motivations, and without any
|
|
||||||
expectation of additional consideration or compensation, the person
|
|
||||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
||||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
||||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
||||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
||||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
||||||
|
|
||||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
||||||
protected by copyright and related or neighboring rights ("Copyright and
|
|
||||||
Related Rights"). Copyright and Related Rights include, but are not
|
|
||||||
limited to, the following:
|
|
||||||
|
|
||||||
i. the right to reproduce, adapt, distribute, perform, display,
|
|
||||||
communicate, and translate a Work;
|
|
||||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
||||||
iii. publicity and privacy rights pertaining to a person's image or
|
|
||||||
likeness depicted in a Work;
|
|
||||||
iv. rights protecting against unfair competition in regards to a Work,
|
|
||||||
subject to the limitations in paragraph 4(a), below;
|
|
||||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
||||||
in a Work;
|
|
||||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
||||||
European Parliament and of the Council of 11 March 1996 on the legal
|
|
||||||
protection of databases, and under any national implementation
|
|
||||||
thereof, including any amended or successor version of such
|
|
||||||
directive); and
|
|
||||||
vii. other similar, equivalent or corresponding rights throughout the
|
|
||||||
world based on applicable law or treaty, and any national
|
|
||||||
implementations thereof.
|
|
||||||
|
|
||||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
||||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
||||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
||||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
||||||
of action, whether now known or unknown (including existing as well as
|
|
||||||
future claims and causes of action), in the Work (i) in all territories
|
|
||||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
||||||
treaty (including future time extensions), (iii) in any current or future
|
|
||||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
||||||
including without limitation commercial, advertising or promotional
|
|
||||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
||||||
member of the public at large and to the detriment of Affirmer's heirs and
|
|
||||||
successors, fully intending that such Waiver shall not be subject to
|
|
||||||
revocation, rescission, cancellation, termination, or any other legal or
|
|
||||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
||||||
as contemplated by Affirmer's express Statement of Purpose.
|
|
||||||
|
|
||||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
||||||
be judged legally invalid or ineffective under applicable law, then the
|
|
||||||
Waiver shall be preserved to the maximum extent permitted taking into
|
|
||||||
account Affirmer's express Statement of Purpose. In addition, to the
|
|
||||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
||||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
||||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
||||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
||||||
maximum duration provided by applicable law or treaty (including future
|
|
||||||
time extensions), (iii) in any current or future medium and for any number
|
|
||||||
of copies, and (iv) for any purpose whatsoever, including without
|
|
||||||
limitation commercial, advertising or promotional purposes (the
|
|
||||||
"License"). The License shall be deemed effective as of the date CC0 was
|
|
||||||
applied by Affirmer to the Work. Should any part of the License for any
|
|
||||||
reason be judged legally invalid or ineffective under applicable law, such
|
|
||||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
||||||
of the License, and in such case Affirmer hereby affirms that he or she
|
|
||||||
will not (i) exercise any of his or her remaining Copyright and Related
|
|
||||||
Rights in the Work or (ii) assert any associated claims and causes of
|
|
||||||
action with respect to the Work, in either case contrary to Affirmer's
|
|
||||||
express Statement of Purpose.
|
|
||||||
|
|
||||||
4. Limitations and Disclaimers.
|
|
||||||
|
|
||||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
||||||
surrendered, licensed or otherwise affected by this document.
|
|
||||||
b. Affirmer offers the Work as-is and makes no representations or
|
|
||||||
warranties of any kind concerning the Work, express, implied,
|
|
||||||
statutory or otherwise, including without limitation warranties of
|
|
||||||
title, merchantability, fitness for a particular purpose, non
|
|
||||||
infringement, or the absence of latent or other defects, accuracy, or
|
|
||||||
the present or absence of errors, whether or not discoverable, all to
|
|
||||||
the greatest extent permissible under applicable law.
|
|
||||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
||||||
that may apply to the Work or any use thereof, including without
|
|
||||||
limitation any person's Copyright and Related Rights in the Work.
|
|
||||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
||||||
consents, permissions or other rights required for any use of the
|
|
||||||
Work.
|
|
||||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
||||||
party to this document and has no duty or obligation with respect to
|
|
||||||
this CC0 or use of the Work.
|
|
@ -7,10 +7,9 @@ void _start(void) {
|
|||||||
// The linker synthesizes this to call constructors.
|
// The linker synthesizes this to call constructors.
|
||||||
__wasm_call_ctors();
|
__wasm_call_ctors();
|
||||||
|
|
||||||
// Call `__original_main` which will either be the application's
|
// Call `__original_main` which will either be the application's zero-argument
|
||||||
// zero-argument `main` function (renamed by the compiler) or a libc
|
// `__original_main` function or a libc routine which calls `__main_void`.
|
||||||
// routine which populates `argv` and `argc` and calls the application's
|
// TODO: Call `main` directly once we no longer have to support old compilers.
|
||||||
// two-argument `main`.
|
|
||||||
int r = __original_main();
|
int r = __original_main();
|
||||||
|
|
||||||
// Call atexit functions, destructors, stdio cleanup, etc.
|
// Call atexit functions, destructors, stdio cleanup, etc.
|
||||||
|
121
dlmalloc/LICENSE
121
dlmalloc/LICENSE
@ -1,121 +0,0 @@
|
|||||||
Creative Commons Legal Code
|
|
||||||
|
|
||||||
CC0 1.0 Universal
|
|
||||||
|
|
||||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
||||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
||||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
||||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
||||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
||||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
||||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
||||||
HEREUNDER.
|
|
||||||
|
|
||||||
Statement of Purpose
|
|
||||||
|
|
||||||
The laws of most jurisdictions throughout the world automatically confer
|
|
||||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
||||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
||||||
authorship and/or a database (each, a "Work").
|
|
||||||
|
|
||||||
Certain owners wish to permanently relinquish those rights to a Work for
|
|
||||||
the purpose of contributing to a commons of creative, cultural and
|
|
||||||
scientific works ("Commons") that the public can reliably and without fear
|
|
||||||
of later claims of infringement build upon, modify, incorporate in other
|
|
||||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
||||||
and for any purposes, including without limitation commercial purposes.
|
|
||||||
These owners may contribute to the Commons to promote the ideal of a free
|
|
||||||
culture and the further production of creative, cultural and scientific
|
|
||||||
works, or to gain reputation or greater distribution for their Work in
|
|
||||||
part through the use and efforts of others.
|
|
||||||
|
|
||||||
For these and/or other purposes and motivations, and without any
|
|
||||||
expectation of additional consideration or compensation, the person
|
|
||||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
||||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
||||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
||||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
||||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
||||||
|
|
||||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
||||||
protected by copyright and related or neighboring rights ("Copyright and
|
|
||||||
Related Rights"). Copyright and Related Rights include, but are not
|
|
||||||
limited to, the following:
|
|
||||||
|
|
||||||
i. the right to reproduce, adapt, distribute, perform, display,
|
|
||||||
communicate, and translate a Work;
|
|
||||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
||||||
iii. publicity and privacy rights pertaining to a person's image or
|
|
||||||
likeness depicted in a Work;
|
|
||||||
iv. rights protecting against unfair competition in regards to a Work,
|
|
||||||
subject to the limitations in paragraph 4(a), below;
|
|
||||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
||||||
in a Work;
|
|
||||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
||||||
European Parliament and of the Council of 11 March 1996 on the legal
|
|
||||||
protection of databases, and under any national implementation
|
|
||||||
thereof, including any amended or successor version of such
|
|
||||||
directive); and
|
|
||||||
vii. other similar, equivalent or corresponding rights throughout the
|
|
||||||
world based on applicable law or treaty, and any national
|
|
||||||
implementations thereof.
|
|
||||||
|
|
||||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
||||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
||||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
||||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
||||||
of action, whether now known or unknown (including existing as well as
|
|
||||||
future claims and causes of action), in the Work (i) in all territories
|
|
||||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
||||||
treaty (including future time extensions), (iii) in any current or future
|
|
||||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
||||||
including without limitation commercial, advertising or promotional
|
|
||||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
||||||
member of the public at large and to the detriment of Affirmer's heirs and
|
|
||||||
successors, fully intending that such Waiver shall not be subject to
|
|
||||||
revocation, rescission, cancellation, termination, or any other legal or
|
|
||||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
||||||
as contemplated by Affirmer's express Statement of Purpose.
|
|
||||||
|
|
||||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
||||||
be judged legally invalid or ineffective under applicable law, then the
|
|
||||||
Waiver shall be preserved to the maximum extent permitted taking into
|
|
||||||
account Affirmer's express Statement of Purpose. In addition, to the
|
|
||||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
||||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
||||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
||||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
||||||
maximum duration provided by applicable law or treaty (including future
|
|
||||||
time extensions), (iii) in any current or future medium and for any number
|
|
||||||
of copies, and (iv) for any purpose whatsoever, including without
|
|
||||||
limitation commercial, advertising or promotional purposes (the
|
|
||||||
"License"). The License shall be deemed effective as of the date CC0 was
|
|
||||||
applied by Affirmer to the Work. Should any part of the License for any
|
|
||||||
reason be judged legally invalid or ineffective under applicable law, such
|
|
||||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
||||||
of the License, and in such case Affirmer hereby affirms that he or she
|
|
||||||
will not (i) exercise any of his or her remaining Copyright and Related
|
|
||||||
Rights in the Work or (ii) assert any associated claims and causes of
|
|
||||||
action with respect to the Work, in either case contrary to Affirmer's
|
|
||||||
express Statement of Purpose.
|
|
||||||
|
|
||||||
4. Limitations and Disclaimers.
|
|
||||||
|
|
||||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
||||||
surrendered, licensed or otherwise affected by this document.
|
|
||||||
b. Affirmer offers the Work as-is and makes no representations or
|
|
||||||
warranties of any kind concerning the Work, express, implied,
|
|
||||||
statutory or otherwise, including without limitation warranties of
|
|
||||||
title, merchantability, fitness for a particular purpose, non
|
|
||||||
infringement, or the absence of latent or other defects, accuracy, or
|
|
||||||
the present or absence of errors, whether or not discoverable, all to
|
|
||||||
the greatest extent permissible under applicable law.
|
|
||||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
||||||
that may apply to the Work or any use thereof, including without
|
|
||||||
limitation any person's Copyright and Related Rights in the Work.
|
|
||||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
||||||
consents, permissions or other rights required for any use of the
|
|
||||||
Work.
|
|
||||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
||||||
party to this document and has no duty or obligation with respect to
|
|
||||||
this CC0 or use of the Work.
|
|
@ -1,74 +1,68 @@
|
|||||||
/*
|
// This file is a wrapper around malloc.c, which is the upstream source file.
|
||||||
* This file is a wrapper around malloc.c, which is the upstream source file.
|
// It sets configuration flags and controls which symbols are exported.
|
||||||
* It sets configuration flags and controls which symbols are exported.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
/* Define configuration macros for dlmalloc. */
|
// Define configuration macros for dlmalloc.
|
||||||
|
|
||||||
/* WebAssembly doesn't have mmap-style memory allocation. */
|
// WebAssembly doesn't have mmap-style memory allocation.
|
||||||
#define HAVE_MMAP 0
|
#define HAVE_MMAP 0
|
||||||
|
|
||||||
/* WebAssembly doesn't support shrinking linear memory. */
|
// WebAssembly doesn't support shrinking linear memory.
|
||||||
#define MORECORE_CANNOT_TRIM 1
|
#define MORECORE_CANNOT_TRIM 1
|
||||||
|
|
||||||
/* Disable sanity checks to reduce code size. */
|
// Disable sanity checks to reduce code size.
|
||||||
#define ABORT __builtin_unreachable()
|
#define ABORT __builtin_unreachable()
|
||||||
|
|
||||||
/* If threads are enabled, enable support for threads. */
|
// If threads are enabled, enable support for threads.
|
||||||
#ifdef _REENTRANT
|
#ifdef _REENTRANT
|
||||||
#define USE_LOCKS 1
|
#define USE_LOCKS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Make malloc deterministic. */
|
// Make malloc deterministic.
|
||||||
#define LACKS_TIME_H 1
|
#define LACKS_TIME_H 1
|
||||||
|
|
||||||
/* Disable malloc statistics generation to reduce code size. */
|
// Disable malloc statistics generation to reduce code size.
|
||||||
#define NO_MALLINFO 1
|
#define NO_MALLINFO 1
|
||||||
#define NO_MALLOC_STATS 1
|
#define NO_MALLOC_STATS 1
|
||||||
|
|
||||||
/* Align malloc regions to 16, to avoid unaligned SIMD accesses. */
|
// Align malloc regions to 16, to avoid unaligned SIMD accesses.
|
||||||
#define MALLOC_ALIGNMENT 16
|
#define MALLOC_ALIGNMENT 16
|
||||||
|
|
||||||
/*
|
// Declare errno values used by dlmalloc. We define them like this to avoid
|
||||||
* Declare errno values used by dlmalloc. We define them like this to avoid
|
// putting specific errno values in the ABI.
|
||||||
* putting specific errno values in the ABI.
|
|
||||||
*/
|
|
||||||
extern const int __ENOMEM;
|
extern const int __ENOMEM;
|
||||||
#define ENOMEM __ENOMEM
|
#define ENOMEM __ENOMEM
|
||||||
extern const int __EINVAL;
|
extern const int __EINVAL;
|
||||||
#define EINVAL __EINVAL
|
#define EINVAL __EINVAL
|
||||||
|
|
||||||
/*
|
// Define USE_DL_PREFIX so that we leave dlmalloc's names prefixed with 'dl'.
|
||||||
* Define USE_DL_PREFIX so that we leave dlmalloc's names prefixed with 'dl'.
|
// We define them as "static", and we wrap them with public names below. This
|
||||||
* We define them as "static", and we wrap them with public names below. This
|
// serves two purposes:
|
||||||
* serves two purposes:
|
//
|
||||||
*
|
// One is to make it easy to control which symbols are exported; dlmalloc
|
||||||
* One is to make it easy to control which symbols are exported; dlmalloc
|
// defines several non-standard functions and we wish to explicitly control
|
||||||
* defines several non-standard functions and we wish to explicitly control
|
// which functions are part of our public-facing interface.
|
||||||
* which functions are part of our public-facing interface.
|
//
|
||||||
*
|
// The other is to protect against compilers optimizing based on the assumption
|
||||||
* The other is to protect against compilers optimizing based on the assumption
|
// that they know what functions with names like "malloc" do. Code in the
|
||||||
* that they know what functions with names like "malloc" do. Code in the
|
// implementation will call functions like "dlmalloc" and assume it can use
|
||||||
* implementation will call functions like "dlmalloc" and assume it can use
|
// the resulting pointers to access the metadata outside of the nominally
|
||||||
* the resulting pointers to access the metadata outside of the nominally
|
// allocated objects. However, if the function were named "malloc", compilers
|
||||||
* allocated objects. However, if the function were named "malloc", compilers
|
// might see code like that and assume it has undefined behavior and can be
|
||||||
* might see code like that and assume it has undefined behavior and can be
|
// optimized away. By using "dlmalloc" in the implementation, we don't need
|
||||||
* optimized away. By using "dlmalloc" in the implementation, we don't need
|
// -fno-builtin to avoid this problem.
|
||||||
* -fno-builtin to avoid this problem.
|
|
||||||
*/
|
|
||||||
#define USE_DL_PREFIX 1
|
#define USE_DL_PREFIX 1
|
||||||
#define DLMALLOC_EXPORT static inline
|
#define DLMALLOC_EXPORT static inline
|
||||||
|
|
||||||
/* This isn't declared with DLMALLOC_EXPORT so make it static explicitly. */
|
// This isn't declared with DLMALLOC_EXPORT so make it static explicitly.
|
||||||
static size_t dlmalloc_usable_size(void*);
|
static size_t dlmalloc_usable_size(void*);
|
||||||
|
|
||||||
/* Include the upstream dlmalloc's malloc.c. */
|
// Include the upstream dlmalloc's malloc.c.
|
||||||
#include "malloc.c"
|
#include "malloc.c"
|
||||||
|
|
||||||
/* Export the public names. */
|
// Export the public names.
|
||||||
|
|
||||||
void *malloc(size_t size) {
|
void *malloc(size_t size) {
|
||||||
return dlmalloc(size);
|
return dlmalloc(size);
|
||||||
|
@ -39,7 +39,6 @@ __env_rm_add
|
|||||||
__env_rm_add
|
__env_rm_add
|
||||||
__env_rm_add
|
__env_rm_add
|
||||||
__env_rm_add
|
__env_rm_add
|
||||||
__environ
|
|
||||||
__exp2f_data
|
__exp2f_data
|
||||||
__exp_data
|
__exp_data
|
||||||
__expo2
|
__expo2
|
||||||
@ -139,6 +138,9 @@ __log2_data
|
|||||||
__log2f_data
|
__log2f_data
|
||||||
__log_data
|
__log_data
|
||||||
__logf_data
|
__logf_data
|
||||||
|
__lseek
|
||||||
|
__main_argc_argv
|
||||||
|
__main_void
|
||||||
__math_divzero
|
__math_divzero
|
||||||
__math_divzerof
|
__math_divzerof
|
||||||
__math_invalid
|
__math_invalid
|
||||||
@ -249,8 +251,12 @@ __uflow
|
|||||||
__unlist_locked_file
|
__unlist_locked_file
|
||||||
__uselocale
|
__uselocale
|
||||||
__utc
|
__utc
|
||||||
|
__wasilibc_ensure_environ
|
||||||
|
__wasilibc_environ
|
||||||
|
__wasilibc_environ
|
||||||
__wasilibc_fd_renumber
|
__wasilibc_fd_renumber
|
||||||
__wasilibc_find_relpath
|
__wasilibc_find_relpath
|
||||||
|
__wasilibc_initialize_environ
|
||||||
__wasilibc_open_nomode
|
__wasilibc_open_nomode
|
||||||
__wasilibc_openat_nomode
|
__wasilibc_openat_nomode
|
||||||
__wasilibc_register_preopened_fd
|
__wasilibc_register_preopened_fd
|
||||||
|
@ -166,6 +166,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <values.h>
|
#include <values.h>
|
||||||
#include <wasi/api.h>
|
#include <wasi/api.h>
|
||||||
|
#include <wasi/libc-environ.h>
|
||||||
#include <wasi/libc-find-relpath.h>
|
#include <wasi/libc-find-relpath.h>
|
||||||
#include <wasi/libc.h>
|
#include <wasi/libc.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
#define CDISCARD CTRL('o')
|
#define CDISCARD CTRL('o')
|
||||||
#define CDSUSP CTRL('y')
|
#define CDSUSP CTRL('y')
|
||||||
#define CEOF CTRL('d')
|
#define CEOF CTRL('d')
|
||||||
#define CEOL _POSIX_VDISABLE
|
#define CEOL '\0'
|
||||||
#define CEOT CEOF
|
#define CEOT CEOF
|
||||||
#define CERASE 0177
|
#define CERASE 0177
|
||||||
#define CFLUSH CDISCARD
|
#define CFLUSH CDISCARD
|
||||||
@ -124,11 +124,11 @@
|
|||||||
#define CRNCYSTR 0x4000F
|
#define CRNCYSTR 0x4000F
|
||||||
#define CRPRNT CREPRINT
|
#define CRPRNT CREPRINT
|
||||||
#define CSTART CTRL('q')
|
#define CSTART CTRL('q')
|
||||||
#define CSTATUS _POSIX_VDISABLE
|
#define CSTATUS '\0'
|
||||||
#define CSTOP CTRL('s')
|
#define CSTOP CTRL('s')
|
||||||
#define CSUSP CTRL('z')
|
#define CSUSP CTRL('z')
|
||||||
#define CTIME 0
|
#define CTIME 0
|
||||||
#define CTRL(x) (x&037)
|
#define CTRL(x) ((x)&037)
|
||||||
#define CWERASE CTRL('w')
|
#define CWERASE CTRL('w')
|
||||||
#define C_ANY ns_c_any
|
#define C_ANY ns_c_any
|
||||||
#define C_CHAOS ns_c_chaos
|
#define C_CHAOS ns_c_chaos
|
||||||
@ -597,8 +597,8 @@
|
|||||||
#define ILL_PRVOPC 5
|
#define ILL_PRVOPC 5
|
||||||
#define ILL_PRVREG 6
|
#define ILL_PRVREG 6
|
||||||
#define IN6ADDRSZ NS_IN6ADDRSZ
|
#define IN6ADDRSZ NS_IN6ADDRSZ
|
||||||
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
|
#define IN6ADDR_ANY_INIT { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
|
||||||
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
|
#define IN6ADDR_LOOPBACK_INIT { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } }
|
||||||
#define IN6_ARE_ADDR_EQUAL(a,b) __ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
|
#define IN6_ARE_ADDR_EQUAL(a,b) __ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
|
||||||
#define IN6_IS_ADDR_LINKLOCAL(a) ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
|
#define IN6_IS_ADDR_LINKLOCAL(a) ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
|
||||||
#define IN6_IS_ADDR_LOOPBACK(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
|
#define IN6_IS_ADDR_LOOPBACK(a) (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
|
||||||
@ -996,7 +996,7 @@
|
|||||||
#define LFLOW_RESTART_ANY 2
|
#define LFLOW_RESTART_ANY 2
|
||||||
#define LFLOW_RESTART_XON 3
|
#define LFLOW_RESTART_XON 3
|
||||||
#define LITTLE_ENDIAN __LITTLE_ENDIAN
|
#define LITTLE_ENDIAN __LITTLE_ENDIAN
|
||||||
#define LLONG_MAX (0x7fffffffffffffffLL)
|
#define LLONG_MAX 0x7fffffffffffffffLL
|
||||||
#define LLONG_MIN (-LLONG_MAX-1)
|
#define LLONG_MIN (-LLONG_MAX-1)
|
||||||
#define LM_FORWARDMASK 2
|
#define LM_FORWARDMASK 2
|
||||||
#define LM_MODE 1
|
#define LM_MODE 1
|
||||||
@ -1007,8 +1007,8 @@
|
|||||||
#define LOCK_SH 1
|
#define LOCK_SH 1
|
||||||
#define LOCK_UN 8
|
#define LOCK_UN 8
|
||||||
#define LONGBITS (sizeof(long) * 8)
|
#define LONGBITS (sizeof(long) * 8)
|
||||||
#define LONG_BIT (32)
|
#define LONG_BIT 32
|
||||||
#define LONG_MAX (0x7fffffffL)
|
#define LONG_MAX __LONG_MAX
|
||||||
#define LONG_MIN (-LONG_MAX-1)
|
#define LONG_MIN (-LONG_MAX-1)
|
||||||
#define L_INCR 1
|
#define L_INCR 1
|
||||||
#define L_SET 0
|
#define L_SET 0
|
||||||
@ -1825,6 +1825,7 @@
|
|||||||
#define TCP_THIN_LINEAR_TIMEOUTS 16
|
#define TCP_THIN_LINEAR_TIMEOUTS 16
|
||||||
#define TCP_TIMESTAMP 24
|
#define TCP_TIMESTAMP 24
|
||||||
#define TCP_TIME_WAIT 6
|
#define TCP_TIME_WAIT 6
|
||||||
|
#define TCP_TX_DELAY 37
|
||||||
#define TCP_ULP 31
|
#define TCP_ULP 31
|
||||||
#define TCP_USER_TIMEOUT 18
|
#define TCP_USER_TIMEOUT 18
|
||||||
#define TCP_WINDOW_CLAMP 10
|
#define TCP_WINDOW_CLAMP 10
|
||||||
@ -2428,7 +2429,7 @@
|
|||||||
#define __BIGGEST_ALIGNMENT__ 16
|
#define __BIGGEST_ALIGNMENT__ 16
|
||||||
#define __BIG_ENDIAN 4321
|
#define __BIG_ENDIAN 4321
|
||||||
#define __BIND 19950621
|
#define __BIND 19950621
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
#define __BYTE_ORDER __BYTE_ORDER__
|
||||||
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||||
#define __CHAR16_TYPE__ unsigned short
|
#define __CHAR16_TYPE__ unsigned short
|
||||||
#define __CHAR32_TYPE__ unsigned int
|
#define __CHAR32_TYPE__ unsigned int
|
||||||
@ -2647,6 +2648,7 @@
|
|||||||
#define __LITTLE_ENDIAN 1234
|
#define __LITTLE_ENDIAN 1234
|
||||||
#define __LITTLE_ENDIAN__ 1
|
#define __LITTLE_ENDIAN__ 1
|
||||||
#define __LONG_LONG_MAX__ 9223372036854775807LL
|
#define __LONG_LONG_MAX__ 9223372036854775807LL
|
||||||
|
#define __LONG_MAX __LONG_MAX__
|
||||||
#define __LONG_MAX__ 2147483647L
|
#define __LONG_MAX__ 2147483647L
|
||||||
#define __NAMESER 19991006
|
#define __NAMESER 19991006
|
||||||
#define __NEED_FILE
|
#define __NEED_FILE
|
||||||
@ -2735,6 +2737,7 @@
|
|||||||
#define __PTRDIFF_MAX__ 2147483647L
|
#define __PTRDIFF_MAX__ 2147483647L
|
||||||
#define __PTRDIFF_TYPE__ long int
|
#define __PTRDIFF_TYPE__ long int
|
||||||
#define __PTRDIFF_WIDTH__ 32
|
#define __PTRDIFF_WIDTH__ 32
|
||||||
|
#define __REDIR(x,y) __typeof__(x) x __asm__(#y)
|
||||||
#define __RETCAST(x)
|
#define __RETCAST(x)
|
||||||
#define __RETCAST_2(x,y)
|
#define __RETCAST_2(x,y)
|
||||||
#define __RETCAST_3(x,y,z)
|
#define __RETCAST_3(x,y,z)
|
||||||
@ -2771,7 +2774,7 @@
|
|||||||
#define __STDC_ISO_10646__ 201206L
|
#define __STDC_ISO_10646__ 201206L
|
||||||
#define __STDC_UTF_16__ 1
|
#define __STDC_UTF_16__ 1
|
||||||
#define __STDC_UTF_32__ 1
|
#define __STDC_UTF_32__ 1
|
||||||
#define __STDC_VERSION__ 201112L
|
#define __STDC_VERSION__ 201710L
|
||||||
#define __STDC__ 1
|
#define __STDC__ 1
|
||||||
#define __STDDEF_H
|
#define __STDDEF_H
|
||||||
#define __UAPI_DEF_IN6_ADDR 0
|
#define __UAPI_DEF_IN6_ADDR 0
|
||||||
@ -2782,6 +2785,7 @@
|
|||||||
#define __UAPI_DEF_IN_IPPROTO 0
|
#define __UAPI_DEF_IN_IPPROTO 0
|
||||||
#define __UAPI_DEF_IN_PKTINFO 0
|
#define __UAPI_DEF_IN_PKTINFO 0
|
||||||
#define __UAPI_DEF_IP6_MTUINFO 0
|
#define __UAPI_DEF_IP6_MTUINFO 0
|
||||||
|
#define __UAPI_DEF_IPHDR 0
|
||||||
#define __UAPI_DEF_IPPROTO_V6 0
|
#define __UAPI_DEF_IPPROTO_V6 0
|
||||||
#define __UAPI_DEF_IPV6_MREQ 0
|
#define __UAPI_DEF_IPV6_MREQ 0
|
||||||
#define __UAPI_DEF_IPV6_OPTIONS 0
|
#define __UAPI_DEF_IPV6_OPTIONS 0
|
||||||
@ -2880,6 +2884,7 @@
|
|||||||
#define __UINT_LEAST8_MAX__ 255
|
#define __UINT_LEAST8_MAX__ 255
|
||||||
#define __UINT_LEAST8_TYPE__ unsigned char
|
#define __UINT_LEAST8_TYPE__ unsigned char
|
||||||
#define __USER_LABEL_PREFIX__
|
#define __USER_LABEL_PREFIX__
|
||||||
|
#define __USE_TIME_BITS64 1
|
||||||
#define __WASI_ADVICE_DONTNEED (UINT8_C(4))
|
#define __WASI_ADVICE_DONTNEED (UINT8_C(4))
|
||||||
#define __WASI_ADVICE_NOREUSE (UINT8_C(5))
|
#define __WASI_ADVICE_NOREUSE (UINT8_C(5))
|
||||||
#define __WASI_ADVICE_NORMAL (UINT8_C(0))
|
#define __WASI_ADVICE_NORMAL (UINT8_C(0))
|
||||||
@ -3093,6 +3098,7 @@
|
|||||||
#define __va_copy(d,s) __builtin_va_copy(d,s)
|
#define __va_copy(d,s) __builtin_va_copy(d,s)
|
||||||
#define __wasi__ 1
|
#define __wasi__ 1
|
||||||
#define __wasi_api_h
|
#define __wasi_api_h
|
||||||
|
#define __wasi_libc_environ_h
|
||||||
#define __wasi_libc_find_relpath_h
|
#define __wasi_libc_find_relpath_h
|
||||||
#define __wasi_libc_h
|
#define __wasi_libc_h
|
||||||
#define __wasilibc___errno_values_h
|
#define __wasilibc___errno_values_h
|
||||||
@ -3168,6 +3174,7 @@
|
|||||||
#define acosh(x) __tg_real_complex(acosh, (x))
|
#define acosh(x) __tg_real_complex(acosh, (x))
|
||||||
#define alignas _Alignas
|
#define alignas _Alignas
|
||||||
#define alignof _Alignof
|
#define alignof _Alignof
|
||||||
|
#define alloca __builtin_alloca
|
||||||
#define alphasort64 alphasort
|
#define alphasort64 alphasort
|
||||||
#define and &&
|
#define and &&
|
||||||
#define and_eq &=
|
#define and_eq &=
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
// Copyright (c) 2015 Nuxi, https://nuxi.nl/
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// Parser of integer literals as performed by strtol(), scanf(), etc.
|
|
||||||
|
|
||||||
// Result of parsing.
|
|
||||||
bool have_number = false;
|
|
||||||
bool have_overflow = false;
|
|
||||||
int_t number = 0;
|
|
||||||
|
|
||||||
{
|
|
||||||
// Negative or positive number?
|
|
||||||
bool negative = false;
|
|
||||||
if (allow_negative && PEEK(0) == '-') {
|
|
||||||
negative = true;
|
|
||||||
SKIP(1);
|
|
||||||
} else if (PEEK(0) == '+') {
|
|
||||||
SKIP(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the base.
|
|
||||||
if ((base == 0 || base == 16) && PEEK(0) == '0' &&
|
|
||||||
(PEEK(1) == 'x' || PEEK(1) == 'X') &&
|
|
||||||
((PEEK(2) >= '0' && PEEK(2) <= '9') ||
|
|
||||||
(PEEK(2) >= 'A' && PEEK(2) <= 'F') ||
|
|
||||||
(PEEK(2) >= 'a' && PEEK(2) <= 'f'))) {
|
|
||||||
SKIP(2);
|
|
||||||
base = 16;
|
|
||||||
} else if (base == 0) {
|
|
||||||
base = PEEK(0) == '0' ? 8 : 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only perform conversion if the base is valid.
|
|
||||||
if (base >= 2 && base <= 36) {
|
|
||||||
uint_fast8_t radix = base;
|
|
||||||
|
|
||||||
// Determine the highest value up to which we can parse so that the
|
|
||||||
// next digit does not cause an overflow.
|
|
||||||
uintmax_t ceil;
|
|
||||||
uint_fast8_t last_digit;
|
|
||||||
if (negative) {
|
|
||||||
ceil = -(min / radix);
|
|
||||||
last_digit = -(min % radix);
|
|
||||||
} else {
|
|
||||||
ceil = max / radix;
|
|
||||||
last_digit = max % radix;
|
|
||||||
}
|
|
||||||
|
|
||||||
uintmax_t value = 0;
|
|
||||||
for (;;) {
|
|
||||||
// Parse next digit.
|
|
||||||
uint_fast8_t digit;
|
|
||||||
if (PEEK(0) >= '0' && PEEK(0) <= '9')
|
|
||||||
digit = PEEK(0) - '0';
|
|
||||||
else if (PEEK(0) >= 'A' && PEEK(0) <= 'Z')
|
|
||||||
digit = PEEK(0) - 'A' + 10;
|
|
||||||
else if (PEEK(0) >= 'a' && PEEK(0) <= 'z')
|
|
||||||
digit = PEEK(0) - 'a' + 10;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
if (digit >= radix)
|
|
||||||
break;
|
|
||||||
SKIP(1);
|
|
||||||
|
|
||||||
// Add it to result.
|
|
||||||
have_number = true;
|
|
||||||
if (value > ceil || (value == ceil && digit > last_digit)) {
|
|
||||||
// Addition of the new digit would cause an overflow.
|
|
||||||
have_overflow = true;
|
|
||||||
} else {
|
|
||||||
value = value * radix + digit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (have_overflow) {
|
|
||||||
// Set value to min or max depending whether the input is negative
|
|
||||||
// and whether the output type is signed.
|
|
||||||
number = (int_t)-1 >= 0 || !negative ? max : min;
|
|
||||||
} else {
|
|
||||||
// Return parsed value.
|
|
||||||
number = negative ? -value : value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,171 +0,0 @@
|
|||||||
// Copyright (c) 2016-2017 Nuxi, https://nuxi.nl/
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
#ifndef COMMON_TLS_H
|
|
||||||
#define COMMON_TLS_H
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <wasi/api.h>
|
|
||||||
#include <stdalign.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#if defined(__aarch64__)
|
|
||||||
|
|
||||||
#define TLS_VARIANT 1
|
|
||||||
#define TCB_SIZE 16
|
|
||||||
|
|
||||||
// Fetches the TCB from the CPU's registers.
|
|
||||||
static inline __wasi_tcb_t *tcb_get(void) {
|
|
||||||
__wasi_tcb_t *tcb;
|
|
||||||
asm volatile("mrs %0, tpidr_el0" : "=r"(tcb));
|
|
||||||
return tcb;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Changes the TCB in the CPU's registers.
|
|
||||||
static inline void tcb_set(__wasi_tcb_t *tcb) {
|
|
||||||
asm volatile("msr tpidr_el0, %0" : : "r"(tcb));
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__arm__)
|
|
||||||
|
|
||||||
#define TLS_VARIANT 1
|
|
||||||
#define TCB_SIZE 8
|
|
||||||
|
|
||||||
// Fetches the TCB from the CPU's registers.
|
|
||||||
static inline __wasi_tcb_t *tcb_get(void) {
|
|
||||||
__wasi_tcb_t *tcb;
|
|
||||||
asm volatile("mrc p15, 0, %0, cr13, cr0, 2" : "=r"(tcb));
|
|
||||||
return tcb;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Changes the TCB in the CPU's registers.
|
|
||||||
static inline void tcb_set(__wasi_tcb_t *tcb) {
|
|
||||||
asm volatile("mcr p15, 0, %0, cr13, cr0, 2" : : "r"(tcb));
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__i386__)
|
|
||||||
|
|
||||||
#define TLS_VARIANT 2
|
|
||||||
|
|
||||||
// Fetches the TCB from the CPU's registers.
|
|
||||||
static inline __wasi_tcb_t *tcb_get(void) {
|
|
||||||
__wasi_tcb_t *tcb;
|
|
||||||
asm volatile("mov %%gs:0, %0" : "=r"(tcb));
|
|
||||||
return tcb;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Changes the TCB in the CPU's registers.
|
|
||||||
static inline void tcb_set(__wasi_tcb_t *tcb) {
|
|
||||||
asm volatile("mov %0, %%gs:0" : : "r"(tcb));
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(__x86_64__)
|
|
||||||
|
|
||||||
#define TLS_VARIANT 2
|
|
||||||
|
|
||||||
// Fetches the TCB from the CPU's registers.
|
|
||||||
static inline __wasi_tcb_t *tcb_get(void) {
|
|
||||||
__wasi_tcb_t *tcb;
|
|
||||||
asm volatile("mov %%fs:0, %0" : "=r"(tcb));
|
|
||||||
return tcb;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Changes the TCB in the CPU's registers.
|
|
||||||
static inline void tcb_set(__wasi_tcb_t *tcb) {
|
|
||||||
asm volatile("mov %0, %%fs:0" : : "r"(tcb));
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error "Unsupported architecture"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TLS_VARIANT == 1
|
|
||||||
|
|
||||||
// TLS Variant I: TLS register points to the TCB. The TLS data is stored
|
|
||||||
// after the TCB. This approach has the disadvantage that the TCB size
|
|
||||||
// needs to be known.
|
|
||||||
|
|
||||||
static_assert(sizeof(__wasi_tcb_t) <= TCB_SIZE,
|
|
||||||
"TCB does not fit in reserved space before TLS");
|
|
||||||
|
|
||||||
// Computes the total size needed to store a TCB with TLS data.
|
|
||||||
static inline size_t tls_size(void) {
|
|
||||||
return TCB_SIZE + __pt_tls_memsz_aligned +
|
|
||||||
(__pt_tls_align > alignof(__wasi_tcb_t) ? __pt_tls_align
|
|
||||||
: sizeof(__wasi_tcb_t)) -
|
|
||||||
1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Computes the address of the TCB in the combined TCB/TLS area.
|
|
||||||
static inline __wasi_tcb_t *tcb_addr(char *buf) {
|
|
||||||
if (alignof(__wasi_tcb_t) < __pt_tls_align) {
|
|
||||||
return (
|
|
||||||
__wasi_tcb_t *)(__roundup((uintptr_t)buf + TCB_SIZE, __pt_tls_align) -
|
|
||||||
TCB_SIZE);
|
|
||||||
} else {
|
|
||||||
return (__wasi_tcb_t *)__roundup((uintptr_t)buf, alignof(__wasi_tcb_t));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Computes the address of the TLS data in the combined TCB/TLS area.
|
|
||||||
static inline char *tls_addr(char *buf) {
|
|
||||||
return (char *)tcb_addr(buf) + TCB_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetches the TLS area of the currently running thread.
|
|
||||||
static inline char *tls_get(void) {
|
|
||||||
return (char *)tcb_get() + TCB_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif TLS_VARIANT == 2
|
|
||||||
|
|
||||||
// TLS Variant II: TLS register points to the TCB. The TLS data is
|
|
||||||
// stored before the TCB. This approach has the advantage that the TCB
|
|
||||||
// size does not need to be known.
|
|
||||||
|
|
||||||
// Computes the total size needed to store a TCB with TLS data.
|
|
||||||
static inline size_t tls_size(void) {
|
|
||||||
return __pt_tls_memsz_aligned + sizeof(__wasi_tcb_t) +
|
|
||||||
(__pt_tls_align > alignof(__wasi_tcb_t) ? __pt_tls_align
|
|
||||||
: sizeof(__wasi_tcb_t)) -
|
|
||||||
1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Computes the address of the TLS data in the combined TCB/TLS area.
|
|
||||||
static inline char *tls_addr(char *buf) {
|
|
||||||
if (alignof(__wasi_tcb_t) < __pt_tls_align) {
|
|
||||||
return (char *)(__roundup((uintptr_t)buf, __pt_tls_align));
|
|
||||||
} else {
|
|
||||||
return (char *)(__roundup((uintptr_t)buf + __pt_tls_memsz_aligned,
|
|
||||||
alignof(__wasi_tcb_t)) -
|
|
||||||
__pt_tls_memsz_aligned);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Computes the address of the TCB in the combined TCB/TLS area.
|
|
||||||
static inline __wasi_tcb_t *tcb_addr(char *buf) {
|
|
||||||
return (__wasi_tcb_t *)(tls_addr(buf) + __pt_tls_memsz_aligned);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetches the TLS area of the currently running thread.
|
|
||||||
static inline char *tls_get(void) {
|
|
||||||
return (char *)tcb_get() - __pt_tls_memsz_aligned;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error "Unknown TLS variant"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Changes the CPU's registers to point to a new TLS area.
|
|
||||||
//
|
|
||||||
// This function ensures that the TCB of the old TLS area is copied into
|
|
||||||
// the new TLS area. This ensures that the runtime (kernel, emulator,
|
|
||||||
// etc) still has access to its own private data.
|
|
||||||
static inline void tls_replace(char *buf) {
|
|
||||||
__wasi_tcb_t *tcb = tcb_addr(buf);
|
|
||||||
*tcb = *tcb_get();
|
|
||||||
tcb_set(tcb);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -21,13 +21,8 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) {
|
|||||||
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
||||||
*subscription = (__wasi_subscription_t){
|
*subscription = (__wasi_subscription_t){
|
||||||
.userdata = (uintptr_t)pollfd,
|
.userdata = (uintptr_t)pollfd,
|
||||||
.type = __WASI_EVENTTYPE_FD_READ,
|
.u.tag = __WASI_EVENTTYPE_FD_READ,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.fd_read.file_descriptor = pollfd->fd,
|
||||||
.fd_readwrite.fd = pollfd->fd,
|
|
||||||
.fd_readwrite.flags = __WASI_SUBSCRIPTION_FD_READWRITE_POLL,
|
|
||||||
#else
|
|
||||||
.u.fd_readwrite.file_descriptor = pollfd->fd,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
created_events = true;
|
created_events = true;
|
||||||
}
|
}
|
||||||
@ -35,13 +30,8 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) {
|
|||||||
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
||||||
*subscription = (__wasi_subscription_t){
|
*subscription = (__wasi_subscription_t){
|
||||||
.userdata = (uintptr_t)pollfd,
|
.userdata = (uintptr_t)pollfd,
|
||||||
.type = __WASI_EVENTTYPE_FD_WRITE,
|
.u.tag = __WASI_EVENTTYPE_FD_WRITE,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.fd_write.file_descriptor = pollfd->fd,
|
||||||
.fd_readwrite.fd = pollfd->fd,
|
|
||||||
.fd_readwrite.flags = __WASI_SUBSCRIPTION_FD_READWRITE_POLL,
|
|
||||||
#else
|
|
||||||
.u.fd_readwrite.file_descriptor = pollfd->fd,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
created_events = true;
|
created_events = true;
|
||||||
}
|
}
|
||||||
@ -59,14 +49,9 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) {
|
|||||||
if (timeout >= 0) {
|
if (timeout >= 0) {
|
||||||
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
||||||
*subscription = (__wasi_subscription_t){
|
*subscription = (__wasi_subscription_t){
|
||||||
.type = __WASI_EVENTTYPE_CLOCK,
|
.u.tag = __WASI_EVENTTYPE_CLOCK,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.clock.id = __WASI_CLOCKID_REALTIME,
|
||||||
.clock.clock_id = __WASI_CLOCK_REALTIME,
|
.u.u.clock.timeout = (__wasi_timestamp_t)timeout * 1000000,
|
||||||
.clock.timeout = (__wasi_timestamp_t)timeout * 1000000,
|
|
||||||
#else
|
|
||||||
.u.clock.id = __WASI_CLOCKID_REALTIME,
|
|
||||||
.u.clock.timeout = (__wasi_timestamp_t)timeout * 1000000,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,14 +99,17 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) {
|
|||||||
pollfd->revents |= POLLERR;
|
pollfd->revents |= POLLERR;
|
||||||
} else {
|
} else {
|
||||||
// Data can be read or written.
|
// Data can be read or written.
|
||||||
pollfd->revents |=
|
if (event->type == __WASI_EVENTTYPE_FD_READ) {
|
||||||
event->type == __WASI_EVENTTYPE_FD_READ ? POLLRDNORM : POLLWRNORM;
|
pollfd->revents |= POLLRDNORM;
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
if (event->fd_readwrite.flags & __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP) {
|
||||||
if (event->fd_readwrite.flags & __WASI_EVENT_FD_READWRITE_HANGUP)
|
pollfd->revents |= POLLHUP;
|
||||||
#else
|
}
|
||||||
if (event->u.fd_readwrite.flags & __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP)
|
} else if (event->type == __WASI_EVENTTYPE_FD_WRITE) {
|
||||||
#endif
|
pollfd->revents |= POLLWRNORM;
|
||||||
pollfd->revents |= POLLHUP;
|
if (event->fd_readwrite.flags & __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP) {
|
||||||
|
pollfd->revents |= POLLHUP;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,21 +14,12 @@ int ioctl(int fildes, int request, ...) {
|
|||||||
// Poll the file descriptor to determine how many bytes can be read.
|
// Poll the file descriptor to determine how many bytes can be read.
|
||||||
__wasi_subscription_t subscriptions[2] = {
|
__wasi_subscription_t subscriptions[2] = {
|
||||||
{
|
{
|
||||||
.type = __WASI_EVENTTYPE_FD_READ,
|
.u.tag = __WASI_EVENTTYPE_FD_READ,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.fd_read.file_descriptor = fildes,
|
||||||
.fd_readwrite.fd = fildes,
|
|
||||||
.fd_readwrite.flags = __WASI_SUBSCRIPTION_FD_READWRITE_POLL,
|
|
||||||
#else
|
|
||||||
.u.fd_readwrite.file_descriptor = fildes,
|
|
||||||
#endif
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.type = __WASI_EVENTTYPE_CLOCK,
|
.u.tag = __WASI_EVENTTYPE_CLOCK,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.clock.id = __WASI_CLOCKID_MONOTONIC,
|
||||||
.clock.clock_id = __WASI_CLOCK_MONOTONIC,
|
|
||||||
#else
|
|
||||||
.u.clock.id = __WASI_CLOCKID_MONOTONIC,
|
|
||||||
#endif
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
__wasi_event_t events[__arraycount(subscriptions)];
|
__wasi_event_t events[__arraycount(subscriptions)];
|
||||||
@ -58,11 +49,7 @@ int ioctl(int fildes, int request, ...) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (event->type == __WASI_EVENTTYPE_FD_READ) {
|
if (event->type == __WASI_EVENTTYPE_FD_READ) {
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
|
||||||
*result = event->fd_readwrite.nbytes;
|
*result = event->fd_readwrite.nbytes;
|
||||||
#else
|
|
||||||
*result = event->u.fd_readwrite.nbytes;
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,13 +49,8 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds,
|
|||||||
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
||||||
*subscription = (__wasi_subscription_t){
|
*subscription = (__wasi_subscription_t){
|
||||||
.userdata = fd,
|
.userdata = fd,
|
||||||
.type = __WASI_EVENTTYPE_FD_READ,
|
.u.tag = __WASI_EVENTTYPE_FD_READ,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.fd_read.file_descriptor = fd,
|
||||||
.fd_readwrite.fd = fd,
|
|
||||||
.fd_readwrite.flags = __WASI_SUBSCRIPTION_FD_READWRITE_POLL,
|
|
||||||
#else
|
|
||||||
.u.fd_readwrite.file_descriptor = fd,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,13 +62,8 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds,
|
|||||||
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
||||||
*subscription = (__wasi_subscription_t){
|
*subscription = (__wasi_subscription_t){
|
||||||
.userdata = fd,
|
.userdata = fd,
|
||||||
.type = __WASI_EVENTTYPE_FD_WRITE,
|
.u.tag = __WASI_EVENTTYPE_FD_WRITE,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.fd_write.file_descriptor = fd,
|
||||||
.fd_readwrite.fd = fd,
|
|
||||||
.fd_readwrite.flags = __WASI_SUBSCRIPTION_FD_READWRITE_POLL,
|
|
||||||
#else
|
|
||||||
.u.fd_readwrite.file_descriptor = fd,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,18 +72,10 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds,
|
|||||||
if (timeout != NULL) {
|
if (timeout != NULL) {
|
||||||
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
__wasi_subscription_t *subscription = &subscriptions[nevents++];
|
||||||
*subscription = (__wasi_subscription_t){
|
*subscription = (__wasi_subscription_t){
|
||||||
.type = __WASI_EVENTTYPE_CLOCK,
|
.u.tag = __WASI_EVENTTYPE_CLOCK,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.clock.id = __WASI_CLOCKID_REALTIME,
|
||||||
.clock.clock_id = __WASI_CLOCK_REALTIME,
|
|
||||||
#else
|
|
||||||
.u.clock.id = __WASI_CLOCKID_REALTIME,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
if (!timespec_to_timestamp_clamp(timeout, &subscription->u.u.clock.timeout)) {
|
||||||
if (!timespec_to_timestamp_clamp(timeout, &subscription->clock.timeout)) {
|
|
||||||
#else
|
|
||||||
if (!timespec_to_timestamp_clamp(timeout, &subscription->u.clock.timeout)) {
|
|
||||||
#endif
|
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -29,20 +29,11 @@ int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp,
|
|||||||
|
|
||||||
// Prepare polling subscription.
|
// Prepare polling subscription.
|
||||||
__wasi_subscription_t sub = {
|
__wasi_subscription_t sub = {
|
||||||
.type = __WASI_EVENTTYPE_CLOCK,
|
.u.tag = __WASI_EVENTTYPE_CLOCK,
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
.u.u.clock.id = clock_id->id,
|
||||||
.clock.clock_id = clock_id->id,
|
.u.u.clock.flags = flags,
|
||||||
.clock.flags = flags,
|
|
||||||
#else
|
|
||||||
.u.clock.id = clock_id->id,
|
|
||||||
.u.clock.flags = flags,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
#ifdef __wasilibc_unmodified_upstream // non-anonymous unions
|
if (!timespec_to_timestamp_clamp(rqtp, &sub.u.u.clock.timeout))
|
||||||
if (!timespec_to_timestamp_clamp(rqtp, &sub.clock.timeout))
|
|
||||||
#else
|
|
||||||
if (!timespec_to_timestamp_clamp(rqtp, &sub.u.clock.timeout))
|
|
||||||
#endif
|
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
// Block until polling event is triggered.
|
// Block until polling event is triggered.
|
||||||
|
@ -11,10 +11,10 @@ static_assert(SEEK_CUR == __WASI_WHENCE_CUR, "Value mismatch");
|
|||||||
static_assert(SEEK_END == __WASI_WHENCE_END, "Value mismatch");
|
static_assert(SEEK_END == __WASI_WHENCE_END, "Value mismatch");
|
||||||
static_assert(SEEK_SET == __WASI_WHENCE_SET, "Value mismatch");
|
static_assert(SEEK_SET == __WASI_WHENCE_SET, "Value mismatch");
|
||||||
|
|
||||||
#ifdef __wasilibc_unmodified_upstream /* Optimize the readonly case of lseek */
|
#ifdef __wasilibc_unmodified_upstream // Provide an __lseek entry point
|
||||||
off_t lseek(int fildes, off_t offset, int whence) {
|
off_t lseek(int fildes, off_t offset, int whence) {
|
||||||
#else
|
#else
|
||||||
off_t (lseek)(int fildes, off_t offset, int whence) {
|
off_t __lseek(int fildes, off_t offset, int whence) {
|
||||||
#endif
|
#endif
|
||||||
__wasi_filesize_t new_offset;
|
__wasi_filesize_t new_offset;
|
||||||
__wasi_errno_t error =
|
__wasi_errno_t error =
|
||||||
@ -25,3 +25,8 @@ off_t (lseek)(int fildes, off_t offset, int whence) {
|
|||||||
}
|
}
|
||||||
return new_offset;
|
return new_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __wasilibc_unmodified_upstream // Provide an __lseek entry point
|
||||||
|
#else
|
||||||
|
extern __typeof(__lseek) lseek __attribute__((weak, alias("__lseek")));
|
||||||
|
#endif
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include <wasi/api.h>
|
#include <wasi/api.h>
|
||||||
#include <wasi/libc.h>
|
|
||||||
extern void __wasm_call_ctors(void);
|
extern void __wasm_call_ctors(void);
|
||||||
extern int __original_main(void);
|
extern int __original_main(void);
|
||||||
extern void __prepare_for_exit(void);
|
extern void __prepare_for_exit(void);
|
||||||
@ -8,10 +7,9 @@ void _start(void) {
|
|||||||
// The linker synthesizes this to call constructors.
|
// The linker synthesizes this to call constructors.
|
||||||
__wasm_call_ctors();
|
__wasm_call_ctors();
|
||||||
|
|
||||||
// Call `__original_main` which will either be the application's
|
// Call `__original_main` which will either be the application's zero-argument
|
||||||
// zero-argument `main` function (renamed by the compiler) or a libc
|
// `__original_main` function or a libc routine which calls `__main_void`.
|
||||||
// routine which populates `argv` and `argc` and calls the application's
|
// TODO: Call `main` directly once we no longer have to support old compilers.
|
||||||
// two-argument `main`.
|
|
||||||
int r = __original_main();
|
int r = __original_main();
|
||||||
|
|
||||||
// Call atexit functions, destructors, stdio cleanup, etc.
|
// Call atexit functions, destructors, stdio cleanup, etc.
|
||||||
|
@ -1,121 +0,0 @@
|
|||||||
Creative Commons Legal Code
|
|
||||||
|
|
||||||
CC0 1.0 Universal
|
|
||||||
|
|
||||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
||||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
||||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
||||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
||||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
||||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
||||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
||||||
HEREUNDER.
|
|
||||||
|
|
||||||
Statement of Purpose
|
|
||||||
|
|
||||||
The laws of most jurisdictions throughout the world automatically confer
|
|
||||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
||||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
||||||
authorship and/or a database (each, a "Work").
|
|
||||||
|
|
||||||
Certain owners wish to permanently relinquish those rights to a Work for
|
|
||||||
the purpose of contributing to a commons of creative, cultural and
|
|
||||||
scientific works ("Commons") that the public can reliably and without fear
|
|
||||||
of later claims of infringement build upon, modify, incorporate in other
|
|
||||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
||||||
and for any purposes, including without limitation commercial purposes.
|
|
||||||
These owners may contribute to the Commons to promote the ideal of a free
|
|
||||||
culture and the further production of creative, cultural and scientific
|
|
||||||
works, or to gain reputation or greater distribution for their Work in
|
|
||||||
part through the use and efforts of others.
|
|
||||||
|
|
||||||
For these and/or other purposes and motivations, and without any
|
|
||||||
expectation of additional consideration or compensation, the person
|
|
||||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
||||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
||||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
||||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
||||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
||||||
|
|
||||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
||||||
protected by copyright and related or neighboring rights ("Copyright and
|
|
||||||
Related Rights"). Copyright and Related Rights include, but are not
|
|
||||||
limited to, the following:
|
|
||||||
|
|
||||||
i. the right to reproduce, adapt, distribute, perform, display,
|
|
||||||
communicate, and translate a Work;
|
|
||||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
||||||
iii. publicity and privacy rights pertaining to a person's image or
|
|
||||||
likeness depicted in a Work;
|
|
||||||
iv. rights protecting against unfair competition in regards to a Work,
|
|
||||||
subject to the limitations in paragraph 4(a), below;
|
|
||||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
||||||
in a Work;
|
|
||||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
||||||
European Parliament and of the Council of 11 March 1996 on the legal
|
|
||||||
protection of databases, and under any national implementation
|
|
||||||
thereof, including any amended or successor version of such
|
|
||||||
directive); and
|
|
||||||
vii. other similar, equivalent or corresponding rights throughout the
|
|
||||||
world based on applicable law or treaty, and any national
|
|
||||||
implementations thereof.
|
|
||||||
|
|
||||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
||||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
||||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
||||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
||||||
of action, whether now known or unknown (including existing as well as
|
|
||||||
future claims and causes of action), in the Work (i) in all territories
|
|
||||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
||||||
treaty (including future time extensions), (iii) in any current or future
|
|
||||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
||||||
including without limitation commercial, advertising or promotional
|
|
||||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
||||||
member of the public at large and to the detriment of Affirmer's heirs and
|
|
||||||
successors, fully intending that such Waiver shall not be subject to
|
|
||||||
revocation, rescission, cancellation, termination, or any other legal or
|
|
||||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
||||||
as contemplated by Affirmer's express Statement of Purpose.
|
|
||||||
|
|
||||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
||||||
be judged legally invalid or ineffective under applicable law, then the
|
|
||||||
Waiver shall be preserved to the maximum extent permitted taking into
|
|
||||||
account Affirmer's express Statement of Purpose. In addition, to the
|
|
||||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
||||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
||||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
||||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
||||||
maximum duration provided by applicable law or treaty (including future
|
|
||||||
time extensions), (iii) in any current or future medium and for any number
|
|
||||||
of copies, and (iv) for any purpose whatsoever, including without
|
|
||||||
limitation commercial, advertising or promotional purposes (the
|
|
||||||
"License"). The License shall be deemed effective as of the date CC0 was
|
|
||||||
applied by Affirmer to the Work. Should any part of the License for any
|
|
||||||
reason be judged legally invalid or ineffective under applicable law, such
|
|
||||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
||||||
of the License, and in such case Affirmer hereby affirms that he or she
|
|
||||||
will not (i) exercise any of his or her remaining Copyright and Related
|
|
||||||
Rights in the Work or (ii) assert any associated claims and causes of
|
|
||||||
action with respect to the Work, in either case contrary to Affirmer's
|
|
||||||
express Statement of Purpose.
|
|
||||||
|
|
||||||
4. Limitations and Disclaimers.
|
|
||||||
|
|
||||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
||||||
surrendered, licensed or otherwise affected by this document.
|
|
||||||
b. Affirmer offers the Work as-is and makes no representations or
|
|
||||||
warranties of any kind concerning the Work, express, implied,
|
|
||||||
statutory or otherwise, including without limitation warranties of
|
|
||||||
title, merchantability, fitness for a particular purpose, non
|
|
||||||
infringement, or the absence of latent or other defects, accuracy, or
|
|
||||||
the present or absence of errors, whether or not discoverable, all to
|
|
||||||
the greatest extent permissible under applicable law.
|
|
||||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
||||||
that may apply to the Work or any use thereof, including without
|
|
||||||
limitation any person's Copyright and Related Rights in the Work.
|
|
||||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
||||||
consents, permissions or other rights required for any use of the
|
|
||||||
Work.
|
|
||||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
||||||
party to this document and has no duty or obligation with respect to
|
|
||||||
this CC0 or use of the Work.
|
|
@ -13,4 +13,18 @@
|
|||||||
#define IPPROTO_IPV6 41
|
#define IPPROTO_IPV6 41
|
||||||
#define IPPROTO_RAW 255
|
#define IPPROTO_RAW 255
|
||||||
|
|
||||||
|
#define IN6ADDR_ANY_INIT { { \
|
||||||
|
0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00 \
|
||||||
|
} }
|
||||||
|
|
||||||
|
#define IN6ADDR_LOOPBACK_INIT { { \
|
||||||
|
0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x01 \
|
||||||
|
} }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define __wasilibc___struct_in6_addr_h
|
#define __wasilibc___struct_in6_addr_h
|
||||||
|
|
||||||
struct in6_addr {
|
struct in6_addr {
|
||||||
_Alignas(long) unsigned char s6_addr[16];
|
_Alignas(int32_t) unsigned char s6_addr[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* and defined values (macros).
|
* and defined values (macros).
|
||||||
*
|
*
|
||||||
* The interface described here is greatly inspired by [CloudABI]'s clean,
|
* The interface described here is greatly inspired by [CloudABI]'s clean,
|
||||||
* thoughtfully-designed, cabability-oriented, POSIX-style API.
|
* thoughtfully-designed, capability-oriented, POSIX-style API.
|
||||||
*
|
*
|
||||||
* [CloudABI]: https://github.com/NuxiNL/cloudlibc
|
* [CloudABI]: https://github.com/NuxiNL/cloudlibc
|
||||||
* [WASI]: https://github.com/WebAssembly/WASI/
|
* [WASI]: https://github.com/WebAssembly/WASI/
|
||||||
@ -20,6 +20,10 @@
|
|||||||
#error <wasi/api.h> is only supported on WASI platforms.
|
#error <wasi/api.h> is only supported on WASI platforms.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __wasm32__
|
||||||
|
#error <wasi/api.h> only supports wasm32; doesn't yet support wasm64
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@ -31,6 +35,7 @@ _Static_assert(_Alignof(int32_t) == 4, "non-wasi data layout");
|
|||||||
_Static_assert(_Alignof(uint32_t) == 4, "non-wasi data layout");
|
_Static_assert(_Alignof(uint32_t) == 4, "non-wasi data layout");
|
||||||
_Static_assert(_Alignof(int64_t) == 8, "non-wasi data layout");
|
_Static_assert(_Alignof(int64_t) == 8, "non-wasi data layout");
|
||||||
_Static_assert(_Alignof(uint64_t) == 8, "non-wasi data layout");
|
_Static_assert(_Alignof(uint64_t) == 8, "non-wasi data layout");
|
||||||
|
_Static_assert(_Alignof(void*) == 4, "non-wasi data layout");
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -40,16 +45,25 @@ extern "C" {
|
|||||||
#define __WASI_DIRCOOKIE_START (UINT64_C(0))
|
#define __WASI_DIRCOOKIE_START (UINT64_C(0))
|
||||||
typedef __SIZE_TYPE__ __wasi_size_t;
|
typedef __SIZE_TYPE__ __wasi_size_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_size_t) == 4, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_size_t) == 4, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non-negative file size or length of a region within a file.
|
* Non-negative file size or length of a region within a file.
|
||||||
*/
|
*/
|
||||||
typedef uint64_t __wasi_filesize_t;
|
typedef uint64_t __wasi_filesize_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_filesize_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_filesize_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamp in nanoseconds.
|
* Timestamp in nanoseconds.
|
||||||
*/
|
*/
|
||||||
typedef uint64_t __wasi_timestamp_t;
|
typedef uint64_t __wasi_timestamp_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_timestamp_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_timestamp_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifiers for clocks.
|
* Identifiers for clocks.
|
||||||
*/
|
*/
|
||||||
@ -79,6 +93,9 @@ typedef uint32_t __wasi_clockid_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_CLOCKID_THREAD_CPUTIME_ID (UINT32_C(3))
|
#define __WASI_CLOCKID_THREAD_CPUTIME_ID (UINT32_C(3))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_clockid_t) == 4, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_clockid_t) == 4, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error codes returned by functions.
|
* Error codes returned by functions.
|
||||||
* Not all of these error codes are returned by the functions provided by this
|
* Not all of these error codes are returned by the functions provided by this
|
||||||
@ -472,6 +489,9 @@ typedef uint16_t __wasi_errno_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_ERRNO_NOTCAPABLE (UINT16_C(76))
|
#define __WASI_ERRNO_NOTCAPABLE (UINT16_C(76))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_errno_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_errno_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File descriptor rights, determining which actions may be performed.
|
* File descriptor rights, determining which actions may be performed.
|
||||||
*/
|
*/
|
||||||
@ -480,7 +500,7 @@ typedef uint64_t __wasi_rights_t;
|
|||||||
/**
|
/**
|
||||||
* The right to invoke `fd_datasync`.
|
* The right to invoke `fd_datasync`.
|
||||||
* If `path_open` is set, includes the right to invoke
|
* If `path_open` is set, includes the right to invoke
|
||||||
* `path_open` with `fdflag::dsync`.
|
* `path_open` with `fdflags::dsync`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_RIGHTS_FD_DATASYNC (UINT64_C(1))
|
#define __WASI_RIGHTS_FD_DATASYNC (UINT64_C(1))
|
||||||
|
|
||||||
@ -503,13 +523,13 @@ typedef uint64_t __wasi_rights_t;
|
|||||||
/**
|
/**
|
||||||
* The right to invoke `fd_sync`.
|
* The right to invoke `fd_sync`.
|
||||||
* If `path_open` is set, includes the right to invoke
|
* If `path_open` is set, includes the right to invoke
|
||||||
* `path_open` with `fdflag::rsync` and `fdflag::dsync`.
|
* `path_open` with `fdflags::rsync` and `fdflags::dsync`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_RIGHTS_FD_SYNC (UINT64_C(16))
|
#define __WASI_RIGHTS_FD_SYNC (UINT64_C(16))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The right to invoke `fd_seek` in such a way that the file offset
|
* The right to invoke `fd_seek` in such a way that the file offset
|
||||||
* remains unaltered (i.e., `WHENCE_CUR` with offset zero), or to
|
* remains unaltered (i.e., `whence::cur` with offset zero), or to
|
||||||
* invoke `fd_tell`.
|
* invoke `fd_tell`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_RIGHTS_FD_TELL (UINT64_C(32))
|
#define __WASI_RIGHTS_FD_TELL (UINT64_C(32))
|
||||||
@ -634,11 +654,17 @@ typedef uint64_t __wasi_rights_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_RIGHTS_SOCK_SHUTDOWN (UINT64_C(268435456))
|
#define __WASI_RIGHTS_SOCK_SHUTDOWN (UINT64_C(268435456))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_rights_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_rights_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A file descriptor index.
|
* A file descriptor index.
|
||||||
*/
|
*/
|
||||||
typedef uint32_t __wasi_fd_t;
|
typedef uint32_t __wasi_fd_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_fd_t) == 4, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_fd_t) == 4, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A region of memory for scatter/gather reads.
|
* A region of memory for scatter/gather reads.
|
||||||
*/
|
*/
|
||||||
@ -655,6 +681,11 @@ typedef struct __wasi_iovec_t {
|
|||||||
|
|
||||||
} __wasi_iovec_t;
|
} __wasi_iovec_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_iovec_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_iovec_t) == 4, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_iovec_t, buf) == 0, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_iovec_t, buf_len) == 4, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A region of memory for scatter/gather writes.
|
* A region of memory for scatter/gather writes.
|
||||||
*/
|
*/
|
||||||
@ -671,11 +702,19 @@ typedef struct __wasi_ciovec_t {
|
|||||||
|
|
||||||
} __wasi_ciovec_t;
|
} __wasi_ciovec_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_ciovec_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_ciovec_t) == 4, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_ciovec_t, buf) == 0, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_ciovec_t, buf_len) == 4, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relative offset within a file.
|
* Relative offset within a file.
|
||||||
*/
|
*/
|
||||||
typedef int64_t __wasi_filedelta_t;
|
typedef int64_t __wasi_filedelta_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_filedelta_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_filedelta_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The position relative to which to set the offset of the file descriptor.
|
* The position relative to which to set the offset of the file descriptor.
|
||||||
*/
|
*/
|
||||||
@ -696,6 +735,9 @@ typedef uint8_t __wasi_whence_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_WHENCE_END (UINT8_C(2))
|
#define __WASI_WHENCE_END (UINT8_C(2))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_whence_t) == 1, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_whence_t) == 1, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reference to the offset of a directory entry.
|
* A reference to the offset of a directory entry.
|
||||||
*
|
*
|
||||||
@ -703,16 +745,25 @@ typedef uint8_t __wasi_whence_t;
|
|||||||
*/
|
*/
|
||||||
typedef uint64_t __wasi_dircookie_t;
|
typedef uint64_t __wasi_dircookie_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_dircookie_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_dircookie_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type for the $d_namlen field of $dirent.
|
* The type for the $d_namlen field of $dirent.
|
||||||
*/
|
*/
|
||||||
typedef uint32_t __wasi_dirnamlen_t;
|
typedef uint32_t __wasi_dirnamlen_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_dirnamlen_t) == 4, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_dirnamlen_t) == 4, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File serial number that is unique within its file system.
|
* File serial number that is unique within its file system.
|
||||||
*/
|
*/
|
||||||
typedef uint64_t __wasi_inode_t;
|
typedef uint64_t __wasi_inode_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_inode_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_inode_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of a file descriptor or file.
|
* The type of a file descriptor or file.
|
||||||
*/
|
*/
|
||||||
@ -758,6 +809,9 @@ typedef uint8_t __wasi_filetype_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_FILETYPE_SYMBOLIC_LINK (UINT8_C(7))
|
#define __WASI_FILETYPE_SYMBOLIC_LINK (UINT8_C(7))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_filetype_t) == 1, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_filetype_t) == 1, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A directory entry.
|
* A directory entry.
|
||||||
*/
|
*/
|
||||||
@ -784,6 +838,13 @@ typedef struct __wasi_dirent_t {
|
|||||||
|
|
||||||
} __wasi_dirent_t;
|
} __wasi_dirent_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_dirent_t) == 24, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_dirent_t) == 8, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_dirent_t, d_next) == 0, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_dirent_t, d_ino) == 8, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_dirent_t, d_namlen) == 16, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_dirent_t, d_type) == 20, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File or memory access pattern advisory information.
|
* File or memory access pattern advisory information.
|
||||||
*/
|
*/
|
||||||
@ -819,6 +880,9 @@ typedef uint8_t __wasi_advice_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_ADVICE_NOREUSE (UINT8_C(5))
|
#define __WASI_ADVICE_NOREUSE (UINT8_C(5))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_advice_t) == 1, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_advice_t) == 1, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File descriptor flags.
|
* File descriptor flags.
|
||||||
*/
|
*/
|
||||||
@ -851,6 +915,9 @@ typedef uint16_t __wasi_fdflags_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_FDFLAGS_SYNC (UINT16_C(16))
|
#define __WASI_FDFLAGS_SYNC (UINT16_C(16))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_fdflags_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_fdflags_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File descriptor attributes.
|
* File descriptor attributes.
|
||||||
*/
|
*/
|
||||||
@ -878,37 +945,50 @@ typedef struct __wasi_fdstat_t {
|
|||||||
|
|
||||||
} __wasi_fdstat_t;
|
} __wasi_fdstat_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_fdstat_t) == 24, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_fdstat_t) == 8, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_fdstat_t, fs_filetype) == 0, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_fdstat_t, fs_flags) == 2, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_fdstat_t, fs_rights_base) == 8, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_fdstat_t, fs_rights_inheriting) == 16, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier for a device containing a file system. Can be used in combination
|
* Identifier for a device containing a file system. Can be used in combination
|
||||||
* with `inode` to uniquely identify a file or directory in the filesystem.
|
* with `inode` to uniquely identify a file or directory in the filesystem.
|
||||||
*/
|
*/
|
||||||
typedef uint64_t __wasi_device_t;
|
typedef uint64_t __wasi_device_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_device_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_device_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Which file time attributes to adjust.
|
* Which file time attributes to adjust.
|
||||||
*/
|
*/
|
||||||
typedef uint16_t __wasi_fstflags_t;
|
typedef uint16_t __wasi_fstflags_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust the last data access timestamp to the value stored in `filestat::st_atim`.
|
* Adjust the last data access timestamp to the value stored in `filestat::atim`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_FSTFLAGS_ATIM (UINT16_C(1))
|
#define __WASI_FSTFLAGS_ATIM (UINT16_C(1))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust the last data access timestamp to the time of clock `clock::realtime`.
|
* Adjust the last data access timestamp to the time of clock `clockid::realtime`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_FSTFLAGS_ATIM_NOW (UINT16_C(2))
|
#define __WASI_FSTFLAGS_ATIM_NOW (UINT16_C(2))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust the last data modification timestamp to the value stored in `filestat::st_mtim`.
|
* Adjust the last data modification timestamp to the value stored in `filestat::mtim`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_FSTFLAGS_MTIM (UINT16_C(4))
|
#define __WASI_FSTFLAGS_MTIM (UINT16_C(4))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust the last data modification timestamp to the time of clock `clock::realtime`.
|
* Adjust the last data modification timestamp to the time of clock `clockid::realtime`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_FSTFLAGS_MTIM_NOW (UINT16_C(8))
|
#define __WASI_FSTFLAGS_MTIM_NOW (UINT16_C(8))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_fstflags_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_fstflags_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags determining the method of how paths are resolved.
|
* Flags determining the method of how paths are resolved.
|
||||||
*/
|
*/
|
||||||
@ -919,6 +999,9 @@ typedef uint32_t __wasi_lookupflags_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW (UINT32_C(1))
|
#define __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW (UINT32_C(1))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_lookupflags_t) == 4, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_lookupflags_t) == 4, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open flags used by `path_open`.
|
* Open flags used by `path_open`.
|
||||||
*/
|
*/
|
||||||
@ -944,11 +1027,17 @@ typedef uint16_t __wasi_oflags_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_OFLAGS_TRUNC (UINT16_C(8))
|
#define __WASI_OFLAGS_TRUNC (UINT16_C(8))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_oflags_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_oflags_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of hard links to an inode.
|
* Number of hard links to an inode.
|
||||||
*/
|
*/
|
||||||
typedef uint64_t __wasi_linkcount_t;
|
typedef uint64_t __wasi_linkcount_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_linkcount_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_linkcount_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File attributes.
|
* File attributes.
|
||||||
*/
|
*/
|
||||||
@ -995,35 +1084,52 @@ typedef struct __wasi_filestat_t {
|
|||||||
|
|
||||||
} __wasi_filestat_t;
|
} __wasi_filestat_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_filestat_t) == 64, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_filestat_t) == 8, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_filestat_t, dev) == 0, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_filestat_t, ino) == 8, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_filestat_t, filetype) == 16, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_filestat_t, nlink) == 24, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_filestat_t, size) == 32, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_filestat_t, atim) == 40, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_filestat_t, mtim) == 48, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_filestat_t, ctim) == 56, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User-provided value that may be attached to objects that is retained when
|
* User-provided value that may be attached to objects that is retained when
|
||||||
* extracted from the implementation.
|
* extracted from the implementation.
|
||||||
*/
|
*/
|
||||||
typedef uint64_t __wasi_userdata_t;
|
typedef uint64_t __wasi_userdata_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_userdata_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_userdata_t) == 8, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of a subscription to an event or its occurrence.
|
* Type of a subscription to an event or its occurrence.
|
||||||
*/
|
*/
|
||||||
typedef uint8_t __wasi_eventtype_t;
|
typedef uint8_t __wasi_eventtype_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time value of clock `subscription::u.clock.clock_id` has
|
* The time value of clock `subscription_clock::id` has
|
||||||
* reached timestamp `subscription::u.clock.timeout`.
|
* reached timestamp `subscription_clock::timeout`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_EVENTTYPE_CLOCK (UINT8_C(0))
|
#define __WASI_EVENTTYPE_CLOCK (UINT8_C(0))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File descriptor `subscription::u.fd_readwrite.fd` has data
|
* File descriptor `subscription_fd_readwrite::file_descriptor` has data
|
||||||
* available for reading. This event always triggers for regular files.
|
* available for reading. This event always triggers for regular files.
|
||||||
*/
|
*/
|
||||||
#define __WASI_EVENTTYPE_FD_READ (UINT8_C(1))
|
#define __WASI_EVENTTYPE_FD_READ (UINT8_C(1))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File descriptor `subscription::u.fd_readwrite.fd` has capacity
|
* File descriptor `subscription_fd_readwrite::file_descriptor` has capacity
|
||||||
* available for writing. This event always triggers for regular files.
|
* available for writing. This event always triggers for regular files.
|
||||||
*/
|
*/
|
||||||
#define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2))
|
#define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_eventtype_t) == 1, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_eventtype_t) == 1, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The state of the file descriptor subscribed to with
|
* The state of the file descriptor subscribed to with
|
||||||
* `eventtype::fd_read` or `eventtype::fd_write`.
|
* `eventtype::fd_read` or `eventtype::fd_write`.
|
||||||
@ -1035,6 +1141,9 @@ typedef uint16_t __wasi_eventrwflags_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP (UINT16_C(1))
|
#define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP (UINT16_C(1))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_eventrwflags_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_eventrwflags_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contents of an $event when type is `eventtype::fd_read` or
|
* The contents of an $event when type is `eventtype::fd_read` or
|
||||||
* `eventtype::fd_write`.
|
* `eventtype::fd_write`.
|
||||||
@ -1052,16 +1161,10 @@ typedef struct __wasi_event_fd_readwrite_t {
|
|||||||
|
|
||||||
} __wasi_event_fd_readwrite_t;
|
} __wasi_event_fd_readwrite_t;
|
||||||
|
|
||||||
/**
|
_Static_assert(sizeof(__wasi_event_fd_readwrite_t) == 16, "witx calculated size");
|
||||||
* The contents of an $event.
|
_Static_assert(_Alignof(__wasi_event_fd_readwrite_t) == 8, "witx calculated align");
|
||||||
*/
|
_Static_assert(offsetof(__wasi_event_fd_readwrite_t, nbytes) == 0, "witx calculated offset");
|
||||||
typedef union __wasi_event_u_t {
|
_Static_assert(offsetof(__wasi_event_fd_readwrite_t, flags) == 8, "witx calculated offset");
|
||||||
/**
|
|
||||||
* When type is `eventtype::fd_read` or `eventtype::fd_write`:
|
|
||||||
*/
|
|
||||||
__wasi_event_fd_readwrite_t fd_readwrite;
|
|
||||||
|
|
||||||
} __wasi_event_u_t;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event that occurred.
|
* An event that occurred.
|
||||||
@ -1078,32 +1181,43 @@ typedef struct __wasi_event_t {
|
|||||||
__wasi_errno_t error;
|
__wasi_errno_t error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the event that occurred.
|
* The type of event that occured
|
||||||
*/
|
*/
|
||||||
__wasi_eventtype_t type;
|
__wasi_eventtype_t type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contents of the event.
|
* The contents of the event, if it is an `eventtype::fd_read` or
|
||||||
|
* `eventtype::fd_write`. `eventtype::clock` events ignore this field.
|
||||||
*/
|
*/
|
||||||
__wasi_event_u_t u;
|
__wasi_event_fd_readwrite_t fd_readwrite;
|
||||||
|
|
||||||
} __wasi_event_t;
|
} __wasi_event_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_event_t) == 32, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_event_t) == 8, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_event_t, userdata) == 0, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_event_t, error) == 8, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_event_t, type) == 10, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_event_t, fd_readwrite) == 16, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags determining how to interpret the timestamp provided in
|
* Flags determining how to interpret the timestamp provided in
|
||||||
* `subscription::u.clock.timeout.`
|
* `subscription_clock::timeout`.
|
||||||
*/
|
*/
|
||||||
typedef uint16_t __wasi_subclockflags_t;
|
typedef uint16_t __wasi_subclockflags_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set, treat the timestamp provided in
|
* If set, treat the timestamp provided in
|
||||||
* `subscription::u.clock.timeout` as an absolute timestamp of clock
|
* `subscription_clock::timeout` as an absolute timestamp of clock
|
||||||
* `subscription::u.clock.clock_id.` If clear, treat the timestamp
|
* `subscription_clock::id`. If clear, treat the timestamp
|
||||||
* provided in `subscription::u.clock.timeout` relative to the
|
* provided in `subscription_clock::timeout` relative to the
|
||||||
* current time value of clock `subscription::u.clock.clock_id.`
|
* current time value of clock `subscription_clock::id`.
|
||||||
*/
|
*/
|
||||||
#define __WASI_SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME (UINT16_C(1))
|
#define __WASI_SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME (UINT16_C(1))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_subclockflags_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_subclockflags_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contents of a $subscription when type is `eventtype::clock`.
|
* The contents of a $subscription when type is `eventtype::clock`.
|
||||||
*/
|
*/
|
||||||
@ -1131,6 +1245,13 @@ typedef struct __wasi_subscription_clock_t {
|
|||||||
|
|
||||||
} __wasi_subscription_clock_t;
|
} __wasi_subscription_clock_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_subscription_clock_t) == 32, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_subscription_clock_t) == 8, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_subscription_clock_t, id) == 0, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_subscription_clock_t, timeout) == 8, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_subscription_clock_t, precision) == 16, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_subscription_clock_t, flags) == 24, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contents of a $subscription when type is type is
|
* The contents of a $subscription when type is type is
|
||||||
* `eventtype::fd_read` or `eventtype::fd_write`.
|
* `eventtype::fd_read` or `eventtype::fd_write`.
|
||||||
@ -1143,22 +1264,29 @@ typedef struct __wasi_subscription_fd_readwrite_t {
|
|||||||
|
|
||||||
} __wasi_subscription_fd_readwrite_t;
|
} __wasi_subscription_fd_readwrite_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_subscription_fd_readwrite_t) == 4, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_subscription_fd_readwrite_t) == 4, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_subscription_fd_readwrite_t, file_descriptor) == 0, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contents of a $subscription.
|
* The contents of a $subscription.
|
||||||
*/
|
*/
|
||||||
typedef union __wasi_subscription_u_t {
|
typedef union __wasi_subscription_u_u_t {
|
||||||
/**
|
|
||||||
* When type is `eventtype::clock`:
|
|
||||||
*/
|
|
||||||
__wasi_subscription_clock_t clock;
|
__wasi_subscription_clock_t clock;
|
||||||
|
__wasi_subscription_fd_readwrite_t fd_read;
|
||||||
/**
|
__wasi_subscription_fd_readwrite_t fd_write;
|
||||||
* When type is `eventtype::fd_read` or `eventtype::fd_write`:
|
} __wasi_subscription_u_u_t;
|
||||||
*/
|
typedef struct __wasi_subscription_u_t {
|
||||||
__wasi_subscription_fd_readwrite_t fd_readwrite;
|
__wasi_eventtype_t tag;
|
||||||
|
__wasi_subscription_u_u_t u;
|
||||||
} __wasi_subscription_u_t;
|
} __wasi_subscription_u_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_subscription_u_t) == 40, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_subscription_u_t) == 8, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_subscription_u_t, u) == 8, "witx calculated union offset");
|
||||||
|
_Static_assert(sizeof(__wasi_subscription_u_u_t) == 32, "witx calculated union size");
|
||||||
|
_Static_assert(_Alignof(__wasi_subscription_u_u_t) == 8, "witx calculated union align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscription to an event.
|
* Subscription to an event.
|
||||||
*/
|
*/
|
||||||
@ -1170,22 +1298,25 @@ typedef struct __wasi_subscription_t {
|
|||||||
__wasi_userdata_t userdata;
|
__wasi_userdata_t userdata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the event to which to subscribe.
|
* The type of the event to which to subscribe, and its contents
|
||||||
*/
|
|
||||||
__wasi_eventtype_t type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The contents of the subscription.
|
|
||||||
*/
|
*/
|
||||||
__wasi_subscription_u_t u;
|
__wasi_subscription_u_t u;
|
||||||
|
|
||||||
} __wasi_subscription_t;
|
} __wasi_subscription_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_subscription_t) == 48, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_subscription_t) == 8, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_subscription_t, userdata) == 0, "witx calculated offset");
|
||||||
|
_Static_assert(offsetof(__wasi_subscription_t, u) == 8, "witx calculated offset");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit code generated by a process when exiting.
|
* Exit code generated by a process when exiting.
|
||||||
*/
|
*/
|
||||||
typedef uint32_t __wasi_exitcode_t;
|
typedef uint32_t __wasi_exitcode_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_exitcode_t) == 4, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_exitcode_t) == 4, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal condition.
|
* Signal condition.
|
||||||
*/
|
*/
|
||||||
@ -1377,6 +1508,9 @@ typedef uint8_t __wasi_signal_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_SIGNAL_SYS (UINT8_C(30))
|
#define __WASI_SIGNAL_SYS (UINT8_C(30))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_signal_t) == 1, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_signal_t) == 1, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags provided to `sock_recv`.
|
* Flags provided to `sock_recv`.
|
||||||
*/
|
*/
|
||||||
@ -1392,6 +1526,9 @@ typedef uint16_t __wasi_riflags_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_RIFLAGS_RECV_WAITALL (UINT16_C(2))
|
#define __WASI_RIFLAGS_RECV_WAITALL (UINT16_C(2))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_riflags_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_riflags_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags returned by `sock_recv`.
|
* Flags returned by `sock_recv`.
|
||||||
*/
|
*/
|
||||||
@ -1402,12 +1539,18 @@ typedef uint16_t __wasi_roflags_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_ROFLAGS_RECV_DATA_TRUNCATED (UINT16_C(1))
|
#define __WASI_ROFLAGS_RECV_DATA_TRUNCATED (UINT16_C(1))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_roflags_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_roflags_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags provided to `sock_send`. As there are currently no flags
|
* Flags provided to `sock_send`. As there are currently no flags
|
||||||
* defined, it must be set to zero.
|
* defined, it must be set to zero.
|
||||||
*/
|
*/
|
||||||
typedef uint16_t __wasi_siflags_t;
|
typedef uint16_t __wasi_siflags_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_siflags_t) == 2, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_siflags_t) == 2, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Which channels on a socket to shut down.
|
* Which channels on a socket to shut down.
|
||||||
*/
|
*/
|
||||||
@ -1423,6 +1566,9 @@ typedef uint8_t __wasi_sdflags_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_SDFLAGS_WR (UINT8_C(2))
|
#define __WASI_SDFLAGS_WR (UINT8_C(2))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_sdflags_t) == 1, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_sdflags_t) == 1, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifiers for preopened capabilities.
|
* Identifiers for preopened capabilities.
|
||||||
*/
|
*/
|
||||||
@ -1433,6 +1579,9 @@ typedef uint8_t __wasi_preopentype_t;
|
|||||||
*/
|
*/
|
||||||
#define __WASI_PREOPENTYPE_DIR (UINT8_C(0))
|
#define __WASI_PREOPENTYPE_DIR (UINT8_C(0))
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_preopentype_t) == 1, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_preopentype_t) == 1, "witx calculated align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The contents of a $prestat when type is `preopentype::dir`.
|
* The contents of a $prestat when type is `preopentype::dir`.
|
||||||
*/
|
*/
|
||||||
@ -1444,33 +1593,27 @@ typedef struct __wasi_prestat_dir_t {
|
|||||||
|
|
||||||
} __wasi_prestat_dir_t;
|
} __wasi_prestat_dir_t;
|
||||||
|
|
||||||
/**
|
_Static_assert(sizeof(__wasi_prestat_dir_t) == 4, "witx calculated size");
|
||||||
* The contents of an $prestat.
|
_Static_assert(_Alignof(__wasi_prestat_dir_t) == 4, "witx calculated align");
|
||||||
*/
|
_Static_assert(offsetof(__wasi_prestat_dir_t, pr_name_len) == 0, "witx calculated offset");
|
||||||
typedef union __wasi_prestat_u_t {
|
|
||||||
/**
|
|
||||||
* When type is `preopentype::dir`:
|
|
||||||
*/
|
|
||||||
__wasi_prestat_dir_t dir;
|
|
||||||
|
|
||||||
} __wasi_prestat_u_t;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about a pre-opened capability.
|
* Information about a pre-opened capability.
|
||||||
*/
|
*/
|
||||||
|
typedef union __wasi_prestat_u_t {
|
||||||
|
__wasi_prestat_dir_t dir;
|
||||||
|
} __wasi_prestat_u_t;
|
||||||
typedef struct __wasi_prestat_t {
|
typedef struct __wasi_prestat_t {
|
||||||
/**
|
__wasi_preopentype_t tag;
|
||||||
* The type of the pre-opened capability.
|
|
||||||
*/
|
|
||||||
__wasi_preopentype_t pr_type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The contents of the information.
|
|
||||||
*/
|
|
||||||
__wasi_prestat_u_t u;
|
__wasi_prestat_u_t u;
|
||||||
|
|
||||||
} __wasi_prestat_t;
|
} __wasi_prestat_t;
|
||||||
|
|
||||||
|
_Static_assert(sizeof(__wasi_prestat_t) == 8, "witx calculated size");
|
||||||
|
_Static_assert(_Alignof(__wasi_prestat_t) == 4, "witx calculated align");
|
||||||
|
_Static_assert(offsetof(__wasi_prestat_t, u) == 4, "witx calculated union offset");
|
||||||
|
_Static_assert(sizeof(__wasi_prestat_u_t) == 4, "witx calculated union size");
|
||||||
|
_Static_assert(_Alignof(__wasi_prestat_u_t) == 4, "witx calculated union align");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup wasi_snapshot_preview1
|
* @defgroup wasi_snapshot_preview1
|
||||||
* @{
|
* @{
|
||||||
@ -1478,7 +1621,7 @@ typedef struct __wasi_prestat_t {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Read command-line argument data.
|
* Read command-line argument data.
|
||||||
* The size of the array should match that returned by `wasi_args_sizes_get()`
|
* The size of the array should match that returned by `args_sizes_get`
|
||||||
*/
|
*/
|
||||||
__wasi_errno_t __wasi_args_get(
|
__wasi_errno_t __wasi_args_get(
|
||||||
uint8_t * * argv,
|
uint8_t * * argv,
|
||||||
@ -1510,7 +1653,7 @@ __wasi_errno_t __wasi_args_sizes_get(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Read environment variable data.
|
* Read environment variable data.
|
||||||
* The sizes of the buffers should match that returned by `environ.sizes_get()`.
|
* The sizes of the buffers should match that returned by `environ_sizes_get`.
|
||||||
*/
|
*/
|
||||||
__wasi_errno_t __wasi_environ_get(
|
__wasi_errno_t __wasi_environ_get(
|
||||||
uint8_t * * environ,
|
uint8_t * * environ,
|
||||||
@ -1542,7 +1685,8 @@ __wasi_errno_t __wasi_environ_sizes_get(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the resolution of a clock.
|
* Return the resolution of a clock.
|
||||||
* Implementations are required to provide a non-zero value for supported clocks. For unsupported clocks, return `WASI_EINVAL`
|
* Implementations are required to provide a non-zero value for supported clocks. For unsupported clocks,
|
||||||
|
* return `errno::inval`.
|
||||||
* Note: This is similar to `clock_getres` in POSIX.
|
* Note: This is similar to `clock_getres` in POSIX.
|
||||||
*/
|
*/
|
||||||
__wasi_errno_t __wasi_clock_res_get(
|
__wasi_errno_t __wasi_clock_res_get(
|
||||||
@ -1695,7 +1839,7 @@ __wasi_errno_t __wasi_fd_fdstat_set_flags(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust the rights associated with a file descriptor.
|
* Adjust the rights associated with a file descriptor.
|
||||||
* This can only be used to remove rights, and returns `ENOTCAPABLE` if called in a way that would attempt to add rights
|
* This can only be used to remove rights, and returns `errno::notcapable` if called in a way that would attempt to add rights
|
||||||
*/
|
*/
|
||||||
__wasi_errno_t __wasi_fd_fdstat_set_rights(
|
__wasi_errno_t __wasi_fd_fdstat_set_rights(
|
||||||
__wasi_fd_t fd,
|
__wasi_fd_t fd,
|
||||||
@ -2196,7 +2340,7 @@ __wasi_errno_t __wasi_path_open(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The relative path of the file or directory to open, relative to the
|
* The relative path of the file or directory to open, relative to the
|
||||||
* `dirfd` directory.
|
* `path_open::fd` directory.
|
||||||
*/
|
*/
|
||||||
const char *path,
|
const char *path,
|
||||||
|
|
||||||
@ -2271,7 +2415,7 @@ __wasi_errno_t __wasi_path_readlink(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a directory.
|
* Remove a directory.
|
||||||
* Return `ENOTEMPTY` if the directory is not empty.
|
* Return `errno::notempty` if the directory is not empty.
|
||||||
* Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
|
* Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
|
||||||
*/
|
*/
|
||||||
__wasi_errno_t __wasi_path_remove_directory(
|
__wasi_errno_t __wasi_path_remove_directory(
|
||||||
@ -2363,7 +2507,7 @@ __wasi_errno_t __wasi_path_symlink(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlink a file.
|
* Unlink a file.
|
||||||
* Return `EISDIR` if the path refers to a directory.
|
* Return `errno::isdir` if the path refers to a directory.
|
||||||
* Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
|
* Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
|
||||||
*/
|
*/
|
||||||
__wasi_errno_t __wasi_path_unlink_file(
|
__wasi_errno_t __wasi_path_unlink_file(
|
||||||
|
19
libc-bottom-half/headers/public/wasi/libc-environ.h
Normal file
19
libc-bottom-half/headers/public/wasi/libc-environ.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef __wasi_libc_environ_h
|
||||||
|
#define __wasi_libc_environ_h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Initialize the global environment variable state. Only needs to be
|
||||||
|
/// called once; most users should call `__wasilibc_ensure_environ` instead.
|
||||||
|
void __wasilibc_initialize_environ(void);
|
||||||
|
|
||||||
|
/// If `__wasilibc_initialize_environ` has not yet been called, call it.
|
||||||
|
void __wasilibc_ensure_environ(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -524,7 +524,7 @@ __wasilibc_find_relpath(
|
|||||||
/// This is referenced by weak reference from crt1.c and lives in the same source
|
/// This is referenced by weak reference from crt1.c and lives in the same source
|
||||||
/// file as `__wasilibc_find_relpath` so that it's linked in when it's needed.
|
/// file as `__wasilibc_find_relpath` so that it's linked in when it's needed.
|
||||||
// Concerning the 51 -- see the comment by the constructor priority in
|
// Concerning the 51 -- see the comment by the constructor priority in
|
||||||
// libc-bottom-half/sources/__environ.c.
|
// libc-bottom-half/sources/__wasilibc_environ.c.
|
||||||
__attribute__((constructor(51)))
|
__attribute__((constructor(51)))
|
||||||
static void
|
static void
|
||||||
__wasilibc_populate_libpreopen(void)
|
__wasilibc_populate_libpreopen(void)
|
||||||
@ -538,7 +538,7 @@ __wasilibc_populate_libpreopen(void)
|
|||||||
break;
|
break;
|
||||||
if (ret != __WASI_ERRNO_SUCCESS)
|
if (ret != __WASI_ERRNO_SUCCESS)
|
||||||
goto oserr;
|
goto oserr;
|
||||||
switch (prestat.pr_type) {
|
switch (prestat.tag) {
|
||||||
case __WASI_PREOPENTYPE_DIR: {
|
case __WASI_PREOPENTYPE_DIR: {
|
||||||
char *path = malloc(prestat.u.dir.pr_name_len + 1);
|
char *path = malloc(prestat.u.dir.pr_name_len + 1);
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
@ -547,13 +547,11 @@ __wasilibc_populate_libpreopen(void)
|
|||||||
// TODO: Remove the cast on `path` once the witx is updated with char8 support.
|
// TODO: Remove the cast on `path` once the witx is updated with char8 support.
|
||||||
ret = __wasi_fd_prestat_dir_name(fd, (uint8_t *)path, prestat.u.dir.pr_name_len);
|
ret = __wasi_fd_prestat_dir_name(fd, (uint8_t *)path, prestat.u.dir.pr_name_len);
|
||||||
if (ret != __WASI_ERRNO_SUCCESS) {
|
if (ret != __WASI_ERRNO_SUCCESS) {
|
||||||
free(path);
|
|
||||||
goto oserr;
|
goto oserr;
|
||||||
}
|
}
|
||||||
path[prestat.u.dir.pr_name_len] = '\0';
|
path[prestat.u.dir.pr_name_len] = '\0';
|
||||||
|
|
||||||
if (internal_register_preopened_fd(fd, path) != 0) {
|
if (internal_register_preopened_fd(fd, path) != 0) {
|
||||||
free(path);
|
|
||||||
goto software;
|
goto software;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,121 +0,0 @@
|
|||||||
Creative Commons Legal Code
|
|
||||||
|
|
||||||
CC0 1.0 Universal
|
|
||||||
|
|
||||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
||||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
||||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
||||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
||||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
||||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
||||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
||||||
HEREUNDER.
|
|
||||||
|
|
||||||
Statement of Purpose
|
|
||||||
|
|
||||||
The laws of most jurisdictions throughout the world automatically confer
|
|
||||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
||||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
||||||
authorship and/or a database (each, a "Work").
|
|
||||||
|
|
||||||
Certain owners wish to permanently relinquish those rights to a Work for
|
|
||||||
the purpose of contributing to a commons of creative, cultural and
|
|
||||||
scientific works ("Commons") that the public can reliably and without fear
|
|
||||||
of later claims of infringement build upon, modify, incorporate in other
|
|
||||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
||||||
and for any purposes, including without limitation commercial purposes.
|
|
||||||
These owners may contribute to the Commons to promote the ideal of a free
|
|
||||||
culture and the further production of creative, cultural and scientific
|
|
||||||
works, or to gain reputation or greater distribution for their Work in
|
|
||||||
part through the use and efforts of others.
|
|
||||||
|
|
||||||
For these and/or other purposes and motivations, and without any
|
|
||||||
expectation of additional consideration or compensation, the person
|
|
||||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
||||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
||||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
||||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
||||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
||||||
|
|
||||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
||||||
protected by copyright and related or neighboring rights ("Copyright and
|
|
||||||
Related Rights"). Copyright and Related Rights include, but are not
|
|
||||||
limited to, the following:
|
|
||||||
|
|
||||||
i. the right to reproduce, adapt, distribute, perform, display,
|
|
||||||
communicate, and translate a Work;
|
|
||||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
||||||
iii. publicity and privacy rights pertaining to a person's image or
|
|
||||||
likeness depicted in a Work;
|
|
||||||
iv. rights protecting against unfair competition in regards to a Work,
|
|
||||||
subject to the limitations in paragraph 4(a), below;
|
|
||||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
||||||
in a Work;
|
|
||||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
||||||
European Parliament and of the Council of 11 March 1996 on the legal
|
|
||||||
protection of databases, and under any national implementation
|
|
||||||
thereof, including any amended or successor version of such
|
|
||||||
directive); and
|
|
||||||
vii. other similar, equivalent or corresponding rights throughout the
|
|
||||||
world based on applicable law or treaty, and any national
|
|
||||||
implementations thereof.
|
|
||||||
|
|
||||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
||||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
||||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
||||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
||||||
of action, whether now known or unknown (including existing as well as
|
|
||||||
future claims and causes of action), in the Work (i) in all territories
|
|
||||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
||||||
treaty (including future time extensions), (iii) in any current or future
|
|
||||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
||||||
including without limitation commercial, advertising or promotional
|
|
||||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
||||||
member of the public at large and to the detriment of Affirmer's heirs and
|
|
||||||
successors, fully intending that such Waiver shall not be subject to
|
|
||||||
revocation, rescission, cancellation, termination, or any other legal or
|
|
||||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
||||||
as contemplated by Affirmer's express Statement of Purpose.
|
|
||||||
|
|
||||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
||||||
be judged legally invalid or ineffective under applicable law, then the
|
|
||||||
Waiver shall be preserved to the maximum extent permitted taking into
|
|
||||||
account Affirmer's express Statement of Purpose. In addition, to the
|
|
||||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
||||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
||||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
||||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
||||||
maximum duration provided by applicable law or treaty (including future
|
|
||||||
time extensions), (iii) in any current or future medium and for any number
|
|
||||||
of copies, and (iv) for any purpose whatsoever, including without
|
|
||||||
limitation commercial, advertising or promotional purposes (the
|
|
||||||
"License"). The License shall be deemed effective as of the date CC0 was
|
|
||||||
applied by Affirmer to the Work. Should any part of the License for any
|
|
||||||
reason be judged legally invalid or ineffective under applicable law, such
|
|
||||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
||||||
of the License, and in such case Affirmer hereby affirms that he or she
|
|
||||||
will not (i) exercise any of his or her remaining Copyright and Related
|
|
||||||
Rights in the Work or (ii) assert any associated claims and causes of
|
|
||||||
action with respect to the Work, in either case contrary to Affirmer's
|
|
||||||
express Statement of Purpose.
|
|
||||||
|
|
||||||
4. Limitations and Disclaimers.
|
|
||||||
|
|
||||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
||||||
surrendered, licensed or otherwise affected by this document.
|
|
||||||
b. Affirmer offers the Work as-is and makes no representations or
|
|
||||||
warranties of any kind concerning the Work, express, implied,
|
|
||||||
statutory or otherwise, including without limitation warranties of
|
|
||||||
title, merchantability, fitness for a particular purpose, non
|
|
||||||
infringement, or the absence of latent or other defects, accuracy, or
|
|
||||||
the present or absence of errors, whether or not discoverable, all to
|
|
||||||
the greatest extent permissible under applicable law.
|
|
||||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
||||||
that may apply to the Work or any use thereof, including without
|
|
||||||
limitation any person's Copyright and Related Rights in the Work.
|
|
||||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
||||||
consents, permissions or other rights required for any use of the
|
|
||||||
Work.
|
|
||||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
||||||
party to this document and has no duty or obligation with respect to
|
|
||||||
this CC0 or use of the Work.
|
|
@ -1,121 +0,0 @@
|
|||||||
Creative Commons Legal Code
|
|
||||||
|
|
||||||
CC0 1.0 Universal
|
|
||||||
|
|
||||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
||||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
||||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
||||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
||||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
||||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
||||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
||||||
HEREUNDER.
|
|
||||||
|
|
||||||
Statement of Purpose
|
|
||||||
|
|
||||||
The laws of most jurisdictions throughout the world automatically confer
|
|
||||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
||||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
||||||
authorship and/or a database (each, a "Work").
|
|
||||||
|
|
||||||
Certain owners wish to permanently relinquish those rights to a Work for
|
|
||||||
the purpose of contributing to a commons of creative, cultural and
|
|
||||||
scientific works ("Commons") that the public can reliably and without fear
|
|
||||||
of later claims of infringement build upon, modify, incorporate in other
|
|
||||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
||||||
and for any purposes, including without limitation commercial purposes.
|
|
||||||
These owners may contribute to the Commons to promote the ideal of a free
|
|
||||||
culture and the further production of creative, cultural and scientific
|
|
||||||
works, or to gain reputation or greater distribution for their Work in
|
|
||||||
part through the use and efforts of others.
|
|
||||||
|
|
||||||
For these and/or other purposes and motivations, and without any
|
|
||||||
expectation of additional consideration or compensation, the person
|
|
||||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
||||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
||||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
||||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
||||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
||||||
|
|
||||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
||||||
protected by copyright and related or neighboring rights ("Copyright and
|
|
||||||
Related Rights"). Copyright and Related Rights include, but are not
|
|
||||||
limited to, the following:
|
|
||||||
|
|
||||||
i. the right to reproduce, adapt, distribute, perform, display,
|
|
||||||
communicate, and translate a Work;
|
|
||||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
||||||
iii. publicity and privacy rights pertaining to a person's image or
|
|
||||||
likeness depicted in a Work;
|
|
||||||
iv. rights protecting against unfair competition in regards to a Work,
|
|
||||||
subject to the limitations in paragraph 4(a), below;
|
|
||||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
||||||
in a Work;
|
|
||||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
||||||
European Parliament and of the Council of 11 March 1996 on the legal
|
|
||||||
protection of databases, and under any national implementation
|
|
||||||
thereof, including any amended or successor version of such
|
|
||||||
directive); and
|
|
||||||
vii. other similar, equivalent or corresponding rights throughout the
|
|
||||||
world based on applicable law or treaty, and any national
|
|
||||||
implementations thereof.
|
|
||||||
|
|
||||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
||||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
||||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
||||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
||||||
of action, whether now known or unknown (including existing as well as
|
|
||||||
future claims and causes of action), in the Work (i) in all territories
|
|
||||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
||||||
treaty (including future time extensions), (iii) in any current or future
|
|
||||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
||||||
including without limitation commercial, advertising or promotional
|
|
||||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
||||||
member of the public at large and to the detriment of Affirmer's heirs and
|
|
||||||
successors, fully intending that such Waiver shall not be subject to
|
|
||||||
revocation, rescission, cancellation, termination, or any other legal or
|
|
||||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
||||||
as contemplated by Affirmer's express Statement of Purpose.
|
|
||||||
|
|
||||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
||||||
be judged legally invalid or ineffective under applicable law, then the
|
|
||||||
Waiver shall be preserved to the maximum extent permitted taking into
|
|
||||||
account Affirmer's express Statement of Purpose. In addition, to the
|
|
||||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
||||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
||||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
||||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
||||||
maximum duration provided by applicable law or treaty (including future
|
|
||||||
time extensions), (iii) in any current or future medium and for any number
|
|
||||||
of copies, and (iv) for any purpose whatsoever, including without
|
|
||||||
limitation commercial, advertising or promotional purposes (the
|
|
||||||
"License"). The License shall be deemed effective as of the date CC0 was
|
|
||||||
applied by Affirmer to the Work. Should any part of the License for any
|
|
||||||
reason be judged legally invalid or ineffective under applicable law, such
|
|
||||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
||||||
of the License, and in such case Affirmer hereby affirms that he or she
|
|
||||||
will not (i) exercise any of his or her remaining Copyright and Related
|
|
||||||
Rights in the Work or (ii) assert any associated claims and causes of
|
|
||||||
action with respect to the Work, in either case contrary to Affirmer's
|
|
||||||
express Statement of Purpose.
|
|
||||||
|
|
||||||
4. Limitations and Disclaimers.
|
|
||||||
|
|
||||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
||||||
surrendered, licensed or otherwise affected by this document.
|
|
||||||
b. Affirmer offers the Work as-is and makes no representations or
|
|
||||||
warranties of any kind concerning the Work, express, implied,
|
|
||||||
statutory or otherwise, including without limitation warranties of
|
|
||||||
title, merchantability, fitness for a particular purpose, non
|
|
||||||
infringement, or the absence of latent or other defects, accuracy, or
|
|
||||||
the present or absence of errors, whether or not discoverable, all to
|
|
||||||
the greatest extent permissible under applicable law.
|
|
||||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
||||||
that may apply to the Work or any use thereof, including without
|
|
||||||
limitation any person's Copyright and Related Rights in the Work.
|
|
||||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
||||||
consents, permissions or other rights required for any use of the
|
|
||||||
Work.
|
|
||||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
||||||
party to this document and has no duty or obligation with respect to
|
|
||||||
this CC0 or use of the Work.
|
|
10
libc-bottom-half/sources/__main_argc_argv.c
Normal file
10
libc-bottom-half/sources/__main_argc_argv.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// New compilers define `__main_argc_argv`. If that doesn't exist, we
|
||||||
|
// may get called here. Old compilers define `main` expecting an
|
||||||
|
// argv/argc, so call that.
|
||||||
|
// TODO: Remove this layer when we no longer have to support old compilers.
|
||||||
|
int __wasilibc_main(int argc, char *argv[]) asm("main");
|
||||||
|
|
||||||
|
__attribute__((weak, nodebug))
|
||||||
|
int __main_argc_argv(int argc, char *argv[]) {
|
||||||
|
return __wasilibc_main(argc, argv);
|
||||||
|
}
|
54
libc-bottom-half/sources/__main_void.c
Normal file
54
libc-bottom-half/sources/__main_void.c
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include <wasi/api.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sysexits.h>
|
||||||
|
|
||||||
|
// The user's `main` function, expecting arguments.
|
||||||
|
int __main_argc_argv(int argc, char *argv[]);
|
||||||
|
|
||||||
|
// If the user's `main` function expects arguments, the compiler will rename
|
||||||
|
// it to `__main_argc_argv`, and this version will get linked in, which
|
||||||
|
// initializes the argument data and calls `__main_argc_argv`.
|
||||||
|
__attribute__((weak, nodebug))
|
||||||
|
int __main_void(void) {
|
||||||
|
__wasi_errno_t err;
|
||||||
|
|
||||||
|
// Get the sizes of the arrays we'll have to create to copy in the args.
|
||||||
|
size_t argv_buf_size;
|
||||||
|
size_t argc;
|
||||||
|
err = __wasi_args_sizes_get(&argc, &argv_buf_size);
|
||||||
|
if (err != __WASI_ERRNO_SUCCESS) {
|
||||||
|
_Exit(EX_OSERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add 1 for the NULL pointer to mark the end, and check for overflow.
|
||||||
|
size_t num_ptrs = argc + 1;
|
||||||
|
if (num_ptrs == 0) {
|
||||||
|
_Exit(EX_SOFTWARE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allocate memory for storing the argument chars.
|
||||||
|
char *argv_buf = malloc(argv_buf_size);
|
||||||
|
if (argv_buf == NULL) {
|
||||||
|
_Exit(EX_SOFTWARE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allocate memory for the array of pointers. This uses `calloc` both to
|
||||||
|
// handle overflow and to initialize the NULL pointer at the end.
|
||||||
|
char **argv = calloc(num_ptrs, sizeof(char *));
|
||||||
|
if (argv == NULL) {
|
||||||
|
free(argv_buf);
|
||||||
|
_Exit(EX_SOFTWARE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill the argument chars, and the argv array with pointers into those chars.
|
||||||
|
// TODO: Remove the casts on `argv_ptrs` and `argv_buf` once the witx is updated with char8 support.
|
||||||
|
err = __wasi_args_get((uint8_t **)argv, (uint8_t *)argv_buf);
|
||||||
|
if (err != __WASI_ERRNO_SUCCESS) {
|
||||||
|
free(argv_buf);
|
||||||
|
free(argv);
|
||||||
|
_Exit(EX_OSERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call `__main_argc_argv` with the arguments!
|
||||||
|
return __main_argc_argv(argc, argv);
|
||||||
|
}
|
@ -1,55 +1,10 @@
|
|||||||
#include <wasi/api.h>
|
// Old compilers define `__original_main`. If that doesn't exist, we
|
||||||
#include <wasi/libc.h>
|
// get called here. New compilers define `__main_void`. If that doesn't
|
||||||
#include <stdlib.h>
|
// exist, we'll try something else.
|
||||||
#include <sysexits.h>
|
// TODO: Remove this layer when we no longer have to support old compilers.
|
||||||
|
int __main_void(void);
|
||||||
|
|
||||||
// The user's `main` function, expecting arguments.
|
|
||||||
int main(int argc, char *argv[]);
|
|
||||||
|
|
||||||
// If the user's `main` function expects arguments, the compiler won't emit
|
|
||||||
// an `__original_main` function so this version will get linked in, which
|
|
||||||
// initializes the argument data and calls `main`.
|
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
int __original_main(void) {
|
int __original_main(void) {
|
||||||
__wasi_errno_t err;
|
return __main_void();
|
||||||
|
|
||||||
// Get the sizes of the arrays we'll have to create to copy in the args.
|
|
||||||
size_t argv_buf_size;
|
|
||||||
size_t argc;
|
|
||||||
err = __wasi_args_sizes_get(&argc, &argv_buf_size);
|
|
||||||
if (err != __WASI_ERRNO_SUCCESS) {
|
|
||||||
_Exit(EX_OSERR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add 1 for the NULL pointer to mark the end, and check for overflow.
|
|
||||||
size_t num_ptrs = argc + 1;
|
|
||||||
if (num_ptrs == 0) {
|
|
||||||
_Exit(EX_SOFTWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allocate memory for storing the argument chars.
|
|
||||||
char *argv_buf = malloc(argv_buf_size);
|
|
||||||
if (argv_buf == NULL) {
|
|
||||||
_Exit(EX_SOFTWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allocate memory for the array of pointers. This uses `calloc` both to
|
|
||||||
// handle overflow and to initialize the NULL pointer at the end.
|
|
||||||
char **argv = calloc(num_ptrs, sizeof(char *));
|
|
||||||
if (argv == NULL) {
|
|
||||||
free(argv_buf);
|
|
||||||
_Exit(EX_SOFTWARE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill the argument chars, and the argv array with pointers into those chars.
|
|
||||||
// TODO: Remove the casts on `argv_ptrs` and `argv_buf` once the witx is updated with char8 support.
|
|
||||||
err = __wasi_args_get((uint8_t **)argv, (uint8_t *)argv_buf);
|
|
||||||
if (err != __WASI_ERRNO_SUCCESS) {
|
|
||||||
free(argv_buf);
|
|
||||||
free(argv);
|
|
||||||
_Exit(EX_OSERR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call main with the arguments!
|
|
||||||
return main(argc, argv);
|
|
||||||
}
|
}
|
||||||
|
@ -3,29 +3,38 @@
|
|||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
#include <wasi/api.h>
|
#include <wasi/api.h>
|
||||||
#include <wasi/libc.h>
|
#include <wasi/libc.h>
|
||||||
|
#include <wasi/libc-environ.h>
|
||||||
|
|
||||||
|
/// If the program doesn't use `environ`, it'll get this version of
|
||||||
|
/// `__wasilibc_environ`, which isn't initialized with a constructor function.
|
||||||
|
/// `getenv` etc. call `__wasilibc_ensure_environ()` before accessing it.
|
||||||
|
/// Statically-initialize it to an invalid pointer value so that we can
|
||||||
|
/// detect if it's been explicitly initialized (we can't use `NULL` because
|
||||||
|
/// `clearenv` sets it to NULL.
|
||||||
|
char **__wasilibc_environ __attribute__((weak)) = (char **)-1;
|
||||||
|
|
||||||
|
// See the comments in libc-environ.h.
|
||||||
|
void __wasilibc_ensure_environ(void) {
|
||||||
|
if (__wasilibc_environ == (char **)-1) {
|
||||||
|
__wasilibc_initialize_environ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Avoid dynamic allocation for the case where there are no environment
|
||||||
|
/// variables, but we still need a non-NULL pointer to an (empty) array.
|
||||||
static char *empty_environ[1] = { NULL };
|
static char *empty_environ[1] = { NULL };
|
||||||
char **__environ = empty_environ;
|
|
||||||
extern __typeof(__environ) _environ __attribute__((weak, alias("__environ")));
|
|
||||||
extern __typeof(__environ) environ __attribute__((weak, alias("__environ")));
|
|
||||||
|
|
||||||
// We define this function here in the same source file as __environ, so that
|
|
||||||
// this function is called in iff environment variable support is used.
|
|
||||||
// Concerning the 50 -- levels up to 100 are reserved for the implementation,
|
|
||||||
// so we an arbitrary number in the middle of the range to allow other
|
|
||||||
// reserved things to go before or after.
|
|
||||||
__attribute__((constructor(50)))
|
|
||||||
static void __wasilibc_populate_environ(void) {
|
|
||||||
__wasi_errno_t err;
|
|
||||||
|
|
||||||
|
// See the comments in libc-environ.h.
|
||||||
|
void __wasilibc_initialize_environ(void) {
|
||||||
// Get the sizes of the arrays we'll have to create to copy in the environment.
|
// Get the sizes of the arrays we'll have to create to copy in the environment.
|
||||||
size_t environ_count;
|
size_t environ_count;
|
||||||
size_t environ_buf_size;
|
size_t environ_buf_size;
|
||||||
err = __wasi_environ_sizes_get(&environ_count, &environ_buf_size);
|
__wasi_errno_t err = __wasi_environ_sizes_get(&environ_count, &environ_buf_size);
|
||||||
if (err != __WASI_ERRNO_SUCCESS) {
|
if (err != __WASI_ERRNO_SUCCESS) {
|
||||||
goto oserr;
|
goto oserr;
|
||||||
}
|
}
|
||||||
if (environ_count == 0) {
|
if (environ_count == 0) {
|
||||||
|
__wasilibc_environ = empty_environ;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +58,8 @@ static void __wasilibc_populate_environ(void) {
|
|||||||
goto software;
|
goto software;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill the environment chars, and the __environ array with pointers into those chars.
|
// Fill the environment chars, and the `__wasilibc_environ` array with
|
||||||
|
// pointers into those chars.
|
||||||
// TODO: Remove the casts on `environ_ptrs` and `environ_buf` once the witx is updated with char8 support.
|
// TODO: Remove the casts on `environ_ptrs` and `environ_buf` once the witx is updated with char8 support.
|
||||||
err = __wasi_environ_get((uint8_t **)environ_ptrs, (uint8_t *)environ_buf);
|
err = __wasi_environ_get((uint8_t **)environ_ptrs, (uint8_t *)environ_buf);
|
||||||
if (err != __WASI_ERRNO_SUCCESS) {
|
if (err != __WASI_ERRNO_SUCCESS) {
|
||||||
@ -58,7 +68,7 @@ static void __wasilibc_populate_environ(void) {
|
|||||||
goto oserr;
|
goto oserr;
|
||||||
}
|
}
|
||||||
|
|
||||||
__environ = environ_ptrs;
|
__wasilibc_environ = environ_ptrs;
|
||||||
return;
|
return;
|
||||||
oserr:
|
oserr:
|
||||||
_Exit(EX_OSERR);
|
_Exit(EX_OSERR);
|
26
libc-bottom-half/sources/environ.c
Normal file
26
libc-bottom-half/sources/environ.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sysexits.h>
|
||||||
|
#include <wasi/api.h>
|
||||||
|
#include <wasi/libc.h>
|
||||||
|
#include <wasi/libc-environ.h>
|
||||||
|
|
||||||
|
// If the program does use `environ`, it'll get this version of
|
||||||
|
// `__wasilibc_environ`, which is initialized with a constructor function, so
|
||||||
|
// that it's initialized whenever user code might want to access it.
|
||||||
|
char **__wasilibc_environ;
|
||||||
|
extern __typeof(__wasilibc_environ) _environ
|
||||||
|
__attribute__((weak, alias("__wasilibc_environ")));
|
||||||
|
extern __typeof(__wasilibc_environ) environ
|
||||||
|
__attribute__((weak, alias("__wasilibc_environ")));
|
||||||
|
|
||||||
|
// We define this function here in the same source file as
|
||||||
|
// `__wasilibc_environ`, so that this function is called in iff environment
|
||||||
|
// variable support is used.
|
||||||
|
// Concerning the 50 -- levels up to 100 are reserved for the implementation,
|
||||||
|
// so we an arbitrary number in the middle of the range to allow other
|
||||||
|
// reserved things to go before or after.
|
||||||
|
__attribute__((constructor(50)))
|
||||||
|
static void __wasilibc_initialize_environ_eagerly(void) {
|
||||||
|
__wasilibc_initialize_environ();
|
||||||
|
}
|
@ -13,7 +13,6 @@ Some major known missing areas include:
|
|||||||
- ipc
|
- ipc
|
||||||
- termios
|
- termios
|
||||||
- nss
|
- nss
|
||||||
- environment variables
|
|
||||||
- timezones
|
- timezones
|
||||||
- non-builtin locales
|
- non-builtin locales
|
||||||
- TIOCGWINSZ (because cloudabi lacks it; affects isatty, line buffering for stdout)
|
- TIOCGWINSZ (because cloudabi lacks it; affects isatty, line buffering for stdout)
|
||||||
|
@ -1,121 +0,0 @@
|
|||||||
Creative Commons Legal Code
|
|
||||||
|
|
||||||
CC0 1.0 Universal
|
|
||||||
|
|
||||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
||||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
||||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
||||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
||||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
||||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
||||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
||||||
HEREUNDER.
|
|
||||||
|
|
||||||
Statement of Purpose
|
|
||||||
|
|
||||||
The laws of most jurisdictions throughout the world automatically confer
|
|
||||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
||||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
||||||
authorship and/or a database (each, a "Work").
|
|
||||||
|
|
||||||
Certain owners wish to permanently relinquish those rights to a Work for
|
|
||||||
the purpose of contributing to a commons of creative, cultural and
|
|
||||||
scientific works ("Commons") that the public can reliably and without fear
|
|
||||||
of later claims of infringement build upon, modify, incorporate in other
|
|
||||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
||||||
and for any purposes, including without limitation commercial purposes.
|
|
||||||
These owners may contribute to the Commons to promote the ideal of a free
|
|
||||||
culture and the further production of creative, cultural and scientific
|
|
||||||
works, or to gain reputation or greater distribution for their Work in
|
|
||||||
part through the use and efforts of others.
|
|
||||||
|
|
||||||
For these and/or other purposes and motivations, and without any
|
|
||||||
expectation of additional consideration or compensation, the person
|
|
||||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
||||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
||||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
||||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
||||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
||||||
|
|
||||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
||||||
protected by copyright and related or neighboring rights ("Copyright and
|
|
||||||
Related Rights"). Copyright and Related Rights include, but are not
|
|
||||||
limited to, the following:
|
|
||||||
|
|
||||||
i. the right to reproduce, adapt, distribute, perform, display,
|
|
||||||
communicate, and translate a Work;
|
|
||||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
||||||
iii. publicity and privacy rights pertaining to a person's image or
|
|
||||||
likeness depicted in a Work;
|
|
||||||
iv. rights protecting against unfair competition in regards to a Work,
|
|
||||||
subject to the limitations in paragraph 4(a), below;
|
|
||||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
||||||
in a Work;
|
|
||||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
||||||
European Parliament and of the Council of 11 March 1996 on the legal
|
|
||||||
protection of databases, and under any national implementation
|
|
||||||
thereof, including any amended or successor version of such
|
|
||||||
directive); and
|
|
||||||
vii. other similar, equivalent or corresponding rights throughout the
|
|
||||||
world based on applicable law or treaty, and any national
|
|
||||||
implementations thereof.
|
|
||||||
|
|
||||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
||||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
||||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
||||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
||||||
of action, whether now known or unknown (including existing as well as
|
|
||||||
future claims and causes of action), in the Work (i) in all territories
|
|
||||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
||||||
treaty (including future time extensions), (iii) in any current or future
|
|
||||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
||||||
including without limitation commercial, advertising or promotional
|
|
||||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
||||||
member of the public at large and to the detriment of Affirmer's heirs and
|
|
||||||
successors, fully intending that such Waiver shall not be subject to
|
|
||||||
revocation, rescission, cancellation, termination, or any other legal or
|
|
||||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
||||||
as contemplated by Affirmer's express Statement of Purpose.
|
|
||||||
|
|
||||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
||||||
be judged legally invalid or ineffective under applicable law, then the
|
|
||||||
Waiver shall be preserved to the maximum extent permitted taking into
|
|
||||||
account Affirmer's express Statement of Purpose. In addition, to the
|
|
||||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
||||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
||||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
||||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
||||||
maximum duration provided by applicable law or treaty (including future
|
|
||||||
time extensions), (iii) in any current or future medium and for any number
|
|
||||||
of copies, and (iv) for any purpose whatsoever, including without
|
|
||||||
limitation commercial, advertising or promotional purposes (the
|
|
||||||
"License"). The License shall be deemed effective as of the date CC0 was
|
|
||||||
applied by Affirmer to the Work. Should any part of the License for any
|
|
||||||
reason be judged legally invalid or ineffective under applicable law, such
|
|
||||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
||||||
of the License, and in such case Affirmer hereby affirms that he or she
|
|
||||||
will not (i) exercise any of his or her remaining Copyright and Related
|
|
||||||
Rights in the Work or (ii) assert any associated claims and causes of
|
|
||||||
action with respect to the Work, in either case contrary to Affirmer's
|
|
||||||
express Statement of Purpose.
|
|
||||||
|
|
||||||
4. Limitations and Disclaimers.
|
|
||||||
|
|
||||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
||||||
surrendered, licensed or otherwise affected by this document.
|
|
||||||
b. Affirmer offers the Work as-is and makes no representations or
|
|
||||||
warranties of any kind concerning the Work, express, implied,
|
|
||||||
statutory or otherwise, including without limitation warranties of
|
|
||||||
title, merchantability, fitness for a particular purpose, non
|
|
||||||
infringement, or the absence of latent or other defects, accuracy, or
|
|
||||||
the present or absence of errors, whether or not discoverable, all to
|
|
||||||
the greatest extent permissible under applicable law.
|
|
||||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
||||||
that may apply to the Work or any use thereof, including without
|
|
||||||
limitation any person's Copyright and Related Rights in the Work.
|
|
||||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
||||||
consents, permissions or other rights required for any use of the
|
|
||||||
Work.
|
|
||||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
||||||
party to this document and has no duty or obligation with respect to
|
|
||||||
this CC0 or use of the Work.
|
|
12
libc-top-half/headers/private/wasi/libc-environ-compat.h
Normal file
12
libc-top-half/headers/private/wasi/libc-environ-compat.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// This header file is meant to be included withinin the body of a function
|
||||||
|
// which uses `__environ`. Code using `__environ` expects it will be initialized
|
||||||
|
// eagerly. `__wasilibc_environ` is initialized lazily. Provide `__environ` as
|
||||||
|
// an alias and arrange for the lazy initialization to be performed.
|
||||||
|
|
||||||
|
extern char **__wasilibc_environ;
|
||||||
|
|
||||||
|
__wasilibc_ensure_environ();
|
||||||
|
|
||||||
|
#ifndef __wasilibc_environ
|
||||||
|
#define __environ __wasilibc_environ
|
||||||
|
#endif
|
1
libc-top-half/musl/.mailmap
Normal file
1
libc-top-half/musl/.mailmap
Normal file
@ -0,0 +1 @@
|
|||||||
|
Ada Worcester <oss@ada.pikhq.com> <josiahw@gmail.com>
|
@ -1,7 +1,7 @@
|
|||||||
musl as a whole is licensed under the following standard MIT license:
|
musl as a whole is licensed under the following standard MIT license:
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Copyright © 2005-2019 Rich Felker, et al.
|
Copyright © 2005-2020 Rich Felker, et al.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
@ -26,6 +26,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
Authors/contributors include:
|
Authors/contributors include:
|
||||||
|
|
||||||
A. Wilcox
|
A. Wilcox
|
||||||
|
Ada Worcester
|
||||||
Alex Dowad
|
Alex Dowad
|
||||||
Alex Suykov
|
Alex Suykov
|
||||||
Alexander Monakov
|
Alexander Monakov
|
||||||
@ -65,7 +66,6 @@ Jeremy Huntwork
|
|||||||
Jo-Philipp Wich
|
Jo-Philipp Wich
|
||||||
Joakim Sindholt
|
Joakim Sindholt
|
||||||
John Spencer
|
John Spencer
|
||||||
Josiah Worcester
|
|
||||||
Julien Ramseier
|
Julien Ramseier
|
||||||
Justin Cormack
|
Justin Cormack
|
||||||
Kaarle Ritvanen
|
Kaarle Ritvanen
|
||||||
@ -122,7 +122,8 @@ Copyright © 1993,2004 Sun Microsystems or
|
|||||||
Copyright © 2003-2011 David Schultz or
|
Copyright © 2003-2011 David Schultz or
|
||||||
Copyright © 2003-2009 Steven G. Kargl or
|
Copyright © 2003-2009 Steven G. Kargl or
|
||||||
Copyright © 2003-2009 Bruce D. Evans or
|
Copyright © 2003-2009 Bruce D. Evans or
|
||||||
Copyright © 2008 Stephen L. Moshier
|
Copyright © 2008 Stephen L. Moshier or
|
||||||
|
Copyright © 2017-2018 Arm Limited
|
||||||
and labelled as such in comments in the individual source files. All
|
and labelled as such in comments in the individual source files. All
|
||||||
have been licensed under extremely permissive terms.
|
have been licensed under extremely permissive terms.
|
||||||
|
|
||||||
|
@ -55,12 +55,13 @@ and ABI combinations:
|
|||||||
* Little-endian default; big-endian variants also supported
|
* Little-endian default; big-endian variants also supported
|
||||||
|
|
||||||
* MIPS
|
* MIPS
|
||||||
* ABI is o32
|
* ABI is o32, fp32/fpxx (except on r6 which is fp64)
|
||||||
* Big-endian default; little-endian variants also supported
|
* Big-endian default; little-endian variants also supported
|
||||||
* Default ABI variant uses FPU registers; alternate soft-float ABI
|
* Default ABI variant uses FPU registers; alternate soft-float ABI
|
||||||
that does not use FPU registers or instructions is available
|
that does not use FPU registers or instructions is available
|
||||||
* MIPS2 or later, or kernel emulation of ll/sc (standard in Linux)
|
* MIPS2 or later, or kernel emulation of ll/sc (standard in Linux)
|
||||||
is required
|
is required
|
||||||
|
* MIPS32r6, an incompatible ISA, is supported as a variant "mipsr6"
|
||||||
|
|
||||||
* MIPS64
|
* MIPS64
|
||||||
* ABI is n64 (LP64) or n32 (ILP32)
|
* ABI is n64 (LP64) or n32 (ILP32)
|
||||||
|
@ -17,7 +17,7 @@ includedir = $(prefix)/include
|
|||||||
libdir = $(prefix)/lib
|
libdir = $(prefix)/lib
|
||||||
syslibdir = /lib
|
syslibdir = /lib
|
||||||
|
|
||||||
SRC_DIRS = $(addprefix $(srcdir)/,src/* crt ldso)
|
SRC_DIRS = $(addprefix $(srcdir)/,src/* crt ldso $(COMPAT_SRC_DIRS))
|
||||||
BASE_GLOBS = $(addsuffix /*.c,$(SRC_DIRS))
|
BASE_GLOBS = $(addsuffix /*.c,$(SRC_DIRS))
|
||||||
ARCH_GLOBS = $(addsuffix /$(ARCH)/*.[csS],$(SRC_DIRS))
|
ARCH_GLOBS = $(addsuffix /$(ARCH)/*.[csS],$(SRC_DIRS))
|
||||||
BASE_SRCS = $(sort $(wildcard $(BASE_GLOBS)))
|
BASE_SRCS = $(sort $(wildcard $(BASE_GLOBS)))
|
||||||
@ -27,7 +27,7 @@ ARCH_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(ARCH_SRCS)))
|
|||||||
REPLACED_OBJS = $(sort $(subst /$(ARCH)/,/,$(ARCH_OBJS)))
|
REPLACED_OBJS = $(sort $(subst /$(ARCH)/,/,$(ARCH_OBJS)))
|
||||||
ALL_OBJS = $(addprefix obj/, $(filter-out $(REPLACED_OBJS), $(sort $(BASE_OBJS) $(ARCH_OBJS))))
|
ALL_OBJS = $(addprefix obj/, $(filter-out $(REPLACED_OBJS), $(sort $(BASE_OBJS) $(ARCH_OBJS))))
|
||||||
|
|
||||||
LIBC_OBJS = $(filter obj/src/%,$(ALL_OBJS))
|
LIBC_OBJS = $(filter obj/src/%,$(ALL_OBJS)) $(filter obj/compat/%,$(ALL_OBJS))
|
||||||
LDSO_OBJS = $(filter obj/ldso/%,$(ALL_OBJS:%.o=%.lo))
|
LDSO_OBJS = $(filter obj/ldso/%,$(ALL_OBJS:%.o=%.lo))
|
||||||
CRT_OBJS = $(filter obj/crt/%,$(ALL_OBJS))
|
CRT_OBJS = $(filter obj/crt/%,$(ALL_OBJS))
|
||||||
|
|
||||||
@ -75,6 +75,7 @@ WRAPCC_CLANG = clang
|
|||||||
LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH)$(SUBARCH).so.1
|
LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH)$(SUBARCH).so.1
|
||||||
|
|
||||||
-include config.mak
|
-include config.mak
|
||||||
|
-include $(srcdir)/arch/$(ARCH)/arch.mak
|
||||||
|
|
||||||
ifeq ($(ARCH),)
|
ifeq ($(ARCH),)
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
1.1.23
|
1.2.0
|
||||||
|
@ -2115,3 +2115,88 @@ arch-specfic bugs fixed:
|
|||||||
- passing of 64-bit syscall arguments was broken on microblaze
|
- passing of 64-bit syscall arguments was broken on microblaze
|
||||||
- posix_fadvise was broken on mips due to missing 7-arg syscall support
|
- posix_fadvise was broken on mips due to missing 7-arg syscall support
|
||||||
- vrregset_t layout and member naming was wrong on powerpc64
|
- vrregset_t layout and member naming was wrong on powerpc64
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1.1.24 release notes
|
||||||
|
|
||||||
|
new features:
|
||||||
|
- GLOB_TILDE extension to glob
|
||||||
|
- non-stub catgets localization API, using netbsd binary catalog format
|
||||||
|
- posix_spawn file actions for [f]chdir (extension, pending future standard)
|
||||||
|
- secure_getenv function (extension)
|
||||||
|
- copy_file_range syscall wrapper (Linux extension)
|
||||||
|
- header-level support for new linux features in 5.2
|
||||||
|
|
||||||
|
performance:
|
||||||
|
- new fast path for lrint (generic C version) on 32-bit archs
|
||||||
|
|
||||||
|
major internal changes:
|
||||||
|
- functions involving time are overhauled to be time64-ready in 32-bit archs
|
||||||
|
- x32 uses the new time64 code paths to replace nasty hacks in syscall glue
|
||||||
|
|
||||||
|
compatibility & conformance:
|
||||||
|
- support for powerpc[64] unaligned relocation types
|
||||||
|
- powerpc[64] and sh sys/user.h no longer clash with kernel asm/ptrace.h
|
||||||
|
- select no longer modifies timeout on failure (or at all)
|
||||||
|
- mips64 stat results are no longer limited to 32-bit time range
|
||||||
|
- optreset (BSD extension) now has a public declaration
|
||||||
|
- support for clang inconsistencies in wchar_t type vs some 32-bit archs
|
||||||
|
- mips r6 syscall asm no longer has invalid lo/hi register clobbers
|
||||||
|
- vestigial asm declarations of __tls_get_new are removed (broke some tooling)
|
||||||
|
- riscv64 mcontext_t mismatch glibc's member naming is corrected
|
||||||
|
|
||||||
|
bugs fixed:
|
||||||
|
- glob failed to match broken symlinks consistently
|
||||||
|
- invalid use of interposed calloc to allocate initial TLS
|
||||||
|
- various dlsym symbol resolution logic errors
|
||||||
|
- semctl with SEM_STAT_ANY didn't work
|
||||||
|
- pthread_create with explicit scheduling was subject to priority inversion
|
||||||
|
- pthread_create failure path had data race for thread count
|
||||||
|
- timer_create with SIGEV_THREAD notification had data race getting timer id
|
||||||
|
- wide printf family failed to support l modifier for float formats
|
||||||
|
|
||||||
|
arch-specific bugs fixed:
|
||||||
|
- x87 floating point stack imbalance in math asm (i386-only CVE-2019-14697)
|
||||||
|
- x32 clock_adjtime, getrusage, wait3, wait4 produced junk (struct mismatches)
|
||||||
|
- lseek broken on x32 and mipsn32 with large file offsets
|
||||||
|
- riscv64 atomics weren't compiler barriers
|
||||||
|
- riscv64 atomics had broken asm constraints (missing earlyclobber flag)
|
||||||
|
- arm clone() was broken when compiled as thumb if start function returned
|
||||||
|
- mipsr6 setjmp/longjmp did not preserve fpu register state correctly
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1.2.0 release notes
|
||||||
|
|
||||||
|
new features:
|
||||||
|
- time_t is now 64-bit on all archs (not just 64-bit archs)
|
||||||
|
- character type & case mapping data updated to Unicode 12.1.0
|
||||||
|
- header-level support for new linux features in 5.3 and 5.4
|
||||||
|
|
||||||
|
performance:
|
||||||
|
- new O(1) wchar_t case mapping implementation
|
||||||
|
- i386 now uses C math code for exp, faster than old asm
|
||||||
|
- mips math asm
|
||||||
|
|
||||||
|
compatibility & conformance:
|
||||||
|
- endian.h now aims to conform to future POSIX definition
|
||||||
|
- support older compilers that don't accept powerpc math asm constraints
|
||||||
|
- fdpic code in ldso was incompatible with valid optimizations in gcc 9+
|
||||||
|
- RLIMIT_RTTIME was missing from sys/resource.h
|
||||||
|
|
||||||
|
bugs fixed:
|
||||||
|
- wcwidth wrongly returned 0 for most of planes 4 and up
|
||||||
|
- missing case mapping between U+03F3 and U+037F
|
||||||
|
- wrong cacosh results for arguments with negative imaginary part
|
||||||
|
- wrong catanf/catanl results for various classes of arguments
|
||||||
|
- wrong return value for ungetc with argument outside [0,UCHAR_MAX]
|
||||||
|
- posix_openpt with no ptys available produced wrong errno
|
||||||
|
|
||||||
|
arch-specific bugs fixed:
|
||||||
|
- sigcontext/regset definition mistakes & omissions on m68k, powerpc64
|
||||||
|
- fesetenv(FE_DFL_ENV) crashed on riscv64
|
||||||
|
- sh2 dynamic linker was broken since 1.1.21 (crash in stage 2b)
|
||||||
|
- arm dynamic linker chose wrong tls/atomic variants since 1.1.21
|
||||||
|
- some math library functions returned excess precision on i386
|
||||||
|
- unconfirmed regression in fchmodat AT_SYMLINK_NOFOLLOW on mips*
|
||||||
|
@ -2,8 +2,13 @@
|
|||||||
#define _Int64 long
|
#define _Int64 long
|
||||||
#define _Reg long
|
#define _Reg long
|
||||||
|
|
||||||
TYPEDEF __builtin_va_list va_list;
|
#if __AARCH64EB__
|
||||||
TYPEDEF __builtin_va_list __isoc_va_list;
|
#define __BYTE_ORDER 4321
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __LONG_MAX 0x7fffffffffffffffL
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF unsigned wchar_t;
|
TYPEDEF unsigned wchar_t;
|
||||||
@ -17,14 +22,3 @@ TYPEDEF float float_t;
|
|||||||
TYPEDEF double double_t;
|
TYPEDEF double double_t;
|
||||||
|
|
||||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||||
|
|
||||||
TYPEDEF long time_t;
|
|
||||||
TYPEDEF long suseconds_t;
|
|
||||||
|
|
||||||
TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
|
|
||||||
TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
|
|
||||||
TYPEDEF struct { union { int __i[10]; volatile int __vi[10]; volatile void *volatile __p[5]; } __u; } mtx_t;
|
|
||||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } pthread_cond_t;
|
|
||||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[6]; } __u; } cnd_t;
|
|
||||||
TYPEDEF struct { union { int __i[14]; volatile int __vi[14]; void *__p[7]; } __u; } pthread_rwlock_t;
|
|
||||||
TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[4]; } __u; } pthread_barrier_t;
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if __AARCH64EB__
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#endif
|
|
@ -30,3 +30,11 @@
|
|||||||
#define HWCAP_SB (1 << 29)
|
#define HWCAP_SB (1 << 29)
|
||||||
#define HWCAP_PACA (1 << 30)
|
#define HWCAP_PACA (1 << 30)
|
||||||
#define HWCAP_PACG (1UL << 31)
|
#define HWCAP_PACG (1UL << 31)
|
||||||
|
|
||||||
|
#define HWCAP2_DCPODP (1 << 0)
|
||||||
|
#define HWCAP2_SVE2 (1 << 1)
|
||||||
|
#define HWCAP2_SVEAES (1 << 2)
|
||||||
|
#define HWCAP2_SVEPMULL (1 << 3)
|
||||||
|
#define HWCAP2_SVEBITPERM (1 << 4)
|
||||||
|
#define HWCAP2_SVESHA3 (1 << 5)
|
||||||
|
#define HWCAP2_SVESM4 (1 << 6)
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
struct ipc_perm {
|
|
||||||
key_t __ipc_perm_key;
|
|
||||||
uid_t uid;
|
|
||||||
gid_t gid;
|
|
||||||
uid_t cuid;
|
|
||||||
gid_t cgid;
|
|
||||||
mode_t mode;
|
|
||||||
unsigned short __ipc_perm_seq;
|
|
||||||
|
|
||||||
unsigned long __pad1;
|
|
||||||
unsigned long __pad2;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define IPC_64 0
|
|
@ -1,7 +0,0 @@
|
|||||||
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
|
||||||
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
|
||||||
#define LONG_BIT 64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LONG_MAX 0x7fffffffffffffffL
|
|
||||||
#define LLONG_MAX 0x7fffffffffffffffLL
|
|
@ -1,13 +0,0 @@
|
|||||||
struct msqid_ds {
|
|
||||||
struct ipc_perm msg_perm;
|
|
||||||
time_t msg_stime;
|
|
||||||
time_t msg_rtime;
|
|
||||||
time_t msg_ctime;
|
|
||||||
unsigned long msg_cbytes;
|
|
||||||
msgqnum_t msg_qnum;
|
|
||||||
msglen_t msg_qbytes;
|
|
||||||
pid_t msg_lspid;
|
|
||||||
pid_t msg_lrpid;
|
|
||||||
unsigned long __pad1;
|
|
||||||
unsigned long __pad2;
|
|
||||||
};
|
|
@ -1,14 +0,0 @@
|
|||||||
struct semid_ds {
|
|
||||||
struct ipc_perm sem_perm;
|
|
||||||
time_t sem_otime;
|
|
||||||
time_t sem_ctime;
|
|
||||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
||||||
unsigned short sem_nsems;
|
|
||||||
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
|
|
||||||
#else
|
|
||||||
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
|
|
||||||
unsigned short sem_nsems;
|
|
||||||
#endif
|
|
||||||
time_t __unused3;
|
|
||||||
time_t __unused4;
|
|
||||||
};
|
|
@ -1,33 +0,0 @@
|
|||||||
#include <endian.h>
|
|
||||||
|
|
||||||
struct msghdr {
|
|
||||||
void *msg_name;
|
|
||||||
socklen_t msg_namelen;
|
|
||||||
struct iovec *msg_iov;
|
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
int __pad1, msg_iovlen;
|
|
||||||
#else
|
|
||||||
int msg_iovlen, __pad1;
|
|
||||||
#endif
|
|
||||||
void *msg_control;
|
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
int __pad2;
|
|
||||||
socklen_t msg_controllen;
|
|
||||||
#else
|
|
||||||
socklen_t msg_controllen;
|
|
||||||
int __pad2;
|
|
||||||
#endif
|
|
||||||
int msg_flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmsghdr {
|
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
||||||
int __pad1;
|
|
||||||
socklen_t cmsg_len;
|
|
||||||
#else
|
|
||||||
socklen_t cmsg_len;
|
|
||||||
int __pad1;
|
|
||||||
#endif
|
|
||||||
int cmsg_level;
|
|
||||||
int cmsg_type;
|
|
||||||
};
|
|
@ -281,4 +281,12 @@
|
|||||||
#define __NR_io_uring_setup 425
|
#define __NR_io_uring_setup 425
|
||||||
#define __NR_io_uring_enter 426
|
#define __NR_io_uring_enter 426
|
||||||
#define __NR_io_uring_register 427
|
#define __NR_io_uring_register 427
|
||||||
|
#define __NR_open_tree 428
|
||||||
|
#define __NR_move_mount 429
|
||||||
|
#define __NR_fsopen 430
|
||||||
|
#define __NR_fsconfig 431
|
||||||
|
#define __NR_fsmount 432
|
||||||
|
#define __NR_fspick 433
|
||||||
|
#define __NR_pidfd_open 434
|
||||||
|
#define __NR_clone3 435
|
||||||
|
|
||||||
|
21
libc-top-half/musl/arch/aarch64/kstat.h
Normal file
21
libc-top-half/musl/arch/aarch64/kstat.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
struct kstat {
|
||||||
|
dev_t st_dev;
|
||||||
|
ino_t st_ino;
|
||||||
|
mode_t st_mode;
|
||||||
|
nlink_t st_nlink;
|
||||||
|
uid_t st_uid;
|
||||||
|
gid_t st_gid;
|
||||||
|
dev_t st_rdev;
|
||||||
|
unsigned long __pad;
|
||||||
|
off_t st_size;
|
||||||
|
blksize_t st_blksize;
|
||||||
|
int __pad2;
|
||||||
|
blkcnt_t st_blocks;
|
||||||
|
long st_atime_sec;
|
||||||
|
long st_atime_nsec;
|
||||||
|
long st_mtime_sec;
|
||||||
|
long st_mtime_nsec;
|
||||||
|
long st_ctime_sec;
|
||||||
|
long st_ctime_nsec;
|
||||||
|
unsigned __unused[2];
|
||||||
|
};
|
@ -1,5 +1,3 @@
|
|||||||
#include <endian.h>
|
|
||||||
|
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
#define ENDIAN_SUFFIX "_be"
|
#define ENDIAN_SUFFIX "_be"
|
||||||
#else
|
#else
|
||||||
|
@ -74,3 +74,5 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
|
|||||||
#define VDSO_USEFUL
|
#define VDSO_USEFUL
|
||||||
#define VDSO_CGT_SYM "__kernel_clock_gettime"
|
#define VDSO_CGT_SYM "__kernel_clock_gettime"
|
||||||
#define VDSO_CGT_VER "LINUX_2.6.39"
|
#define VDSO_CGT_VER "LINUX_2.6.39"
|
||||||
|
|
||||||
|
#define IPC_64 0
|
||||||
|
1
libc-top-half/musl/arch/arm/arch.mak
Normal file
1
libc-top-half/musl/arch/arm/arch.mak
Normal file
@ -0,0 +1 @@
|
|||||||
|
COMPAT_SRC_DIRS = compat/time32
|
@ -1,9 +1,15 @@
|
|||||||
|
#define _REDIR_TIME64 1
|
||||||
#define _Addr int
|
#define _Addr int
|
||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
TYPEDEF __builtin_va_list va_list;
|
#if __ARMEB__
|
||||||
TYPEDEF __builtin_va_list __isoc_va_list;
|
#define __BYTE_ORDER 4321
|
||||||
|
#else
|
||||||
|
#define __BYTE_ORDER 1234
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __LONG_MAX 0x7fffffffL
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
TYPEDEF unsigned wchar_t;
|
TYPEDEF unsigned wchar_t;
|
||||||
@ -13,14 +19,3 @@ TYPEDEF float float_t;
|
|||||||
TYPEDEF double double_t;
|
TYPEDEF double double_t;
|
||||||
|
|
||||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||||
|
|
||||||
TYPEDEF long time_t;
|
|
||||||
TYPEDEF long suseconds_t;
|
|
||||||
|
|
||||||
TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
|
|
||||||
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
|
|
||||||
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
|
|
||||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
|
|
||||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
|
|
||||||
TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
|
|
||||||
TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#if __ARMEB__
|
|
||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
||||||
#else
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
#endif
|
|
1
libc-top-half/musl/arch/arm/bits/ipcstat.h
Normal file
1
libc-top-half/musl/arch/arm/bits/ipcstat.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define IPC_STAT 0x102
|
@ -1,7 +0,0 @@
|
|||||||
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
|
||||||
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
|
||||||
#define LONG_BIT 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LONG_MAX 0x7fffffffL
|
|
||||||
#define LLONG_MAX 0x7fffffffffffffffLL
|
|
@ -1,12 +1,18 @@
|
|||||||
struct msqid_ds {
|
struct msqid_ds {
|
||||||
struct ipc_perm msg_perm;
|
struct ipc_perm msg_perm;
|
||||||
time_t msg_stime;
|
unsigned long __msg_stime_lo;
|
||||||
time_t msg_rtime;
|
unsigned long __msg_stime_hi;
|
||||||
time_t msg_ctime;
|
unsigned long __msg_rtime_lo;
|
||||||
|
unsigned long __msg_rtime_hi;
|
||||||
|
unsigned long __msg_ctime_lo;
|
||||||
|
unsigned long __msg_ctime_hi;
|
||||||
unsigned long msg_cbytes;
|
unsigned long msg_cbytes;
|
||||||
msgqnum_t msg_qnum;
|
msgqnum_t msg_qnum;
|
||||||
msglen_t msg_qbytes;
|
msglen_t msg_qbytes;
|
||||||
pid_t msg_lspid;
|
pid_t msg_lspid;
|
||||||
pid_t msg_lrpid;
|
pid_t msg_lrpid;
|
||||||
unsigned long __unused[2];
|
unsigned long __unused[2];
|
||||||
|
time_t msg_stime;
|
||||||
|
time_t msg_rtime;
|
||||||
|
time_t msg_ctime;
|
||||||
};
|
};
|
18
libc-top-half/musl/arch/arm/bits/sem.h
Normal file
18
libc-top-half/musl/arch/arm/bits/sem.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
struct semid_ds {
|
||||||
|
struct ipc_perm sem_perm;
|
||||||
|
unsigned long __sem_otime_lo;
|
||||||
|
unsigned long __sem_otime_hi;
|
||||||
|
unsigned long __sem_ctime_lo;
|
||||||
|
unsigned long __sem_ctime_hi;
|
||||||
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
|
unsigned short sem_nsems;
|
||||||
|
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
|
||||||
|
#else
|
||||||
|
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
|
||||||
|
unsigned short sem_nsems;
|
||||||
|
#endif
|
||||||
|
long __unused3;
|
||||||
|
long __unused4;
|
||||||
|
time_t sem_otime;
|
||||||
|
time_t sem_ctime;
|
||||||
|
};
|
@ -3,14 +3,21 @@
|
|||||||
struct shmid_ds {
|
struct shmid_ds {
|
||||||
struct ipc_perm shm_perm;
|
struct ipc_perm shm_perm;
|
||||||
size_t shm_segsz;
|
size_t shm_segsz;
|
||||||
time_t shm_atime;
|
unsigned long __shm_atime_lo;
|
||||||
time_t shm_dtime;
|
unsigned long __shm_atime_hi;
|
||||||
time_t shm_ctime;
|
unsigned long __shm_dtime_lo;
|
||||||
|
unsigned long __shm_dtime_hi;
|
||||||
|
unsigned long __shm_ctime_lo;
|
||||||
|
unsigned long __shm_ctime_hi;
|
||||||
pid_t shm_cpid;
|
pid_t shm_cpid;
|
||||||
pid_t shm_lpid;
|
pid_t shm_lpid;
|
||||||
unsigned long shm_nattch;
|
unsigned long shm_nattch;
|
||||||
unsigned long __pad1;
|
unsigned long __pad1;
|
||||||
unsigned long __pad2;
|
unsigned long __pad2;
|
||||||
|
unsigned long __pad3;
|
||||||
|
time_t shm_atime;
|
||||||
|
time_t shm_dtime;
|
||||||
|
time_t shm_ctime;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct shminfo {
|
struct shminfo {
|
@ -14,8 +14,12 @@ struct stat {
|
|||||||
off_t st_size;
|
off_t st_size;
|
||||||
blksize_t st_blksize;
|
blksize_t st_blksize;
|
||||||
blkcnt_t st_blocks;
|
blkcnt_t st_blocks;
|
||||||
|
struct {
|
||||||
|
long tv_sec;
|
||||||
|
long tv_nsec;
|
||||||
|
} __st_atim32, __st_mtim32, __st_ctim32;
|
||||||
|
ino_t st_ino;
|
||||||
struct timespec st_atim;
|
struct timespec st_atim;
|
||||||
struct timespec st_mtim;
|
struct timespec st_mtim;
|
||||||
struct timespec st_ctim;
|
struct timespec st_ctim;
|
||||||
ino_t st_ino;
|
|
||||||
};
|
};
|
||||||
|
@ -55,8 +55,8 @@
|
|||||||
#define __NR_sethostname 74
|
#define __NR_sethostname 74
|
||||||
#define __NR_setrlimit 75
|
#define __NR_setrlimit 75
|
||||||
#define __NR_getrusage 77
|
#define __NR_getrusage 77
|
||||||
#define __NR_gettimeofday 78
|
#define __NR_gettimeofday_time32 78
|
||||||
#define __NR_settimeofday 79
|
#define __NR_settimeofday_time32 79
|
||||||
#define __NR_getgroups 80
|
#define __NR_getgroups 80
|
||||||
#define __NR_setgroups 81
|
#define __NR_setgroups 81
|
||||||
#define __NR_symlink 83
|
#define __NR_symlink 83
|
||||||
@ -211,14 +211,14 @@
|
|||||||
#define __NR_remap_file_pages 253
|
#define __NR_remap_file_pages 253
|
||||||
#define __NR_set_tid_address 256
|
#define __NR_set_tid_address 256
|
||||||
#define __NR_timer_create 257
|
#define __NR_timer_create 257
|
||||||
#define __NR_timer_settime 258
|
#define __NR_timer_settime32 258
|
||||||
#define __NR_timer_gettime 259
|
#define __NR_timer_gettime32 259
|
||||||
#define __NR_timer_getoverrun 260
|
#define __NR_timer_getoverrun 260
|
||||||
#define __NR_timer_delete 261
|
#define __NR_timer_delete 261
|
||||||
#define __NR_clock_settime 262
|
#define __NR_clock_settime32 262
|
||||||
#define __NR_clock_gettime 263
|
#define __NR_clock_gettime32 263
|
||||||
#define __NR_clock_getres 264
|
#define __NR_clock_getres_time32 264
|
||||||
#define __NR_clock_nanosleep 265
|
#define __NR_clock_nanosleep_time32 265
|
||||||
#define __NR_statfs64 266
|
#define __NR_statfs64 266
|
||||||
#define __NR_fstatfs64 267
|
#define __NR_fstatfs64 267
|
||||||
#define __NR_tgkill 268
|
#define __NR_tgkill 268
|
||||||
@ -308,8 +308,8 @@
|
|||||||
#define __NR_timerfd_create 350
|
#define __NR_timerfd_create 350
|
||||||
#define __NR_eventfd 351
|
#define __NR_eventfd 351
|
||||||
#define __NR_fallocate 352
|
#define __NR_fallocate 352
|
||||||
#define __NR_timerfd_settime 353
|
#define __NR_timerfd_settime32 353
|
||||||
#define __NR_timerfd_gettime 354
|
#define __NR_timerfd_gettime32 354
|
||||||
#define __NR_signalfd4 355
|
#define __NR_signalfd4 355
|
||||||
#define __NR_eventfd2 356
|
#define __NR_eventfd2 356
|
||||||
#define __NR_epoll_create1 357
|
#define __NR_epoll_create1 357
|
||||||
@ -381,6 +381,14 @@
|
|||||||
#define __NR_io_uring_setup 425
|
#define __NR_io_uring_setup 425
|
||||||
#define __NR_io_uring_enter 426
|
#define __NR_io_uring_enter 426
|
||||||
#define __NR_io_uring_register 427
|
#define __NR_io_uring_register 427
|
||||||
|
#define __NR_open_tree 428
|
||||||
|
#define __NR_move_mount 429
|
||||||
|
#define __NR_fsopen 430
|
||||||
|
#define __NR_fsconfig 431
|
||||||
|
#define __NR_fsmount 432
|
||||||
|
#define __NR_fspick 433
|
||||||
|
#define __NR_pidfd_open 434
|
||||||
|
#define __NR_clone3 435
|
||||||
|
|
||||||
#define __ARM_NR_breakpoint 0x0f0001
|
#define __ARM_NR_breakpoint 0x0f0001
|
||||||
#define __ARM_NR_cacheflush 0x0f0002
|
#define __ARM_NR_cacheflush 0x0f0002
|
||||||
|
21
libc-top-half/musl/arch/arm/kstat.h
Normal file
21
libc-top-half/musl/arch/arm/kstat.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
struct kstat {
|
||||||
|
dev_t st_dev;
|
||||||
|
int __st_dev_padding;
|
||||||
|
long __st_ino_truncated;
|
||||||
|
mode_t st_mode;
|
||||||
|
nlink_t st_nlink;
|
||||||
|
uid_t st_uid;
|
||||||
|
gid_t st_gid;
|
||||||
|
dev_t st_rdev;
|
||||||
|
int __st_rdev_padding;
|
||||||
|
off_t st_size;
|
||||||
|
blksize_t st_blksize;
|
||||||
|
blkcnt_t st_blocks;
|
||||||
|
long st_atime_sec;
|
||||||
|
long st_atime_nsec;
|
||||||
|
long st_mtime_sec;
|
||||||
|
long st_mtime_nsec;
|
||||||
|
long st_ctime_sec;
|
||||||
|
long st_ctime_nsec;
|
||||||
|
ino_t st_ino;
|
||||||
|
};
|
@ -1,5 +1,3 @@
|
|||||||
#include <endian.h>
|
|
||||||
|
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
#define ENDIAN_SUFFIX "eb"
|
#define ENDIAN_SUFFIX "eb"
|
||||||
#else
|
#else
|
||||||
|
@ -99,7 +99,9 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define VDSO_USEFUL
|
#define VDSO_USEFUL
|
||||||
#define VDSO_CGT_SYM "__vdso_clock_gettime"
|
#define VDSO_CGT32_SYM "__vdso_clock_gettime"
|
||||||
|
#define VDSO_CGT32_VER "LINUX_2.6"
|
||||||
|
#define VDSO_CGT_SYM "__vdso_clock_gettime64"
|
||||||
#define VDSO_CGT_VER "LINUX_2.6"
|
#define VDSO_CGT_VER "LINUX_2.6"
|
||||||
|
|
||||||
#define SYSCALL_FADVISE_6_ARG
|
#define SYSCALL_FADVISE_6_ARG
|
||||||
|
11
libc-top-half/musl/arch/generic/bits/dirent.h
Normal file
11
libc-top-half/musl/arch/generic/bits/dirent.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#define _DIRENT_HAVE_D_RECLEN
|
||||||
|
#define _DIRENT_HAVE_D_OFF
|
||||||
|
#define _DIRENT_HAVE_D_TYPE
|
||||||
|
|
||||||
|
struct dirent {
|
||||||
|
ino_t d_ino;
|
||||||
|
off_t d_off;
|
||||||
|
unsigned short d_reclen;
|
||||||
|
unsigned char d_type;
|
||||||
|
char d_name[256];
|
||||||
|
};
|
@ -104,7 +104,12 @@
|
|||||||
#define FIOGETOWN 0x8903
|
#define FIOGETOWN 0x8903
|
||||||
#define SIOCGPGRP 0x8904
|
#define SIOCGPGRP 0x8904
|
||||||
#define SIOCATMARK 0x8905
|
#define SIOCATMARK 0x8905
|
||||||
|
#if __LONG_MAX == 0x7fffffff
|
||||||
|
#define SIOCGSTAMP _IOR(0x89, 6, char[16])
|
||||||
|
#define SIOCGSTAMPNS _IOR(0x89, 7, char[16])
|
||||||
|
#else
|
||||||
#define SIOCGSTAMP 0x8906
|
#define SIOCGSTAMP 0x8906
|
||||||
#define SIOCGSTAMPNS 0x8907
|
#define SIOCGSTAMPNS 0x8907
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <bits/ioctl_fix.h>
|
#include <bits/ioctl_fix.h>
|
||||||
|
@ -9,5 +9,3 @@ struct ipc_perm {
|
|||||||
long __pad1;
|
long __pad1;
|
||||||
long __pad2;
|
long __pad2;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IPC_64 0x100
|
|
||||||
|
1
libc-top-half/musl/arch/generic/bits/ipcstat.h
Normal file
1
libc-top-half/musl/arch/generic/bits/ipcstat.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define IPC_STAT 2
|
0
libc-top-half/musl/arch/generic/bits/limits.h
Normal file
0
libc-top-half/musl/arch/generic/bits/limits.h
Normal file
@ -1,11 +1,8 @@
|
|||||||
struct msqid_ds {
|
struct msqid_ds {
|
||||||
struct ipc_perm msg_perm;
|
struct ipc_perm msg_perm;
|
||||||
time_t msg_stime;
|
time_t msg_stime;
|
||||||
int __unused1;
|
|
||||||
time_t msg_rtime;
|
time_t msg_rtime;
|
||||||
int __unused2;
|
|
||||||
time_t msg_ctime;
|
time_t msg_ctime;
|
||||||
int __unused3;
|
|
||||||
unsigned long msg_cbytes;
|
unsigned long msg_cbytes;
|
||||||
msgqnum_t msg_qnum;
|
msgqnum_t msg_qnum;
|
||||||
msglen_t msg_qbytes;
|
msglen_t msg_qbytes;
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
struct semid_ds {
|
struct semid_ds {
|
||||||
struct ipc_perm sem_perm;
|
struct ipc_perm sem_perm;
|
||||||
time_t sem_otime;
|
time_t sem_otime;
|
||||||
time_t __unused1;
|
|
||||||
time_t sem_ctime;
|
time_t sem_ctime;
|
||||||
time_t __unused2;
|
|
||||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
unsigned short sem_nsems;
|
unsigned short sem_nsems;
|
||||||
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
|
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
|
||||||
#else
|
#else
|
||||||
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
|
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
|
||||||
unsigned short sem_nsems;
|
unsigned short sem_nsems;
|
||||||
#endif
|
#endif
|
||||||
time_t __unused3;
|
long __unused3;
|
||||||
time_t __unused4;
|
long __unused4;
|
||||||
};
|
};
|
||||||
|
@ -4,11 +4,8 @@ struct shmid_ds {
|
|||||||
struct ipc_perm shm_perm;
|
struct ipc_perm shm_perm;
|
||||||
size_t shm_segsz;
|
size_t shm_segsz;
|
||||||
time_t shm_atime;
|
time_t shm_atime;
|
||||||
int __unused1;
|
|
||||||
time_t shm_dtime;
|
time_t shm_dtime;
|
||||||
int __unused2;
|
|
||||||
time_t shm_ctime;
|
time_t shm_ctime;
|
||||||
int __unused3;
|
|
||||||
pid_t shm_cpid;
|
pid_t shm_cpid;
|
||||||
pid_t shm_lpid;
|
pid_t shm_lpid;
|
||||||
unsigned long shm_nattch;
|
unsigned long shm_nattch;
|
||||||
@ -25,4 +22,3 @@ struct shm_info {
|
|||||||
unsigned long shm_tot, shm_rss, shm_swp;
|
unsigned long shm_tot, shm_rss, shm_swp;
|
||||||
unsigned long __swap_attempts, __swap_successes;
|
unsigned long __swap_attempts, __swap_successes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
struct msghdr {
|
|
||||||
void *msg_name;
|
|
||||||
socklen_t msg_namelen;
|
|
||||||
struct iovec *msg_iov;
|
|
||||||
int msg_iovlen;
|
|
||||||
void *msg_control;
|
|
||||||
socklen_t msg_controllen;
|
|
||||||
int msg_flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cmsghdr {
|
|
||||||
socklen_t cmsg_len;
|
|
||||||
int cmsg_level;
|
|
||||||
int cmsg_type;
|
|
||||||
};
|
|
1
libc-top-half/musl/arch/i386/arch.mak
Normal file
1
libc-top-half/musl/arch/i386/arch.mak
Normal file
@ -0,0 +1 @@
|
|||||||
|
COMPAT_SRC_DIRS = compat/time32
|
@ -1,14 +1,10 @@
|
|||||||
|
#define _REDIR_TIME64 1
|
||||||
#define _Addr int
|
#define _Addr int
|
||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
#if __GNUC__ >= 3
|
#define __BYTE_ORDER 1234
|
||||||
TYPEDEF __builtin_va_list va_list;
|
#define __LONG_MAX 0x7fffffffL
|
||||||
TYPEDEF __builtin_va_list __isoc_va_list;
|
|
||||||
#else
|
|
||||||
TYPEDEF struct __va_list * va_list;
|
|
||||||
TYPEDEF struct __va_list * __isoc_va_list;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifdef __WCHAR_TYPE__
|
#ifdef __WCHAR_TYPE__
|
||||||
@ -33,14 +29,3 @@ TYPEDEF struct { __attribute__((__aligned__(8))) long long __ll; long double __l
|
|||||||
#else
|
#else
|
||||||
TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t;
|
TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TYPEDEF long time_t;
|
|
||||||
TYPEDEF long suseconds_t;
|
|
||||||
|
|
||||||
TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
|
|
||||||
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
|
|
||||||
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
|
|
||||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
|
|
||||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
|
|
||||||
TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
|
|
||||||
TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
1
libc-top-half/musl/arch/i386/bits/ipcstat.h
Normal file
1
libc-top-half/musl/arch/i386/bits/ipcstat.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define IPC_STAT 0x102
|
@ -1,8 +1 @@
|
|||||||
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
|
||||||
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
|
||||||
#define PAGESIZE 4096
|
#define PAGESIZE 4096
|
||||||
#define LONG_BIT 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LONG_MAX 0x7fffffffL
|
|
||||||
#define LLONG_MAX 0x7fffffffffffffffLL
|
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
struct msqid_ds {
|
struct msqid_ds {
|
||||||
struct ipc_perm msg_perm;
|
struct ipc_perm msg_perm;
|
||||||
time_t msg_stime;
|
unsigned long __msg_stime_lo;
|
||||||
time_t msg_rtime;
|
unsigned long __msg_stime_hi;
|
||||||
time_t msg_ctime;
|
unsigned long __msg_rtime_lo;
|
||||||
|
unsigned long __msg_rtime_hi;
|
||||||
|
unsigned long __msg_ctime_lo;
|
||||||
|
unsigned long __msg_ctime_hi;
|
||||||
unsigned long msg_cbytes;
|
unsigned long msg_cbytes;
|
||||||
msgqnum_t msg_qnum;
|
msgqnum_t msg_qnum;
|
||||||
msglen_t msg_qbytes;
|
msglen_t msg_qbytes;
|
||||||
pid_t msg_lspid;
|
pid_t msg_lspid;
|
||||||
pid_t msg_lrpid;
|
pid_t msg_lrpid;
|
||||||
unsigned long __unused[2];
|
unsigned long __unused[2];
|
||||||
|
time_t msg_stime;
|
||||||
|
time_t msg_rtime;
|
||||||
|
time_t msg_ctime;
|
||||||
};
|
};
|
13
libc-top-half/musl/arch/i386/bits/sem.h
Normal file
13
libc-top-half/musl/arch/i386/bits/sem.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
struct semid_ds {
|
||||||
|
struct ipc_perm sem_perm;
|
||||||
|
unsigned long __sem_otime_lo;
|
||||||
|
unsigned long __sem_otime_hi;
|
||||||
|
unsigned long __sem_ctime_lo;
|
||||||
|
unsigned long __sem_ctime_hi;
|
||||||
|
unsigned short sem_nsems;
|
||||||
|
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
|
||||||
|
long __unused3;
|
||||||
|
long __unused4;
|
||||||
|
time_t sem_otime;
|
||||||
|
time_t sem_ctime;
|
||||||
|
};
|
@ -3,14 +3,21 @@
|
|||||||
struct shmid_ds {
|
struct shmid_ds {
|
||||||
struct ipc_perm shm_perm;
|
struct ipc_perm shm_perm;
|
||||||
size_t shm_segsz;
|
size_t shm_segsz;
|
||||||
time_t shm_atime;
|
unsigned long __shm_atime_lo;
|
||||||
time_t shm_dtime;
|
unsigned long __shm_atime_hi;
|
||||||
time_t shm_ctime;
|
unsigned long __shm_dtime_lo;
|
||||||
|
unsigned long __shm_dtime_hi;
|
||||||
|
unsigned long __shm_ctime_lo;
|
||||||
|
unsigned long __shm_ctime_hi;
|
||||||
pid_t shm_cpid;
|
pid_t shm_cpid;
|
||||||
pid_t shm_lpid;
|
pid_t shm_lpid;
|
||||||
unsigned long shm_nattch;
|
unsigned long shm_nattch;
|
||||||
unsigned long __pad1;
|
unsigned long __pad1;
|
||||||
unsigned long __pad2;
|
unsigned long __pad2;
|
||||||
|
unsigned long __pad3;
|
||||||
|
time_t shm_atime;
|
||||||
|
time_t shm_dtime;
|
||||||
|
time_t shm_ctime;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct shminfo {
|
struct shminfo {
|
||||||
@ -22,4 +29,3 @@ struct shm_info {
|
|||||||
unsigned long shm_tot, shm_rss, shm_swp;
|
unsigned long shm_tot, shm_rss, shm_swp;
|
||||||
unsigned long __swap_attempts, __swap_successes;
|
unsigned long __swap_attempts, __swap_successes;
|
||||||
};
|
};
|
||||||
|
|
@ -14,8 +14,12 @@ struct stat {
|
|||||||
off_t st_size;
|
off_t st_size;
|
||||||
blksize_t st_blksize;
|
blksize_t st_blksize;
|
||||||
blkcnt_t st_blocks;
|
blkcnt_t st_blocks;
|
||||||
|
struct {
|
||||||
|
long tv_sec;
|
||||||
|
long tv_nsec;
|
||||||
|
} __st_atim32, __st_mtim32, __st_ctim32;
|
||||||
|
ino_t st_ino;
|
||||||
struct timespec st_atim;
|
struct timespec st_atim;
|
||||||
struct timespec st_mtim;
|
struct timespec st_mtim;
|
||||||
struct timespec st_ctim;
|
struct timespec st_ctim;
|
||||||
ino_t st_ino;
|
|
||||||
};
|
};
|
||||||
|
@ -76,8 +76,8 @@
|
|||||||
#define __NR_setrlimit 75
|
#define __NR_setrlimit 75
|
||||||
#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
|
#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
|
||||||
#define __NR_getrusage 77
|
#define __NR_getrusage 77
|
||||||
#define __NR_gettimeofday 78
|
#define __NR_gettimeofday_time32 78
|
||||||
#define __NR_settimeofday 79
|
#define __NR_settimeofday_time32 79
|
||||||
#define __NR_getgroups 80
|
#define __NR_getgroups 80
|
||||||
#define __NR_setgroups 81
|
#define __NR_setgroups 81
|
||||||
#define __NR_select 82
|
#define __NR_select 82
|
||||||
@ -257,14 +257,14 @@
|
|||||||
#define __NR_remap_file_pages 257
|
#define __NR_remap_file_pages 257
|
||||||
#define __NR_set_tid_address 258
|
#define __NR_set_tid_address 258
|
||||||
#define __NR_timer_create 259
|
#define __NR_timer_create 259
|
||||||
#define __NR_timer_settime (__NR_timer_create+1)
|
#define __NR_timer_settime32 (__NR_timer_create+1)
|
||||||
#define __NR_timer_gettime (__NR_timer_create+2)
|
#define __NR_timer_gettime32 (__NR_timer_create+2)
|
||||||
#define __NR_timer_getoverrun (__NR_timer_create+3)
|
#define __NR_timer_getoverrun (__NR_timer_create+3)
|
||||||
#define __NR_timer_delete (__NR_timer_create+4)
|
#define __NR_timer_delete (__NR_timer_create+4)
|
||||||
#define __NR_clock_settime (__NR_timer_create+5)
|
#define __NR_clock_settime32 (__NR_timer_create+5)
|
||||||
#define __NR_clock_gettime (__NR_timer_create+6)
|
#define __NR_clock_gettime32 (__NR_timer_create+6)
|
||||||
#define __NR_clock_getres (__NR_timer_create+7)
|
#define __NR_clock_getres_time32 (__NR_timer_create+7)
|
||||||
#define __NR_clock_nanosleep (__NR_timer_create+8)
|
#define __NR_clock_nanosleep_time32 (__NR_timer_create+8)
|
||||||
#define __NR_statfs64 268
|
#define __NR_statfs64 268
|
||||||
#define __NR_fstatfs64 269
|
#define __NR_fstatfs64 269
|
||||||
#define __NR_tgkill 270
|
#define __NR_tgkill 270
|
||||||
@ -322,8 +322,8 @@
|
|||||||
#define __NR_timerfd_create 322
|
#define __NR_timerfd_create 322
|
||||||
#define __NR_eventfd 323
|
#define __NR_eventfd 323
|
||||||
#define __NR_fallocate 324
|
#define __NR_fallocate 324
|
||||||
#define __NR_timerfd_settime 325
|
#define __NR_timerfd_settime32 325
|
||||||
#define __NR_timerfd_gettime 326
|
#define __NR_timerfd_gettime32 326
|
||||||
#define __NR_signalfd4 327
|
#define __NR_signalfd4 327
|
||||||
#define __NR_eventfd2 328
|
#define __NR_eventfd2 328
|
||||||
#define __NR_epoll_create1 329
|
#define __NR_epoll_create1 329
|
||||||
@ -418,4 +418,12 @@
|
|||||||
#define __NR_io_uring_setup 425
|
#define __NR_io_uring_setup 425
|
||||||
#define __NR_io_uring_enter 426
|
#define __NR_io_uring_enter 426
|
||||||
#define __NR_io_uring_register 427
|
#define __NR_io_uring_register 427
|
||||||
|
#define __NR_open_tree 428
|
||||||
|
#define __NR_move_mount 429
|
||||||
|
#define __NR_fsopen 430
|
||||||
|
#define __NR_fsconfig 431
|
||||||
|
#define __NR_fsmount 432
|
||||||
|
#define __NR_fspick 433
|
||||||
|
#define __NR_pidfd_open 434
|
||||||
|
#define __NR_clone3 435
|
||||||
|
|
||||||
|
21
libc-top-half/musl/arch/i386/kstat.h
Normal file
21
libc-top-half/musl/arch/i386/kstat.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
struct kstat {
|
||||||
|
dev_t st_dev;
|
||||||
|
int __st_dev_padding;
|
||||||
|
long __st_ino_truncated;
|
||||||
|
mode_t st_mode;
|
||||||
|
nlink_t st_nlink;
|
||||||
|
uid_t st_uid;
|
||||||
|
gid_t st_gid;
|
||||||
|
dev_t st_rdev;
|
||||||
|
int __st_rdev_padding;
|
||||||
|
off_t st_size;
|
||||||
|
blksize_t st_blksize;
|
||||||
|
blkcnt_t st_blocks;
|
||||||
|
long st_atime_sec;
|
||||||
|
long st_atime_nsec;
|
||||||
|
long st_mtime_sec;
|
||||||
|
long st_mtime_nsec;
|
||||||
|
long st_ctime_sec;
|
||||||
|
long st_ctime_nsec;
|
||||||
|
ino_t st_ino;
|
||||||
|
};
|
@ -83,7 +83,9 @@ static inline long __syscall6(long n, long a1, long a2, long a3, long a4, long a
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define VDSO_USEFUL
|
#define VDSO_USEFUL
|
||||||
#define VDSO_CGT_SYM "__vdso_clock_gettime"
|
#define VDSO_CGT32_SYM "__vdso_clock_gettime"
|
||||||
|
#define VDSO_CGT32_VER "LINUX_2.6"
|
||||||
|
#define VDSO_CGT_SYM "__vdso_clock_gettime64"
|
||||||
#define VDSO_CGT_VER "LINUX_2.6"
|
#define VDSO_CGT_VER "LINUX_2.6"
|
||||||
|
|
||||||
#define SYSCALL_USE_SOCKETCALL
|
#define SYSCALL_USE_SOCKETCALL
|
||||||
|
1
libc-top-half/musl/arch/m68k/arch.mak
Normal file
1
libc-top-half/musl/arch/m68k/arch.mak
Normal file
@ -0,0 +1 @@
|
|||||||
|
COMPAT_SRC_DIRS = compat/time32
|
@ -1,13 +1,18 @@
|
|||||||
|
#define _REDIR_TIME64 1
|
||||||
#define _Addr int
|
#define _Addr int
|
||||||
#define _Int64 long long
|
#define _Int64 long long
|
||||||
#define _Reg int
|
#define _Reg int
|
||||||
|
|
||||||
TYPEDEF __builtin_va_list va_list;
|
#define __BYTE_ORDER 4321
|
||||||
TYPEDEF __builtin_va_list __isoc_va_list;
|
#define __LONG_MAX 0x7fffffffL
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
#ifdef __WCHAR_TYPE__
|
||||||
|
TYPEDEF __WCHAR_TYPE__ wchar_t;
|
||||||
|
#else
|
||||||
TYPEDEF long wchar_t;
|
TYPEDEF long wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __mcffpu__
|
#if __mcffpu__
|
||||||
TYPEDEF float float_t;
|
TYPEDEF float float_t;
|
||||||
@ -18,14 +23,3 @@ TYPEDEF long double double_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||||
|
|
||||||
TYPEDEF long time_t;
|
|
||||||
TYPEDEF long suseconds_t;
|
|
||||||
|
|
||||||
TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
|
|
||||||
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
|
|
||||||
TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
|
|
||||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
|
|
||||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
|
|
||||||
TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
|
|
||||||
TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#define __BYTE_ORDER __BIG_ENDIAN
|
|
1
libc-top-half/musl/arch/m68k/bits/ipcstat.h
Normal file
1
libc-top-half/musl/arch/m68k/bits/ipcstat.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define IPC_STAT 0x102
|
@ -1,7 +0,0 @@
|
|||||||
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
|
||||||
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
|
||||||
#define LONG_BIT 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LONG_MAX 0x7fffffffL
|
|
||||||
#define LLONG_MAX 0x7fffffffffffffffLL
|
|
@ -1,12 +1,18 @@
|
|||||||
struct msqid_ds {
|
struct msqid_ds {
|
||||||
struct ipc_perm msg_perm;
|
struct ipc_perm msg_perm;
|
||||||
time_t msg_stime;
|
unsigned long __msg_stime_lo;
|
||||||
time_t msg_rtime;
|
unsigned long __msg_stime_hi;
|
||||||
time_t msg_ctime;
|
unsigned long __msg_rtime_lo;
|
||||||
|
unsigned long __msg_rtime_hi;
|
||||||
|
unsigned long __msg_ctime_lo;
|
||||||
|
unsigned long __msg_ctime_hi;
|
||||||
unsigned long msg_cbytes;
|
unsigned long msg_cbytes;
|
||||||
msgqnum_t msg_qnum;
|
msgqnum_t msg_qnum;
|
||||||
msglen_t msg_qbytes;
|
msglen_t msg_qbytes;
|
||||||
pid_t msg_lspid;
|
pid_t msg_lspid;
|
||||||
pid_t msg_lrpid;
|
pid_t msg_lrpid;
|
||||||
unsigned long __unused[2];
|
unsigned long __unused[2];
|
||||||
|
time_t msg_stime;
|
||||||
|
time_t msg_rtime;
|
||||||
|
time_t msg_ctime;
|
||||||
};
|
};
|
13
libc-top-half/musl/arch/m68k/bits/sem.h
Normal file
13
libc-top-half/musl/arch/m68k/bits/sem.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
struct semid_ds {
|
||||||
|
struct ipc_perm sem_perm;
|
||||||
|
unsigned long __sem_otime_lo;
|
||||||
|
unsigned long __sem_otime_hi;
|
||||||
|
unsigned long __sem_ctime_lo;
|
||||||
|
unsigned long __sem_ctime_hi;
|
||||||
|
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
|
||||||
|
unsigned short sem_nsems;
|
||||||
|
long __unused3;
|
||||||
|
long __unused4;
|
||||||
|
time_t sem_otime;
|
||||||
|
time_t sem_ctime;
|
||||||
|
};
|
@ -3,14 +3,21 @@
|
|||||||
struct shmid_ds {
|
struct shmid_ds {
|
||||||
struct ipc_perm shm_perm;
|
struct ipc_perm shm_perm;
|
||||||
size_t shm_segsz;
|
size_t shm_segsz;
|
||||||
time_t shm_atime;
|
unsigned long __shm_atime_lo;
|
||||||
time_t shm_dtime;
|
unsigned long __shm_atime_hi;
|
||||||
time_t shm_ctime;
|
unsigned long __shm_dtime_lo;
|
||||||
|
unsigned long __shm_dtime_hi;
|
||||||
|
unsigned long __shm_ctime_lo;
|
||||||
|
unsigned long __shm_ctime_hi;
|
||||||
pid_t shm_cpid;
|
pid_t shm_cpid;
|
||||||
pid_t shm_lpid;
|
pid_t shm_lpid;
|
||||||
unsigned long shm_nattch;
|
unsigned long shm_nattch;
|
||||||
unsigned long __pad1;
|
unsigned long __pad1;
|
||||||
unsigned long __pad2;
|
unsigned long __pad2;
|
||||||
|
unsigned long __pad3;
|
||||||
|
time_t shm_atime;
|
||||||
|
time_t shm_dtime;
|
||||||
|
time_t shm_ctime;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct shminfo {
|
struct shminfo {
|
@ -14,8 +14,12 @@ struct stat {
|
|||||||
off_t st_size;
|
off_t st_size;
|
||||||
blksize_t st_blksize;
|
blksize_t st_blksize;
|
||||||
blkcnt_t st_blocks;
|
blkcnt_t st_blocks;
|
||||||
|
struct {
|
||||||
|
long tv_sec;
|
||||||
|
long tv_nsec;
|
||||||
|
} __st_atim32, __st_mtim32, __st_ctim32;
|
||||||
|
ino_t st_ino;
|
||||||
struct timespec st_atim;
|
struct timespec st_atim;
|
||||||
struct timespec st_mtim;
|
struct timespec st_mtim;
|
||||||
struct timespec st_ctim;
|
struct timespec st_ctim;
|
||||||
ino_t st_ino;
|
|
||||||
};
|
};
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user