diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index ee24fe2323..0e11853bac 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,7 +1,7 @@ # These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username +github: [winlinvip] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with patreon id. open_collective: srs-server ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7bce38f63b..708a1ba9e2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,6 +7,10 @@ assignees: '' --- +!!! Before submitting a new bug report, please ensure you have searched for any existing bugs. Duplicate issues or +questions that are overly simple or already addressed in the documentation will be removed without any +response. + **Describe the bug** A clear and concise description of what the bug is. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index b07a11b29e..5eba3b916d 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,6 +7,11 @@ assignees: '' --- +!!! Before submitting a new feature request, please ensure you have searched for any existing features and utilized +the `Ask AI` feature at https://ossrs.io or https://ossrs.net (for users in China). Duplicate issues or +questions that are overly simple or already addressed in the documentation will be removed without any +response. + **What is the business background? Please provide a description.** Who are the users? How do they utilize this feature? What problem does this feature address? diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc95ef5f72..b8d65a36eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ name: "Release" on: push: tags: - - v6* + - v7* # For draft, need write permission. permissions: @@ -75,7 +75,7 @@ jobs: - name: Run SRS regression-test run: | docker run --rm srs:test bash -c 'make && \ - ./objs/srs -c conf/regression-test.conf && \ + ./objs/srs -c conf/regression-test.conf && sleep 10 && \ cd 3rdparty/srs-bench && make && ./objs/srs_test -test.v' runs-on: ubuntu-20.04 @@ -108,7 +108,7 @@ jobs: # See https://github.com/cygwin/cygwin-install-action#parameters # Note that https://github.com/egor-tensin/setup-cygwin fails to install packages. - name: Setup Cygwin - uses: cygwin/cygwin-install-action@db475590d56881c6cef7b3f96f6f3dd9532ea1f4 # master + uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # master with: platform: x86_64 packages: bash make gcc-g++ cmake automake patch pkg-config tcl unzip @@ -250,7 +250,7 @@ jobs: echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV echo "SRS_VERSION=${{ needs.envs.outputs.SRS_VERSION }}" >> $GITHUB_ENV echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV - echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_XYZ }}" >> $GITHUB_ENV + echo "SRS_XYZ=${{ needs.envs.outputs.SRS_XYZ }}" >> $GITHUB_ENV ################################################################################################################## # Git checkout - name: Checkout repository @@ -276,7 +276,9 @@ jobs: echo "Release ossrs/srs:$SRS_TAG" docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 \ --output "type=image,push=true" \ - -t ossrs/srs:$SRS_TAG --build-arg SRS_AUTO_PACKAGER=$PACKAGER -f Dockerfile . + -t ossrs/srs:$SRS_TAG --build-arg SRS_AUTO_PACKAGER=$PACKAGER \ + --build-arg CONFARGS='--sanitizer=off --gb28181=on' \ + -f Dockerfile . # Docker alias images # TODO: FIXME: If stable, please set the latest from 5.0 to 6.0 - name: Docker alias images for ossrs/srs @@ -304,7 +306,7 @@ jobs: echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV echo "SRS_VERSION=${{ needs.envs.outputs.SRS_VERSION }}" >> $GITHUB_ENV echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV - echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_XYZ }}" >> $GITHUB_ENV + echo "SRS_XYZ=${{ needs.envs.outputs.SRS_XYZ }}" >> $GITHUB_ENV # Aliyun ACR # TODO: FIXME: If stable, please set the latest from 5.0 to 6.0 - name: Login aliyun hub @@ -406,6 +408,7 @@ jobs: echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV echo "SRS_VERSION=${{ needs.envs.outputs.SRS_VERSION }}" >> $GITHUB_ENV echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV + echo "SRS_XYZ=${{ needs.envs.outputs.SRS_XYZ }}" >> $GITHUB_ENV echo "SRS_RELEASE_ID=${{ needs.draft.outputs.SRS_RELEASE_ID }}" >> $GITHUB_ENV echo "SRS_PACKAGE_ZIP=${{ needs.linux.outputs.SRS_PACKAGE_ZIP }}" >> $GITHUB_ENV echo "SRS_PACKAGE_MD5=${{ needs.linux.outputs.SRS_PACKAGE_MD5 }}" >> $GITHUB_ENV @@ -446,23 +449,23 @@ jobs: * Binary: ${{ env.SRS_CYGWIN_MD5 }} [${{ env.SRS_CYGWIN_TAR }}](https://gitee.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_CYGWIN_TAR }}) ## Docker - * [docker pull ossrs/srs:${{ env.SRS_MAJOR }}](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started) - * [docker pull ossrs/srs:${{ env.SRS_TAG }}](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started) - * [docker pull ossrs/srs:${{ env.SRS_XYZ }}](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started) + * [docker pull ossrs/srs:${{ env.SRS_MAJOR }}](https://ossrs.io/lts/en-us/docs/v7/doc/getting-started) + * [docker pull ossrs/srs:${{ env.SRS_TAG }}](https://ossrs.io/lts/en-us/docs/v7/doc/getting-started) + * [docker pull ossrs/srs:${{ env.SRS_XYZ }}](https://ossrs.io/lts/en-us/docs/v7/doc/getting-started) ## Docker Mirror: aliyun.com - * [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_MAJOR }}](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started) - * [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }}](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started) - * [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_XYZ }}](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started) + * [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_MAJOR }}](https://ossrs.net/lts/zh-cn/docs/v7/doc/getting-started) + * [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }}](https://ossrs.net/lts/zh-cn/docs/v7/doc/getting-started) + * [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_XYZ }}](https://ossrs.net/lts/zh-cn/docs/v7/doc/getting-started) ## Doc: ossrs.io - * [Getting Started](https://ossrs.io/lts/en-us/docs/v5/doc/getting-started) - * [Wiki home](https://ossrs.io/lts/en-us/docs/v5/doc/introduction) + * [Getting Started](https://ossrs.io/lts/en-us/docs/v7/doc/getting-started) + * [Wiki home](https://ossrs.io/lts/en-us/docs/v7/doc/introduction) * [FAQ](https://ossrs.io/lts/en-us/faq), [Features](https://github.com/ossrs/srs/blob/${{ github.sha }}/trunk/doc/Features.md#features) or [ChangeLogs](https://github.com/ossrs/srs/blob/${{ github.sha }}/trunk/doc/CHANGELOG.md#changelog) ## Doc: ossrs.net - * [快速入门](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started) - * [中文Wiki首页](https://ossrs.net/lts/zh-cn/docs/v5/doc/introduction) + * [快速入门](https://ossrs.net/lts/zh-cn/docs/v7/doc/getting-started) + * [中文Wiki首页](https://ossrs.net/lts/zh-cn/docs/v7/doc/introduction) * [中文FAQ](https://ossrs.net/lts/zh-cn/faq), [功能列表](https://github.com/ossrs/srs/blob/${{ github.sha }}/trunk/doc/Features.md#features) 或 [修订历史](https://github.com/ossrs/srs/blob/${{ github.sha }}/trunk/doc/CHANGELOG.md#changelog) draft: false prerelease: true diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml deleted file mode 100644 index df1f008aa0..0000000000 --- a/.github/workflows/scorecard.yml +++ /dev/null @@ -1,73 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. They are provided -# by a third-party and are governed by separate terms of service, privacy -# policy, and support documentation. - -name: Scorecard - -on: - # For Branch-Protection check. Only the default branch is supported. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection - #branch_protection_rule: - # To guarantee Maintained check is occasionally updated. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained - #schedule: - # - cron: '00 00 * * 6' # At 00:00 on Saturday, see https://crontab.guru/#00_00_*_*_6 - push: - branches: [ "develop" ] - -# Declare default permissions as read only. -permissions: read-all - -jobs: - analysis: - name: Scorecard analysis - runs-on: ubuntu-latest - permissions: - # Needed to upload the results to code-scanning dashboard. - security-events: write - # Needed to publish results and get a badge (see publish_results below). - id-token: write - # Uncomment the permissions below if installing in a private repository. - # contents: read - # actions: read - - steps: - - name: "Checkout code" - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 - with: - persist-credentials: false - - - name: "Run analysis" - uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6 - with: - results_file: results.sarif - results_format: sarif - # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: - # - you want to enable the Branch-Protection check on a *public* repository, or - # - you are installing Scorecard on a *private* repository - # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. - repo_token: ${{ secrets.SCORECARD_TOKEN }} - - # Public repositories: - # - Publish results to OpenSSF REST API for easy access by consumers - # - Allows the repository to include the Scorecard badge. - # - See https://github.com/ossf/scorecard-action#publishing-results. - # For private repositories: - # - `publish_results` will always be set to `false`, regardless - # of the value entered here. - publish_results: true - - # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF - # format to the repository Actions tab. - #- name: "Upload artifact" - # uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 - # with: - # name: SARIF file - # path: results.sarif - # retention-days: 5 - - # Upload the results to GitHub's code scanning dashboard. - - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27 - with: - sarif_file: results.sarif diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 440cf00059..272abadfd6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: # See https://github.com/cygwin/cygwin-install-action#parameters # Note that https://github.com/egor-tensin/setup-cygwin fails to install packages. - name: Setup Cygwin - uses: cygwin/cygwin-install-action@db475590d56881c6cef7b3f96f6f3dd9532ea1f4 # master + uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # master with: platform: x86_64 packages: bash make gcc-g++ cmake automake patch pkg-config tcl unzip @@ -190,15 +190,16 @@ jobs: docker run --rm -w /srs/trunk/3rdparty/srs-bench srs:test \ ./objs/srs_blackbox_test -test.v -test.run '^TestFast' -test.parallel 64 docker run --rm -w /srs/trunk/3rdparty/srs-bench srs:test \ - ./objs/srs_blackbox_test -test.v -test.run '^TestSlow' -test.parallel 4 + ./objs/srs_blackbox_test -test.v -test.run '^TestSlow' -test.parallel 1 # For utest - name: Run SRS utest run: docker run --rm srs:test ./objs/srs_utest # For regression-test - name: Run SRS regression-test run: | - docker run --rm srs:test bash -c './objs/srs -c conf/regression-test.conf && \ - cd 3rdparty/srs-bench && ./objs/srs_test -test.v && ./objs/srs_gb28181_test -test.v' + docker run --rm srs:test bash -c './objs/srs -c conf/regression-test.conf && sleep 10 && \ + cd 3rdparty/srs-bench && (./objs/srs_test -test.v || (cat ../../objs/srs.log && exit 1)) && \ + ./objs/srs_gb28181_test -test.v' runs-on: ubuntu-20.04 coverage: diff --git a/.gitignore b/.gitignore index 63880f2281..0319e6d68f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,8 +16,6 @@ *.pyc *.swp .DS_Store -.vscode -.vscode/* /trunk/Makefile /trunk/objs /trunk/src/build-qt-Desktop-Debug @@ -42,4 +40,6 @@ cmake-build-debug /trunk/ide/srs_clion/Makefile /trunk/ide/srs_clion/cmake_install.cmake /trunk/ide/srs_clion/srs -/trunk/ide/srs_clion/Testing/ \ No newline at end of file +/trunk/ide/srs_clion/Testing/ +/trunk/ide/vscode-build + diff --git a/.run/private.run.xml b/.run/private.run.xml index 458dabc613..5f46184622 100644 --- a/.run/private.run.xml +++ b/.run/private.run.xml @@ -1,7 +1,6 @@ - diff --git a/.vscode/README.md b/.vscode/README.md new file mode 100644 index 0000000000..eb513707b4 --- /dev/null +++ b/.vscode/README.md @@ -0,0 +1,38 @@ +# Debug with VSCode + +Support run and debug with VSCode. + +## SRS + +Install the following extensions: + +- CMake Tools +- CodeLLDB +- C/C++ Extension Pack + +Open the folder like `~/git/srs` in VSCode. +Run commmand `> CMake: Configure` to configure the project. + +> Note: You can press `Ctrl+R`, then type `CMake: Configure` then select `Clang` as the toolchain. + +> Note: The `settings.json` is used to configure the cmake. It will use `${workspaceFolder}/trunk/ide/srs_clion/CMakeLists.txt` +> and `${workspaceFolder}/trunk/ide/vscode-build` as the source file and build directory. + +Click the `Run > Run Without Debugging` button to start the server. + +> Note: The `launch.json` is used for running and debugging. The build will output the binary to +> `${workspaceFolder}/trunk/ide/vscode-build/srs`. + +## Proxy + +Install the following extensions: + +- Go + +Open the folder like `~/git/srs` in VSCode. + +Select the `View > Run` and select `Launch srs-proxy` to start the proxy server. + +Click the `Run > Run Without Debugging` button to start the server. + +> Note: The `launch.json` is used for running and debugging. diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..047efcbfd4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,36 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch SRS", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/trunk/ide/vscode-build/srs", + "args": ["-c", "conf/console.conf"], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/trunk", + "environment": [], + "externalConsole": false, + "MIMode": "lldb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "build", + "logging": { + "engineLogging": true + } + }, + { + "name": "Launch srs-proxy", + "type": "go", + "request": "launch", + "mode": "auto", + "cwd": "${workspaceFolder}/proxy", + "program": "${workspaceFolder}/proxy" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..0d9dbf97bd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cmake.sourceDirectory": "${workspaceFolder}/trunk/ide/srs_clion", + "cmake.buildDirectory": "${workspaceFolder}/trunk/ide/vscode-build", + "cmake.configureOnOpen": false +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000..98388f3b32 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,17 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "cmake --build ${workspaceFolder}/trunk/ide/vscode-build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": ["$gcc"], + "detail": "Build SRS by cmake." + } + ] + } + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 953f60df27..a83c330a91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ARG SRS_AUTO_PACKAGER RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, PACKAGER: ${#SRS_AUTO_PACKAGER}, CONFARGS: ${CONFARGS}, MAKEARGS: ${MAKEARGS}, INSTALLDEPENDS: ${INSTALLDEPENDS}" # https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive # To use if in RUN, see https://github.com/moby/moby/issues/7281#issuecomment-389440503 # Note that only exists issue like "/bin/sh: 1: [[: not found" for Ubuntu20, no such problem in CentOS7. @@ -29,7 +29,7 @@ WORKDIR /srs/trunk # Build and install SRS. # Note that SRT is enabled by default, so we configure without --srt=on. # Note that we have copied all files by make install. -RUN ./configure --sanitizer=off --gb28181=on --h265=on ${CONFARGS} && make ${MAKEARGS} && make install +RUN ./configure ${CONFARGS} && make ${MAKEARGS} && make install ############################################################ # dist diff --git a/LICENSE b/LICENSE index 2ce38816d0..4391c39244 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2023 The SRS Authors +Copyright (c) 2013-2024 The SRS Authors 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 diff --git a/README.md b/README.md index b8ba364ea7..c4d3b20a52 100755 --- a/README.md +++ b/README.md @@ -10,13 +10,9 @@ [![](https://img.shields.io/badge/SRS-YouTube-red)](https://www.youtube.com/@srs_server) [![](https://badgen.net/discord/members/yZ4BnPmHAd)](https://discord.gg/yZ4BnPmHAd) [![](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fossrs%2Fsrs.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Fossrs%2Fsrs?ref=badge_small) -[![](https://ossrs.net/wiki/images/srs-faq.svg)](https://ossrs.net/lts/zh-cn/faq) [![](https://badgen.net/badge/srs/stackoverflow/orange?icon=terminal)](https://stackoverflow.com/questions/tagged/simple-realtime-server) [![](https://opencollective.com/srs-server/tiers/badge.svg)](https://opencollective.com/srs-server) [![](https://img.shields.io/docker/pulls/ossrs/srs)](https://hub.docker.com/r/ossrs/srs/tags) -[![](https://ossrs.net/wiki/images/do-btn-srs-125x20.svg)](https://cloud.digitalocean.com/droplets/new?appId=133468816&size=s-2vcpu-2gb®ion=sgp1&image=ossrs-srs&type=applications) -[![](https://api.securityscorecards.dev/projects/github.com/ossrs/srs/badge)](https://api.securityscorecards.dev/projects/github.com/ossrs/srs) -[![](https://bestpractices.coreinfrastructure.org/projects/5619/badge)](https://bestpractices.coreinfrastructure.org/projects/5619) SRS/6.0 ([Hang](https://ossrs.io/lts/en-us/product#release-60)) is a simple, high-efficiency, and real-time video server, supporting RTMP/WebRTC/HLS/HTTP-FLV/SRT/MPEG-DASH/GB28181, Linux/Windows/macOS, X86_64/ARMv7/AARCH64/M1/RISCV/LOONGARCH/MIPS, @@ -126,9 +122,20 @@ distributed under their [licenses](https://ossrs.io/lts/en-us/license). ## Releases +* 2024-09-01, [Release v6.0-a1](https://github.com/ossrs/srs/releases/tag/v6.0-a1), v6.0-a1, 6.0 alpha1, v6.0.155, 169636 lines. +* 2024-07-27, [Release v6.0-a0](https://github.com/ossrs/srs/releases/tag/v6.0-a0), v6.0-a0, 6.0 alpha0, v6.0.145, 169259 lines. +* 2024-07-04, [Release v6.0-d6](https://github.com/ossrs/srs/releases/tag/v6.0-d6), v6.0-d6, 6.0 dev6, v6.0.134, 168904 lines. +* 2024-06-15, [Release v6.0-d5](https://github.com/ossrs/srs/releases/tag/v6.0-d5), v6.0-d5, 6.0 dev5, v6.0.129, 168454 lines. +* 2024-02-15, [Release v6.0-d4](https://github.com/ossrs/srs/releases/tag/v6.0-d4), v6.0-d4, 6.0 dev4, v6.0.113, 167695 lines. +* 2023-11-19, [Release v6.0-d3](https://github.com/ossrs/srs/releases/tag/v6.0-d3), v6.0-d3, 6.0 dev3, v6.0.101, 167560 lines. * 2023-09-28, [Release v6.0-d2](https://github.com/ossrs/srs/releases/tag/v6.0-d2), v6.0-d2, 6.0 dev2, v6.0.85, 167509 lines. * 2023-08-31, [Release v6.0-d1](https://github.com/ossrs/srs/releases/tag/v6.0-d1), v6.0-d1, 6.0 dev1, v6.0.72, 167135 lines. * 2023-07-09, [Release v6.0-d0](https://github.com/ossrs/srs/releases/tag/v6.0-d0), v6.0-d0, 6.0 dev0, v6.0.59, 166739 lines. +* 2024-06-15, [Release v5.0-r3](https://github.com/ossrs/srs/releases/tag/v5.0-r3), v5.0-r3, 5.0 release3, v5.0.213, 163585 lines. +* 2024-04-03, [Release v5.0-r2](https://github.com/ossrs/srs/releases/tag/v5.0-r2), v5.0-r2, 5.0 release2, v5.0.210, 163515 lines. +* 2024-02-15, [Release v5.0-r1](https://github.com/ossrs/srs/releases/tag/v5.0-r1), v5.0-r1, 5.0 release1, v5.0.208, 163441 lines. +* 2023-12-30, [Release v5.0-r0](https://github.com/ossrs/srs/releases/tag/v5.0-r0), v5.0-r0, 5.0 release0, v5.0.205, 163363 lines. +* 2023-11-19, [Release v5.0-b7](https://github.com/ossrs/srs/releases/tag/v5.0-b7), v5.0-b7, 5.0 beta7, v5.0.200, 163305 lines. * 2023-10-25, [Release v5.0-b6](https://github.com/ossrs/srs/releases/tag/v5.0-b6), v5.0-b6, 5.0 beta6, v5.0.195, 163303 lines. * 2023-09-28, [Release v5.0-b5](https://github.com/ossrs/srs/releases/tag/v5.0-b5), v5.0-b5, 5.0 beta5, v5.0.185, 163254 lines. * 2023-08-31, [Release v5.0-b4](https://github.com/ossrs/srs/releases/tag/v5.0-b4), v5.0-b4, 5.0 beta4, v5.0.176, 162919 lines. diff --git a/proxy/.gitignore b/proxy/.gitignore new file mode 100644 index 0000000000..c20f4b6782 --- /dev/null +++ b/proxy/.gitignore @@ -0,0 +1,4 @@ +.idea +srs-proxy +.env +.go-formarted \ No newline at end of file diff --git a/proxy/Makefile b/proxy/Makefile new file mode 100644 index 0000000000..29084d5b76 --- /dev/null +++ b/proxy/Makefile @@ -0,0 +1,23 @@ +.PHONY: all build test fmt clean run + +all: build + +build: fmt ./srs-proxy + +./srs-proxy: *.go + go build -o srs-proxy . + +test: + go test ./... + +fmt: ./.go-formarted + +./.go-formarted: *.go + touch .go-formarted + go fmt ./... + +clean: + rm -f srs-proxy .go-formarted + +run: fmt + go run . diff --git a/proxy/api.go b/proxy/api.go new file mode 100644 index 0000000000..04baa92526 --- /dev/null +++ b/proxy/api.go @@ -0,0 +1,272 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "fmt" + "net/http" + "os" + "strings" + "sync" + "time" + + "srs-proxy/errors" + "srs-proxy/logger" +) + +// srsHTTPAPIServer is the proxy for SRS HTTP API, to proxy the WebRTC HTTP API like WHIP and WHEP, +// to proxy other HTTP API of SRS like the streams and clients, etc. +type srsHTTPAPIServer struct { + // The underlayer HTTP server. + server *http.Server + // The WebRTC server. + rtc *srsWebRTCServer + // The gracefully quit timeout, wait server to quit. + gracefulQuitTimeout time.Duration + // The wait group for all goroutines. + wg sync.WaitGroup +} + +func NewSRSHTTPAPIServer(opts ...func(*srsHTTPAPIServer)) *srsHTTPAPIServer { + v := &srsHTTPAPIServer{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *srsHTTPAPIServer) Close() error { + ctx, cancel := context.WithTimeout(context.Background(), v.gracefulQuitTimeout) + defer cancel() + v.server.Shutdown(ctx) + + v.wg.Wait() + return nil +} + +func (v *srsHTTPAPIServer) Run(ctx context.Context) error { + // Parse address to listen. + addr := envHttpAPI() + if !strings.Contains(addr, ":") { + addr = ":" + addr + } + + // Create server and handler. + mux := http.NewServeMux() + v.server = &http.Server{Addr: addr, Handler: mux} + logger.Df(ctx, "HTTP API server listen at %v", addr) + + // Shutdown the server gracefully when quiting. + go func() { + ctxParent := ctx + <-ctxParent.Done() + + ctx, cancel := context.WithTimeout(context.Background(), v.gracefulQuitTimeout) + defer cancel() + + v.server.Shutdown(ctx) + }() + + // The basic version handler, also can be used as health check API. + logger.Df(ctx, "Handle /api/v1/versions by %v", addr) + mux.HandleFunc("/api/v1/versions", func(w http.ResponseWriter, r *http.Request) { + apiResponse(ctx, w, r, map[string]string{ + "signature": Signature(), + "version": Version(), + }) + }) + + // The WebRTC WHIP API handler. + logger.Df(ctx, "Handle /rtc/v1/whip/ by %v", addr) + mux.HandleFunc("/rtc/v1/whip/", func(w http.ResponseWriter, r *http.Request) { + if err := v.rtc.HandleApiForWHIP(ctx, w, r); err != nil { + apiError(ctx, w, r, err) + } + }) + + // The WebRTC WHEP API handler. + logger.Df(ctx, "Handle /rtc/v1/whep/ by %v", addr) + mux.HandleFunc("/rtc/v1/whep/", func(w http.ResponseWriter, r *http.Request) { + if err := v.rtc.HandleApiForWHEP(ctx, w, r); err != nil { + apiError(ctx, w, r, err) + } + }) + + // Run HTTP API server. + v.wg.Add(1) + go func() { + defer v.wg.Done() + + err := v.server.ListenAndServe() + if err != nil { + if ctx.Err() != context.Canceled { + // TODO: If HTTP API server closed unexpectedly, we should notice the main loop to quit. + logger.Wf(ctx, "HTTP API accept err %+v", err) + } else { + logger.Df(ctx, "HTTP API server done") + } + } + }() + + return nil +} + +// systemAPI is the system HTTP API of the proxy server, for SRS media server to register the service +// to proxy server. It also provides some other system APIs like the status of proxy server, like exporter +// for Prometheus metrics. +type systemAPI struct { + // The underlayer HTTP server. + server *http.Server + // The gracefully quit timeout, wait server to quit. + gracefulQuitTimeout time.Duration + // The wait group for all goroutines. + wg sync.WaitGroup +} + +func NewSystemAPI(opts ...func(*systemAPI)) *systemAPI { + v := &systemAPI{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *systemAPI) Close() error { + ctx, cancel := context.WithTimeout(context.Background(), v.gracefulQuitTimeout) + defer cancel() + v.server.Shutdown(ctx) + + v.wg.Wait() + return nil +} + +func (v *systemAPI) Run(ctx context.Context) error { + // Parse address to listen. + addr := envSystemAPI() + if !strings.Contains(addr, ":") { + addr = ":" + addr + } + + // Create server and handler. + mux := http.NewServeMux() + v.server = &http.Server{Addr: addr, Handler: mux} + logger.Df(ctx, "System API server listen at %v", addr) + + // Shutdown the server gracefully when quiting. + go func() { + ctxParent := ctx + <-ctxParent.Done() + + ctx, cancel := context.WithTimeout(context.Background(), v.gracefulQuitTimeout) + defer cancel() + + v.server.Shutdown(ctx) + }() + + // The basic version handler, also can be used as health check API. + logger.Df(ctx, "Handle /api/v1/versions by %v", addr) + mux.HandleFunc("/api/v1/versions", func(w http.ResponseWriter, r *http.Request) { + apiResponse(ctx, w, r, map[string]string{ + "signature": Signature(), + "version": Version(), + }) + }) + + // The register service for SRS media servers. + logger.Df(ctx, "Handle /api/v1/srs/register by %v", addr) + mux.HandleFunc("/api/v1/srs/register", func(w http.ResponseWriter, r *http.Request) { + if err := func() error { + var deviceID, ip, serverID, serviceID, pid string + var rtmp, stream, api, srt, rtc []string + if err := ParseBody(r.Body, &struct { + // The IP of SRS, mandatory. + IP *string `json:"ip"` + // The server id of SRS, store in file, may not change, mandatory. + ServerID *string `json:"server"` + // The service id of SRS, always change when restarted, mandatory. + ServiceID *string `json:"service"` + // The process id of SRS, always change when restarted, mandatory. + PID *string `json:"pid"` + // The RTMP listen endpoints, mandatory. + RTMP *[]string `json:"rtmp"` + // The HTTP Stream listen endpoints, optional. + HTTP *[]string `json:"http"` + // The API listen endpoints, optional. + API *[]string `json:"api"` + // The SRT listen endpoints, optional. + SRT *[]string `json:"srt"` + // The RTC listen endpoints, optional. + RTC *[]string `json:"rtc"` + // The device id of SRS, optional. + DeviceID *string `json:"device_id"` + }{ + IP: &ip, DeviceID: &deviceID, + ServerID: &serverID, ServiceID: &serviceID, PID: &pid, + RTMP: &rtmp, HTTP: &stream, API: &api, SRT: &srt, RTC: &rtc, + }); err != nil { + return errors.Wrapf(err, "parse body") + } + + if ip == "" { + return errors.Errorf("empty ip") + } + if serverID == "" { + return errors.Errorf("empty server") + } + if serviceID == "" { + return errors.Errorf("empty service") + } + if pid == "" { + return errors.Errorf("empty pid") + } + if len(rtmp) == 0 { + return errors.Errorf("empty rtmp") + } + + server := NewSRSServer(func(srs *SRSServer) { + srs.IP, srs.DeviceID = ip, deviceID + srs.ServerID, srs.ServiceID, srs.PID = serverID, serviceID, pid + srs.RTMP, srs.HTTP, srs.API = rtmp, stream, api + srs.SRT, srs.RTC = srt, rtc + srs.UpdatedAt = time.Now() + }) + if err := srsLoadBalancer.Update(ctx, server); err != nil { + return errors.Wrapf(err, "update SRS server %+v", server) + } + + logger.Df(ctx, "Register SRS media server, %+v", server) + return nil + }(); err != nil { + apiError(ctx, w, r, err) + } + + type Response struct { + Code int `json:"code"` + PID string `json:"pid"` + } + + apiResponse(ctx, w, r, &Response{ + Code: 0, PID: fmt.Sprintf("%v", os.Getpid()), + }) + }) + + // Run System API server. + v.wg.Add(1) + go func() { + defer v.wg.Done() + + err := v.server.ListenAndServe() + if err != nil { + if ctx.Err() != context.Canceled { + // TODO: If System API server closed unexpectedly, we should notice the main loop to quit. + logger.Wf(ctx, "System API accept err %+v", err) + } else { + logger.Df(ctx, "System API server done") + } + } + }() + + return nil +} diff --git a/proxy/debug.go b/proxy/debug.go new file mode 100644 index 0000000000..3a389b8bbd --- /dev/null +++ b/proxy/debug.go @@ -0,0 +1,20 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "net/http" + + "srs-proxy/logger" +) + +func handleGoPprof(ctx context.Context) { + if addr := envGoPprof(); addr != "" { + go func() { + logger.Df(ctx, "Start Go pprof at %v", addr) + http.ListenAndServe(addr, nil) + }() + } +} diff --git a/proxy/env.go b/proxy/env.go new file mode 100644 index 0000000000..d607263547 --- /dev/null +++ b/proxy/env.go @@ -0,0 +1,226 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "io" + "os" + "path" + "strings" + + "srs-proxy/errors" + "srs-proxy/logger" +) + +// loadEnvFile loads the environment variables from file. Note that we only use .env file. +func loadEnvFile(ctx context.Context) error { + workDir, err := os.Getwd() + if err != nil { + return errors.Wrapf(err, "getpwd") + } + + envFile := path.Join(workDir, ".env") + if _, err := os.Stat(envFile); err != nil { + return nil + } + + file, err := os.Open(envFile) + if err != nil { + return errors.Wrapf(err, "open %v", envFile) + } + defer file.Close() + + b, err := io.ReadAll(file) + if err != nil { + return errors.Wrapf(err, "read %v", envFile) + } + + lines := strings.Split(strings.Replace(string(b), "\r\n", "\n", -1), "\n") + logger.Df(ctx, "load env file %v, lines=%v", envFile, len(lines)) + + for _, line := range lines { + if strings.HasPrefix(strings.TrimSpace(line), "#") { + continue + } + + if pos := strings.IndexByte(line, '='); pos > 0 { + key := strings.TrimSpace(line[:pos]) + value := strings.TrimSpace(line[pos+1:]) + if v := os.Getenv(key); v != "" { + continue + } + + os.Setenv(key, value) + } + } + + return nil +} + +// buildDefaultEnvironmentVariables setups the default environment variables. +func buildDefaultEnvironmentVariables(ctx context.Context) { + // Whether enable the Go pprof. + setEnvDefault("GO_PPROF", "") + // Force shutdown timeout. + setEnvDefault("PROXY_FORCE_QUIT_TIMEOUT", "30s") + // Graceful quit timeout. + setEnvDefault("PROXY_GRACE_QUIT_TIMEOUT", "20s") + + // The HTTP API server. + setEnvDefault("PROXY_HTTP_API", "11985") + // The HTTP web server. + setEnvDefault("PROXY_HTTP_SERVER", "18080") + // The RTMP media server. + setEnvDefault("PROXY_RTMP_SERVER", "11935") + // The WebRTC media server, via UDP protocol. + setEnvDefault("PROXY_WEBRTC_SERVER", "18000") + // The SRT media server, via UDP protocol. + setEnvDefault("PROXY_SRT_SERVER", "20080") + // The API server of proxy itself. + setEnvDefault("PROXY_SYSTEM_API", "12025") + // The static directory for web server. + setEnvDefault("PROXY_STATIC_FILES", "../trunk/research") + + // The load balancer, use redis or memory. + setEnvDefault("PROXY_LOAD_BALANCER_TYPE", "memory") + // The redis server host. + setEnvDefault("PROXY_REDIS_HOST", "127.0.0.1") + // The redis server port. + setEnvDefault("PROXY_REDIS_PORT", "6379") + // The redis server password. + setEnvDefault("PROXY_REDIS_PASSWORD", "") + // The redis server db. + setEnvDefault("PROXY_REDIS_DB", "0") + + // Whether enable the default backend server, for debugging. + setEnvDefault("PROXY_DEFAULT_BACKEND_ENABLED", "off") + // Default backend server IP, for debugging. + setEnvDefault("PROXY_DEFAULT_BACKEND_IP", "127.0.0.1") + // Default backend server port, for debugging. + setEnvDefault("PROXY_DEFAULT_BACKEND_RTMP", "1935") + // Default backend api port, for debugging. + setEnvDefault("PROXY_DEFAULT_BACKEND_API", "1985") + // Default backend udp rtc port, for debugging. + setEnvDefault("PROXY_DEFAULT_BACKEND_RTC", "8000") + // Default backend udp srt port, for debugging. + setEnvDefault("PROXY_DEFAULT_BACKEND_SRT", "10080") + + logger.Df(ctx, "load .env as GO_PPROF=%v, "+ + "PROXY_FORCE_QUIT_TIMEOUT=%v, PROXY_GRACE_QUIT_TIMEOUT=%v, "+ + "PROXY_HTTP_API=%v, PROXY_HTTP_SERVER=%v, PROXY_RTMP_SERVER=%v, "+ + "PROXY_WEBRTC_SERVER=%v, PROXY_SRT_SERVER=%v, "+ + "PROXY_SYSTEM_API=%v, PROXY_STATIC_FILES=%v, PROXY_DEFAULT_BACKEND_ENABLED=%v, "+ + "PROXY_DEFAULT_BACKEND_IP=%v, PROXY_DEFAULT_BACKEND_RTMP=%v, "+ + "PROXY_DEFAULT_BACKEND_HTTP=%v, PROXY_DEFAULT_BACKEND_API=%v, "+ + "PROXY_DEFAULT_BACKEND_RTC=%v, PROXY_DEFAULT_BACKEND_SRT=%v, "+ + "PROXY_LOAD_BALANCER_TYPE=%v, PROXY_REDIS_HOST=%v, PROXY_REDIS_PORT=%v, "+ + "PROXY_REDIS_PASSWORD=%v, PROXY_REDIS_DB=%v", + envGoPprof(), + envForceQuitTimeout(), envGraceQuitTimeout(), + envHttpAPI(), envHttpServer(), envRtmpServer(), + envWebRTCServer(), envSRTServer(), + envSystemAPI(), envStaticFiles(), envDefaultBackendEnabled(), + envDefaultBackendIP(), envDefaultBackendRTMP(), + envDefaultBackendHttp(), envDefaultBackendAPI(), + envDefaultBackendRTC(), envDefaultBackendSRT(), + envLoadBalancerType(), envRedisHost(), envRedisPort(), + envRedisPassword(), envRedisDB(), + ) +} + +func envStaticFiles() string { + return os.Getenv("PROXY_STATIC_FILES") +} + +func envDefaultBackendSRT() string { + return os.Getenv("PROXY_DEFAULT_BACKEND_SRT") +} + +func envDefaultBackendRTC() string { + return os.Getenv("PROXY_DEFAULT_BACKEND_RTC") +} + +func envDefaultBackendAPI() string { + return os.Getenv("PROXY_DEFAULT_BACKEND_API") +} + +func envSRTServer() string { + return os.Getenv("PROXY_SRT_SERVER") +} + +func envWebRTCServer() string { + return os.Getenv("PROXY_WEBRTC_SERVER") +} + +func envDefaultBackendHttp() string { + return os.Getenv("PROXY_DEFAULT_BACKEND_HTTP") +} + +func envRedisDB() string { + return os.Getenv("PROXY_REDIS_DB") +} + +func envRedisPassword() string { + return os.Getenv("PROXY_REDIS_PASSWORD") +} + +func envRedisPort() string { + return os.Getenv("PROXY_REDIS_PORT") +} + +func envRedisHost() string { + return os.Getenv("PROXY_REDIS_HOST") +} + +func envLoadBalancerType() string { + return os.Getenv("PROXY_LOAD_BALANCER_TYPE") +} + +func envDefaultBackendRTMP() string { + return os.Getenv("PROXY_DEFAULT_BACKEND_RTMP") +} + +func envDefaultBackendIP() string { + return os.Getenv("PROXY_DEFAULT_BACKEND_IP") +} + +func envDefaultBackendEnabled() string { + return os.Getenv("PROXY_DEFAULT_BACKEND_ENABLED") +} + +func envGraceQuitTimeout() string { + return os.Getenv("PROXY_GRACE_QUIT_TIMEOUT") +} + +func envForceQuitTimeout() string { + return os.Getenv("PROXY_FORCE_QUIT_TIMEOUT") +} + +func envGoPprof() string { + return os.Getenv("GO_PPROF") +} + +func envSystemAPI() string { + return os.Getenv("PROXY_SYSTEM_API") +} + +func envRtmpServer() string { + return os.Getenv("PROXY_RTMP_SERVER") +} + +func envHttpServer() string { + return os.Getenv("PROXY_HTTP_SERVER") +} + +func envHttpAPI() string { + return os.Getenv("PROXY_HTTP_API") +} + +// setEnvDefault set env key=value if not set. +func setEnvDefault(key, value string) { + if os.Getenv(key) == "" { + os.Setenv(key, value) + } +} diff --git a/proxy/errors/errors.go b/proxy/errors/errors.go new file mode 100644 index 0000000000..257bc3ccda --- /dev/null +++ b/proxy/errors/errors.go @@ -0,0 +1,270 @@ +// Package errors provides simple error handling primitives. +// +// The traditional error handling idiom in Go is roughly akin to +// +// if err != nil { +// return err +// } +// +// which applied recursively up the call stack results in error reports +// without context or debugging information. The errors package allows +// programmers to add context to the failure path in their code in a way +// that does not destroy the original value of the error. +// +// Adding context to an error +// +// The errors.Wrap function returns a new error that adds context to the +// original error by recording a stack trace at the point Wrap is called, +// and the supplied message. For example +// +// _, err := ioutil.ReadAll(r) +// if err != nil { +// return errors.Wrap(err, "read failed") +// } +// +// If additional control is required the errors.WithStack and errors.WithMessage +// functions destructure errors.Wrap into its component operations of annotating +// an error with a stack trace and an a message, respectively. +// +// Retrieving the cause of an error +// +// Using errors.Wrap constructs a stack of errors, adding context to the +// preceding error. Depending on the nature of the error it may be necessary +// to reverse the operation of errors.Wrap to retrieve the original error +// for inspection. Any error value which implements this interface +// +// type causer interface { +// Cause() error +// } +// +// can be inspected by errors.Cause. errors.Cause will recursively retrieve +// the topmost error which does not implement causer, which is assumed to be +// the original cause. For example: +// +// switch err := errors.Cause(err).(type) { +// case *MyError: +// // handle specifically +// default: +// // unknown error +// } +// +// causer interface is not exported by this package, but is considered a part +// of stable public API. +// +// Formatted printing of errors +// +// All error values returned from this package implement fmt.Formatter and can +// be formatted by the fmt package. The following verbs are supported +// +// %s print the error. If the error has a Cause it will be +// printed recursively +// %v see %s +// %+v extended format. Each Frame of the error's StackTrace will +// be printed in detail. +// +// Retrieving the stack trace of an error or wrapper +// +// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are +// invoked. This information can be retrieved with the following interface. +// +// type stackTracer interface { +// StackTrace() errors.StackTrace +// } +// +// Where errors.StackTrace is defined as +// +// type StackTrace []Frame +// +// The Frame type represents a call site in the stack trace. Frame supports +// the fmt.Formatter interface that can be used for printing information about +// the stack trace of this error. For example: +// +// if err, ok := err.(stackTracer); ok { +// for _, f := range err.StackTrace() { +// fmt.Printf("%+s:%d", f) +// } +// } +// +// stackTracer interface is not exported by this package, but is considered a part +// of stable public API. +// +// See the documentation for Frame.Format for more details. +// Fork from https://github.com/pkg/errors +package errors + +import ( + "fmt" + "io" +) + +// New returns an error with the supplied message. +// New also records the stack trace at the point it was called. +func New(message string) error { + return &fundamental{ + msg: message, + stack: callers(), + } +} + +// Errorf formats according to a format specifier and returns the string +// as a value that satisfies error. +// Errorf also records the stack trace at the point it was called. +func Errorf(format string, args ...interface{}) error { + return &fundamental{ + msg: fmt.Sprintf(format, args...), + stack: callers(), + } +} + +// fundamental is an error that has a message and a stack, but no caller. +type fundamental struct { + msg string + *stack +} + +func (f *fundamental) Error() string { return f.msg } + +func (f *fundamental) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + io.WriteString(s, f.msg) + f.stack.Format(s, verb) + return + } + fallthrough + case 's': + io.WriteString(s, f.msg) + case 'q': + fmt.Fprintf(s, "%q", f.msg) + } +} + +// WithStack annotates err with a stack trace at the point WithStack was called. +// If err is nil, WithStack returns nil. +func WithStack(err error) error { + if err == nil { + return nil + } + return &withStack{ + err, + callers(), + } +} + +type withStack struct { + error + *stack +} + +func (w *withStack) Cause() error { return w.error } + +func (w *withStack) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v", w.Cause()) + w.stack.Format(s, verb) + return + } + fallthrough + case 's': + io.WriteString(s, w.Error()) + case 'q': + fmt.Fprintf(s, "%q", w.Error()) + } +} + +// Wrap returns an error annotating err with a stack trace +// at the point Wrap is called, and the supplied message. +// If err is nil, Wrap returns nil. +func Wrap(err error, message string) error { + if err == nil { + return nil + } + err = &withMessage{ + cause: err, + msg: message, + } + return &withStack{ + err, + callers(), + } +} + +// Wrapf returns an error annotating err with a stack trace +// at the point Wrapf is call, and the format specifier. +// If err is nil, Wrapf returns nil. +func Wrapf(err error, format string, args ...interface{}) error { + if err == nil { + return nil + } + err = &withMessage{ + cause: err, + msg: fmt.Sprintf(format, args...), + } + return &withStack{ + err, + callers(), + } +} + +// WithMessage annotates err with a new message. +// If err is nil, WithMessage returns nil. +func WithMessage(err error, message string) error { + if err == nil { + return nil + } + return &withMessage{ + cause: err, + msg: message, + } +} + +type withMessage struct { + cause error + msg string +} + +func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } +func (w *withMessage) Cause() error { return w.cause } + +func (w *withMessage) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v\n", w.Cause()) + io.WriteString(s, w.msg) + return + } + fallthrough + case 's', 'q': + io.WriteString(s, w.Error()) + } +} + +// Cause returns the underlying cause of the error, if possible. +// An error value has a cause if it implements the following +// interface: +// +// type causer interface { +// Cause() error +// } +// +// If the error does not implement Cause, the original error will +// be returned. If the error is nil, nil will be returned without further +// investigation. +func Cause(err error) error { + type causer interface { + Cause() error + } + + for err != nil { + cause, ok := err.(causer) + if !ok { + break + } + err = cause.Cause() + } + return err +} diff --git a/proxy/errors/stack.go b/proxy/errors/stack.go new file mode 100644 index 0000000000..6c42db5a85 --- /dev/null +++ b/proxy/errors/stack.go @@ -0,0 +1,187 @@ +// Fork from https://github.com/pkg/errors +package errors + +import ( + "fmt" + "io" + "path" + "runtime" + "strings" +) + +// Frame represents a program counter inside a stack frame. +type Frame uintptr + +// pc returns the program counter for this frame; +// multiple frames may have the same PC value. +func (f Frame) pc() uintptr { return uintptr(f) - 1 } + +// file returns the full path to the file that contains the +// function for this Frame's pc. +func (f Frame) file() string { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return "unknown" + } + file, _ := fn.FileLine(f.pc()) + return file +} + +// line returns the line number of source code of the +// function for this Frame's pc. +func (f Frame) line() int { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return 0 + } + _, line := fn.FileLine(f.pc()) + return line +} + +// Format formats the frame according to the fmt.Formatter interface. +// +// %s source file +// %d source line +// %n function name +// %v equivalent to %s:%d +// +// Format accepts flags that alter the printing of some verbs, as follows: +// +// %+s path of source file relative to the compile time GOPATH +// %+v equivalent to %+s:%d +func (f Frame) Format(s fmt.State, verb rune) { + switch verb { + case 's': + switch { + case s.Flag('+'): + pc := f.pc() + fn := runtime.FuncForPC(pc) + if fn == nil { + io.WriteString(s, "unknown") + } else { + file, _ := fn.FileLine(pc) + fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file) + } + default: + io.WriteString(s, path.Base(f.file())) + } + case 'd': + fmt.Fprintf(s, "%d", f.line()) + case 'n': + name := runtime.FuncForPC(f.pc()).Name() + io.WriteString(s, funcname(name)) + case 'v': + f.Format(s, 's') + io.WriteString(s, ":") + f.Format(s, 'd') + } +} + +// StackTrace is stack of Frames from innermost (newest) to outermost (oldest). +type StackTrace []Frame + +// Format formats the stack of Frames according to the fmt.Formatter interface. +// +// %s lists source files for each Frame in the stack +// %v lists the source file and line number for each Frame in the stack +// +// Format accepts flags that alter the printing of some verbs, as follows: +// +// %+v Prints filename, function, and line number for each Frame in the stack. +func (st StackTrace) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case s.Flag('+'): + for _, f := range st { + fmt.Fprintf(s, "\n%+v", f) + } + case s.Flag('#'): + fmt.Fprintf(s, "%#v", []Frame(st)) + default: + fmt.Fprintf(s, "%v", []Frame(st)) + } + case 's': + fmt.Fprintf(s, "%s", []Frame(st)) + } +} + +// stack represents a stack of program counters. +type stack []uintptr + +func (s *stack) Format(st fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case st.Flag('+'): + for _, pc := range *s { + f := Frame(pc) + fmt.Fprintf(st, "\n%+v", f) + } + } + } +} + +func (s *stack) StackTrace() StackTrace { + f := make([]Frame, len(*s)) + for i := 0; i < len(f); i++ { + f[i] = Frame((*s)[i]) + } + return f +} + +func callers() *stack { + const depth = 32 + var pcs [depth]uintptr + n := runtime.Callers(3, pcs[:]) + var st stack = pcs[0:n] + return &st +} + +// funcname removes the path prefix component of a function's name reported by func.Name(). +func funcname(name string) string { + i := strings.LastIndex(name, "/") + name = name[i+1:] + i = strings.Index(name, ".") + return name[i+1:] +} + +func trimGOPATH(name, file string) string { + // Here we want to get the source file path relative to the compile time + // GOPATH. As of Go 1.6.x there is no direct way to know the compiled + // GOPATH at runtime, but we can infer the number of path segments in the + // GOPATH. We note that fn.Name() returns the function name qualified by + // the import path, which does not include the GOPATH. Thus we can trim + // segments from the beginning of the file path until the number of path + // separators remaining is one more than the number of path separators in + // the function name. For example, given: + // + // GOPATH /home/user + // file /home/user/src/pkg/sub/file.go + // fn.Name() pkg/sub.Type.Method + // + // We want to produce: + // + // pkg/sub/file.go + // + // From this we can easily see that fn.Name() has one less path separator + // than our desired output. We count separators from the end of the file + // path until it finds two more than in the function name and then move + // one character forward to preserve the initial path segment without a + // leading separator. + const sep = "/" + goal := strings.Count(name, sep) + 2 + i := len(file) + for n := 0; n < goal; n++ { + i = strings.LastIndex(file[:i], sep) + if i == -1 { + // not enough separators found, set i so that the slice expression + // below leaves file unmodified + i = -len(sep) + break + } + } + // get back to 0 or trim the leading separator + file = file[i+len(sep):] + return file +} diff --git a/proxy/go.mod b/proxy/go.mod new file mode 100644 index 0000000000..e9e196d2f7 --- /dev/null +++ b/proxy/go.mod @@ -0,0 +1,10 @@ +module srs-proxy + +go 1.18 + +require github.com/go-redis/redis/v8 v8.11.5 + +require ( + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect +) diff --git a/proxy/go.sum b/proxy/go.sum new file mode 100644 index 0000000000..7342ff813f --- /dev/null +++ b/proxy/go.sum @@ -0,0 +1,15 @@ +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= +github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/proxy/http.go b/proxy/http.go new file mode 100644 index 0000000000..f02af02a30 --- /dev/null +++ b/proxy/http.go @@ -0,0 +1,419 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "fmt" + "io" + "io/ioutil" + "net/http" + "os" + "strconv" + "strings" + stdSync "sync" + "time" + + "srs-proxy/errors" + "srs-proxy/logger" +) + +// srsHTTPStreamServer is the proxy server for SRS HTTP stream server, for HTTP-FLV, HTTP-TS, +// HLS, etc. The proxy server will figure out which SRS origin server to proxy to, then proxy +// the request to the origin server. +type srsHTTPStreamServer struct { + // The underlayer HTTP server. + server *http.Server + // The gracefully quit timeout, wait server to quit. + gracefulQuitTimeout time.Duration + // The wait group for all goroutines. + wg stdSync.WaitGroup +} + +func NewSRSHTTPStreamServer(opts ...func(*srsHTTPStreamServer)) *srsHTTPStreamServer { + v := &srsHTTPStreamServer{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *srsHTTPStreamServer) Close() error { + ctx, cancel := context.WithTimeout(context.Background(), v.gracefulQuitTimeout) + defer cancel() + v.server.Shutdown(ctx) + + v.wg.Wait() + return nil +} + +func (v *srsHTTPStreamServer) Run(ctx context.Context) error { + // Parse address to listen. + addr := envHttpServer() + if !strings.Contains(addr, ":") { + addr = ":" + addr + } + + // Create server and handler. + mux := http.NewServeMux() + v.server = &http.Server{Addr: addr, Handler: mux} + logger.Df(ctx, "HTTP Stream server listen at %v", addr) + + // Shutdown the server gracefully when quiting. + go func() { + ctxParent := ctx + <-ctxParent.Done() + + ctx, cancel := context.WithTimeout(context.Background(), v.gracefulQuitTimeout) + defer cancel() + + v.server.Shutdown(ctx) + }() + + // The basic version handler, also can be used as health check API. + logger.Df(ctx, "Handle /api/v1/versions by %v", addr) + mux.HandleFunc("/api/v1/versions", func(w http.ResponseWriter, r *http.Request) { + type Response struct { + Code int `json:"code"` + PID string `json:"pid"` + Data struct { + Major int `json:"major"` + Minor int `json:"minor"` + Revision int `json:"revision"` + Version string `json:"version"` + } `json:"data"` + } + + res := Response{Code: 0, PID: fmt.Sprintf("%v", os.Getpid())} + res.Data.Major = VersionMajor() + res.Data.Minor = VersionMinor() + res.Data.Revision = VersionRevision() + res.Data.Version = Version() + + apiResponse(ctx, w, r, &res) + }) + + // The static web server, for the web pages. + var staticServer http.Handler + if staticFiles := envStaticFiles(); staticFiles != "" { + if _, err := os.Stat(staticFiles); err != nil { + return errors.Wrapf(err, "invalid static files %v", staticFiles) + } + + staticServer = http.FileServer(http.Dir(staticFiles)) + logger.Df(ctx, "Handle static files at %v", staticFiles) + } + + // The default handler, for both static web server and streaming server. + logger.Df(ctx, "Handle / by %v", addr) + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + // For HLS streaming, we will proxy the request to the streaming server. + if strings.HasSuffix(r.URL.Path, ".m3u8") { + unifiedURL, fullURL := convertURLToStreamURL(r) + streamURL, err := buildStreamURL(unifiedURL) + if err != nil { + http.Error(w, fmt.Sprintf("build stream url by %v from %v", unifiedURL, fullURL), http.StatusBadRequest) + return + } + + stream, _ := srsLoadBalancer.LoadOrStoreHLS(ctx, streamURL, NewHLSPlayStream(func(s *HLSPlayStream) { + s.SRSProxyBackendHLSID = logger.GenerateContextID() + s.StreamURL, s.FullURL = streamURL, fullURL + })) + + stream.Initialize(ctx).ServeHTTP(w, r) + return + } + + // For HTTP streaming, we will proxy the request to the streaming server. + if strings.HasSuffix(r.URL.Path, ".flv") || + strings.HasSuffix(r.URL.Path, ".ts") { + // If SPBHID is specified, it must be a HLS stream client. + if srsProxyBackendID := r.URL.Query().Get("spbhid"); srsProxyBackendID != "" { + if stream, err := srsLoadBalancer.LoadHLSBySPBHID(ctx, srsProxyBackendID); err != nil { + http.Error(w, fmt.Sprintf("load stream by spbhid %v", srsProxyBackendID), http.StatusBadRequest) + } else { + stream.Initialize(ctx).ServeHTTP(w, r) + } + return + } + + // Use HTTP pseudo streaming to proxy the request. + NewHTTPFlvTsConnection(func(c *HTTPFlvTsConnection) { + c.ctx = ctx + }).ServeHTTP(w, r) + return + } + + // Serve by static server. + if staticServer != nil { + staticServer.ServeHTTP(w, r) + return + } + + http.NotFound(w, r) + }) + + // Run HTTP server. + v.wg.Add(1) + go func() { + defer v.wg.Done() + + err := v.server.ListenAndServe() + if err != nil { + if ctx.Err() != context.Canceled { + // TODO: If HTTP Stream server closed unexpectedly, we should notice the main loop to quit. + logger.Wf(ctx, "HTTP Stream accept err %+v", err) + } else { + logger.Df(ctx, "HTTP Stream server done") + } + } + }() + + return nil +} + +// HTTPFlvTsConnection is an HTTP pseudo streaming connection, such as an HTTP-FLV or HTTP-TS +// connection. There is no state need to be sync between proxy servers. +// +// When we got an HTTP FLV or TS request, we will parse the stream URL from the HTTP request, +// then proxy to the corresponding backend server. All state is in the HTTP request, so this +// connection is stateless. +type HTTPFlvTsConnection struct { + // The context for HTTP streaming. + ctx context.Context +} + +func NewHTTPFlvTsConnection(opts ...func(*HTTPFlvTsConnection)) *HTTPFlvTsConnection { + v := &HTTPFlvTsConnection{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *HTTPFlvTsConnection) ServeHTTP(w http.ResponseWriter, r *http.Request) { + defer r.Body.Close() + ctx := logger.WithContext(v.ctx) + + if err := v.serve(ctx, w, r); err != nil { + apiError(ctx, w, r, err) + } else { + logger.Df(ctx, "HTTP client done") + } +} + +func (v *HTTPFlvTsConnection) serve(ctx context.Context, w http.ResponseWriter, r *http.Request) error { + // Always allow CORS for all requests. + if ok := apiCORS(ctx, w, r); ok { + return nil + } + + // Build the stream URL in vhost/app/stream schema. + unifiedURL, fullURL := convertURLToStreamURL(r) + logger.Df(ctx, "Got HTTP client from %v for %v", r.RemoteAddr, fullURL) + + streamURL, err := buildStreamURL(unifiedURL) + if err != nil { + return errors.Wrapf(err, "build stream url %v", unifiedURL) + } + + // Pick a backend SRS server to proxy the RTMP stream. + backend, err := srsLoadBalancer.Pick(ctx, streamURL) + if err != nil { + return errors.Wrapf(err, "pick backend for %v", streamURL) + } + + if err = v.serveByBackend(ctx, w, r, backend); err != nil { + return errors.Wrapf(err, "serve %v with %v by backend %+v", fullURL, streamURL, backend) + } + + return nil +} + +func (v *HTTPFlvTsConnection) serveByBackend(ctx context.Context, w http.ResponseWriter, r *http.Request, backend *SRSServer) error { + // Parse HTTP port from backend. + if len(backend.HTTP) == 0 { + return errors.Errorf("no http stream server") + } + + var httpPort int + if iv, err := strconv.ParseInt(backend.HTTP[0], 10, 64); err != nil { + return errors.Wrapf(err, "parse http port %v", backend.HTTP[0]) + } else { + httpPort = int(iv) + } + + // Connect to backend SRS server via HTTP client. + backendURL := fmt.Sprintf("http://%v:%v%s", backend.IP, httpPort, r.URL.Path) + req, err := http.NewRequestWithContext(ctx, r.Method, backendURL, nil) + if err != nil { + return errors.Wrapf(err, "create request to %v", backendURL) + } + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return errors.Wrapf(err, "do request to %v", backendURL) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return errors.Errorf("proxy stream to %v failed, status=%v", backendURL, resp.Status) + } + + // Copy all headers from backend to client. + w.WriteHeader(resp.StatusCode) + for k, v := range resp.Header { + for _, vv := range v { + w.Header().Add(k, vv) + } + } + + logger.Df(ctx, "HTTP start streaming") + + // Proxy the stream from backend to client. + if _, err := io.Copy(w, resp.Body); err != nil { + return errors.Wrapf(err, "copy stream to client, backend=%v", backendURL) + } + + return nil +} + +// HLSPlayStream is an HLS stream proxy, which represents the stream level object. This means multiple HLS +// clients will share this object, and they do not use the same ctx among proxy servers. +// +// Unlike the HTTP FLV or TS connection, HLS client may request the m3u8 or ts via different HTTP connections. +// Especially for requesting ts, we need to identify the stream URl or backend server for it. So we create +// the spbhid which can be seen as the hash of stream URL or backend server. The spbhid enable us to convert +// to the stream URL and then query the backend server to serve it. +type HLSPlayStream struct { + // The context for HLS streaming. + ctx context.Context + + // The spbhid, used to identify the backend server. + SRSProxyBackendHLSID string `json:"spbhid"` + // The stream URL in vhost/app/stream schema. + StreamURL string `json:"stream_url"` + // The full request URL for HLS streaming + FullURL string `json:"full_url"` +} + +func NewHLSPlayStream(opts ...func(*HLSPlayStream)) *HLSPlayStream { + v := &HLSPlayStream{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *HLSPlayStream) Initialize(ctx context.Context) *HLSPlayStream { + if v.ctx == nil { + v.ctx = logger.WithContext(ctx) + } + return v +} + +func (v *HLSPlayStream) ServeHTTP(w http.ResponseWriter, r *http.Request) { + defer r.Body.Close() + + if err := v.serve(v.ctx, w, r); err != nil { + apiError(v.ctx, w, r, err) + } else { + logger.Df(v.ctx, "HLS client %v for %v with %v done", + v.SRSProxyBackendHLSID, v.StreamURL, r.URL.Path) + } +} + +func (v *HLSPlayStream) serve(ctx context.Context, w http.ResponseWriter, r *http.Request) error { + ctx, streamURL, fullURL := v.ctx, v.StreamURL, v.FullURL + + // Always allow CORS for all requests. + if ok := apiCORS(ctx, w, r); ok { + return nil + } + + // Pick a backend SRS server to proxy the RTMP stream. + backend, err := srsLoadBalancer.Pick(ctx, streamURL) + if err != nil { + return errors.Wrapf(err, "pick backend for %v", streamURL) + } + + if err = v.serveByBackend(ctx, w, r, backend); err != nil { + return errors.Wrapf(err, "serve %v with %v by backend %+v", fullURL, streamURL, backend) + } + + return nil +} + +func (v *HLSPlayStream) serveByBackend(ctx context.Context, w http.ResponseWriter, r *http.Request, backend *SRSServer) error { + // Parse HTTP port from backend. + if len(backend.HTTP) == 0 { + return errors.Errorf("no rtmp server") + } + + var httpPort int + if iv, err := strconv.ParseInt(backend.HTTP[0], 10, 64); err != nil { + return errors.Wrapf(err, "parse http port %v", backend.HTTP[0]) + } else { + httpPort = int(iv) + } + + // Connect to backend SRS server via HTTP client. + backendURL := fmt.Sprintf("http://%v:%v%s", backend.IP, httpPort, r.URL.Path) + if r.URL.RawQuery != "" { + backendURL += "?" + r.URL.RawQuery + } + + req, err := http.NewRequestWithContext(ctx, r.Method, backendURL, nil) + if err != nil { + return errors.Wrapf(err, "create request to %v", backendURL) + } + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return errors.Errorf("do request to %v EOF", backendURL) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return errors.Errorf("proxy stream to %v failed, status=%v", backendURL, resp.Status) + } + + // Copy all headers from backend to client. + w.WriteHeader(resp.StatusCode) + for k, v := range resp.Header { + for _, vv := range v { + w.Header().Add(k, vv) + } + } + + // For TS file, directly copy it. + if !strings.HasSuffix(r.URL.Path, ".m3u8") { + if _, err := io.Copy(w, resp.Body); err != nil { + return errors.Wrapf(err, "copy stream to client, backend=%v", backendURL) + } + + return nil + } + + // Read all content of m3u8, append the stream ID to ts URL. Note that we only append stream ID to ts + // URL, to identify the stream to specified backend server. The spbhid is the SRS Proxy Backend HLS ID. + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + return errors.Wrapf(err, "read stream from %v", backendURL) + } + + m3u8 := string(b) + if strings.Contains(m3u8, ".ts?") { + m3u8 = strings.ReplaceAll(m3u8, ".ts?", fmt.Sprintf(".ts?spbhid=%v&&", v.SRSProxyBackendHLSID)) + } else { + m3u8 = strings.ReplaceAll(m3u8, ".ts", fmt.Sprintf(".ts?spbhid=%v", v.SRSProxyBackendHLSID)) + } + + if _, err := io.Copy(w, strings.NewReader(m3u8)); err != nil { + return errors.Wrapf(err, "proxy m3u8 client to %v", backendURL) + } + + return nil +} diff --git a/proxy/logger/context.go b/proxy/logger/context.go new file mode 100644 index 0000000000..ef15a7d4fb --- /dev/null +++ b/proxy/logger/context.go @@ -0,0 +1,43 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package logger + +import ( + "context" + "crypto/rand" + "crypto/sha256" + "encoding/hex" +) + +type key string + +var cidKey key = "cid.proxy.ossrs.org" + +// generateContextID generates a random context id in string. +func GenerateContextID() string { + randomBytes := make([]byte, 32) + _, _ = rand.Read(randomBytes) + hash := sha256.Sum256(randomBytes) + hashString := hex.EncodeToString(hash[:]) + cid := hashString[:7] + return cid +} + +// WithContext creates a new context with cid, which will be used for log. +func WithContext(ctx context.Context) context.Context { + return WithContextID(ctx, GenerateContextID()) +} + +// WithContextID creates a new context with cid, which will be used for log. +func WithContextID(ctx context.Context, cid string) context.Context { + return context.WithValue(ctx, cidKey, cid) +} + +// ContextID returns the cid in context, or empty string if not set. +func ContextID(ctx context.Context) string { + if cid, ok := ctx.Value(cidKey).(string); ok { + return cid + } + return "" +} diff --git a/proxy/logger/log.go b/proxy/logger/log.go new file mode 100644 index 0000000000..debbe1a847 --- /dev/null +++ b/proxy/logger/log.go @@ -0,0 +1,87 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package logger + +import ( + "context" + "io/ioutil" + stdLog "log" + "os" +) + +type logger interface { + Printf(ctx context.Context, format string, v ...any) +} + +type loggerPlus struct { + logger *stdLog.Logger + level string +} + +func newLoggerPlus(opts ...func(*loggerPlus)) *loggerPlus { + v := &loggerPlus{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *loggerPlus) Printf(ctx context.Context, f string, a ...interface{}) { + format, args := f, a + if cid := ContextID(ctx); cid != "" { + format, args = "[%v][%v][%v] "+format, append([]interface{}{v.level, os.Getpid(), cid}, a...) + } + + v.logger.Printf(format, args...) +} + +var verboseLogger logger + +func Vf(ctx context.Context, format string, a ...interface{}) { + verboseLogger.Printf(ctx, format, a...) +} + +var debugLogger logger + +func Df(ctx context.Context, format string, a ...interface{}) { + debugLogger.Printf(ctx, format, a...) +} + +var warnLogger logger + +func Wf(ctx context.Context, format string, a ...interface{}) { + warnLogger.Printf(ctx, format, a...) +} + +var errorLogger logger + +func Ef(ctx context.Context, format string, a ...interface{}) { + errorLogger.Printf(ctx, format, a...) +} + +const ( + logVerboseLabel = "verb" + logDebugLabel = "debug" + logWarnLabel = "warn" + logErrorLabel = "error" +) + +func init() { + verboseLogger = newLoggerPlus(func(logger *loggerPlus) { + logger.logger = stdLog.New(ioutil.Discard, "", stdLog.Ldate|stdLog.Ltime|stdLog.Lmicroseconds) + logger.level = logVerboseLabel + }) + debugLogger = newLoggerPlus(func(logger *loggerPlus) { + logger.logger = stdLog.New(os.Stdout, "", stdLog.Ldate|stdLog.Ltime|stdLog.Lmicroseconds) + logger.level = logDebugLabel + }) + warnLogger = newLoggerPlus(func(logger *loggerPlus) { + logger.logger = stdLog.New(os.Stderr, "", stdLog.Ldate|stdLog.Ltime|stdLog.Lmicroseconds) + logger.level = logWarnLabel + }) + errorLogger = newLoggerPlus(func(logger *loggerPlus) { + logger.logger = stdLog.New(os.Stderr, "", stdLog.Ldate|stdLog.Ltime|stdLog.Lmicroseconds) + logger.level = logErrorLabel + }) +} diff --git a/proxy/main.go b/proxy/main.go new file mode 100644 index 0000000000..6327a7cf80 --- /dev/null +++ b/proxy/main.go @@ -0,0 +1,121 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "os" + + "srs-proxy/errors" + "srs-proxy/logger" +) + +func main() { + ctx := logger.WithContext(context.Background()) + logger.Df(ctx, "%v/%v started", Signature(), Version()) + + // Install signals. + ctx, cancel := context.WithCancel(ctx) + installSignals(ctx, cancel) + + // Start the main loop, ignore the user cancel error. + err := doMain(ctx) + if err != nil && ctx.Err() != context.Canceled { + logger.Ef(ctx, "main: %+v", err) + os.Exit(-1) + } + + logger.Df(ctx, "%v done", Signature()) +} + +func doMain(ctx context.Context) error { + // Setup the environment variables. + if err := loadEnvFile(ctx); err != nil { + return errors.Wrapf(err, "load env") + } + + buildDefaultEnvironmentVariables(ctx) + + // When cancelled, the program is forced to exit due to a timeout. Normally, this doesn't occur + // because the main thread exits after the context is cancelled. However, sometimes the main thread + // may be blocked for some reason, so a forced exit is necessary to ensure the program terminates. + if err := installForceQuit(ctx); err != nil { + return errors.Wrapf(err, "install force quit") + } + + // Start the Go pprof if enabled. + handleGoPprof(ctx) + + // Initialize SRS load balancers. + switch lbType := envLoadBalancerType(); lbType { + case "memory": + srsLoadBalancer = NewMemoryLoadBalancer() + case "redis": + srsLoadBalancer = NewRedisLoadBalancer() + default: + return errors.Errorf("invalid load balancer %v", lbType) + } + + if err := srsLoadBalancer.Initialize(ctx); err != nil { + return errors.Wrapf(err, "initialize srs load balancer") + } + + // Parse the gracefully quit timeout. + gracefulQuitTimeout, err := parseGracefullyQuitTimeout() + if err != nil { + return errors.Wrapf(err, "parse gracefully quit timeout") + } + + // Start the RTMP server. + srsRTMPServer := NewSRSRTMPServer() + defer srsRTMPServer.Close() + if err := srsRTMPServer.Run(ctx); err != nil { + return errors.Wrapf(err, "rtmp server") + } + + // Start the WebRTC server. + srsWebRTCServer := NewSRSWebRTCServer() + defer srsWebRTCServer.Close() + if err := srsWebRTCServer.Run(ctx); err != nil { + return errors.Wrapf(err, "rtc server") + } + + // Start the HTTP API server. + srsHTTPAPIServer := NewSRSHTTPAPIServer(func(server *srsHTTPAPIServer) { + server.gracefulQuitTimeout, server.rtc = gracefulQuitTimeout, srsWebRTCServer + }) + defer srsHTTPAPIServer.Close() + if err := srsHTTPAPIServer.Run(ctx); err != nil { + return errors.Wrapf(err, "http api server") + } + + // Start the SRT server. + srsSRTServer := NewSRSSRTServer() + defer srsSRTServer.Close() + if err := srsSRTServer.Run(ctx); err != nil { + return errors.Wrapf(err, "srt server") + } + + // Start the System API server. + systemAPI := NewSystemAPI(func(server *systemAPI) { + server.gracefulQuitTimeout = gracefulQuitTimeout + }) + defer systemAPI.Close() + if err := systemAPI.Run(ctx); err != nil { + return errors.Wrapf(err, "system api server") + } + + // Start the HTTP web server. + srsHTTPStreamServer := NewSRSHTTPStreamServer(func(server *srsHTTPStreamServer) { + server.gracefulQuitTimeout = gracefulQuitTimeout + }) + defer srsHTTPStreamServer.Close() + if err := srsHTTPStreamServer.Run(ctx); err != nil { + return errors.Wrapf(err, "http server") + } + + // Wait for the main loop to quit. + <-ctx.Done() + return nil +} diff --git a/proxy/rtc.go b/proxy/rtc.go new file mode 100644 index 0000000000..5a7d9936c7 --- /dev/null +++ b/proxy/rtc.go @@ -0,0 +1,515 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "encoding/binary" + "fmt" + "io/ioutil" + "net" + "net/http" + "strconv" + "strings" + stdSync "sync" + + "srs-proxy/errors" + "srs-proxy/logger" + "srs-proxy/sync" +) + +// srsWebRTCServer is the proxy for SRS WebRTC server via WHIP or WHEP protocol. It will figure out +// which backend server to proxy to. It will also replace the UDP port to the proxy server's in the +// SDP answer. +type srsWebRTCServer struct { + // The UDP listener for WebRTC server. + listener *net.UDPConn + + // Fast cache for the username to identify the connection. + // The key is username, the value is the UDP address. + usernames sync.Map[string, *RTCConnection] + // Fast cache for the udp address to identify the connection. + // The key is UDP address, the value is the username. + // TODO: Support fast earch by uint64 address. + addresses sync.Map[string, *RTCConnection] + + // The wait group for server. + wg stdSync.WaitGroup +} + +func NewSRSWebRTCServer(opts ...func(*srsWebRTCServer)) *srsWebRTCServer { + v := &srsWebRTCServer{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *srsWebRTCServer) Close() error { + if v.listener != nil { + _ = v.listener.Close() + } + + v.wg.Wait() + return nil +} + +func (v *srsWebRTCServer) HandleApiForWHIP(ctx context.Context, w http.ResponseWriter, r *http.Request) error { + defer r.Body.Close() + ctx = logger.WithContext(ctx) + + // Always allow CORS for all requests. + if ok := apiCORS(ctx, w, r); ok { + return nil + } + + // Read remote SDP offer from body. + remoteSDPOffer, err := ioutil.ReadAll(r.Body) + if err != nil { + return errors.Wrapf(err, "read remote sdp offer") + } + + // Build the stream URL in vhost/app/stream schema. + unifiedURL, fullURL := convertURLToStreamURL(r) + logger.Df(ctx, "Got WebRTC WHIP from %v with %vB offer for %v", r.RemoteAddr, len(remoteSDPOffer), fullURL) + + streamURL, err := buildStreamURL(unifiedURL) + if err != nil { + return errors.Wrapf(err, "build stream url %v", unifiedURL) + } + + // Pick a backend SRS server to proxy the RTMP stream. + backend, err := srsLoadBalancer.Pick(ctx, streamURL) + if err != nil { + return errors.Wrapf(err, "pick backend for %v", streamURL) + } + + if err = v.proxyApiToBackend(ctx, w, r, backend, string(remoteSDPOffer), streamURL); err != nil { + return errors.Wrapf(err, "serve %v with %v by backend %+v", fullURL, streamURL, backend) + } + + return nil +} + +func (v *srsWebRTCServer) HandleApiForWHEP(ctx context.Context, w http.ResponseWriter, r *http.Request) error { + defer r.Body.Close() + ctx = logger.WithContext(ctx) + + // Always allow CORS for all requests. + if ok := apiCORS(ctx, w, r); ok { + return nil + } + + // Read remote SDP offer from body. + remoteSDPOffer, err := ioutil.ReadAll(r.Body) + if err != nil { + return errors.Wrapf(err, "read remote sdp offer") + } + + // Build the stream URL in vhost/app/stream schema. + unifiedURL, fullURL := convertURLToStreamURL(r) + logger.Df(ctx, "Got WebRTC WHEP from %v with %vB offer for %v", r.RemoteAddr, len(remoteSDPOffer), fullURL) + + streamURL, err := buildStreamURL(unifiedURL) + if err != nil { + return errors.Wrapf(err, "build stream url %v", unifiedURL) + } + + // Pick a backend SRS server to proxy the RTMP stream. + backend, err := srsLoadBalancer.Pick(ctx, streamURL) + if err != nil { + return errors.Wrapf(err, "pick backend for %v", streamURL) + } + + if err = v.proxyApiToBackend(ctx, w, r, backend, string(remoteSDPOffer), streamURL); err != nil { + return errors.Wrapf(err, "serve %v with %v by backend %+v", fullURL, streamURL, backend) + } + + return nil +} + +func (v *srsWebRTCServer) proxyApiToBackend( + ctx context.Context, w http.ResponseWriter, r *http.Request, backend *SRSServer, + remoteSDPOffer string, streamURL string, +) error { + // Parse HTTP port from backend. + if len(backend.API) == 0 { + return errors.Errorf("no http api server") + } + + var apiPort int + if iv, err := strconv.ParseInt(backend.API[0], 10, 64); err != nil { + return errors.Wrapf(err, "parse http port %v", backend.API[0]) + } else { + apiPort = int(iv) + } + + // Connect to backend SRS server via HTTP client. + backendURL := fmt.Sprintf("http://%v:%v%s", backend.IP, apiPort, r.URL.Path) + if r.URL.RawQuery != "" { + backendURL += "?" + r.URL.RawQuery + } + + req, err := http.NewRequestWithContext(ctx, r.Method, backendURL, strings.NewReader(remoteSDPOffer)) + if err != nil { + return errors.Wrapf(err, "create request to %v", backendURL) + } + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return errors.Errorf("do request to %v EOF", backendURL) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { + return errors.Errorf("proxy api to %v failed, status=%v", backendURL, resp.Status) + } + + // Copy all headers from backend to client. + w.WriteHeader(resp.StatusCode) + for k, v := range resp.Header { + for _, vv := range v { + w.Header().Add(k, vv) + } + } + + // Parse the local SDP answer from backend. + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + return errors.Wrapf(err, "read stream from %v", backendURL) + } + + // Replace the WebRTC UDP port in answer. + localSDPAnswer := string(b) + for _, endpoint := range backend.RTC { + _, _, port, err := parseListenEndpoint(endpoint) + if err != nil { + return errors.Wrapf(err, "parse endpoint %v", endpoint) + } + + from := fmt.Sprintf(" %v typ host", port) + to := fmt.Sprintf(" %v typ host", envWebRTCServer()) + localSDPAnswer = strings.Replace(localSDPAnswer, from, to, -1) + } + + // Fetch the ice-ufrag and ice-pwd from local SDP answer. + remoteICEUfrag, remoteICEPwd, err := parseIceUfragPwd(remoteSDPOffer) + if err != nil { + return errors.Wrapf(err, "parse remote sdp offer") + } + + localICEUfrag, localICEPwd, err := parseIceUfragPwd(localSDPAnswer) + if err != nil { + return errors.Wrapf(err, "parse local sdp answer") + } + + // Save the new WebRTC connection to LB. + icePair := &RTCICEPair{ + RemoteICEUfrag: remoteICEUfrag, RemoteICEPwd: remoteICEPwd, + LocalICEUfrag: localICEUfrag, LocalICEPwd: localICEPwd, + } + if err := srsLoadBalancer.StoreWebRTC(ctx, streamURL, NewRTCConnection(func(c *RTCConnection) { + c.StreamURL, c.Ufrag = streamURL, icePair.Ufrag() + c.Initialize(ctx, v.listener) + + // Cache the connection for fast search by username. + v.usernames.Store(c.Ufrag, c) + })); err != nil { + return errors.Wrapf(err, "load or store webrtc %v", streamURL) + } + + // Response client with local answer. + if _, err = w.Write([]byte(localSDPAnswer)); err != nil { + return errors.Wrapf(err, "write local sdp answer %v", localSDPAnswer) + } + + logger.Df(ctx, "Create WebRTC connection with local answer %vB with ice-ufrag=%v, ice-pwd=%vB", + len(localSDPAnswer), localICEUfrag, len(localICEPwd)) + return nil +} + +func (v *srsWebRTCServer) Run(ctx context.Context) error { + // Parse address to listen. + endpoint := envWebRTCServer() + if !strings.Contains(endpoint, ":") { + endpoint = fmt.Sprintf(":%v", endpoint) + } + + saddr, err := net.ResolveUDPAddr("udp", endpoint) + if err != nil { + return errors.Wrapf(err, "resolve udp addr %v", endpoint) + } + + listener, err := net.ListenUDP("udp", saddr) + if err != nil { + return errors.Wrapf(err, "listen udp %v", saddr) + } + v.listener = listener + logger.Df(ctx, "WebRTC server listen at %v", saddr) + + // Consume all messages from UDP media transport. + v.wg.Add(1) + go func() { + defer v.wg.Done() + + for ctx.Err() == nil { + buf := make([]byte, 4096) + n, caddr, err := listener.ReadFromUDP(buf) + if err != nil { + // TODO: If WebRTC server closed unexpectedly, we should notice the main loop to quit. + logger.Wf(ctx, "read from udp failed, err=%+v", err) + continue + } + + if err := v.handleClientUDP(ctx, caddr, buf[:n]); err != nil { + logger.Wf(ctx, "handle udp %vB failed, addr=%v, err=%+v", n, caddr, err) + } + } + }() + + return nil +} + +func (v *srsWebRTCServer) handleClientUDP(ctx context.Context, addr *net.UDPAddr, data []byte) error { + var connection *RTCConnection + + // If STUN binding request, parse the ufrag and identify the connection. + if err := func() error { + if rtcIsRTPOrRTCP(data) || !rtcIsSTUN(data) { + return nil + } + + var pkt RTCStunPacket + if err := pkt.UnmarshalBinary(data); err != nil { + return errors.Wrapf(err, "unmarshal stun packet") + } + + // Search the connection in fast cache. + if s, ok := v.usernames.Load(pkt.Username); ok { + connection = s + return nil + } + + // Load connection by username. + if s, err := srsLoadBalancer.LoadWebRTCByUfrag(ctx, pkt.Username); err != nil { + return errors.Wrapf(err, "load webrtc by ufrag %v", pkt.Username) + } else { + connection = s.Initialize(ctx, v.listener) + logger.Df(ctx, "Create WebRTC connection by ufrag=%v, stream=%v", pkt.Username, connection.StreamURL) + } + + // Cache connection for fast search. + if connection != nil { + v.usernames.Store(pkt.Username, connection) + } + return nil + }(); err != nil { + return err + } + + // Search the connection by addr. + if s, ok := v.addresses.Load(addr.String()); ok { + connection = s + } else if connection != nil { + // Cache the address for fast search. + v.addresses.Store(addr.String(), connection) + } + + // If connection is not found, ignore the packet. + if connection == nil { + // TODO: Should logging the dropped packet, only logging the first one for each address. + return nil + } + + // Proxy the packet to backend. + if err := connection.HandlePacket(addr, data); err != nil { + return errors.Wrapf(err, "proxy %vB for %v", len(data), connection.StreamURL) + } + + return nil +} + +// RTCConnection is a WebRTC connection proxy, for both WHIP and WHEP. It represents a WebRTC +// connection, identify by the ufrag in sdp offer/answer and ICE binding request. +// +// It's not like RTMP or HTTP FLV/TS proxy connection, which are stateless and all state is +// in the client request. The RTCConnection is stateful, and need to sync the ufrag between +// proxy servers. +// +// The media transport is UDP, which is also a special thing for WebRTC. So if the client switch +// to another UDP address, it may connect to another WebRTC proxy, then we should discover the +// RTCConnection by the ufrag from the ICE binding request. +type RTCConnection struct { + // The stream context for WebRTC streaming. + ctx context.Context + + // The stream URL in vhost/app/stream schema. + StreamURL string `json:"stream_url"` + // The ufrag for this WebRTC connection. + Ufrag string `json:"ufrag"` + + // The UDP connection proxy to backend. + backendUDP *net.UDPConn + // The client UDP address. Note that it may change. + clientUDP *net.UDPAddr + // The listener UDP connection, used to send messages to client. + listenerUDP *net.UDPConn +} + +func NewRTCConnection(opts ...func(*RTCConnection)) *RTCConnection { + v := &RTCConnection{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *RTCConnection) Initialize(ctx context.Context, listener *net.UDPConn) *RTCConnection { + if v.ctx == nil { + v.ctx = logger.WithContext(ctx) + } + if listener != nil { + v.listenerUDP = listener + } + return v +} + +func (v *RTCConnection) HandlePacket(addr *net.UDPAddr, data []byte) error { + ctx := v.ctx + + // Update the current UDP address. + v.clientUDP = addr + + // Start the UDP proxy to backend. + if err := v.connectBackend(ctx); err != nil { + return errors.Wrapf(err, "connect backend for %v", v.StreamURL) + } + + // Proxy client message to backend. + if v.backendUDP == nil { + return nil + } + + // Proxy all messages from backend to client. + go func() { + for ctx.Err() == nil { + buf := make([]byte, 4096) + n, _, err := v.backendUDP.ReadFromUDP(buf) + if err != nil { + // TODO: If backend server closed unexpectedly, we should notice the stream to quit. + logger.Wf(ctx, "read from backend failed, err=%v", err) + break + } + + if _, err = v.listenerUDP.WriteToUDP(buf[:n], v.clientUDP); err != nil { + // TODO: If backend server closed unexpectedly, we should notice the stream to quit. + logger.Wf(ctx, "write to client failed, err=%v", err) + break + } + } + }() + + if _, err := v.backendUDP.Write(data); err != nil { + return errors.Wrapf(err, "write to backend %v", v.StreamURL) + } + + return nil +} + +func (v *RTCConnection) connectBackend(ctx context.Context) error { + if v.backendUDP != nil { + return nil + } + + // Pick a backend SRS server to proxy the RTC stream. + backend, err := srsLoadBalancer.Pick(ctx, v.StreamURL) + if err != nil { + return errors.Wrapf(err, "pick backend") + } + + // Parse UDP port from backend. + if len(backend.RTC) == 0 { + return errors.Errorf("no udp server") + } + + _, _, udpPort, err := parseListenEndpoint(backend.RTC[0]) + if err != nil { + return errors.Wrapf(err, "parse udp port %v of %v for %v", backend.RTC[0], backend, v.StreamURL) + } + + // Connect to backend SRS server via UDP client. + // TODO: FIXME: Support close the connection when timeout or DTLS alert. + backendAddr := net.UDPAddr{IP: net.ParseIP(backend.IP), Port: int(udpPort)} + if backendUDP, err := net.DialUDP("udp", nil, &backendAddr); err != nil { + return errors.Wrapf(err, "dial udp to %v", backendAddr) + } else { + v.backendUDP = backendUDP + } + + return nil +} + +type RTCICEPair struct { + // The remote ufrag, used for ICE username and session id. + RemoteICEUfrag string `json:"remote_ufrag"` + // The remote pwd, used for ICE password. + RemoteICEPwd string `json:"remote_pwd"` + // The local ufrag, used for ICE username and session id. + LocalICEUfrag string `json:"local_ufrag"` + // The local pwd, used for ICE password. + LocalICEPwd string `json:"local_pwd"` +} + +// Generate the ICE ufrag for the WebRTC streaming, format is remote-ufrag:local-ufrag. +func (v *RTCICEPair) Ufrag() string { + return fmt.Sprintf("%v:%v", v.LocalICEUfrag, v.RemoteICEUfrag) +} + +type RTCStunPacket struct { + // The stun message type. + MessageType uint16 + // The stun username, or ufrag. + Username string +} + +func (v *RTCStunPacket) UnmarshalBinary(data []byte) error { + if len(data) < 20 { + return errors.Errorf("stun packet too short %v", len(data)) + } + + p := data + v.MessageType = binary.BigEndian.Uint16(p) + messageLen := binary.BigEndian.Uint16(p[2:]) + //magicCookie := p[:8] + //transactionID := p[:20] + p = p[20:] + + if len(p) != int(messageLen) { + return errors.Errorf("stun packet length invalid %v != %v", len(data), messageLen) + } + + for len(p) > 0 { + typ := binary.BigEndian.Uint16(p) + length := binary.BigEndian.Uint16(p[2:]) + p = p[4:] + + if len(p) < int(length) { + return errors.Errorf("stun attribute length invalid %v < %v", len(p), length) + } + + value := p[:length] + p = p[length:] + + if length%4 != 0 { + p = p[4-length%4:] + } + + switch typ { + case 0x0006: + v.Username = string(value) + } + } + + return nil +} diff --git a/proxy/rtmp.go b/proxy/rtmp.go new file mode 100644 index 0000000000..d93f04b3a6 --- /dev/null +++ b/proxy/rtmp.go @@ -0,0 +1,655 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "fmt" + "math/rand" + "net" + "strconv" + "strings" + "sync" + "time" + + "srs-proxy/errors" + "srs-proxy/logger" + "srs-proxy/rtmp" +) + +// srsRTMPServer is the proxy for SRS RTMP server, to proxy the RTMP stream to backend SRS +// server. It will figure out the backend server to proxy to. Unlike the edge server, it will +// not cache the stream, but just proxy the stream to backend. +type srsRTMPServer struct { + // The TCP listener for RTMP server. + listener *net.TCPListener + // The random number generator. + rd *rand.Rand + // The wait group for all goroutines. + wg sync.WaitGroup +} + +func NewSRSRTMPServer(opts ...func(*srsRTMPServer)) *srsRTMPServer { + v := &srsRTMPServer{ + rd: rand.New(rand.NewSource(time.Now().UnixNano())), + } + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *srsRTMPServer) Close() error { + if v.listener != nil { + v.listener.Close() + } + + v.wg.Wait() + return nil +} + +func (v *srsRTMPServer) Run(ctx context.Context) error { + endpoint := envRtmpServer() + if !strings.Contains(endpoint, ":") { + endpoint = ":" + endpoint + } + + addr, err := net.ResolveTCPAddr("tcp", endpoint) + if err != nil { + return errors.Wrapf(err, "resolve rtmp addr %v", endpoint) + } + + listener, err := net.ListenTCP("tcp", addr) + if err != nil { + return errors.Wrapf(err, "listen rtmp addr %v", addr) + } + v.listener = listener + logger.Df(ctx, "RTMP server listen at %v", addr) + + v.wg.Add(1) + go func() { + defer v.wg.Done() + + for { + conn, err := v.listener.AcceptTCP() + if err != nil { + if ctx.Err() != context.Canceled { + // TODO: If RTMP server closed unexpectedly, we should notice the main loop to quit. + logger.Wf(ctx, "RTMP server accept err %+v", err) + } else { + logger.Df(ctx, "RTMP server done") + } + return + } + + v.wg.Add(1) + go func(ctx context.Context, conn *net.TCPConn) { + defer v.wg.Done() + defer conn.Close() + + handleErr := func(err error) { + if isPeerClosedError(err) { + logger.Df(ctx, "RTMP peer is closed") + } else { + logger.Wf(ctx, "RTMP serve err %+v", err) + } + } + + rc := NewRTMPConnection(func(client *RTMPConnection) { + client.rd = v.rd + }) + if err := rc.serve(ctx, conn); err != nil { + handleErr(err) + } else { + logger.Df(ctx, "RTMP client done") + } + }(logger.WithContext(ctx), conn) + } + }() + + return nil +} + +// RTMPConnection is an RTMP streaming connection. There is no state need to be sync between +// proxy servers. +// +// When we got an RTMP request, we will parse the stream URL from the RTMP publish or play request, +// then proxy to the corresponding backend server. All state is in the RTMP request, so this +// connection is stateless. +type RTMPConnection struct { + // The random number generator. + rd *rand.Rand +} + +func NewRTMPConnection(opts ...func(*RTMPConnection)) *RTMPConnection { + v := &RTMPConnection{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *RTMPConnection) serve(ctx context.Context, conn *net.TCPConn) error { + logger.Df(ctx, "Got RTMP client from %v", conn.RemoteAddr()) + + // If any goroutine quit, cancel another one. + parentCtx := ctx + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + var backend *RTMPClientToBackend + if true { + go func() { + <-ctx.Done() + conn.Close() + if backend != nil { + backend.Close() + } + }() + } + + // Simple handshake with client. + hs := rtmp.NewHandshake(v.rd) + if _, err := hs.ReadC0S0(conn); err != nil { + return errors.Wrapf(err, "read c0") + } + if _, err := hs.ReadC1S1(conn); err != nil { + return errors.Wrapf(err, "read c1") + } + if err := hs.WriteC0S0(conn); err != nil { + return errors.Wrapf(err, "write s1") + } + if err := hs.WriteC1S1(conn); err != nil { + return errors.Wrapf(err, "write s1") + } + if err := hs.WriteC2S2(conn, hs.C1S1()); err != nil { + return errors.Wrapf(err, "write s2") + } + if _, err := hs.ReadC2S2(conn); err != nil { + return errors.Wrapf(err, "read c2") + } + + client := rtmp.NewProtocol(conn) + logger.Df(ctx, "RTMP simple handshake done") + + // Expect RTMP connect command with tcUrl. + var connectReq *rtmp.ConnectAppPacket + if _, err := rtmp.ExpectPacket(ctx, client, &connectReq); err != nil { + return errors.Wrapf(err, "expect connect req") + } + + if true { + ack := rtmp.NewWindowAcknowledgementSize() + ack.AckSize = 2500000 + if err := client.WritePacket(ctx, ack, 0); err != nil { + return errors.Wrapf(err, "write set ack size") + } + } + if true { + chunk := rtmp.NewSetChunkSize() + chunk.ChunkSize = 128 + if err := client.WritePacket(ctx, chunk, 0); err != nil { + return errors.Wrapf(err, "write set chunk size") + } + } + + connectRes := rtmp.NewConnectAppResPacket(connectReq.TransactionID) + connectRes.CommandObject.Set("fmsVer", rtmp.NewAmf0String("FMS/3,5,3,888")) + connectRes.CommandObject.Set("capabilities", rtmp.NewAmf0Number(127)) + connectRes.CommandObject.Set("mode", rtmp.NewAmf0Number(1)) + connectRes.Args.Set("level", rtmp.NewAmf0String("status")) + connectRes.Args.Set("code", rtmp.NewAmf0String("NetConnection.Connect.Success")) + connectRes.Args.Set("description", rtmp.NewAmf0String("Connection succeeded")) + connectRes.Args.Set("objectEncoding", rtmp.NewAmf0Number(0)) + connectResData := rtmp.NewAmf0EcmaArray() + connectResData.Set("version", rtmp.NewAmf0String("3,5,3,888")) + connectResData.Set("srs_version", rtmp.NewAmf0String(Version())) + connectResData.Set("srs_id", rtmp.NewAmf0String(logger.ContextID(ctx))) + connectRes.Args.Set("data", connectResData) + if err := client.WritePacket(ctx, connectRes, 0); err != nil { + return errors.Wrapf(err, "write connect res") + } + + tcUrl := connectReq.TcUrl() + logger.Df(ctx, "RTMP connect app %v", tcUrl) + + // Expect RTMP command to identify the client, a publisher or viewer. + var currentStreamID, nextStreamID int + var streamName string + var clientType RTMPClientType + for clientType == "" { + var identifyReq rtmp.Packet + if _, err := rtmp.ExpectPacket(ctx, client, &identifyReq); err != nil { + return errors.Wrapf(err, "expect identify req") + } + + var response rtmp.Packet + switch pkt := identifyReq.(type) { + case *rtmp.CallPacket: + if pkt.CommandName == "createStream" { + identifyRes := rtmp.NewCreateStreamResPacket(pkt.TransactionID) + response = identifyRes + + nextStreamID = 1 + identifyRes.StreamID = *rtmp.NewAmf0Number(float64(nextStreamID)) + } else if pkt.CommandName == "getStreamLength" { + // Ignore and do not reply these packets. + } else { + // For releaseStream, FCPublish, etc. + identifyRes := rtmp.NewCallPacket() + response = identifyRes + + identifyRes.TransactionID = pkt.TransactionID + identifyRes.CommandName = "_result" + identifyRes.CommandObject = rtmp.NewAmf0Null() + identifyRes.Args = rtmp.NewAmf0Undefined() + } + case *rtmp.PublishPacket: + streamName = string(pkt.StreamName) + clientType = RTMPClientTypePublisher + + identifyRes := rtmp.NewCallPacket() + response = identifyRes + + identifyRes.CommandName = "onFCPublish" + identifyRes.CommandObject = rtmp.NewAmf0Null() + + data := rtmp.NewAmf0Object() + data.Set("code", rtmp.NewAmf0String("NetStream.Publish.Start")) + data.Set("description", rtmp.NewAmf0String("Started publishing stream.")) + identifyRes.Args = data + case *rtmp.PlayPacket: + streamName = string(pkt.StreamName) + clientType = RTMPClientTypeViewer + + identifyRes := rtmp.NewCallPacket() + response = identifyRes + + identifyRes.CommandName = "onStatus" + identifyRes.CommandObject = rtmp.NewAmf0Null() + + data := rtmp.NewAmf0Object() + data.Set("level", rtmp.NewAmf0String("status")) + data.Set("code", rtmp.NewAmf0String("NetStream.Play.Reset")) + data.Set("description", rtmp.NewAmf0String("Playing and resetting stream.")) + data.Set("details", rtmp.NewAmf0String("stream")) + data.Set("clientid", rtmp.NewAmf0String("ASAICiss")) + identifyRes.Args = data + } + + if response != nil { + if err := client.WritePacket(ctx, response, currentStreamID); err != nil { + return errors.Wrapf(err, "write identify res for req=%v, stream=%v", + identifyReq, currentStreamID) + } + } + + // Update the stream ID for next request. + currentStreamID = nextStreamID + } + logger.Df(ctx, "RTMP identify tcUrl=%v, stream=%v, id=%v, type=%v", + tcUrl, streamName, currentStreamID, clientType) + + // Find a backend SRS server to proxy the RTMP stream. + backend = NewRTMPClientToBackend(func(client *RTMPClientToBackend) { + client.rd, client.typ = v.rd, clientType + }) + defer backend.Close() + + if err := backend.Connect(ctx, tcUrl, streamName); err != nil { + return errors.Wrapf(err, "connect backend, tcUrl=%v, stream=%v", tcUrl, streamName) + } + + // Start the streaming. + if clientType == RTMPClientTypePublisher { + identifyRes := rtmp.NewCallPacket() + + identifyRes.CommandName = "onStatus" + identifyRes.CommandObject = rtmp.NewAmf0Null() + + data := rtmp.NewAmf0Object() + data.Set("level", rtmp.NewAmf0String("status")) + data.Set("code", rtmp.NewAmf0String("NetStream.Publish.Start")) + data.Set("description", rtmp.NewAmf0String("Started publishing stream.")) + data.Set("clientid", rtmp.NewAmf0String("ASAICiss")) + identifyRes.Args = data + + if err := client.WritePacket(ctx, identifyRes, currentStreamID); err != nil { + return errors.Wrapf(err, "start publish") + } + } else if clientType == RTMPClientTypeViewer { + identifyRes := rtmp.NewCallPacket() + + identifyRes.CommandName = "onStatus" + identifyRes.CommandObject = rtmp.NewAmf0Null() + + data := rtmp.NewAmf0Object() + data.Set("level", rtmp.NewAmf0String("status")) + data.Set("code", rtmp.NewAmf0String("NetStream.Play.Start")) + data.Set("description", rtmp.NewAmf0String("Started playing stream.")) + data.Set("details", rtmp.NewAmf0String("stream")) + data.Set("clientid", rtmp.NewAmf0String("ASAICiss")) + identifyRes.Args = data + + if err := client.WritePacket(ctx, identifyRes, currentStreamID); err != nil { + return errors.Wrapf(err, "start play") + } + } + logger.Df(ctx, "RTMP start streaming") + + // For all proxy goroutines. + var wg sync.WaitGroup + defer wg.Wait() + + // Proxy all message from backend to client. + wg.Add(1) + var r0 error + go func() { + defer wg.Done() + defer cancel() + + r0 = func() error { + for { + m, err := backend.client.ReadMessage(ctx) + if err != nil { + return errors.Wrapf(err, "read message") + } + //logger.Df(ctx, "client<- %v %v %vB", m.MessageType, m.Timestamp, len(m.Payload)) + + // TODO: Update the stream ID if not the same. + if err := client.WriteMessage(ctx, m); err != nil { + return errors.Wrapf(err, "write message") + } + } + }() + }() + + // Proxy all messages from client to backend. + wg.Add(1) + var r1 error + go func() { + defer wg.Done() + defer cancel() + + r1 = func() error { + for { + m, err := client.ReadMessage(ctx) + if err != nil { + return errors.Wrapf(err, "read message") + } + //logger.Df(ctx, "client-> %v %v %vB", m.MessageType, m.Timestamp, len(m.Payload)) + + // TODO: Update the stream ID if not the same. + if err := backend.client.WriteMessage(ctx, m); err != nil { + return errors.Wrapf(err, "write message") + } + } + }() + }() + + // Wait until all goroutine quit. + wg.Wait() + + // Reset the error if caused by another goroutine. + if r0 != nil { + return errors.Wrapf(r0, "proxy backend->client") + } + if r1 != nil { + return errors.Wrapf(r1, "proxy client->backend") + } + + return parentCtx.Err() +} + +type RTMPClientType string + +const ( + RTMPClientTypePublisher RTMPClientType = "publisher" + RTMPClientTypeViewer RTMPClientType = "viewer" +) + +// RTMPClientToBackend is a RTMP client to proxy the RTMP stream to backend. +type RTMPClientToBackend struct { + // The random number generator. + rd *rand.Rand + // The underlayer tcp client. + tcpConn *net.TCPConn + // The RTMP protocol client. + client *rtmp.Protocol + // The stream type. + typ RTMPClientType +} + +func NewRTMPClientToBackend(opts ...func(*RTMPClientToBackend)) *RTMPClientToBackend { + v := &RTMPClientToBackend{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *RTMPClientToBackend) Close() error { + if v.tcpConn != nil { + v.tcpConn.Close() + } + return nil +} + +func (v *RTMPClientToBackend) Connect(ctx context.Context, tcUrl, streamName string) error { + // Build the stream URL in vhost/app/stream schema. + streamURL, err := buildStreamURL(fmt.Sprintf("%v/%v", tcUrl, streamName)) + if err != nil { + return errors.Wrapf(err, "build stream url %v/%v", tcUrl, streamName) + } + + // Pick a backend SRS server to proxy the RTMP stream. + backend, err := srsLoadBalancer.Pick(ctx, streamURL) + if err != nil { + return errors.Wrapf(err, "pick backend for %v", streamURL) + } + + // Parse RTMP port from backend. + if len(backend.RTMP) == 0 { + return errors.Errorf("no rtmp server %+v for %v", backend, streamURL) + } + + var rtmpPort int + if iv, err := strconv.ParseInt(backend.RTMP[0], 10, 64); err != nil { + return errors.Wrapf(err, "parse backend %+v rtmp port %v", backend, backend.RTMP[0]) + } else { + rtmpPort = int(iv) + } + + // Connect to backend SRS server via TCP client. + addr := &net.TCPAddr{IP: net.ParseIP(backend.IP), Port: rtmpPort} + c, err := net.DialTCP("tcp", nil, addr) + if err != nil { + return errors.Wrapf(err, "dial backend addr=%v, srs=%v", addr, backend) + } + v.tcpConn = c + + hs := rtmp.NewHandshake(v.rd) + client := rtmp.NewProtocol(c) + v.client = client + + // Simple RTMP handshake with server. + if err := hs.WriteC0S0(c); err != nil { + return errors.Wrapf(err, "write c0") + } + if err := hs.WriteC1S1(c); err != nil { + return errors.Wrapf(err, "write c1") + } + + if _, err = hs.ReadC0S0(c); err != nil { + return errors.Wrapf(err, "read s0") + } + if _, err := hs.ReadC1S1(c); err != nil { + return errors.Wrapf(err, "read s1") + } + if _, err = hs.ReadC2S2(c); err != nil { + return errors.Wrapf(err, "read c2") + } + logger.Df(ctx, "backend simple handshake done, server=%v", addr) + + if err := hs.WriteC2S2(c, hs.C1S1()); err != nil { + return errors.Wrapf(err, "write c2") + } + + // Connect RTMP app on tcUrl with server. + if true { + connectApp := rtmp.NewConnectAppPacket() + connectApp.CommandObject.Set("tcUrl", rtmp.NewAmf0String(tcUrl)) + if err := client.WritePacket(ctx, connectApp, 1); err != nil { + return errors.Wrapf(err, "write connect app") + } + } + + if true { + var connectAppRes *rtmp.ConnectAppResPacket + if _, err := rtmp.ExpectPacket(ctx, client, &connectAppRes); err != nil { + return errors.Wrapf(err, "expect connect app res") + } + logger.Df(ctx, "backend connect RTMP app, tcUrl=%v, id=%v", tcUrl, connectAppRes.SrsID()) + } + + // Play or view RTMP stream with server. + if v.typ == RTMPClientTypeViewer { + return v.play(ctx, client, streamName) + } + + // Publish RTMP stream with server. + return v.publish(ctx, client, streamName) +} + +func (v *RTMPClientToBackend) publish(ctx context.Context, client *rtmp.Protocol, streamName string) error { + if true { + identifyReq := rtmp.NewCallPacket() + identifyReq.CommandName = "releaseStream" + identifyReq.TransactionID = 2 + identifyReq.CommandObject = rtmp.NewAmf0Null() + identifyReq.Args = rtmp.NewAmf0String(streamName) + if err := client.WritePacket(ctx, identifyReq, 0); err != nil { + return errors.Wrapf(err, "releaseStream") + } + } + for { + var identifyRes *rtmp.CallPacket + if _, err := rtmp.ExpectPacket(ctx, client, &identifyRes); err != nil { + return errors.Wrapf(err, "expect releaseStream res") + } + if identifyRes.CommandName == "_result" { + break + } + } + + if true { + identifyReq := rtmp.NewCallPacket() + identifyReq.CommandName = "FCPublish" + identifyReq.TransactionID = 3 + identifyReq.CommandObject = rtmp.NewAmf0Null() + identifyReq.Args = rtmp.NewAmf0String(streamName) + if err := client.WritePacket(ctx, identifyReq, 0); err != nil { + return errors.Wrapf(err, "FCPublish") + } + } + for { + var identifyRes *rtmp.CallPacket + if _, err := rtmp.ExpectPacket(ctx, client, &identifyRes); err != nil { + return errors.Wrapf(err, "expect FCPublish res") + } + if identifyRes.CommandName == "_result" { + break + } + } + + var currentStreamID int + if true { + createStream := rtmp.NewCreateStreamPacket() + createStream.TransactionID = 4 + createStream.CommandObject = rtmp.NewAmf0Null() + if err := client.WritePacket(ctx, createStream, 0); err != nil { + return errors.Wrapf(err, "createStream") + } + } + for { + var identifyRes *rtmp.CreateStreamResPacket + if _, err := rtmp.ExpectPacket(ctx, client, &identifyRes); err != nil { + return errors.Wrapf(err, "expect createStream res") + } + if sid := identifyRes.StreamID; sid != 0 { + currentStreamID = int(sid) + break + } + } + + if true { + publishStream := rtmp.NewPublishPacket() + publishStream.TransactionID = 5 + publishStream.CommandObject = rtmp.NewAmf0Null() + publishStream.StreamName = *rtmp.NewAmf0String(streamName) + publishStream.StreamType = *rtmp.NewAmf0String("live") + if err := client.WritePacket(ctx, publishStream, currentStreamID); err != nil { + return errors.Wrapf(err, "publish") + } + } + for { + var identifyRes *rtmp.CallPacket + if _, err := rtmp.ExpectPacket(ctx, client, &identifyRes); err != nil { + return errors.Wrapf(err, "expect publish res") + } + // Ignore onFCPublish, expect onStatus(NetStream.Publish.Start). + if identifyRes.CommandName == "onStatus" { + if data := rtmp.NewAmf0Converter(identifyRes.Args).ToObject(); data == nil { + return errors.Errorf("onStatus args not object") + } else if code := rtmp.NewAmf0Converter(data.Get("code")).ToString(); code == nil { + return errors.Errorf("onStatus code not string") + } else if *code != "NetStream.Publish.Start" { + return errors.Errorf("onStatus code=%v not NetStream.Publish.Start", *code) + } + break + } + } + logger.Df(ctx, "backend publish stream=%v, sid=%v", streamName, currentStreamID) + + return nil +} + +func (v *RTMPClientToBackend) play(ctx context.Context, client *rtmp.Protocol, streamName string) error { + var currentStreamID int + if true { + createStream := rtmp.NewCreateStreamPacket() + createStream.TransactionID = 4 + createStream.CommandObject = rtmp.NewAmf0Null() + if err := client.WritePacket(ctx, createStream, 0); err != nil { + return errors.Wrapf(err, "createStream") + } + } + for { + var identifyRes *rtmp.CreateStreamResPacket + if _, err := rtmp.ExpectPacket(ctx, client, &identifyRes); err != nil { + return errors.Wrapf(err, "expect createStream res") + } + if sid := identifyRes.StreamID; sid != 0 { + currentStreamID = int(sid) + break + } + } + + playStream := rtmp.NewPlayPacket() + playStream.StreamName = *rtmp.NewAmf0String(streamName) + if err := client.WritePacket(ctx, playStream, currentStreamID); err != nil { + return errors.Wrapf(err, "play") + } + + for { + var identifyRes *rtmp.CallPacket + if _, err := rtmp.ExpectPacket(ctx, client, &identifyRes); err != nil { + return errors.Wrapf(err, "expect releaseStream res") + } + if identifyRes.CommandName == "onStatus" && identifyRes.ArgsCode() == "NetStream.Play.Start" { + break + } + } + return nil +} diff --git a/proxy/rtmp/amf0.go b/proxy/rtmp/amf0.go new file mode 100644 index 0000000000..a013d5eccb --- /dev/null +++ b/proxy/rtmp/amf0.go @@ -0,0 +1,771 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package rtmp + +import ( + "bytes" + "encoding" + "encoding/binary" + "fmt" + "math" + "sync" + + "srs-proxy/errors" +) + +// Please read @doc amf0_spec_121207.pdf, @page 4, @section 2.1 Types Overview +type amf0Marker uint8 + +const ( + amf0MarkerNumber amf0Marker = iota // 0 + amf0MarkerBoolean // 1 + amf0MarkerString // 2 + amf0MarkerObject // 3 + amf0MarkerMovieClip // 4 + amf0MarkerNull // 5 + amf0MarkerUndefined // 6 + amf0MarkerReference // 7 + amf0MarkerEcmaArray // 8 + amf0MarkerObjectEnd // 9 + amf0MarkerStrictArray // 10 + amf0MarkerDate // 11 + amf0MarkerLongString // 12 + amf0MarkerUnsupported // 13 + amf0MarkerRecordSet // 14 + amf0MarkerXmlDocument // 15 + amf0MarkerTypedObject // 16 + amf0MarkerAvmPlusObject // 17 + + amf0MarkerForbidden amf0Marker = 0xff +) + +func (v amf0Marker) String() string { + switch v { + case amf0MarkerNumber: + return "Amf0Number" + case amf0MarkerBoolean: + return "amf0Boolean" + case amf0MarkerString: + return "Amf0String" + case amf0MarkerObject: + return "Amf0Object" + case amf0MarkerNull: + return "Null" + case amf0MarkerUndefined: + return "Undefined" + case amf0MarkerReference: + return "Reference" + case amf0MarkerEcmaArray: + return "EcmaArray" + case amf0MarkerObjectEnd: + return "ObjectEnd" + case amf0MarkerStrictArray: + return "StrictArray" + case amf0MarkerDate: + return "Date" + case amf0MarkerLongString: + return "LongString" + case amf0MarkerUnsupported: + return "Unsupported" + case amf0MarkerXmlDocument: + return "XmlDocument" + case amf0MarkerTypedObject: + return "TypedObject" + case amf0MarkerAvmPlusObject: + return "AvmPlusObject" + case amf0MarkerMovieClip: + return "MovieClip" + case amf0MarkerRecordSet: + return "RecordSet" + default: + return "Forbidden" + } +} + +// For utest to mock it. +type amf0Buffer interface { + Bytes() []byte + WriteByte(c byte) error + Write(p []byte) (n int, err error) +} + +var createBuffer = func() amf0Buffer { + return &bytes.Buffer{} +} + +// All AMF0 things. +type amf0Any interface { + // Binary marshaler and unmarshaler. + encoding.BinaryUnmarshaler + encoding.BinaryMarshaler + // Get the size of bytes to marshal this object. + Size() int + + // Get the Marker of any AMF0 stuff. + amf0Marker() amf0Marker +} + +type amf0Converter struct { + from amf0Any +} + +func NewAmf0Converter(from amf0Any) *amf0Converter { + return &amf0Converter{from: from} +} + +func (v *amf0Converter) ToNumber() *amf0Number { + return amf0AnyTo[*amf0Number](v.from) +} + +func (v *amf0Converter) ToBoolean() *amf0Boolean { + return amf0AnyTo[*amf0Boolean](v.from) +} + +func (v *amf0Converter) ToString() *amf0String { + return amf0AnyTo[*amf0String](v.from) +} + +func (v *amf0Converter) ToObject() *amf0Object { + return amf0AnyTo[*amf0Object](v.from) +} + +func (v *amf0Converter) ToNull() *amf0Null { + return amf0AnyTo[*amf0Null](v.from) +} + +func (v *amf0Converter) ToUndefined() *amf0Undefined { + return amf0AnyTo[*amf0Undefined](v.from) +} + +func (v *amf0Converter) ToEcmaArray() *amf0EcmaArray { + return amf0AnyTo[*amf0EcmaArray](v.from) +} + +func (v *amf0Converter) ToStrictArray() *amf0StrictArray { + return amf0AnyTo[*amf0StrictArray](v.from) +} + +// Convert any to specified object. +func amf0AnyTo[T amf0Any](a amf0Any) T { + var to T + if a != nil { + if v, ok := a.(T); ok { + return v + } + } + return to +} + +// Discovery the amf0 object from the bytes b. +func Amf0Discovery(p []byte) (a amf0Any, err error) { + if len(p) < 1 { + return nil, errors.Errorf("require 1 bytes only %v", len(p)) + } + m := amf0Marker(p[0]) + + switch m { + case amf0MarkerNumber: + return NewAmf0Number(0), nil + case amf0MarkerBoolean: + return NewAmf0Boolean(false), nil + case amf0MarkerString: + return NewAmf0String(""), nil + case amf0MarkerObject: + return NewAmf0Object(), nil + case amf0MarkerNull: + return NewAmf0Null(), nil + case amf0MarkerUndefined: + return NewAmf0Undefined(), nil + case amf0MarkerReference: + case amf0MarkerEcmaArray: + return NewAmf0EcmaArray(), nil + case amf0MarkerObjectEnd: + return &amf0ObjectEOF{}, nil + case amf0MarkerStrictArray: + return NewAmf0StrictArray(), nil + case amf0MarkerDate, amf0MarkerLongString, amf0MarkerUnsupported, amf0MarkerXmlDocument, + amf0MarkerTypedObject, amf0MarkerAvmPlusObject, amf0MarkerForbidden, amf0MarkerMovieClip, + amf0MarkerRecordSet: + return nil, errors.Errorf("Marker %v is not supported", m) + } + return nil, errors.Errorf("Marker %v is invalid", m) +} + +// The UTF8 string, please read @doc amf0_spec_121207.pdf, @page 3, @section 1.3.1 Strings and UTF-8 +type amf0UTF8 string + +func (v *amf0UTF8) Size() int { + return 2 + len(string(*v)) +} + +func (v *amf0UTF8) UnmarshalBinary(data []byte) (err error) { + var p []byte + if p = data; len(p) < 2 { + return errors.Errorf("require 2 bytes only %v", len(p)) + } + size := uint16(p[0])<<8 | uint16(p[1]) + + if p = data[2:]; len(p) < int(size) { + return errors.Errorf("require %v bytes only %v", int(size), len(p)) + } + *v = amf0UTF8(string(p[:size])) + + return +} + +func (v *amf0UTF8) MarshalBinary() (data []byte, err error) { + data = make([]byte, v.Size()) + + size := uint16(len(string(*v))) + data[0] = byte(size >> 8) + data[1] = byte(size) + + if size > 0 { + copy(data[2:], []byte(*v)) + } + + return +} + +// The number object, please read @doc amf0_spec_121207.pdf, @page 5, @section 2.2 Number Type +type amf0Number float64 + +func NewAmf0Number(f float64) *amf0Number { + v := amf0Number(f) + return &v +} + +func (v *amf0Number) amf0Marker() amf0Marker { + return amf0MarkerNumber +} + +func (v *amf0Number) Size() int { + return 1 + 8 +} + +func (v *amf0Number) UnmarshalBinary(data []byte) (err error) { + var p []byte + if p = data; len(p) < 9 { + return errors.Errorf("require 9 bytes only %v", len(p)) + } + if m := amf0Marker(p[0]); m != amf0MarkerNumber { + return errors.Errorf("Amf0Number amf0Marker %v is illegal", m) + } + + f := binary.BigEndian.Uint64(p[1:]) + *v = amf0Number(math.Float64frombits(f)) + return +} + +func (v *amf0Number) MarshalBinary() (data []byte, err error) { + data = make([]byte, 9) + data[0] = byte(amf0MarkerNumber) + f := math.Float64bits(float64(*v)) + binary.BigEndian.PutUint64(data[1:], f) + return +} + +// The string objet, please read @doc amf0_spec_121207.pdf, @page 5, @section 2.4 String Type +type amf0String string + +func NewAmf0String(s string) *amf0String { + v := amf0String(s) + return &v +} + +func (v *amf0String) amf0Marker() amf0Marker { + return amf0MarkerString +} + +func (v *amf0String) Size() int { + u := amf0UTF8(*v) + return 1 + u.Size() +} + +func (v *amf0String) UnmarshalBinary(data []byte) (err error) { + var p []byte + if p = data; len(p) < 1 { + return errors.Errorf("require 1 bytes only %v", len(p)) + } + if m := amf0Marker(p[0]); m != amf0MarkerString { + return errors.Errorf("Amf0String amf0Marker %v is illegal", m) + } + + var sv amf0UTF8 + if err = sv.UnmarshalBinary(p[1:]); err != nil { + return errors.WithMessage(err, "utf8") + } + *v = amf0String(string(sv)) + return +} + +func (v *amf0String) MarshalBinary() (data []byte, err error) { + u := amf0UTF8(*v) + + var pb []byte + if pb, err = u.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "utf8") + } + + data = append([]byte{byte(amf0MarkerString)}, pb...) + return +} + +// The AMF0 object end type, please read @doc amf0_spec_121207.pdf, @page 5, @section 2.11 Object End Type +type amf0ObjectEOF struct { +} + +func (v *amf0ObjectEOF) amf0Marker() amf0Marker { + return amf0MarkerObjectEnd +} + +func (v *amf0ObjectEOF) Size() int { + return 3 +} + +func (v *amf0ObjectEOF) UnmarshalBinary(data []byte) (err error) { + p := data + + if len(p) < 3 { + return errors.Errorf("require 3 bytes only %v", len(p)) + } + + if p[0] != 0 || p[1] != 0 || p[2] != 9 { + return errors.Errorf("EOF amf0Marker %v is illegal", p[0:3]) + } + return +} + +func (v *amf0ObjectEOF) MarshalBinary() (data []byte, err error) { + return []byte{0, 0, 9}, nil +} + +// Use array for object and ecma array, to keep the original order. +type amf0Property struct { + key amf0UTF8 + value amf0Any +} + +// The object-like AMF0 structure, like object and ecma array and strict array. +type amf0ObjectBase struct { + properties []*amf0Property + lock sync.Mutex +} + +func (v *amf0ObjectBase) Size() int { + v.lock.Lock() + defer v.lock.Unlock() + + var size int + + for _, p := range v.properties { + key, value := p.key, p.value + size += key.Size() + value.Size() + } + + return size +} + +func (v *amf0ObjectBase) Get(key string) amf0Any { + v.lock.Lock() + defer v.lock.Unlock() + + for _, p := range v.properties { + if string(p.key) == key { + return p.value + } + } + + return nil +} + +func (v *amf0ObjectBase) Set(key string, value amf0Any) *amf0ObjectBase { + v.lock.Lock() + defer v.lock.Unlock() + + prop := &amf0Property{key: amf0UTF8(key), value: value} + + var ok bool + for i, p := range v.properties { + if string(p.key) == key { + v.properties[i] = prop + ok = true + } + } + + if !ok { + v.properties = append(v.properties, prop) + } + + return v +} + +func (v *amf0ObjectBase) unmarshal(p []byte, eof bool, maxElems int) (err error) { + // if no eof, elems specified by maxElems. + if !eof && maxElems < 0 { + return errors.Errorf("maxElems=%v without eof", maxElems) + } + // if eof, maxElems must be -1. + if eof && maxElems != -1 { + return errors.Errorf("maxElems=%v with eof", maxElems) + } + + readOne := func() (amf0UTF8, amf0Any, error) { + var u amf0UTF8 + if err = u.UnmarshalBinary(p); err != nil { + return "", nil, errors.WithMessage(err, "prop name") + } + + p = p[u.Size():] + var a amf0Any + if a, err = Amf0Discovery(p); err != nil { + return "", nil, errors.WithMessage(err, fmt.Sprintf("discover prop %v", string(u))) + } + return u, a, nil + } + + pushOne := func(u amf0UTF8, a amf0Any) error { + // For object property, consume the whole bytes. + if err = a.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, fmt.Sprintf("unmarshal prop %v", string(u))) + } + + v.Set(string(u), a) + p = p[a.Size():] + return nil + } + + for eof { + u, a, err := readOne() + if err != nil { + return errors.WithMessage(err, "read") + } + + // For object EOF, we should only consume total 3bytes. + if u.Size() == 2 && a.amf0Marker() == amf0MarkerObjectEnd { + // 2 bytes is consumed by u(name), the a(eof) should only consume 1 byte. + p = p[1:] + return nil + } + + if err := pushOne(u, a); err != nil { + return errors.WithMessage(err, "push") + } + } + + for len(v.properties) < maxElems { + u, a, err := readOne() + if err != nil { + return errors.WithMessage(err, "read") + } + + if err := pushOne(u, a); err != nil { + return errors.WithMessage(err, "push") + } + } + + return +} + +func (v *amf0ObjectBase) marshal(b amf0Buffer) (err error) { + v.lock.Lock() + defer v.lock.Unlock() + + var pb []byte + for _, p := range v.properties { + key, value := p.key, p.value + + if pb, err = key.MarshalBinary(); err != nil { + return errors.WithMessage(err, fmt.Sprintf("marshal %v", string(key))) + } + if _, err = b.Write(pb); err != nil { + return errors.Wrapf(err, "write %v", string(key)) + } + + if pb, err = value.MarshalBinary(); err != nil { + return errors.WithMessage(err, fmt.Sprintf("marshal value for %v", string(key))) + } + if _, err = b.Write(pb); err != nil { + return errors.Wrapf(err, "marshal value for %v", string(key)) + } + } + + return +} + +// The AMF0 object, please read @doc amf0_spec_121207.pdf, @page 5, @section 2.5 Object Type +type amf0Object struct { + amf0ObjectBase + eof amf0ObjectEOF +} + +func NewAmf0Object() *amf0Object { + v := &amf0Object{} + v.properties = []*amf0Property{} + return v +} + +func (v *amf0Object) amf0Marker() amf0Marker { + return amf0MarkerObject +} + +func (v *amf0Object) Size() int { + return int(1) + v.eof.Size() + v.amf0ObjectBase.Size() +} + +func (v *amf0Object) UnmarshalBinary(data []byte) (err error) { + var p []byte + if p = data; len(p) < 1 { + return errors.Errorf("require 1 byte only %v", len(p)) + } + if m := amf0Marker(p[0]); m != amf0MarkerObject { + return errors.Errorf("Amf0Object amf0Marker %v is illegal", m) + } + p = p[1:] + + if err = v.unmarshal(p, true, -1); err != nil { + return errors.WithMessage(err, "unmarshal") + } + + return +} + +func (v *amf0Object) MarshalBinary() (data []byte, err error) { + b := createBuffer() + + if err = b.WriteByte(byte(amf0MarkerObject)); err != nil { + return nil, errors.Wrap(err, "marshal") + } + + if err = v.marshal(b); err != nil { + return nil, errors.WithMessage(err, "marshal") + } + + var pb []byte + if pb, err = v.eof.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal") + } + if _, err = b.Write(pb); err != nil { + return nil, errors.Wrap(err, "marshal") + } + + return b.Bytes(), nil +} + +// The AMF0 ecma array, please read @doc amf0_spec_121207.pdf, @page 6, @section 2.10 ECMA Array Type +type amf0EcmaArray struct { + amf0ObjectBase + count uint32 + eof amf0ObjectEOF +} + +func NewAmf0EcmaArray() *amf0EcmaArray { + v := &amf0EcmaArray{} + v.properties = []*amf0Property{} + return v +} + +func (v *amf0EcmaArray) amf0Marker() amf0Marker { + return amf0MarkerEcmaArray +} + +func (v *amf0EcmaArray) Size() int { + return int(1) + 4 + v.eof.Size() + v.amf0ObjectBase.Size() +} + +func (v *amf0EcmaArray) UnmarshalBinary(data []byte) (err error) { + var p []byte + if p = data; len(p) < 5 { + return errors.Errorf("require 5 bytes only %v", len(p)) + } + if m := amf0Marker(p[0]); m != amf0MarkerEcmaArray { + return errors.Errorf("EcmaArray amf0Marker %v is illegal", m) + } + v.count = binary.BigEndian.Uint32(p[1:]) + p = p[5:] + + if err = v.unmarshal(p, true, -1); err != nil { + return errors.WithMessage(err, "unmarshal") + } + return +} + +func (v *amf0EcmaArray) MarshalBinary() (data []byte, err error) { + b := createBuffer() + + if err = b.WriteByte(byte(amf0MarkerEcmaArray)); err != nil { + return nil, errors.Wrap(err, "marshal") + } + + if err = binary.Write(b, binary.BigEndian, v.count); err != nil { + return nil, errors.Wrap(err, "marshal") + } + + if err = v.marshal(b); err != nil { + return nil, errors.WithMessage(err, "marshal") + } + + var pb []byte + if pb, err = v.eof.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal") + } + if _, err = b.Write(pb); err != nil { + return nil, errors.Wrap(err, "marshal") + } + + return b.Bytes(), nil +} + +// The AMF0 strict array, please read @doc amf0_spec_121207.pdf, @page 7, @section 2.12 Strict Array Type +type amf0StrictArray struct { + amf0ObjectBase + count uint32 +} + +func NewAmf0StrictArray() *amf0StrictArray { + v := &amf0StrictArray{} + v.properties = []*amf0Property{} + return v +} + +func (v *amf0StrictArray) amf0Marker() amf0Marker { + return amf0MarkerStrictArray +} + +func (v *amf0StrictArray) Size() int { + return int(1) + 4 + v.amf0ObjectBase.Size() +} + +func (v *amf0StrictArray) UnmarshalBinary(data []byte) (err error) { + var p []byte + if p = data; len(p) < 5 { + return errors.Errorf("require 5 bytes only %v", len(p)) + } + if m := amf0Marker(p[0]); m != amf0MarkerStrictArray { + return errors.Errorf("StrictArray amf0Marker %v is illegal", m) + } + v.count = binary.BigEndian.Uint32(p[1:]) + p = p[5:] + + if int(v.count) <= 0 { + return + } + + if err = v.unmarshal(p, false, int(v.count)); err != nil { + return errors.WithMessage(err, "unmarshal") + } + return +} + +func (v *amf0StrictArray) MarshalBinary() (data []byte, err error) { + b := createBuffer() + + if err = b.WriteByte(byte(amf0MarkerStrictArray)); err != nil { + return nil, errors.Wrap(err, "marshal") + } + + if err = binary.Write(b, binary.BigEndian, v.count); err != nil { + return nil, errors.Wrap(err, "marshal") + } + + if err = v.marshal(b); err != nil { + return nil, errors.WithMessage(err, "marshal") + } + + return b.Bytes(), nil +} + +// The single amf0Marker object, for all AMF0 which only has the amf0Marker, like null and undefined. +type amf0SingleMarkerObject struct { + target amf0Marker +} + +func newAmf0SingleMarkerObject(m amf0Marker) amf0SingleMarkerObject { + return amf0SingleMarkerObject{target: m} +} + +func (v *amf0SingleMarkerObject) amf0Marker() amf0Marker { + return v.target +} + +func (v *amf0SingleMarkerObject) Size() int { + return int(1) +} + +func (v *amf0SingleMarkerObject) UnmarshalBinary(data []byte) (err error) { + var p []byte + if p = data; len(p) < 1 { + return errors.Errorf("require 1 byte only %v", len(p)) + } + if m := amf0Marker(p[0]); m != v.target { + return errors.Errorf("%v amf0Marker %v is illegal", v.target, m) + } + return +} + +func (v *amf0SingleMarkerObject) MarshalBinary() (data []byte, err error) { + return []byte{byte(v.target)}, nil +} + +// The AMF0 null, please read @doc amf0_spec_121207.pdf, @page 6, @section 2.7 null Type +type amf0Null struct { + amf0SingleMarkerObject +} + +func NewAmf0Null() *amf0Null { + v := amf0Null{} + v.amf0SingleMarkerObject = newAmf0SingleMarkerObject(amf0MarkerNull) + return &v +} + +// The AMF0 undefined, please read @doc amf0_spec_121207.pdf, @page 6, @section 2.8 undefined Type +type amf0Undefined struct { + amf0SingleMarkerObject +} + +func NewAmf0Undefined() amf0Any { + v := amf0Undefined{} + v.amf0SingleMarkerObject = newAmf0SingleMarkerObject(amf0MarkerUndefined) + return &v +} + +// The AMF0 boolean, please read @doc amf0_spec_121207.pdf, @page 5, @section 2.3 Boolean Type +type amf0Boolean bool + +func NewAmf0Boolean(b bool) amf0Any { + v := amf0Boolean(b) + return &v +} + +func (v *amf0Boolean) amf0Marker() amf0Marker { + return amf0MarkerBoolean +} + +func (v *amf0Boolean) Size() int { + return int(2) +} + +func (v *amf0Boolean) UnmarshalBinary(data []byte) (err error) { + var p []byte + if p = data; len(p) < 2 { + return errors.Errorf("require 2 bytes only %v", len(p)) + } + if m := amf0Marker(p[0]); m != amf0MarkerBoolean { + return errors.Errorf("BOOL amf0Marker %v is illegal", m) + } + if p[1] == 0 { + *v = false + } else { + *v = true + } + return +} + +func (v *amf0Boolean) MarshalBinary() (data []byte, err error) { + var b byte + if *v { + b = 1 + } + return []byte{byte(amf0MarkerBoolean), b}, nil +} diff --git a/proxy/rtmp/rtmp.go b/proxy/rtmp/rtmp.go new file mode 100644 index 0000000000..ee0970e960 --- /dev/null +++ b/proxy/rtmp/rtmp.go @@ -0,0 +1,1792 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package rtmp + +import ( + "bufio" + "bytes" + "context" + "encoding" + "encoding/binary" + "fmt" + "io" + "math/rand" + "sync" + + "srs-proxy/errors" +) + +// The handshake implements the RTMP handshake protocol. +type Handshake struct { + // The random number generator. + r *rand.Rand + // The c1s1 cache. + c1s1 []byte +} + +func NewHandshake(r *rand.Rand) *Handshake { + return &Handshake{r: r} +} + +func (v *Handshake) C1S1() []byte { + return v.c1s1 +} + +func (v *Handshake) WriteC0S0(w io.Writer) (err error) { + r := bytes.NewReader([]byte{0x03}) + if _, err = io.Copy(w, r); err != nil { + return errors.Wrap(err, "write c0s0") + } + + return +} + +func (v *Handshake) ReadC0S0(r io.Reader) (c0 []byte, err error) { + b := &bytes.Buffer{} + if _, err = io.CopyN(b, r, 1); err != nil { + return nil, errors.Wrap(err, "read c0s0") + } + + c0 = b.Bytes() + + return +} + +func (v *Handshake) WriteC1S1(w io.Writer) (err error) { + p := make([]byte, 1536) + + for i := 8; i < len(p); i++ { + p[i] = byte(v.r.Int()) + } + + r := bytes.NewReader(p) + if _, err = io.Copy(w, r); err != nil { + return errors.Wrap(err, "write c0s1") + } + + return +} + +func (v *Handshake) ReadC1S1(r io.Reader) (c1s1 []byte, err error) { + b := &bytes.Buffer{} + if _, err = io.CopyN(b, r, 1536); err != nil { + return nil, errors.Wrap(err, "read c1s1") + } + + c1s1 = b.Bytes() + v.c1s1 = c1s1 + + return +} + +func (v *Handshake) WriteC2S2(w io.Writer, s1c1 []byte) (err error) { + r := bytes.NewReader(s1c1[:]) + if _, err = io.Copy(w, r); err != nil { + return errors.Wrap(err, "write c2s2") + } + + return +} + +func (v *Handshake) ReadC2S2(r io.Reader) (c2 []byte, err error) { + b := &bytes.Buffer{} + if _, err = io.CopyN(b, r, 1536); err != nil { + return nil, errors.Wrap(err, "read c2s2") + } + + c2 = b.Bytes() + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 16, @section 6.1. Chunk Format +// Extended timestamp: 0 or 4 bytes +// This field MUST be sent when the normal timsestamp is set to +// 0xffffff, it MUST NOT be sent if the normal timestamp is set to +// anything else. So for values less than 0xffffff the normal +// timestamp field SHOULD be used in which case the extended timestamp +// MUST NOT be present. For values greater than or equal to 0xffffff +// the normal timestamp field MUST NOT be used and MUST be set to +// 0xffffff and the extended timestamp MUST be sent. +const extendedTimestamp = uint64(0xffffff) + +// The default chunk size of RTMP is 128 bytes. +const defaultChunkSize = 128 + +// The intput or output settings for RTMP protocol. +type settings struct { + chunkSize uint32 +} + +func newSettings() *settings { + return &settings{ + chunkSize: defaultChunkSize, + } +} + +// The chunk stream which transport a message once. +type chunkStream struct { + format formatType + cid chunkID + header messageHeader + message *Message + count uint64 + extendedTimestamp bool +} + +func newChunkStream() *chunkStream { + return &chunkStream{} +} + +// The protocol implements the RTMP command and chunk stack. +type Protocol struct { + r *bufio.Reader + w *bufio.Writer + input struct { + opt *settings + chunks map[chunkID]*chunkStream + + transactions map[amf0Number]amf0String + ltransactions sync.Mutex + } + output struct { + opt *settings + } +} + +func NewProtocol(rw io.ReadWriter) *Protocol { + v := &Protocol{ + r: bufio.NewReader(rw), + w: bufio.NewWriter(rw), + } + + v.input.opt = newSettings() + v.input.chunks = map[chunkID]*chunkStream{} + v.input.transactions = map[amf0Number]amf0String{} + + v.output.opt = newSettings() + + return v +} + +func ExpectPacket[T Packet](ctx context.Context, v *Protocol, ppkt *T) (m *Message, err error) { + for { + if m, err = v.ReadMessage(ctx); err != nil { + return nil, errors.WithMessage(err, "read message") + } + + var pkt Packet + if pkt, err = v.DecodeMessage(m); err != nil { + return nil, errors.WithMessage(err, "decode message") + } + + if p, ok := pkt.(T); ok { + *ppkt = p + break + } + } + + return +} + +// Deprecated: Please use rtmp.ExpectPacket instead. +func (v *Protocol) ExpectPacket(ctx context.Context, ppkt any) (m *Message, err error) { + panic("Please use rtmp.ExpectPacket instead") +} + +func (v *Protocol) ExpectMessage(ctx context.Context, types ...MessageType) (m *Message, err error) { + for { + if m, err = v.ReadMessage(ctx); err != nil { + return nil, errors.WithMessage(err, "read message") + } + + if len(types) == 0 { + return + } + + for _, t := range types { + if m.MessageType == t { + return + } + } + } + + return +} + +func (v *Protocol) parseAMFObject(p []byte) (pkt Packet, err error) { + var commandName amf0String + if err = commandName.UnmarshalBinary(p); err != nil { + return nil, errors.WithMessage(err, "unmarshal command name") + } + + switch commandName { + case commandResult, commandError: + var transactionID amf0Number + if err = transactionID.UnmarshalBinary(p[commandName.Size():]); err != nil { + return nil, errors.WithMessage(err, "unmarshal tid") + } + + var requestName amf0String + if err = func() error { + v.input.ltransactions.Lock() + defer v.input.ltransactions.Unlock() + + var ok bool + if requestName, ok = v.input.transactions[transactionID]; !ok { + return errors.Errorf("No matched request for tid=%v", transactionID) + } + delete(v.input.transactions, transactionID) + + return nil + }(); err != nil { + return nil, errors.WithMessage(err, "discovery request name") + } + + switch requestName { + case commandConnect: + return NewConnectAppResPacket(transactionID), nil + case commandCreateStream: + return NewCreateStreamResPacket(transactionID), nil + case commandReleaseStream, commandFCPublish, commandFCUnpublish: + call := NewCallPacket() + call.TransactionID = transactionID + return call, nil + default: + return nil, errors.Errorf("No request for %v", string(requestName)) + } + case commandConnect: + return NewConnectAppPacket(), nil + case commandPublish: + return NewPublishPacket(), nil + case commandPlay: + return NewPlayPacket(), nil + default: + return NewCallPacket(), nil + } +} + +func (v *Protocol) DecodeMessage(m *Message) (pkt Packet, err error) { + p := m.Payload[:] + if len(p) == 0 { + return nil, errors.New("Empty packet") + } + + switch m.MessageType { + case MessageTypeAMF3Command, MessageTypeAMF3Data: + p = p[1:] + } + + switch m.MessageType { + case MessageTypeSetChunkSize: + pkt = NewSetChunkSize() + case MessageTypeWindowAcknowledgementSize: + pkt = NewWindowAcknowledgementSize() + case MessageTypeSetPeerBandwidth: + pkt = NewSetPeerBandwidth() + case MessageTypeAMF0Command, MessageTypeAMF3Command, MessageTypeAMF0Data, MessageTypeAMF3Data: + if pkt, err = v.parseAMFObject(p); err != nil { + return nil, errors.WithMessage(err, fmt.Sprintf("Parse AMF %v", m.MessageType)) + } + case MessageTypeUserControl: + pkt = NewUserControl() + default: + return nil, errors.Errorf("Unknown message %v", m.MessageType) + } + + if err = pkt.UnmarshalBinary(p); err != nil { + return nil, errors.WithMessage(err, fmt.Sprintf("Unmarshal %v", m.MessageType)) + } + + return +} + +func (v *Protocol) ReadMessage(ctx context.Context) (m *Message, err error) { + for m == nil { + // TODO: We should convert buffered io to async io, because we will be stuck in block io here, + // TODO: but the risk is acceptable because we literally will set the underlay io timeout. + if ctx.Err() != nil { + return nil, ctx.Err() + } + + var cid chunkID + var format formatType + if format, cid, err = v.readBasicHeader(ctx); err != nil { + return nil, errors.WithMessage(err, "read basic header") + } + + var ok bool + var chunk *chunkStream + if chunk, ok = v.input.chunks[cid]; !ok { + chunk = newChunkStream() + v.input.chunks[cid] = chunk + chunk.header.betterCid = cid + } + + if err = v.readMessageHeader(ctx, chunk, format); err != nil { + return nil, errors.WithMessage(err, "read message header") + } + + if m, err = v.readMessagePayload(ctx, chunk); err != nil { + return nil, errors.WithMessage(err, "read message payload") + } + + if err = v.onMessageArrivated(m); err != nil { + return nil, errors.WithMessage(err, "on message") + } + } + + return +} + +func (v *Protocol) readMessagePayload(ctx context.Context, chunk *chunkStream) (m *Message, err error) { + // Empty payload message. + if chunk.message.payloadLength == 0 { + m = chunk.message + chunk.message = nil + return + } + + // Calculate the chunk payload size. + chunkedPayloadSize := int(chunk.message.payloadLength) - len(chunk.message.Payload) + if chunkedPayloadSize > int(v.input.opt.chunkSize) { + chunkedPayloadSize = int(v.input.opt.chunkSize) + } + + b := make([]byte, chunkedPayloadSize) + if _, err = io.ReadFull(v.r, b); err != nil { + return nil, errors.Wrapf(err, "read chunk %vB", chunkedPayloadSize) + } + chunk.message.Payload = append(chunk.message.Payload, b...) + + // Got entire RTMP message? + if int(chunk.message.payloadLength) == len(chunk.message.Payload) { + m = chunk.message + chunk.message = nil + } + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 18, @section 6.1.2. Chunk Message Header +// There are four different formats for the chunk message header, +// selected by the "fmt" field in the chunk basic header. +type formatType uint8 + +const ( + // 6.1.2.1. Type 0 + // Chunks of Type 0 are 11 bytes long. This type MUST be used at the + // start of a chunk stream, and whenever the stream timestamp goes + // backward (e.g., because of a backward seek). + formatType0 formatType = iota + // 6.1.2.2. Type 1 + // Chunks of Type 1 are 7 bytes long. The message stream ID is not + // included; this chunk takes the same stream ID as the preceding chunk. + // Streams with variable-sized messages (for example, many video + // formats) SHOULD use this format for the first chunk of each new + // message after the first. + formatType1 + // 6.1.2.3. Type 2 + // Chunks of Type 2 are 3 bytes long. Neither the stream ID nor the + // message length is included; this chunk has the same stream ID and + // message length as the preceding chunk. Streams with constant-sized + // messages (for example, some audio and data formats) SHOULD use this + // format for the first chunk of each message after the first. + formatType2 + // 6.1.2.4. Type 3 + // Chunks of Type 3 have no header. Stream ID, message length and + // timestamp delta are not present; chunks of this type take values from + // the preceding chunk. When a single message is split into chunks, all + // chunks of a message except the first one, SHOULD use this type. Refer + // to example 2 in section 6.2.2. Stream consisting of messages of + // exactly the same size, stream ID and spacing in time SHOULD use this + // type for all chunks after chunk of Type 2. Refer to example 1 in + // section 6.2.1. If the delta between the first message and the second + // message is same as the time stamp of first message, then chunk of + // type 3 would immediately follow the chunk of type 0 as there is no + // need for a chunk of type 2 to register the delta. If Type 3 chunk + // follows a Type 0 chunk, then timestamp delta for this Type 3 chunk is + // the same as the timestamp of Type 0 chunk. + formatType3 +) + +// The message header size, index is format. +var messageHeaderSizes = []int{11, 7, 3, 0} + +// Parse the chunk message header. +// 3bytes: timestamp delta, fmt=0,1,2 +// 3bytes: payload length, fmt=0,1 +// 1bytes: message type, fmt=0,1 +// 4bytes: stream id, fmt=0 +// where: +// fmt=0, 0x0X +// fmt=1, 0x4X +// fmt=2, 0x8X +// fmt=3, 0xCX +func (v *Protocol) readMessageHeader(ctx context.Context, chunk *chunkStream, format formatType) (err error) { + // We should not assert anything about fmt, for the first packet. + // (when first packet, the chunk.message is nil). + // the fmt maybe 0/1/2/3, the FMLE will send a 0xC4 for some audio packet. + // the previous packet is: + // 04 // fmt=0, cid=4 + // 00 00 1a // timestamp=26 + // 00 00 9d // payload_length=157 + // 08 // message_type=8(audio) + // 01 00 00 00 // stream_id=1 + // the current packet maybe: + // c4 // fmt=3, cid=4 + // it's ok, for the packet is audio, and timestamp delta is 26. + // the current packet must be parsed as: + // fmt=0, cid=4 + // timestamp=26+26=52 + // payload_length=157 + // message_type=8(audio) + // stream_id=1 + // so we must update the timestamp even fmt=3 for first packet. + // + // The fresh packet used to update the timestamp even fmt=3 for first packet. + // fresh packet always means the chunk is the first one of message. + var isFirstChunkOfMsg bool + if chunk.message == nil { + isFirstChunkOfMsg = true + } + + // But, we can ensure that when a chunk stream is fresh, + // the fmt must be 0, a new stream. + if chunk.count == 0 && format != formatType0 { + // For librtmp, if ping, it will send a fresh stream with fmt=1, + // 0x42 where: fmt=1, cid=2, protocol contorl user-control message + // 0x00 0x00 0x00 where: timestamp=0 + // 0x00 0x00 0x06 where: payload_length=6 + // 0x04 where: message_type=4(protocol control user-control message) + // 0x00 0x06 where: event Ping(0x06) + // 0x00 0x00 0x0d 0x0f where: event data 4bytes ping timestamp. + // @see: https://github.com/ossrs/srs/issues/98 + if chunk.cid == chunkIDProtocolControl && format == formatType1 { + // We accept cid=2, fmt=1 to make librtmp happy. + } else { + return errors.Errorf("For fresh chunk, fmt %v != %v(required), cid is %v", format, formatType0, chunk.cid) + } + } + + // When exists cache msg, means got an partial message, + // the fmt must not be type0 which means new message. + if chunk.message != nil && format == formatType0 { + return errors.Errorf("For exists chunk, fmt is %v, cid is %v", format, chunk.cid) + } + + // Create msg when new chunk stream start + if chunk.message == nil { + chunk.message = NewMessage() + } + + // Read the message header. + p := make([]byte, messageHeaderSizes[format]) + if _, err = io.ReadFull(v.r, p); err != nil { + return errors.Wrapf(err, "read %vB message header", len(p)) + } + + // Prse the message header. + // 3bytes: timestamp delta, fmt=0,1,2 + // 3bytes: payload length, fmt=0,1 + // 1bytes: message type, fmt=0,1 + // 4bytes: stream id, fmt=0 + // where: + // fmt=0, 0x0X + // fmt=1, 0x4X + // fmt=2, 0x8X + // fmt=3, 0xCX + if format <= formatType2 { + chunk.header.timestampDelta = uint32(p[0])<<16 | uint32(p[1])<<8 | uint32(p[2]) + p = p[3:] + + // fmt: 0 + // timestamp: 3 bytes + // If the timestamp is greater than or equal to 16777215 + // (hexadecimal 0x00ffffff), this value MUST be 16777215, and the + // 'extended timestamp header' MUST be present. Otherwise, this value + // SHOULD be the entire timestamp. + // + // fmt: 1 or 2 + // timestamp delta: 3 bytes + // If the delta is greater than or equal to 16777215 (hexadecimal + // 0x00ffffff), this value MUST be 16777215, and the 'extended + // timestamp header' MUST be present. Otherwise, this value SHOULD be + // the entire delta. + chunk.extendedTimestamp = uint64(chunk.header.timestampDelta) >= extendedTimestamp + if !chunk.extendedTimestamp { + // Extended timestamp: 0 or 4 bytes + // This field MUST be sent when the normal timsestamp is set to + // 0xffffff, it MUST NOT be sent if the normal timestamp is set to + // anything else. So for values less than 0xffffff the normal + // timestamp field SHOULD be used in which case the extended timestamp + // MUST NOT be present. For values greater than or equal to 0xffffff + // the normal timestamp field MUST NOT be used and MUST be set to + // 0xffffff and the extended timestamp MUST be sent. + if format == formatType0 { + // 6.1.2.1. Type 0 + // For a type-0 chunk, the absolute timestamp of the message is sent + // here. + chunk.header.Timestamp = uint64(chunk.header.timestampDelta) + } else { + // 6.1.2.2. Type 1 + // 6.1.2.3. Type 2 + // For a type-1 or type-2 chunk, the difference between the previous + // chunk's timestamp and the current chunk's timestamp is sent here. + chunk.header.Timestamp += uint64(chunk.header.timestampDelta) + } + } + + if format <= formatType1 { + payloadLength := uint32(p[0])<<16 | uint32(p[1])<<8 | uint32(p[2]) + p = p[3:] + + // For a message, if msg exists in cache, the size must not changed. + // always use the actual msg size to compare, for the cache payload length can changed, + // for the fmt type1(stream_id not changed), user can change the payload + // length(it's not allowed in the continue chunks). + if !isFirstChunkOfMsg && chunk.header.payloadLength != payloadLength { + return errors.Errorf("Chunk message size %v != %v(required)", payloadLength, chunk.header.payloadLength) + } + chunk.header.payloadLength = payloadLength + + chunk.header.MessageType = MessageType(p[0]) + p = p[1:] + + if format == formatType0 { + chunk.header.streamID = uint32(p[0]) | uint32(p[1])<<8 | uint32(p[2])<<16 | uint32(p[3])<<24 + p = p[4:] + } + } + } else { + // Update the timestamp even fmt=3 for first chunk packet + if isFirstChunkOfMsg && !chunk.extendedTimestamp { + chunk.header.Timestamp += uint64(chunk.header.timestampDelta) + } + } + + // Read extended-timestamp + if chunk.extendedTimestamp { + var timestamp uint32 + if err = binary.Read(v.r, binary.BigEndian, ×tamp); err != nil { + return errors.Wrapf(err, "read ext-ts, pkt-ts=%v", chunk.header.Timestamp) + } + + // We always use 31bits timestamp, for some server may use 32bits extended timestamp. + // @see https://github.com/ossrs/srs/issues/111 + timestamp &= 0x7fffffff + + // TODO: FIXME: Support detect the extended timestamp. + // @see http://blog.csdn.net/win_lin/article/details/13363699 + chunk.header.Timestamp = uint64(timestamp) + } + + // The extended-timestamp must be unsigned-int, + // 24bits timestamp: 0xffffff = 16777215ms = 16777.215s = 4.66h + // 32bits timestamp: 0xffffffff = 4294967295ms = 4294967.295s = 1193.046h = 49.71d + // because the rtmp protocol says the 32bits timestamp is about "50 days": + // 3. Byte Order, Alignment, and Time Format + // Because timestamps are generally only 32 bits long, they will roll + // over after fewer than 50 days. + // + // but, its sample says the timestamp is 31bits: + // An application could assume, for example, that all + // adjacent timestamps are within 2^31 milliseconds of each other, so + // 10000 comes after 4000000000, while 3000000000 comes before + // 4000000000. + // and flv specification says timestamp is 31bits: + // Extension of the Timestamp field to form a SI32 value. This + // field represents the upper 8 bits, while the previous + // Timestamp field represents the lower 24 bits of the time in + // milliseconds. + // in a word, 31bits timestamp is ok. + // convert extended timestamp to 31bits. + chunk.header.Timestamp &= 0x7fffffff + + // Copy header to msg + chunk.message.messageHeader = chunk.header + + // Increase the msg count, the chunk stream can accept fmt=1/2/3 message now. + chunk.count++ + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 17, @section 6.1.1. Chunk Basic Header +// The Chunk Basic Header encodes the chunk stream ID and the chunk +// type(represented by fmt field in the figure below). Chunk type +// determines the format of the encoded message header. Chunk Basic +// Header field may be 1, 2, or 3 bytes, depending on the chunk stream +// ID. +// +// The bits 0-5 (least significant) in the chunk basic header represent +// the chunk stream ID. +// +// Chunk stream IDs 2-63 can be encoded in the 1-byte version of this +// field. +// 0 1 2 3 4 5 6 7 +// +-+-+-+-+-+-+-+-+ +// |fmt| cs id | +// +-+-+-+-+-+-+-+-+ +// Figure 6 Chunk basic header 1 +// +// Chunk stream IDs 64-319 can be encoded in the 2-byte version of this +// field. ID is computed as (the second byte + 64). +// 0 1 +// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +// |fmt| 0 | cs id - 64 | +// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +// Figure 7 Chunk basic header 2 +// +// Chunk stream IDs 64-65599 can be encoded in the 3-byte version of +// this field. ID is computed as ((the third byte)*256 + the second byte +// + 64). +// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 +// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +// |fmt| 1 | cs id - 64 | +// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +// Figure 8 Chunk basic header 3 +// +// cs id: 6 bits +// fmt: 2 bits +// cs id - 64: 8 or 16 bits +// +// Chunk stream IDs with values 64-319 could be represented by both 2- +// byte version and 3-byte version of this field. +func (v *Protocol) readBasicHeader(ctx context.Context) (format formatType, cid chunkID, err error) { + // 2-63, 1B chunk header + var t uint8 + if err = binary.Read(v.r, binary.BigEndian, &t); err != nil { + return format, cid, errors.Wrap(err, "read basic header") + } + cid = chunkID(t & 0x3f) + format = formatType((t >> 6) & 0x03) + + if cid > 1 { + return + } + + // 64-319, 2B chunk header + if err = binary.Read(v.r, binary.BigEndian, &t); err != nil { + return format, cid, errors.Wrapf(err, "read basic header for cid=%v", cid) + } + cid = chunkID(64 + uint32(t)) + + // 64-65599, 3B chunk header + if cid == 1 { + if err = binary.Read(v.r, binary.BigEndian, &t); err != nil { + return format, cid, errors.Wrapf(err, "read basic header for cid=%v", cid) + } + cid += chunkID(uint32(t) * 256) + } + + return +} + +func (v *Protocol) WritePacket(ctx context.Context, pkt Packet, streamID int) (err error) { + m := NewMessage() + + if m.Payload, err = pkt.MarshalBinary(); err != nil { + return errors.WithMessage(err, "marshal payload") + } + + m.MessageType = pkt.Type() + m.streamID = uint32(streamID) + m.betterCid = pkt.BetterCid() + + if err = v.WriteMessage(ctx, m); err != nil { + return errors.WithMessage(err, "write message") + } + + if err = v.onPacketWriten(m, pkt); err != nil { + return errors.WithMessage(err, "on write packet") + } + + return +} + +func (v *Protocol) onPacketWriten(m *Message, pkt Packet) (err error) { + var tid amf0Number + var name amf0String + + switch pkt := pkt.(type) { + case *ConnectAppPacket: + tid, name = pkt.TransactionID, pkt.CommandName + case *CreateStreamPacket: + tid, name = pkt.TransactionID, pkt.CommandName + case *CallPacket: + tid, name = pkt.TransactionID, pkt.CommandName + } + + if tid > 0 && len(name) > 0 { + v.input.ltransactions.Lock() + defer v.input.ltransactions.Unlock() + + v.input.transactions[tid] = name + } + + return +} + +func (v *Protocol) onMessageArrivated(m *Message) (err error) { + if m == nil { + return + } + + var pkt Packet + switch m.MessageType { + case MessageTypeSetChunkSize, MessageTypeUserControl, MessageTypeWindowAcknowledgementSize: + if pkt, err = v.DecodeMessage(m); err != nil { + return errors.Errorf("decode message %v", m.MessageType) + } + } + + switch pkt := pkt.(type) { + case *SetChunkSize: + v.input.opt.chunkSize = pkt.ChunkSize + } + + return +} + +func (v *Protocol) WriteMessage(ctx context.Context, m *Message) (err error) { + m.payloadLength = uint32(len(m.Payload)) + + var c0h, c3h []byte + if c0h, err = m.generateC0Header(); err != nil { + return errors.WithMessage(err, "generate c0 header") + } + if c3h, err = m.generateC3Header(); err != nil { + return errors.WithMessage(err, "generate c3 header") + } + + var h []byte + p := m.Payload + for len(p) > 0 { + // TODO: We should convert buffered io to async io, because we will be stuck in block io here, + // TODO: but the risk is acceptable because we literally will set the underlay io timeout. + if ctx.Err() != nil { + return ctx.Err() + } + + if h == nil { + h = c0h + } else { + h = c3h + } + + if _, err = io.Copy(v.w, bytes.NewReader(h)); err != nil { + return errors.Wrapf(err, "write c0c3 header %x", h) + } + + size := len(p) + if size > int(v.output.opt.chunkSize) { + size = int(v.output.opt.chunkSize) + } + + if _, err = io.Copy(v.w, bytes.NewReader(p[:size])); err != nil { + return errors.Wrapf(err, "write chunk payload %vB", size) + } + p = p[size:] + } + + // TODO: We should convert buffered io to async io, because we will be stuck in block io here, + // TODO: but the risk is acceptable because we literally will set the underlay io timeout. + if ctx.Err() != nil { + return ctx.Err() + } + + // TODO: FIXME: Use writev to write for high performance. + if err = v.w.Flush(); err != nil { + return errors.Wrapf(err, "flush writer") + } + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 30, @section 4.1. Message Header +// 1byte. One byte field to represent the message type. A range of type IDs +// (1-7) are reserved for protocol control messages. +type MessageType uint8 + +const ( + // Please read @doc rtmp_specification_1.0.pdf, @page 30, @section 5. Protocol Control Messages + // RTMP reserves message type IDs 1-7 for protocol control messages. + // These messages contain information needed by the RTM Chunk Stream + // protocol or RTMP itself. Protocol messages with IDs 1 & 2 are + // reserved for usage with RTM Chunk Stream protocol. Protocol messages + // with IDs 3-6 are reserved for usage of RTMP. Protocol message with ID + // 7 is used between edge server and origin server. + MessageTypeSetChunkSize MessageType = 0x01 + MessageTypeAbort MessageType = 0x02 // 0x02 + MessageTypeAcknowledgement MessageType = 0x03 // 0x03 + MessageTypeUserControl MessageType = 0x04 // 0x04 + MessageTypeWindowAcknowledgementSize MessageType = 0x05 // 0x05 + MessageTypeSetPeerBandwidth MessageType = 0x06 // 0x06 + MessageTypeEdgeAndOriginServerCommand MessageType = 0x07 // 0x07 + // Please read @doc rtmp_specification_1.0.pdf, @page 38, @section 3. Types of messages + // The server and the client send messages over the network to + // communicate with each other. The messages can be of any type which + // includes audio messages, video messages, command messages, shared + // object messages, data messages, and user control messages. + // + // Please read @doc rtmp_specification_1.0.pdf, @page 41, @section 3.4. Audio message + // The client or the server sends this message to send audio data to the + // peer. The message type value of 8 is reserved for audio messages. + MessageTypeAudio MessageType = 0x08 + // Please read @doc rtmp_specification_1.0.pdf, @page 41, @section 3.5. Video message + // The client or the server sends this message to send video data to the + // peer. The message type value of 9 is reserved for video messages. + // These messages are large and can delay the sending of other type of + // messages. To avoid such a situation, the video message is assigned + // the lowest priority. + MessageTypeVideo MessageType = 0x09 // 0x09 + // Please read @doc rtmp_specification_1.0.pdf, @page 38, @section 3.1. Command message + // Command messages carry the AMF-encoded commands between the client + // and the server. These messages have been assigned message type value + // of 20 for AMF0 encoding and message type value of 17 for AMF3 + // encoding. These messages are sent to perform some operations like + // connect, createStream, publish, play, pause on the peer. Command + // messages like onstatus, result etc. are used to inform the sender + // about the status of the requested commands. A command message + // consists of command name, transaction ID, and command object that + // contains related parameters. A client or a server can request Remote + // Procedure Calls (RPC) over streams that are communicated using the + // command messages to the peer. + MessageTypeAMF3Command MessageType = 17 // 0x11 + MessageTypeAMF0Command MessageType = 20 // 0x14 + // Please read @doc rtmp_specification_1.0.pdf, @page 38, @section 3.2. Data message + // The client or the server sends this message to send Metadata or any + // user data to the peer. Metadata includes details about the + // data(audio, video etc.) like creation time, duration, theme and so + // on. These messages have been assigned message type value of 18 for + // AMF0 and message type value of 15 for AMF3. + MessageTypeAMF0Data MessageType = 18 // 0x12 + MessageTypeAMF3Data MessageType = 15 // 0x0f +) + +// The header of message. +type messageHeader struct { + // 3bytes. + // Three-byte field that contains a timestamp delta of the message. + // @remark, only used for decoding message from chunk stream. + timestampDelta uint32 + // 3bytes. + // Three-byte field that represents the size of the payload in bytes. + // It is set in big-endian format. + payloadLength uint32 + // 1byte. + // One byte field to represent the message type. A range of type IDs + // (1-7) are reserved for protocol control messages. + MessageType MessageType + // 4bytes. + // Four-byte field that identifies the stream of the message. These + // bytes are set in little-endian format. + streamID uint32 + + // The chunk stream id over which transport. + betterCid chunkID + + // Four-byte field that contains a timestamp of the message. + // The 4 bytes are packed in the big-endian order. + // @remark, we use 64bits for large time for jitter detect and for large tbn like HLS. + Timestamp uint64 +} + +// The RTMP message, transport over chunk stream in RTMP. +// Please read the cs id of @doc rtmp_specification_1.0.pdf, @page 30, @section 4.1. Message Header +type Message struct { + messageHeader + + // The payload which carries the RTMP packet. + Payload []byte +} + +func NewMessage() *Message { + return &Message{} +} + +func NewStreamMessage(streamID int) *Message { + v := NewMessage() + v.streamID = uint32(streamID) + v.betterCid = chunkIDOverStream + return v +} + +func (v *Message) generateC3Header() ([]byte, error) { + var c3h []byte + if v.Timestamp < extendedTimestamp { + c3h = make([]byte, 1) + } else { + c3h = make([]byte, 1+4) + } + + p := c3h + p[0] = 0xc0 | byte(v.betterCid&0x3f) + p = p[1:] + + // In RTMP protocol, there must not any timestamp in C3 header, + // but actually all products from adobe, such as FMS/AMS and Flash player and FMLE, + // always carry a extended timestamp in C3 header. + // @see: http://blog.csdn.net/win_lin/article/details/13363699 + if v.Timestamp >= extendedTimestamp { + p[0] = byte(v.Timestamp >> 24) + p[1] = byte(v.Timestamp >> 16) + p[2] = byte(v.Timestamp >> 8) + p[3] = byte(v.Timestamp) + } + + return c3h, nil +} + +func (v *Message) generateC0Header() ([]byte, error) { + var c0h []byte + if v.Timestamp < extendedTimestamp { + c0h = make([]byte, 1+3+3+1+4) + } else { + c0h = make([]byte, 1+3+3+1+4+4) + } + + p := c0h + p[0] = byte(v.betterCid) & 0x3f + p = p[1:] + + if v.Timestamp < extendedTimestamp { + p[0] = byte(v.Timestamp >> 16) + p[1] = byte(v.Timestamp >> 8) + p[2] = byte(v.Timestamp) + } else { + p[0] = 0xff + p[1] = 0xff + p[2] = 0xff + } + p = p[3:] + + p[0] = byte(v.payloadLength >> 16) + p[1] = byte(v.payloadLength >> 8) + p[2] = byte(v.payloadLength) + p = p[3:] + + p[0] = byte(v.MessageType) + p = p[1:] + + p[0] = byte(v.streamID) + p[1] = byte(v.streamID >> 8) + p[2] = byte(v.streamID >> 16) + p[3] = byte(v.streamID >> 24) + p = p[4:] + + if v.Timestamp >= extendedTimestamp { + p[0] = byte(v.Timestamp >> 24) + p[1] = byte(v.Timestamp >> 16) + p[2] = byte(v.Timestamp >> 8) + p[3] = byte(v.Timestamp) + } + + return c0h, nil +} + +// Please read the cs id of @doc rtmp_specification_1.0.pdf, @page 17, @section 6.1.1. Chunk Basic Header +type chunkID uint32 + +const ( + chunkIDProtocolControl chunkID = 0x02 + chunkIDOverConnection chunkID = 0x03 + chunkIDOverConnection2 chunkID = 0x04 + chunkIDOverStream chunkID = 0x05 + chunkIDOverStream2 chunkID = 0x06 + chunkIDVideo chunkID = 0x07 + chunkIDAudio chunkID = 0x08 +) + +// The Command Name of message. +const ( + commandConnect amf0String = amf0String("connect") + commandCreateStream amf0String = amf0String("createStream") + commandCloseStream amf0String = amf0String("closeStream") + commandPlay amf0String = amf0String("play") + commandPause amf0String = amf0String("pause") + commandOnBWDone amf0String = amf0String("onBWDone") + commandOnStatus amf0String = amf0String("onStatus") + commandResult amf0String = amf0String("_result") + commandError amf0String = amf0String("_error") + commandReleaseStream amf0String = amf0String("releaseStream") + commandFCPublish amf0String = amf0String("FCPublish") + commandFCUnpublish amf0String = amf0String("FCUnpublish") + commandPublish amf0String = amf0String("publish") + commandRtmpSampleAccess amf0String = amf0String("|RtmpSampleAccess") +) + +// The RTMP packet, transport as payload of RTMP message. +type Packet interface { + // Marshaler and unmarshaler + Size() int + encoding.BinaryUnmarshaler + encoding.BinaryMarshaler + + // RTMP protocol fields for each packet. + BetterCid() chunkID + Type() MessageType +} + +// A Call packet, both object and args are AMF0 objects. +type objectCallPacket struct { + CommandName amf0String + TransactionID amf0Number + CommandObject *amf0Object + Args *amf0Object +} + +func (v *objectCallPacket) BetterCid() chunkID { + return chunkIDOverConnection +} + +func (v *objectCallPacket) Type() MessageType { + return MessageTypeAMF0Command +} + +func (v *objectCallPacket) Size() int { + size := v.CommandName.Size() + v.TransactionID.Size() + v.CommandObject.Size() + if v.Args != nil { + size += v.Args.Size() + } + return size +} + +func (v *objectCallPacket) UnmarshalBinary(data []byte) (err error) { + p := data + + if err = v.CommandName.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal command name") + } + p = p[v.CommandName.Size():] + + if err = v.TransactionID.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal tid") + } + p = p[v.TransactionID.Size():] + + if err = v.CommandObject.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal command") + } + p = p[v.CommandObject.Size():] + + if len(p) == 0 { + return + } + + v.Args = NewAmf0Object() + if err = v.Args.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal args") + } + + return +} + +func (v *objectCallPacket) MarshalBinary() (data []byte, err error) { + var pb []byte + if pb, err = v.CommandName.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal command name") + } + data = append(data, pb...) + + if pb, err = v.TransactionID.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal tid") + } + data = append(data, pb...) + + if pb, err = v.CommandObject.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal command object") + } + data = append(data, pb...) + + if v.Args != nil { + if pb, err = v.Args.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal args") + } + data = append(data, pb...) + } + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 45, @section 4.1.1. connect +// The client sends the connect command to the server to request +// connection to a server application instance. +type ConnectAppPacket struct { + objectCallPacket +} + +func NewConnectAppPacket() *ConnectAppPacket { + v := &ConnectAppPacket{} + v.CommandName = commandConnect + v.CommandObject = NewAmf0Object() + v.TransactionID = amf0Number(1.0) + return v +} + +func (v *ConnectAppPacket) UnmarshalBinary(data []byte) (err error) { + if err = v.objectCallPacket.UnmarshalBinary(data); err != nil { + return errors.WithMessage(err, "unmarshal call") + } + + if v.CommandName != commandConnect { + return errors.Errorf("Invalid command name %v", string(v.CommandName)) + } + + if v.TransactionID != 1.0 { + return errors.Errorf("Invalid transaction ID %v", float64(v.TransactionID)) + } + + return +} + +func (v *ConnectAppPacket) TcUrl() string { + if v.CommandObject != nil { + if v, ok := v.CommandObject.Get("tcUrl").(*amf0String); ok { + return string(*v) + } + } + return "" +} + +// The response for ConnectAppPacket. +type ConnectAppResPacket struct { + objectCallPacket +} + +func NewConnectAppResPacket(tid amf0Number) *ConnectAppResPacket { + v := &ConnectAppResPacket{} + v.CommandName = commandResult + v.CommandObject = NewAmf0Object() + v.Args = NewAmf0Object() + v.TransactionID = tid + return v +} + +func (v *ConnectAppResPacket) SrsID() string { + if v.Args != nil { + if v, ok := v.Args.Get("data").(*amf0EcmaArray); ok { + if v, ok := v.Get("srs_id").(*amf0String); ok { + return string(*v) + } + } + } + return "" +} + +func (v *ConnectAppResPacket) UnmarshalBinary(data []byte) (err error) { + if err = v.objectCallPacket.UnmarshalBinary(data); err != nil { + return errors.WithMessage(err, "unmarshal call") + } + + if v.CommandName != commandResult { + return errors.Errorf("Invalid command name %v", string(v.CommandName)) + } + + return +} + +// A Call object, command object is variant. +type variantCallPacket struct { + CommandName amf0String + TransactionID amf0Number + CommandObject amf0Any // object or null +} + +func (v *variantCallPacket) BetterCid() chunkID { + return chunkIDOverConnection +} + +func (v *variantCallPacket) Type() MessageType { + return MessageTypeAMF0Command +} + +func (v *variantCallPacket) Size() int { + size := v.CommandName.Size() + v.TransactionID.Size() + + if v.CommandObject != nil { + size += v.CommandObject.Size() + } + + return size +} + +func (v *variantCallPacket) UnmarshalBinary(data []byte) (err error) { + p := data + + if err = v.CommandName.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal command name") + } + p = p[v.CommandName.Size():] + + if err = v.TransactionID.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal tid") + } + p = p[v.TransactionID.Size():] + + if len(p) > 0 { + if v.CommandObject, err = Amf0Discovery(p); err != nil { + return errors.WithMessage(err, "discovery command object") + } + if err = v.CommandObject.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal command object") + } + p = p[v.CommandObject.Size():] + } + + return +} + +func (v *variantCallPacket) MarshalBinary() (data []byte, err error) { + var pb []byte + if pb, err = v.CommandName.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal command name") + } + data = append(data, pb...) + + if pb, err = v.TransactionID.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal tid") + } + data = append(data, pb...) + + if v.CommandObject != nil { + if pb, err = v.CommandObject.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal command object") + } + data = append(data, pb...) + } + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 51, @section 4.1.2. Call +// The call method of the NetConnection object runs remote procedure +// calls (RPC) at the receiving end. The called RPC name is passed as a +// parameter to the call command. +// @remark onStatus packet is a call packet. +type CallPacket struct { + variantCallPacket + Args amf0Any // optional or object or null +} + +func NewCallPacket() *CallPacket { + return &CallPacket{} +} + +func (v *CallPacket) ArgsCode() string { + if v.Args != nil { + if v, ok := v.Args.(*amf0Object); ok { + if code, ok := v.Get("code").(*amf0String); ok { + return string(*code) + } + } + } + return "" +} + +func (v *CallPacket) Size() int { + size := v.variantCallPacket.Size() + + if v.Args != nil { + size += v.Args.Size() + } + + return size +} + +func (v *CallPacket) UnmarshalBinary(data []byte) (err error) { + p := data + + if err = v.variantCallPacket.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal call") + } + p = p[v.variantCallPacket.Size():] + + if len(p) > 0 { + if v.Args, err = Amf0Discovery(p); err != nil { + return errors.WithMessage(err, "discovery args") + } + if err = v.Args.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal args") + } + } + + return +} + +func (v *CallPacket) MarshalBinary() (data []byte, err error) { + var pb []byte + if pb, err = v.variantCallPacket.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal call") + } + data = append(data, pb...) + + if v.Args != nil { + if pb, err = v.Args.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal args") + } + data = append(data, pb...) + } + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 52, @section 4.1.3. createStream +// The client sends this command to the server to create a logical +// channel for message communication The publishing of audio, video, and +// metadata is carried out over stream channel created using the +// createStream command. +type CreateStreamPacket struct { + variantCallPacket +} + +func NewCreateStreamPacket() *CreateStreamPacket { + v := &CreateStreamPacket{} + v.CommandName = commandCreateStream + v.TransactionID = amf0Number(2) + v.CommandObject = NewAmf0Null() + return v +} + +// The response for create stream +type CreateStreamResPacket struct { + variantCallPacket + StreamID amf0Number +} + +func NewCreateStreamResPacket(tid amf0Number) *CreateStreamResPacket { + v := &CreateStreamResPacket{} + v.CommandName = commandResult + v.TransactionID = tid + v.CommandObject = NewAmf0Null() + v.StreamID = 0 + return v +} + +func (v *CreateStreamResPacket) Size() int { + return v.variantCallPacket.Size() + v.StreamID.Size() +} + +func (v *CreateStreamResPacket) UnmarshalBinary(data []byte) (err error) { + p := data + + if err = v.variantCallPacket.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal call") + } + p = p[v.variantCallPacket.Size():] + + if err = v.StreamID.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal sid") + } + + return +} + +func (v *CreateStreamResPacket) MarshalBinary() (data []byte, err error) { + var pb []byte + if pb, err = v.variantCallPacket.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal call") + } + data = append(data, pb...) + + if pb, err = v.StreamID.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal sid") + } + data = append(data, pb...) + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 64, @section 4.2.6. Publish +type PublishPacket struct { + variantCallPacket + StreamName amf0String + StreamType amf0String +} + +func NewPublishPacket() *PublishPacket { + v := &PublishPacket{} + v.CommandName = commandPublish + v.CommandObject = NewAmf0Null() + v.StreamType = "live" + return v +} + +func (v *PublishPacket) Size() int { + return v.variantCallPacket.Size() + v.StreamName.Size() + v.StreamType.Size() +} + +func (v *PublishPacket) UnmarshalBinary(data []byte) (err error) { + p := data + + if err = v.variantCallPacket.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal call") + } + p = p[v.variantCallPacket.Size():] + + if err = v.StreamName.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal stream name") + } + p = p[v.StreamName.Size():] + + if err = v.StreamType.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal stream type") + } + + return +} + +func (v *PublishPacket) MarshalBinary() (data []byte, err error) { + var pb []byte + if pb, err = v.variantCallPacket.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal call") + } + data = append(data, pb...) + + if pb, err = v.StreamName.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal stream name") + } + data = append(data, pb...) + + if pb, err = v.StreamType.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal stream type") + } + data = append(data, pb...) + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 54, @section 4.2.1. play +type PlayPacket struct { + variantCallPacket + StreamName amf0String +} + +func NewPlayPacket() *PlayPacket { + v := &PlayPacket{} + v.CommandName = commandPlay + v.CommandObject = NewAmf0Null() + return v +} + +func (v *PlayPacket) Size() int { + return v.variantCallPacket.Size() + v.StreamName.Size() +} + +func (v *PlayPacket) UnmarshalBinary(data []byte) (err error) { + p := data + + if err = v.variantCallPacket.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal call") + } + p = p[v.variantCallPacket.Size():] + + if err = v.StreamName.UnmarshalBinary(p); err != nil { + return errors.WithMessage(err, "unmarshal stream name") + } + p = p[v.StreamName.Size():] + + return +} + +func (v *PlayPacket) MarshalBinary() (data []byte, err error) { + var pb []byte + if pb, err = v.variantCallPacket.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal call") + } + data = append(data, pb...) + + if pb, err = v.StreamName.MarshalBinary(); err != nil { + return nil, errors.WithMessage(err, "marshal stream name") + } + data = append(data, pb...) + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 31, @section 5.1. Set Chunk Size +// Protocol control message 1, Set Chunk Size, is used to notify the +// peer about the new maximum chunk size. +type SetChunkSize struct { + ChunkSize uint32 +} + +func NewSetChunkSize() *SetChunkSize { + return &SetChunkSize{ + ChunkSize: defaultChunkSize, + } +} + +func (v *SetChunkSize) BetterCid() chunkID { + return chunkIDProtocolControl +} + +func (v *SetChunkSize) Type() MessageType { + return MessageTypeSetChunkSize +} + +func (v *SetChunkSize) Size() int { + return 4 +} + +func (v *SetChunkSize) UnmarshalBinary(data []byte) (err error) { + if len(data) < 4 { + return errors.Errorf("requires 4 only %v bytes, %x", len(data), data) + } + v.ChunkSize = binary.BigEndian.Uint32(data) + + return +} + +func (v *SetChunkSize) MarshalBinary() (data []byte, err error) { + data = make([]byte, 4) + binary.BigEndian.PutUint32(data, v.ChunkSize) + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 33, @section 5.5. Window Acknowledgement Size (5) +// The client or the server sends this message to inform the peer which +// window size to use when sending acknowledgment. +type WindowAcknowledgementSize struct { + AckSize uint32 +} + +func NewWindowAcknowledgementSize() *WindowAcknowledgementSize { + return &WindowAcknowledgementSize{} +} + +func (v *WindowAcknowledgementSize) BetterCid() chunkID { + return chunkIDProtocolControl +} + +func (v *WindowAcknowledgementSize) Type() MessageType { + return MessageTypeWindowAcknowledgementSize +} + +func (v *WindowAcknowledgementSize) Size() int { + return 4 +} + +func (v *WindowAcknowledgementSize) UnmarshalBinary(data []byte) (err error) { + if len(data) < 4 { + return errors.Errorf("requires 4 only %v bytes, %x", len(data), data) + } + v.AckSize = binary.BigEndian.Uint32(data) + + return +} + +func (v *WindowAcknowledgementSize) MarshalBinary() (data []byte, err error) { + data = make([]byte, 4) + binary.BigEndian.PutUint32(data, v.AckSize) + + return +} + +// Please read @doc rtmp_specification_1.0.pdf, @page 33, @section 5.6. Set Peer Bandwidth (6) +// The sender can mark this message hard (0), soft (1), or dynamic (2) +// using the Limit type field. +type LimitType uint8 + +const ( + LimitTypeHard LimitType = iota + LimitTypeSoft + LimitTypeDynamic +) + +// Please read @doc rtmp_specification_1.0.pdf, @page 33, @section 5.6. Set Peer Bandwidth (6) +// The client or the server sends this message to update the output +// bandwidth of the peer. +type SetPeerBandwidth struct { + Bandwidth uint32 + LimitType LimitType +} + +func NewSetPeerBandwidth() *SetPeerBandwidth { + return &SetPeerBandwidth{} +} + +func (v *SetPeerBandwidth) BetterCid() chunkID { + return chunkIDProtocolControl +} + +func (v *SetPeerBandwidth) Type() MessageType { + return MessageTypeSetPeerBandwidth +} + +func (v *SetPeerBandwidth) Size() int { + return 4 + 1 +} + +func (v *SetPeerBandwidth) UnmarshalBinary(data []byte) (err error) { + if len(data) < 5 { + return errors.Errorf("requires 5 only %v bytes, %x", len(data), data) + } + v.Bandwidth = binary.BigEndian.Uint32(data) + v.LimitType = LimitType(data[4]) + + return +} + +func (v *SetPeerBandwidth) MarshalBinary() (data []byte, err error) { + data = make([]byte, 5) + binary.BigEndian.PutUint32(data, v.Bandwidth) + data[4] = byte(v.LimitType) + + return +} + +type EventType uint16 + +const ( + // Generally, 4bytes event-data + + // The server sends this event to notify the client + // that a stream has become functional and can be + // used for communication. By default, this event + // is sent on ID 0 after the application connect + // command is successfully received from the + // client. The event data is 4-byte and represents + // The stream ID of the stream that became + // Functional. + EventTypeStreamBegin = 0x00 + + // The server sends this event to notify the client + // that the playback of data is over as requested + // on this stream. No more data is sent without + // issuing additional commands. The client discards + // The messages received for the stream. The + // 4 bytes of event data represent the ID of the + // stream on which playback has ended. + EventTypeStreamEOF = 0x01 + + // The server sends this event to notify the client + // that there is no more data on the stream. If the + // server does not detect any message for a time + // period, it can notify the subscribed clients + // that the stream is dry. The 4 bytes of event + // data represent the stream ID of the dry stream. + EventTypeStreamDry = 0x02 + + // The client sends this event to inform the server + // of the buffer size (in milliseconds) that is + // used to buffer any data coming over a stream. + // This event is sent before the server starts + // processing the stream. The first 4 bytes of the + // event data represent the stream ID and the next + // 4 bytes represent the buffer length, in + // milliseconds. + EventTypeSetBufferLength = 0x03 // 8bytes event-data + + // The server sends this event to notify the client + // that the stream is a recorded stream. The + // 4 bytes event data represent the stream ID of + // The recorded stream. + EventTypeStreamIsRecorded = 0x04 + + // The server sends this event to test whether the + // client is reachable. Event data is a 4-byte + // timestamp, representing the local server time + // When the server dispatched the command. The + // client responds with kMsgPingResponse on + // receiving kMsgPingRequest. + EventTypePingRequest = 0x06 + + // The client sends this event to the server in + // Response to the ping request. The event data is + // a 4-byte timestamp, which was received with the + // kMsgPingRequest request. + EventTypePingResponse = 0x07 + + // For PCUC size=3, for example the payload is "00 1A 01", + // it's a FMS control event, where the event type is 0x001a and event data is 0x01, + // please notice that the event data is only 1 byte for this event. + EventTypeFmsEvent0 = 0x1a +) + +// Please read @doc rtmp_specification_1.0.pdf, @page 32, @5.4. User Control Message (4) +// The client or the server sends this message to notify the peer about the user control events. +// This message carries Event type and Event data. +type UserControl struct { + // Event type is followed by Event data. + // @see: SrcPCUCEventType + EventType EventType + // The event data generally in 4bytes. + // @remark for event type is 0x001a, only 1bytes. + // @see SrsPCUCFmsEvent0 + EventData int32 + // 4bytes if event_type is SetBufferLength; otherwise 0. + ExtraData int32 +} + +func NewUserControl() *UserControl { + return &UserControl{} +} + +func (v *UserControl) BetterCid() chunkID { + return chunkIDProtocolControl +} + +func (v *UserControl) Type() MessageType { + return MessageTypeUserControl +} + +func (v *UserControl) Size() int { + size := 2 + + if v.EventType == EventTypeFmsEvent0 { + size += 1 + } else { + size += 4 + } + + if v.EventType == EventTypeSetBufferLength { + size += 4 + } + + return size +} + +func (v *UserControl) UnmarshalBinary(data []byte) (err error) { + if len(data) < 3 { + return errors.Errorf("requires 5 only %v bytes, %x", len(data), data) + } + + v.EventType = EventType(binary.BigEndian.Uint16(data)) + if len(data) < v.Size() { + return errors.Errorf("requires %v only %v bytes, %x", v.Size(), len(data), data) + } + + if v.EventType == EventTypeFmsEvent0 { + v.EventData = int32(uint8(data[2])) + } else { + v.EventData = int32(binary.BigEndian.Uint32(data[2:])) + } + + if v.EventType == EventTypeSetBufferLength { + v.ExtraData = int32(binary.BigEndian.Uint32(data[6:])) + } + + return +} + +func (v *UserControl) MarshalBinary() (data []byte, err error) { + data = make([]byte, v.Size()) + binary.BigEndian.PutUint16(data, uint16(v.EventType)) + + if v.EventType == EventTypeFmsEvent0 { + data[2] = uint8(v.EventData) + } else { + binary.BigEndian.PutUint32(data[2:], uint32(v.EventData)) + } + + if v.EventType == EventTypeSetBufferLength { + binary.BigEndian.PutUint32(data[6:], uint32(v.ExtraData)) + } + + return +} diff --git a/proxy/signal.go b/proxy/signal.go new file mode 100644 index 0000000000..367543f4a7 --- /dev/null +++ b/proxy/signal.go @@ -0,0 +1,44 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "os" + "os/signal" + "syscall" + "time" + + "srs-proxy/errors" + "srs-proxy/logger" +) + +func installSignals(ctx context.Context, cancel context.CancelFunc) { + sc := make(chan os.Signal, 1) + signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt) + + go func() { + for s := range sc { + logger.Df(ctx, "Got signal %v", s) + cancel() + } + }() +} + +func installForceQuit(ctx context.Context) error { + var forceTimeout time.Duration + if t, err := time.ParseDuration(envForceQuitTimeout()); err != nil { + return errors.Wrapf(err, "parse force timeout %v", envForceQuitTimeout()) + } else { + forceTimeout = t + } + + go func() { + <-ctx.Done() + time.Sleep(forceTimeout) + logger.Wf(ctx, "Force to exit by timeout") + os.Exit(1) + }() + return nil +} diff --git a/proxy/srs.go b/proxy/srs.go new file mode 100644 index 0000000000..d05a39c610 --- /dev/null +++ b/proxy/srs.go @@ -0,0 +1,553 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "encoding/json" + "fmt" + "math/rand" + "os" + "strconv" + "strings" + "time" + + // Use v8 because we use Go 1.16+, while v9 requires Go 1.18+ + "github.com/go-redis/redis/v8" + + "srs-proxy/errors" + "srs-proxy/logger" + "srs-proxy/sync" +) + +// If server heartbeat in this duration, it's alive. +const srsServerAliveDuration = 300 * time.Second + +// If HLS streaming update in this duration, it's alive. +const srsHLSAliveDuration = 120 * time.Second + +// If WebRTC streaming update in this duration, it's alive. +const srsRTCAliveDuration = 120 * time.Second + +type SRSServer struct { + // The server IP. + IP string `json:"ip,omitempty"` + // The server device ID, configured by user. + DeviceID string `json:"device_id,omitempty"` + // The server id of SRS, store in file, may not change, mandatory. + ServerID string `json:"server_id,omitempty"` + // The service id of SRS, always change when restarted, mandatory. + ServiceID string `json:"service_id,omitempty"` + // The process id of SRS, always change when restarted, mandatory. + PID string `json:"pid,omitempty"` + // The RTMP listen endpoints. + RTMP []string `json:"rtmp,omitempty"` + // The HTTP Stream listen endpoints. + HTTP []string `json:"http,omitempty"` + // The HTTP API listen endpoints. + API []string `json:"api,omitempty"` + // The SRT server listen endpoints. + SRT []string `json:"srt,omitempty"` + // The RTC server listen endpoints. + RTC []string `json:"rtc,omitempty"` + // Last update time. + UpdatedAt time.Time `json:"update_at,omitempty"` +} + +func (v *SRSServer) ID() string { + return fmt.Sprintf("%v-%v-%v", v.ServerID, v.ServiceID, v.PID) +} + +func (v *SRSServer) String() string { + return fmt.Sprintf("%v", v) +} + +func (v *SRSServer) Format(f fmt.State, c rune) { + switch c { + case 'v', 's': + if f.Flag('+') { + var sb strings.Builder + sb.WriteString(fmt.Sprintf("pid=%v, server=%v, service=%v", v.PID, v.ServerID, v.ServiceID)) + if v.DeviceID != "" { + sb.WriteString(fmt.Sprintf(", device=%v", v.DeviceID)) + } + if len(v.RTMP) > 0 { + sb.WriteString(fmt.Sprintf(", rtmp=[%v]", strings.Join(v.RTMP, ","))) + } + if len(v.HTTP) > 0 { + sb.WriteString(fmt.Sprintf(", http=[%v]", strings.Join(v.HTTP, ","))) + } + if len(v.API) > 0 { + sb.WriteString(fmt.Sprintf(", api=[%v]", strings.Join(v.API, ","))) + } + if len(v.SRT) > 0 { + sb.WriteString(fmt.Sprintf(", srt=[%v]", strings.Join(v.SRT, ","))) + } + if len(v.RTC) > 0 { + sb.WriteString(fmt.Sprintf(", rtc=[%v]", strings.Join(v.RTC, ","))) + } + sb.WriteString(fmt.Sprintf(", update=%v", v.UpdatedAt.Format("2006-01-02 15:04:05.999"))) + fmt.Fprintf(f, "SRS ip=%v, id=%v, %v", v.IP, v.ID(), sb.String()) + } else { + fmt.Fprintf(f, "SRS ip=%v, id=%v", v.IP, v.ID()) + } + default: + fmt.Fprintf(f, "%v, fmt=%%%c", v, c) + } +} + +func NewSRSServer(opts ...func(*SRSServer)) *SRSServer { + v := &SRSServer{} + for _, opt := range opts { + opt(v) + } + return v +} + +// NewDefaultSRSForDebugging initialize the default SRS media server, for debugging only. +func NewDefaultSRSForDebugging() (*SRSServer, error) { + if envDefaultBackendEnabled() != "on" { + return nil, nil + } + + if envDefaultBackendIP() == "" { + return nil, fmt.Errorf("empty default backend ip") + } + if envDefaultBackendRTMP() == "" { + return nil, fmt.Errorf("empty default backend rtmp") + } + + server := NewSRSServer(func(srs *SRSServer) { + srs.IP = envDefaultBackendIP() + srs.RTMP = []string{envDefaultBackendRTMP()} + srs.ServerID = fmt.Sprintf("default-%v", logger.GenerateContextID()) + srs.ServiceID = logger.GenerateContextID() + srs.PID = fmt.Sprintf("%v", os.Getpid()) + srs.UpdatedAt = time.Now() + }) + + if envDefaultBackendHttp() != "" { + server.HTTP = []string{envDefaultBackendHttp()} + } + if envDefaultBackendAPI() != "" { + server.API = []string{envDefaultBackendAPI()} + } + if envDefaultBackendRTC() != "" { + server.RTC = []string{envDefaultBackendRTC()} + } + if envDefaultBackendSRT() != "" { + server.SRT = []string{envDefaultBackendSRT()} + } + return server, nil +} + +// SRSLoadBalancer is the interface to load balance the SRS servers. +type SRSLoadBalancer interface { + // Initialize the load balancer. + Initialize(ctx context.Context) error + // Update the backer server. + Update(ctx context.Context, server *SRSServer) error + // Pick a backend server for the specified stream URL. + Pick(ctx context.Context, streamURL string) (*SRSServer, error) + // Load or store the HLS streaming for the specified stream URL. + LoadOrStoreHLS(ctx context.Context, streamURL string, value *HLSPlayStream) (*HLSPlayStream, error) + // Load the HLS streaming by SPBHID, the SRS Proxy Backend HLS ID. + LoadHLSBySPBHID(ctx context.Context, spbhid string) (*HLSPlayStream, error) + // Store the WebRTC streaming for the specified stream URL. + StoreWebRTC(ctx context.Context, streamURL string, value *RTCConnection) error + // Load the WebRTC streaming by ufrag, the ICE username. + LoadWebRTCByUfrag(ctx context.Context, ufrag string) (*RTCConnection, error) +} + +// srsLoadBalancer is the global SRS load balancer. +var srsLoadBalancer SRSLoadBalancer + +// srsMemoryLoadBalancer stores state in memory. +type srsMemoryLoadBalancer struct { + // All available SRS servers, key is server ID. + servers sync.Map[string, *SRSServer] + // The picked server to servce client by specified stream URL, key is stream url. + picked sync.Map[string, *SRSServer] + // The HLS streaming, key is stream URL. + hlsStreamURL sync.Map[string, *HLSPlayStream] + // The HLS streaming, key is SPBHID. + hlsSPBHID sync.Map[string, *HLSPlayStream] + // The WebRTC streaming, key is stream URL. + rtcStreamURL sync.Map[string, *RTCConnection] + // The WebRTC streaming, key is ufrag. + rtcUfrag sync.Map[string, *RTCConnection] +} + +func NewMemoryLoadBalancer() SRSLoadBalancer { + return &srsMemoryLoadBalancer{} +} + +func (v *srsMemoryLoadBalancer) Initialize(ctx context.Context) error { + if server, err := NewDefaultSRSForDebugging(); err != nil { + return errors.Wrapf(err, "initialize default SRS") + } else if server != nil { + if err := v.Update(ctx, server); err != nil { + return errors.Wrapf(err, "update default SRS %+v", server) + } + + // Keep alive. + go func() { + for { + select { + case <-ctx.Done(): + return + case <-time.After(30 * time.Second): + if err := v.Update(ctx, server); err != nil { + logger.Wf(ctx, "update default SRS %+v failed, %+v", server, err) + } + } + } + }() + logger.Df(ctx, "MemoryLB: Initialize default SRS media server, %+v", server) + } + return nil +} + +func (v *srsMemoryLoadBalancer) Update(ctx context.Context, server *SRSServer) error { + v.servers.Store(server.ID(), server) + return nil +} + +func (v *srsMemoryLoadBalancer) Pick(ctx context.Context, streamURL string) (*SRSServer, error) { + // Always proxy to the same server for the same stream URL. + if server, ok := v.picked.Load(streamURL); ok { + return server, nil + } + + // Gather all servers that were alive within the last few seconds. + var servers []*SRSServer + v.servers.Range(func(key string, server *SRSServer) bool { + if time.Since(server.UpdatedAt) < srsServerAliveDuration { + servers = append(servers, server) + } + return true + }) + + // If no servers available, use all possible servers. + if len(servers) == 0 { + v.servers.Range(func(key string, server *SRSServer) bool { + servers = append(servers, server) + return true + }) + } + + // No server found, failed. + if len(servers) == 0 { + return nil, fmt.Errorf("no server available for %v", streamURL) + } + + // Pick a server randomly from servers. + server := servers[rand.Intn(len(servers))] + v.picked.Store(streamURL, server) + return server, nil +} + +func (v *srsMemoryLoadBalancer) LoadHLSBySPBHID(ctx context.Context, spbhid string) (*HLSPlayStream, error) { + // Load the HLS streaming for the SPBHID, for TS files. + if actual, ok := v.hlsSPBHID.Load(spbhid); !ok { + return nil, errors.Errorf("no HLS streaming for SPBHID %v", spbhid) + } else { + return actual, nil + } +} + +func (v *srsMemoryLoadBalancer) LoadOrStoreHLS(ctx context.Context, streamURL string, value *HLSPlayStream) (*HLSPlayStream, error) { + // Update the HLS streaming for the stream URL, for M3u8. + actual, _ := v.hlsStreamURL.LoadOrStore(streamURL, value) + if actual == nil { + return nil, errors.Errorf("load or store HLS streaming for %v failed", streamURL) + } + + // Update the HLS streaming for the SPBHID, for TS files. + v.hlsSPBHID.Store(value.SRSProxyBackendHLSID, actual) + + return actual, nil +} + +func (v *srsMemoryLoadBalancer) StoreWebRTC(ctx context.Context, streamURL string, value *RTCConnection) error { + // Update the WebRTC streaming for the stream URL. + v.rtcStreamURL.Store(streamURL, value) + + // Update the WebRTC streaming for the ufrag. + v.rtcUfrag.Store(value.Ufrag, value) + return nil +} + +func (v *srsMemoryLoadBalancer) LoadWebRTCByUfrag(ctx context.Context, ufrag string) (*RTCConnection, error) { + if actual, ok := v.rtcUfrag.Load(ufrag); !ok { + return nil, errors.Errorf("no WebRTC streaming for ufrag %v", ufrag) + } else { + return actual, nil + } +} + +type srsRedisLoadBalancer struct { + // The redis client sdk. + rdb *redis.Client +} + +func NewRedisLoadBalancer() SRSLoadBalancer { + return &srsRedisLoadBalancer{} +} + +func (v *srsRedisLoadBalancer) Initialize(ctx context.Context) error { + redisDatabase, err := strconv.Atoi(envRedisDB()) + if err != nil { + return errors.Wrapf(err, "invalid PROXY_REDIS_DB %v", envRedisDB()) + } + + rdb := redis.NewClient(&redis.Options{ + Addr: fmt.Sprintf("%v:%v", envRedisHost(), envRedisPort()), + Password: envRedisPassword(), + DB: redisDatabase, + }) + v.rdb = rdb + + if err := rdb.Ping(ctx).Err(); err != nil { + return errors.Wrapf(err, "unable to connect to redis %v", rdb.String()) + } + logger.Df(ctx, "RedisLB: connected to redis %v ok", rdb.String()) + + if server, err := NewDefaultSRSForDebugging(); err != nil { + return errors.Wrapf(err, "initialize default SRS") + } else if server != nil { + if err := v.Update(ctx, server); err != nil { + return errors.Wrapf(err, "update default SRS %+v", server) + } + + // Keep alive. + go func() { + for { + select { + case <-ctx.Done(): + return + case <-time.After(30 * time.Second): + if err := v.Update(ctx, server); err != nil { + logger.Wf(ctx, "update default SRS %+v failed, %+v", server, err) + } + } + } + }() + logger.Df(ctx, "RedisLB: Initialize default SRS media server, %+v", server) + } + return nil +} + +func (v *srsRedisLoadBalancer) Update(ctx context.Context, server *SRSServer) error { + b, err := json.Marshal(server) + if err != nil { + return errors.Wrapf(err, "marshal server %+v", server) + } + + key := v.redisKeyServer(server.ID()) + if err = v.rdb.Set(ctx, key, b, srsServerAliveDuration).Err(); err != nil { + return errors.Wrapf(err, "set key=%v server %+v", key, server) + } + + // Query all servers from redis, in json string. + var serverKeys []string + if b, err := v.rdb.Get(ctx, v.redisKeyServers()).Bytes(); err == nil { + if err := json.Unmarshal(b, &serverKeys); err != nil { + return errors.Wrapf(err, "unmarshal key=%v servers %v", v.redisKeyServers(), string(b)) + } + } + + // Check each server expiration, if not exists in redis, remove from servers. + for i := len(serverKeys) - 1; i >= 0; i-- { + if _, err := v.rdb.Get(ctx, serverKeys[i]).Bytes(); err != nil { + serverKeys = append(serverKeys[:i], serverKeys[i+1:]...) + } + } + + // Add server to servers if not exists. + var found bool + for _, serverKey := range serverKeys { + if serverKey == key { + found = true + break + } + } + if !found { + serverKeys = append(serverKeys, key) + } + + // Update all servers to redis. + b, err = json.Marshal(serverKeys) + if err != nil { + return errors.Wrapf(err, "marshal servers %+v", serverKeys) + } + if err = v.rdb.Set(ctx, v.redisKeyServers(), b, 0).Err(); err != nil { + return errors.Wrapf(err, "set key=%v servers %+v", v.redisKeyServers(), serverKeys) + } + + return nil +} + +func (v *srsRedisLoadBalancer) Pick(ctx context.Context, streamURL string) (*SRSServer, error) { + key := fmt.Sprintf("srs-proxy-url:%v", streamURL) + + // Always proxy to the same server for the same stream URL. + if serverKey, err := v.rdb.Get(ctx, key).Result(); err == nil { + // If server not exists, ignore and pick another server for the stream URL. + if b, err := v.rdb.Get(ctx, serverKey).Bytes(); err == nil && len(b) > 0 { + var server SRSServer + if err := json.Unmarshal(b, &server); err != nil { + return nil, errors.Wrapf(err, "unmarshal key=%v server %v", key, string(b)) + } + + // TODO: If server fail, we should migrate the streams to another server. + return &server, nil + } + } + + // Query all servers from redis, in json string. + var serverKeys []string + if b, err := v.rdb.Get(ctx, v.redisKeyServers()).Bytes(); err == nil { + if err := json.Unmarshal(b, &serverKeys); err != nil { + return nil, errors.Wrapf(err, "unmarshal key=%v servers %v", v.redisKeyServers(), string(b)) + } + } + + // No server found, failed. + if len(serverKeys) == 0 { + return nil, fmt.Errorf("no server available for %v", streamURL) + } + + // All server should be alive, if not, should have been removed by redis. So we only + // random pick one that is always available. + var serverKey string + var server SRSServer + for i := 0; i < 3; i++ { + tryServerKey := serverKeys[rand.Intn(len(serverKeys))] + b, err := v.rdb.Get(ctx, tryServerKey).Bytes() + if err == nil && len(b) > 0 { + if err := json.Unmarshal(b, &server); err != nil { + return nil, errors.Wrapf(err, "unmarshal key=%v server %v", serverKey, string(b)) + } + + serverKey = tryServerKey + break + } + } + if serverKey == "" { + return nil, errors.Errorf("no server available in %v for %v", serverKeys, streamURL) + } + + // Update the picked server for the stream URL. + if err := v.rdb.Set(ctx, key, []byte(serverKey), 0).Err(); err != nil { + return nil, errors.Wrapf(err, "set key=%v server %v", key, serverKey) + } + + return &server, nil +} + +func (v *srsRedisLoadBalancer) LoadHLSBySPBHID(ctx context.Context, spbhid string) (*HLSPlayStream, error) { + key := v.redisKeySPBHID(spbhid) + + b, err := v.rdb.Get(ctx, key).Bytes() + if err != nil { + return nil, errors.Wrapf(err, "get key=%v HLS", key) + } + + var actual HLSPlayStream + if err := json.Unmarshal(b, &actual); err != nil { + return nil, errors.Wrapf(err, "unmarshal key=%v HLS %v", key, string(b)) + } + + return &actual, nil +} + +func (v *srsRedisLoadBalancer) LoadOrStoreHLS(ctx context.Context, streamURL string, value *HLSPlayStream) (*HLSPlayStream, error) { + b, err := json.Marshal(value) + if err != nil { + return nil, errors.Wrapf(err, "marshal HLS %v", value) + } + + key := v.redisKeyHLS(streamURL) + if err = v.rdb.Set(ctx, key, b, srsHLSAliveDuration).Err(); err != nil { + return nil, errors.Wrapf(err, "set key=%v HLS %v", key, value) + } + + key2 := v.redisKeySPBHID(value.SRSProxyBackendHLSID) + if err := v.rdb.Set(ctx, key2, b, srsHLSAliveDuration).Err(); err != nil { + return nil, errors.Wrapf(err, "set key=%v HLS %v", key2, value) + } + + // Query the HLS streaming from redis. + b2, err := v.rdb.Get(ctx, key).Bytes() + if err != nil { + return nil, errors.Wrapf(err, "get key=%v HLS", key) + } + + var actual HLSPlayStream + if err := json.Unmarshal(b2, &actual); err != nil { + return nil, errors.Wrapf(err, "unmarshal key=%v HLS %v", key, string(b2)) + } + + return &actual, nil +} + +func (v *srsRedisLoadBalancer) StoreWebRTC(ctx context.Context, streamURL string, value *RTCConnection) error { + b, err := json.Marshal(value) + if err != nil { + return errors.Wrapf(err, "marshal WebRTC %v", value) + } + + key := v.redisKeyRTC(streamURL) + if err = v.rdb.Set(ctx, key, b, srsRTCAliveDuration).Err(); err != nil { + return errors.Wrapf(err, "set key=%v WebRTC %v", key, value) + } + + key2 := v.redisKeyUfrag(value.Ufrag) + if err := v.rdb.Set(ctx, key2, b, srsRTCAliveDuration).Err(); err != nil { + return errors.Wrapf(err, "set key=%v WebRTC %v", key2, value) + } + + return nil +} + +func (v *srsRedisLoadBalancer) LoadWebRTCByUfrag(ctx context.Context, ufrag string) (*RTCConnection, error) { + key := v.redisKeyUfrag(ufrag) + + b, err := v.rdb.Get(ctx, key).Bytes() + if err != nil { + return nil, errors.Wrapf(err, "get key=%v WebRTC", key) + } + + var actual RTCConnection + if err := json.Unmarshal(b, &actual); err != nil { + return nil, errors.Wrapf(err, "unmarshal key=%v WebRTC %v", key, string(b)) + } + + return &actual, nil +} + +func (v *srsRedisLoadBalancer) redisKeyUfrag(ufrag string) string { + return fmt.Sprintf("srs-proxy-ufrag:%v", ufrag) +} + +func (v *srsRedisLoadBalancer) redisKeyRTC(streamURL string) string { + return fmt.Sprintf("srs-proxy-rtc:%v", streamURL) +} + +func (v *srsRedisLoadBalancer) redisKeySPBHID(spbhid string) string { + return fmt.Sprintf("srs-proxy-spbhid:%v", spbhid) +} + +func (v *srsRedisLoadBalancer) redisKeyHLS(streamURL string) string { + return fmt.Sprintf("srs-proxy-hls:%v", streamURL) +} + +func (v *srsRedisLoadBalancer) redisKeyServer(serverID string) string { + return fmt.Sprintf("srs-proxy-server:%v", serverID) +} + +func (v *srsRedisLoadBalancer) redisKeyServers() string { + return fmt.Sprintf("srs-proxy-all-servers") +} diff --git a/proxy/srt.go b/proxy/srt.go new file mode 100644 index 0000000000..e4c629af8d --- /dev/null +++ b/proxy/srt.go @@ -0,0 +1,574 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "bytes" + "context" + "encoding/binary" + "fmt" + "net" + "strings" + stdSync "sync" + "time" + + "srs-proxy/errors" + "srs-proxy/logger" + "srs-proxy/sync" +) + +// srsSRTServer is the proxy for SRS server via SRT. It will figure out which backend server to +// proxy to. It only parses the SRT handshake messages, parses the stream id, and proxy to the +// backend server. +type srsSRTServer struct { + // The UDP listener for SRT server. + listener *net.UDPConn + + // The SRT connections, identify by the socket ID. + sockets sync.Map[uint32, *SRTConnection] + // The system start time. + start time.Time + + // The wait group for server. + wg stdSync.WaitGroup +} + +func NewSRSSRTServer(opts ...func(*srsSRTServer)) *srsSRTServer { + v := &srsSRTServer{ + start: time.Now(), + } + + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *srsSRTServer) Close() error { + if v.listener != nil { + v.listener.Close() + } + + v.wg.Wait() + return nil +} + +func (v *srsSRTServer) Run(ctx context.Context) error { + // Parse address to listen. + endpoint := envSRTServer() + if !strings.Contains(endpoint, ":") { + endpoint = ":" + endpoint + } + + saddr, err := net.ResolveUDPAddr("udp", endpoint) + if err != nil { + return errors.Wrapf(err, "resolve udp addr %v", endpoint) + } + + listener, err := net.ListenUDP("udp", saddr) + if err != nil { + return errors.Wrapf(err, "listen udp %v", saddr) + } + v.listener = listener + logger.Df(ctx, "SRT server listen at %v", saddr) + + // Consume all messages from UDP media transport. + v.wg.Add(1) + go func() { + defer v.wg.Done() + + for ctx.Err() == nil { + buf := make([]byte, 4096) + n, caddr, err := v.listener.ReadFromUDP(buf) + if err != nil { + // TODO: If SRT server closed unexpectedly, we should notice the main loop to quit. + logger.Wf(ctx, "read from udp failed, err=%+v", err) + continue + } + + if err := v.handleClientUDP(ctx, caddr, buf[:n]); err != nil { + logger.Wf(ctx, "handle udp %vB failed, addr=%v, err=%+v", n, caddr, err) + } + } + }() + + return nil +} + +func (v *srsSRTServer) handleClientUDP(ctx context.Context, addr *net.UDPAddr, data []byte) error { + socketID := srtParseSocketID(data) + + var pkt *SRTHandshakePacket + if srtIsHandshake(data) { + pkt = &SRTHandshakePacket{} + if err := pkt.UnmarshalBinary(data); err != nil { + return err + } + + if socketID == 0 { + socketID = pkt.SRTSocketID + } + } + + conn, ok := v.sockets.LoadOrStore(socketID, NewSRTConnection(func(c *SRTConnection) { + c.ctx = logger.WithContext(ctx) + c.listenerUDP, c.socketID = v.listener, socketID + c.start = v.start + })) + + ctx = conn.ctx + if !ok { + logger.Df(ctx, "Create new SRT connection skt=%v", socketID) + } + + if newSocketID, err := conn.HandlePacket(pkt, addr, data); err != nil { + return errors.Wrapf(err, "handle packet") + } else if newSocketID != 0 && newSocketID != socketID { + // The connection may use a new socket ID. + // TODO: FIXME: Should cleanup the dead SRT connection. + v.sockets.Store(newSocketID, conn) + } + + return nil +} + +// SRTConnection is an SRT connection proxy, for both caller and listener. It represents an SRT +// connection, identify by the socket ID. +// +// It's similar to RTMP or HTTP FLV/TS proxy connection, which are stateless and all state is in +// the client request. The SRTConnection is stateless, and no need to sync between proxy servers. +// +// Unlike the WebRTC connection, SRTConnection does not support address changes. This means the +// client should never switch to another network or port. If this occurs, the client may be served +// by a different proxy server and fail because the other proxy server cannot identify the client. +type SRTConnection struct { + // The stream context for SRT connection. + ctx context.Context + + // The current socket ID. + socketID uint32 + + // The UDP connection proxy to backend. + backendUDP *net.UDPConn + // The listener UDP connection, used to send messages to client. + listenerUDP *net.UDPConn + + // Listener start time. + start time.Time + + // Handshake packets with client. + handshake0 *SRTHandshakePacket + handshake1 *SRTHandshakePacket + handshake2 *SRTHandshakePacket + handshake3 *SRTHandshakePacket +} + +func NewSRTConnection(opts ...func(*SRTConnection)) *SRTConnection { + v := &SRTConnection{} + for _, opt := range opts { + opt(v) + } + return v +} + +func (v *SRTConnection) HandlePacket(pkt *SRTHandshakePacket, addr *net.UDPAddr, data []byte) (uint32, error) { + ctx := v.ctx + + // If not handshake, try to proxy to backend directly. + if pkt == nil { + // Proxy client message to backend. + if v.backendUDP != nil { + if _, err := v.backendUDP.Write(data); err != nil { + return v.socketID, errors.Wrapf(err, "write to backend") + } + } + + return v.socketID, nil + } + + // Handle handshake messages. + if err := v.handleHandshake(ctx, pkt, addr, data); err != nil { + return v.socketID, errors.Wrapf(err, "handle handshake %v", pkt) + } + + return v.socketID, nil +} + +func (v *SRTConnection) handleHandshake(ctx context.Context, pkt *SRTHandshakePacket, addr *net.UDPAddr, data []byte) error { + // Handle handshake 0 and 1 messages. + if pkt.SynCookie == 0 { + // Save handshake 0 packet. + v.handshake0 = pkt + logger.Df(ctx, "SRT Handshake 0: %v", v.handshake0) + + // Response handshake 1. + v.handshake1 = &SRTHandshakePacket{ + ControlFlag: pkt.ControlFlag, + ControlType: 0, + SubType: 0, + AdditionalInfo: 0, + Timestamp: uint32(time.Since(v.start).Microseconds()), + SocketID: pkt.SRTSocketID, + Version: 5, + EncryptionField: 0, + ExtensionField: 0x4A17, + InitSequence: pkt.InitSequence, + MTU: pkt.MTU, + FlowWindow: pkt.FlowWindow, + HandshakeType: 1, + SRTSocketID: pkt.SRTSocketID, + SynCookie: 0x418d5e4e, + PeerIP: net.ParseIP("127.0.0.1"), + } + logger.Df(ctx, "SRT Handshake 1: %v", v.handshake1) + + if b, err := v.handshake1.MarshalBinary(); err != nil { + return errors.Wrapf(err, "marshal handshake 1") + } else if _, err = v.listenerUDP.WriteToUDP(b, addr); err != nil { + return errors.Wrapf(err, "write handshake 1") + } + + return nil + } + + // Handle handshake 2 and 3 messages. + // Parse stream id from packet. + streamID, err := pkt.StreamID() + if err != nil { + return errors.Wrapf(err, "parse stream id") + } + + // Save handshake packet. + v.handshake2 = pkt + logger.Df(ctx, "SRT Handshake 2: %v, sid=%v", v.handshake2, streamID) + + // Start the UDP proxy to backend. + if err := v.connectBackend(ctx, streamID); err != nil { + return errors.Wrapf(err, "connect backend for %v", streamID) + } + + // Proxy client message to backend. + if v.backendUDP == nil { + return errors.Errorf("no backend for %v", streamID) + } + + // Proxy handshake 0 to backend server. + if b, err := v.handshake0.MarshalBinary(); err != nil { + return errors.Wrapf(err, "marshal handshake 0") + } else if _, err = v.backendUDP.Write(b); err != nil { + return errors.Wrapf(err, "write handshake 0") + } + logger.Df(ctx, "Proxy send handshake 0: %v", v.handshake0) + + // Read handshake 1 from backend server. + b := make([]byte, 4096) + handshake1p := &SRTHandshakePacket{} + if nn, err := v.backendUDP.Read(b); err != nil { + return errors.Wrapf(err, "read handshake 1") + } else if err := handshake1p.UnmarshalBinary(b[:nn]); err != nil { + return errors.Wrapf(err, "unmarshal handshake 1") + } + logger.Df(ctx, "Proxy got handshake 1: %v", handshake1p) + + // Proxy handshake 2 to backend server. + handshake2p := *v.handshake2 + handshake2p.SynCookie = handshake1p.SynCookie + if b, err := handshake2p.MarshalBinary(); err != nil { + return errors.Wrapf(err, "marshal handshake 2") + } else if _, err = v.backendUDP.Write(b); err != nil { + return errors.Wrapf(err, "write handshake 2") + } + logger.Df(ctx, "Proxy send handshake 2: %v", handshake2p) + + // Read handshake 3 from backend server. + handshake3p := &SRTHandshakePacket{} + if nn, err := v.backendUDP.Read(b); err != nil { + return errors.Wrapf(err, "read handshake 3") + } else if err := handshake3p.UnmarshalBinary(b[:nn]); err != nil { + return errors.Wrapf(err, "unmarshal handshake 3") + } + logger.Df(ctx, "Proxy got handshake 3: %v", handshake3p) + + // Response handshake 3 to client. + v.handshake3 = &*handshake3p + v.handshake3.SynCookie = v.handshake1.SynCookie + v.socketID = handshake3p.SRTSocketID + logger.Df(ctx, "Handshake 3: %v", v.handshake3) + + if b, err := v.handshake3.MarshalBinary(); err != nil { + return errors.Wrapf(err, "marshal handshake 3") + } else if _, err = v.listenerUDP.WriteToUDP(b, addr); err != nil { + return errors.Wrapf(err, "write handshake 3") + } + + // Start a goroutine to proxy message from backend to client. + // TODO: FIXME: Support close the connection when timeout or client disconnected. + go func() { + for ctx.Err() == nil { + nn, err := v.backendUDP.Read(b) + if err != nil { + // TODO: If backend server closed unexpectedly, we should notice the stream to quit. + logger.Wf(ctx, "read from backend failed, err=%v", err) + return + } + if _, err = v.listenerUDP.WriteToUDP(b[:nn], addr); err != nil { + // TODO: If backend server closed unexpectedly, we should notice the stream to quit. + logger.Wf(ctx, "write to client failed, err=%v", err) + return + } + } + }() + return nil +} + +func (v *SRTConnection) connectBackend(ctx context.Context, streamID string) error { + if v.backendUDP != nil { + return nil + } + + // Parse stream id to host and resource. + host, resource, err := parseSRTStreamID(streamID) + if err != nil { + return errors.Wrapf(err, "parse stream id %v", streamID) + } + + if host == "" { + host = "localhost" + } + + streamURL, err := buildStreamURL(fmt.Sprintf("srt://%v/%v", host, resource)) + if err != nil { + return errors.Wrapf(err, "build stream url %v", streamID) + } + + // Pick a backend SRS server to proxy the SRT stream. + backend, err := srsLoadBalancer.Pick(ctx, streamURL) + if err != nil { + return errors.Wrapf(err, "pick backend for %v", streamURL) + } + + // Parse UDP port from backend. + if len(backend.SRT) == 0 { + return errors.Errorf("no udp server %v for %v", backend, streamURL) + } + + _, _, udpPort, err := parseListenEndpoint(backend.SRT[0]) + if err != nil { + return errors.Wrapf(err, "parse udp port %v of %v for %v", backend.SRT[0], backend, streamURL) + } + + // Connect to backend SRS server via UDP client. + // TODO: FIXME: Support close the connection when timeout or client disconnected. + backendAddr := net.UDPAddr{IP: net.ParseIP(backend.IP), Port: int(udpPort)} + if backendUDP, err := net.DialUDP("udp", nil, &backendAddr); err != nil { + return errors.Wrapf(err, "dial udp to %v of %v for %v", backendAddr, backend, streamURL) + } else { + v.backendUDP = backendUDP + } + + return nil +} + +// See https://datatracker.ietf.org/doc/html/draft-sharabayko-srt-01#section-3.2 +// See https://datatracker.ietf.org/doc/html/draft-sharabayko-srt-01#section-3.2.1 +type SRTHandshakePacket struct { + // F: 1 bit. Packet Type Flag. The control packet has this flag set to + // "1". The data packet has this flag set to "0". + ControlFlag uint8 + // Control Type: 15 bits. Control Packet Type. The use of these bits + // is determined by the control packet type definition. + // Handshake control packets (Control Type = 0x0000) are used to + // exchange peer configurations, to agree on connection parameters, and + // to establish a connection. + ControlType uint16 + // Subtype: 16 bits. This field specifies an additional subtype for + // specific packets. + SubType uint16 + // Type-specific Information: 32 bits. The use of this field depends on + // the particular control packet type. Handshake packets do not use + // this field. + AdditionalInfo uint32 + // Timestamp: 32 bits. + Timestamp uint32 + // Destination Socket ID: 32 bits. + SocketID uint32 + + // Version: 32 bits. A base protocol version number. Currently used + // values are 4 and 5. Values greater than 5 are reserved for future + // use. + Version uint32 + // Encryption Field: 16 bits. Block cipher family and key size. The + // values of this field are described in Table 2. The default value + // is AES-128. + // 0 | No Encryption Advertised + // 2 | AES-128 + // 3 | AES-192 + // 4 | AES-256 + EncryptionField uint16 + // Extension Field: 16 bits. This field is message specific extension + // related to Handshake Type field. The value MUST be set to 0 + // except for the following cases. (1) If the handshake control + // packet is the INDUCTION message, this field is sent back by the + // Listener. (2) In the case of a CONCLUSION message, this field + // value should contain a combination of Extension Type values. + // 0x00000001 | HSREQ + // 0x00000002 | KMREQ + // 0x00000004 | CONFIG + // 0x4A17 if HandshakeType is INDUCTION, see https://datatracker.ietf.org/doc/html/draft-sharabayko-srt-01#section-4.3.1.1 + ExtensionField uint16 + // Initial Packet Sequence Number: 32 bits. The sequence number of the + // very first data packet to be sent. + InitSequence uint32 + // Maximum Transmission Unit Size: 32 bits. This value is typically set + // to 1500, which is the default Maximum Transmission Unit (MTU) size + // for Ethernet, but can be less. + MTU uint32 + // Maximum Flow Window Size: 32 bits. The value of this field is the + // maximum number of data packets allowed to be "in flight" (i.e. the + // number of sent packets for which an ACK control packet has not yet + // been received). + FlowWindow uint32 + // Handshake Type: 32 bits. This field indicates the handshake packet + // type. + // 0xFFFFFFFD | DONE + // 0xFFFFFFFE | AGREEMENT + // 0xFFFFFFFF | CONCLUSION + // 0x00000000 | WAVEHAND + // 0x00000001 | INDUCTION + HandshakeType uint32 + // SRT Socket ID: 32 bits. This field holds the ID of the source SRT + // socket from which a handshake packet is issued. + SRTSocketID uint32 + // SYN Cookie: 32 bits. Randomized value for processing a handshake. + // The value of this field is specified by the handshake message + // type. + SynCookie uint32 + // Peer IP Address: 128 bits. IPv4 or IPv6 address of the packet's + // sender. The value consists of four 32-bit fields. + PeerIP net.IP + // Extensions. + // Extension Type: 16 bits. The value of this field is used to process + // an integrated handshake. Each extension can have a pair of + // request and response types. + // Extension Length: 16 bits. The length of the Extension Contents + // field in four-byte blocks. + // Extension Contents: variable length. The payload of the extension. + ExtraData []byte +} + +func (v *SRTHandshakePacket) IsData() bool { + return v.ControlFlag == 0x00 +} + +func (v *SRTHandshakePacket) IsControl() bool { + return v.ControlFlag == 0x80 +} + +func (v *SRTHandshakePacket) IsHandshake() bool { + return v.IsControl() && v.ControlType == 0x00 && v.SubType == 0x00 +} + +func (v *SRTHandshakePacket) StreamID() (string, error) { + p := v.ExtraData + for { + if len(p) < 2 { + return "", errors.Errorf("Require 2 bytes, actual=%v, extra=%v", len(p), len(v.ExtraData)) + } + + extType := binary.BigEndian.Uint16(p) + extSize := binary.BigEndian.Uint16(p[2:]) + p = p[4:] + + if len(p) < int(extSize*4) { + return "", errors.Errorf("Require %v bytes, actual=%v, extra=%v", extSize*4, len(p), len(v.ExtraData)) + } + + // Ignore other packets except stream id. + if extType != 0x05 { + p = p[extSize*4:] + continue + } + + // We must copy it, because we will decode the stream id. + data := append([]byte{}, p[:extSize*4]...) + + // Reverse the stream id encoded in little-endian to big-endian. + for i := 0; i < len(data); i += 4 { + value := binary.LittleEndian.Uint32(data[i:]) + binary.BigEndian.PutUint32(data[i:], value) + } + + // Trim the trailing zero bytes. + data = bytes.TrimRight(data, "\x00") + return string(data), nil + } +} + +func (v *SRTHandshakePacket) String() string { + return fmt.Sprintf("Control=%v, CType=%v, SType=%v, Timestamp=%v, SocketID=%v, Version=%v, Encrypt=%v, Extension=%v, InitSequence=%v, MTU=%v, FlowWnd=%v, HSType=%v, SRTSocketID=%v, Cookie=%v, Peer=%vB, Extra=%vB", + v.IsControl(), v.ControlType, v.SubType, v.Timestamp, v.SocketID, v.Version, v.EncryptionField, v.ExtensionField, v.InitSequence, v.MTU, v.FlowWindow, v.HandshakeType, v.SRTSocketID, v.SynCookie, len(v.PeerIP), len(v.ExtraData)) +} + +func (v *SRTHandshakePacket) UnmarshalBinary(b []byte) error { + if len(b) < 4 { + return errors.Errorf("Invalid packet length %v", len(b)) + } + v.ControlFlag = b[0] & 0x80 + v.ControlType = binary.BigEndian.Uint16(b[0:2]) & 0x7fff + v.SubType = binary.BigEndian.Uint16(b[2:4]) + + if len(b) < 64 { + return errors.Errorf("Invalid packet length %v", len(b)) + } + v.AdditionalInfo = binary.BigEndian.Uint32(b[4:]) + v.Timestamp = binary.BigEndian.Uint32(b[8:]) + v.SocketID = binary.BigEndian.Uint32(b[12:]) + v.Version = binary.BigEndian.Uint32(b[16:]) + v.EncryptionField = binary.BigEndian.Uint16(b[20:]) + v.ExtensionField = binary.BigEndian.Uint16(b[22:]) + v.InitSequence = binary.BigEndian.Uint32(b[24:]) + v.MTU = binary.BigEndian.Uint32(b[28:]) + v.FlowWindow = binary.BigEndian.Uint32(b[32:]) + v.HandshakeType = binary.BigEndian.Uint32(b[36:]) + v.SRTSocketID = binary.BigEndian.Uint32(b[40:]) + v.SynCookie = binary.BigEndian.Uint32(b[44:]) + + // Only support IPv4. + v.PeerIP = net.IPv4(b[51], b[50], b[49], b[48]) + + v.ExtraData = b[64:] + + return nil +} + +func (v *SRTHandshakePacket) MarshalBinary() ([]byte, error) { + b := make([]byte, 64+len(v.ExtraData)) + binary.BigEndian.PutUint16(b, uint16(v.ControlFlag)<<8|v.ControlType) + binary.BigEndian.PutUint16(b[2:], v.SubType) + binary.BigEndian.PutUint32(b[4:], v.AdditionalInfo) + binary.BigEndian.PutUint32(b[8:], v.Timestamp) + binary.BigEndian.PutUint32(b[12:], v.SocketID) + binary.BigEndian.PutUint32(b[16:], v.Version) + binary.BigEndian.PutUint16(b[20:], v.EncryptionField) + binary.BigEndian.PutUint16(b[22:], v.ExtensionField) + binary.BigEndian.PutUint32(b[24:], v.InitSequence) + binary.BigEndian.PutUint32(b[28:], v.MTU) + binary.BigEndian.PutUint32(b[32:], v.FlowWindow) + binary.BigEndian.PutUint32(b[36:], v.HandshakeType) + binary.BigEndian.PutUint32(b[40:], v.SRTSocketID) + binary.BigEndian.PutUint32(b[44:], v.SynCookie) + + // Only support IPv4. + ip := v.PeerIP.To4() + b[48] = ip[3] + b[49] = ip[2] + b[50] = ip[1] + b[51] = ip[0] + + if len(v.ExtraData) > 0 { + copy(b[64:], v.ExtraData) + } + + return b, nil +} diff --git a/proxy/sync/map.go b/proxy/sync/map.go new file mode 100644 index 0000000000..75db12f9a9 --- /dev/null +++ b/proxy/sync/map.go @@ -0,0 +1,45 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package sync + +import "sync" + +type Map[K comparable, V any] struct { + m sync.Map +} + +func (m *Map[K, V]) Delete(key K) { + m.m.Delete(key) +} + +func (m *Map[K, V]) Load(key K) (value V, ok bool) { + v, ok := m.m.Load(key) + if !ok { + return value, ok + } + return v.(V), ok +} + +func (m *Map[K, V]) LoadAndDelete(key K) (value V, loaded bool) { + v, loaded := m.m.LoadAndDelete(key) + if !loaded { + return value, loaded + } + return v.(V), loaded +} + +func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool) { + a, loaded := m.m.LoadOrStore(key, value) + return a.(V), loaded +} + +func (m *Map[K, V]) Range(f func(key K, value V) bool) { + m.m.Range(func(key, value any) bool { + return f(key.(K), value.(V)) + }) +} + +func (m *Map[K, V]) Store(key K, value V) { + m.m.Store(key, value) +} diff --git a/proxy/utils.go b/proxy/utils.go new file mode 100644 index 0000000000..f3c3930762 --- /dev/null +++ b/proxy/utils.go @@ -0,0 +1,276 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import ( + "context" + "encoding/binary" + "encoding/json" + stdErr "errors" + "fmt" + "io" + "io/ioutil" + "net" + "net/http" + "net/url" + "os" + "path" + "reflect" + "regexp" + "strconv" + "strings" + "syscall" + "time" + + "srs-proxy/errors" + "srs-proxy/logger" +) + +func apiResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, data any) { + w.Header().Set("Server", fmt.Sprintf("%v/%v", Signature(), Version())) + + b, err := json.Marshal(data) + if err != nil { + apiError(ctx, w, r, errors.Wrapf(err, "marshal %v %v", reflect.TypeOf(data), data)) + return + } + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(b) +} + +func apiError(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) { + logger.Wf(ctx, "HTTP API error %+v", err) + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.WriteHeader(http.StatusInternalServerError) + fmt.Fprintln(w, fmt.Sprintf("%v", err)) +} + +func apiCORS(ctx context.Context, w http.ResponseWriter, r *http.Request) bool { + // Always support CORS. Note that browser may send origin header for m3u8, but no origin header + // for ts. So we always response CORS header. + if true { + // SRS does not need cookie or credentials, so we disable CORS credentials, and use * for CORS origin, + // headers, expose headers and methods. + w.Header().Set("Access-Control-Allow-Origin", "*") + // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers + w.Header().Set("Access-Control-Allow-Headers", "*") + // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods + w.Header().Set("Access-Control-Allow-Methods", "*") + } + + if r.Method == http.MethodOptions { + w.WriteHeader(http.StatusOK) + return true + } + + return false +} + +func parseGracefullyQuitTimeout() (time.Duration, error) { + if t, err := time.ParseDuration(envGraceQuitTimeout()); err != nil { + return 0, errors.Wrapf(err, "parse duration %v", envGraceQuitTimeout()) + } else { + return t, nil + } +} + +// ParseBody read the body from r, and unmarshal JSON to v. +func ParseBody(r io.ReadCloser, v interface{}) error { + b, err := ioutil.ReadAll(r) + if err != nil { + return errors.Wrapf(err, "read body") + } + defer r.Close() + + if len(b) == 0 { + return nil + } + + if err := json.Unmarshal(b, v); err != nil { + return errors.Wrapf(err, "json unmarshal %v", string(b)) + } + + return nil +} + +// buildStreamURL build as vhost/app/stream for stream URL r. +func buildStreamURL(r string) (string, error) { + u, err := url.Parse(r) + if err != nil { + return "", errors.Wrapf(err, "parse url %v", r) + } + + // If not domain or ip in hostname, it's __defaultVhost__. + defaultVhost := !strings.Contains(u.Hostname(), ".") + + // If hostname is actually an IP address, it's __defaultVhost__. + if ip := net.ParseIP(u.Hostname()); ip.To4() != nil { + defaultVhost = true + } + + if defaultVhost { + return fmt.Sprintf("__defaultVhost__%v", u.Path), nil + } + + // Ignore port, only use hostname as vhost. + return fmt.Sprintf("%v%v", u.Hostname(), u.Path), nil +} + +// isPeerClosedError indicates whether peer object closed the connection. +func isPeerClosedError(err error) bool { + causeErr := errors.Cause(err) + + if stdErr.Is(causeErr, io.EOF) { + return true + } + + if stdErr.Is(causeErr, syscall.EPIPE) { + return true + } + + if netErr, ok := causeErr.(*net.OpError); ok { + if sysErr, ok := netErr.Err.(*os.SyscallError); ok { + if stdErr.Is(sysErr.Err, syscall.ECONNRESET) { + return true + } + } + } + + return false +} + +// convertURLToStreamURL convert the URL in HTTP request to special URLs. The unifiedURL is the URL +// in unified, foramt as scheme://vhost/app/stream without extensions. While the fullURL is the unifiedURL +// with extension. +func convertURLToStreamURL(r *http.Request) (unifiedURL, fullURL string) { + scheme := "http" + if r.TLS != nil { + scheme = "https" + } + + hostname := "__defaultVhost__" + if strings.Contains(r.Host, ":") { + if v, _, err := net.SplitHostPort(r.Host); err == nil { + hostname = v + } + } + + var appStream, streamExt string + + // Parse app/stream from query string. + q := r.URL.Query() + if app := q.Get("app"); app != "" { + appStream = "/" + app + } + if stream := q.Get("stream"); stream != "" { + appStream = fmt.Sprintf("%v/%v", appStream, stream) + } + + // Parse app/stream from path. + if appStream == "" { + streamExt = path.Ext(r.URL.Path) + appStream = strings.TrimSuffix(r.URL.Path, streamExt) + } + + unifiedURL = fmt.Sprintf("%v://%v%v", scheme, hostname, appStream) + fullURL = fmt.Sprintf("%v%v", unifiedURL, streamExt) + return +} + +// rtcIsSTUN returns true if data of UDP payload is a STUN packet. +func rtcIsSTUN(data []byte) bool { + return len(data) > 0 && (data[0] == 0 || data[0] == 1) +} + +// rtcIsRTPOrRTCP returns true if data of UDP payload is a RTP or RTCP packet. +func rtcIsRTPOrRTCP(data []byte) bool { + return len(data) >= 12 && (data[0]&0xC0) == 0x80 +} + +// srtIsHandshake returns true if data of UDP payload is a SRT handshake packet. +func srtIsHandshake(data []byte) bool { + return len(data) >= 4 && binary.BigEndian.Uint32(data) == 0x80000000 +} + +// srtParseSocketID parse the socket id from the SRT packet. +func srtParseSocketID(data []byte) uint32 { + if len(data) >= 16 { + return binary.BigEndian.Uint32(data[12:]) + } + return 0 +} + +// parseIceUfragPwd parse the ice-ufrag and ice-pwd from the SDP. +func parseIceUfragPwd(sdp string) (ufrag, pwd string, err error) { + if true { + ufragRe := regexp.MustCompile(`a=ice-ufrag:([^\s]+)`) + ufragMatch := ufragRe.FindStringSubmatch(sdp) + if len(ufragMatch) <= 1 { + return "", "", errors.Errorf("no ice-ufrag in sdp %v", sdp) + } + ufrag = ufragMatch[1] + } + + if true { + pwdRe := regexp.MustCompile(`a=ice-pwd:([^\s]+)`) + pwdMatch := pwdRe.FindStringSubmatch(sdp) + if len(pwdMatch) <= 1 { + return "", "", errors.Errorf("no ice-pwd in sdp %v", sdp) + } + pwd = pwdMatch[1] + } + + return ufrag, pwd, nil +} + +// parseSRTStreamID parse the SRT stream id to host(optional) and resource(required). +// See https://ossrs.io/lts/en-us/docs/v7/doc/srt#srt-url +func parseSRTStreamID(sid string) (host, resource string, err error) { + if true { + hostRe := regexp.MustCompile(`h=([^,]+)`) + hostMatch := hostRe.FindStringSubmatch(sid) + if len(hostMatch) > 1 { + host = hostMatch[1] + } + } + + if true { + resourceRe := regexp.MustCompile(`r=([^,]+)`) + resourceMatch := resourceRe.FindStringSubmatch(sid) + if len(resourceMatch) <= 1 { + return "", "", errors.Errorf("no resource in sid %v", sid) + } + resource = resourceMatch[1] + } + + return host, resource, nil +} + +// parseListenEndpoint parse the listen endpoint as: +// port The tcp listen port, like 1935. +// protocol://ip:port The listen endpoint, like tcp://:1935 or tcp://0.0.0.0:1935 +func parseListenEndpoint(ep string) (protocol string, ip net.IP, port uint16, err error) { + // If no colon in ep, it's port in string. + if !strings.Contains(ep, ":") { + if p, err := strconv.Atoi(ep); err != nil { + return "", nil, 0, errors.Wrapf(err, "parse port %v", ep) + } else { + return "tcp", nil, uint16(p), nil + } + } + + // Must be protocol://ip:port schema. + parts := strings.Split(ep, ":") + if len(parts) != 3 { + return "", nil, 0, errors.Errorf("invalid endpoint %v", ep) + } + + if p, err := strconv.Atoi(parts[2]); err != nil { + return "", nil, 0, errors.Wrapf(err, "parse port %v", parts[2]) + } else { + return parts[0], net.ParseIP(parts[1]), uint16(p), nil + } +} diff --git a/proxy/version.go b/proxy/version.go new file mode 100644 index 0000000000..94f668f96e --- /dev/null +++ b/proxy/version.go @@ -0,0 +1,27 @@ +// Copyright (c) 2024 Winlin +// +// SPDX-License-Identifier: MIT +package main + +import "fmt" + +func VersionMajor() int { + return 1 +} + +// VersionMinor specifies the typical version of SRS we adapt to. +func VersionMinor() int { + return 5 +} + +func VersionRevision() int { + return 0 +} + +func Version() string { + return fmt.Sprintf("%v.%v.%v", VersionMajor(), VersionMinor(), VersionRevision()) +} + +func Signature() string { + return "SRSProxy" +} diff --git a/trunk/3rdparty/srs-bench/Makefile b/trunk/3rdparty/srs-bench/Makefile index 80d284998d..79d89b1d70 100644 --- a/trunk/3rdparty/srs-bench/Makefile +++ b/trunk/3rdparty/srs-bench/Makefile @@ -1,20 +1,32 @@ -.PHONY: help default clean bench test +.PHONY: help default clean bench pcap test all default: bench test clean: rm -rf ./objs +all: bench test pcap test + ######################################################################################################### # SRS benchmark tool for SRS, janus, GB28181. ./objs/.format.bench.txt: *.go janus/*.go ./objs/.format.srs.txt ./objs/.format.gb28181.txt gofmt -w *.go janus mkdir -p objs && echo "done" > ./objs/.format.bench.txt -bench: ./objs/srs_bench ./objs/pcap_simulator +bench: ./objs/srs_bench + +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + SRT_PREFIX := $(shell brew --prefix srt) + CGO_CFLAGS := -I$(SRT_PREFIX)/include + CGO_LDFLAGS := -L$(SRT_PREFIX)/lib -lsrt +else ifeq ($(UNAME_S),Linux) + CGO_CFLAGS := -I/usr/local/include + CGO_LDFLAGS := -L/usr/local/lib -lsrt -L/usr/local/ssl/lib -lcrypto -lstdc++ -lm -ldl +endif -./objs/srs_bench: ./objs/.format.bench.txt *.go janus/*.go srs/*.go vnet/*.go gb28181/*.go Makefile - go build -mod=vendor -o objs/srs_bench . +./objs/srs_bench: ./objs/.format.bench.txt *.go janus/*.go srs/*.go vnet/*.go gb28181/*.go live/*.go Makefile + CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -mod=vendor -o objs/srs_bench . ######################################################################################################### # For all regression tests. @@ -35,6 +47,8 @@ test: ./objs/srs_test ./objs/srs_gb28181_test ./objs/srs_blackbox_test gofmt -w pcap mkdir -p objs && echo "done" > ./objs/.format.pcap.txt +pcap: ./objs/pcap_simulator + ./objs/pcap_simulator: ./objs/.format.pcap.txt pcap/*.go Makefile go build -mod=vendor -o ./objs/pcap_simulator ./pcap @@ -59,9 +73,10 @@ test: ./objs/srs_test ./objs/srs_gb28181_test ./objs/srs_blackbox_test ######################################################################################################### # Help menu. help: - @echo "Usage: make [default|bench|test|clean]" + @echo "Usage: make [default|bench|pcap|test|clean]" @echo " default The default entry for make is bench+test" @echo " bench Make the bench to ./objs/srs_bench" + @echo " pcap Make the pcap simulator to ./objs/pcap_simulator" @echo " test Make the test tool to ./objs/srs_test and ./objs/srs_gb28181_test ./objs/srs_blackbox_test" @echo " clean Remove all tools at ./objs" diff --git a/trunk/3rdparty/srs-bench/README.md b/trunk/3rdparty/srs-bench/README.md index 7c795a3311..21b8939b1a 100644 --- a/trunk/3rdparty/srs-bench/README.md +++ b/trunk/3rdparty/srs-bench/README.md @@ -14,6 +14,8 @@ git clone -b feature/rtc https://github.com/ossrs/srs-bench.git && cd srs-bench && make ``` +> Note: 依赖Go编译工具,建议使用 Go 1.17 及以上的版本。 + 编译会生成下面的工具: * `./objs/srs_bench` 压测,模拟大量客户端的负载测试,支持SRS、GB28181和Janus三种场景。 @@ -31,9 +33,11 @@ cd srs/trunk && ./configure --h265=on --gb28181=on && make && ./objs/srs -c conf/console.conf ``` +> Note: Use valgrind to check memory leak, please use `valgrind --leak-check=full ./objs/srs -c conf/console.conf >/dev/null` to start SRS. + 具体场景,请按下面的操作启动测试。 -## Player for Live +## Player for WHEP 直播播放压测,一个流,很多个播放。 @@ -49,7 +53,7 @@ ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy -f flv -y rtmp://localhost/ ./objs/srs_bench -sr webrtc://localhost/live/livestream -nn 100 ``` -## Publisher for Live or RTC +## Publisher for WHIP 直播或会议场景推流压测,一般会推多个流。 @@ -63,7 +67,7 @@ ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy -f flv -y rtmp://localhost/ > 注意:帧率是原始视频的帧率,由于264中没有这个信息所以需要传递。 -## Multipel Player or Publisher for RTC +## Multiple WHIP or WHEP for RTC 会议场景的播放压测,会多个客户端播放多个流,比如3人会议,那么就有3个推流,每个流有2个播放。 @@ -84,7 +88,7 @@ ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy -f flv -y rtmp://localhost/ > 备注:URL的变量格式参考Go的`fmt.Sprintf`,比如可以用`webrtc://localhost/live/livestream_%03d`。 -## DVR for Benchmark +## DVR for RTC Benchmark 录制场景,主要是把内容录制下来后,可分析,也可以用于推流。 @@ -120,6 +124,37 @@ ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy -f flv -y rtmp://localhost/ > Note: 可以传递更多参数,详细参考SRS支持的参数。 +## Reconnecting Load Test + +建立连接和断开重连的压测,可以测试SRS在多个Source时是否有内存泄露问题,参考 [#3667](https://github.com/ossrs/srs/discussions/3667#discussioncomment-8969107) + +RTMP重连测试: + +```bash +for ((i=0;;i++)); do + ./objs/srs_bench -sfu=live -pr=rtmp://localhost/live${i}/stream -sn=1000 -cap=true; + sleep 10; +done +``` + +SRT重连测试: + +```bash +for ((i=0;;i++)); do + ./objs/srs_bench -sfu=live -pr='srt://127.0.0.1:10080?streamid=#!::'m=publish,r=live${i}/stream -sn=1000 -cap=true; + sleep 10; +done +``` + +WebRTC重连测试: + +```bash +for ((i=0;;i++)); do + ./objs/srs_bench -sfu=rtc -pr=webrtc://localhost/live${i}/livestream -sn=1000 -cap=true; + sleep 10; +done +``` + ## Regression Test 回归测试需要先启动[SRS](https://github.com/ossrs/srs/issues/307),支持WebRTC推拉流: @@ -329,4 +364,50 @@ make -j10 && ./objs/srs_bench -sfu janus \ -nn 5 ``` +## Install LIBSRT + +我们使用 [srtgo](https://github.com/Haivision/srtgo) 库测试SRT协议,需要安装libsrt库, +参考[macOS](https://github.com/Haivision/srt/blob/master/docs/build/build-macOS.md): + +```bash +brew install srt +``` + +如果是Ubuntu,可以参考[Ubuntu](https://github.com/Haivision/srt/blob/master/docs/build/package-managers.md): + +```bash +apt-get install -y libsrt +``` + +安装完libsrt后,直接编译srs-bench即可: + +```bash +make +``` + +## Ubuntu Docker + +如果使用Ubuntu编译,推荐使用 `ossrs/srs:ubuntu20` 作为镜像编译,已经编译了openssl和libsrt,启动容器: + +```bash +docker run --rm -it -v $(pwd):/g -w /g ossrs/srs:ubuntu20 make +``` + +## GoLand + +使用GoLand编译和调试时,需要设置libsrt的环境变量,首先可以使用brew获取路径: + +```bash +brew --prefix srt +#/opt/homebrew/opt/srt +``` + +然后在GoLand中,编辑配置 `Edit Configurations`,添加环境变量: + +```bash +CGO_CFLAGS=-I/opt/homebrew/opt/srt/include;CGO_LDFLAGS=-L/opt/homebrew/opt/srt/lib -lsrt +``` + +> Note: 特别注意的是,CGO_LDFLAGS是可以有空格的,不能使用字符串,否则找不到库。 + 2021.01, Winlin diff --git a/trunk/3rdparty/srs-bench/blackbox/hevc_test.go b/trunk/3rdparty/srs-bench/blackbox/hevc_test.go index 6a98f9a500..b6b85cec1a 100644 --- a/trunk/3rdparty/srs-bench/blackbox/hevc_test.go +++ b/trunk/3rdparty/srs-bench/blackbox/hevc_test.go @@ -900,6 +900,14 @@ func TestSlow_SrtPublish_HttpTsPlay_HEVC_Basic(t *testing.T) { r1 = ffmpeg.Run(ctx, cancel) }() + // Should wait for TS to generate the contents. + select { + case <-ctx.Done(): + r2 = fmt.Errorf("timeout") + return + case <-time.After(5 * time.Second): + } + // Start FFprobe to detect and verify stream. duration := time.Duration(*srsFFprobeDuration) * time.Millisecond ffprobe := NewFFprobe(func(v *ffprobeClient) { @@ -912,9 +920,6 @@ func TestSlow_SrtPublish_HttpTsPlay_HEVC_Basic(t *testing.T) { defer wg.Done() <-svr.ReadyCtx().Done() - // wait for ffmpeg - time.Sleep(3 * time.Second) - r2 = ffprobe.Run(ctx, cancel) }() @@ -930,8 +935,8 @@ func TestSlow_SrtPublish_HttpTsPlay_HEVC_Basic(t *testing.T) { } // Note that HLS score is low, so we only check duration. - if dv := m.Duration(); dv < duration { - r5 = errors.Errorf("short duration=%v < %v, %v, %v", dv, duration, m.String(), str) + if dv := m.Duration(); dv < duration/2 { + r5 = errors.Errorf("short duration=%v < %v, %v, %v", dv, duration/2, m.String(), str) } if v := m.Video(); v == nil { @@ -949,7 +954,6 @@ func TestSlow_SrtPublish_HlsPlay_HEVC_Basic(t *testing.T) { // Setup the max timeout for this case. ctx, cancel := context.WithTimeout(logger.WithContext(context.Background()), time.Duration(*srsTimeout)*time.Millisecond) defer cancel() - // Check a set of errors. var r0, r1, r2, r3, r4 error defer func(ctx context.Context) { @@ -995,12 +999,17 @@ func TestSlow_SrtPublish_HlsPlay_HEVC_Basic(t *testing.T) { defer wg.Done() <-svr.ReadyCtx().Done() - // wait for ffmpeg - time.Sleep(3 * time.Second) - r1 = ffmpeg.Run(ctx, cancel) }() + // Should wait for HLS to generate the ts files. + select { + case <-ctx.Done(): + r2 = fmt.Errorf("timeout") + return + case <-time.After(20 * time.Second): + } + // Start FFprobe to detect and verify stream. duration := time.Duration(*srsFFprobeDuration) * time.Millisecond ffprobe := NewFFprobe(func(v *ffprobeClient) { diff --git a/trunk/3rdparty/srs-bench/gb28181/gb28181.go b/trunk/3rdparty/srs-bench/gb28181/gb28181.go index 38122e786f..f2cf9bb555 100644 --- a/trunk/3rdparty/srs-bench/gb28181/gb28181.go +++ b/trunk/3rdparty/srs-bench/gb28181/gb28181.go @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2022 Winlin +// # Copyright (c) 2022-2024 Winlin // // 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 @@ -57,7 +57,11 @@ func Parse(ctx context.Context) interface{} { fl.Usage = func() { fmt.Println(fmt.Sprintf("Usage: %v [Options]", os.Args[0])) fmt.Println(fmt.Sprintf("Options:")) - fmt.Println(fmt.Sprintf(" -sfu The target SFU, srs or gb28181 or janus. Default: srs")) + fmt.Println(fmt.Sprintf(" -sfu The target server that can be rtc, live, janus, or gb28181. Default: rtc")) + fmt.Println(fmt.Sprintf(" rtc/srs: SRS WebRTC SFU server, for WebRTC/WHIP/WHEP.")) + fmt.Println(fmt.Sprintf(" live: SRS live streaming server, for RTMP/HTTP-FLV/HLS.")) + fmt.Println(fmt.Sprintf(" janus: Janus WebRTC SFU server, for janus private protocol.")) + fmt.Println(fmt.Sprintf(" gb28181: GB media server, for GB protocol.")) fmt.Println(fmt.Sprintf("SIP:")) fmt.Println(fmt.Sprintf(" -user The SIP username, ID of device.")) fmt.Println(fmt.Sprintf(" -random Append N number to user as random device ID, like 1320000001.")) diff --git a/trunk/3rdparty/srs-bench/gb28181/gb28181_test.go b/trunk/3rdparty/srs-bench/gb28181/gb28181_test.go index 43139aa5b7..19a82764c0 100644 --- a/trunk/3rdparty/srs-bench/gb28181/gb28181_test.go +++ b/trunk/3rdparty/srs-bench/gb28181/gb28181_test.go @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2022 Winlin +// # Copyright (c) 2022-2024 Winlin // // 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 diff --git a/trunk/3rdparty/srs-bench/gb28181/gb_test.go b/trunk/3rdparty/srs-bench/gb28181/gb_test.go index 10f06a7c73..f1bfccfa18 100644 --- a/trunk/3rdparty/srs-bench/gb28181/gb_test.go +++ b/trunk/3rdparty/srs-bench/gb28181/gb_test.go @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2022 Winlin +// # Copyright (c) 2022-2024 Winlin // // 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 diff --git a/trunk/3rdparty/srs-bench/gb28181/ingester.go b/trunk/3rdparty/srs-bench/gb28181/ingester.go index 2cf6cacf3b..9bcb3270aa 100644 --- a/trunk/3rdparty/srs-bench/gb28181/ingester.go +++ b/trunk/3rdparty/srs-bench/gb28181/ingester.go @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2022 Winlin +// # Copyright (c) 2022-2024 Winlin // // 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 diff --git a/trunk/3rdparty/srs-bench/gb28181/ps.go b/trunk/3rdparty/srs-bench/gb28181/ps.go index 7acaf83427..b4871961ae 100644 --- a/trunk/3rdparty/srs-bench/gb28181/ps.go +++ b/trunk/3rdparty/srs-bench/gb28181/ps.go @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2022 Winlin +// # Copyright (c) 2022-2024 Winlin // // 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 diff --git a/trunk/3rdparty/srs-bench/gb28181/sip.go b/trunk/3rdparty/srs-bench/gb28181/sip.go index 8043ffd8b3..1bc8cd0d30 100644 --- a/trunk/3rdparty/srs-bench/gb28181/sip.go +++ b/trunk/3rdparty/srs-bench/gb28181/sip.go @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2022 Winlin +// # Copyright (c) 2022-2024 Winlin // // 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 diff --git a/trunk/3rdparty/srs-bench/gb28181/util.go b/trunk/3rdparty/srs-bench/gb28181/util.go index e162710d39..ca4adff1b8 100644 --- a/trunk/3rdparty/srs-bench/gb28181/util.go +++ b/trunk/3rdparty/srs-bench/gb28181/util.go @@ -1,6 +1,6 @@ // The MIT License (MIT) // -// Copyright (c) 2022 Winlin +// # Copyright (c) 2022-2024 Winlin // // 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 diff --git a/trunk/3rdparty/srs-bench/go.mod b/trunk/3rdparty/srs-bench/go.mod index 1aa2421afb..d4667a1a5a 100644 --- a/trunk/3rdparty/srs-bench/go.mod +++ b/trunk/3rdparty/srs-bench/go.mod @@ -5,6 +5,7 @@ go 1.17 require ( github.com/ghettovoice/gosip v0.0.0-20220929080231-de8ba881be83 github.com/google/gopacket v1.1.19 + github.com/haivision/srtgo v0.0.0-20230627061225-a70d53fcd618 github.com/ossrs/go-oryx-lib v0.0.9 github.com/pion/ice/v2 v2.3.6 github.com/pion/interceptor v0.1.17 @@ -28,6 +29,7 @@ require ( github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/mattn/go-colorable v0.1.4 // indirect github.com/mattn/go-isatty v0.0.8 // indirect + github.com/mattn/go-pointer v0.0.1 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/pion/datachannel v1.5.5 // indirect github.com/pion/dtls/v2 v2.2.7 // indirect @@ -40,12 +42,12 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect github.com/sirupsen/logrus v1.4.2 // indirect - github.com/stretchr/testify v1.8.4 // indirect + github.com/stretchr/testify v1.9.0 // indirect github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5 // indirect github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trunk/3rdparty/srs-bench/go.sum b/trunk/3rdparty/srs-bench/go.sum index 27e06b91a3..9c5733d4ad 100644 --- a/trunk/3rdparty/srs-bench/go.sum +++ b/trunk/3rdparty/srs-bench/go.sum @@ -31,6 +31,8 @@ github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/haivision/srtgo v0.0.0-20230627061225-a70d53fcd618 h1:oGPTZa7I5wqmQs/UhWHj3ln6/CjQX2yQt784xx6H0wI= +github.com/haivision/srtgo v0.0.0-20230627061225-a70d53fcd618/go.mod h1:aTd4vOr9wtzkCbbocUFh6atlJy7H/iV5jhqEWlTdCdA= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= @@ -44,6 +46,8 @@ github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaa github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= +github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -115,6 +119,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -122,8 +127,9 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5 h1:hNna6Fi0eP1f2sMBe/rJicDmaHmoXGe1Ta84FPYHLuE= github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5/go.mod h1:f1SCnEOt6sc3fOJfPQDRDzHOtSXuTtnz0ImG9kPRDV0= github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg= @@ -140,8 +146,10 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -161,8 +169,9 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -178,6 +187,7 @@ golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200926100807-9d91bd62050c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -193,8 +203,10 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -202,8 +214,10 @@ golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -213,8 +227,9 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= diff --git a/trunk/3rdparty/srs-bench/janus/janus.go b/trunk/3rdparty/srs-bench/janus/janus.go index c7762d9c15..f62750af8d 100644 --- a/trunk/3rdparty/srs-bench/janus/janus.go +++ b/trunk/3rdparty/srs-bench/janus/janus.go @@ -66,7 +66,11 @@ func Parse(ctx context.Context) { fl.Usage = func() { fmt.Println(fmt.Sprintf("Usage: %v [Options]", os.Args[0])) fmt.Println(fmt.Sprintf("Options:")) - fmt.Println(fmt.Sprintf(" -sfu The target SFU, srs or gb28181 or janus. Default: srs")) + fmt.Println(fmt.Sprintf(" -sfu The target server that can be rtc, live, janus, or gb28181. Default: rtc")) + fmt.Println(fmt.Sprintf(" rtc/srs: SRS WebRTC SFU server, for WebRTC/WHIP/WHEP.")) + fmt.Println(fmt.Sprintf(" live: SRS live streaming server, for RTMP/HTTP-FLV/HLS.")) + fmt.Println(fmt.Sprintf(" janus: Janus WebRTC SFU server, for janus private protocol.")) + fmt.Println(fmt.Sprintf(" gb28181: GB media server, for GB protocol.")) fmt.Println(fmt.Sprintf(" -nn The number of clients to simulate. Default: 1")) fmt.Println(fmt.Sprintf(" -sn The number of streams to simulate. Variable: %%d. Default: 1")) fmt.Println(fmt.Sprintf(" -delay The start delay in ms for each client or stream to simulate. Default: 50")) diff --git a/trunk/3rdparty/srs-bench/live/live.go b/trunk/3rdparty/srs-bench/live/live.go new file mode 100644 index 0000000000..f264e2adfc --- /dev/null +++ b/trunk/3rdparty/srs-bench/live/live.go @@ -0,0 +1,195 @@ +// The MIT License (MIT) +// +// # Copyright (c) 2021 Winlin +// +// 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. +package live + +import ( + "context" + "flag" + "fmt" + "net" + "net/http" + "os" + "strings" + "sync" + "time" + + "github.com/ossrs/go-oryx-lib/errors" + "github.com/ossrs/go-oryx-lib/logger" +) + +var closeAfterPublished bool + +var pr string + +var streams, delay int + +var statListen string + +func Parse(ctx context.Context) { + fl := flag.NewFlagSet(os.Args[0], flag.ContinueOnError) + + var sfu string + fl.StringVar(&sfu, "sfu", "srs", "The SFU server, srs or gb28181 or janus") + + fl.BoolVar(&closeAfterPublished, "cap", false, "") + + fl.StringVar(&pr, "pr", "", "") + + fl.IntVar(&streams, "sn", 1, "") + fl.IntVar(&delay, "delay", 10, "") + + fl.StringVar(&statListen, "stat", "", "") + + fl.Usage = func() { + fmt.Println(fmt.Sprintf("Usage: %v [Options]", os.Args[0])) + fmt.Println(fmt.Sprintf("Options:")) + fmt.Println(fmt.Sprintf(" -sfu The target server that can be rtc, live, janus, or gb28181. Default: rtc")) + fmt.Println(fmt.Sprintf(" rtc/srs: SRS WebRTC SFU server, for WebRTC/WHIP/WHEP.")) + fmt.Println(fmt.Sprintf(" live: SRS live streaming server, for RTMP/HTTP-FLV/HLS.")) + fmt.Println(fmt.Sprintf(" janus: Janus WebRTC SFU server, for janus private protocol.")) + fmt.Println(fmt.Sprintf(" -sn The number of streams to simulate. Variable: %%d. Default: 1")) + fmt.Println(fmt.Sprintf(" -delay The start delay in ms for each client or stream to simulate. Default: 50")) + fmt.Println(fmt.Sprintf(" -stat [Optional] The stat server API listen port.")) + fmt.Println(fmt.Sprintf("Publisher:")) + fmt.Println(fmt.Sprintf(" -pr The url to publish. If sn exceed 1, auto append variable %%d.")) + fmt.Println(fmt.Sprintf(" -cap Whether to close connection after publish. Default: false")) + fmt.Println(fmt.Sprintf("\n例如,1个推流,无媒体传输:")) + fmt.Println(fmt.Sprintf(" %v -pr=rtmp://localhost/live/livestream -cap=true", os.Args[0])) + fmt.Println(fmt.Sprintf("\n例如,2个推流,无媒体传输:")) + fmt.Println(fmt.Sprintf(" %v -pr=rtmp://localhost/live/livestream_%%d -sn=2 -cap=true", os.Args[0])) + fmt.Println() + } + _ = fl.Parse(os.Args[1:]) + + showHelp := streams <= 0 + if pr == "" { + showHelp = true + } + if showHelp { + fl.Usage() + os.Exit(-1) + } + + if statListen != "" && !strings.Contains(statListen, ":") { + statListen = ":" + statListen + } + + summaryDesc := fmt.Sprintf("streams=%v", streams) + if pr != "" { + summaryDesc = fmt.Sprintf("%v, publish=(url=%v,cap=%v)", + summaryDesc, pr, closeAfterPublished) + } + logger.Tf(ctx, "Run benchmark with %v", summaryDesc) +} + +func Run(ctx context.Context) error { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + // Run tasks. + var wg sync.WaitGroup + defer wg.Wait() + + // Run STAT API server. + wg.Add(1) + go func() { + defer wg.Done() + + if statListen == "" { + return + } + + var lc net.ListenConfig + ln, err := lc.Listen(ctx, "tcp", statListen) + if err != nil { + logger.Ef(ctx, "stat listen err+%v", err) + cancel() + return + } + + mux := http.NewServeMux() + handleStat(ctx, mux, statListen) + + srv := &http.Server{ + Handler: mux, + BaseContext: func(listener net.Listener) context.Context { + return ctx + }, + } + + go func() { + <-ctx.Done() + srv.Shutdown(ctx) + }() + + logger.Tf(ctx, "Stat listen at %v", statListen) + if err := srv.Serve(ln); err != nil { + if ctx.Err() == nil { + logger.Ef(ctx, "stat serve err+%v", err) + cancel() + } + return + } + }() + + // Run all publishers. + publisherStartedCtx, publisherStartedCancel := context.WithCancel(ctx) + defer publisherStartedCancel() + for i := 0; pr != "" && i < streams && ctx.Err() == nil; i++ { + r_auto := pr + if streams > 1 && !strings.Contains(r_auto, "%") { + r_auto += "%d" + } + + r2 := r_auto + if strings.Contains(r2, "%") { + r2 = fmt.Sprintf(r2, i) + } + + gStatLive.Publishers.Expect++ + gStatLive.Publishers.Alive++ + + wg.Add(1) + go func(pr string) { + defer wg.Done() + defer func() { + gStatLive.Publishers.Alive-- + logger.Tf(ctx, "Publisher %v done, alive=%v", pr, gStatLive.Publishers.Alive) + + <- publisherStartedCtx.Done() + if gStatLive.Publishers.Alive == 0 { + cancel() + } + }() + + if err := startPublish(ctx, pr, closeAfterPublished); err != nil { + if errors.Cause(err) != context.Canceled { + logger.Wf(ctx, "Run err %+v", err) + } + } + }(r2) + + if delay > 0 { + time.Sleep(time.Duration(delay) * time.Millisecond) + } + } + return nil +} diff --git a/trunk/3rdparty/srs-bench/live/publisher.go b/trunk/3rdparty/srs-bench/live/publisher.go new file mode 100644 index 0000000000..2db5466728 --- /dev/null +++ b/trunk/3rdparty/srs-bench/live/publisher.go @@ -0,0 +1,210 @@ +// The MIT License (MIT) +// +// # Copyright (c) 2021 Winlin +// +// 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. +package live + +import ( + "context" + "fmt" + "math/rand" + "net" + "net/url" + "strconv" + "strings" + "time" + + "github.com/haivision/srtgo" + "github.com/ossrs/go-oryx-lib/amf0" + "github.com/ossrs/go-oryx-lib/errors" + "github.com/ossrs/go-oryx-lib/logger" + "github.com/ossrs/go-oryx-lib/rtmp" +) + +func startPublish(ctx context.Context, r string, closeAfterPublished bool) error { + ctx = logger.WithContext(ctx) + logger.Tf(ctx, "Run publish url=%v, cap=%v", r, closeAfterPublished) + + u, err := url.Parse(r) + if err != nil { + return errors.Wrapf(err, "parse %v", r) + } + + if u.Scheme == "rtmp" { + return startPublishRTMP(ctx, u, closeAfterPublished) + } else if u.Scheme == "srt" { + return startPublishSRT(ctx, u, closeAfterPublished) + } + + return fmt.Errorf("invalid schema %v of %v", u.Scheme, r) +} + +func startPublishSRT(ctx context.Context, u *url.URL, closeAfterPublished bool) (err error) { + // Parse host and port. + port := 1935 + if u.Port() != "" { + if port, err = strconv.Atoi(u.Port()); err != nil { + return errors.Wrapf(err, "parse port %v", u.Port()) + } + } + + ips, err := net.LookupIP(u.Hostname()) + if err != nil { + return errors.Wrapf(err, "lookup %v", u.Hostname()) + } + if len(ips) == 0 { + return errors.Errorf("no ips for %v", u.Hostname()) + } + logger.Tf(ctx, "Parse url %v to host=%v, ip=%v, port=%v", + u.String(), u.Hostname(), ips[0], port) + + // Setup libsrt. + client := srtgo.NewSrtSocket(ips[0].To4().String(), uint16(port), + map[string]string{ + "transtype": "live", + "tsbpdmode": "false", + "tlpktdrop": "false", + "latency": "0", + "streamid": fmt.Sprintf("#%v", u.Fragment), + }, + ) + defer client.Close() + + if err := client.Connect(); err != nil { + return errors.Wrapf(err, "SRT connect to %v:%v", u.Hostname(), port) + } + logger.Tf(ctx, "Connect to SRT server %v:%v success", u.Hostname(), port) + + // We should wait for a while after connected to SRT server before quit. Because SRT server use timeout + // to detect UDP connection status, so we should never reconnect very fast. + select { + case <-ctx.Done(): + case <-time.After(3 * time.Second): + logger.Tf(ctx, "SRT publish stream success, stream=%v", u.Fragment) + } + + if closeAfterPublished { + logger.Tf(ctx, "Close connection after published") + return nil + } + + return nil +} + +func startPublishRTMP(ctx context.Context, u *url.URL, closeAfterPublished bool) (err error) { + parts := strings.Split(u.Path, "/") + if len(parts) == 0 { + return errors.Errorf("invalid path %v", u.Path) + } + app, stream := strings.Join(parts[:len(parts)-1], "/"), parts[len(parts)-1] + + // Parse host and port. + port := 1935 + if u.Port() != "" { + if port, err = strconv.Atoi(u.Port()); err != nil { + return errors.Wrapf(err, "parse port %v", u.Port()) + } + } + + ips, err := net.LookupIP(u.Hostname()) + if err != nil { + return errors.Wrapf(err, "lookup %v", u.Hostname()) + } + if len(ips) == 0 { + return errors.Errorf("no ips for %v", u.Hostname()) + } + logger.Tf(ctx, "Parse url %v to host=%v, ip=%v, port=%v, app=%v, stream=%v", + u.String(), u.Hostname(), ips[0], port, app, stream) + + // Connect via TCP client. + c, err := net.DialTCP("tcp", nil, &net.TCPAddr{IP: ips[0], Port: port}) + if err != nil { + return errors.Wrapf(err, "dial %v %v", u.Hostname(), u.Port()) + } + defer c.Close() + logger.Tf(ctx, "Connect to RTMP server %v:%v success", u.Hostname(), port) + + // RTMP Handshake. + rd := rand.New(rand.NewSource(time.Now().UnixNano())) + hs := rtmp.NewHandshake(rd) + + if err := hs.WriteC0S0(c); err != nil { + return errors.Wrap(err, "write c0") + } + if err := hs.WriteC1S1(c); err != nil { + return errors.Wrap(err, "write c1") + } + + if _, err = hs.ReadC0S0(c); err != nil { + return errors.Wrap(err, "read s1") + } + s1, err := hs.ReadC1S1(c) + if err != nil { + return errors.Wrap(err, "read s1") + } + if _, err = hs.ReadC2S2(c); err != nil { + return errors.Wrap(err, "read s2") + } + + if err := hs.WriteC2S2(c, s1); err != nil { + return errors.Wrap(err, "write c2") + } + logger.Tf(ctx, "RTMP handshake with %v:%v success", ips[0], port) + + // Do connect and publish. + client := rtmp.NewProtocol(c) + + connectApp := rtmp.NewConnectAppPacket() + tcURL := fmt.Sprintf("rtmp://%v%v", u.Hostname(), app) + connectApp.CommandObject.Set("tcUrl", amf0.NewString(tcURL)) + if err = client.WritePacket(connectApp, 1); err != nil { + return errors.Wrap(err, "write connect app") + } + + var connectAppRes *rtmp.ConnectAppResPacket + if _, err = client.ExpectPacket(&connectAppRes); err != nil { + return errors.Wrap(err, "expect connect app res") + } + logger.Tf(ctx, "RTMP connect app success, tcUrl=%v", tcURL) + + createStream := rtmp.NewCreateStreamPacket() + if err = client.WritePacket(createStream, 1); err != nil { + return errors.Wrap(err, "write create stream") + } + + var createStreamRes *rtmp.CreateStreamResPacket + if _, err = client.ExpectPacket(&createStreamRes); err != nil { + return errors.Wrap(err, "expect create stream res") + } + logger.Tf(ctx, "RTMP create stream success") + + publish := rtmp.NewPublishPacket() + publish.StreamName = *amf0.NewString(stream) + if err = client.WritePacket(publish, 1); err != nil { + return errors.Wrap(err, "write publish") + } + logger.Tf(ctx, "RTMP publish stream success, stream=%v", stream) + + if closeAfterPublished { + logger.Tf(ctx, "Close connection after published") + return nil + } + + return nil +} diff --git a/trunk/3rdparty/srs-bench/live/stat.go b/trunk/3rdparty/srs-bench/live/stat.go new file mode 100644 index 0000000000..f368dfd07f --- /dev/null +++ b/trunk/3rdparty/srs-bench/live/stat.go @@ -0,0 +1,68 @@ +// The MIT License (MIT) +// +// # Copyright (c) 2021 Winlin +// +// 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. +package live + +import ( + "context" + "encoding/json" + "net/http" + "strings" + + "github.com/ossrs/go-oryx-lib/logger" +) + +type statLive struct { + Publishers struct { + Expect int `json:"expect"` + Alive int `json:"alive"` + } `json:"publishers"` + Subscribers struct { + Expect int `json:"expect"` + Alive int `json:"alive"` + } `json:"subscribers"` + PeerConnection interface{} `json:"random-pc"` +} + +var gStatLive statLive + +func handleStat(ctx context.Context, mux *http.ServeMux, l string) { + if strings.HasPrefix(l, ":") { + l = "127.0.0.1" + l + } + + logger.Tf(ctx, "Handle http://%v/api/v1/sb/live", l) + mux.HandleFunc("/api/v1/sb/live", func(w http.ResponseWriter, r *http.Request) { + res := &struct { + Code int `json:"code"` + Data interface{} `json:"data"` + }{ + 0, &gStatLive, + } + + b, err := json.Marshal(res) + if err != nil { + logger.Wf(ctx, "marshal %v err %+v", res, err) + return + } + + w.Write(b) + }) +} diff --git a/trunk/3rdparty/srs-bench/main.go b/trunk/3rdparty/srs-bench/main.go index e8f9786b4b..5052af2272 100644 --- a/trunk/3rdparty/srs-bench/main.go +++ b/trunk/3rdparty/srs-bench/main.go @@ -24,27 +24,31 @@ import ( "context" "flag" "fmt" - "github.com/ossrs/go-oryx-lib/logger" - "github.com/ossrs/srs-bench/gb28181" - "github.com/ossrs/srs-bench/janus" - "github.com/ossrs/srs-bench/srs" "io/ioutil" "os" "os/signal" "syscall" + + "github.com/ossrs/go-oryx-lib/logger" + "github.com/ossrs/srs-bench/gb28181" + "github.com/ossrs/srs-bench/janus" + "github.com/ossrs/srs-bench/live" + "github.com/ossrs/srs-bench/srs" ) func main() { var sfu string fl := flag.NewFlagSet(os.Args[0], flag.ContinueOnError) fl.SetOutput(ioutil.Discard) - fl.StringVar(&sfu, "sfu", "srs", "The SFU server, srs or gb28181 or janus") + fl.StringVar(&sfu, "sfu", "rtc", "") _ = fl.Parse(os.Args[1:]) ctx := context.Background() var conf interface{} - if sfu == "srs" { + if sfu == "rtc" || sfu == "srs" { srs.Parse(ctx) + } else if sfu == "live" { + live.Parse(ctx) } else if sfu == "gb28181" { conf = gb28181.Parse(ctx) } else if sfu == "janus" { @@ -52,7 +56,11 @@ func main() { } else { fmt.Println(fmt.Sprintf("Usage: %v [Options]", os.Args[0])) fmt.Println(fmt.Sprintf("Options:")) - fmt.Println(fmt.Sprintf(" -sfu The target SFU, srs or gb28181 or janus. Default: srs")) + fmt.Println(fmt.Sprintf(" -sfu The target server that can be rtc, live, janus, or gb28181. Default: rtc")) + fmt.Println(fmt.Sprintf(" rtc/srs: SRS WebRTC SFU server, for WebRTC/WHIP/WHEP.")) + fmt.Println(fmt.Sprintf(" live: SRS live streaming server, for RTMP/HTTP-FLV/HLS.")) + fmt.Println(fmt.Sprintf(" janus: Janus WebRTC SFU server, for janus private protocol.")) + fmt.Println(fmt.Sprintf(" gb28181: GB media server, for GB protocol.")) os.Exit(-1) } @@ -67,8 +75,10 @@ func main() { }() var err error - if sfu == "srs" { + if sfu == "rtc" || sfu == "srs" { err = srs.Run(ctx) + } else if sfu == "live" { + err = live.Run(ctx) } else if sfu == "gb28181" { err = gb28181.Run(ctx, conf) } else if sfu == "janus" { diff --git a/trunk/3rdparty/srs-bench/pcap/main.go b/trunk/3rdparty/srs-bench/pcap/main.go index 9409578be4..2464e51acb 100644 --- a/trunk/3rdparty/srs-bench/pcap/main.go +++ b/trunk/3rdparty/srs-bench/pcap/main.go @@ -7,6 +7,7 @@ import ( "fmt" "net" "os" + "strings" "time" "github.com/google/gopacket" @@ -62,9 +63,19 @@ func doMain(ctx context.Context) error { } defer f.Close() - r, err := pcapgo.NewNgReader(f, pcapgo.DefaultNgReaderOptions) - if err != nil { - return errors.Wrapf(err, "new reader") + var source *gopacket.PacketSource + if strings.HasSuffix(filename, ".pcap") { + r, err := pcapgo.NewReader(f) + if err != nil { + return errors.Wrapf(err, "new reader") + } + source = gopacket.NewPacketSource(r, r.LinkType()) + } else { + r, err := pcapgo.NewNgReader(f, pcapgo.DefaultNgReaderOptions) + if err != nil { + return errors.Wrapf(err, "new reader") + } + source = gopacket.NewPacketSource(r, r.LinkType()) } // TODO: FIXME: Should start a goroutine to consume bytes from conn. @@ -76,7 +87,6 @@ func doMain(ctx context.Context) error { var packetNumber uint64 var previousTime *time.Time - source := gopacket.NewPacketSource(r, r.LinkType()) for packet := range source.Packets() { packetNumber++ @@ -90,7 +100,7 @@ func doMain(ctx context.Context) error { if len(payload) == 0 { continue } - if tcp.DstPort != 1935 { + if tcp.DstPort != 1935 && tcp.DstPort != 19350 { continue } diff --git a/trunk/3rdparty/srs-bench/srs/publisher.go b/trunk/3rdparty/srs-bench/srs/publisher.go index 8cf7f450ae..6ef381c7ee 100644 --- a/trunk/3rdparty/srs-bench/srs/publisher.go +++ b/trunk/3rdparty/srs-bench/srs/publisher.go @@ -34,7 +34,7 @@ import ( ) // @see https://github.com/pion/webrtc/blob/master/examples/play-from-disk/main.go -func startPublish(ctx context.Context, r, sourceAudio, sourceVideo string, fps int, enableAudioLevel, enableTWCC bool) error { +func startPublish(ctx context.Context, r, sourceAudio, sourceVideo string, fps int, enableAudioLevel, enableTWCC, closeAfterPublished bool) error { ctx = logger.WithContext(ctx) logger.Tf(ctx, "Run publish url=%v, audio=%v, video=%v, fps=%v, audio-level=%v, twcc=%v", @@ -77,10 +77,13 @@ func startPublish(ctx context.Context, r, sourceAudio, sourceVideo string, fps i return nil, err } - if sourceAudio != "" { + // For CAP, we always add audio track, because both audio and video are disabled for CAP, which will + // cause failed when exchange SDP. + if sourceAudio != "" || closeAfterPublished { aIngester = newAudioIngester(sourceAudio) registry.Add(&rtpInteceptorFactory{aIngester.audioLevelInterceptor}) } + if sourceVideo != "" { vIngester = newVideoIngester(sourceVideo) registry.Add(&rtpInteceptorFactory{vIngester.markerInterceptor}) @@ -178,6 +181,7 @@ func startPublish(ctx context.Context, r, sourceAudio, sourceVideo string, fps i // Wait for event from context or tracks. var wg sync.WaitGroup + defer wg.Wait() wg.Add(1) go func() { @@ -186,6 +190,18 @@ func startPublish(ctx context.Context, r, sourceAudio, sourceVideo string, fps i doClose() // Interrupt the RTCP read. }() + // If CAP, directly close the connection after published. + if closeAfterPublished { + select { + case <-ctx.Done(): + case <-pcDoneCtx.Done(): + } + + logger.Tf(ctx, "Close connection after published") + cancel() + return nil + } + wg.Add(1) go func() { defer wg.Done() @@ -295,6 +311,5 @@ func startPublish(ctx context.Context, r, sourceAudio, sourceVideo string, fps i } }() - wg.Wait() return nil } diff --git a/trunk/3rdparty/srs-bench/srs/rtc_test.go b/trunk/3rdparty/srs-bench/srs/rtc_test.go index a5bf90a36c..4754720896 100644 --- a/trunk/3rdparty/srs-bench/srs/rtc_test.go +++ b/trunk/3rdparty/srs-bench/srs/rtc_test.go @@ -2153,8 +2153,8 @@ func TestRtcDTLS_ClientPassive_ARQ_Certificate_After_ClientHello(t *testing.T) { // case, we corrupt the ClientHello packet sent by srs-bench. // Note that the passive mode is not being tested as the focus is solely on testing srs-server. // -// [Corrupt] No.1 srs-bench: ClientHello(Epoch=0, Sequence=0), change length from 129 to 0xf. -// No.2 srs-server: Alert (Level: Fatal, Description: Illegal Parameter) +// [Corrupt] No.1 srs-bench: ClientHello(Epoch=0, Sequence=0), change length from 129 to 0xf. +// No.2 srs-server: Alert (Level: Fatal, Description: Illegal Parameter) func TestRtcDTLS_ClientActive_Corrupt_ClientHello(t *testing.T) { ctx := logger.WithContext(context.Background()) ctx, cancel := context.WithTimeout(ctx, time.Duration(*srsTimeout)*time.Millisecond) @@ -2209,10 +2209,11 @@ func TestRtcDTLS_ClientActive_Corrupt_ClientHello(t *testing.T) { // case, we corrupt the ClientHello packet sent by srs-bench. // Note that the passive mode is not being tested as the focus is solely on testing srs-server. // -// No.1 srs-bench: ClientHello -// No.2 srs-server: ServerHello, Certificate, ServerKeyExchange, CertificateRequest, ServerHelloDone -// [Corrupt] No.3 srs-bench: Certificate, ClientKeyExchange, CertificateVerify, ChangeCipherSpec, Finished -// No.4 srs-server: Alert (Level: Fatal, Description: Illegal Parameter) +// No.1 srs-bench: ClientHello +// No.2 srs-server: ServerHello, Certificate, ServerKeyExchange, CertificateRequest, ServerHelloDone +// [Corrupt] No.3 srs-bench: Certificate, ClientKeyExchange, CertificateVerify, ChangeCipherSpec, Finished +// No.4 srs-server: Alert (Level: Fatal, Description: Illegal Parameter) +// // [Corrupt] No.1 srs-bench: ClientHello(Epoch=0, Sequence=0), change length from 129 to 0xf. // No.2 srs-server: Alert (Level: Fatal, Description: Illegal Parameter) func TestRtcDTLS_ClientActive_Corrupt_Certificate(t *testing.T) { diff --git a/trunk/3rdparty/srs-bench/srs/rtmp_test.go b/trunk/3rdparty/srs-bench/srs/rtmp_test.go index 7dd39597f2..798db65da7 100644 --- a/trunk/3rdparty/srs-bench/srs/rtmp_test.go +++ b/trunk/3rdparty/srs-bench/srs/rtmp_test.go @@ -24,7 +24,6 @@ import ( "bytes" "context" "fmt" - "github.com/pkg/errors" "math/rand" "os" "sync" @@ -36,6 +35,7 @@ import ( "github.com/ossrs/go-oryx-lib/logger" "github.com/ossrs/go-oryx-lib/rtmp" "github.com/pion/interceptor" + "github.com/pkg/errors" ) func TestRtmpPublishPlay(t *testing.T) { @@ -623,7 +623,10 @@ func TestRtmpPublish_HttpFlvPlayNoVideo(t *testing.T) { go func() { defer wg.Done() publisher.onSendPacket = func(m *rtmp.Message) error { - time.Sleep(1 * time.Millisecond) + // Note that must greater than the cost of ffmpeg-opus, which is about 4ms, otherwise, + // the publisher will always get audio frames to transcode and won't accept new players + // connection and finally failed the case. + time.Sleep(5 * time.Millisecond) return nil } if r0 = publisher.Ingest(ctx, *srsPublishAvatar); r0 != nil { diff --git a/trunk/3rdparty/srs-bench/srs/srs.go b/trunk/3rdparty/srs-bench/srs/srs.go index 648ff39e17..62f6f998b8 100644 --- a/trunk/3rdparty/srs-bench/srs/srs.go +++ b/trunk/3rdparty/srs-bench/srs/srs.go @@ -46,6 +46,8 @@ var clients, streams, delay int var statListen string +var closeAfterPublished bool + func Parse(ctx context.Context) { fl := flag.NewFlagSet(os.Args[0], flag.ContinueOnError) @@ -71,10 +73,16 @@ func Parse(ctx context.Context) { fl.StringVar(&statListen, "stat", "", "") + fl.BoolVar(&closeAfterPublished, "cap", false, "") + fl.Usage = func() { fmt.Println(fmt.Sprintf("Usage: %v [Options]", os.Args[0])) fmt.Println(fmt.Sprintf("Options:")) - fmt.Println(fmt.Sprintf(" -sfu The target SFU, srs or gb28181 or janus. Default: srs")) + fmt.Println(fmt.Sprintf(" -sfu The target server that can be rtc, live, janus, or gb28181. Default: rtc")) + fmt.Println(fmt.Sprintf(" rtc/srs: SRS WebRTC SFU server, for WebRTC/WHIP/WHEP.")) + fmt.Println(fmt.Sprintf(" live: SRS live streaming server, for RTMP/HTTP-FLV/HLS.")) + fmt.Println(fmt.Sprintf(" janus: Janus WebRTC SFU server, for janus private protocol.")) + fmt.Println(fmt.Sprintf(" gb28181: GB media server, for GB protocol.")) fmt.Println(fmt.Sprintf(" -nn The number of clients to simulate. Default: 1")) fmt.Println(fmt.Sprintf(" -sn The number of streams to simulate. Variable: %%d. Default: 1")) fmt.Println(fmt.Sprintf(" -delay The start delay in ms for each client or stream to simulate. Default: 50")) @@ -91,6 +99,7 @@ func Parse(ctx context.Context) { fmt.Println(fmt.Sprintf(" -fps [Optional] The fps of .h264 source file.")) fmt.Println(fmt.Sprintf(" -sa [Optional] The file path to read audio, ignore if empty.")) fmt.Println(fmt.Sprintf(" -sv [Optional] The file path to read video, ignore if empty.")) + fmt.Println(fmt.Sprintf(" -cap Whether to close connection after publish. Default: false")) fmt.Println(fmt.Sprintf("\n例如,1个播放,1个推流:")) fmt.Println(fmt.Sprintf(" %v -sr webrtc://localhost/live/livestream", os.Args[0])) fmt.Println(fmt.Sprintf(" %v -pr webrtc://localhost/live/livestream -sa avatar.ogg -sv avatar.h264 -fps 25", os.Args[0])) @@ -114,7 +123,7 @@ func Parse(ctx context.Context) { if sr == "" && pr == "" { showHelp = true } - if pr != "" && (sourceAudio == "" && sourceVideo == "") { + if pr != "" && !closeAfterPublished && (sourceAudio == "" && sourceVideo == "") { showHelp = true } if showHelp { @@ -131,8 +140,8 @@ func Parse(ctx context.Context) { summaryDesc = fmt.Sprintf("%v, play(url=%v, da=%v, dv=%v, pli=%v)", summaryDesc, sr, dumpAudio, dumpVideo, pli) } if pr != "" { - summaryDesc = fmt.Sprintf("%v, publish(url=%v, sa=%v, sv=%v, fps=%v)", - summaryDesc, pr, sourceAudio, sourceVideo, fps) + summaryDesc = fmt.Sprintf("%v, publish(url=%v, sa=%v, sv=%v, fps=%v, cap=%v)", + summaryDesc, pr, sourceAudio, sourceVideo, fps, closeAfterPublished) } logger.Tf(ctx, "Run benchmark with %v", summaryDesc) @@ -161,6 +170,7 @@ func Run(ctx context.Context) error { // Run tasks. var wg sync.WaitGroup + defer wg.Wait() // Run STAT API server. wg.Add(1) @@ -266,7 +276,7 @@ func Run(ctx context.Context) error { gStatRTC.Publishers.Alive-- }() - if err := startPublish(ctx, pr, sourceAudio, sourceVideo, fps, audioLevel, videoTWCC); err != nil { + if err := startPublish(ctx, pr, sourceAudio, sourceVideo, fps, audioLevel, videoTWCC, closeAfterPublished); err != nil { if errors.Cause(err) != context.Canceled { logger.Wf(ctx, "Run err %+v", err) } @@ -276,7 +286,5 @@ func Run(ctx context.Context) error { time.Sleep(time.Duration(delay) * time.Millisecond) } - wg.Wait() - return nil } diff --git a/trunk/3rdparty/srs-bench/tcpproxy/main.go b/trunk/3rdparty/srs-bench/tcpproxy/main.go new file mode 100644 index 0000000000..09dcfbf642 --- /dev/null +++ b/trunk/3rdparty/srs-bench/tcpproxy/main.go @@ -0,0 +1,159 @@ +package main + +import ( + "context" + "crypto/rand" + "crypto/sha256" + "encoding/hex" + "fmt" + "net" + "sync" + "time" +) + +func main() { + if err := doMain(); err != nil { + panic(err) + } +} + +func doMain() error { + hashID := buildHashID() + + listener, err := net.Listen("tcp", ":1935") + if err != nil { + return err + } + trace(hashID, "Listen at %v", listener.Addr()) + + for { + client, err := listener.Accept() + if err != nil { + return err + } + + backend, err := net.Dial("tcp", "localhost:19350") + if err != nil { + return err + } + + go serve(client, backend) + } + return nil +} + +func serve(client, backend net.Conn) { + defer client.Close() + defer backend.Close() + hashID := buildHashID() + if err := doServe(hashID, client, backend); err != nil { + trace(hashID, "Serve error %v", err) + } +} + +func doServe(hashID string, client, backend net.Conn) error { + var wg sync.WaitGroup + var r0 error + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + if c, ok := client.(*net.TCPConn); ok { + c.SetNoDelay(true) + } + if c, ok := backend.(*net.TCPConn); ok { + c.SetNoDelay(true) + } + + wg.Add(1) + go func() { + defer wg.Done() + defer cancel() + + for { + buf := make([]byte, 128*1024) + nn, err := client.Read(buf) + if err != nil { + trace(hashID, "Read from client error %v", err) + r0 = err + return + } + if nn == 0 { + trace(hashID, "Read from client EOF") + return + } + + _, err = backend.Write(buf[:nn]) + if err != nil { + trace(hashID, "Write to RTMP backend error %v", err) + r0 = err + return + } + + trace(hashID, "Copy %v bytes to RTMP backend", nn) + } + }() + + wg.Add(1) + go func() { + defer wg.Done() + defer cancel() + + for { + buf := make([]byte, 128*1024) + nn, err := backend.Read(buf) + if err != nil { + trace(hashID, "Read from RTMP backend error %v", err) + r0 = err + return + } + if nn == 0 { + trace(hashID, "Read from RTMP backend EOF") + return + } + + _, err = client.Write(buf[:nn]) + if err != nil { + trace(hashID, "Write to client error %v", err) + r0 = err + return + } + + trace(hashID, "Copy %v bytes to RTMP client", nn) + } + }() + + wg.Add(1) + go func() { + defer wg.Done() + + defer client.Close() + defer backend.Close() + + <-ctx.Done() + trace(hashID, "Context is done, close the connections") + }() + + trace(hashID, "Start proxing client %v over %v to backend %v", client.RemoteAddr(), backend.LocalAddr(), backend.RemoteAddr()) + wg.Wait() + trace(hashID, "Finish proxing client %v over %v to backend %v", client.RemoteAddr(), backend.LocalAddr(), backend.RemoteAddr()) + + return r0 +} + +func trace(id, msg string, a ...interface{}) { + fmt.Println(fmt.Sprintf("[%v][%v] %v", + time.Now().Format("2006-01-02 15:04:05.000"), id, + fmt.Sprintf(msg, a...), + )) +} + +func buildHashID() string { + randomData := make([]byte, 16) + if _, err := rand.Read(randomData); err != nil { + return "" + } + + hash := sha256.Sum256(randomData) + return hex.EncodeToString(hash[:])[:6] +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/LICENSE b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/LICENSE new file mode 100644 index 0000000000..fa0086a952 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. \ No newline at end of file diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/README.md b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/README.md new file mode 100644 index 0000000000..27b6b547e1 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/README.md @@ -0,0 +1,63 @@ +[![PkgGoDev](https://pkg.go.dev/badge/github.com/haivision/srtgo)](https://pkg.go.dev/github.com/haivision/srtgo) + +# srtgo + +Go bindings for [SRT](https://github.com/Haivision/srt) (Secure Reliable Transport), the open source transport technology that optimizes streaming performance across unpredictable networks. + +## Why srtgo? +The purpose of srtgo is easing the adoption of SRT transport technology. Using Go, with just a few lines of code you can implement an application that sends/receives data with all the benefits of SRT technology: security and reliability, while keeping latency low. + +## Is this a new implementation of SRT? +No! We are just exposing the great work done by the community in the [SRT project](https://github.com/Haivision/srt) as a golang library. All the functionality and implementation still resides in the official SRT project. + + +# Features supported +* Basic API exposed to easy develop SRT sender/receiver apps +* Caller and Listener mode +* Live transport type +* File transport type +* Message/Buffer API +* SRT transport options up to SRT 1.4.1 +* SRT Stats retrieval + +# Usage +Example of a SRT receiver application: +``` go +package main + +import ( + "github.com/haivision/srtgo" + "fmt" +) + +func main() { + options := make(map[string]string) + options["transtype"] = "file" + + sck := srtgo.NewSrtSocket("0.0.0.0", 8090, options) + defer sck.Close() + sck.Listen(1) + s, _ := sck.Accept() + defer s.Close() + + buf := make([]byte, 2048) + for { + n, _ := s.Read(buf) + if n == 0 { + break + } + fmt.Println("Received %d bytes", n) + } + //.... +} + +``` + + +# Dependencies + +* srtlib + +You can find detailed instructions about how to install srtlib in its [README file](https://github.com/Haivision/srt#requirements) + +gosrt has been developed with srt 1.4.1 as its main target and has been successfully tested in srt 1.3.4 and above. diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/accept.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/accept.go new file mode 100644 index 0000000000..a5ca5ed5d8 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/accept.go @@ -0,0 +1,69 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include + +SRTSOCKET srt_accept_wrapped(SRTSOCKET lsn, struct sockaddr* addr, int* addrlen, int *srterror, int *syserror) +{ + int ret = srt_accept(lsn, addr, addrlen); + if (ret < 0) { + *srterror = srt_getlasterror(syserror); + } + return ret; +} + +*/ +import "C" +import ( + "fmt" + "net" + "syscall" + "unsafe" +) + +func srtAcceptImpl(lsn C.SRTSOCKET, addr *C.struct_sockaddr, addrlen *C.int) (C.SRTSOCKET, error) { + srterr := C.int(0) + syserr := C.int(0) + socket := C.srt_accept_wrapped(lsn, addr, addrlen, &srterr, &syserr) + if srterr != 0 { + srterror := SRTErrno(srterr) + if syserr < 0 { + srterror.wrapSysErr(syscall.Errno(syserr)) + } + return socket, srterror + } + return socket, nil +} + +// Accept an incoming connection +func (s SrtSocket) Accept() (*SrtSocket, *net.UDPAddr, error) { + var err error + if !s.blocking { + err = s.pd.wait(ModeRead) + if err != nil { + return nil, nil, err + } + } + var addr syscall.RawSockaddrAny + sclen := C.int(syscall.SizeofSockaddrAny) + socket, err := srtAcceptImpl(s.socket, (*C.struct_sockaddr)(unsafe.Pointer(&addr)), &sclen) + if err != nil { + return nil, nil, err + } + if socket == SRT_INVALID_SOCK { + return nil, nil, fmt.Errorf("srt accept, error accepting the connection: %w", srtGetAndClearError()) + } + + newSocket, err := newFromSocket(&s, socket) + if err != nil { + return nil, nil, fmt.Errorf("new socket could not be created: %w", err) + } + + udpAddr, err := udpAddrFromSockaddr(&addr) + if err != nil { + return nil, nil, err + } + + return newSocket, udpAddr, nil +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/callback.h b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/callback.h new file mode 100644 index 0000000000..0fbbfa9b65 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/callback.h @@ -0,0 +1,7 @@ +#include + +int srtListenCBWrapper(void* opaque, SRTSOCKET ns, int hs_version, struct sockaddr* peeraddr, char* streamid); +void srtConnectCBWrapper(void* opaque, SRTSOCKET ns, int errorcode, struct sockaddr* peeraddr, int token); + +int srtListenCB(void* opaque, SRTSOCKET ns, int hs_version, const struct sockaddr* peeraddr, const char* streamid); +void srtConnectCB(void* opaque, SRTSOCKET ns, int errorcode, const struct sockaddr* peeraddr, int token); \ No newline at end of file diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/callback_c.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/callback_c.go new file mode 100644 index 0000000000..6932bee7ed --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/callback_c.go @@ -0,0 +1,17 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include "callback.h" + +int srtListenCB(void* opaque, SRTSOCKET ns, int hs_version, const struct sockaddr* peeraddr, const char* streamid) +{ + return srtListenCBWrapper(opaque, ns, hs_version, (struct sockaddr*)peeraddr, (char*)streamid); +} + +void srtConnectCB(void* opaque, SRTSOCKET ns, int errorcode, const struct sockaddr* peeraddr, int token) +{ + srtConnectCBWrapper(opaque, ns, errorcode, (struct sockaddr*)peeraddr, token); +} +*/ +import "C" diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/errors.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/errors.go new file mode 100644 index 0000000000..069889e6e8 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/errors.go @@ -0,0 +1,242 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include +*/ +import "C" +import ( + "strconv" + "syscall" +) + +type SrtInvalidSock struct{} +type SrtRendezvousUnbound struct{} +type SrtSockConnected struct{} +type SrtConnectionRejected struct{} +type SrtConnectTimeout struct{} +type SrtSocketClosed struct{} +type SrtEpollTimeout struct{} + +func (m *SrtInvalidSock) Error() string { + return "Socket u indicates no valid socket ID" +} + +func (m *SrtRendezvousUnbound) Error() string { + return "Socket u is in rendezvous mode, but it wasn't bound" +} + +func (m *SrtSockConnected) Error() string { + return "Socket u is already connected" +} + +func (m *SrtConnectionRejected) Error() string { + return "Connection has been rejected" +} + +func (m *SrtConnectTimeout) Error() string { + return "Connection has been timed out" +} + +func (m *SrtSocketClosed) Error() string { + return "The socket has been closed" +} + +func (m *SrtEpollTimeout) Error() string { + return "Operation has timed out" +} + +func (m *SrtEpollTimeout) Timeout() bool { + return true +} + +func (m *SrtEpollTimeout) Temporary() bool { + return true +} + +//MUST be called from same OS thread that generated the error (i.e.: use runtime.LockOSThread()) +func srtGetAndClearError() error { + defer C.srt_clearlasterror() + eSysErrno := C.int(0) + errno := C.srt_getlasterror(&eSysErrno) + srterr := SRTErrno(errno) + if eSysErrno != 0 { + return srterr.wrapSysErr(syscall.Errno(eSysErrno)) + } + return srterr +} + +//Based of off golang errno handling: https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/syscall/syscall_unix.go;l=114 +type SRTErrno int + +func (e SRTErrno) Error() string { + //Workaround for unknown being -1 + if e == Unknown { + return "Internal error when setting the right error code" + } + if 0 <= int(e) && int(e) < len(srterrors) { + s := srterrors[e] + if s != "" { + return s + } + } + return "srterrno: " + strconv.Itoa(int(e)) +} + +func (e SRTErrno) Is(target error) bool { + //for backwards compat + switch target.(type) { + case *SrtInvalidSock: + return e == EInvSock + case *SrtRendezvousUnbound: + return e == ERdvUnbound + case *SrtSockConnected: + return e == EConnSock + case *SrtConnectionRejected: + return e == EConnRej + case *SrtConnectTimeout: + return e == ETimeout + case *SrtSocketClosed: + return e == ESClosed + } + return false +} + +func (e SRTErrno) Temporary() bool { + return e == EAsyncFAIL || e == EAsyncRCV || e == EAsyncSND || e == ECongest || e == ETimeout +} + +func (e SRTErrno) Timeout() bool { + return e == ETimeout +} + +func (e SRTErrno) wrapSysErr(errno syscall.Errno) error { + return &srtErrnoSysErrnoWrapped{ + e: e, + eSys: errno, + } +} + +type srtErrnoSysErrnoWrapped struct { + e SRTErrno + eSys syscall.Errno +} + +func (e *srtErrnoSysErrnoWrapped) Error() string { + return e.e.Error() +} + +func (e *srtErrnoSysErrnoWrapped) Is(target error) bool { + return e.e.Is(target) +} + +func (e *srtErrnoSysErrnoWrapped) Temporary() bool { + return e.e.Temporary() +} + +func (e *srtErrnoSysErrnoWrapped) Timeout() bool { + return e.e.Timeout() +} + +func (e *srtErrnoSysErrnoWrapped) Unwrap() error { + return error(e.eSys) +} + +//Shadows SRT_ERRNO srtcore/srt.h line 490+ +const ( + Unknown = SRTErrno(C.SRT_EUNKNOWN) + Success = SRTErrno(C.SRT_SUCCESS) + //Major: SETUP + EConnSetup = SRTErrno(C.SRT_ECONNSETUP) + ENoServer = SRTErrno(C.SRT_ENOSERVER) + EConnRej = SRTErrno(C.SRT_ECONNREJ) + ESockFail = SRTErrno(C.SRT_ESOCKFAIL) + ESecFail = SRTErrno(C.SRT_ESECFAIL) + ESClosed = SRTErrno(C.SRT_ESCLOSED) + //Major: CONNECTION + EConnFail = SRTErrno(C.SRT_ECONNFAIL) + EConnLost = SRTErrno(C.SRT_ECONNLOST) + ENoConn = SRTErrno(C.SRT_ENOCONN) + //Major: SYSTEMRES + EResource = SRTErrno(C.SRT_ERESOURCE) + EThread = SRTErrno(C.SRT_ETHREAD) + EnoBuf = SRTErrno(C.SRT_ENOBUF) + ESysObj = SRTErrno(C.SRT_ESYSOBJ) + //Major: FILESYSTEM + EFile = SRTErrno(C.SRT_EFILE) + EInvRdOff = SRTErrno(C.SRT_EINVRDOFF) + ERdPerm = SRTErrno(C.SRT_ERDPERM) + EInvWrOff = SRTErrno(C.SRT_EINVWROFF) + EWrPerm = SRTErrno(C.SRT_EWRPERM) + //Major: NOTSUP + EInvOp = SRTErrno(C.SRT_EINVOP) + EBoundSock = SRTErrno(C.SRT_EBOUNDSOCK) + EConnSock = SRTErrno(C.SRT_ECONNSOCK) + EInvParam = SRTErrno(C.SRT_EINVPARAM) + EInvSock = SRTErrno(C.SRT_EINVSOCK) + EUnboundSock = SRTErrno(C.SRT_EUNBOUNDSOCK) + ENoListen = SRTErrno(C.SRT_ENOLISTEN) + ERdvNoServ = SRTErrno(C.SRT_ERDVNOSERV) + ERdvUnbound = SRTErrno(C.SRT_ERDVUNBOUND) + EInvalMsgAPI = SRTErrno(C.SRT_EINVALMSGAPI) + EInvalBufferAPI = SRTErrno(C.SRT_EINVALBUFFERAPI) + EDupListen = SRTErrno(C.SRT_EDUPLISTEN) + ELargeMsg = SRTErrno(C.SRT_ELARGEMSG) + EInvPollID = SRTErrno(C.SRT_EINVPOLLID) + EPollEmpty = SRTErrno(C.SRT_EPOLLEMPTY) + //EBindConflict = SRTErrno(C.SRT_EBINDCONFLICT) + //Major: AGAIN + EAsyncFAIL = SRTErrno(C.SRT_EASYNCFAIL) + EAsyncSND = SRTErrno(C.SRT_EASYNCSND) + EAsyncRCV = SRTErrno(C.SRT_EASYNCRCV) + ETimeout = SRTErrno(C.SRT_ETIMEOUT) + ECongest = SRTErrno(C.SRT_ECONGEST) + //Major: PEERERROR + EPeer = SRTErrno(C.SRT_EPEERERR) +) + +//Unknown cannot be here since it would have a negative index! +//Error strings taken from: https://github.com/Haivision/srt/blob/master/docs/API/API-functions.md +var srterrors = [...]string{ + Success: "The value set when the last error was cleared and no error has occurred since then", + EConnSetup: "General setup error resulting from internal system state", + ENoServer: "Connection timed out while attempting to connect to the remote address", + EConnRej: "Connection has been rejected", + ESockFail: "An error occurred when trying to call a system function on an internally used UDP socket", + ESecFail: "A possible tampering with the handshake packets was detected, or encryption request wasn't properly fulfilled.", + ESClosed: "A socket that was vital for an operation called in blocking mode has been closed during the operation", + EConnFail: "General connection failure of unknown details", + EConnLost: "The socket was properly connected, but the connection has been broken", + ENoConn: "The socket is not connected", + EResource: "System or standard library error reported unexpectedly for unknown purpose", + EThread: "System was unable to spawn a new thread when requried", + EnoBuf: "System was unable to allocate memory for buffers", + ESysObj: "System was unable to allocate system specific objects", + EFile: "General filesystem error (for functions operating with file transmission)", + EInvRdOff: "Failure when trying to read from a given position in the file", + ERdPerm: "Read permission was denied when trying to read from file", + EInvWrOff: "Failed to set position in the written file", + EWrPerm: "Write permission was denied when trying to write to a file", + EInvOp: "Invalid operation performed for the current state of a socket", + EBoundSock: "The socket is currently bound and the required operation cannot be performed in this state", + EConnSock: "The socket is currently connected and therefore performing the required operation is not possible", + EInvParam: "Call parameters for API functions have some requirements that were not satisfied", + EInvSock: "The API function required an ID of an entity (socket or group) and it was invalid", + EUnboundSock: "The operation to be performed on a socket requires that it first be explicitly bound", + ENoListen: "The socket passed for the operation is required to be in the listen state", + ERdvNoServ: "The required operation cannot be performed when the socket is set to rendezvous mode", + ERdvUnbound: "An attempt was made to connect to a socket set to rendezvous mode that was not first bound", + EInvalMsgAPI: "The function was used incorrectly in the message API", + EInvalBufferAPI: "The function was used incorrectly in the stream (buffer) API", + EDupListen: "The port tried to be bound for listening is already busy", + ELargeMsg: "Size exceeded", + EInvPollID: "The epoll ID passed to an epoll function is invalid", + EPollEmpty: "The epoll container currently has no subscribed sockets", + //EBindConflict: "SRT_EBINDCONFLICT", + EAsyncFAIL: "General asynchronous failure (not in use currently)", + EAsyncSND: "Sending operation is not ready to perform", + EAsyncRCV: "Receiving operation is not ready to perform", + ETimeout: "The operation timed out", + ECongest: "With SRTO_TSBPDMODE and SRTO_TLPKTDROP set to true, some packets were dropped by sender", + EPeer: "Receiver peer is writing to a file that the agent is sending", +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/logging.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/logging.go new file mode 100644 index 0000000000..948863b63f --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/logging.go @@ -0,0 +1,66 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include +extern void srtLogCB(void* opaque, int level, const char* file, int line, const char* area, const char* message); +*/ +import "C" + +import ( + "sync" + "unsafe" + + gopointer "github.com/mattn/go-pointer" +) + +type LogCallBackFunc func(level SrtLogLevel, file string, line int, area, message string) + +type SrtLogLevel int + +const ( + // SrtLogLevelEmerg = int(C.LOG_EMERG) + // SrtLogLevelAlert = int(C.LOG_ALERT) + SrtLogLevelCrit SrtLogLevel = SrtLogLevel(C.LOG_CRIT) + SrtLogLevelErr SrtLogLevel = SrtLogLevel(C.LOG_ERR) + SrtLogLevelWarning SrtLogLevel = SrtLogLevel(C.LOG_WARNING) + SrtLogLevelNotice SrtLogLevel = SrtLogLevel(C.LOG_NOTICE) + SrtLogLevelInfo SrtLogLevel = SrtLogLevel(C.LOG_INFO) + SrtLogLevelDebug SrtLogLevel = SrtLogLevel(C.LOG_DEBUG) + SrtLogLevelTrace SrtLogLevel = SrtLogLevel(8) +) + +var ( + logCBPtr unsafe.Pointer = nil + logCBPtrLock sync.Mutex +) + +//export srtLogCBWrapper +func srtLogCBWrapper(arg unsafe.Pointer, level C.int, file *C.char, line C.int, area, message *C.char) { + userCB := gopointer.Restore(arg).(LogCallBackFunc) + go userCB(SrtLogLevel(level), C.GoString(file), int(line), C.GoString(area), C.GoString(message)) +} + +func SrtSetLogLevel(level SrtLogLevel) { + C.srt_setloglevel(C.int(level)) +} + +func SrtSetLogHandler(cb LogCallBackFunc) { + ptr := gopointer.Save(cb) + C.srt_setloghandler(ptr, (*C.SRT_LOG_HANDLER_FN)(C.srtLogCB)) + storeLogCBPtr(ptr) +} + +func SrtUnsetLogHandler() { + C.srt_setloghandler(nil, nil) + storeLogCBPtr(nil) +} + +func storeLogCBPtr(ptr unsafe.Pointer) { + logCBPtrLock.Lock() + defer logCBPtrLock.Unlock() + if logCBPtr != nil { + gopointer.Unref(logCBPtr) + } + logCBPtr = ptr +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/logging_c.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/logging_c.go new file mode 100644 index 0000000000..d804c1b83e --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/logging_c.go @@ -0,0 +1,14 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include + +extern void srtLogCBWrapper (void* opaque, int level, char* file, int line, char* area, char* message); + +void srtLogCB(void* opaque, int level, const char* file, int line, const char* area, const char* message) +{ + srtLogCBWrapper(opaque, level, (char*)file, line, (char*)area,(char*) message); +} +*/ +import "C" diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils.go new file mode 100644 index 0000000000..ef23d00e94 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils.go @@ -0,0 +1,87 @@ +package srtgo + +//#include +import "C" + +import ( + "encoding/binary" + "fmt" + "net" + "syscall" + "unsafe" +) + +func ntohs(val uint16) uint16 { + tmp := ((*[unsafe.Sizeof(val)]byte)(unsafe.Pointer(&val))) + return binary.BigEndian.Uint16((*tmp)[:]) +} + +func udpAddrFromSockaddr(addr *syscall.RawSockaddrAny) (*net.UDPAddr, error) { + var udpAddr net.UDPAddr + + switch addr.Addr.Family { + case afINET6: + ptr := (*syscall.RawSockaddrInet6)(unsafe.Pointer(addr)) + udpAddr.Port = int(ntohs(ptr.Port)) + udpAddr.IP = ptr.Addr[:] + + case afINET4: + ptr := (*syscall.RawSockaddrInet4)(unsafe.Pointer(addr)) + udpAddr.Port = int(ntohs(ptr.Port)) + udpAddr.IP = net.IPv4( + ptr.Addr[0], + ptr.Addr[1], + ptr.Addr[2], + ptr.Addr[3], + ) + default: + return nil, fmt.Errorf("unknown address family: %v", addr.Addr.Family) + } + + return &udpAddr, nil +} + +func sockAddrFromIp4(ip net.IP, port uint16) (*C.struct_sockaddr, int, error) { + var raw syscall.RawSockaddrInet4 + raw.Family = afINET4 + + p := (*[2]byte)(unsafe.Pointer(&raw.Port)) + p[0] = byte(port >> 8) + p[1] = byte(port) + + copy(raw.Addr[:], ip.To4()) + + return (*C.struct_sockaddr)(unsafe.Pointer(&raw)), int(sizeofSockAddrInet4), nil +} + +func sockAddrFromIp6(ip net.IP, port uint16) (*C.struct_sockaddr, int, error) { + var raw syscall.RawSockaddrInet6 + raw.Family = afINET6 + + p := (*[2]byte)(unsafe.Pointer(&raw.Port)) + p[0] = byte(port >> 8) + p[1] = byte(port) + + copy(raw.Addr[:], ip.To16()) + + return (*C.struct_sockaddr)(unsafe.Pointer(&raw)), int(sizeofSockAddrInet6), nil +} + +func CreateAddrInet(name string, port uint16) (*C.struct_sockaddr, int, error) { + ip := net.ParseIP(name) + if ip == nil { + ips, err := net.LookupIP(name) + if err != nil { + return nil, 0, fmt.Errorf("Error in CreateAddrInet, LookupIP") + } + ip = ips[0] + } + + if ip.To4() != nil { + return sockAddrFromIp4(ip, port) + } else if ip.To16() != nil { + return sockAddrFromIp6(ip, port) + } + + return nil, 0, fmt.Errorf("Error in CreateAddrInet, LookupIP") +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils_unix.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils_unix.go new file mode 100644 index 0000000000..4950a2c5ca --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils_unix.go @@ -0,0 +1,17 @@ +//go:build !windows + +package srtgo + +import ( + "syscall" + + "golang.org/x/sys/unix" +) + +const ( + sizeofSockAddrInet4 = syscall.SizeofSockaddrInet4 + sizeofSockAddrInet6 = syscall.SizeofSockaddrInet6 + sizeofSockaddrAny = syscall.SizeofSockaddrAny + afINET4 = unix.AF_INET + afINET6 = unix.AF_INET6 +) diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils_windows.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils_windows.go new file mode 100644 index 0000000000..c022f73054 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/netutils_windows.go @@ -0,0 +1,29 @@ +//go:build windows + +package srtgo + +import ( + "unsafe" + + "golang.org/x/sys/windows" +) + +const ( + afINET4 = windows.AF_INET + afINET6 = windows.AF_INET6 +) + +var ( + sizeofSockAddrInet4 uint64 = 0 + sizeofSockAddrInet6 uint64 = 0 + sizeofSockaddrAny uint64 = 0 +) + +func init() { + inet4 := windows.RawSockaddrInet4{} + inet6 := windows.RawSockaddrInet6{} + any := windows.RawSockaddrAny{} + sizeofSockAddrInet4 = uint64(unsafe.Sizeof(inet4)) + sizeofSockAddrInet6 = uint64(unsafe.Sizeof(inet6)) + sizeofSockaddrAny = uint64(unsafe.Sizeof(any)) +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/poll.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/poll.go new file mode 100644 index 0000000000..336f686fff --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/poll.go @@ -0,0 +1,269 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include +*/ +import "C" +import ( + "sync" + "sync/atomic" + "time" +) + +const ( + pollDefault = int32(iota) + pollReady = int32(iota) + pollWait = int32(iota) +) + +type PollMode int + +const ( + ModeRead = PollMode(iota) + ModeWrite +) + +/* + pollDesc contains the polling state for the associated SrtSocket + closing: socket is closing, reject all poll operations + pollErr: an error occured on the socket, indicates it's not useable anymore. + unblockRd: is used to unblock the poller when the socket becomes ready for io + rdState: polling state for read operations + rdDeadline: deadline in NS before poll operation times out, -1 means timedout (needs to be cleared), 0 is without timeout + rdSeq: sequence number protects against spurious signalling of timeouts when timer is reset. + rdTimer: timer used to enforce deadline. +*/ +type pollDesc struct { + lock sync.Mutex + closing bool + fd C.SRTSOCKET + pollErr bool + unblockRd chan interface{} + rdState int32 + rdLock sync.Mutex + rdDeadline int64 + rdSeq int64 + rdTimer *time.Timer + rtSeq int64 + unblockWr chan interface{} + wrState int32 + wrLock sync.Mutex + wdDeadline int64 + wdSeq int64 + wdTimer *time.Timer + wtSeq int64 + pollS *pollServer +} + +var pdPool = sync.Pool{ + New: func() interface{} { + return &pollDesc{ + unblockRd: make(chan interface{}, 1), + unblockWr: make(chan interface{}, 1), + rdTimer: time.NewTimer(0), + wdTimer: time.NewTimer(0), + } + }, +} + +func pollDescInit(s C.SRTSOCKET) *pollDesc { + pd := pdPool.Get().(*pollDesc) + pd.lock.Lock() + defer pd.lock.Unlock() + pd.fd = s + pd.rdState = pollDefault + pd.wrState = pollDefault + pd.pollS = pollServerCtx() + pd.closing = false + pd.pollErr = false + pd.rdSeq++ + pd.wdSeq++ + pd.pollS.pollOpen(pd) + return pd +} + +func (pd *pollDesc) release() { + pd.lock.Lock() + defer pd.lock.Unlock() + if !pd.closing || pd.rdState == pollWait || pd.wrState == pollWait { + panic("returning open or blocked upon pollDesc") + } + pd.fd = 0 + pdPool.Put(pd) +} + +func (pd *pollDesc) wait(mode PollMode) error { + defer pd.reset(mode) + if err := pd.checkPollErr(mode); err != nil { + return err + } + state := &pd.rdState + unblockChan := pd.unblockRd + expiryChan := pd.rdTimer.C + timerSeq := int64(0) + pd.lock.Lock() + if mode == ModeRead { + timerSeq = pd.rtSeq + pd.rdLock.Lock() + defer pd.rdLock.Unlock() + } else if mode == ModeWrite { + timerSeq = pd.wtSeq + state = &pd.wrState + unblockChan = pd.unblockWr + expiryChan = pd.wdTimer.C + pd.wrLock.Lock() + defer pd.wrLock.Unlock() + } + + for { + old := *state + if old == pollReady { + *state = pollDefault + pd.lock.Unlock() + return nil + } + if atomic.CompareAndSwapInt32(state, pollDefault, pollWait) { + break + } + } + pd.lock.Unlock() + +wait: + for { + select { + case <-unblockChan: + break wait + case <-expiryChan: + pd.lock.Lock() + if mode == ModeRead { + if timerSeq == pd.rdSeq { + pd.rdDeadline = -1 + pd.lock.Unlock() + break wait + } + timerSeq = pd.rtSeq + } + if mode == ModeWrite { + if timerSeq == pd.wdSeq { + pd.wdDeadline = -1 + pd.lock.Unlock() + break wait + } + timerSeq = pd.wtSeq + } + pd.lock.Unlock() + } + } + err := pd.checkPollErr(mode) + return err +} + +func (pd *pollDesc) close() { + pd.lock.Lock() + defer pd.lock.Unlock() + if pd.closing { + return + } + pd.closing = true + pd.pollS.pollClose(pd) +} + +func (pd *pollDesc) checkPollErr(mode PollMode) error { + pd.lock.Lock() + defer pd.lock.Unlock() + if pd.closing { + return &SrtSocketClosed{} + } + + if mode == ModeRead && pd.rdDeadline < 0 || mode == ModeWrite && pd.wdDeadline < 0 { + return &SrtEpollTimeout{} + } + + if pd.pollErr { + return &SrtSocketClosed{} + } + + return nil +} + +func (pd *pollDesc) setDeadline(t time.Time, mode PollMode) { + pd.lock.Lock() + defer pd.lock.Unlock() + var d int64 + if !t.IsZero() { + d = int64(time.Until(t)) + if d == 0 { + d = -1 + } + } + if mode == ModeRead || mode == ModeRead+ModeWrite { + pd.rdSeq++ + pd.rtSeq = pd.rdSeq + if pd.rdDeadline > 0 { + pd.rdTimer.Stop() + } + pd.rdDeadline = d + if d > 0 { + pd.rdTimer.Reset(time.Duration(d)) + } + if d < 0 { + pd.unblock(ModeRead, false, false) + } + } + if mode == ModeWrite || mode == ModeRead+ModeWrite { + pd.wdSeq++ + pd.wtSeq = pd.wdSeq + if pd.wdDeadline > 0 { + pd.wdTimer.Stop() + } + pd.wdDeadline = d + if d > 0 { + pd.wdTimer.Reset(time.Duration(d)) + } + if d < 0 { + pd.unblock(ModeWrite, false, false) + } + } +} + +func (pd *pollDesc) unblock(mode PollMode, pollerr, ioready bool) { + if pollerr { + pd.lock.Lock() + pd.pollErr = pollerr + pd.lock.Unlock() + } + state := &pd.rdState + unblockChan := pd.unblockRd + if mode == ModeWrite { + state = &pd.wrState + unblockChan = pd.unblockWr + } + pd.lock.Lock() + old := atomic.LoadInt32(state) + if ioready { + atomic.StoreInt32(state, pollReady) + } + pd.lock.Unlock() + if old == pollWait { + //make sure we never block here + select { + case unblockChan <- struct{}{}: + // + default: + // + } + } +} + +func (pd *pollDesc) reset(mode PollMode) { + if mode == ModeRead { + pd.rdLock.Lock() + pd.rdState = pollDefault + pd.rdLock.Unlock() + } else if mode == ModeWrite { + pd.wrLock.Lock() + pd.wrState = pollDefault + pd.wrLock.Unlock() + } +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/pollserver.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/pollserver.go new file mode 100644 index 0000000000..4c04da5672 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/pollserver.go @@ -0,0 +1,109 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include +*/ +import "C" + +import ( + "sync" + "unsafe" +) + +var ( + phctx *pollServer + once sync.Once +) + +func pollServerCtx() *pollServer { + once.Do(pollServerCtxInit) + return phctx +} + +func pollServerCtxInit() { + eid := C.srt_epoll_create() + C.srt_epoll_set(eid, C.SRT_EPOLL_ENABLE_EMPTY) + phctx = &pollServer{ + srtEpollDescr: eid, + pollDescs: make(map[C.SRTSOCKET]*pollDesc), + } + go phctx.run() +} + +type pollServer struct { + srtEpollDescr C.int + pollDescLock sync.Mutex + pollDescs map[C.SRTSOCKET]*pollDesc +} + +func (p *pollServer) pollOpen(pd *pollDesc) { + //use uint because otherwise with ET it would overflow :/ (srt should accept an uint instead, or fix it's SRT_EPOLL_ET definition) + events := C.uint(C.SRT_EPOLL_IN | C.SRT_EPOLL_OUT | C.SRT_EPOLL_ERR | C.SRT_EPOLL_ET) + //via unsafe.Pointer because we cannot cast *C.uint to *C.int directly + //block poller + p.pollDescLock.Lock() + ret := C.srt_epoll_add_usock(p.srtEpollDescr, pd.fd, (*C.int)(unsafe.Pointer(&events))) + if ret == -1 { + panic("ERROR ADDING FD TO EPOLL") + } + p.pollDescs[pd.fd] = pd + p.pollDescLock.Unlock() +} + +func (p *pollServer) pollClose(pd *pollDesc) { + sockstate := C.srt_getsockstate(pd.fd) + //Broken/closed sockets get removed internally by SRT lib + if sockstate == C.SRTS_BROKEN || sockstate == C.SRTS_CLOSING || sockstate == C.SRTS_CLOSED || sockstate == C.SRTS_NONEXIST { + return + } + ret := C.srt_epoll_remove_usock(p.srtEpollDescr, pd.fd) + if ret == -1 { + panic("ERROR REMOVING FD FROM EPOLL") + } + p.pollDescLock.Lock() + delete(p.pollDescs, pd.fd) + p.pollDescLock.Unlock() +} + +func init() { + +} + +func (p *pollServer) run() { + timeoutMs := C.int64_t(-1) + fds := [128]C.SRT_EPOLL_EVENT{} + fdlen := C.int(128) + for { + res := C.srt_epoll_uwait(p.srtEpollDescr, &fds[0], fdlen, timeoutMs) + if res == 0 { + continue //Shouldn't happen with -1 + } else if res == -1 { + panic("srt_epoll_error") + } else if res > 0 { + max := int(res) + if fdlen < res { + max = int(fdlen) + } + p.pollDescLock.Lock() + for i := 0; i < max; i++ { + s := fds[i].fd + events := fds[i].events + + pd := p.pollDescs[s] + if events&C.SRT_EPOLL_ERR != 0 { + pd.unblock(ModeRead, true, false) + pd.unblock(ModeWrite, true, false) + continue + } + if events&C.SRT_EPOLL_IN != 0 { + pd.unblock(ModeRead, false, true) + } + if events&C.SRT_EPOLL_OUT != 0 { + pd.unblock(ModeWrite, false, true) + } + } + p.pollDescLock.Unlock() + } + } +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/read.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/read.go new file mode 100644 index 0000000000..0378dadbf3 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/read.go @@ -0,0 +1,54 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include + +int srt_recvmsg2_wrapped(SRTSOCKET u, char* buf, int len, SRT_MSGCTRL *mctrl, int *srterror, int *syserror) +{ + int ret = srt_recvmsg2(u, buf, len, mctrl); + if (ret < 0) { + *srterror = srt_getlasterror(syserror); + } + return ret; +} + +*/ +import "C" +import ( + "errors" + "syscall" + "unsafe" +) + +func srtRecvMsg2Impl(u C.SRTSOCKET, buf []byte, msgctrl *C.SRT_MSGCTRL) (n int, err error) { + srterr := C.int(0) + syserr := C.int(0) + n = int(C.srt_recvmsg2_wrapped(u, (*C.char)(unsafe.Pointer(&buf[0])), C.int(len(buf)), msgctrl, &srterr, &syserr)) + if n < 0 { + srterror := SRTErrno(srterr) + if syserr < 0 { + srterror.wrapSysErr(syscall.Errno(syserr)) + } + err = srterror + n = 0 + } + return +} + +// Read data from the SRT socket +func (s SrtSocket) Read(b []byte) (n int, err error) { + //Fastpath + if !s.blocking { + s.pd.reset(ModeRead) + } + n, err = srtRecvMsg2Impl(s.socket, b, nil) + + for { + if !errors.Is(err, error(EAsyncRCV)) || s.blocking { + return + } + s.pd.wait(ModeRead) + n, err = srtRecvMsg2Impl(s.socket, b, nil) + } +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtgo.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtgo.go new file mode 100644 index 0000000000..d7791c80d6 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtgo.go @@ -0,0 +1,578 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include +#include +#include "callback.h" +static const SRTSOCKET get_srt_invalid_sock() { return SRT_INVALID_SOCK; }; +static const int get_srt_error() { return SRT_ERROR; }; +static const int get_srt_error_reject_predefined() { return SRT_REJC_PREDEFINED; }; +static const int get_srt_error_reject_userdefined() { return SRT_REJC_USERDEFINED; }; +*/ +import "C" + +import ( + "errors" + "fmt" + "net" + "runtime" + "strconv" + "sync" + "syscall" + "time" + "unsafe" + + gopointer "github.com/mattn/go-pointer" +) + +// SRT Socket mode +const ( + ModeFailure = iota + ModeListener + ModeCaller + ModeRendezvouz +) + +// Binding ops +const ( + bindingPre = 0 + bindingPost = 1 +) + +// SrtSocket - SRT socket +type SrtSocket struct { + socket C.int + blocking bool + pd *pollDesc + host string + port uint16 + options map[string]string + mode int + pktSize int + pollTimeout int64 +} + +var ( + callbackMutex sync.Mutex + listenCallbackMap map[C.int]unsafe.Pointer = make(map[C.int]unsafe.Pointer) + connectCallbackMap map[C.int]unsafe.Pointer = make(map[C.int]unsafe.Pointer) +) + +// Static consts from library +var ( + SRT_INVALID_SOCK = C.get_srt_invalid_sock() + SRT_ERROR = C.get_srt_error() + SRTS_CONNECTED = C.SRTS_CONNECTED +) + +const defaultPacketSize = 1456 + +// InitSRT - Initialize srt library +func InitSRT() { + C.srt_startup() +} + +// CleanupSRT - Cleanup SRT lib +func CleanupSRT() { + C.srt_cleanup() +} + +// NewSrtSocket - Create a new SRT Socket +func NewSrtSocket(host string, port uint16, options map[string]string) *SrtSocket { + s := new(SrtSocket) + + s.socket = C.srt_create_socket() + if s.socket == SRT_INVALID_SOCK { + return nil + } + + s.host = host + s.port = port + s.options = options + s.pollTimeout = -1 + + val, exists := options["pktsize"] + if exists { + pktSize, err := strconv.Atoi(val) + if err != nil { + s.pktSize = pktSize + } + } + if s.pktSize <= 0 { + s.pktSize = defaultPacketSize + } + + val, exists = options["blocking"] + if exists && val != "0" { + s.blocking = true + } + + if !s.blocking { + s.pd = pollDescInit(s.socket) + } + + finalizer := func(obj interface{}) { + sf := obj.(*SrtSocket) + sf.Close() + if sf.pd != nil { + sf.pd.release() + } + } + + //Cleanup SrtSocket if no references exist anymore + runtime.SetFinalizer(s, finalizer) + + var err error + s.mode, err = s.preconfiguration() + if err != nil { + return nil + } + + return s +} + +func newFromSocket(acceptSocket *SrtSocket, socket C.SRTSOCKET) (*SrtSocket, error) { + s := new(SrtSocket) + s.socket = socket + s.pktSize = acceptSocket.pktSize + s.blocking = acceptSocket.blocking + s.pollTimeout = acceptSocket.pollTimeout + + err := acceptSocket.postconfiguration(s) + if err != nil { + return nil, err + } + + if !s.blocking { + s.pd = pollDescInit(s.socket) + } + + finalizer := func(obj interface{}) { + sf := obj.(*SrtSocket) + sf.Close() + if sf.pd != nil { + sf.pd.release() + } + } + + //Cleanup SrtSocket if no references exist anymore + runtime.SetFinalizer(s, finalizer) + + return s, nil +} + +func (s SrtSocket) GetSocket() C.int { + return s.socket +} + +// Listen for incoming connections. The backlog setting defines how many sockets +// may be allowed to wait until they are accepted (excessive connection requests +// are rejected in advance) +func (s *SrtSocket) Listen(backlog int) error { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + nbacklog := C.int(backlog) + + sa, salen, err := CreateAddrInet(s.host, s.port) + if err != nil { + return err + } + + res := C.srt_bind(s.socket, sa, C.int(salen)) + if res == SRT_ERROR { + C.srt_close(s.socket) + return fmt.Errorf("Error in srt_bind: %w", srtGetAndClearError()) + } + + res = C.srt_listen(s.socket, nbacklog) + if res == SRT_ERROR { + C.srt_close(s.socket) + return fmt.Errorf("Error in srt_listen: %w", srtGetAndClearError()) + } + + err = s.postconfiguration(s) + if err != nil { + return fmt.Errorf("Error setting post socket options") + } + + return nil +} + +// Connect to a remote endpoint +func (s *SrtSocket) Connect() error { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + sa, salen, err := CreateAddrInet(s.host, s.port) + if err != nil { + return err + } + + res := C.srt_connect(s.socket, sa, C.int(salen)) + if res == SRT_ERROR { + C.srt_close(s.socket) + return srtGetAndClearError() + } + + if !s.blocking { + if err := s.pd.wait(ModeWrite); err != nil { + return err + } + } + + err = s.postconfiguration(s) + if err != nil { + return fmt.Errorf("Error setting post socket options in connect") + } + + return nil +} + +// Stats - Retrieve stats from the SRT socket +func (s SrtSocket) Stats() (*SrtStats, error) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + var stats C.SRT_TRACEBSTATS = C.SRT_TRACEBSTATS{} + var b C.int = 1 + if C.srt_bstats(s.socket, &stats, b) == SRT_ERROR { + return nil, fmt.Errorf("Error getting stats, %w", srtGetAndClearError()) + } + + return newSrtStats(&stats), nil +} + +// Mode - Return working mode of the SRT socket +func (s SrtSocket) Mode() int { + return s.mode +} + +// PacketSize - Return packet size of the SRT socket +func (s SrtSocket) PacketSize() int { + return s.pktSize +} + +// PollTimeout - Return polling max time, for connect/read/write operations. +// Only applied when socket is in non-blocking mode. +func (s SrtSocket) PollTimeout() time.Duration { + return time.Duration(s.pollTimeout) * time.Millisecond +} + +// SetPollTimeout - Sets polling max time, for connect/read/write operations. +// Only applied when socket is in non-blocking mode. +func (s *SrtSocket) SetPollTimeout(pollTimeout time.Duration) { + s.pollTimeout = pollTimeout.Milliseconds() +} + +func (s *SrtSocket) SetDeadline(deadline time.Time) { + s.pd.setDeadline(deadline, ModeRead+ModeWrite) +} + +func (s *SrtSocket) SetReadDeadline(deadline time.Time) { + s.pd.setDeadline(deadline, ModeRead) +} + +func (s *SrtSocket) SetWriteDeadline(deadline time.Time) { + s.pd.setDeadline(deadline, ModeWrite) +} + +// Close the SRT socket +func (s *SrtSocket) Close() { + + C.srt_close(s.socket) + s.socket = SRT_INVALID_SOCK + if !s.blocking { + s.pd.close() + } + callbackMutex.Lock() + if ptr, exists := listenCallbackMap[s.socket]; exists { + gopointer.Unref(ptr) + } + if ptr, exists := connectCallbackMap[s.socket]; exists { + gopointer.Unref(ptr) + } + callbackMutex.Unlock() +} + +// ListenCallbackFunc specifies a function to be called before a connecting socket is passed to accept +type ListenCallbackFunc func(socket *SrtSocket, version int, addr *net.UDPAddr, streamid string) bool + +//export srtListenCBWrapper +func srtListenCBWrapper(arg unsafe.Pointer, socket C.SRTSOCKET, hsVersion C.int, peeraddr *C.struct_sockaddr, streamid *C.char) C.int { + userCB := gopointer.Restore(arg).(ListenCallbackFunc) + + s := new(SrtSocket) + s.socket = socket + udpAddr, _ := udpAddrFromSockaddr((*syscall.RawSockaddrAny)(unsafe.Pointer(peeraddr))) + + if userCB(s, int(hsVersion), udpAddr, C.GoString(streamid)) { + return 0 + } + return SRT_ERROR +} + +// SetListenCallback - set a function to be called early in the handshake before a client +// is handed to accept on a listening socket. +// The connection can be rejected by returning false from the callback. +// See examples/echo-receiver for more details. +func (s SrtSocket) SetListenCallback(cb ListenCallbackFunc) { + ptr := gopointer.Save(cb) + C.srt_listen_callback(s.socket, (*C.srt_listen_callback_fn)(C.srtListenCB), ptr) + + callbackMutex.Lock() + defer callbackMutex.Unlock() + if listenCallbackMap[s.socket] != nil { + gopointer.Unref(listenCallbackMap[s.socket]) + } + listenCallbackMap[s.socket] = ptr +} + +// ConnectCallbackFunc specifies a function to be called after a socket or connection in a group has failed. +type ConnectCallbackFunc func(socket *SrtSocket, err error, addr *net.UDPAddr, token int) + +//export srtConnectCBWrapper +func srtConnectCBWrapper(arg unsafe.Pointer, socket C.SRTSOCKET, errcode C.int, peeraddr *C.struct_sockaddr, token C.int) { + userCB := gopointer.Restore(arg).(ConnectCallbackFunc) + + s := new(SrtSocket) + s.socket = socket + udpAddr, _ := udpAddrFromSockaddr((*syscall.RawSockaddrAny)(unsafe.Pointer(peeraddr))) + + userCB(s, SRTErrno(errcode), udpAddr, int(token)) +} + +// SetConnectCallback - set a function to be called after a socket or connection in a group has failed +// Note that the function is not guaranteed to be called if the socket is set to blocking mode. +func (s SrtSocket) SetConnectCallback(cb ConnectCallbackFunc) { + ptr := gopointer.Save(cb) + C.srt_connect_callback(s.socket, (*C.srt_connect_callback_fn)(C.srtConnectCB), ptr) + + callbackMutex.Lock() + defer callbackMutex.Unlock() + if connectCallbackMap[s.socket] != nil { + gopointer.Unref(connectCallbackMap[s.socket]) + } + connectCallbackMap[s.socket] = ptr +} + +// Rejection reasons +var ( + // Start of range for predefined rejection reasons + RejectionReasonPredefined = int(C.get_srt_error_reject_predefined()) + + // General syntax error in the SocketID specification (also a fallback code for undefined cases) + RejectionReasonBadRequest = RejectionReasonPredefined + 400 + + // Authentication failed, provided that the user was correctly identified and access to the required resource would be granted + RejectionReasonUnauthorized = RejectionReasonPredefined + 401 + + // The server is too heavily loaded, or you have exceeded credits for accessing the service and the resource. + RejectionReasonOverload = RejectionReasonPredefined + 402 + + // Access denied to the resource by any kind of reason + RejectionReasonForbidden = RejectionReasonPredefined + 403 + + // Resource not found at this time. + RejectionReasonNotFound = RejectionReasonPredefined + 404 + + // The mode specified in `m` key in StreamID is not supported for this request. + RejectionReasonBadMode = RejectionReasonPredefined + 405 + + // The requested parameters specified in SocketID cannot be satisfied for the requested resource. Also when m=publish and the data format is not acceptable. + RejectionReasonUnacceptable = RejectionReasonPredefined + 406 + + // Start of range for application defined rejection reasons + RejectionReasonUserDefined = int(C.get_srt_error_reject_predefined()) +) + +// SetRejectReason - set custom reason for connection reject +func (s SrtSocket) SetRejectReason(value int) error { + res := C.srt_setrejectreason(s.socket, C.int(value)) + if res == SRT_ERROR { + return errors.New(C.GoString(C.srt_getlasterror_str())) + } + return nil +} + +// GetSockOptByte - return byte value obtained with srt_getsockopt +func (s SrtSocket) GetSockOptByte(opt int) (byte, error) { + var v byte + l := 1 + + err := s.getSockOpt(opt, unsafe.Pointer(&v), &l) + return v, err +} + +// GetSockOptBool - return bool value obtained with srt_getsockopt +func (s SrtSocket) GetSockOptBool(opt int) (bool, error) { + var v int32 + l := 4 + + err := s.getSockOpt(opt, unsafe.Pointer(&v), &l) + if v == 1 { + return true, err + } + + return false, err +} + +// GetSockOptInt - return int value obtained with srt_getsockopt +func (s SrtSocket) GetSockOptInt(opt int) (int, error) { + var v int32 + l := 4 + + err := s.getSockOpt(opt, unsafe.Pointer(&v), &l) + return int(v), err +} + +// GetSockOptInt64 - return int64 value obtained with srt_getsockopt +func (s SrtSocket) GetSockOptInt64(opt int) (int64, error) { + var v int64 + l := 8 + + err := s.getSockOpt(opt, unsafe.Pointer(&v), &l) + return v, err +} + +// GetSockOptString - return string value obtained with srt_getsockopt +func (s SrtSocket) GetSockOptString(opt int) (string, error) { + buf := make([]byte, 256) + l := len(buf) + + err := s.getSockOpt(opt, unsafe.Pointer(&buf[0]), &l) + if err != nil { + return "", err + } + return string(buf[:l]), nil +} + +// SetSockOptByte - set byte value using srt_setsockopt +func (s SrtSocket) SetSockOptByte(opt int, value byte) error { + return s.setSockOpt(opt, unsafe.Pointer(&value), 1) +} + +// SetSockOptBool - set bool value using srt_setsockopt +func (s SrtSocket) SetSockOptBool(opt int, value bool) error { + val := int(0) + if value { + val = 1 + } + return s.setSockOpt(opt, unsafe.Pointer(&val), 4) +} + +// SetSockOptInt - set int value using srt_setsockopt +func (s SrtSocket) SetSockOptInt(opt int, value int) error { + return s.setSockOpt(opt, unsafe.Pointer(&value), 4) +} + +// SetSockOptInt64 - set int64 value using srt_setsockopt +func (s SrtSocket) SetSockOptInt64(opt int, value int64) error { + return s.setSockOpt(opt, unsafe.Pointer(&value), 8) +} + +// SetSockOptString - set string value using srt_setsockopt +func (s SrtSocket) SetSockOptString(opt int, value string) error { + return s.setSockOpt(opt, unsafe.Pointer(&[]byte(value)[0]), len(value)) +} + +func (s SrtSocket) setSockOpt(opt int, data unsafe.Pointer, size int) error { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + res := C.srt_setsockopt(s.socket, 0, C.SRT_SOCKOPT(opt), data, C.int(size)) + if res == -1 { + return fmt.Errorf("Error calling srt_setsockopt %w", srtGetAndClearError()) + } + return nil +} + +func (s SrtSocket) getSockOpt(opt int, data unsafe.Pointer, size *int) error { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + res := C.srt_getsockopt(s.socket, 0, C.SRT_SOCKOPT(opt), data, (*C.int)(unsafe.Pointer(size))) + if res == -1 { + return fmt.Errorf("Error calling srt_getsockopt %w", srtGetAndClearError()) + } + + return nil +} + +func (s SrtSocket) preconfiguration() (int, error) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + var blocking C.int + if s.blocking { + blocking = C.int(1) + } else { + blocking = C.int(0) + } + result := C.srt_setsockopt(s.socket, 0, C.SRTO_RCVSYN, unsafe.Pointer(&blocking), C.int(unsafe.Sizeof(blocking))) + if result == -1 { + return ModeFailure, fmt.Errorf("could not set SRTO_RCVSYN flag: %w", srtGetAndClearError()) + } + + var mode int + modeVal, ok := s.options["mode"] + if !ok { + modeVal = "default" + } + + if modeVal == "client" || modeVal == "caller" { + mode = ModeCaller + } else if modeVal == "server" || modeVal == "listener" { + mode = ModeListener + } else if modeVal == "default" { + if s.host == "" { + mode = ModeListener + } else { + // Host is given, so check also "adapter" + if _, ok := s.options["adapter"]; ok { + mode = ModeRendezvouz + } else { + mode = ModeCaller + } + } + } else { + mode = ModeFailure + } + + if linger, ok := s.options["linger"]; ok { + li, err := strconv.Atoi(linger) + if err == nil { + if err := setSocketLingerOption(s.socket, int32(li)); err != nil { + return ModeFailure, fmt.Errorf("could not set LINGER option %w", err) + } + } else { + return ModeFailure, fmt.Errorf("could not set LINGER option %w", err) + } + } + + err := setSocketOptions(s.socket, bindingPre, s.options) + if err != nil { + return ModeFailure, fmt.Errorf("Error setting socket options: %w", err) + } + + return mode, nil +} + +func (s SrtSocket) postconfiguration(sck *SrtSocket) error { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + var blocking C.int + if s.blocking { + blocking = 1 + } else { + blocking = 0 + } + + res := C.srt_setsockopt(sck.socket, 0, C.SRTO_SNDSYN, unsafe.Pointer(&blocking), C.int(unsafe.Sizeof(blocking))) + if res == -1 { + return fmt.Errorf("Error in postconfiguration setting SRTO_SNDSYN: %w", srtGetAndClearError()) + } + + res = C.srt_setsockopt(sck.socket, 0, C.SRTO_RCVSYN, unsafe.Pointer(&blocking), C.int(unsafe.Sizeof(blocking))) + if res == -1 { + return fmt.Errorf("Error in postconfiguration setting SRTO_RCVSYN: %w", srtGetAndClearError()) + } + + err := setSocketOptions(sck.socket, bindingPost, s.options) + return err +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtsocketoptions.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtsocketoptions.go new file mode 100644 index 0000000000..461f791e31 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtsocketoptions.go @@ -0,0 +1,191 @@ +package srtgo + +// #cgo LDFLAGS: -lsrt +// #include +import "C" + +import ( + "errors" + "fmt" + "strconv" + "syscall" + "unsafe" +) + +const ( + transTypeLive = 0 + transTypeFile = 1 +) + +const ( + tInteger32 = 0 + tInteger64 = 1 + tString = 2 + tBoolean = 3 + tTransType = 4 + + SRTO_TRANSTYPE = C.SRTO_TRANSTYPE + SRTO_MAXBW = C.SRTO_MAXBW + SRTO_PBKEYLEN = C.SRTO_PBKEYLEN + SRTO_PASSPHRASE = C.SRTO_PASSPHRASE + SRTO_MSS = C.SRTO_MSS + SRTO_FC = C.SRTO_FC + SRTO_SNDBUF = C.SRTO_SNDBUF + SRTO_RCVBUF = C.SRTO_RCVBUF + SRTO_IPTTL = C.SRTO_IPTTL + SRTO_IPTOS = C.SRTO_IPTOS + SRTO_INPUTBW = C.SRTO_INPUTBW + SRTO_OHEADBW = C.SRTO_OHEADBW + SRTO_LATENCY = C.SRTO_LATENCY + SRTO_TSBPDMODE = C.SRTO_TSBPDMODE + SRTO_TLPKTDROP = C.SRTO_TLPKTDROP + SRTO_SNDDROPDELAY = C.SRTO_SNDDROPDELAY + SRTO_NAKREPORT = C.SRTO_NAKREPORT + SRTO_CONNTIMEO = C.SRTO_CONNTIMEO + SRTO_LOSSMAXTTL = C.SRTO_LOSSMAXTTL + SRTO_RCVLATENCY = C.SRTO_RCVLATENCY + SRTO_PEERLATENCY = C.SRTO_PEERLATENCY + SRTO_MINVERSION = C.SRTO_MINVERSION + SRTO_STREAMID = C.SRTO_STREAMID + SRTO_CONGESTION = C.SRTO_CONGESTION + SRTO_MESSAGEAPI = C.SRTO_MESSAGEAPI + SRTO_PAYLOADSIZE = C.SRTO_PAYLOADSIZE + SRTO_KMREFRESHRATE = C.SRTO_KMREFRESHRATE + SRTO_KMPREANNOUNCE = C.SRTO_KMPREANNOUNCE + SRTO_ENFORCEDENCRYPTION = C.SRTO_ENFORCEDENCRYPTION + SRTO_PEERIDLETIMEO = C.SRTO_PEERIDLETIMEO + SRTO_PACKETFILTER = C.SRTO_PACKETFILTER + SRTO_STATE = C.SRTO_STATE +) + +type socketOption struct { + name string + level int + option int + binding int + dataType int +} + +// List of possible srt socket options +var SocketOptions = []socketOption{ + {"transtype", 0, SRTO_TRANSTYPE, bindingPre, tTransType}, + {"maxbw", 0, SRTO_MAXBW, bindingPre, tInteger64}, + {"pbkeylen", 0, SRTO_PBKEYLEN, bindingPre, tInteger32}, + {"passphrase", 0, SRTO_PASSPHRASE, bindingPre, tString}, + {"mss", 0, SRTO_MSS, bindingPre, tInteger32}, + {"fc", 0, SRTO_FC, bindingPre, tInteger32}, + {"sndbuf", 0, SRTO_SNDBUF, bindingPre, tInteger32}, + {"rcvbuf", 0, SRTO_RCVBUF, bindingPre, tInteger32}, + {"ipttl", 0, SRTO_IPTTL, bindingPre, tInteger32}, + {"iptos", 0, SRTO_IPTOS, bindingPre, tInteger32}, + {"inputbw", 0, SRTO_INPUTBW, bindingPost, tInteger64}, + {"oheadbw", 0, SRTO_OHEADBW, bindingPost, tInteger32}, + {"latency", 0, SRTO_LATENCY, bindingPre, tInteger32}, + {"tsbpdmode", 0, SRTO_TSBPDMODE, bindingPre, tBoolean}, + {"tlpktdrop", 0, SRTO_TLPKTDROP, bindingPre, tBoolean}, + {"snddropdelay", 0, SRTO_SNDDROPDELAY, bindingPost, tInteger32}, + {"nakreport", 0, SRTO_NAKREPORT, bindingPre, tBoolean}, + {"conntimeo", 0, SRTO_CONNTIMEO, bindingPre, tInteger32}, + {"lossmaxttl", 0, SRTO_LOSSMAXTTL, bindingPre, tInteger32}, + {"rcvlatency", 0, SRTO_RCVLATENCY, bindingPre, tInteger32}, + {"peerlatency", 0, SRTO_PEERLATENCY, bindingPre, tInteger32}, + {"minversion", 0, SRTO_MINVERSION, bindingPre, tInteger32}, + {"streamid", 0, SRTO_STREAMID, bindingPre, tString}, + {"congestion", 0, SRTO_CONGESTION, bindingPre, tString}, + {"messageapi", 0, SRTO_MESSAGEAPI, bindingPre, tBoolean}, + {"payloadsize", 0, SRTO_PAYLOADSIZE, bindingPre, tInteger32}, + {"kmrefreshrate", 0, SRTO_KMREFRESHRATE, bindingPre, tInteger32}, + {"kmpreannounce", 0, SRTO_KMPREANNOUNCE, bindingPre, tInteger32}, + {"enforcedencryption", 0, SRTO_ENFORCEDENCRYPTION, bindingPre, tBoolean}, + {"peeridletimeo", 0, SRTO_PEERIDLETIMEO, bindingPre, tInteger32}, + {"packetfilter", 0, SRTO_PACKETFILTER, bindingPre, tString}, +} + +func setSocketLingerOption(s C.int, li int32) error { + var lin syscall.Linger + lin.Linger = li + if lin.Linger > 0 { + lin.Onoff = 1 + } else { + lin.Onoff = 0 + } + res := C.srt_setsockopt(s, bindingPre, C.SRTO_LINGER, unsafe.Pointer(&lin), C.int(unsafe.Sizeof(lin))) + if res == SRT_ERROR { + return errors.New("failed to set linger") + } + return nil +} + +func getSocketLingerOption(s *SrtSocket) (int32, error) { + var lin syscall.Linger + size := int(unsafe.Sizeof(lin)) + err := s.getSockOpt(C.SRTO_LINGER, unsafe.Pointer(&lin), &size) + if err != nil { + return 0, err + } + if lin.Onoff == 0 { + return 0, nil + } + return lin.Linger, nil +} + +// Set socket options for SRT +func setSocketOptions(s C.int, binding int, options map[string]string) error { + for _, so := range SocketOptions { + if val, ok := options[so.name]; ok { + if so.binding == binding { + if so.dataType == tInteger32 { + v, err := strconv.Atoi(val) + v32 := int32(v) + if err == nil { + result := C.srt_setsockflag(s, C.SRT_SOCKOPT(so.option), unsafe.Pointer(&v32), C.int32_t(unsafe.Sizeof(v32))) + if result == -1 { + return fmt.Errorf("warning - error setting option %s to %s, %w", so.name, val, srtGetAndClearError()) + } + } + } else if so.dataType == tInteger64 { + v, err := strconv.ParseInt(val, 10, 64) + if err == nil { + result := C.srt_setsockflag(s, C.SRT_SOCKOPT(so.option), unsafe.Pointer(&v), C.int32_t(unsafe.Sizeof(v))) + if result == -1 { + return fmt.Errorf("warning - error setting option %s to %s, %w", so.name, val, srtGetAndClearError()) + } + } + } else if so.dataType == tString { + sval := C.CString(val) + defer C.free(unsafe.Pointer(sval)) + result := C.srt_setsockflag(s, C.SRT_SOCKOPT(so.option), unsafe.Pointer(sval), C.int32_t(len(val))) + if result == -1 { + return fmt.Errorf("warning - error setting option %s to %s, %w", so.name, val, srtGetAndClearError()) + } + + } else if so.dataType == tBoolean { + var result C.int + if val == "1" { + v := C.char(1) + result = C.srt_setsockflag(s, C.SRT_SOCKOPT(so.option), unsafe.Pointer(&v), C.int32_t(unsafe.Sizeof(v))) + } else if val == "0" { + v := C.char(0) + result = C.srt_setsockflag(s, C.SRT_SOCKOPT(so.option), unsafe.Pointer(&v), C.int32_t(unsafe.Sizeof(v))) + } + if result == -1 { + return fmt.Errorf("warning - error setting option %s to %s, %w", so.name, val, srtGetAndClearError()) + } + } else if so.dataType == tTransType { + var result C.int + if val == "live" { + var v int32 = C.SRTT_LIVE + result = C.srt_setsockflag(s, C.SRT_SOCKOPT(so.option), unsafe.Pointer(&v), C.int32_t(unsafe.Sizeof(v))) + } else if val == "file" { + var v int32 = C.SRTT_FILE + result = C.srt_setsockflag(s, C.SRT_SOCKOPT(so.option), unsafe.Pointer(&v), C.int32_t(unsafe.Sizeof(v))) + } + if result == -1 { + return fmt.Errorf("warning - error setting option %s to %s: %w", so.name, val, srtGetAndClearError()) + } + } + } + } + } + return nil +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtstats.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtstats.go new file mode 100644 index 0000000000..b300c6b9e2 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/srtstats.go @@ -0,0 +1,188 @@ +package srtgo + +// #cgo LDFLAGS: -lsrt +// #include +import "C" + +type SrtStats struct { + // Global measurements + MsTimeStamp int64 // time since the UDT entity is started, in milliseconds + PktSentTotal int64 // total number of sent data packets, including retransmissions + PktRecvTotal int64 // total number of received packets + PktSndLossTotal int // total number of lost packets (sender side) + PktRcvLossTotal int // total number of lost packets (receiver side) + PktRetransTotal int // total number of retransmitted packets + PktSentACKTotal int // total number of sent ACK packets + PktRecvACKTotal int // total number of received ACK packets + PktSentNAKTotal int // total number of sent NAK packets + PktRecvNAKTotal int // total number of received NAK packets + UsSndDurationTotal int64 // total time duration when UDT is sending data (idle time exclusive) + + PktSndDropTotal int // number of too-late-to-send dropped packets + PktRcvDropTotal int // number of too-late-to play missing packets + PktRcvUndecryptTotal int // number of undecrypted packets + ByteSentTotal int64 // total number of sent data bytes, including retransmissions + ByteRecvTotal int64 // total number of received bytes + ByteRcvLossTotal int64 // total number of lost bytes + + ByteRetransTotal int64 // total number of retransmitted bytes + ByteSndDropTotal int64 // number of too-late-to-send dropped bytes + ByteRcvDropTotal int64 // number of too-late-to play missing bytes (estimate based on average packet size) + ByteRcvUndecryptTotal int64 // number of undecrypted bytes + + // Local measurements + PktSent int64 // number of sent data packets, including retransmissions + PktRecv int64 // number of received packets + PktSndLoss int // number of lost packets (sender side) + PktRcvLoss int // number of lost packets (receiver side) + PktRetrans int // number of retransmitted packets + PktRcvRetrans int // number of retransmitted packets received + PktSentACK int // number of sent ACK packets + PktRecvACK int // number of received ACK packets + PktSentNAK int // number of sent NAK packets + PktRecvNAK int // number of received NAK packets + MbpsSendRate float64 // sending rate in Mb/s + MbpsRecvRate float64 // receiving rate in Mb/s + UsSndDuration int64 // busy sending time (i.e., idle time exclusive) + PktReorderDistance int // size of order discrepancy in received sequences + PktRcvAvgBelatedTime float64 // average time of packet delay for belated packets (packets with sequence past the ACK) + PktRcvBelated int64 // number of received AND IGNORED packets due to having come too late + + PktSndDrop int // number of too-late-to-send dropped packets + PktRcvDrop int // number of too-late-to play missing packets + PktRcvUndecrypt int // number of undecrypted packets + ByteSent int64 // number of sent data bytes, including retransmissions + ByteRecv int64 // number of received bytes + + ByteRcvLoss int64 // number of retransmitted Bytes + ByteRetrans int64 // number of retransmitted Bytes + ByteSndDrop int64 // number of too-late-to-send dropped Bytes + ByteRcvDrop int64 // number of too-late-to play missing Bytes (estimate based on average packet size) + ByteRcvUndecrypt int64 // number of undecrypted bytes + + // Instant measurements + UsPktSndPeriod float64 // packet sending period, in microseconds + PktFlowWindow int // flow window size, in number of packets + PktCongestionWindow int // congestion window size, in number of packets + PktFlightSize int // number of packets on flight + MsRTT float64 // RTT, in milliseconds + MbpsBandwidth float64 // estimated bandwidth, in Mb/s + ByteAvailSndBuf int // available UDT sender buffer size + ByteAvailRcvBuf int // available UDT receiver buffer size + + MbpsMaxBW float64 // Transmit Bandwidth ceiling (Mbps) + ByteMSS int // MTU + + PktSndBuf int // UnACKed packets in UDT sender + ByteSndBuf int // UnACKed bytes in UDT sender + MsSndBuf int // UnACKed timespan (msec) of UDT sender + MsSndTsbPdDelay int // Timestamp-based Packet Delivery Delay + + PktRcvBuf int // Undelivered packets in UDT receiver + ByteRcvBuf int // Undelivered bytes of UDT receiver + MsRcvBuf int // Undelivered timespan (msec) of UDT receiver + MsRcvTsbPdDelay int // Timestamp-based Packet Delivery Delay + + PktSndFilterExtraTotal int // number of control packets supplied by packet filter + PktRcvFilterExtraTotal int // number of control packets received and not supplied back + PktRcvFilterSupplyTotal int // number of packets that the filter supplied extra (e.g. FEC rebuilt) + PktRcvFilterLossTotal int // number of packet loss not coverable by filter + + PktSndFilterExtra int // number of control packets supplied by packet filter + PktRcvFilterExtra int // number of control packets received and not supplied back + PktRcvFilterSupply int // number of packets that the filter supplied extra (e.g. FEC rebuilt) + PktRcvFilterLoss int // number of packet loss not coverable by filter + PktReorderTolerance int // packet reorder tolerance value +} + +func newSrtStats(stats *C.SRT_TRACEBSTATS) *SrtStats { + s := new(SrtStats) + + s.MsTimeStamp = int64(stats.msTimeStamp) + s.PktSentTotal = int64(stats.pktSentTotal) + s.PktRecvTotal = int64(stats.pktRecvTotal) + s.PktSndLossTotal = int(stats.pktSndLossTotal) + s.PktRcvLossTotal = int(stats.pktRcvLossTotal) + s.PktRetransTotal = int(stats.pktRetransTotal) + s.PktSentACKTotal = int(stats.pktSentACKTotal) + s.PktRecvACKTotal = int(stats.pktRecvACKTotal) + s.PktSentNAKTotal = int(stats.pktSentNAKTotal) + s.PktRecvNAKTotal = int(stats.pktRecvNAKTotal) + s.UsSndDurationTotal = int64(stats.usSndDurationTotal) + + s.PktSndDropTotal = int(stats.pktSndDropTotal) + s.PktRcvDropTotal = int(stats.pktRcvDropTotal) + s.PktRcvUndecryptTotal = int(stats.pktRcvUndecryptTotal) + s.ByteSentTotal = int64(stats.byteSentTotal) + s.ByteRecvTotal = int64(stats.byteRecvTotal) + s.ByteRcvLossTotal = int64(stats.byteRcvLossTotal) + + s.ByteRetransTotal = int64(stats.byteRetransTotal) + s.ByteSndDropTotal = int64(stats.byteSndDropTotal) + s.ByteRcvDropTotal = int64(stats.byteRcvDropTotal) + s.ByteRcvUndecryptTotal = int64(stats.byteRcvUndecryptTotal) + + s.PktSent = int64(stats.pktSent) + s.PktRecv = int64(stats.pktRecv) + s.PktSndLoss = int(stats.pktSndLoss) + s.PktRcvLoss = int(stats.pktRcvLoss) + s.PktRetrans = int(stats.pktRetrans) + s.PktRcvRetrans = int(stats.pktRcvRetrans) + s.PktSentACK = int(stats.pktSentACK) + s.PktRecvACK = int(stats.pktRecvACK) + s.PktSentNAK = int(stats.pktSentNAK) + s.PktRecvNAK = int(stats.pktRecvNAK) + s.MbpsSendRate = float64(stats.mbpsSendRate) + s.MbpsRecvRate = float64(stats.mbpsRecvRate) + s.UsSndDuration = int64(stats.usSndDuration) + s.PktReorderDistance = int(stats.pktReorderDistance) + s.PktRcvAvgBelatedTime = float64(stats.pktRcvAvgBelatedTime) + s.PktRcvBelated = int64(stats.pktRcvBelated) + + s.PktSndDrop = int(stats.pktSndDrop) + s.PktRcvDrop = int(stats.pktRcvDrop) + s.PktRcvUndecrypt = int(stats.pktRcvUndecrypt) + s.ByteSent = int64(stats.byteSent) + s.ByteRecv = int64(stats.byteRecv) + + s.ByteRcvLoss = int64(stats.byteRcvLoss) + s.ByteRetrans = int64(stats.byteRetrans) + s.ByteSndDrop = int64(stats.byteSndDrop) + s.ByteRcvDrop = int64(stats.byteRcvDrop) + s.ByteRcvUndecrypt = int64(stats.byteRcvUndecrypt) + + s.UsPktSndPeriod = float64(stats.usPktSndPeriod) + s.PktFlowWindow = int(stats.pktFlowWindow) + s.PktCongestionWindow = int(stats.pktCongestionWindow) + s.PktFlightSize = int(stats.pktFlightSize) + s.MsRTT = float64(stats.msRTT) + s.MbpsBandwidth = float64(stats.mbpsBandwidth) + s.ByteAvailSndBuf = int(stats.byteAvailSndBuf) + s.ByteAvailRcvBuf = int(stats.byteAvailRcvBuf) + + s.MbpsMaxBW = float64(stats.mbpsMaxBW) + s.ByteMSS = int(stats.byteMSS) + + s.PktSndBuf = int(stats.pktSndBuf) + s.ByteSndBuf = int(stats.byteSndBuf) + s.MsSndBuf = int(stats.msSndBuf) + s.MsSndTsbPdDelay = int(stats.msSndTsbPdDelay) + + s.PktRcvBuf = int(stats.pktRcvBuf) + s.ByteRcvBuf = int(stats.byteRcvBuf) + s.MsRcvBuf = int(stats.msRcvBuf) + s.MsRcvTsbPdDelay = int(stats.msRcvTsbPdDelay) + + s.PktSndFilterExtraTotal = int(stats.pktSndFilterExtraTotal) + s.PktRcvFilterExtraTotal = int(stats.pktRcvFilterExtraTotal) + s.PktRcvFilterSupplyTotal = int(stats.pktRcvFilterSupplyTotal) + s.PktRcvFilterLossTotal = int(stats.pktRcvFilterLossTotal) + + s.PktSndFilterExtra = int(stats.pktSndFilterExtra) + s.PktRcvFilterExtra = int(stats.pktRcvFilterExtra) + s.PktRcvFilterSupply = int(stats.pktRcvFilterSupply) + s.PktRcvFilterLoss = int(stats.pktRcvFilterLoss) + s.PktReorderTolerance = int(stats.pktReorderTolerance) + + return s +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/write.go b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/write.go new file mode 100644 index 0000000000..01cb8a7211 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/haivision/srtgo/write.go @@ -0,0 +1,55 @@ +package srtgo + +/* +#cgo LDFLAGS: -lsrt +#include + +int srt_sendmsg2_wrapped(SRTSOCKET u, const char* buf, int len, SRT_MSGCTRL *mctrl, int *srterror, int *syserror) +{ + int ret = srt_sendmsg2(u, buf, len, mctrl); + if (ret < 0) { + *srterror = srt_getlasterror(syserror); + } + return ret; +} + +*/ +import "C" +import ( + "errors" + "syscall" + "unsafe" +) + +func srtSendMsg2Impl(u C.SRTSOCKET, buf []byte, msgctrl *C.SRT_MSGCTRL) (n int, err error) { + srterr := C.int(0) + syserr := C.int(0) + n = int(C.srt_sendmsg2_wrapped(u, (*C.char)(unsafe.Pointer(&buf[0])), C.int(len(buf)), msgctrl, &srterr, &syserr)) + if n < 0 { + srterror := SRTErrno(srterr) + if syserr < 0 { + srterror.wrapSysErr(syscall.Errno(syserr)) + } + err = srterror + n = 0 + } + return +} + +// Write data to the SRT socket +func (s SrtSocket) Write(b []byte) (n int, err error) { + + //Fastpath: + if !s.blocking { + s.pd.reset(ModeWrite) + } + n, err = srtSendMsg2Impl(s.socket, b, nil) + + for { + if !errors.Is(err, error(EAsyncSND)) || s.blocking { + return + } + s.pd.wait(ModeWrite) + n, err = srtSendMsg2Impl(s.socket, b, nil) + } +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/LICENSE b/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/LICENSE new file mode 100644 index 0000000000..5794eddcd2 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Yasuhiro Matsumoto + +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. diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/README.md b/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/README.md new file mode 100644 index 0000000000..c74eee22ad --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/README.md @@ -0,0 +1,29 @@ +# go-pointer + +Utility for cgo + +## Usage + +https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md + +In go 1.6, cgo argument can't be passed Go pointer. + +``` +var s string +C.pass_pointer(pointer.Save(&s)) +v := *(pointer.Restore(C.get_from_pointer()).(*string)) +``` + +## Installation + +``` +go get github.com/mattn/go-pointer +``` + +## License + +MIT + +## Author + +Yasuhiro Matsumoto (a.k.a mattn) diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/doc.go b/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/doc.go new file mode 100644 index 0000000000..c27bd8c059 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/doc.go @@ -0,0 +1 @@ +package pointer diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/pointer.go b/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/pointer.go new file mode 100644 index 0000000000..08a985339f --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/github.com/mattn/go-pointer/pointer.go @@ -0,0 +1,57 @@ +package pointer + +// #include +import "C" +import ( + "sync" + "unsafe" +) + +var ( + mutex sync.RWMutex + store = map[unsafe.Pointer]interface{}{} +) + +func Save(v interface{}) unsafe.Pointer { + if v == nil { + return nil + } + + // Generate real fake C pointer. + // This pointer will not store any data, but will bi used for indexing purposes. + // Since Go doest allow to cast dangling pointer to unsafe.Pointer, we do rally allocate one byte. + // Why we need indexing, because Go doest allow C code to store pointers to Go data. + var ptr unsafe.Pointer = C.malloc(C.size_t(1)) + if ptr == nil { + panic("can't allocate 'cgo-pointer hack index pointer': ptr == nil") + } + + mutex.Lock() + store[ptr] = v + mutex.Unlock() + + return ptr +} + +func Restore(ptr unsafe.Pointer) (v interface{}) { + if ptr == nil { + return nil + } + + mutex.RLock() + v = store[ptr] + mutex.RUnlock() + return +} + +func Unref(ptr unsafe.Pointer) { + if ptr == nil { + return + } + + mutex.Lock() + delete(store, ptr) + mutex.Unlock() + + C.free(ptr) +} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare.go index b774da88d8..4d4b4aad6f 100644 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare.go +++ b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare.go @@ -28,6 +28,8 @@ var ( uint32Type = reflect.TypeOf(uint32(1)) uint64Type = reflect.TypeOf(uint64(1)) + uintptrType = reflect.TypeOf(uintptr(1)) + float32Type = reflect.TypeOf(float32(1)) float64Type = reflect.TypeOf(float64(1)) @@ -308,11 +310,11 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { case reflect.Struct: { // All structs enter here. We're not interested in most types. - if !canConvert(obj1Value, timeType) { + if !obj1Value.CanConvert(timeType) { break } - // time.Time can compared! + // time.Time can be compared! timeObj1, ok := obj1.(time.Time) if !ok { timeObj1 = obj1Value.Convert(timeType).Interface().(time.Time) @@ -328,7 +330,7 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { case reflect.Slice: { // We only care about the []byte type. - if !canConvert(obj1Value, bytesType) { + if !obj1Value.CanConvert(bytesType) { break } @@ -345,6 +347,26 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { return CompareType(bytes.Compare(bytesObj1, bytesObj2)), true } + case reflect.Uintptr: + { + uintptrObj1, ok := obj1.(uintptr) + if !ok { + uintptrObj1 = obj1Value.Convert(uintptrType).Interface().(uintptr) + } + uintptrObj2, ok := obj2.(uintptr) + if !ok { + uintptrObj2 = obj2Value.Convert(uintptrType).Interface().(uintptr) + } + if uintptrObj1 > uintptrObj2 { + return compareGreater, true + } + if uintptrObj1 == uintptrObj2 { + return compareEqual, true + } + if uintptrObj1 < uintptrObj2 { + return compareLess, true + } + } } return compareEqual, false diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go deleted file mode 100644 index da867903e2..0000000000 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build go1.17 -// +build go1.17 - -// TODO: once support for Go 1.16 is dropped, this file can be -// merged/removed with assertion_compare_go1.17_test.go and -// assertion_compare_legacy.go - -package assert - -import "reflect" - -// Wrapper around reflect.Value.CanConvert, for compatibility -// reasons. -func canConvert(value reflect.Value, to reflect.Type) bool { - return value.CanConvert(to) -} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go deleted file mode 100644 index 1701af2a3c..0000000000 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build !go1.17 -// +build !go1.17 - -// TODO: once support for Go 1.16 is dropped, this file can be -// merged/removed with assertion_compare_go1.17_test.go and -// assertion_compare_can_convert.go - -package assert - -import "reflect" - -// Older versions of Go does not have the reflect.Value.CanConvert -// method. -func canConvert(value reflect.Value, to reflect.Type) bool { - return false -} diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_format.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_format.go index 84dbd6c790..3ddab109ad 100644 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -1,7 +1,4 @@ -/* -* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen -* THIS FILE MUST NOT BE EDITED BY HAND - */ +// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. package assert @@ -107,7 +104,7 @@ func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, return EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...) } -// EqualValuesf asserts that two objects are equal or convertable to the same types +// EqualValuesf asserts that two objects are equal or convertible to the same types // and equal. // // assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") @@ -616,6 +613,16 @@ func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interf return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...) } +// NotImplementsf asserts that an object does not implement the specified interface. +// +// assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotImplements(t, interfaceObject, object, append([]interface{}{msg}, args...)...) +} + // NotNilf asserts that the specified object is not nil. // // assert.NotNilf(t, err, "error message %s", "formatted") @@ -660,10 +667,12 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) } -// NotSubsetf asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubsetf asserts that the specified list(array, slice...) or map does NOT +// contain all elements given in the specified subset list(array, slice...) or +// map. // -// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") +// assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -747,10 +756,11 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg return Same(t, expected, actual, append([]interface{}{msg}, args...)...) } -// Subsetf asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subsetf asserts that the specified list(array, slice...) or map contains all +// elements given in the specified subset list(array, slice...) or map. // -// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +// assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") +// assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_forward.go index b1d94aec53..a84e09bd40 100644 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -1,7 +1,4 @@ -/* -* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen -* THIS FILE MUST NOT BE EDITED BY HAND - */ +// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. package assert @@ -189,7 +186,7 @@ func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface return EqualExportedValuesf(a.t, expected, actual, msg, args...) } -// EqualValues asserts that two objects are equal or convertable to the same types +// EqualValues asserts that two objects are equal or convertible to the same types // and equal. // // a.EqualValues(uint32(123), int32(123)) @@ -200,7 +197,7 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn return EqualValues(a.t, expected, actual, msgAndArgs...) } -// EqualValuesf asserts that two objects are equal or convertable to the same types +// EqualValuesf asserts that two objects are equal or convertible to the same types // and equal. // // a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") @@ -1221,6 +1218,26 @@ func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...in return NotErrorIsf(a.t, err, target, msg, args...) } +// NotImplements asserts that an object does not implement the specified interface. +// +// a.NotImplements((*MyInterface)(nil), new(MyObject)) +func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotImplements(a.t, interfaceObject, object, msgAndArgs...) +} + +// NotImplementsf asserts that an object does not implement the specified interface. +// +// a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotImplementsf(a.t, interfaceObject, object, msg, args...) +} + // NotNil asserts that the specified object is not nil. // // a.NotNil(err) @@ -1309,10 +1326,12 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri return NotSamef(a.t, expected, actual, msg, args...) } -// NotSubset asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubset asserts that the specified list(array, slice...) or map does NOT +// contain all elements given in the specified subset list(array, slice...) or +// map. // -// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +// a.NotSubset([1, 3, 4], [1, 2]) +// a.NotSubset({"x": 1, "y": 2}, {"z": 3}) func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1320,10 +1339,12 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs return NotSubset(a.t, list, subset, msgAndArgs...) } -// NotSubsetf asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubsetf asserts that the specified list(array, slice...) or map does NOT +// contain all elements given in the specified subset list(array, slice...) or +// map. // -// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1483,10 +1504,11 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, return Samef(a.t, expected, actual, msg, args...) } -// Subset asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subset asserts that the specified list(array, slice...) or map contains all +// elements given in the specified subset list(array, slice...) or map. // -// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +// a.Subset([1, 2, 3], [1, 2]) +// a.Subset({"x": 1, "y": 2}, {"x": 1}) func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1494,10 +1516,11 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... return Subset(a.t, list, subset, msgAndArgs...) } -// Subsetf asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subsetf asserts that the specified list(array, slice...) or map contains all +// elements given in the specified subset list(array, slice...) or map. // -// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +// a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertions.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertions.go index a55d1bba92..0b7570f21c 100644 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertions.go +++ b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/assertions.go @@ -19,7 +19,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/pmezard/go-difflib/difflib" - yaml "gopkg.in/yaml.v3" + "gopkg.in/yaml.v3" ) //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl" @@ -110,7 +110,12 @@ func copyExportedFields(expected interface{}) interface{} { return result.Interface() case reflect.Array, reflect.Slice: - result := reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len()) + var result reflect.Value + if expectedKind == reflect.Array { + result = reflect.New(reflect.ArrayOf(expectedValue.Len(), expectedType.Elem())).Elem() + } else { + result = reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len()) + } for i := 0; i < expectedValue.Len(); i++ { index := expectedValue.Index(i) if isNil(index) { @@ -140,6 +145,8 @@ func copyExportedFields(expected interface{}) interface{} { // structures. // // This function does no assertion of any kind. +// +// Deprecated: Use [EqualExportedValues] instead. func ObjectsExportedFieldsAreEqual(expected, actual interface{}) bool { expectedCleaned := copyExportedFields(expected) actualCleaned := copyExportedFields(actual) @@ -153,17 +160,40 @@ func ObjectsAreEqualValues(expected, actual interface{}) bool { return true } - actualType := reflect.TypeOf(actual) - if actualType == nil { + expectedValue := reflect.ValueOf(expected) + actualValue := reflect.ValueOf(actual) + if !expectedValue.IsValid() || !actualValue.IsValid() { return false } - expectedValue := reflect.ValueOf(expected) - if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) { + + expectedType := expectedValue.Type() + actualType := actualValue.Type() + if !expectedType.ConvertibleTo(actualType) { + return false + } + + if !isNumericType(expectedType) || !isNumericType(actualType) { // Attempt comparison after type conversion - return reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual) + return reflect.DeepEqual( + expectedValue.Convert(actualType).Interface(), actual, + ) } - return false + // If BOTH values are numeric, there are chances of false positives due + // to overflow or underflow. So, we need to make sure to always convert + // the smaller type to a larger type before comparing. + if expectedType.Size() >= actualType.Size() { + return actualValue.Convert(expectedType).Interface() == expected + } + + return expectedValue.Convert(actualType).Interface() == actual +} + +// isNumericType returns true if the type is one of: +// int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, +// float32, float64, complex64, complex128 +func isNumericType(t reflect.Type) bool { + return t.Kind() >= reflect.Int && t.Kind() <= reflect.Complex128 } /* CallerInfo is necessary because the assert functions use the testing object @@ -266,7 +296,7 @@ func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { // Aligns the provided message so that all lines after the first line start at the same location as the first line. // Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab). -// The longestLabelLen parameter specifies the length of the longest label in the output (required becaues this is the +// The longestLabelLen parameter specifies the length of the longest label in the output (required because this is the // basis on which the alignment occurs). func indentMessageLines(message string, longestLabelLen int) string { outBuf := new(bytes.Buffer) @@ -382,6 +412,25 @@ func Implements(t TestingT, interfaceObject interface{}, object interface{}, msg return true } +// NotImplements asserts that an object does not implement the specified interface. +// +// assert.NotImplements(t, (*MyInterface)(nil), new(MyObject)) +func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + interfaceType := reflect.TypeOf(interfaceObject).Elem() + + if object == nil { + return Fail(t, fmt.Sprintf("Cannot check if nil does not implement %v", interfaceType), msgAndArgs...) + } + if reflect.TypeOf(object).Implements(interfaceType) { + return Fail(t, fmt.Sprintf("%T implements %v", object, interfaceType), msgAndArgs...) + } + + return true +} + // IsType asserts that the specified objects are of the same type. func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -496,7 +545,7 @@ func samePointers(first, second interface{}) bool { // representations appropriate to be presented to the user. // // If the values are not of like type, the returned strings will be prefixed -// with the type name, and the value will be enclosed in parenthesis similar +// with the type name, and the value will be enclosed in parentheses similar // to a type conversion in the Go grammar. func formatUnequalValues(expected, actual interface{}) (e string, a string) { if reflect.TypeOf(expected) != reflect.TypeOf(actual) { @@ -523,7 +572,7 @@ func truncatingFormat(data interface{}) string { return value } -// EqualValues asserts that two objects are equal or convertable to the same types +// EqualValues asserts that two objects are equal or convertible to the same types // and equal. // // assert.EqualValues(t, uint32(123), int32(123)) @@ -566,12 +615,19 @@ func EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs .. return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) } + if aType.Kind() == reflect.Ptr { + aType = aType.Elem() + } + if bType.Kind() == reflect.Ptr { + bType = bType.Elem() + } + if aType.Kind() != reflect.Struct { - return Fail(t, fmt.Sprintf("Types expected to both be struct \n\t%v != %v", aType.Kind(), reflect.Struct), msgAndArgs...) + return Fail(t, fmt.Sprintf("Types expected to both be struct or pointer to struct \n\t%v != %v", aType.Kind(), reflect.Struct), msgAndArgs...) } if bType.Kind() != reflect.Struct { - return Fail(t, fmt.Sprintf("Types expected to both be struct \n\t%v != %v", bType.Kind(), reflect.Struct), msgAndArgs...) + return Fail(t, fmt.Sprintf("Types expected to both be struct or pointer to struct \n\t%v != %v", bType.Kind(), reflect.Struct), msgAndArgs...) } expected = copyExportedFields(expected) @@ -620,17 +676,6 @@ func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { return Fail(t, "Expected value not to be nil.", msgAndArgs...) } -// containsKind checks if a specified kind in the slice of kinds. -func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool { - for i := 0; i < len(kinds); i++ { - if kind == kinds[i] { - return true - } - } - - return false -} - // isNil checks if a specified object is nil or not, without Failing. func isNil(object interface{}) bool { if object == nil { @@ -638,16 +683,13 @@ func isNil(object interface{}) bool { } value := reflect.ValueOf(object) - kind := value.Kind() - isNilableKind := containsKind( - []reflect.Kind{ - reflect.Chan, reflect.Func, - reflect.Interface, reflect.Map, - reflect.Ptr, reflect.Slice, reflect.UnsafePointer}, - kind) - - if isNilableKind && value.IsNil() { - return true + switch value.Kind() { + case + reflect.Chan, reflect.Func, + reflect.Interface, reflect.Map, + reflect.Ptr, reflect.Slice, reflect.UnsafePointer: + + return value.IsNil() } return false @@ -731,16 +773,14 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } -// getLen try to get length of object. -// return (false, 0) if impossible. -func getLen(x interface{}) (ok bool, length int) { +// getLen tries to get the length of an object. +// It returns (0, false) if impossible. +func getLen(x interface{}) (length int, ok bool) { v := reflect.ValueOf(x) defer func() { - if e := recover(); e != nil { - ok = false - } + ok = recover() == nil }() - return true, v.Len() + return v.Len(), true } // Len asserts that the specified object has specific length. @@ -751,13 +791,13 @@ func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) if h, ok := t.(tHelper); ok { h.Helper() } - ok, l := getLen(object) + l, ok := getLen(object) if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", object), msgAndArgs...) + return Fail(t, fmt.Sprintf("\"%v\" could not be applied builtin len()", object), msgAndArgs...) } if l != length { - return Fail(t, fmt.Sprintf("\"%s\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) + return Fail(t, fmt.Sprintf("\"%v\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) } return true } @@ -919,10 +959,11 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) } -// Subset asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subset asserts that the specified list(array, slice...) or map contains all +// elements given in the specified subset list(array, slice...) or map. // -// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +// assert.Subset(t, [1, 2, 3], [1, 2]) +// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -975,10 +1016,12 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok return true } -// NotSubset asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubset asserts that the specified list(array, slice...) or map does NOT +// contain all elements given in the specified subset list(array, slice...) or +// map. // -// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +// assert.NotSubset(t, [1, 3, 4], [1, 2]) +// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1439,7 +1482,7 @@ func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAnd h.Helper() } if math.IsNaN(epsilon) { - return Fail(t, "epsilon must not be NaN") + return Fail(t, "epsilon must not be NaN", msgAndArgs...) } actualEpsilon, err := calcRelativeError(expected, actual) if err != nil { @@ -1458,19 +1501,26 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m if h, ok := t.(tHelper); ok { h.Helper() } - if expected == nil || actual == nil || - reflect.TypeOf(actual).Kind() != reflect.Slice || - reflect.TypeOf(expected).Kind() != reflect.Slice { + + if expected == nil || actual == nil { return Fail(t, "Parameters must be slice", msgAndArgs...) } - actualSlice := reflect.ValueOf(actual) expectedSlice := reflect.ValueOf(expected) + actualSlice := reflect.ValueOf(actual) - for i := 0; i < actualSlice.Len(); i++ { - result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon) - if !result { - return result + if expectedSlice.Type().Kind() != reflect.Slice { + return Fail(t, "Expected value must be slice", msgAndArgs...) + } + + expectedLen := expectedSlice.Len() + if !IsType(t, expected, actual) || !Len(t, actual, expectedLen) { + return false + } + + for i := 0; i < expectedLen; i++ { + if !InEpsilon(t, expectedSlice.Index(i).Interface(), actualSlice.Index(i).Interface(), epsilon, "at index %d", i) { + return false } } @@ -1870,23 +1920,18 @@ func (c *CollectT) Errorf(format string, args ...interface{}) { } // FailNow panics. -func (c *CollectT) FailNow() { +func (*CollectT) FailNow() { panic("Assertion failed") } -// Reset clears the collected errors. -func (c *CollectT) Reset() { - c.errors = nil +// Deprecated: That was a method for internal usage that should not have been published. Now just panics. +func (*CollectT) Reset() { + panic("Reset() is deprecated") } -// Copy copies the collected errors to the supplied t. -func (c *CollectT) Copy(t TestingT) { - if tt, ok := t.(tHelper); ok { - tt.Helper() - } - for _, err := range c.errors { - t.Errorf("%v", err) - } +// Deprecated: That was a method for internal usage that should not have been published. Now just panics. +func (*CollectT) Copy(TestingT) { + panic("Copy() is deprecated") } // EventuallyWithT asserts that given condition will be met in waitFor time, @@ -1912,8 +1957,8 @@ func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time h.Helper() } - collect := new(CollectT) - ch := make(chan bool, 1) + var lastFinishedTickErrs []error + ch := make(chan []error, 1) timer := time.NewTimer(waitFor) defer timer.Stop() @@ -1924,19 +1969,25 @@ func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time for tick := ticker.C; ; { select { case <-timer.C: - collect.Copy(t) + for _, err := range lastFinishedTickErrs { + t.Errorf("%v", err) + } return Fail(t, "Condition never satisfied", msgAndArgs...) case <-tick: tick = nil - collect.Reset() go func() { + collect := new(CollectT) + defer func() { + ch <- collect.errors + }() condition(collect) - ch <- len(collect.errors) == 0 }() - case v := <-ch: - if v { + case errs := <-ch: + if len(errs) == 0 { return true } + // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached. + lastFinishedTickErrs = errs tick = ticker.C } } diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/http_assertions.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/http_assertions.go index d8038c28a7..861ed4b7ce 100644 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -12,7 +12,7 @@ import ( // an error if building a new request fails. func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) { w := httptest.NewRecorder() - req, err := http.NewRequest(method, url, nil) + req, err := http.NewRequest(method, url, http.NoBody) if err != nil { return -1, err } @@ -32,12 +32,12 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, value } code, err := httpCode(handler, method, url, values) if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) } isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent if !isSuccessCode { - Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code)) + Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) } return isSuccessCode @@ -54,12 +54,12 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, valu } code, err := httpCode(handler, method, url, values) if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) } isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect if !isRedirectCode { - Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code)) + Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) } return isRedirectCode @@ -76,12 +76,12 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values } code, err := httpCode(handler, method, url, values) if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) } isErrorCode := code >= http.StatusBadRequest if !isErrorCode { - Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code)) + Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) } return isErrorCode @@ -98,12 +98,12 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, va } code, err := httpCode(handler, method, url, values) if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err)) + Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) } successful := code == statuscode if !successful { - Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code)) + Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code), msgAndArgs...) } return successful @@ -113,7 +113,10 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, va // empty string if building a new request fails. func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { w := httptest.NewRecorder() - req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) + if len(values) > 0 { + url += "?" + values.Encode() + } + req, err := http.NewRequest(method, url, http.NoBody) if err != nil { return "" } @@ -135,7 +138,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, contains := strings.Contains(body, fmt.Sprint(str)) if !contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) } return contains @@ -155,7 +158,7 @@ func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url strin contains := strings.Contains(body, fmt.Sprint(str)) if contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) } return !contains diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/require/require.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/require/require.go index 63f8521476..506a82f807 100644 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/require/require.go +++ b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/require/require.go @@ -1,7 +1,4 @@ -/* -* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen -* THIS FILE MUST NOT BE EDITED BY HAND - */ +// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. package require @@ -235,7 +232,7 @@ func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, t.FailNow() } -// EqualValues asserts that two objects are equal or convertable to the same types +// EqualValues asserts that two objects are equal or convertible to the same types // and equal. // // assert.EqualValues(t, uint32(123), int32(123)) @@ -249,7 +246,7 @@ func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArg t.FailNow() } -// EqualValuesf asserts that two objects are equal or convertable to the same types +// EqualValuesf asserts that two objects are equal or convertible to the same types // and equal. // // assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") @@ -1546,6 +1543,32 @@ func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interf t.FailNow() } +// NotImplements asserts that an object does not implement the specified interface. +// +// assert.NotImplements(t, (*MyInterface)(nil), new(MyObject)) +func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotImplements(t, interfaceObject, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotImplementsf asserts that an object does not implement the specified interface. +// +// assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotImplementsf(t, interfaceObject, object, msg, args...) { + return + } + t.FailNow() +} + // NotNil asserts that the specified object is not nil. // // assert.NotNil(t, err) @@ -1658,10 +1681,12 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, t.FailNow() } -// NotSubset asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubset asserts that the specified list(array, slice...) or map does NOT +// contain all elements given in the specified subset list(array, slice...) or +// map. // -// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +// assert.NotSubset(t, [1, 3, 4], [1, 2]) +// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1672,10 +1697,12 @@ func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...i t.FailNow() } -// NotSubsetf asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubsetf asserts that the specified list(array, slice...) or map does NOT +// contain all elements given in the specified subset list(array, slice...) or +// map. // -// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") +// assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1880,10 +1907,11 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg t.FailNow() } -// Subset asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subset asserts that the specified list(array, slice...) or map contains all +// elements given in the specified subset list(array, slice...) or map. // -// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +// assert.Subset(t, [1, 2, 3], [1, 2]) +// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1894,10 +1922,11 @@ func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...inte t.FailNow() } -// Subsetf asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subsetf asserts that the specified list(array, slice...) or map contains all +// elements given in the specified subset list(array, slice...) or map. // -// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +// assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") +// assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/require/require_forward.go b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/require/require_forward.go index 3b5b09330a..eee8310a5f 100644 --- a/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/require/require_forward.go +++ b/trunk/3rdparty/srs-bench/vendor/github.com/stretchr/testify/require/require_forward.go @@ -1,7 +1,4 @@ -/* -* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen -* THIS FILE MUST NOT BE EDITED BY HAND - */ +// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. package require @@ -190,7 +187,7 @@ func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface EqualExportedValuesf(a.t, expected, actual, msg, args...) } -// EqualValues asserts that two objects are equal or convertable to the same types +// EqualValues asserts that two objects are equal or convertible to the same types // and equal. // // a.EqualValues(uint32(123), int32(123)) @@ -201,7 +198,7 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn EqualValues(a.t, expected, actual, msgAndArgs...) } -// EqualValuesf asserts that two objects are equal or convertable to the same types +// EqualValuesf asserts that two objects are equal or convertible to the same types // and equal. // // a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") @@ -1222,6 +1219,26 @@ func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...in NotErrorIsf(a.t, err, target, msg, args...) } +// NotImplements asserts that an object does not implement the specified interface. +// +// a.NotImplements((*MyInterface)(nil), new(MyObject)) +func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotImplements(a.t, interfaceObject, object, msgAndArgs...) +} + +// NotImplementsf asserts that an object does not implement the specified interface. +// +// a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotImplementsf(a.t, interfaceObject, object, msg, args...) +} + // NotNil asserts that the specified object is not nil. // // a.NotNil(err) @@ -1310,10 +1327,12 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri NotSamef(a.t, expected, actual, msg, args...) } -// NotSubset asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubset asserts that the specified list(array, slice...) or map does NOT +// contain all elements given in the specified subset list(array, slice...) or +// map. // -// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +// a.NotSubset([1, 3, 4], [1, 2]) +// a.NotSubset({"x": 1, "y": 2}, {"z": 3}) func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1321,10 +1340,12 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs NotSubset(a.t, list, subset, msgAndArgs...) } -// NotSubsetf asserts that the specified list(array, slice...) contains not all -// elements given in the specified subset(array, slice...). +// NotSubsetf asserts that the specified list(array, slice...) or map does NOT +// contain all elements given in the specified subset list(array, slice...) or +// map. // -// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1484,10 +1505,11 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, Samef(a.t, expected, actual, msg, args...) } -// Subset asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subset asserts that the specified list(array, slice...) or map contains all +// elements given in the specified subset list(array, slice...) or map. // -// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +// a.Subset([1, 2, 3], [1, 2]) +// a.Subset({"x": 1, "y": 2}, {"x": 1}) func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1495,10 +1517,11 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... Subset(a.t, list, subset, msgAndArgs...) } -// Subsetf asserts that the specified list(array, slice...) contains all -// elements given in the specified subset(array, slice...). +// Subsetf asserts that the specified list(array, slice...) or map contains all +// elements given in the specified subset list(array, slice...) or map. // -// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +// a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/asn1.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/asn1.go index 6fc2838a3f..2492f796af 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/asn1.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/asn1.go @@ -733,13 +733,14 @@ func (s *String) ReadOptionalASN1OctetString(out *[]byte, outPresent *bool, tag return true } -// ReadOptionalASN1Boolean sets *out to the value of the next ASN.1 BOOLEAN or, -// if the next bytes are not an ASN.1 BOOLEAN, to the value of defaultValue. -// It reports whether the operation was successful. -func (s *String) ReadOptionalASN1Boolean(out *bool, defaultValue bool) bool { +// ReadOptionalASN1Boolean attempts to read an optional ASN.1 BOOLEAN +// explicitly tagged with tag into out and advances. If no element with a +// matching tag is present, it sets "out" to defaultValue instead. It reports +// whether the read was successful. +func (s *String) ReadOptionalASN1Boolean(out *bool, tag asn1.Tag, defaultValue bool) bool { var present bool var child String - if !s.ReadOptionalASN1(&child, &present, asn1.BOOLEAN) { + if !s.ReadOptionalASN1(&child, &present, tag) { return false } @@ -748,7 +749,7 @@ func (s *String) ReadOptionalASN1Boolean(out *bool, defaultValue bool) bool { return true } - return s.ReadASN1Boolean(out) + return child.ReadASN1Boolean(out) } func (s *String) readASN1(out *String, outTag *asn1.Tag, skipHeader bool) bool { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/builder.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/builder.go index c05ac7d16d..cf254f5f1e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/builder.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/builder.go @@ -95,6 +95,11 @@ func (b *Builder) AddUint32(v uint32) { b.add(byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) } +// AddUint48 appends a big-endian, 48-bit value to the byte string. +func (b *Builder) AddUint48(v uint64) { + b.add(byte(v>>40), byte(v>>32), byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) +} + // AddUint64 appends a big-endian, 64-bit value to the byte string. func (b *Builder) AddUint64(v uint64) { b.add(byte(v>>56), byte(v>>48), byte(v>>40), byte(v>>32), byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/string.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/string.go index 0531a3d6f1..10692a8a31 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/string.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/cryptobyte/string.go @@ -81,6 +81,17 @@ func (s *String) ReadUint32(out *uint32) bool { return true } +// ReadUint48 decodes a big-endian, 48-bit value into out and advances over it. +// It reports whether the read was successful. +func (s *String) ReadUint48(out *uint64) bool { + v := s.read(6) + if v == nil { + return false + } + *out = uint64(v[0])<<40 | uint64(v[1])<<32 | uint64(v[2])<<24 | uint64(v[3])<<16 | uint64(v[4])<<8 | uint64(v[5]) + return true +} + // ReadUint64 decodes a big-endian, 64-bit value into out and advances over it. // It reports whether the read was successful. func (s *String) ReadUint64(out *uint64) bool { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go index edcf163c4e..70c541692c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go @@ -1,7 +1,6 @@ // Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego package field diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s index 293f013c94..60817acc41 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s @@ -1,7 +1,6 @@ // Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go index ddb6c9b8f7..9da280d1d8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || !gc || purego -// +build !amd64 !gc purego package field diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go index af459ef515..075fe9b925 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && gc && !purego -// +build arm64,gc,!purego package field diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s index 5c91e45892..3126a43419 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && gc && !purego -// +build arm64,gc,!purego #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go index 234a5b2e5d..fc029ac12d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !arm64 || !gc || purego -// +build !arm64 !gc purego package field diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/dns/dnsmessage/message.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/dns/dnsmessage/message.go index ffdf19d5d3..a656efc128 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/dns/dnsmessage/message.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/dns/dnsmessage/message.go @@ -260,9 +260,11 @@ var ( errReserved = errors.New("segment prefix is reserved") errTooManyPtr = errors.New("too many pointers (>10)") errInvalidPtr = errors.New("invalid pointer") + errInvalidName = errors.New("invalid dns name") errNilResouceBody = errors.New("nil resource body") errResourceLen = errors.New("insufficient data for resource body length") errSegTooLong = errors.New("segment length too long") + errNameTooLong = errors.New("name too long") errZeroSegLen = errors.New("zero length segment") errResTooLong = errors.New("resource length too long") errTooManyQuestions = errors.New("too many Questions to pack (>65535)") @@ -271,7 +273,6 @@ var ( errTooManyAdditionals = errors.New("too many Additionals to pack (>65535)") errNonCanonicalName = errors.New("name is not in canonical format (it must end with a .)") errStringTooLong = errors.New("character string exceeds maximum length (255)") - errCompressedSRV = errors.New("compressed name in SRV resource data") ) // Internal constants. @@ -359,6 +360,8 @@ func (m *Header) GoString() string { "Truncated: " + printBool(m.Truncated) + ", " + "RecursionDesired: " + printBool(m.RecursionDesired) + ", " + "RecursionAvailable: " + printBool(m.RecursionAvailable) + ", " + + "AuthenticData: " + printBool(m.AuthenticData) + ", " + + "CheckingDisabled: " + printBool(m.CheckingDisabled) + ", " + "RCode: " + m.RCode.GoString() + "}" } @@ -488,7 +491,7 @@ func (r *Resource) GoString() string { // A ResourceBody is a DNS resource record minus the header. type ResourceBody interface { // pack packs a Resource except for its header. - pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) + pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) // realType returns the actual type of the Resource. This is used to // fill in the header Type field. @@ -499,7 +502,7 @@ type ResourceBody interface { } // pack appends the wire format of the Resource to msg. -func (r *Resource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *Resource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { if r.Body == nil { return msg, errNilResouceBody } @@ -525,22 +528,26 @@ func (r *Resource) pack(msg []byte, compression map[string]int, compressionOff i // When parsing is started, the Header is parsed. Next, each Question can be // either parsed or skipped. Alternatively, all Questions can be skipped at // once. When all Questions have been parsed, attempting to parse Questions -// will return (nil, nil) and attempting to skip Questions will return -// (true, nil). After all Questions have been either parsed or skipped, all +// will return the [ErrSectionDone] error. +// After all Questions have been either parsed or skipped, all // Answers, Authorities and Additionals can be either parsed or skipped in the // same way, and each type of Resource must be fully parsed or skipped before // proceeding to the next type of Resource. // +// Parser is safe to copy to preserve the parsing state. +// // Note that there is no requirement to fully skip or parse the message. type Parser struct { msg []byte header header - section section - off int - index int - resHeaderValid bool - resHeader ResourceHeader + section section + off int + index int + resHeaderValid bool + resHeaderOffset int + resHeaderType Type + resHeaderLength uint16 } // Start parses the header and enables the parsing of Questions. @@ -591,8 +598,9 @@ func (p *Parser) resource(sec section) (Resource, error) { func (p *Parser) resourceHeader(sec section) (ResourceHeader, error) { if p.resHeaderValid { - return p.resHeader, nil + p.off = p.resHeaderOffset } + if err := p.checkAdvance(sec); err != nil { return ResourceHeader{}, err } @@ -602,14 +610,16 @@ func (p *Parser) resourceHeader(sec section) (ResourceHeader, error) { return ResourceHeader{}, err } p.resHeaderValid = true - p.resHeader = hdr + p.resHeaderOffset = p.off + p.resHeaderType = hdr.Type + p.resHeaderLength = hdr.Length p.off = off return hdr, nil } func (p *Parser) skipResource(sec section) error { - if p.resHeaderValid { - newOff := p.off + int(p.resHeader.Length) + if p.resHeaderValid && p.section == sec { + newOff := p.off + int(p.resHeaderLength) if newOff > len(p.msg) { return errResourceLen } @@ -740,6 +750,9 @@ func (p *Parser) AllAnswers() ([]Resource, error) { } // SkipAnswer skips a single Answer Resource. +// +// It does not perform a complete validation of the resource header, which means +// it may return a nil error when the [AnswerHeader] would actually return an error. func (p *Parser) SkipAnswer() error { return p.skipResource(sectionAnswers) } @@ -790,6 +803,9 @@ func (p *Parser) AllAuthorities() ([]Resource, error) { } // SkipAuthority skips a single Authority Resource. +// +// It does not perform a complete validation of the resource header, which means +// it may return a nil error when the [AuthorityHeader] would actually return an error. func (p *Parser) SkipAuthority() error { return p.skipResource(sectionAuthorities) } @@ -840,6 +856,9 @@ func (p *Parser) AllAdditionals() ([]Resource, error) { } // SkipAdditional skips a single Additional Resource. +// +// It does not perform a complete validation of the resource header, which means +// it may return a nil error when the [AdditionalHeader] would actually return an error. func (p *Parser) SkipAdditional() error { return p.skipResource(sectionAdditionals) } @@ -860,14 +879,14 @@ func (p *Parser) SkipAllAdditionals() error { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) CNAMEResource() (CNAMEResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeCNAME { + if !p.resHeaderValid || p.resHeaderType != TypeCNAME { return CNAMEResource{}, ErrNotStarted } r, err := unpackCNAMEResource(p.msg, p.off) if err != nil { return CNAMEResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -878,14 +897,14 @@ func (p *Parser) CNAMEResource() (CNAMEResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) MXResource() (MXResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeMX { + if !p.resHeaderValid || p.resHeaderType != TypeMX { return MXResource{}, ErrNotStarted } r, err := unpackMXResource(p.msg, p.off) if err != nil { return MXResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -896,14 +915,14 @@ func (p *Parser) MXResource() (MXResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) NSResource() (NSResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeNS { + if !p.resHeaderValid || p.resHeaderType != TypeNS { return NSResource{}, ErrNotStarted } r, err := unpackNSResource(p.msg, p.off) if err != nil { return NSResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -914,14 +933,14 @@ func (p *Parser) NSResource() (NSResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) PTRResource() (PTRResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypePTR { + if !p.resHeaderValid || p.resHeaderType != TypePTR { return PTRResource{}, ErrNotStarted } r, err := unpackPTRResource(p.msg, p.off) if err != nil { return PTRResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -932,14 +951,14 @@ func (p *Parser) PTRResource() (PTRResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) SOAResource() (SOAResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeSOA { + if !p.resHeaderValid || p.resHeaderType != TypeSOA { return SOAResource{}, ErrNotStarted } r, err := unpackSOAResource(p.msg, p.off) if err != nil { return SOAResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -950,14 +969,14 @@ func (p *Parser) SOAResource() (SOAResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) TXTResource() (TXTResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeTXT { + if !p.resHeaderValid || p.resHeaderType != TypeTXT { return TXTResource{}, ErrNotStarted } - r, err := unpackTXTResource(p.msg, p.off, p.resHeader.Length) + r, err := unpackTXTResource(p.msg, p.off, p.resHeaderLength) if err != nil { return TXTResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -968,14 +987,14 @@ func (p *Parser) TXTResource() (TXTResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) SRVResource() (SRVResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeSRV { + if !p.resHeaderValid || p.resHeaderType != TypeSRV { return SRVResource{}, ErrNotStarted } r, err := unpackSRVResource(p.msg, p.off) if err != nil { return SRVResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -986,14 +1005,14 @@ func (p *Parser) SRVResource() (SRVResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) AResource() (AResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeA { + if !p.resHeaderValid || p.resHeaderType != TypeA { return AResource{}, ErrNotStarted } r, err := unpackAResource(p.msg, p.off) if err != nil { return AResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -1004,14 +1023,14 @@ func (p *Parser) AResource() (AResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) AAAAResource() (AAAAResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeAAAA { + if !p.resHeaderValid || p.resHeaderType != TypeAAAA { return AAAAResource{}, ErrNotStarted } r, err := unpackAAAAResource(p.msg, p.off) if err != nil { return AAAAResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -1022,14 +1041,14 @@ func (p *Parser) AAAAResource() (AAAAResource, error) { // One of the XXXHeader methods must have been called before calling this // method. func (p *Parser) OPTResource() (OPTResource, error) { - if !p.resHeaderValid || p.resHeader.Type != TypeOPT { + if !p.resHeaderValid || p.resHeaderType != TypeOPT { return OPTResource{}, ErrNotStarted } - r, err := unpackOPTResource(p.msg, p.off, p.resHeader.Length) + r, err := unpackOPTResource(p.msg, p.off, p.resHeaderLength) if err != nil { return OPTResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -1043,11 +1062,11 @@ func (p *Parser) UnknownResource() (UnknownResource, error) { if !p.resHeaderValid { return UnknownResource{}, ErrNotStarted } - r, err := unpackUnknownResource(p.resHeader.Type, p.msg, p.off, p.resHeader.Length) + r, err := unpackUnknownResource(p.resHeaderType, p.msg, p.off, p.resHeaderLength) if err != nil { return UnknownResource{}, err } - p.off += int(p.resHeader.Length) + p.off += int(p.resHeaderLength) p.resHeaderValid = false p.index++ return r, nil @@ -1118,7 +1137,7 @@ func (m *Message) AppendPack(b []byte) ([]byte, error) { // DNS messages can be a maximum of 512 bytes long. Without compression, // many DNS response messages are over this limit, so enabling // compression will help ensure compliance. - compression := map[string]int{} + compression := map[string]uint16{} for i := range m.Questions { var err error @@ -1209,7 +1228,7 @@ type Builder struct { // compression is a mapping from name suffixes to their starting index // in msg. - compression map[string]int + compression map[string]uint16 } // NewBuilder creates a new builder with compression disabled. @@ -1246,7 +1265,7 @@ func NewBuilder(buf []byte, h Header) Builder { // // Compression should be enabled before any sections are added for best results. func (b *Builder) EnableCompression() { - b.compression = map[string]int{} + b.compression = map[string]uint16{} } func (b *Builder) startCheck(s section) error { @@ -1662,7 +1681,7 @@ func (h *ResourceHeader) GoString() string { // pack appends the wire format of the ResourceHeader to oldMsg. // // lenOff is the offset in msg where the Length field was packed. -func (h *ResourceHeader) pack(oldMsg []byte, compression map[string]int, compressionOff int) (msg []byte, lenOff int, err error) { +func (h *ResourceHeader) pack(oldMsg []byte, compression map[string]uint16, compressionOff int) (msg []byte, lenOff int, err error) { msg = oldMsg if msg, err = h.Name.pack(msg, compression, compressionOff); err != nil { return oldMsg, 0, &nestedError{"Name", err} @@ -1728,7 +1747,7 @@ const ( // // The provided extRCode must be an extended RCode. func (h *ResourceHeader) SetEDNS0(udpPayloadLen int, extRCode RCode, dnssecOK bool) error { - h.Name = Name{Data: [nameLen]byte{'.'}, Length: 1} // RFC 6891 section 6.1.2 + h.Name = Name{Data: [255]byte{'.'}, Length: 1} // RFC 6891 section 6.1.2 h.Type = TypeOPT h.Class = Class(udpPayloadLen) h.TTL = uint32(extRCode) >> 4 << 24 @@ -1888,21 +1907,21 @@ func unpackBytes(msg []byte, off int, field []byte) (int, error) { return newOff, nil } -const nameLen = 255 +const nonEncodedNameMax = 254 -// A Name is a non-encoded domain name. It is used instead of strings to avoid +// A Name is a non-encoded and non-escaped domain name. It is used instead of strings to avoid // allocations. type Name struct { - Data [nameLen]byte // 255 bytes + Data [255]byte Length uint8 } // NewName creates a new Name from a string. func NewName(name string) (Name, error) { - if len(name) > nameLen { + n := Name{Length: uint8(len(name))} + if len(name) > len(n.Data) { return Name{}, errCalcLen } - n := Name{Length: uint8(len(name))} copy(n.Data[:], name) return n, nil } @@ -1917,6 +1936,8 @@ func MustNewName(name string) Name { } // String implements fmt.Stringer.String. +// +// Note: characters inside the labels are not escaped in any way. func (n Name) String() string { return string(n.Data[:n.Length]) } @@ -1933,9 +1954,13 @@ func (n *Name) GoString() string { // // The compression map will be updated with new domain suffixes. If compression // is nil, compression will not be used. -func (n *Name) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (n *Name) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { oldMsg := msg + if n.Length > nonEncodedNameMax { + return nil, errNameTooLong + } + // Add a trailing dot to canonicalize name. if n.Length == 0 || n.Data[n.Length-1] != '.' { return oldMsg, errNonCanonicalName @@ -1946,6 +1971,8 @@ func (n *Name) pack(msg []byte, compression map[string]int, compressionOff int) return append(msg, 0), nil } + var nameAsStr string + // Emit sequence of counted strings, chopping at dots. for i, begin := 0, 0; i < int(n.Length); i++ { // Check for the end of the segment. @@ -1976,16 +2003,22 @@ func (n *Name) pack(msg []byte, compression map[string]int, compressionOff int) // segment. A pointer is two bytes with the two most significant // bits set to 1 to indicate that it is a pointer. if (i == 0 || n.Data[i-1] == '.') && compression != nil { - if ptr, ok := compression[string(n.Data[i:])]; ok { + if ptr, ok := compression[string(n.Data[i:n.Length])]; ok { // Hit. Emit a pointer instead of the rest of // the domain. return append(msg, byte(ptr>>8|0xC0), byte(ptr)), nil } // Miss. Add the suffix to the compression table if the - // offset can be stored in the available 14 bytes. - if len(msg) <= int(^uint16(0)>>2) { - compression[string(n.Data[i:])] = len(msg) - compressionOff + // offset can be stored in the available 14 bits. + newPtr := len(msg) - compressionOff + if newPtr <= int(^uint16(0)>>2) { + if nameAsStr == "" { + // allocate n.Data on the heap once, to avoid allocating it + // multiple times (for next labels). + nameAsStr = string(n.Data[:n.Length]) + } + compression[nameAsStr[i:]] = uint16(newPtr) } } } @@ -1994,10 +2027,6 @@ func (n *Name) pack(msg []byte, compression map[string]int, compressionOff int) // unpack unpacks a domain name. func (n *Name) unpack(msg []byte, off int) (int, error) { - return n.unpackCompressed(msg, off, true /* allowCompression */) -} - -func (n *Name) unpackCompressed(msg []byte, off int, allowCompression bool) (int, error) { // currOff is the current working offset. currOff := off @@ -2029,13 +2058,19 @@ Loop: if endOff > len(msg) { return off, errCalcLen } + + // Reject names containing dots. + // See issue golang/go#56246 + for _, v := range msg[currOff:endOff] { + if v == '.' { + return off, errInvalidName + } + } + name = append(name, msg[currOff:endOff]...) name = append(name, '.') currOff = endOff case 0xC0: // Pointer - if !allowCompression { - return off, errCompressedSRV - } if currOff >= len(msg) { return off, errInvalidPtr } @@ -2057,8 +2092,8 @@ Loop: if len(name) == 0 { name = append(name, '.') } - if len(name) > len(n.Data) { - return off, errCalcLen + if len(name) > nonEncodedNameMax { + return off, errNameTooLong } n.Length = uint8(len(name)) if ptr == 0 { @@ -2116,7 +2151,7 @@ type Question struct { } // pack appends the wire format of the Question to msg. -func (q *Question) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (q *Question) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { msg, err := q.Name.pack(msg, compression, compressionOff) if err != nil { return msg, &nestedError{"Name", err} @@ -2212,7 +2247,7 @@ func (r *CNAMEResource) realType() Type { } // pack appends the wire format of the CNAMEResource to msg. -func (r *CNAMEResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *CNAMEResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { return r.CNAME.pack(msg, compression, compressionOff) } @@ -2240,7 +2275,7 @@ func (r *MXResource) realType() Type { } // pack appends the wire format of the MXResource to msg. -func (r *MXResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *MXResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { oldMsg := msg msg = packUint16(msg, r.Pref) msg, err := r.MX.pack(msg, compression, compressionOff) @@ -2279,7 +2314,7 @@ func (r *NSResource) realType() Type { } // pack appends the wire format of the NSResource to msg. -func (r *NSResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *NSResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { return r.NS.pack(msg, compression, compressionOff) } @@ -2306,7 +2341,7 @@ func (r *PTRResource) realType() Type { } // pack appends the wire format of the PTRResource to msg. -func (r *PTRResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *PTRResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { return r.PTR.pack(msg, compression, compressionOff) } @@ -2343,7 +2378,7 @@ func (r *SOAResource) realType() Type { } // pack appends the wire format of the SOAResource to msg. -func (r *SOAResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *SOAResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { oldMsg := msg msg, err := r.NS.pack(msg, compression, compressionOff) if err != nil { @@ -2415,7 +2450,7 @@ func (r *TXTResource) realType() Type { } // pack appends the wire format of the TXTResource to msg. -func (r *TXTResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *TXTResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { oldMsg := msg for _, s := range r.TXT { var err error @@ -2471,7 +2506,7 @@ func (r *SRVResource) realType() Type { } // pack appends the wire format of the SRVResource to msg. -func (r *SRVResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *SRVResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { oldMsg := msg msg = packUint16(msg, r.Priority) msg = packUint16(msg, r.Weight) @@ -2506,7 +2541,7 @@ func unpackSRVResource(msg []byte, off int) (SRVResource, error) { return SRVResource{}, &nestedError{"Port", err} } var target Name - if _, err := target.unpackCompressed(msg, off, false /* allowCompression */); err != nil { + if _, err := target.unpack(msg, off); err != nil { return SRVResource{}, &nestedError{"Target", err} } return SRVResource{priority, weight, port, target}, nil @@ -2522,7 +2557,7 @@ func (r *AResource) realType() Type { } // pack appends the wire format of the AResource to msg. -func (r *AResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *AResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { return packBytes(msg, r.A[:]), nil } @@ -2556,7 +2591,7 @@ func (r *AAAAResource) GoString() string { } // pack appends the wire format of the AAAAResource to msg. -func (r *AAAAResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *AAAAResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { return packBytes(msg, r.AAAA[:]), nil } @@ -2596,7 +2631,7 @@ func (r *OPTResource) realType() Type { return TypeOPT } -func (r *OPTResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *OPTResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { for _, opt := range r.Options { msg = packUint16(msg, opt.Code) l := uint16(len(opt.Data)) @@ -2654,7 +2689,7 @@ func (r *UnknownResource) realType() Type { } // pack appends the wire format of the UnknownResource to msg. -func (r *UnknownResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { +func (r *UnknownResource) pack(msg []byte, compression map[string]uint16, compressionOff int) ([]byte, error) { return packBytes(msg, r.Data[:]), nil } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr.go index 4bdaaaf1ad..33a5bf59c3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go index 0d30e0a0f2..68f438c845 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd -// +build aix darwin dragonfly freebsd netbsd openbsd package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go index 4936e8a6f3..058ea8de89 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (arm || mips || mipsle || 386 || ppc) && linux -// +build arm mips mipsle 386 ppc -// +build linux package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go index f6877f98fd..3ca0d3a0ab 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux -// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x -// +build linux package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go index d3dbe1b8e0..6d0e426cdd 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && solaris -// +build amd64,solaris package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go index 1d9f2ed625..7ca9cb7e78 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_unix.go index 19d46789de..0211f225bf 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/cmsghdr_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/complete_dontwait.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/complete_dontwait.go index 5b1d50ae72..2038f29043 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/complete_dontwait.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/complete_dontwait.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build darwin dragonfly freebsd linux netbsd openbsd solaris package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/complete_nodontwait.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/complete_nodontwait.go index be63409583..70e6f448b0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/complete_nodontwait.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/complete_nodontwait.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || windows || zos -// +build aix windows zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/empty.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/empty.s index 90ab4ca3d8..49d79791e0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/empty.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/empty.s @@ -3,6 +3,5 @@ // license that can be found in the LICENSE file. //go:build darwin && go1.12 -// +build darwin,go1.12 // This exists solely so we can linkname in symbols from syscall. diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/error_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/error_unix.go index 78f4129047..7a5cc5c43e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/error_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/error_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_32bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_32bit.go index 2b8fbb3f3d..340e53fbda 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_32bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_32bit.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (arm || mips || mipsle || 386 || ppc) && (darwin || dragonfly || freebsd || linux || netbsd || openbsd) -// +build arm mips mipsle 386 ppc -// +build darwin dragonfly freebsd linux netbsd openbsd package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_64bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_64bit.go index 2e94e96f8b..26470c191a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_64bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_64bit.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos) -// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x -// +build aix darwin dragonfly freebsd linux netbsd openbsd zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go index f7da2bc4d4..8859ce1035 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && solaris -// +build amd64,solaris package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_stub.go index 14caf52483..da886b0326 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/iovec_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go index 113e773cd5..4825b21e3e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !linux && !netbsd -// +build !aix,!linux,!netbsd package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go index 41883c530c..311fd2c789 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || linux || netbsd -// +build aix linux netbsd package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go index 25f6847f99..ebff4f6e05 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd -// +build aix darwin dragonfly freebsd netbsd openbsd package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go index 5b8e00f1cd..62e6fe8616 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || netbsd -// +build aix darwin dragonfly freebsd netbsd package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go index b4658fbaeb..3dd07250a6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (arm || mips || mipsle || 386 || ppc) && linux -// +build arm mips mipsle 386 ppc -// +build linux package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go index 42411affad..5af9ddd6ab 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux -// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x -// +build linux package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go index 3098f5d783..e212b50f8d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && solaris -// +build amd64,solaris package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_stub.go index eb79151f6a..e876776459 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_zos_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_zos_s390x.go index 324e9ee7d1..529db68ee3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_zos_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/msghdr_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build s390x && zos -// +build s390x,zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/norace.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/norace.go index de0ad420fc..8af30ecfbb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/norace.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/norace.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !race -// +build !race package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/race.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/race.go index f0a28a625d..9afa958083 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/race.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/race.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build race -// +build race package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go index 8f79b38f74..0431390789 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux -// +build linux package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_msg.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_msg.go index f7d0b0d2b8..7c0d7410bc 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_msg.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_msg.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go index 02f3285566..e363fb5a89 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux -// +build !linux package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go index dd785877b6..ff7a8baf0b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_bsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_bsd.go index b258879d44..e7664d48be 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_bsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || openbsd || solaris -// +build aix darwin dragonfly freebsd openbsd solaris package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_const_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_const_unix.go index 5d99f2373f..d7627f87eb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_const_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_const_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux.go index 76f5b8ae5d..08d4910778 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && !s390x && !386 -// +build linux,!s390x,!386 package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux_loong64.go index af964e6171..1d182470d0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux_loong64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build loong64 -// +build loong64 package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go index 5b128fbb2a..0e407d1257 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 -// +build riscv64 package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_posix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_posix.go index 42b8f2340e..58d8654824 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_posix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_posix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_stub.go index 7cfb349c0c..2e5b473c66 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_unix.go index de823932b9..93058db5b9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/sys_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go index 00691bd524..45bab004c1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go @@ -3,7 +3,6 @@ // Added for go1.11 compatibility //go:build aix -// +build aix package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_linux_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_linux_loong64.go index 6a94fec2c5..b6fc15a1a2 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_linux_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_linux_loong64.go @@ -2,7 +2,6 @@ // cgo -godefs defs_linux.go //go:build loong64 -// +build loong64 package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go index c066272ddd..e67fc3cbaa 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go @@ -2,7 +2,6 @@ // cgo -godefs defs_linux.go //go:build riscv64 -// +build riscv64 package socket diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_bsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_bsd.go index b7385dfd95..c88da8cbe7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_bsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd -// +build aix darwin dragonfly freebsd netbsd openbsd package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_pktinfo.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_pktinfo.go index 0e748dbdc4..14ae2dae49 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_pktinfo.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_pktinfo.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || linux || solaris -// +build darwin linux solaris package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_stub.go index f27322c3ed..3ba6611609 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_unix.go index 2413e02f8f..2e765548f3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/control_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/icmp_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/icmp_stub.go index cd4ee6e1c9..c2c4ce7ff5 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/icmp_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/icmp_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux -// +build !linux package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/payload_cmsg.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/payload_cmsg.go index 1bb370e25f..91c685e8fc 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/payload_cmsg.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/payload_cmsg.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/payload_nocmsg.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/payload_nocmsg.go index 53f0794eb7..2afd4b50ef 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/payload_nocmsg.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/payload_nocmsg.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sockopt_posix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sockopt_posix.go index eb07c1c02a..82e2c37838 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sockopt_posix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sockopt_posix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sockopt_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sockopt_stub.go index cf036893b7..840108bf76 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sockopt_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sockopt_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_aix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_aix.go index 02730cdfd2..9244a68a38 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_aix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_aix.go @@ -4,7 +4,6 @@ // Added for go1.11 compatibility //go:build aix -// +build aix package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreq.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreq.go index 22322b387e..645f254c6d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreq.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreq.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || windows -// +build aix darwin dragonfly freebsd netbsd openbsd solaris windows package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go index fde640142d..48cfb6db2f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !netbsd && !openbsd && !solaris && !windows -// +build !aix,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreqn.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreqn.go index 54eb9901b5..0b27b632f1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreqn.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreqn.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || freebsd || linux -// +build darwin freebsd linux package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go index dcb15f25a5..303a5e2e68 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !darwin && !freebsd && !linux -// +build !darwin,!freebsd,!linux package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bpf.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bpf.go index fb11e324e2..1b4780df41 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bpf.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bpf.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux -// +build linux package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go index fc53a0d33a..b1f779b493 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux -// +build !linux package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bsd.go index e191b2f14f..b7b032d260 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build netbsd || openbsd -// +build netbsd openbsd package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_ssmreq.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_ssmreq.go index 6a4e7abf9b..a295e15ea0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_ssmreq.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_ssmreq.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || freebsd || linux || solaris -// +build darwin freebsd linux solaris package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go index 157159fd50..74bd454e25 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !darwin && !freebsd && !linux && !solaris -// +build !darwin,!freebsd,!linux,!solaris package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_stub.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_stub.go index d550851658..20af4074c2 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_stub.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/sys_stub.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go index b7f2d6e5c1..dd454025c7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go @@ -3,7 +3,6 @@ // Added for go1.11 compatibility //go:build aix -// +build aix package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_linux_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_linux_loong64.go index e15c22c748..54f9e13948 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_linux_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_linux_loong64.go @@ -2,7 +2,6 @@ // cgo -godefs defs_linux.go //go:build loong64 -// +build loong64 package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go index e2edebdb81..78374a5250 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go @@ -2,7 +2,6 @@ // cgo -godefs defs_linux.go //go:build riscv64 -// +build riscv64 package ipv4 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s index db9171c2e4..269e173ca4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu.go index 83f112c4c8..4756ad5f79 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu.go @@ -38,7 +38,7 @@ var X86 struct { HasAVX512F bool // Advanced vector extension 512 Foundation Instructions HasAVX512CD bool // Advanced vector extension 512 Conflict Detection Instructions HasAVX512ER bool // Advanced vector extension 512 Exponential and Reciprocal Instructions - HasAVX512PF bool // Advanced vector extension 512 Prefetch Instructions Instructions + HasAVX512PF bool // Advanced vector extension 512 Prefetch Instructions HasAVX512VL bool // Advanced vector extension 512 Vector Length Extensions HasAVX512BW bool // Advanced vector extension 512 Byte and Word Instructions HasAVX512DQ bool // Advanced vector extension 512 Doubleword and Quadword Instructions @@ -54,6 +54,9 @@ var X86 struct { HasAVX512VBMI2 bool // Advanced vector extension 512 Vector Byte Manipulation Instructions 2 HasAVX512BITALG bool // Advanced vector extension 512 Bit Algorithms HasAVX512BF16 bool // Advanced vector extension 512 BFloat16 Instructions + HasAMXTile bool // Advanced Matrix Extension Tile instructions + HasAMXInt8 bool // Advanced Matrix Extension Int8 instructions + HasAMXBF16 bool // Advanced Matrix Extension BFloat16 instructions HasBMI1 bool // Bit manipulation instruction set 1 HasBMI2 bool // Bit manipulation instruction set 2 HasCX16 bool // Compare and exchange 16 Bytes diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_aix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_aix.go index 8aaeef545a..9bf0c32eb6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_aix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_aix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix -// +build aix package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_arm64.s index c61f95a05a..fcb9a38882 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_arm64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_arm64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go index ccf542a73d..a8acd3e328 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go index 0af2f24841..c8ae6ddc15 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go index fa7cdb9bcd..910728fb16 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gc -// +build 386 amd64 amd64p32 -// +build gc package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go index 2aff318911..7f1946780b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo -// +build gccgo package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go index 4bfbda6199..9526d2ce3a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo -// +build gccgo package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c index 6cc73109f5..3f73a05dcf 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gccgo -// +build 386 amd64 amd64p32 -// +build gccgo #include #include diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go index 863d415ab4..99c60fe9f9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gccgo -// +build 386 amd64 amd64p32 -// +build gccgo package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux.go index 159a686f6f..743eb54354 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !386 && !amd64 && !amd64p32 && !arm64 -// +build !386,!amd64,!amd64p32,!arm64 package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go index 6000db4cdd..4686c1d541 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) -// +build linux -// +build mips64 mips64le package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go index f4992b1a59..cd63e73355 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x -// +build linux,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le,!s390x package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go index 021356d6de..197188e67f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) -// +build linux -// +build ppc64 ppc64le package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_loong64.go index 0f57b05bdb..558635850c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_loong64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build loong64 -// +build loong64 package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_mips64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_mips64x.go index f4063c6642..fedb00cc4c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_mips64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_mips64x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build mips64 || mips64le -// +build mips64 mips64le package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_mipsx.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_mipsx.go index 07c4e36d8f..ffb4ec7eb3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_mipsx.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_mipsx.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build mips || mipsle -// +build mips mipsle package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_arm.go index d7b4fb4ccc..e9ecf2a456 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && arm -// +build !linux,arm package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go index f3cde129b6..5341e7f88d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && !netbsd && !openbsd && arm64 -// +build !linux,!netbsd,!openbsd,arm64 package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go index 0dafe9644a..5f8f2419ab 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && (mips64 || mips64le) -// +build !linux -// +build mips64 mips64le package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go index 060d46b6ea..89608fba27 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !linux && (ppc64 || ppc64le) -// +build !aix -// +build !linux -// +build ppc64 ppc64le package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go index dd10eb79fe..5ab87808f7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !linux && riscv64 -// +build !linux,riscv64 package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go index 4e8acd1658..c14f12b149 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build ppc64 || ppc64le -// +build ppc64 ppc64le package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_riscv64.go index bd6c128af9..7f0c79c004 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_riscv64.go @@ -3,10 +3,9 @@ // license that can be found in the LICENSE file. //go:build riscv64 -// +build riscv64 package cpu -const cacheLineSize = 32 +const cacheLineSize = 64 func initOptions() {} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_s390x.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_s390x.s index 96f81e2097..1fb4b70133 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_s390x.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_s390x.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_wasm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_wasm.go index 7747d888a6..384787ea30 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_wasm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_wasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build wasm -// +build wasm package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_x86.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_x86.go index f5aacfc825..c29f5e4c5a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 || amd64 || amd64p32 -// +build 386 amd64 amd64p32 package cpu @@ -37,6 +36,9 @@ func initOptions() { {Name: "avx512vbmi2", Feature: &X86.HasAVX512VBMI2}, {Name: "avx512bitalg", Feature: &X86.HasAVX512BITALG}, {Name: "avx512bf16", Feature: &X86.HasAVX512BF16}, + {Name: "amxtile", Feature: &X86.HasAMXTile}, + {Name: "amxint8", Feature: &X86.HasAMXInt8}, + {Name: "amxbf16", Feature: &X86.HasAMXBF16}, {Name: "bmi1", Feature: &X86.HasBMI1}, {Name: "bmi2", Feature: &X86.HasBMI2}, {Name: "cx16", Feature: &X86.HasCX16}, @@ -138,6 +140,10 @@ func archInit() { eax71, _, _, _ := cpuid(7, 1) X86.HasAVX512BF16 = isSet(5, eax71) } + + X86.HasAMXTile = isSet(24, edx7) + X86.HasAMXInt8 = isSet(25, edx7) + X86.HasAMXBF16 = isSet(22, edx7) } func isSet(bitpos uint, value uint32) bool { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_x86.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_x86.s index 39acab2ff5..7d7ba33efb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_x86.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/cpu_x86.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gc -// +build 386 amd64 amd64p32 -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/endian_big.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/endian_big.go index 93ce03a346..7fe04b0a13 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/endian_big.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/endian_big.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 -// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/endian_little.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/endian_little.go index fe545966b6..48eccc4c79 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/endian_little.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/endian_little.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh -// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh +//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh || wasm package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/hwcap_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/hwcap_linux.go index 1d9d91f3ed..34e49f955a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/hwcap_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/hwcap_linux.go @@ -5,7 +5,7 @@ package cpu import ( - "io/ioutil" + "os" ) const ( @@ -39,7 +39,7 @@ func readHWCAP() error { return nil } - buf, err := ioutil.ReadFile(procAuxv) + buf, err := os.ReadFile(procAuxv) if err != nil { // e.g. on android /proc/self/auxv is not accessible, so silently // ignore the error and leave Initialized = false. On some diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go index d87bd6b3eb..4cd64c7042 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && arm64 -// +build linux,arm64 package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go index b975ea2a04..4c9788ea8e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.21 -// +build go1.21 package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go index 96134157a1..1b9ccb091a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go @@ -9,7 +9,6 @@ // gccgo's libgo and thus must not used a CGo method. //go:build aix && gccgo -// +build aix,gccgo package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go index 904be42ffd..e8b6cdbe9a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go @@ -7,7 +7,6 @@ // (See golang.org/issue/32102) //go:build aix && ppc64 && gc -// +build aix,ppc64,gc package cpu diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go deleted file mode 100644 index e07899b909..0000000000 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package unsafeheader contains header declarations for the Go runtime's -// slice and string implementations. -// -// This package allows x/sys to use types equivalent to -// reflect.SliceHeader and reflect.StringHeader without introducing -// a dependency on the (relatively heavy) "reflect" package. -package unsafeheader - -import ( - "unsafe" -) - -// Slice is the runtime representation of a slice. -// It cannot be used safely or portably and its representation may change in a later release. -type Slice struct { - Data unsafe.Pointer - Len int - Cap int -} - -// String is the runtime representation of a string. -// It cannot be used safely or portably and its representation may change in a later release. -type String struct { - Data unsafe.Pointer - Len int -} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go index c9b69937a0..73687de748 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.5 -// +build go1.5 package plan9 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/pwd_plan9.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/pwd_plan9.go index 98bf56b732..fb94582184 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/pwd_plan9.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/pwd_plan9.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.5 -// +build !go1.5 package plan9 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/race.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/race.go index 62377d2ff9..c02d9ed333 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/race.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/race.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build plan9 && race -// +build plan9,race package plan9 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/race0.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/race0.go index f8da30876d..7b15e15f65 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/race0.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/race0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build plan9 && !race -// +build plan9,!race package plan9 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/str.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/str.go index 55fa8d025e..ba3e8ff8a6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/str.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/str.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build plan9 -// +build plan9 package plan9 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/syscall.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/syscall.go index 67e5b0115c..d631fd664a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/syscall.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build plan9 -// +build plan9 // Package plan9 contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go index 3f40b9bd74..f780d5c807 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build plan9 && 386 -// +build plan9,386 package plan9 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go index 0e6a96aa4f..7de61065f6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build plan9 && amd64 -// +build plan9,amd64 package plan9 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go index 244c501b77..ea85780f03 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build plan9 && arm -// +build plan9,arm package plan9 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/aliases.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/aliases.go index abc89c104a..b0e4198575 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/aliases.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/aliases.go @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9 -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos -// +build go1.9 +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s index db9171c2e4..269e173ca4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_386.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_386.s index e0fcd9b3de..a4fcef0e0d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_386.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_386.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (freebsd || netbsd || openbsd) && gc -// +build freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s index 2b99c349a2..1e63615c57 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc -// +build darwin dragonfly freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_arm.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_arm.s index d702d4adc7..6496c31008 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_arm.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_arm.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (freebsd || netbsd || openbsd) && gc -// +build freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s index fe36a7391a..4fd1f54daa 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s index e5b9a84899..42f7eb9e47 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s index d560019ea2..f8902667e9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || freebsd || netbsd || openbsd) && gc -// +build darwin freebsd netbsd openbsd -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_386.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_386.s index 8fd101d071..3b4734870d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_386.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_386.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_amd64.s index 7ed38e43c6..67e29f3178 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_amd64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_arm.s index 8ef1d51402..d6ae269ce1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_arm.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_arm.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_arm64.s index 98ae02760d..01e5e253c6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_arm64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_arm64.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && arm64 && gc -// +build linux -// +build arm64 -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_loong64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_loong64.s index 565357288a..2abf12f6e8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_loong64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_loong64.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && loong64 && gc -// +build linux -// +build loong64 -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s index 21231d2ce1..f84bae7120 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) && gc -// +build linux -// +build mips64 mips64le -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s index 6783b26c60..f08f628077 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips || mipsle) && gc -// +build linux -// +build mips mipsle -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s index 19d4989344..bdfc024d2d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) && gc -// +build linux -// +build ppc64 ppc64le -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s index e42eb81d58..2e8c996120 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && gc -// +build riscv64 -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_s390x.s index c46aab3395..2c394b11eb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_s390x.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_linux_s390x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && s390x && gc -// +build linux -// +build s390x -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s index 5e7a1169c0..fab586a2c4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s index f8c5394c1a..f949ec5476 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_zos_s390x.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_zos_s390x.s index 3b54e18581..2f67ba86d5 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_zos_s390x.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/asm_zos_s390x.s @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x && gc -// +build zos -// +build s390x -// +build gc #include "textflag.h" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/cap_freebsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/cap_freebsd.go index 0b7c6adb86..a08657890f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/cap_freebsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/cap_freebsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build freebsd -// +build freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/constants.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/constants.go index 394a3965b6..6fb7cb77d0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/constants.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/constants.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_aix_ppc.go index 65a998508d..d785134617 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_aix_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_aix_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc -// +build aix,ppc // Functions to access/create device major and minor numbers matching the // encoding used by AIX. diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go index 8fc08ad0aa..623a5e6973 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc64 -// +build aix,ppc64 // Functions to access/create device major and minor numbers matching the // encoding used AIX. diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_zos.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_zos.go index a388e59a0e..bb6a64fe92 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_zos.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dev_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Functions to access/create device major and minor numbers matching the // encoding used by z/OS. diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dirent.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dirent.go index 2499f977b0..1ebf117826 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dirent.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/dirent.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/endian_big.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/endian_big.go index a520265576..1095fd31d6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/endian_big.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/endian_big.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 -// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/endian_little.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/endian_little.go index b0f2bc4ae3..b9f0e277b1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/endian_little.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/endian_little.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh -// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/env_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/env_unix.go index 29ccc4d133..a96da71f47 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/env_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/env_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Unix environment variables. diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/epoll_zos.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/epoll_zos.go index cedaf7e024..7753fddea8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/epoll_zos.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/epoll_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fcntl.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fcntl.go index e9b991258c..6200876fb2 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fcntl.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fcntl.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build dragonfly || freebsd || linux || netbsd || openbsd -// +build dragonfly freebsd linux netbsd openbsd +//go:build dragonfly || freebsd || linux || netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go index 29d44808b1..13b4acd5c6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc) -// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fdset.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fdset.go index a8068f94f2..9e83d18cd0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fdset.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fdset.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fstatfs_zos.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fstatfs_zos.go index e377cc9f49..c8bde601e7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fstatfs_zos.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/fstatfs_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo.go index b06f52d748..aca5721ddc 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && !aix && !hurd -// +build gccgo,!aix,!hurd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo_c.c b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo_c.c index f98a1c542f..d468b7b47f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo_c.c +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo_c.c @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && !aix && !hurd -// +build gccgo,!aix,!hurd #include #include diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go index e60e49a3d9..972d61bd75 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gccgo && linux && amd64 -// +build gccgo,linux,amd64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ifreq_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ifreq_linux.go index 15721a5104..848840ae4c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ifreq_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux -// +build linux package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_linux.go index 0d12c0851a..dbe680eab8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_linux.go @@ -231,3 +231,8 @@ func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) { func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error { return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value)) } + +// IoctlLoopConfigure configures all loop device parameters in a single step +func IoctlLoopConfigure(fd int, value *LoopConfig) error { + return ioctlPtr(fd, LOOP_CONFIGURE, unsafe.Pointer(value)) +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_signed.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_signed.go index 7def9580e6..5b0759bd86 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_signed.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_signed.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || solaris -// +build aix solaris package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_unsigned.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_unsigned.go index 649913d1ea..20f470b9d0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_unsigned.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_unsigned.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd -// +build darwin dragonfly freebsd hurd linux netbsd openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_zos.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_zos.go index cdc21bf76d..c8b2a750f8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_zos.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ioctl_zos.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mkall.sh b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mkall.sh index 8e3947c368..e6f31d374d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mkall.sh +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mkall.sh @@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then # Use the Docker-based build system # Files generated through docker (use $cmd so you can Ctl-C the build or run) $cmd docker build --tag generate:$GOOS $GOOS - $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS + $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS exit fi diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mkerrors.sh b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mkerrors.sh index be0423e685..fdcaa974d2 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -248,6 +248,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -283,10 +284,6 @@ struct ltchars { #include #endif -#ifndef MSG_FASTOPEN -#define MSG_FASTOPEN 0x20000000 -#endif - #ifndef PTRACE_GETREGS #define PTRACE_GETREGS 0xc #endif @@ -295,14 +292,6 @@ struct ltchars { #define PTRACE_SETREGS 0xd #endif -#ifndef SOL_NETLINK -#define SOL_NETLINK 270 -#endif - -#ifndef SOL_SMC -#define SOL_SMC 286 -#endif - #ifdef SOL_BLUETOOTH // SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h // but it is already in bluetooth_linux.go @@ -319,10 +308,23 @@ struct ltchars { #undef TIPC_WAIT_FOREVER #define TIPC_WAIT_FOREVER 0xffffffff -// Copied from linux/l2tp.h -// Including linux/l2tp.h here causes conflicts between linux/in.h -// and netinet/in.h included via net/route.h above. -#define IPPROTO_L2TP 115 +// Copied from linux/netfilter/nf_nat.h +// Including linux/netfilter/nf_nat.h here causes conflicts between linux/in.h +// and netinet/in.h. +#define NF_NAT_RANGE_MAP_IPS (1 << 0) +#define NF_NAT_RANGE_PROTO_SPECIFIED (1 << 1) +#define NF_NAT_RANGE_PROTO_RANDOM (1 << 2) +#define NF_NAT_RANGE_PERSISTENT (1 << 3) +#define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4) +#define NF_NAT_RANGE_PROTO_OFFSET (1 << 5) +#define NF_NAT_RANGE_NETMAP (1 << 6) +#define NF_NAT_RANGE_PROTO_RANDOM_ALL \ + (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY) +#define NF_NAT_RANGE_MASK \ + (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \ + NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \ + NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET | \ + NF_NAT_RANGE_NETMAP) // Copied from linux/hid.h. // Keep in sync with the size of the referenced fields. @@ -519,7 +521,8 @@ ccflags="$@" $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LO_(KEY|NAME)_SIZE$/ || $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || - $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ || + $2 == "LOOP_CONFIGURE" || + $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ || $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || $2 ~ /^NFC_.*_(MAX)?SIZE$/ || $2 ~ /^RAW_PAYLOAD_/ || @@ -560,7 +563,7 @@ ccflags="$@" $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ || $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ || $2 ~ /^CLONE_[A-Z_]+/ || - $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ && + $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+|BPF_F_LINK)$/ && $2 ~ /^(BPF|DLT)_/ || $2 ~ /^AUDIT_/ || $2 ~ /^(CLOCK|TIMER)_/ || @@ -581,8 +584,9 @@ ccflags="$@" $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ || $2 ~ /^KEYCTL_/ || $2 ~ /^PERF_/ || - $2 ~ /^SECCOMP_MODE_/ || + $2 ~ /^SECCOMP_/ || $2 ~ /^SEEK_/ || + $2 ~ /^SCHED_/ || $2 ~ /^SPLICE_/ || $2 ~ /^SYNC_FILE_RANGE_/ || $2 !~ /IOC_MAGIC/ && @@ -601,6 +605,9 @@ ccflags="$@" $2 ~ /^FSOPT_/ || $2 ~ /^WDIO[CFS]_/ || $2 ~ /^NFN/ || + $2 !~ /^NFT_META_IIFTYPE/ && + $2 ~ /^NFT_/ || + $2 ~ /^NF_NAT_/ || $2 ~ /^XDP_/ || $2 ~ /^RWF_/ || $2 ~ /^(HDIO|WIN|SMART)_/ || @@ -624,7 +631,7 @@ ccflags="$@" $2 ~ /^MEM/ || $2 ~ /^WG/ || $2 ~ /^FIB_RULE_/ || - $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)} + $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE|IOMIN$|IOOPT$|ALIGNOFF$|DISCARD|ROTATIONAL$|ZEROOUT$|GETDISKSEQ$)/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^__WCOREFLAG$/ {next} $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)} @@ -662,7 +669,6 @@ echo '// mkerrors.sh' "$@" echo '// Code generated by the command above; see README.md. DO NOT EDIT.' echo echo "//go:build ${GOARCH} && ${GOOS}" -echo "// +build ${GOARCH},${GOOS}" echo go tool cgo -godefs -- "$@" _const.go >_error.out cat _error.out | grep -vf _error.grep | grep -vf _signal.grep @@ -741,7 +747,8 @@ main(void) e = errors[i].num; if(i > 0 && errors[i-1].num == e) continue; - strcpy(buf, strerror(e)); + strncpy(buf, strerror(e), sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; // lowercase first letter: Bad -> bad, but STREAM -> STREAM. if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z) buf[0] += a - A; @@ -760,7 +767,8 @@ main(void) e = signals[i].num; if(i > 0 && signals[i-1].num == e) continue; - strcpy(buf, strsignal(e)); + strncpy(buf, strsignal(e), sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; // lowercase first letter: Bad -> bad, but STREAM -> STREAM. if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z) buf[0] += a - A; diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mmap_nomremap.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mmap_nomremap.go new file mode 100644 index 0000000000..4b68e59780 --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mmap_nomremap.go @@ -0,0 +1,13 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris + +package unix + +var mapper = &mmapper{ + active: make(map[*byte][]byte), + mmap: mmap, + munmap: munmap, +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mremap.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mremap.go new file mode 100644 index 0000000000..fd45fe529d --- /dev/null +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/mremap.go @@ -0,0 +1,52 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux || netbsd + +package unix + +import "unsafe" + +type mremapMmapper struct { + mmapper + mremap func(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (xaddr uintptr, err error) +} + +var mapper = &mremapMmapper{ + mmapper: mmapper{ + active: make(map[*byte][]byte), + mmap: mmap, + munmap: munmap, + }, + mremap: mremap, +} + +func (m *mremapMmapper) Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) { + if newLength <= 0 || len(oldData) == 0 || len(oldData) != cap(oldData) || flags&mremapFixed != 0 { + return nil, EINVAL + } + + pOld := &oldData[cap(oldData)-1] + m.Lock() + defer m.Unlock() + bOld := m.active[pOld] + if bOld == nil || &bOld[0] != &oldData[0] { + return nil, EINVAL + } + newAddr, errno := m.mremap(uintptr(unsafe.Pointer(&bOld[0])), uintptr(len(bOld)), uintptr(newLength), flags, 0) + if errno != nil { + return nil, errno + } + bNew := unsafe.Slice((*byte)(unsafe.Pointer(newAddr)), newLength) + pNew := &bNew[cap(bNew)-1] + if flags&mremapDontunmap == 0 { + delete(m.active, pOld) + } + m.active[pNew] = bNew + return bNew, nil +} + +func Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) { + return mapper.Mremap(oldData, newLength, flags) +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/pagesize_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/pagesize_unix.go index 53f1b4c5b8..4d0a3430ed 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/pagesize_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/pagesize_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris // For Unix, get the pagesize from the runtime. diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/pledge_openbsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/pledge_openbsd.go index eb48294b27..6a09af53e6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/pledge_openbsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/pledge_openbsd.go @@ -8,54 +8,31 @@ import ( "errors" "fmt" "strconv" - "syscall" - "unsafe" ) // Pledge implements the pledge syscall. // -// The pledge syscall does not accept execpromises on OpenBSD releases -// before 6.3. -// -// execpromises must be empty when Pledge is called on OpenBSD -// releases predating 6.3, otherwise an error will be returned. +// This changes both the promises and execpromises; use PledgePromises or +// PledgeExecpromises to only change the promises or execpromises +// respectively. // // For more information see pledge(2). func Pledge(promises, execpromises string) error { - maj, min, err := majmin() - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - err = pledgeAvailable(maj, min, execpromises) + pptr, err := BytePtrFromString(promises) if err != nil { return err } - pptr, err := syscall.BytePtrFromString(promises) + exptr, err := BytePtrFromString(execpromises) if err != nil { return err } - // This variable will hold either a nil unsafe.Pointer or - // an unsafe.Pointer to a string (execpromises). - var expr unsafe.Pointer - - // If we're running on OpenBSD > 6.2, pass execpromises to the syscall. - if maj > 6 || (maj == 6 && min > 2) { - exptr, err := syscall.BytePtrFromString(execpromises) - if err != nil { - return err - } - expr = unsafe.Pointer(exptr) - } - - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0) - if e != 0 { - return e - } - - return nil + return pledge(pptr, exptr) } // PledgePromises implements the pledge syscall. @@ -64,30 +41,16 @@ func Pledge(promises, execpromises string) error { // // For more information see pledge(2). func PledgePromises(promises string) error { - maj, min, err := majmin() - if err != nil { - return err - } - - err = pledgeAvailable(maj, min, "") - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - // This variable holds the execpromises and is always nil. - var expr unsafe.Pointer - - pptr, err := syscall.BytePtrFromString(promises) + pptr, err := BytePtrFromString(promises) if err != nil { return err } - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0) - if e != 0 { - return e - } - - return nil + return pledge(pptr, nil) } // PledgeExecpromises implements the pledge syscall. @@ -96,30 +59,16 @@ func PledgePromises(promises string) error { // // For more information see pledge(2). func PledgeExecpromises(execpromises string) error { - maj, min, err := majmin() - if err != nil { + if err := pledgeAvailable(); err != nil { return err } - err = pledgeAvailable(maj, min, execpromises) + exptr, err := BytePtrFromString(execpromises) if err != nil { return err } - // This variable holds the promises and is always nil. - var pptr unsafe.Pointer - - exptr, err := syscall.BytePtrFromString(execpromises) - if err != nil { - return err - } - - _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0) - if e != 0 { - return e - } - - return nil + return pledge(nil, exptr) } // majmin returns major and minor version number for an OpenBSD system. @@ -147,16 +96,15 @@ func majmin() (major int, minor int, err error) { // pledgeAvailable checks for availability of the pledge(2) syscall // based on the running OpenBSD version. -func pledgeAvailable(maj, min int, execpromises string) error { - // If OpenBSD <= 5.9, pledge is not available. - if (maj == 5 && min != 9) || maj < 5 { - return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min) +func pledgeAvailable() error { + maj, min, err := majmin() + if err != nil { + return err } - // If OpenBSD <= 6.2 and execpromises is not empty, - // return an error - execpromises is not available before 6.3 - if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" { - return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min) + // Require OpenBSD 6.4 as a minimum. + if maj < 6 || (maj == 6 && min <= 3) { + return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj, min) } return nil diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ptrace_darwin.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ptrace_darwin.go index 39dba6ca6a..3f0975f3de 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ptrace_darwin.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ptrace_darwin.go @@ -3,16 +3,9 @@ // license that can be found in the LICENSE file. //go:build darwin && !ios -// +build darwin,!ios package unix -import "unsafe" - func ptrace(request int, pid int, addr uintptr, data uintptr) error { return ptrace1(request, pid, addr, data) } - -func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) error { - return ptrace1Ptr(request, pid, addr, data) -} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ptrace_ios.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ptrace_ios.go index 9ea66330a9..a4d35db5dc 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ptrace_ios.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ptrace_ios.go @@ -3,16 +3,9 @@ // license that can be found in the LICENSE file. //go:build ios -// +build ios package unix -import "unsafe" - func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { return ENOTSUP } - -func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { - return ENOTSUP -} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/race.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/race.go index 6f6c5fec5a..714d2aae7c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/race.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/race.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin && race) || (linux && race) || (freebsd && race) -// +build darwin,race linux,race freebsd,race package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/race0.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/race0.go index 706e1322ae..4a9f6634c9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/race0.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/race0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos -// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/readdirent_getdents.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/readdirent_getdents.go index 4d6257569e..dbd2b6ccb1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/readdirent_getdents.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/readdirent_getdents.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || dragonfly || freebsd || linux || netbsd || openbsd -// +build aix dragonfly freebsd linux netbsd openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go index 2a4ba47c45..130398b6b7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin -// +build darwin package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sockcmsg_unix.go index 3865943f6e..c3a62dbb1b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sockcmsg_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sockcmsg_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Socket control messages diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go index 0840fe4a57..4a1eab37ec 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin freebsd linux netbsd openbsd solaris zos package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall.go index 63e8c83831..5ea74da982 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Package unix contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix.go index c406ae00f4..67ce6cef2d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix -// +build aix // Aix system calls. // This file is compiled as ordinary Go code, @@ -107,7 +106,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- @@ -487,8 +487,6 @@ func Fsync(fd int) error { //sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys write(fd int, p []byte) (n int, err error) -//sys readlen(fd int, p *byte, np int) (n int, err error) = read -//sys writelen(fd int, p *byte, np int) (n int, err error) = write //sys Dup2(oldfd int, newfd int) (err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64 @@ -535,21 +533,6 @@ func Fsync(fd int) error { //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg //sys munmap(addr uintptr, length uintptr) (err error) - -var mapper = &mmapper{ - active: make(map[*byte][]byte), - mmap: mmap, - munmap: munmap, -} - -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return mapper.Mmap(fd, offset, length, prot, flags) -} - -func Munmap(b []byte) (err error) { - return mapper.Munmap(b) -} - //sys Madvise(b []byte, advice int) (err error) //sys Mprotect(b []byte, prot int) (err error) //sys Mlock(b []byte) (err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go index f2871fa953..1fdaa47600 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc -// +build aix,ppc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go index 75718ec0f1..c87f9a9f45 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix && ppc64 -// +build aix,ppc64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_bsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_bsd.go index 7705c3270b..a00c3e5450 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || netbsd || openbsd -// +build darwin dragonfly freebsd netbsd openbsd // BSD system call wrappers shared by *BSD based systems // including OS X (Darwin) and FreeBSD. Like the other @@ -317,7 +316,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { if err != nil { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) @@ -601,20 +600,6 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { // Gethostuuid(uuid *byte, timeout *Timespec) (err error) // Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, err error) -var mapper = &mmapper{ - active: make(map[*byte][]byte), - mmap: mmap, - munmap: munmap, -} - -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return mapper.Mmap(fd, offset, length, prot, flags) -} - -func Munmap(b []byte) (err error) { - return mapper.Munmap(b) -} - //sys Madvise(b []byte, behav int) (err error) //sys Mlock(b []byte) (err error) //sys Mlockall(flags int) (err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin.go index 206921504c..59542a897d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -510,30 +510,36 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { return nil, err } - // Find size. - n := uintptr(0) - if err := sysctl(mib, nil, &n, nil, 0); err != nil { - return nil, err - } - if n == 0 { - return nil, nil - } - if n%SizeofKinfoProc != 0 { - return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) - } + for { + // Find size. + n := uintptr(0) + if err := sysctl(mib, nil, &n, nil, 0); err != nil { + return nil, err + } + if n == 0 { + return nil, nil + } + if n%SizeofKinfoProc != 0 { + return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) + } - // Read into buffer of that size. - buf := make([]KinfoProc, n/SizeofKinfoProc) - if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil { - return nil, err - } - if n%SizeofKinfoProc != 0 { - return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) - } + // Read into buffer of that size. + buf := make([]KinfoProc, n/SizeofKinfoProc) + if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil { + if err == ENOMEM { + // Process table grew. Try again. + continue + } + return nil, err + } + if n%SizeofKinfoProc != 0 { + return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) + } - // The actual call may return less than the original reported required - // size so ensure we deal with that. - return buf[:n/SizeofKinfoProc], nil + // The actual call may return less than the original reported required + // size so ensure we deal with that. + return buf[:n/SizeofKinfoProc], nil + } } //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) @@ -638,189 +644,3 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) -//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ -//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE - -/* - * Unimplemented - */ -// Profil -// Sigaction -// Sigprocmask -// Getlogin -// Sigpending -// Sigaltstack -// Ioctl -// Reboot -// Execve -// Vfork -// Sbrk -// Sstk -// Ovadvise -// Mincore -// Setitimer -// Swapon -// Select -// Sigsuspend -// Readv -// Writev -// Nfssvc -// Getfh -// Quotactl -// Csops -// Waitid -// Add_profil -// Kdebug_trace -// Sigreturn -// Atsocket -// Kqueue_from_portset_np -// Kqueue_portset -// Getattrlist -// Getdirentriesattr -// Searchfs -// Delete -// Copyfile -// Watchevent -// Waitevent -// Modwatch -// Fsctl -// Initgroups -// Posix_spawn -// Nfsclnt -// Fhopen -// Minherit -// Semsys -// Msgsys -// Shmsys -// Semctl -// Semget -// Semop -// Msgctl -// Msgget -// Msgsnd -// Msgrcv -// Shm_open -// Shm_unlink -// Sem_open -// Sem_close -// Sem_unlink -// Sem_wait -// Sem_trywait -// Sem_post -// Sem_getvalue -// Sem_init -// Sem_destroy -// Open_extended -// Umask_extended -// Stat_extended -// Lstat_extended -// Fstat_extended -// Chmod_extended -// Fchmod_extended -// Access_extended -// Settid -// Gettid -// Setsgroups -// Getsgroups -// Setwgroups -// Getwgroups -// Mkfifo_extended -// Mkdir_extended -// Identitysvc -// Shared_region_check_np -// Shared_region_map_np -// __pthread_mutex_destroy -// __pthread_mutex_init -// __pthread_mutex_lock -// __pthread_mutex_trylock -// __pthread_mutex_unlock -// __pthread_cond_init -// __pthread_cond_destroy -// __pthread_cond_broadcast -// __pthread_cond_signal -// Setsid_with_pid -// __pthread_cond_timedwait -// Aio_fsync -// Aio_return -// Aio_suspend -// Aio_cancel -// Aio_error -// Aio_read -// Aio_write -// Lio_listio -// __pthread_cond_wait -// Iopolicysys -// __pthread_kill -// __pthread_sigmask -// __sigwait -// __disable_threadsignal -// __pthread_markcancel -// __pthread_canceled -// __semwait_signal -// Proc_info -// sendfile -// Stat64_extended -// Lstat64_extended -// Fstat64_extended -// __pthread_chdir -// __pthread_fchdir -// Audit -// Auditon -// Getauid -// Setauid -// Getaudit -// Setaudit -// Getaudit_addr -// Setaudit_addr -// Auditctl -// Bsdthread_create -// Bsdthread_terminate -// Stack_snapshot -// Bsdthread_register -// Workq_open -// Workq_ops -// __mac_execve -// __mac_syscall -// __mac_get_file -// __mac_set_file -// __mac_get_link -// __mac_set_link -// __mac_get_proc -// __mac_set_proc -// __mac_get_fd -// __mac_set_fd -// __mac_get_pid -// __mac_get_lcid -// __mac_get_lctx -// __mac_set_lctx -// Setlcid -// Read_nocancel -// Write_nocancel -// Open_nocancel -// Close_nocancel -// Wait4_nocancel -// Recvmsg_nocancel -// Sendmsg_nocancel -// Recvfrom_nocancel -// Accept_nocancel -// Fcntl_nocancel -// Select_nocancel -// Fsync_nocancel -// Connect_nocancel -// Sigsuspend_nocancel -// Readv_nocancel -// Writev_nocancel -// Sendto_nocancel -// Pread_nocancel -// Pwrite_nocancel -// Waitid_nocancel -// Poll_nocancel -// Msgsnd_nocancel -// Msgrcv_nocancel -// Sem_wait_nocancel -// Aio_suspend_nocancel -// __sigwait_nocancel -// __semwait_signal_nocancel -// __mac_mount -// __mac_get_mount -// __mac_getfsstat diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index 9fa879806b..0eaecf5fc3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && darwin -// +build amd64,darwin package unix @@ -47,6 +46,5 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace -//sys ptrace1Ptr(request int, pid int, addr unsafe.Pointer, data uintptr) (err error) = SYS_ptrace //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go index f17b8c526a..f36c6707cf 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && darwin -// +build arm64,darwin package unix @@ -47,6 +46,5 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT //sys Lstat(path string, stat *Stat_t) (err error) //sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace -//sys ptrace1Ptr(request int, pid int, addr unsafe.Pointer, data uintptr) (err error) = SYS_ptrace //sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, stat *Statfs_t) (err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go index 53c96641f8..2f0fa76e4f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build darwin && go1.12 -// +build darwin,go1.12 +//go:build darwin package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index d4ce988e72..97cb916f2c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -343,203 +343,5 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) -//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ -//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) - -/* - * Unimplemented - * TODO(jsing): Update this list for DragonFly. - */ -// Profil -// Sigaction -// Sigprocmask -// Getlogin -// Sigpending -// Sigaltstack -// Reboot -// Execve -// Vfork -// Sbrk -// Sstk -// Ovadvise -// Mincore -// Setitimer -// Swapon -// Select -// Sigsuspend -// Readv -// Writev -// Nfssvc -// Getfh -// Quotactl -// Mount -// Csops -// Waitid -// Add_profil -// Kdebug_trace -// Sigreturn -// Atsocket -// Kqueue_from_portset_np -// Kqueue_portset -// Getattrlist -// Setattrlist -// Getdirentriesattr -// Searchfs -// Delete -// Copyfile -// Watchevent -// Waitevent -// Modwatch -// Getxattr -// Fgetxattr -// Setxattr -// Fsetxattr -// Removexattr -// Fremovexattr -// Listxattr -// Flistxattr -// Fsctl -// Initgroups -// Posix_spawn -// Nfsclnt -// Fhopen -// Minherit -// Semsys -// Msgsys -// Shmsys -// Semctl -// Semget -// Semop -// Msgctl -// Msgget -// Msgsnd -// Msgrcv -// Shmat -// Shmctl -// Shmdt -// Shmget -// Shm_open -// Shm_unlink -// Sem_open -// Sem_close -// Sem_unlink -// Sem_wait -// Sem_trywait -// Sem_post -// Sem_getvalue -// Sem_init -// Sem_destroy -// Open_extended -// Umask_extended -// Stat_extended -// Lstat_extended -// Fstat_extended -// Chmod_extended -// Fchmod_extended -// Access_extended -// Settid -// Gettid -// Setsgroups -// Getsgroups -// Setwgroups -// Getwgroups -// Mkfifo_extended -// Mkdir_extended -// Identitysvc -// Shared_region_check_np -// Shared_region_map_np -// __pthread_mutex_destroy -// __pthread_mutex_init -// __pthread_mutex_lock -// __pthread_mutex_trylock -// __pthread_mutex_unlock -// __pthread_cond_init -// __pthread_cond_destroy -// __pthread_cond_broadcast -// __pthread_cond_signal -// Setsid_with_pid -// __pthread_cond_timedwait -// Aio_fsync -// Aio_return -// Aio_suspend -// Aio_cancel -// Aio_error -// Aio_read -// Aio_write -// Lio_listio -// __pthread_cond_wait -// Iopolicysys -// __pthread_kill -// __pthread_sigmask -// __sigwait -// __disable_threadsignal -// __pthread_markcancel -// __pthread_canceled -// __semwait_signal -// Proc_info -// Stat64_extended -// Lstat64_extended -// Fstat64_extended -// __pthread_chdir -// __pthread_fchdir -// Audit -// Auditon -// Getauid -// Setauid -// Getaudit -// Setaudit -// Getaudit_addr -// Setaudit_addr -// Auditctl -// Bsdthread_create -// Bsdthread_terminate -// Stack_snapshot -// Bsdthread_register -// Workq_open -// Workq_ops -// __mac_execve -// __mac_syscall -// __mac_get_file -// __mac_set_file -// __mac_get_link -// __mac_set_link -// __mac_get_proc -// __mac_set_proc -// __mac_get_fd -// __mac_set_fd -// __mac_get_pid -// __mac_get_lcid -// __mac_get_lctx -// __mac_set_lctx -// Setlcid -// Read_nocancel -// Write_nocancel -// Open_nocancel -// Close_nocancel -// Wait4_nocancel -// Recvmsg_nocancel -// Sendmsg_nocancel -// Recvfrom_nocancel -// Accept_nocancel -// Fcntl_nocancel -// Select_nocancel -// Fsync_nocancel -// Connect_nocancel -// Sigsuspend_nocancel -// Readv_nocancel -// Writev_nocancel -// Sendto_nocancel -// Pread_nocancel -// Pwrite_nocancel -// Waitid_nocancel -// Msgsnd_nocancel -// Msgrcv_nocancel -// Sem_wait_nocancel -// Aio_suspend_nocancel -// __sigwait_nocancel -// __semwait_signal_nocancel -// __mac_mount -// __mac_get_mount -// __mac_getfsstat diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go index 4e2d32120a..14bab6b2de 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd.go index afb10106f6..2b57e0f73b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -13,6 +13,7 @@ package unix import ( + "errors" "sync" "unsafe" ) @@ -169,25 +170,26 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { func Uname(uname *Utsname) error { mib := []_C_int{CTL_KERN, KERN_OSTYPE} n := unsafe.Sizeof(uname.Sysname) - if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil { + // Suppress ENOMEM errors to be compatible with the C library __xuname() implementation. + if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) { return err } mib = []_C_int{CTL_KERN, KERN_HOSTNAME} n = unsafe.Sizeof(uname.Nodename) - if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil { + if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) { return err } mib = []_C_int{CTL_KERN, KERN_OSRELEASE} n = unsafe.Sizeof(uname.Release) - if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil { + if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) { return err } mib = []_C_int{CTL_KERN, KERN_VERSION} n = unsafe.Sizeof(uname.Version) - if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil { + if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) { return err } @@ -205,7 +207,7 @@ func Uname(uname *Utsname) error { mib = []_C_int{CTL_HW, HW_MACHINE} n = unsafe.Sizeof(uname.Machine) - if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil { + if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) { return err } @@ -449,197 +451,5 @@ func Dup3(oldfd, newfd, flags int) error { //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) -//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ -//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) - -/* - * Unimplemented - */ -// Profil -// Sigaction -// Sigprocmask -// Getlogin -// Sigpending -// Sigaltstack -// Ioctl -// Reboot -// Execve -// Vfork -// Sbrk -// Sstk -// Ovadvise -// Mincore -// Setitimer -// Swapon -// Select -// Sigsuspend -// Readv -// Writev -// Nfssvc -// Getfh -// Quotactl -// Mount -// Csops -// Waitid -// Add_profil -// Kdebug_trace -// Sigreturn -// Atsocket -// Kqueue_from_portset_np -// Kqueue_portset -// Getattrlist -// Setattrlist -// Getdents -// Getdirentriesattr -// Searchfs -// Delete -// Copyfile -// Watchevent -// Waitevent -// Modwatch -// Fsctl -// Initgroups -// Posix_spawn -// Nfsclnt -// Fhopen -// Minherit -// Semsys -// Msgsys -// Shmsys -// Semctl -// Semget -// Semop -// Msgctl -// Msgget -// Msgsnd -// Msgrcv -// Shmat -// Shmctl -// Shmdt -// Shmget -// Shm_open -// Shm_unlink -// Sem_open -// Sem_close -// Sem_unlink -// Sem_wait -// Sem_trywait -// Sem_post -// Sem_getvalue -// Sem_init -// Sem_destroy -// Open_extended -// Umask_extended -// Stat_extended -// Lstat_extended -// Fstat_extended -// Chmod_extended -// Fchmod_extended -// Access_extended -// Settid -// Gettid -// Setsgroups -// Getsgroups -// Setwgroups -// Getwgroups -// Mkfifo_extended -// Mkdir_extended -// Identitysvc -// Shared_region_check_np -// Shared_region_map_np -// __pthread_mutex_destroy -// __pthread_mutex_init -// __pthread_mutex_lock -// __pthread_mutex_trylock -// __pthread_mutex_unlock -// __pthread_cond_init -// __pthread_cond_destroy -// __pthread_cond_broadcast -// __pthread_cond_signal -// Setsid_with_pid -// __pthread_cond_timedwait -// Aio_fsync -// Aio_return -// Aio_suspend -// Aio_cancel -// Aio_error -// Aio_read -// Aio_write -// Lio_listio -// __pthread_cond_wait -// Iopolicysys -// __pthread_kill -// __pthread_sigmask -// __sigwait -// __disable_threadsignal -// __pthread_markcancel -// __pthread_canceled -// __semwait_signal -// Proc_info -// Stat64_extended -// Lstat64_extended -// Fstat64_extended -// __pthread_chdir -// __pthread_fchdir -// Audit -// Auditon -// Getauid -// Setauid -// Getaudit -// Setaudit -// Getaudit_addr -// Setaudit_addr -// Auditctl -// Bsdthread_create -// Bsdthread_terminate -// Stack_snapshot -// Bsdthread_register -// Workq_open -// Workq_ops -// __mac_execve -// __mac_syscall -// __mac_get_file -// __mac_set_file -// __mac_get_link -// __mac_set_link -// __mac_get_proc -// __mac_set_proc -// __mac_get_fd -// __mac_set_fd -// __mac_get_pid -// __mac_get_lcid -// __mac_get_lctx -// __mac_set_lctx -// Setlcid -// Read_nocancel -// Write_nocancel -// Open_nocancel -// Close_nocancel -// Wait4_nocancel -// Recvmsg_nocancel -// Sendmsg_nocancel -// Recvfrom_nocancel -// Accept_nocancel -// Fcntl_nocancel -// Select_nocancel -// Fsync_nocancel -// Connect_nocancel -// Sigsuspend_nocancel -// Readv_nocancel -// Writev_nocancel -// Sendto_nocancel -// Pread_nocancel -// Pwrite_nocancel -// Waitid_nocancel -// Poll_nocancel -// Msgsnd_nocancel -// Msgrcv_nocancel -// Sem_wait_nocancel -// Aio_suspend_nocancel -// __sigwait_nocancel -// __semwait_signal_nocancel -// __mac_mount -// __mac_get_mount -// __mac_getfsstat diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go index b8da510043..3967bca772 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go index 47155c4839..eff19ada23 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go index 08932093fa..4f24b517a6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go index d151a0d0e5..ac30759ece 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go index d5cd64b378..aab725ca77 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_hurd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_hurd.go index 381fd4673b..ba46651f8e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_hurd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_hurd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build hurd -// +build hurd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_hurd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_hurd_386.go index 7cf54a3e4f..df89f9e6b4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_hurd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_hurd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && hurd -// +build 386,hurd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_illumos.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_illumos.go index 87db5a6a8c..a863f7052c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_illumos.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_illumos.go @@ -5,7 +5,6 @@ // illumos system calls not present on Solaris. //go:build amd64 && illumos -// +build amd64,illumos package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux.go index fbaeb5fff1..5682e2628a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -61,15 +61,23 @@ func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) ( } //sys fchmodat(dirfd int, path string, mode uint32) (err error) - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - // Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior - // and check the flags. Otherwise the mode would be applied to the symlink - // destination which is not what the user expects. - if flags&^AT_SYMLINK_NOFOLLOW != 0 { - return EINVAL - } else if flags&AT_SYMLINK_NOFOLLOW != 0 { - return EOPNOTSUPP +//sys fchmodat2(dirfd int, path string, mode uint32, flags int) (err error) + +func Fchmodat(dirfd int, path string, mode uint32, flags int) error { + // Linux fchmodat doesn't support the flags parameter, but fchmodat2 does. + // Try fchmodat2 if flags are specified. + if flags != 0 { + err := fchmodat2(dirfd, path, mode, flags) + if err == ENOSYS { + // fchmodat2 isn't available. If the flags are known to be valid, + // return EOPNOTSUPP to indicate that fchmodat doesn't support them. + if flags&^(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 { + return EINVAL + } else if flags&(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 { + return EOPNOTSUPP + } + } + return err } return fchmodat(dirfd, path, mode) } @@ -417,7 +425,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- @@ -693,10 +702,10 @@ type SockaddrALG struct { func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) { // Leave room for NUL byte terminator. - if len(sa.Type) > 13 { + if len(sa.Type) > len(sa.raw.Type)-1 { return nil, 0, EINVAL } - if len(sa.Name) > 63 { + if len(sa.Name) > len(sa.raw.Name)-1 { return nil, 0, EINVAL } @@ -704,17 +713,8 @@ func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Feat = sa.Feature sa.raw.Mask = sa.Mask - typ, err := ByteSliceFromString(sa.Type) - if err != nil { - return nil, 0, err - } - name, err := ByteSliceFromString(sa.Name) - if err != nil { - return nil, 0, err - } - - copy(sa.raw.Type[:], typ) - copy(sa.raw.Name[:], name) + copy(sa.raw.Type[:], sa.Type) + copy(sa.raw.Name[:], sa.Name) return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil } @@ -1310,7 +1310,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { return "", err } } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) { @@ -1699,12 +1699,23 @@ func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) { return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data) } +// elfNT_PRSTATUS is a copy of the debug/elf.NT_PRSTATUS constant so +// x/sys/unix doesn't need to depend on debug/elf and thus +// compress/zlib, debug/dwarf, and other packages. +const elfNT_PRSTATUS = 1 + func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) { - return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout)) + var iov Iovec + iov.Base = (*byte)(unsafe.Pointer(regsout)) + iov.SetLen(int(unsafe.Sizeof(*regsout))) + return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov)) } func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) { - return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs)) + var iov Iovec + iov.Base = (*byte)(unsafe.Pointer(regs)) + iov.SetLen(int(unsafe.Sizeof(*regs))) + return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov)) } func PtraceSetOptions(pid int, options int) (err error) { @@ -1838,6 +1849,105 @@ func Dup2(oldfd, newfd int) error { //sys Fsmount(fd int, flags int, mountAttrs int) (fsfd int, err error) //sys Fsopen(fsName string, flags int) (fd int, err error) //sys Fspick(dirfd int, pathName string, flags int) (fd int, err error) + +//sys fsconfig(fd int, cmd uint, key *byte, value *byte, aux int) (err error) + +func fsconfigCommon(fd int, cmd uint, key string, value *byte, aux int) (err error) { + var keyp *byte + if keyp, err = BytePtrFromString(key); err != nil { + return + } + return fsconfig(fd, cmd, keyp, value, aux) +} + +// FsconfigSetFlag is equivalent to fsconfig(2) called +// with cmd == FSCONFIG_SET_FLAG. +// +// fd is the filesystem context to act upon. +// key the parameter key to set. +func FsconfigSetFlag(fd int, key string) (err error) { + return fsconfigCommon(fd, FSCONFIG_SET_FLAG, key, nil, 0) +} + +// FsconfigSetString is equivalent to fsconfig(2) called +// with cmd == FSCONFIG_SET_STRING. +// +// fd is the filesystem context to act upon. +// key the parameter key to set. +// value is the parameter value to set. +func FsconfigSetString(fd int, key string, value string) (err error) { + var valuep *byte + if valuep, err = BytePtrFromString(value); err != nil { + return + } + return fsconfigCommon(fd, FSCONFIG_SET_STRING, key, valuep, 0) +} + +// FsconfigSetBinary is equivalent to fsconfig(2) called +// with cmd == FSCONFIG_SET_BINARY. +// +// fd is the filesystem context to act upon. +// key the parameter key to set. +// value is the parameter value to set. +func FsconfigSetBinary(fd int, key string, value []byte) (err error) { + if len(value) == 0 { + return EINVAL + } + return fsconfigCommon(fd, FSCONFIG_SET_BINARY, key, &value[0], len(value)) +} + +// FsconfigSetPath is equivalent to fsconfig(2) called +// with cmd == FSCONFIG_SET_PATH. +// +// fd is the filesystem context to act upon. +// key the parameter key to set. +// path is a non-empty path for specified key. +// atfd is a file descriptor at which to start lookup from or AT_FDCWD. +func FsconfigSetPath(fd int, key string, path string, atfd int) (err error) { + var valuep *byte + if valuep, err = BytePtrFromString(path); err != nil { + return + } + return fsconfigCommon(fd, FSCONFIG_SET_PATH, key, valuep, atfd) +} + +// FsconfigSetPathEmpty is equivalent to fsconfig(2) called +// with cmd == FSCONFIG_SET_PATH_EMPTY. The same as +// FconfigSetPath but with AT_PATH_EMPTY implied. +func FsconfigSetPathEmpty(fd int, key string, path string, atfd int) (err error) { + var valuep *byte + if valuep, err = BytePtrFromString(path); err != nil { + return + } + return fsconfigCommon(fd, FSCONFIG_SET_PATH_EMPTY, key, valuep, atfd) +} + +// FsconfigSetFd is equivalent to fsconfig(2) called +// with cmd == FSCONFIG_SET_FD. +// +// fd is the filesystem context to act upon. +// key the parameter key to set. +// value is a file descriptor to be assigned to specified key. +func FsconfigSetFd(fd int, key string, value int) (err error) { + return fsconfigCommon(fd, FSCONFIG_SET_FD, key, nil, value) +} + +// FsconfigCreate is equivalent to fsconfig(2) called +// with cmd == FSCONFIG_CMD_CREATE. +// +// fd is the filesystem context to act upon. +func FsconfigCreate(fd int) (err error) { + return fsconfig(fd, FSCONFIG_CMD_CREATE, nil, nil, 0) +} + +// FsconfigReconfigure is equivalent to fsconfig(2) called +// with cmd == FSCONFIG_CMD_RECONFIGURE. +// +// fd is the filesystem context to act upon. +func FsconfigReconfigure(fd int) (err error) { + return fsconfig(fd, FSCONFIG_CMD_RECONFIGURE, nil, nil, 0) +} + //sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64 //sysnb Getpgid(pid int) (pgid int, err error) @@ -1874,7 +1984,7 @@ func Getpgrp() (pid int) { //sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT //sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) -//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 +//sys pselect6(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_argpack) (n int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Removexattr(path string, attr string) (err error) //sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) @@ -1977,8 +2087,6 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) { //sys Unshare(flags int) (err error) //sys write(fd int, p []byte) (n int, err error) //sys exitThread(code int) (err error) = SYS_EXIT -//sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ -//sys writelen(fd int, p *byte, np int) (n int, err error) = SYS_WRITE //sys readv(fd int, iovs []Iovec) (n int, err error) = SYS_READV //sys writev(fd int, iovs []Iovec) (n int, err error) = SYS_WRITEV //sys preadv(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr) (n int, err error) = SYS_PREADV @@ -2113,21 +2221,7 @@ func writevRacedetect(iovecs []Iovec, n int) { // mmap varies by architecture; see syscall_linux_*.go. //sys munmap(addr uintptr, length uintptr) (err error) - -var mapper = &mmapper{ - active: make(map[*byte][]byte), - mmap: mmap, - munmap: munmap, -} - -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return mapper.Mmap(fd, offset, length, prot, flags) -} - -func Munmap(b []byte) (err error) { - return mapper.Munmap(b) -} - +//sys mremap(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (xaddr uintptr, err error) //sys Madvise(b []byte, advice int) (err error) //sys Mprotect(b []byte, prot int) (err error) //sys Mlock(b []byte) (err error) @@ -2136,6 +2230,12 @@ func Munmap(b []byte) (err error) { //sys Munlock(b []byte) (err error) //sys Munlockall() (err error) +const ( + mremapFixed = MREMAP_FIXED + mremapDontunmap = MREMAP_DONTUNMAP + mremapMaymove = MREMAP_MAYMOVE +) + // Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd, // using the specified flags. func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) { @@ -2420,99 +2520,75 @@ func PthreadSigmask(how int, set, oldset *Sigset_t) error { return rtSigprocmask(how, set, oldset, _C__NSIG/8) } -/* - * Unimplemented - */ -// AfsSyscall -// ArchPrctl -// Brk -// ClockNanosleep -// ClockSettime -// Clone -// EpollCtlOld -// EpollPwait -// EpollWaitOld -// Execve -// Fork -// Futex -// GetKernelSyms -// GetMempolicy -// GetRobustList -// GetThreadArea -// Getpmsg -// IoCancel -// IoDestroy -// IoGetevents -// IoSetup -// IoSubmit -// IoprioGet -// IoprioSet -// KexecLoad -// LookupDcookie -// Mbind -// MigratePages -// Mincore -// ModifyLdt -// Mount -// MovePages -// MqGetsetattr -// MqNotify -// MqOpen -// MqTimedreceive -// MqTimedsend -// MqUnlink -// Mremap -// Msgctl -// Msgget -// Msgrcv -// Msgsnd -// Nfsservctl -// Personality -// Pselect6 -// Ptrace -// Putpmsg -// Quotactl -// Readahead -// Readv -// RemapFilePages -// RestartSyscall -// RtSigaction -// RtSigpending -// RtSigqueueinfo -// RtSigreturn -// RtSigsuspend -// RtSigtimedwait -// SchedGetPriorityMax -// SchedGetPriorityMin -// SchedGetparam -// SchedGetscheduler -// SchedRrGetInterval -// SchedSetparam -// SchedYield -// Security -// Semctl -// Semget -// Semop -// Semtimedop -// SetMempolicy -// SetRobustList -// SetThreadArea -// SetTidAddress -// Sigaltstack -// Swapoff -// Swapon -// Sysfs -// TimerCreate -// TimerDelete -// TimerGetoverrun -// TimerGettime -// TimerSettime -// Tkill (obsolete) -// Tuxcall -// Umount2 -// Uselib -// Utimensat -// Vfork -// Vhangup -// Vserver -// _Sysctl +//sysnb getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) +//sysnb getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) + +func Getresuid() (ruid, euid, suid int) { + var r, e, s _C_int + getresuid(&r, &e, &s) + return int(r), int(e), int(s) +} + +func Getresgid() (rgid, egid, sgid int) { + var r, e, s _C_int + getresgid(&r, &e, &s) + return int(r), int(e), int(s) +} + +// Pselect is a wrapper around the Linux pselect6 system call. +// This version does not modify the timeout argument. +func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { + // Per https://man7.org/linux/man-pages/man2/select.2.html#NOTES, + // The Linux pselect6() system call modifies its timeout argument. + // [Not modifying the argument] is the behavior required by POSIX.1-2001. + var mutableTimeout *Timespec + if timeout != nil { + mutableTimeout = new(Timespec) + *mutableTimeout = *timeout + } + + // The final argument of the pselect6() system call is not a + // sigset_t * pointer, but is instead a structure + var kernelMask *sigset_argpack + if sigmask != nil { + wordBits := 32 << (^uintptr(0) >> 63) // see math.intSize + + // A sigset stores one bit per signal, + // offset by 1 (because signal 0 does not exist). + // So the number of words needed is ⌈__C_NSIG - 1 / wordBits⌉. + sigsetWords := (_C__NSIG - 1 + wordBits - 1) / (wordBits) + + sigsetBytes := uintptr(sigsetWords * (wordBits / 8)) + kernelMask = &sigset_argpack{ + ss: sigmask, + ssLen: sigsetBytes, + } + } + + return pselect6(nfd, r, w, e, mutableTimeout, kernelMask) +} + +//sys schedSetattr(pid int, attr *SchedAttr, flags uint) (err error) +//sys schedGetattr(pid int, attr *SchedAttr, size uint, flags uint) (err error) + +// SchedSetAttr is a wrapper for sched_setattr(2) syscall. +// https://man7.org/linux/man-pages/man2/sched_setattr.2.html +func SchedSetAttr(pid int, attr *SchedAttr, flags uint) error { + if attr == nil { + return EINVAL + } + attr.Size = SizeofSchedAttr + return schedSetattr(pid, attr, flags) +} + +// SchedGetAttr is a wrapper for sched_getattr(2) syscall. +// https://man7.org/linux/man-pages/man2/sched_getattr.2.html +func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { + attr := &SchedAttr{} + if err := schedGetattr(pid, attr, SizeofSchedAttr, flags); err != nil { + return nil, err + } + return attr, nil +} + +//sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_386.go index c7d9945ea1..506dafa7b4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && linux -// +build 386,linux package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go index 08086ac6a4..38d55641b5 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64) -// +build linux -// +build 386 amd64 mips mipsle mips64 mipsle ppc64 ppc64le ppc s390x sparc64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 5b21fcfd75..d557cf8de3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && linux -// +build amd64,linux package unix @@ -40,7 +39,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err if timeout != nil { ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} } - return Pselect(nfd, r, w, e, ts, nil) + return pselect6(nfd, r, w, e, ts, nil) } //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go index 8b0f0f3aa5..facdb83b23 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && linux && gc -// +build amd64,linux,gc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index da2986415a..cd2dd797fd 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && linux -// +build arm,linux package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index a81f5742b8..cf2ee6c75e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && linux -// +build arm64,linux package unix @@ -33,7 +32,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err if timeout != nil { ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} } - return Pselect(nfd, r, w, e, ts, nil) + return pselect6(nfd, r, w, e, ts, nil) } //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc.go index 2b1168d7d1..ffc4c2b635 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gc -// +build linux,gc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go index 9843fb4896..9ebfdcf447 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gc && 386 -// +build linux,gc,386 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go index a6008fccd5..5f2b57c4c2 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && gc && linux -// +build arm,gc,linux package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go index 7740af2428..d1a3ad8263 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gccgo && 386 -// +build linux,gccgo,386 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go index e16a12299a..f2f67423e9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && gccgo && arm -// +build linux,gccgo,arm package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go index 69d2d7c3db..3d0e98451f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build loong64 && linux -// +build loong64,linux package unix @@ -28,7 +27,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err if timeout != nil { ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} } - return Pselect(nfd, r, w, e, ts, nil) + return pselect6(nfd, r, w, e, ts, nil) } //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 76d564095e..70963a95ab 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) -// +build linux -// +build mips64 mips64le package unix @@ -31,7 +29,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err if timeout != nil { ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} } - return Pselect(nfd, r, w, e, ts, nil) + return pselect6(nfd, r, w, e, ts, nil) } //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index aae7f0ffd3..c218ebd280 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (mips || mipsle) -// +build linux -// +build mips mipsle package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go index 66eff19a32..e6c48500ca 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && ppc -// +build linux,ppc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 806aa2574d..7286a9aa88 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) -// +build linux -// +build ppc64 ppc64le package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 35851ef70b..6f5a288944 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && linux -// +build riscv64,linux package unix @@ -32,7 +31,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err if timeout != nil { ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} } - return Pselect(nfd, r, w, e, ts, nil) + return pselect6(nfd, r, w, e, ts, nil) } //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) @@ -177,3 +176,14 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error } return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) } + +//sys riscvHWProbe(pairs []RISCVHWProbePairs, cpuCount uintptr, cpus *CPUSet, flags uint) (err error) + +func RISCVHWProbe(pairs []RISCVHWProbePairs, set *CPUSet, flags uint) (err error) { + var setSize uintptr + + if set != nil { + setSize = uintptr(unsafe.Sizeof(*set)) + } + return riscvHWProbe(pairs, setSize, set, flags) +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index 2f89e8f5de..66f31210d0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build s390x && linux -// +build s390x,linux package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index 7ca064ae76..11d1f16986 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build sparc64 && linux -// +build sparc64,linux package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 018d7d4782..88162099af 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -356,266 +356,16 @@ func Statvfs(path string, buf *Statvfs_t) (err error) { //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) -//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ -//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) -/* - * Unimplemented - */ -// ____semctl13 -// __clone -// __fhopen40 -// __fhstat40 -// __fhstatvfs140 -// __fstat30 -// __getcwd -// __getfh30 -// __getlogin -// __lstat30 -// __mount50 -// __msgctl13 -// __msync13 -// __ntp_gettime30 -// __posix_chown -// __posix_fchown -// __posix_lchown -// __posix_rename -// __setlogin -// __shmctl13 -// __sigaction_sigtramp -// __sigaltstack14 -// __sigpending14 -// __sigprocmask14 -// __sigsuspend14 -// __sigtimedwait -// __stat30 -// __syscall -// __vfork14 -// _ksem_close -// _ksem_destroy -// _ksem_getvalue -// _ksem_init -// _ksem_open -// _ksem_post -// _ksem_trywait -// _ksem_unlink -// _ksem_wait -// _lwp_continue -// _lwp_create -// _lwp_ctl -// _lwp_detach -// _lwp_exit -// _lwp_getname -// _lwp_getprivate -// _lwp_kill -// _lwp_park -// _lwp_self -// _lwp_setname -// _lwp_setprivate -// _lwp_suspend -// _lwp_unpark -// _lwp_unpark_all -// _lwp_wait -// _lwp_wakeup -// _pset_bind -// _sched_getaffinity -// _sched_getparam -// _sched_setaffinity -// _sched_setparam -// acct -// aio_cancel -// aio_error -// aio_fsync -// aio_read -// aio_return -// aio_suspend -// aio_write -// break -// clock_getres -// clock_gettime -// clock_settime -// compat_09_ogetdomainname -// compat_09_osetdomainname -// compat_09_ouname -// compat_10_omsgsys -// compat_10_osemsys -// compat_10_oshmsys -// compat_12_fstat12 -// compat_12_getdirentries -// compat_12_lstat12 -// compat_12_msync -// compat_12_oreboot -// compat_12_oswapon -// compat_12_stat12 -// compat_13_sigaction13 -// compat_13_sigaltstack13 -// compat_13_sigpending13 -// compat_13_sigprocmask13 -// compat_13_sigreturn13 -// compat_13_sigsuspend13 -// compat_14___semctl -// compat_14_msgctl -// compat_14_shmctl -// compat_16___sigaction14 -// compat_16___sigreturn14 -// compat_20_fhstatfs -// compat_20_fstatfs -// compat_20_getfsstat -// compat_20_statfs -// compat_30___fhstat30 -// compat_30___fstat13 -// compat_30___lstat13 -// compat_30___stat13 -// compat_30_fhopen -// compat_30_fhstat -// compat_30_fhstatvfs1 -// compat_30_getdents -// compat_30_getfh -// compat_30_ntp_gettime -// compat_30_socket -// compat_40_mount -// compat_43_fstat43 -// compat_43_lstat43 -// compat_43_oaccept -// compat_43_ocreat -// compat_43_oftruncate -// compat_43_ogetdirentries -// compat_43_ogetdtablesize -// compat_43_ogethostid -// compat_43_ogethostname -// compat_43_ogetkerninfo -// compat_43_ogetpagesize -// compat_43_ogetpeername -// compat_43_ogetrlimit -// compat_43_ogetsockname -// compat_43_okillpg -// compat_43_olseek -// compat_43_ommap -// compat_43_oquota -// compat_43_orecv -// compat_43_orecvfrom -// compat_43_orecvmsg -// compat_43_osend -// compat_43_osendmsg -// compat_43_osethostid -// compat_43_osethostname -// compat_43_osigblock -// compat_43_osigsetmask -// compat_43_osigstack -// compat_43_osigvec -// compat_43_otruncate -// compat_43_owait -// compat_43_stat43 -// execve -// extattr_delete_fd -// extattr_delete_file -// extattr_delete_link -// extattr_get_fd -// extattr_get_file -// extattr_get_link -// extattr_list_fd -// extattr_list_file -// extattr_list_link -// extattr_set_fd -// extattr_set_file -// extattr_set_link -// extattrctl -// fchroot -// fdatasync -// fgetxattr -// fktrace -// flistxattr -// fork -// fremovexattr -// fsetxattr -// fstatvfs1 -// fsync_range -// getcontext -// getitimer -// getvfsstat -// getxattr -// ktrace -// lchflags -// lchmod -// lfs_bmapv -// lfs_markv -// lfs_segclean -// lfs_segwait -// lgetxattr -// lio_listio -// listxattr -// llistxattr -// lremovexattr -// lseek -// lsetxattr -// lutimes -// madvise -// mincore -// minherit -// modctl -// mq_close -// mq_getattr -// mq_notify -// mq_open -// mq_receive -// mq_send -// mq_setattr -// mq_timedreceive -// mq_timedsend -// mq_unlink -// mremap -// msgget -// msgrcv -// msgsnd -// nfssvc -// ntp_adjtime -// pmc_control -// pmc_get_info -// pollts -// preadv -// profil -// pselect -// pset_assign -// pset_create -// pset_destroy -// ptrace -// pwritev -// quotactl -// rasctl -// readv -// reboot -// removexattr -// sa_enable -// sa_preempt -// sa_register -// sa_setconcurrency -// sa_stacks -// sa_yield -// sbrk -// sched_yield -// semconfig -// semget -// semop -// setcontext -// setitimer -// setxattr -// shmat -// shmdt -// shmget -// sstk -// statvfs1 -// swapctl -// sysarch -// syscall -// timer_create -// timer_delete -// timer_getoverrun -// timer_gettime -// timer_settime -// undelete -// utrace -// uuidgen -// vadvise -// vfork -// writev +const ( + mremapFixed = MAP_FIXED + mremapDontunmap = 0 + mremapMaymove = 0 +) + +//sys mremapNetBSD(oldp uintptr, oldsize uintptr, newp uintptr, newsize uintptr, flags int) (xaddr uintptr, err error) = SYS_MREMAP + +func mremap(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (uintptr, error) { + return mremapNetBSD(oldaddr, oldlength, newaddr, newlength, flags) +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go index 5199d282fd..7a5eb57432 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go index 70a9c52e98..62d8957ae6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go index 3eb5942f93..ce6a068851 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go index fc6ccfd810..d46d689d1b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd.go index f9c7a9663c..b25343c71a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -137,18 +137,28 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e } func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { - var _p0 unsafe.Pointer + var bufptr *Statfs_t var bufsize uintptr if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) + bufptr = &buf[0] bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) } - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = e1 - } - return + return getfsstat(bufptr, bufsize, flags) +} + +//sysnb getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) +//sysnb getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) + +func Getresuid() (ruid, euid, suid int) { + var r, e, s _C_int + getresuid(&r, &e, &s) + return int(r), int(e), int(s) +} + +func Getresgid() (rgid, egid, sgid int) { + var r, e, s _C_int + getresgid(&r, &e, &s) + return int(r), int(e), int(s) } //sys ioctl(fd int, req uint, arg uintptr) (err error) @@ -156,6 +166,20 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys fcntl(fd int, cmd int, arg int) (n int, err error) +//sys fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) = SYS_FCNTL + +// FcntlInt performs a fcntl syscall on fd with the provided command and argument. +func FcntlInt(fd uintptr, cmd, arg int) (int, error) { + return fcntl(int(fd), cmd, arg) +} + +// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { + _, err := fcntlPtr(int(fd), cmd, unsafe.Pointer(lk)) + return err +} + //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { @@ -311,80 +335,7 @@ func Uname(uname *Utsname) error { //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) -//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ -//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE +//sys getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) - -/* - * Unimplemented - */ -// __getcwd -// __semctl -// __syscall -// __sysctl -// adjfreq -// break -// clock_getres -// clock_gettime -// clock_settime -// closefrom -// execve -// fhopen -// fhstat -// fhstatfs -// fork -// futimens -// getfh -// getgid -// getitimer -// getlogin -// getresgid -// getresuid -// getthrid -// ktrace -// lfs_bmapv -// lfs_markv -// lfs_segclean -// lfs_segwait -// mincore -// minherit -// mount -// mquery -// msgctl -// msgget -// msgrcv -// msgsnd -// nfssvc -// nnpfspioctl -// preadv -// profil -// pwritev -// quotactl -// readv -// reboot -// renameat -// rfork -// sched_yield -// semget -// semop -// setgroups -// setitimer -// setsockopt -// shmat -// shmctl -// shmdt -// shmget -// sigaction -// sigaltstack -// sigpending -// sigprocmask -// sigreturn -// sigsuspend -// sysarch -// syscall -// threxit -// thrsigdivert -// thrsleep -// thrwakeup -// vfork -// writev +//sys pledge(promises *byte, execpromises *byte) (err error) +//sys unveil(path *byte, flags *byte) (err error) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go index 6baabcdcb0..9ddc89f4fc 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go index bab25360ea..70a3c96eea 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go index 8eed3c4d4e..265caa87f7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go index 483dde99d4..ac4fda1715 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go index 04aa43f41b..0a451e6dd4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build openbsd -// +build openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go index c2796139c0..30a308cbb4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go index 23199a7ff6..ea954330fa 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_solaris.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_solaris.go index b600a289d3..21974af064 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -128,7 +128,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { if n > 0 { sl += _Socklen(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- @@ -157,7 +158,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { if err != nil { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } const ImplementsGetwd = true @@ -698,38 +699,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) = libsocket.setsockopt //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = libsocket.recvfrom -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0) - n = int(r0) - if e1 != 0 { - err = e1 - } - return -} - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0) - n = int(r0) - if e1 != 0 { - err = e1 - } - return -} - -var mapper = &mmapper{ - active: make(map[*byte][]byte), - mmap: mmap, - munmap: munmap, -} - -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return mapper.Mmap(fd, offset, length, prot, flags) -} - -func Munmap(b []byte) (err error) { - return mapper.Munmap(b) -} - // Event Ports type fileObjCookie struct { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go index 0bd25ef81f..e02d8ceae3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && solaris -// +build amd64,solaris package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix.go index 8e48c29ec3..77081de8c7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix @@ -147,6 +146,14 @@ func (m *mmapper) Munmap(data []byte) (err error) { return nil } +func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { + return mapper.Mmap(fd, offset, length, prot, flags) +} + +func Munmap(b []byte) (err error) { + return mapper.Munmap(b) +} + func Read(fd int, p []byte) (n int, err error) { n, err = read(fd, p) if raceenabled { @@ -541,6 +548,9 @@ func SetNonblock(fd int, nonblocking bool) (err error) { if err != nil { return err } + if (flag&O_NONBLOCK != 0) == nonblocking { + return nil + } if nonblocking { flag |= O_NONBLOCK } else { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix_gc.go index b6919ca580..05c95bccfa 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix_gc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix_gc.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc -// +build darwin dragonfly freebsd linux,!ppc64,!ppc64le netbsd openbsd solaris -// +build gc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go index f6f707acf2..23f39b7af7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux && (ppc64le || ppc64) && gc -// +build linux -// +build ppc64le ppc64 -// +build gc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index d3d49ec3ed..b473038c61 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix @@ -192,7 +191,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { //sys fcntl(fd int, cmd int, arg int) (val int, err error) //sys read(fd int, p []byte) (n int, err error) -//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ //sys write(fd int, p []byte) (n int, err error) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) = SYS___ACCEPT_A @@ -285,25 +283,11 @@ func Close(fd int) (err error) { return } -var mapper = &mmapper{ - active: make(map[*byte][]byte), - mmap: mmap, - munmap: munmap, -} - // Dummy function: there are no semantics for Madvise on z/OS func Madvise(b []byte, advice int) (err error) { return } -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return mapper.Mmap(fd, offset, length, prot, flags) -} - -func Munmap(b []byte) (err error) { - return mapper.Munmap(b) -} - //sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A //sysnb Getegid() (egid int) //sysnb Geteuid() (uid int) @@ -1120,7 +1104,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_linux.go index 2c3a4437f0..4fcd38de27 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_linux.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build linux -// +build linux package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_unix.go index 5bb41d17bc..79a84f18b4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (darwin && !ios) || linux -// +build darwin,!ios linux package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go index 71bddefdb8..9eb0db664c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin && !ios -// +build darwin,!ios package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/timestruct.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/timestruct.go index 616b1b2848..7997b19022 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/timestruct.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/timestruct.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/unveil_openbsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/unveil_openbsd.go index 168d5ae779..cb7e598cef 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/unveil_openbsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/unveil_openbsd.go @@ -4,39 +4,48 @@ package unix -import ( - "syscall" - "unsafe" -) +import "fmt" // Unveil implements the unveil syscall. // For more information see unveil(2). // Note that the special case of blocking further // unveil calls is handled by UnveilBlock. func Unveil(path string, flags string) error { - pathPtr, err := syscall.BytePtrFromString(path) - if err != nil { + if err := supportsUnveil(); err != nil { return err } - flagsPtr, err := syscall.BytePtrFromString(flags) + pathPtr, err := BytePtrFromString(path) if err != nil { return err } - _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) - if e != 0 { - return e + flagsPtr, err := BytePtrFromString(flags) + if err != nil { + return err } - return nil + return unveil(pathPtr, flagsPtr) } // UnveilBlock blocks future unveil calls. // For more information see unveil(2). func UnveilBlock() error { - // Both pointers must be nil. - var pathUnsafe, flagsUnsafe unsafe.Pointer - _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) - if e != 0 { - return e + if err := supportsUnveil(); err != nil { + return err } + return unveil(nil, nil) +} + +// supportsUnveil checks for availability of the unveil(2) system call based +// on the running OpenBSD version. +func supportsUnveil() error { + maj, min, err := majmin() + if err != nil { + return err + } + + // unveil is not available before 6.4 + if maj < 6 || (maj == 6 && min <= 3) { + return fmt.Errorf("cannot call Unveil on OpenBSD %d.%d", maj, min) + } + return nil } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/xattr_bsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/xattr_bsd.go index f5f8e9f366..e168793961 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/xattr_bsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/xattr_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build freebsd || netbsd -// +build freebsd netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go index ca9799b79e..2fb219d787 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && aix -// +build ppc,aix // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -maix32 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go index 200c8c26fe..b0e6f5c85c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && aix -// +build ppc64,aix // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -maix64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 1430076271..e40fa85245 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index ab044a7427..bb02aa6c05 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index 17bba0e44f..c0e0f8694c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index f8c2c51387..6c6923906f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index 96310c3be1..dd9163f8e8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index 777b69defa..493a2a793c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go index c557ac2db3..8b437b307d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go index 341b4d9626..67c02dd579 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux.go index de936b677b..36bf8399f4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -481,10 +480,13 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_AFTER = 0x10 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 - BPF_F_KPROBE_MULTI_RETURN = 0x1 + BPF_F_BEFORE = 0x8 + BPF_F_ID = 0x20 + BPF_F_NETFILTER_IP_DEFRAG = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REPLACE = 0x4 BPF_F_SLEEPABLE = 0x10 @@ -493,6 +495,7 @@ const ( BPF_F_TEST_RUN_ON_CPU = 0x1 BPF_F_TEST_STATE_FREQ = 0x8 BPF_F_TEST_XDP_LIVE_FRAMES = 0x2 + BPF_F_XDP_DEV_BOUND_ONLY = 0x40 BPF_F_XDP_HAS_FRAGS = 0x20 BPF_H = 0x8 BPF_IMM = 0x0 @@ -520,6 +523,7 @@ const ( BPF_MAJOR_VERSION = 0x1 BPF_MAXINSNS = 0x1000 BPF_MEM = 0x60 + BPF_MEMSX = 0x80 BPF_MEMWORDS = 0x10 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 @@ -775,6 +779,8 @@ const ( DEVLINK_GENL_MCGRP_CONFIG_NAME = "config" DEVLINK_GENL_NAME = "devlink" DEVLINK_GENL_VERSION = 0x1 + DEVLINK_PORT_FN_CAP_IPSEC_CRYPTO = 0x4 + DEVLINK_PORT_FN_CAP_IPSEC_PACKET = 0x8 DEVLINK_PORT_FN_CAP_MIGRATABLE = 0x2 DEVLINK_PORT_FN_CAP_ROCE = 0x1 DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14 @@ -826,9 +832,9 @@ const ( DM_UUID_FLAG = 0x4000 DM_UUID_LEN = 0x81 DM_VERSION = 0xc138fd00 - DM_VERSION_EXTRA = "-ioctl (2022-07-28)" + DM_VERSION_EXTRA = "-ioctl (2023-03-01)" DM_VERSION_MAJOR = 0x4 - DM_VERSION_MINOR = 0x2f + DM_VERSION_MINOR = 0x30 DM_VERSION_PATCHLEVEL = 0x0 DT_BLK = 0x6 DT_CHR = 0x2 @@ -1197,6 +1203,7 @@ const ( FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_FS_ERROR = 0x8000 + FAN_INFO = 0x20 FAN_MARK_ADD = 0x1 FAN_MARK_DONT_FOLLOW = 0x4 FAN_MARK_EVICTABLE = 0x200 @@ -1233,6 +1240,8 @@ const ( FAN_REPORT_PIDFD = 0x80 FAN_REPORT_TARGET_FID = 0x1000 FAN_REPORT_TID = 0x100 + FAN_RESPONSE_INFO_AUDIT_RULE = 0x1 + FAN_RESPONSE_INFO_NONE = 0x0 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 @@ -1694,6 +1703,7 @@ const ( KEXEC_ON_CRASH = 0x1 KEXEC_PRESERVE_CONTEXT = 0x2 KEXEC_SEGMENT_MAX = 0x10 + KEXEC_UPDATE_ELFCOREHDR = 0x4 KEYCTL_ASSUME_AUTHORITY = 0x10 KEYCTL_CAPABILITIES = 0x1f KEYCTL_CAPS0_BIG_KEY = 0x10 @@ -1775,6 +1785,8 @@ const ( LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20 LANDLOCK_ACCESS_FS_TRUNCATE = 0x4000 LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 + LANDLOCK_ACCESS_NET_BIND_TCP = 0x1 + LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2 LANDLOCK_CREATE_RULESET_VERSION = 0x1 LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef @@ -1791,6 +1803,7 @@ const ( LOCK_SH = 0x1 LOCK_UN = 0x8 LOOP_CLR_FD = 0x4c01 + LOOP_CONFIGURE = 0x4c0a LOOP_CTL_ADD = 0x4c80 LOOP_CTL_GET_FREE = 0x4c82 LOOP_CTL_REMOVE = 0x4c81 @@ -1860,6 +1873,7 @@ const ( MEMWRITEOOB64 = 0xc0184d15 MFD_ALLOW_SEALING = 0x2 MFD_CLOEXEC = 0x1 + MFD_EXEC = 0x10 MFD_HUGETLB = 0x4 MFD_HUGE_16GB = 0x88000000 MFD_HUGE_16MB = 0x60000000 @@ -1875,6 +1889,7 @@ const ( MFD_HUGE_8MB = 0x5c000000 MFD_HUGE_MASK = 0x3f MFD_HUGE_SHIFT = 0x1a + MFD_NOEXEC_SEAL = 0x8 MINIX2_SUPER_MAGIC = 0x2468 MINIX2_SUPER_MAGIC2 = 0x2478 MINIX3_SUPER_MAGIC = 0x4d5a @@ -1898,6 +1913,9 @@ const ( MOUNT_ATTR_SIZE_VER0 = 0x20 MOUNT_ATTR_STRICTATIME = 0x20 MOUNT_ATTR__ATIME = 0x70 + MREMAP_DONTUNMAP = 0x4 + MREMAP_FIXED = 0x2 + MREMAP_MAYMOVE = 0x1 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -2111,6 +2129,60 @@ const ( NFNL_SUBSYS_QUEUE = 0x3 NFNL_SUBSYS_ULOG = 0x4 NFS_SUPER_MAGIC = 0x6969 + NFT_CHAIN_FLAGS = 0x7 + NFT_CHAIN_MAXNAMELEN = 0x100 + NFT_CT_MAX = 0x17 + NFT_DATA_RESERVED_MASK = 0xffffff00 + NFT_DATA_VALUE_MAXLEN = 0x40 + NFT_EXTHDR_OP_MAX = 0x4 + NFT_FIB_RESULT_MAX = 0x3 + NFT_INNER_MASK = 0xf + NFT_LOGLEVEL_MAX = 0x8 + NFT_NAME_MAXLEN = 0x100 + NFT_NG_MAX = 0x1 + NFT_OBJECT_CONNLIMIT = 0x5 + NFT_OBJECT_COUNTER = 0x1 + NFT_OBJECT_CT_EXPECT = 0x9 + NFT_OBJECT_CT_HELPER = 0x3 + NFT_OBJECT_CT_TIMEOUT = 0x7 + NFT_OBJECT_LIMIT = 0x4 + NFT_OBJECT_MAX = 0xa + NFT_OBJECT_QUOTA = 0x2 + NFT_OBJECT_SECMARK = 0x8 + NFT_OBJECT_SYNPROXY = 0xa + NFT_OBJECT_TUNNEL = 0x6 + NFT_OBJECT_UNSPEC = 0x0 + NFT_OBJ_MAXNAMELEN = 0x100 + NFT_OSF_MAXGENRELEN = 0x10 + NFT_QUEUE_FLAG_BYPASS = 0x1 + NFT_QUEUE_FLAG_CPU_FANOUT = 0x2 + NFT_QUEUE_FLAG_MASK = 0x3 + NFT_REG32_COUNT = 0x10 + NFT_REG32_SIZE = 0x4 + NFT_REG_MAX = 0x4 + NFT_REG_SIZE = 0x10 + NFT_REJECT_ICMPX_MAX = 0x3 + NFT_RT_MAX = 0x4 + NFT_SECMARK_CTX_MAXLEN = 0x100 + NFT_SET_MAXNAMELEN = 0x100 + NFT_SOCKET_MAX = 0x3 + NFT_TABLE_F_MASK = 0x3 + NFT_TABLE_MAXNAMELEN = 0x100 + NFT_TRACETYPE_MAX = 0x3 + NFT_TUNNEL_F_MASK = 0x7 + NFT_TUNNEL_MAX = 0x1 + NFT_TUNNEL_MODE_MAX = 0x2 + NFT_USERDATA_MAXLEN = 0x100 + NFT_XFRM_KEY_MAX = 0x6 + NF_NAT_RANGE_MAP_IPS = 0x1 + NF_NAT_RANGE_MASK = 0x7f + NF_NAT_RANGE_NETMAP = 0x40 + NF_NAT_RANGE_PERSISTENT = 0x8 + NF_NAT_RANGE_PROTO_OFFSET = 0x20 + NF_NAT_RANGE_PROTO_RANDOM = 0x4 + NF_NAT_RANGE_PROTO_RANDOM_ALL = 0x14 + NF_NAT_RANGE_PROTO_RANDOM_FULLY = 0x10 + NF_NAT_RANGE_PROTO_SPECIFIED = 0x2 NILFS_SUPER_MAGIC = 0x3434 NL0 = 0x0 NL1 = 0x100 @@ -2204,6 +2276,7 @@ const ( PACKET_USER = 0x6 PACKET_VERSION = 0xa PACKET_VNET_HDR = 0xf + PACKET_VNET_HDR_SZ = 0x18 PARITY_CRC16_PR0 = 0x2 PARITY_CRC16_PR0_CCITT = 0x4 PARITY_CRC16_PR1 = 0x3 @@ -2221,6 +2294,7 @@ const ( PERF_ATTR_SIZE_VER5 = 0x70 PERF_ATTR_SIZE_VER6 = 0x78 PERF_ATTR_SIZE_VER7 = 0x80 + PERF_ATTR_SIZE_VER8 = 0x88 PERF_AUX_FLAG_COLLISION = 0x8 PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT = 0x0 PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW = 0x100 @@ -2264,6 +2338,7 @@ const ( PERF_MEM_LVLNUM_PMEM = 0xe PERF_MEM_LVLNUM_RAM = 0xd PERF_MEM_LVLNUM_SHIFT = 0x21 + PERF_MEM_LVLNUM_UNC = 0x8 PERF_MEM_LVL_HIT = 0x2 PERF_MEM_LVL_IO = 0x1000 PERF_MEM_LVL_L1 = 0x8 @@ -2361,6 +2436,7 @@ const ( PR_FP_EXC_UND = 0x40000 PR_FP_MODE_FR = 0x1 PR_FP_MODE_FRE = 0x2 + PR_GET_AUXV = 0x41555856 PR_GET_CHILD_SUBREAPER = 0x25 PR_GET_DUMPABLE = 0x3 PR_GET_ENDIAN = 0x13 @@ -2369,6 +2445,8 @@ const ( PR_GET_FP_MODE = 0x2e PR_GET_IO_FLUSHER = 0x3a PR_GET_KEEPCAPS = 0x7 + PR_GET_MDWE = 0x42 + PR_GET_MEMORY_MERGE = 0x44 PR_GET_NAME = 0x10 PR_GET_NO_NEW_PRIVS = 0x27 PR_GET_PDEATHSIG = 0x2 @@ -2389,6 +2467,8 @@ const ( PR_MCE_KILL_GET = 0x22 PR_MCE_KILL_LATE = 0x0 PR_MCE_KILL_SET = 0x1 + PR_MDWE_NO_INHERIT = 0x2 + PR_MDWE_REFUSE_EXEC_GAIN = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b PR_MTE_TAG_MASK = 0x7fff8 @@ -2406,6 +2486,15 @@ const ( PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_RESET_KEYS = 0x36 PR_PAC_SET_ENABLED_KEYS = 0x3c + PR_RISCV_V_GET_CONTROL = 0x46 + PR_RISCV_V_SET_CONTROL = 0x45 + PR_RISCV_V_VSTATE_CTRL_CUR_MASK = 0x3 + PR_RISCV_V_VSTATE_CTRL_DEFAULT = 0x0 + PR_RISCV_V_VSTATE_CTRL_INHERIT = 0x10 + PR_RISCV_V_VSTATE_CTRL_MASK = 0x1f + PR_RISCV_V_VSTATE_CTRL_NEXT_MASK = 0xc + PR_RISCV_V_VSTATE_CTRL_OFF = 0x1 + PR_RISCV_V_VSTATE_CTRL_ON = 0x2 PR_SCHED_CORE = 0x3e PR_SCHED_CORE_CREATE = 0x1 PR_SCHED_CORE_GET = 0x0 @@ -2423,6 +2512,8 @@ const ( PR_SET_FP_MODE = 0x2d PR_SET_IO_FLUSHER = 0x39 PR_SET_KEEPCAPS = 0x8 + PR_SET_MDWE = 0x41 + PR_SET_MEMORY_MERGE = 0x43 PR_SET_MM = 0x23 PR_SET_MM_ARG_END = 0x9 PR_SET_MM_ARG_START = 0x8 @@ -2506,6 +2597,7 @@ const ( PTRACE_GETSIGMASK = 0x420a PTRACE_GET_RSEQ_CONFIGURATION = 0x420f PTRACE_GET_SYSCALL_INFO = 0x420e + PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG = 0x4211 PTRACE_INTERRUPT = 0x4207 PTRACE_KILL = 0x8 PTRACE_LISTEN = 0x4208 @@ -2536,6 +2628,7 @@ const ( PTRACE_SETREGSET = 0x4205 PTRACE_SETSIGINFO = 0x4203 PTRACE_SETSIGMASK = 0x420b + PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG = 0x4210 PTRACE_SINGLESTEP = 0x9 PTRACE_SYSCALL = 0x18 PTRACE_SYSCALL_INFO_ENTRY = 0x1 @@ -2579,8 +2672,9 @@ const ( RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 - RTAX_FEATURE_MASK = 0xf + RTAX_FEATURE_MASK = 0x1f RTAX_FEATURE_SACK = 0x2 + RTAX_FEATURE_TCP_USEC_TS = 0x10 RTAX_FEATURE_TIMESTAMP = 0x4 RTAX_HOPLIMIT = 0xa RTAX_INITCWND = 0xb @@ -2802,13 +2896,59 @@ const ( RWF_SUPPORTED = 0x1f RWF_SYNC = 0x4 RWF_WRITE_LIFE_NOT_SET = 0x0 + SCHED_BATCH = 0x3 + SCHED_DEADLINE = 0x6 + SCHED_FIFO = 0x1 + SCHED_FLAG_ALL = 0x7f + SCHED_FLAG_DL_OVERRUN = 0x4 + SCHED_FLAG_KEEP_ALL = 0x18 + SCHED_FLAG_KEEP_PARAMS = 0x10 + SCHED_FLAG_KEEP_POLICY = 0x8 + SCHED_FLAG_RECLAIM = 0x2 + SCHED_FLAG_RESET_ON_FORK = 0x1 + SCHED_FLAG_UTIL_CLAMP = 0x60 + SCHED_FLAG_UTIL_CLAMP_MAX = 0x40 + SCHED_FLAG_UTIL_CLAMP_MIN = 0x20 + SCHED_IDLE = 0x5 + SCHED_NORMAL = 0x0 + SCHED_RESET_ON_FORK = 0x40000000 + SCHED_RR = 0x2 SCM_CREDENTIALS = 0x2 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x1d SC_LOG_FLUSH = 0x100000 + SECCOMP_ADDFD_FLAG_SEND = 0x2 + SECCOMP_ADDFD_FLAG_SETFD = 0x1 + SECCOMP_FILTER_FLAG_LOG = 0x2 + SECCOMP_FILTER_FLAG_NEW_LISTENER = 0x8 + SECCOMP_FILTER_FLAG_SPEC_ALLOW = 0x4 + SECCOMP_FILTER_FLAG_TSYNC = 0x1 + SECCOMP_FILTER_FLAG_TSYNC_ESRCH = 0x10 + SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV = 0x20 + SECCOMP_GET_ACTION_AVAIL = 0x2 + SECCOMP_GET_NOTIF_SIZES = 0x3 + SECCOMP_IOCTL_NOTIF_RECV = 0xc0502100 + SECCOMP_IOCTL_NOTIF_SEND = 0xc0182101 + SECCOMP_IOC_MAGIC = '!' SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 + SECCOMP_RET_ACTION = 0x7fff0000 + SECCOMP_RET_ACTION_FULL = 0xffff0000 + SECCOMP_RET_ALLOW = 0x7fff0000 + SECCOMP_RET_DATA = 0xffff + SECCOMP_RET_ERRNO = 0x50000 + SECCOMP_RET_KILL = 0x0 + SECCOMP_RET_KILL_PROCESS = 0x80000000 + SECCOMP_RET_KILL_THREAD = 0x0 + SECCOMP_RET_LOG = 0x7ffc0000 + SECCOMP_RET_TRACE = 0x7ff00000 + SECCOMP_RET_TRAP = 0x30000 + SECCOMP_RET_USER_NOTIF = 0x7fc00000 + SECCOMP_SET_MODE_FILTER = 0x1 + SECCOMP_SET_MODE_STRICT = 0x0 + SECCOMP_USER_NOTIF_FD_SYNC_WAKE_UP = 0x1 + SECCOMP_USER_NOTIF_FLAG_CONTINUE = 0x1 SECRETMEM_MAGIC = 0x5345434d SECURITYFS_MAGIC = 0x73636673 SEEK_CUR = 0x1 @@ -2968,6 +3108,7 @@ const ( SOL_TIPC = 0x10f SOL_TLS = 0x11a SOL_UDP = 0x11 + SOL_VSOCK = 0x11f SOL_X25 = 0x106 SOL_XDP = 0x11b SOMAXCONN = 0x1000 @@ -3072,7 +3213,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0xd + TASKSTATS_VERSION = 0xe TCIFLUSH = 0x0 TCIOFF = 0x2 TCIOFLUSH = 0x2 @@ -3238,6 +3379,7 @@ const ( TP_STATUS_COPY = 0x2 TP_STATUS_CSUMNOTREADY = 0x8 TP_STATUS_CSUM_VALID = 0x80 + TP_STATUS_GSO_TCP = 0x100 TP_STATUS_KERNEL = 0x0 TP_STATUS_LOSING = 0x4 TP_STATUS_SENDING = 0x2 @@ -3415,6 +3557,7 @@ const ( XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 + XDP_PKT_CONTD = 0x1 XDP_RING_NEED_WAKEUP = 0x1 XDP_RX_RING = 0x2 XDP_SHARED_UMEM = 0x1 @@ -3427,6 +3570,7 @@ const ( XDP_UMEM_REG = 0x4 XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1 XDP_USE_NEED_WAKEUP = 0x8 + XDP_USE_SG = 0x10 XDP_ZEROCOPY = 0x4 XENFS_SUPER_MAGIC = 0xabba1974 XFS_SUPER_MAGIC = 0x58465342 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index a46df0f1e5..42ff8c3c1b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/386/include -m32 _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x127a BLKBSZGET = 0x80041270 BLKBSZSET = 0x40041271 + BLKDISCARD = 0x1277 + BLKDISCARDZEROES = 0x127c BLKFLSBUF = 0x1261 BLKFRAGET = 0x1265 BLKFRASET = 0x1264 + BLKGETDISKSEQ = 0x80081280 BLKGETSIZE = 0x1260 BLKGETSIZE64 = 0x80041272 + BLKIOMIN = 0x1278 + BLKIOOPT = 0x1279 BLKPBSZGET = 0x127b BLKRAGET = 0x1263 BLKRASET = 0x1262 BLKROGET = 0x125e BLKROSET = 0x125d + BLKROTATIONAL = 0x127e BLKRRPART = 0x125f + BLKSECDISCARD = 0x127d BLKSECTGET = 0x1267 BLKSECTSET = 0x1266 BLKSSZGET = 0x1268 + BLKZEROOUT = 0x127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -273,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -317,10 +328,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 6cd4a3ea9d..dca436004f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/amd64/include -m64 _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x127a BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 + BLKDISCARD = 0x1277 + BLKDISCARDZEROES = 0x127c BLKFLSBUF = 0x1261 BLKFRAGET = 0x1265 BLKFRASET = 0x1264 + BLKGETDISKSEQ = 0x80081280 BLKGETSIZE = 0x1260 BLKGETSIZE64 = 0x80081272 + BLKIOMIN = 0x1278 + BLKIOOPT = 0x1279 BLKPBSZGET = 0x127b BLKRAGET = 0x1263 BLKRASET = 0x1262 BLKROGET = 0x125e BLKROSET = 0x125d + BLKROTATIONAL = 0x127e BLKRRPART = 0x125f + BLKSECDISCARD = 0x127d BLKSECTGET = 0x1267 BLKSECTSET = 0x1266 BLKSSZGET = 0x1268 + BLKZEROOUT = 0x127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -274,6 +282,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -318,10 +329,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index c7ebee24df..5cca668ac3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/arm/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x127a BLKBSZGET = 0x80041270 BLKBSZSET = 0x40041271 + BLKDISCARD = 0x1277 + BLKDISCARDZEROES = 0x127c BLKFLSBUF = 0x1261 BLKFRAGET = 0x1265 BLKFRASET = 0x1264 + BLKGETDISKSEQ = 0x80081280 BLKGETSIZE = 0x1260 BLKGETSIZE64 = 0x80041272 + BLKIOMIN = 0x1278 + BLKIOOPT = 0x1279 BLKPBSZGET = 0x127b BLKRAGET = 0x1263 BLKRASET = 0x1262 BLKROGET = 0x125e BLKROSET = 0x125d + BLKROTATIONAL = 0x127e BLKRRPART = 0x125f + BLKSECDISCARD = 0x127d BLKSECTGET = 0x1267 BLKSECTSET = 0x1266 BLKSSZGET = 0x1268 + BLKZEROOUT = 0x127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -280,6 +288,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -324,10 +335,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 9d5352c3e4..d8cae6d153 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/arm64/include -fsigned-char _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x127a BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 + BLKDISCARD = 0x1277 + BLKDISCARDZEROES = 0x127c BLKFLSBUF = 0x1261 BLKFRAGET = 0x1265 BLKFRASET = 0x1264 + BLKGETDISKSEQ = 0x80081280 BLKGETSIZE = 0x1260 BLKGETSIZE64 = 0x80081272 + BLKIOMIN = 0x1278 + BLKIOOPT = 0x1279 BLKPBSZGET = 0x127b BLKRAGET = 0x1263 BLKRASET = 0x1262 BLKROGET = 0x125e BLKROSET = 0x125d + BLKROTATIONAL = 0x127e BLKRRPART = 0x125f + BLKSECDISCARD = 0x127d BLKSECTGET = 0x1267 BLKSECTSET = 0x1266 BLKSSZGET = 0x1268 + BLKZEROOUT = 0x127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -270,6 +278,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -314,10 +325,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 @@ -443,6 +456,7 @@ const ( TIOCSWINSZ = 0x5414 TIOCVHANGUP = 0x5437 TOSTOP = 0x100 + TPIDR2_MAGIC = 0x54504902 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 TUNGETDEVNETNS = 0x54e3 @@ -515,6 +529,7 @@ const ( XCASE = 0x4 XTABS = 0x1800 ZA_MAGIC = 0x54366345 + ZT_MAGIC = 0x5a544e01 _HIDIOCGRAWNAME = 0x80804804 _HIDIOCGRAWPHYS = 0x80404805 _HIDIOCGRAWUNIQ = 0x80404808 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index f26a164f4a..28e39afdcb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/loong64/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x127a BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 + BLKDISCARD = 0x1277 + BLKDISCARDZEROES = 0x127c BLKFLSBUF = 0x1261 BLKFRAGET = 0x1265 BLKFRASET = 0x1264 + BLKGETDISKSEQ = 0x80081280 BLKGETSIZE = 0x1260 BLKGETSIZE64 = 0x80081272 + BLKIOMIN = 0x1278 + BLKIOOPT = 0x1279 BLKPBSZGET = 0x127b BLKRAGET = 0x1263 BLKRASET = 0x1262 BLKROGET = 0x125e BLKROSET = 0x125d + BLKROTATIONAL = 0x127e BLKRRPART = 0x125f + BLKSECDISCARD = 0x127d BLKSECTGET = 0x1267 BLKSECTSET = 0x1266 BLKSSZGET = 0x1268 + BLKZEROOUT = 0x127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -109,6 +117,9 @@ const ( IUCLC = 0x200 IXOFF = 0x1000 IXON = 0x400 + LASX_CTX_MAGIC = 0x41535801 + LBT_CTX_MAGIC = 0x42540001 + LSX_CTX_MAGIC = 0x53580001 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -264,6 +275,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -308,10 +322,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 890bc3c9b7..cd66e92cb4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x2000127a BLKBSZGET = 0x40041270 BLKBSZSET = 0x80041271 + BLKDISCARD = 0x20001277 + BLKDISCARDZEROES = 0x2000127c BLKFLSBUF = 0x20001261 BLKFRAGET = 0x20001265 BLKFRASET = 0x20001264 + BLKGETDISKSEQ = 0x40081280 BLKGETSIZE = 0x20001260 BLKGETSIZE64 = 0x40041272 + BLKIOMIN = 0x20001278 + BLKIOOPT = 0x20001279 BLKPBSZGET = 0x2000127b BLKRAGET = 0x20001263 BLKRASET = 0x20001262 BLKROGET = 0x2000125e BLKROSET = 0x2000125d + BLKROTATIONAL = 0x2000127e BLKRRPART = 0x2000125f + BLKSECDISCARD = 0x2000127d BLKSECTGET = 0x20001267 BLKSECTSET = 0x20001266 BLKSSZGET = 0x20001268 + BLKZEROOUT = 0x2000127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -273,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x80 SIOCATMARK = 0x40047307 @@ -317,10 +328,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1e SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 549f26ac64..c1595eba78 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips64/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x2000127a BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 + BLKDISCARD = 0x20001277 + BLKDISCARDZEROES = 0x2000127c BLKFLSBUF = 0x20001261 BLKFRAGET = 0x20001265 BLKFRASET = 0x20001264 + BLKGETDISKSEQ = 0x40081280 BLKGETSIZE = 0x20001260 BLKGETSIZE64 = 0x40081272 + BLKIOMIN = 0x20001278 + BLKIOOPT = 0x20001279 BLKPBSZGET = 0x2000127b BLKRAGET = 0x20001263 BLKRASET = 0x20001262 BLKROGET = 0x2000125e BLKROSET = 0x2000125d + BLKROTATIONAL = 0x2000127e BLKRRPART = 0x2000125f + BLKSECDISCARD = 0x2000127d BLKSECTGET = 0x20001267 BLKSECTSET = 0x20001266 BLKSSZGET = 0x20001268 + BLKZEROOUT = 0x2000127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -273,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x80 SIOCATMARK = 0x40047307 @@ -317,10 +328,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1e SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index e0365e32c1..ee9456b0da 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mips64le/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x2000127a BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 + BLKDISCARD = 0x20001277 + BLKDISCARDZEROES = 0x2000127c BLKFLSBUF = 0x20001261 BLKFRAGET = 0x20001265 BLKFRASET = 0x20001264 + BLKGETDISKSEQ = 0x40081280 BLKGETSIZE = 0x20001260 BLKGETSIZE64 = 0x40081272 + BLKIOMIN = 0x20001278 + BLKIOOPT = 0x20001279 BLKPBSZGET = 0x2000127b BLKRAGET = 0x20001263 BLKRASET = 0x20001262 BLKROGET = 0x2000125e BLKROSET = 0x2000125d + BLKROTATIONAL = 0x2000127e BLKRRPART = 0x2000125f + BLKSECDISCARD = 0x2000127d BLKSECTGET = 0x20001267 BLKSECTSET = 0x20001266 BLKSSZGET = 0x20001268 + BLKZEROOUT = 0x2000127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -273,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x80 SIOCATMARK = 0x40047307 @@ -317,10 +328,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1e SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index fdccce15ca..8cfca81e1b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/mipsle/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x2000127a BLKBSZGET = 0x40041270 BLKBSZSET = 0x80041271 + BLKDISCARD = 0x20001277 + BLKDISCARDZEROES = 0x2000127c BLKFLSBUF = 0x20001261 BLKFRAGET = 0x20001265 BLKFRASET = 0x20001264 + BLKGETDISKSEQ = 0x40081280 BLKGETSIZE = 0x20001260 BLKGETSIZE64 = 0x40041272 + BLKIOMIN = 0x20001278 + BLKIOOPT = 0x20001279 BLKPBSZGET = 0x2000127b BLKRAGET = 0x20001263 BLKRASET = 0x20001262 BLKROGET = 0x2000125e BLKROSET = 0x2000125d + BLKROTATIONAL = 0x2000127e BLKRRPART = 0x2000125f + BLKSECDISCARD = 0x2000127d BLKSECTGET = 0x20001267 BLKSECTSET = 0x20001266 BLKSSZGET = 0x20001268 + BLKZEROOUT = 0x2000127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -273,6 +281,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x80 SIOCATMARK = 0x40047307 @@ -317,10 +328,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1e SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index b2205c83fa..60b0deb3af 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x10 B576000 = 0x15 B921600 = 0x16 + BLKALIGNOFF = 0x2000127a BLKBSZGET = 0x40041270 BLKBSZSET = 0x80041271 + BLKDISCARD = 0x20001277 + BLKDISCARDZEROES = 0x2000127c BLKFLSBUF = 0x20001261 BLKFRAGET = 0x20001265 BLKFRASET = 0x20001264 + BLKGETDISKSEQ = 0x40081280 BLKGETSIZE = 0x20001260 BLKGETSIZE64 = 0x40041272 + BLKIOMIN = 0x20001278 + BLKIOOPT = 0x20001279 BLKPBSZGET = 0x2000127b BLKRAGET = 0x20001263 BLKRASET = 0x20001262 BLKROGET = 0x2000125e BLKROSET = 0x2000125d + BLKROTATIONAL = 0x2000127e BLKRRPART = 0x2000125f + BLKSECDISCARD = 0x2000127d BLKSECTGET = 0x20001267 BLKSECTSET = 0x20001266 BLKSSZGET = 0x20001268 + BLKZEROOUT = 0x2000127f BOTHER = 0x1f BS1 = 0x8000 BSDLY = 0x8000 @@ -328,6 +336,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -372,10 +383,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 81aa5ad0f6..f90aa7281b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x10 B576000 = 0x15 B921600 = 0x16 + BLKALIGNOFF = 0x2000127a BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 + BLKDISCARD = 0x20001277 + BLKDISCARDZEROES = 0x2000127c BLKFLSBUF = 0x20001261 BLKFRAGET = 0x20001265 BLKFRASET = 0x20001264 + BLKGETDISKSEQ = 0x40081280 BLKGETSIZE = 0x20001260 BLKGETSIZE64 = 0x40081272 + BLKIOMIN = 0x20001278 + BLKIOOPT = 0x20001279 BLKPBSZGET = 0x2000127b BLKRAGET = 0x20001263 BLKRASET = 0x20001262 BLKROGET = 0x2000125e BLKROSET = 0x2000125d + BLKROTATIONAL = 0x2000127e BLKRRPART = 0x2000125f + BLKSECDISCARD = 0x2000127d BLKSECTGET = 0x20001267 BLKSECTSET = 0x20001266 BLKSSZGET = 0x20001268 + BLKZEROOUT = 0x2000127f BOTHER = 0x1f BS1 = 0x8000 BSDLY = 0x8000 @@ -332,6 +340,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -376,10 +387,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 76807a1fd4..ba9e015033 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64le/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x10 B576000 = 0x15 B921600 = 0x16 + BLKALIGNOFF = 0x2000127a BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 + BLKDISCARD = 0x20001277 + BLKDISCARDZEROES = 0x2000127c BLKFLSBUF = 0x20001261 BLKFRAGET = 0x20001265 BLKFRASET = 0x20001264 + BLKGETDISKSEQ = 0x40081280 BLKGETSIZE = 0x20001260 BLKGETSIZE64 = 0x40081272 + BLKIOMIN = 0x20001278 + BLKIOOPT = 0x20001279 BLKPBSZGET = 0x2000127b BLKRAGET = 0x20001263 BLKRASET = 0x20001262 BLKROGET = 0x2000125e BLKROSET = 0x2000125d + BLKROTATIONAL = 0x2000127e BLKRRPART = 0x2000125f + BLKSECDISCARD = 0x2000127d BLKSECTGET = 0x20001267 BLKSECTSET = 0x20001266 BLKSSZGET = 0x20001268 + BLKZEROOUT = 0x2000127f BOTHER = 0x1f BS1 = 0x8000 BSDLY = 0x8000 @@ -332,6 +340,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -376,10 +387,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index d4a5ab9e4e..07cdfd6e9f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/riscv64/include _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x127a BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 + BLKDISCARD = 0x1277 + BLKDISCARDZEROES = 0x127c BLKFLSBUF = 0x1261 BLKFRAGET = 0x1265 BLKFRASET = 0x1264 + BLKGETDISKSEQ = 0x80081280 BLKGETSIZE = 0x1260 BLKGETSIZE64 = 0x80081272 + BLKIOMIN = 0x1278 + BLKIOOPT = 0x1279 BLKPBSZGET = 0x127b BLKRAGET = 0x1263 BLKRASET = 0x1262 BLKROGET = 0x125e BLKROSET = 0x125d + BLKROTATIONAL = 0x127e BLKRRPART = 0x125f + BLKSECDISCARD = 0x127d BLKSECTGET = 0x1267 BLKSECTSET = 0x1266 BLKSSZGET = 0x1268 + BLKZEROOUT = 0x127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -219,6 +227,9 @@ const ( PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff + PTRACE_GETFDPIC = 0x21 + PTRACE_GETFDPIC_EXEC = 0x0 + PTRACE_GETFDPIC_INTERP = 0x1 RLIMIT_AS = 0x9 RLIMIT_MEMLOCK = 0x8 RLIMIT_NOFILE = 0x7 @@ -261,6 +272,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -305,10 +319,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 66e65db951..2f1dd214a7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/s390x/include -fsigned-char _const.go @@ -27,22 +26,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x127a BLKBSZGET = 0x80081270 BLKBSZSET = 0x40081271 + BLKDISCARD = 0x1277 + BLKDISCARDZEROES = 0x127c BLKFLSBUF = 0x1261 BLKFRAGET = 0x1265 BLKFRASET = 0x1264 + BLKGETDISKSEQ = 0x80081280 BLKGETSIZE = 0x1260 BLKGETSIZE64 = 0x80081272 + BLKIOMIN = 0x1278 + BLKIOOPT = 0x1279 BLKPBSZGET = 0x127b BLKRAGET = 0x1263 BLKRASET = 0x1262 BLKROGET = 0x125e BLKROSET = 0x125d + BLKROTATIONAL = 0x127e BLKRRPART = 0x125f + BLKSECDISCARD = 0x127d BLKSECTGET = 0x1267 BLKSECTSET = 0x1266 BLKSSZGET = 0x1268 + BLKZEROOUT = 0x127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -336,6 +344,9 @@ const ( SCM_TIMESTAMPNS = 0x23 SCM_TXTIME = 0x3d SCM_WIFI_STATUS = 0x29 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104 SFD_CLOEXEC = 0x80000 SFD_NONBLOCK = 0x800 SIOCATMARK = 0x8905 @@ -380,10 +391,12 @@ const ( SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 + SO_PASSPIDFD = 0x4c SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b + SO_PEERPIDFD = 0x4d SO_PEERSEC = 0x1f SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index f619252691..f40519d901 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/sparc64/include _const.go @@ -30,22 +29,31 @@ const ( B57600 = 0x1001 B576000 = 0x1006 B921600 = 0x1007 + BLKALIGNOFF = 0x2000127a BLKBSZGET = 0x40081270 BLKBSZSET = 0x80081271 + BLKDISCARD = 0x20001277 + BLKDISCARDZEROES = 0x2000127c BLKFLSBUF = 0x20001261 BLKFRAGET = 0x20001265 BLKFRASET = 0x20001264 + BLKGETDISKSEQ = 0x40081280 BLKGETSIZE = 0x20001260 BLKGETSIZE64 = 0x40081272 + BLKIOMIN = 0x20001278 + BLKIOOPT = 0x20001279 BLKPBSZGET = 0x2000127b BLKRAGET = 0x20001263 BLKRASET = 0x20001262 BLKROGET = 0x2000125e BLKROSET = 0x2000125d + BLKROTATIONAL = 0x2000127e BLKRRPART = 0x2000125f + BLKSECDISCARD = 0x2000127d BLKSECTGET = 0x20001267 BLKSECTSET = 0x20001266 BLKSSZGET = 0x20001268 + BLKZEROOUT = 0x2000127f BOTHER = 0x1000 BS1 = 0x2000 BSDLY = 0x2000 @@ -327,8 +335,59 @@ const ( SCM_TIMESTAMPNS = 0x21 SCM_TXTIME = 0x3f SCM_WIFI_STATUS = 0x25 + SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 + SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102 + SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104 SFD_CLOEXEC = 0x400000 SFD_NONBLOCK = 0x4000 + SF_FP = 0x38 + SF_I0 = 0x20 + SF_I1 = 0x24 + SF_I2 = 0x28 + SF_I3 = 0x2c + SF_I4 = 0x30 + SF_I5 = 0x34 + SF_L0 = 0x0 + SF_L1 = 0x4 + SF_L2 = 0x8 + SF_L3 = 0xc + SF_L4 = 0x10 + SF_L5 = 0x14 + SF_L6 = 0x18 + SF_L7 = 0x1c + SF_PC = 0x3c + SF_RETP = 0x40 + SF_V9_FP = 0x70 + SF_V9_I0 = 0x40 + SF_V9_I1 = 0x48 + SF_V9_I2 = 0x50 + SF_V9_I3 = 0x58 + SF_V9_I4 = 0x60 + SF_V9_I5 = 0x68 + SF_V9_L0 = 0x0 + SF_V9_L1 = 0x8 + SF_V9_L2 = 0x10 + SF_V9_L3 = 0x18 + SF_V9_L4 = 0x20 + SF_V9_L5 = 0x28 + SF_V9_L6 = 0x30 + SF_V9_L7 = 0x38 + SF_V9_PC = 0x78 + SF_V9_RETP = 0x80 + SF_V9_XARG0 = 0x88 + SF_V9_XARG1 = 0x90 + SF_V9_XARG2 = 0x98 + SF_V9_XARG3 = 0xa0 + SF_V9_XARG4 = 0xa8 + SF_V9_XARG5 = 0xb0 + SF_V9_XXARG = 0xb8 + SF_XARG0 = 0x44 + SF_XARG1 = 0x48 + SF_XARG2 = 0x4c + SF_XARG3 = 0x50 + SF_XARG4 = 0x54 + SF_XARG5 = 0x58 + SF_XXARG = 0x5c SIOCATMARK = 0x8905 SIOCGPGRP = 0x8904 SIOCGSTAMPNS_NEW = 0x40108907 @@ -371,10 +430,12 @@ const ( SO_NOFCS = 0x27 SO_OOBINLINE = 0x100 SO_PASSCRED = 0x2 + SO_PASSPIDFD = 0x55 SO_PASSSEC = 0x1f SO_PEEK_OFF = 0x26 SO_PEERCRED = 0x40 SO_PEERGROUPS = 0x3d + SO_PEERPIDFD = 0x56 SO_PEERSEC = 0x1e SO_PREFER_BUSY_POLL = 0x48 SO_PROTOCOL = 0x1028 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go index 72f7420d20..130085df40 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go index 8d4eb0c080..84769a1a38 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go index 9eef9749f6..602ded0033 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -marm _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go index 3b62ba192c..efc0406ee1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index af20e474b3..5a6500f837 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 6015fcb2bf..a5aeeb979d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index 8d44955e44..0e9748a722 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go index ae16fe7542..4f4449abc1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go index 03d90fe355..76a363f0fe 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go index 8e2c51b1ee..43ca0cdfdc 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go index 13d403031e..b1b8bb2005 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go index 1afee6a089..d2ddd3176e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && solaris -// +build amd64,solaris // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go index fc7d0506f6..4dfd2e051d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Hand edited based on zerrors_linux_s390x.go // TODO: auto-generate. diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go index 97f20ca282..586317c78e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT. //go:build linux && (arm || arm64) -// +build linux -// +build arm arm64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go index 0b5f794305..d7c881be77 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mips", "mips64"). DO NOT EDIT. //go:build linux && (mips || mips64) -// +build linux -// +build mips mips64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go index 2807f7e646..2d2de5d292 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mipsle", "mips64le"). DO NOT EDIT. //go:build linux && (mipsle || mips64le) -// +build linux -// +build mipsle mips64le package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go index 281ea64e34..5adc79fb5e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go @@ -1,8 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("386", "amd64"). DO NOT EDIT. //go:build linux && (386 || amd64) -// +build linux -// +build 386 amd64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index 9a257219d7..6ea64a3c0c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc -// +build aix,ppc package unix @@ -817,28 +816,6 @@ func write(fd int, p []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, p *byte, np int) (n int, err error) { - r0, er := C.read(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(p))), C.size_t(np)) - n = int(r0) - if r0 == -1 && er != nil { - err = er - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, p *byte, np int) (n int, err error) { - r0, er := C.write(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(p))), C.size_t(np)) - n = int(r0) - if r0 == -1 && er != nil { - err = er - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { r0, er := C.dup2(C.int(oldfd), C.int(newfd)) if r0 == -1 && er != nil { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index 6de80c20cf..99ee4399a3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 -// +build aix,ppc64 package unix @@ -762,28 +761,6 @@ func write(fd int, p []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, p *byte, np int) (n int, err error) { - r0, e1 := callread(fd, uintptr(unsafe.Pointer(p)), np) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, p *byte, np int) (n int, err error) { - r0, e1 := callwrite(fd, uintptr(unsafe.Pointer(p)), np) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Dup2(oldfd int, newfd int) (err error) { _, e1 := calldup2(oldfd, newfd) if e1 != 0 { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index c4d50ae500..b68a78362b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 && gc -// +build aix,ppc64,gc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index 6903d3b09e..0a87450bf8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build aix && ppc64 && gccgo -// +build aix,ppc64,gccgo package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 4037ccf7a9..ccb02f240a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build darwin && amd64 -// +build darwin,amd64 package unix @@ -725,6 +724,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -733,10 +738,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -2410,28 +2411,6 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := syscall_syscall(libc_fstat64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { @@ -2521,14 +2500,6 @@ func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { return } -func ptrace1Ptr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { - _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), addr, uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - var libc_ptrace_trampoline_addr uintptr //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 4baaed0bc1..8b8bb28402 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -5,703 +5,586 @@ TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fdopendir(SB) - GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) - GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) - GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) - GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_accept(SB) - GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_bind(SB) - GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_connect(SB) - GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socket(SB) - GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) - GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) - GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) - GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) - GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) - GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) - GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) - GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) - GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) - GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) - GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) - GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) - GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) - GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_poll(SB) - GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_madvise(SB) - GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlock(SB) - GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlockall(SB) - GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mprotect(SB) - GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_msync(SB) - GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) - GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) - GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_closedir(SB) - GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readdir_r(SB) - GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) - GLOBL ·libc_pipe_trampoline_addr(SB), RODATA, $8 DATA ·libc_pipe_trampoline_addr(SB)/8, $libc_pipe_trampoline<>(SB) TEXT libc_getxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getxattr(SB) - GLOBL ·libc_getxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_getxattr_trampoline_addr(SB)/8, $libc_getxattr_trampoline<>(SB) TEXT libc_fgetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fgetxattr(SB) - GLOBL ·libc_fgetxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_fgetxattr_trampoline_addr(SB)/8, $libc_fgetxattr_trampoline<>(SB) TEXT libc_setxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setxattr(SB) - GLOBL ·libc_setxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_setxattr_trampoline_addr(SB)/8, $libc_setxattr_trampoline<>(SB) TEXT libc_fsetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsetxattr(SB) - GLOBL ·libc_fsetxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_fsetxattr_trampoline_addr(SB)/8, $libc_fsetxattr_trampoline<>(SB) TEXT libc_removexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_removexattr(SB) - GLOBL ·libc_removexattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_removexattr_trampoline_addr(SB)/8, $libc_removexattr_trampoline<>(SB) TEXT libc_fremovexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fremovexattr(SB) - GLOBL ·libc_fremovexattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_fremovexattr_trampoline_addr(SB)/8, $libc_fremovexattr_trampoline<>(SB) TEXT libc_listxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listxattr(SB) - GLOBL ·libc_listxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_listxattr_trampoline_addr(SB)/8, $libc_listxattr_trampoline<>(SB) TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flistxattr(SB) - GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB) TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) - GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) - GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kill(SB) - GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) - GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) - GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) - GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shmat(SB) - GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8 DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB) TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shmctl(SB) - GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB) TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shmdt(SB) - GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8 DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB) TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shmget(SB) - GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8 DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB) TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) - GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) - GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) - GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) - GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) - GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chown(SB) - GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) - GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) - GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_close(SB) - GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) TEXT libc_clonefile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clonefile(SB) - GLOBL ·libc_clonefile_trampoline_addr(SB), RODATA, $8 DATA ·libc_clonefile_trampoline_addr(SB)/8, $libc_clonefile_trampoline<>(SB) TEXT libc_clonefileat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clonefileat(SB) - GLOBL ·libc_clonefileat_trampoline_addr(SB), RODATA, $8 DATA ·libc_clonefileat_trampoline_addr(SB)/8, $libc_clonefileat_trampoline<>(SB) TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup(SB) - GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) - GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) TEXT libc_exchangedata_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exchangedata(SB) - GLOBL ·libc_exchangedata_trampoline_addr(SB), RODATA, $8 DATA ·libc_exchangedata_trampoline_addr(SB)/8, $libc_exchangedata_trampoline<>(SB) TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exit(SB) - GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_faccessat(SB) - GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) - GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) - GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) - GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmodat(SB) - GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) - GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) - GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) TEXT libc_fclonefileat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fclonefileat(SB) - GLOBL ·libc_fclonefileat_trampoline_addr(SB), RODATA, $8 DATA ·libc_fclonefileat_trampoline_addr(SB)/8, $libc_fclonefileat_trampoline<>(SB) TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flock(SB) - GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) - GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) - GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) - GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getcwd(SB) - GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) TEXT libc_getdtablesize_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) - GLOBL ·libc_getdtablesize_trampoline_addr(SB), RODATA, $8 DATA ·libc_getdtablesize_trampoline_addr(SB)/8, $libc_getdtablesize_trampoline<>(SB) TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) - GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) - GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) - GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) - GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) - GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) - GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) - GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) - GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) - GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) - GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) - GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_gettimeofday(SB) - GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) - GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) - GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) - GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) - GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_link(SB) - GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_linkat(SB) - GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listen(SB) - GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) - GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdirat(SB) - GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) - GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) - GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mount(SB) - GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_open(SB) - GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_openat(SB) - GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) - GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pread(SB) - GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) - GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_read(SB) - GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) - GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlinkat(SB) - GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rename(SB) - GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_renameat(SB) - GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) - GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) - GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) - GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_select(SB) - GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) @@ -712,192 +595,160 @@ DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) - GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) - GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) - GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) - GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) - GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) - GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) TEXT libc_setprivexec_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setprivexec(SB) - GLOBL ·libc_setprivexec_trampoline_addr(SB), RODATA, $8 DATA ·libc_setprivexec_trampoline_addr(SB)/8, $libc_setprivexec_trampoline<>(SB) TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) - GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) - GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) - GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) - GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) - GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) - GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlinkat(SB) - GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sync(SB) - GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) - GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_umask(SB) - GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) TEXT libc_undelete_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_undelete(SB) - GLOBL ·libc_undelete_trampoline_addr(SB), RODATA, $8 DATA ·libc_undelete_trampoline_addr(SB)/8, $libc_undelete_trampoline<>(SB) TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) - GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) - GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) - GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_write(SB) - GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) - GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) - GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) TEXT libc_fstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstat64(SB) - GLOBL ·libc_fstat64_trampoline_addr(SB), RODATA, $8 DATA ·libc_fstat64_trampoline_addr(SB)/8, $libc_fstat64_trampoline<>(SB) TEXT libc_fstatat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatat64(SB) - GLOBL ·libc_fstatat64_trampoline_addr(SB), RODATA, $8 DATA ·libc_fstatat64_trampoline_addr(SB)/8, $libc_fstatat64_trampoline<>(SB) TEXT libc_fstatfs64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatfs64(SB) - GLOBL ·libc_fstatfs64_trampoline_addr(SB), RODATA, $8 DATA ·libc_fstatfs64_trampoline_addr(SB)/8, $libc_fstatfs64_trampoline<>(SB) TEXT libc_getfsstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getfsstat64(SB) - GLOBL ·libc_getfsstat64_trampoline_addr(SB), RODATA, $8 DATA ·libc_getfsstat64_trampoline_addr(SB)/8, $libc_getfsstat64_trampoline<>(SB) TEXT libc_lstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lstat64(SB) - GLOBL ·libc_lstat64_trampoline_addr(SB), RODATA, $8 DATA ·libc_lstat64_trampoline_addr(SB)/8, $libc_lstat64_trampoline<>(SB) TEXT libc_ptrace_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) - GLOBL ·libc_ptrace_trampoline_addr(SB), RODATA, $8 DATA ·libc_ptrace_trampoline_addr(SB)/8, $libc_ptrace_trampoline<>(SB) TEXT libc_stat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_stat64(SB) - GLOBL ·libc_stat64_trampoline_addr(SB), RODATA, $8 DATA ·libc_stat64_trampoline_addr(SB)/8, $libc_stat64_trampoline<>(SB) TEXT libc_statfs64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_statfs64(SB) - GLOBL ·libc_statfs64_trampoline_addr(SB), RODATA, $8 DATA ·libc_statfs64_trampoline_addr(SB)/8, $libc_statfs64_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 51d6f3fb25..1b40b997b5 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build darwin && arm64 -// +build darwin,arm64 package unix @@ -725,6 +724,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -733,10 +738,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -2410,28 +2411,6 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { @@ -2521,14 +2500,6 @@ func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { return } -func ptrace1Ptr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { - _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), addr, uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - var libc_ptrace_trampoline_addr uintptr //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index c3b82c0379..08362c1ab7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -5,703 +5,586 @@ TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fdopendir(SB) - GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) - GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) - GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) - GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_accept(SB) - GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_bind(SB) - GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_connect(SB) - GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socket(SB) - GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) - GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) - GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) - GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) - GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) - GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) - GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) - GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) - GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) - GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) - GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) - GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) - GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) - GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_poll(SB) - GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_madvise(SB) - GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlock(SB) - GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlockall(SB) - GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mprotect(SB) - GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_msync(SB) - GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) - GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) - GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_closedir(SB) - GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readdir_r(SB) - GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) - GLOBL ·libc_pipe_trampoline_addr(SB), RODATA, $8 DATA ·libc_pipe_trampoline_addr(SB)/8, $libc_pipe_trampoline<>(SB) TEXT libc_getxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getxattr(SB) - GLOBL ·libc_getxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_getxattr_trampoline_addr(SB)/8, $libc_getxattr_trampoline<>(SB) TEXT libc_fgetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fgetxattr(SB) - GLOBL ·libc_fgetxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_fgetxattr_trampoline_addr(SB)/8, $libc_fgetxattr_trampoline<>(SB) TEXT libc_setxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setxattr(SB) - GLOBL ·libc_setxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_setxattr_trampoline_addr(SB)/8, $libc_setxattr_trampoline<>(SB) TEXT libc_fsetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsetxattr(SB) - GLOBL ·libc_fsetxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_fsetxattr_trampoline_addr(SB)/8, $libc_fsetxattr_trampoline<>(SB) TEXT libc_removexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_removexattr(SB) - GLOBL ·libc_removexattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_removexattr_trampoline_addr(SB)/8, $libc_removexattr_trampoline<>(SB) TEXT libc_fremovexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fremovexattr(SB) - GLOBL ·libc_fremovexattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_fremovexattr_trampoline_addr(SB)/8, $libc_fremovexattr_trampoline<>(SB) TEXT libc_listxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listxattr(SB) - GLOBL ·libc_listxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_listxattr_trampoline_addr(SB)/8, $libc_listxattr_trampoline<>(SB) TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flistxattr(SB) - GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8 DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB) TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) - GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) - GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kill(SB) - GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) - GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) - GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) - GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shmat(SB) - GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8 DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB) TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shmctl(SB) - GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB) TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shmdt(SB) - GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8 DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB) TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shmget(SB) - GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8 DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB) TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) - GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) - GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) - GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) - GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) - GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chown(SB) - GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) - GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) - GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_close(SB) - GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) TEXT libc_clonefile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clonefile(SB) - GLOBL ·libc_clonefile_trampoline_addr(SB), RODATA, $8 DATA ·libc_clonefile_trampoline_addr(SB)/8, $libc_clonefile_trampoline<>(SB) TEXT libc_clonefileat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clonefileat(SB) - GLOBL ·libc_clonefileat_trampoline_addr(SB), RODATA, $8 DATA ·libc_clonefileat_trampoline_addr(SB)/8, $libc_clonefileat_trampoline<>(SB) TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup(SB) - GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) - GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) TEXT libc_exchangedata_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exchangedata(SB) - GLOBL ·libc_exchangedata_trampoline_addr(SB), RODATA, $8 DATA ·libc_exchangedata_trampoline_addr(SB)/8, $libc_exchangedata_trampoline<>(SB) TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exit(SB) - GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_faccessat(SB) - GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) - GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) - GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) - GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmodat(SB) - GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) - GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) - GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) TEXT libc_fclonefileat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fclonefileat(SB) - GLOBL ·libc_fclonefileat_trampoline_addr(SB), RODATA, $8 DATA ·libc_fclonefileat_trampoline_addr(SB)/8, $libc_fclonefileat_trampoline<>(SB) TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flock(SB) - GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) - GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) - GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) - GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getcwd(SB) - GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) TEXT libc_getdtablesize_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) - GLOBL ·libc_getdtablesize_trampoline_addr(SB), RODATA, $8 DATA ·libc_getdtablesize_trampoline_addr(SB)/8, $libc_getdtablesize_trampoline<>(SB) TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) - GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) - GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) - GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) - GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) - GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) - GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) - GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) - GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) - GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) - GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) - GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_gettimeofday(SB) - GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) - GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) - GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) - GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) - GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_link(SB) - GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_linkat(SB) - GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listen(SB) - GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) - GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdirat(SB) - GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) - GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) - GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mount(SB) - GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8 DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB) TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_open(SB) - GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_openat(SB) - GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) - GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pread(SB) - GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) - GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_read(SB) - GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) - GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlinkat(SB) - GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rename(SB) - GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_renameat(SB) - GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) - GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) - GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) - GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_select(SB) - GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) @@ -712,192 +595,160 @@ DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) - GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) - GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) - GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) - GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) - GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) - GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) TEXT libc_setprivexec_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setprivexec(SB) - GLOBL ·libc_setprivexec_trampoline_addr(SB), RODATA, $8 DATA ·libc_setprivexec_trampoline_addr(SB)/8, $libc_setprivexec_trampoline<>(SB) TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) - GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) - GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) - GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) - GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) - GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) - GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlinkat(SB) - GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sync(SB) - GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) - GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_umask(SB) - GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) TEXT libc_undelete_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_undelete(SB) - GLOBL ·libc_undelete_trampoline_addr(SB), RODATA, $8 DATA ·libc_undelete_trampoline_addr(SB)/8, $libc_undelete_trampoline<>(SB) TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) - GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) - GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) - GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_write(SB) - GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) - GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) - GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) - GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB) TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatat(SB) - GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8 DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB) TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatfs(SB) - GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8 DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB) TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getfsstat(SB) - GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lstat(SB) - GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8 DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB) TEXT libc_ptrace_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) - GLOBL ·libc_ptrace_trampoline_addr(SB), RODATA, $8 DATA ·libc_ptrace_trampoline_addr(SB)/8, $libc_ptrace_trampoline<>(SB) TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_stat(SB) - GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8 DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB) TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_statfs(SB) - GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8 DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 0eabac7ade..aad65fc793 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build dragonfly && amd64 -// +build dragonfly,amd64 package unix @@ -1642,28 +1641,6 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index ee313eb007..c0096391af 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && 386 -// +build freebsd,386 package unix @@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 4c986e448e..7664df7496 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && amd64 -// +build freebsd,amd64 package unix @@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 555216944a..ae099182c9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && arm -// +build freebsd,arm package unix @@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index 67a226fbf5..11fd5d45bb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && arm64 -// +build freebsd,arm64 package unix @@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go index f0b9ddaaa2..c3d2d65307 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build freebsd && riscv64 -// +build freebsd,riscv64 package unix @@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go index b57c7050d7..c698cbc01a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build illumos && amd64 -// +build illumos,amd64 package unix @@ -40,7 +39,7 @@ func readv(fd int, iovs []Iovec) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procreadv)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -55,7 +54,7 @@ func preadv(fd int, iovs []Iovec, off int64) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpreadv)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -70,7 +69,7 @@ func writev(fd int, iovs []Iovec) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwritev)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -85,7 +84,7 @@ func pwritev(fd int, iovs []Iovec, off int64) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpwritev)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -96,7 +95,7 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept4)), 4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) fd = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux.go index da63d9d782..87d8612a1d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -38,6 +37,21 @@ func fchmodat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fchmodat2(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHMODAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -892,6 +906,16 @@ func Fspick(dirfd int, pathName string, flags int) (fd int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fsconfig(fd int, cmd uint, key *byte, value *byte, aux int) (err error) { + _, _, e1 := Syscall6(SYS_FSCONFIG, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(value)), uintptr(aux), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -1356,7 +1380,7 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { +func pselect6(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_argpack) (n int, err error) { r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) n = int(r0) if e1 != 0 { @@ -1734,28 +1758,6 @@ func exitThread(code int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, p *byte, np int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, p *byte, np int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func readv(fd int, iovs []Iovec) (n int, err error) { var _p0 unsafe.Pointer if len(iovs) > 0 { @@ -1868,6 +1870,17 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func mremap(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (xaddr uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MREMAP, uintptr(oldaddr), uintptr(oldlength), uintptr(newlength), uintptr(flags), uintptr(newaddr), 0) + xaddr = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Madvise(b []byte, advice int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { @@ -2172,3 +2185,47 @@ func rtSigprocmask(how int, set *Sigset_t, oldset *Sigset_t, sigsetsize uintptr) } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) { + RawSyscallNoError(SYS_GETRESUID, uintptr(unsafe.Pointer(ruid)), uintptr(unsafe.Pointer(euid)), uintptr(unsafe.Pointer(suid))) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) { + RawSyscallNoError(SYS_GETRESGID, uintptr(unsafe.Pointer(rgid)), uintptr(unsafe.Pointer(egid)), uintptr(unsafe.Pointer(sgid))) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func schedSetattr(pid int, attr *SchedAttr, flags uint) (err error) { + _, _, e1 := Syscall(SYS_SCHED_SETATTR, uintptr(pid), uintptr(unsafe.Pointer(attr)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func schedGetattr(pid int, attr *SchedAttr, size uint, flags uint) (err error) { + _, _, e1 := Syscall6(SYS_SCHED_GETATTR, uintptr(pid), uintptr(unsafe.Pointer(attr)), uintptr(size), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) { + _, _, e1 := Syscall6(SYS_CACHESTAT, uintptr(fd), uintptr(unsafe.Pointer(crange)), uintptr(unsafe.Pointer(cstat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 07b549cc25..4def3e9fcb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && 386 -// +build linux,386 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 5f481bf83f..fef2bc8ba9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && amd64 -// +build linux,amd64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 824cd52c7f..a9fd76a884 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && arm -// +build linux,arm package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index e77aecfe98..4600650280 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && arm64 -// +build linux,arm64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go index 806ffd1e12..c8987d2646 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && loong64 -// +build linux,loong64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 961a3afb7b..921f430611 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips -// +build linux,mips package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index ed05005e91..44f067829c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips64 -// +build linux,mips64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index d365b718f3..e7fa0abf0d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mips64le -// +build linux,mips64le package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index c3f1b8bbde..8c5125675e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && mipsle -// +build linux,mipsle package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go index a6574cf98b..7392fd45e4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc -// +build linux,ppc package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index f40990264f..41180434e6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc64 -// +build linux,ppc64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 9dfcc29974..40c6ce7ae5 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && ppc64le -// +build linux,ppc64le package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index 0b29239583..2cfe34adb1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && riscv64 -// +build linux,riscv64 package unix @@ -531,3 +530,19 @@ func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, f } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func riscvHWProbe(pairs []RISCVHWProbePairs, cpuCount uintptr, cpus *CPUSet, flags uint) (err error) { + var _p0 unsafe.Pointer + if len(pairs) > 0 { + _p0 = unsafe.Pointer(&pairs[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_RISCV_HWPROBE, uintptr(_p0), uintptr(len(pairs)), uintptr(cpuCount), uintptr(unsafe.Pointer(cpus)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 6cde32237d..61e6f07097 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && s390x -// +build linux,s390x package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index 5253d65bf1..834b842042 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && sparc64 -// +build linux,sparc64 package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index cdb2af5ae0..e91ebc14a1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && 386 -// +build netbsd,386 package unix @@ -1824,20 +1823,13 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -1846,13 +1838,9 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) +func mremapNetBSD(oldp uintptr, oldsize uintptr, newp uintptr, newsize uintptr, flags int) (xaddr uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MREMAP, uintptr(oldp), uintptr(oldsize), uintptr(newp), uintptr(newsize), uintptr(flags), 0) + xaddr = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index 9d25f76b0b..be28babbcd 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && amd64 -// +build netbsd,amd64 package unix @@ -1824,20 +1823,13 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -1846,13 +1838,9 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) +func mremapNetBSD(oldp uintptr, oldsize uintptr, newp uintptr, newsize uintptr, flags int) (xaddr uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MREMAP, uintptr(oldp), uintptr(oldsize), uintptr(newp), uintptr(newsize), uintptr(flags), 0) + xaddr = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index d3f8035169..fb587e8261 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && arm -// +build netbsd,arm package unix @@ -1824,20 +1823,13 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -1846,13 +1838,9 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) +func mremapNetBSD(oldp uintptr, oldsize uintptr, newp uintptr, newsize uintptr, flags int) (xaddr uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MREMAP, uintptr(oldp), uintptr(oldsize), uintptr(newp), uintptr(newsize), uintptr(flags), 0) + xaddr = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index 887188a529..d576438bb0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build netbsd && arm64 -// +build netbsd,arm64 package unix @@ -1824,20 +1823,13 @@ func munmap(addr uintptr, length uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -1846,13 +1838,9 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) +func mremapNetBSD(oldp uintptr, oldsize uintptr, newp uintptr, newsize uintptr, flags int) (xaddr uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MREMAP, uintptr(oldp), uintptr(oldsize), uintptr(newp), uintptr(newsize), uintptr(flags), 0) + xaddr = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 6699a783e1..9dc42410b7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && 386 -// +build openbsd,386 package unix @@ -519,6 +518,28 @@ var libc_getcwd_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) { + syscall_rawSyscall(libc_getresuid_trampoline_addr, uintptr(unsafe.Pointer(ruid)), uintptr(unsafe.Pointer(euid)), uintptr(unsafe.Pointer(suid))) + return +} + +var libc_getresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresuid getresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) { + syscall_rawSyscall(libc_getresgid_trampoline_addr, uintptr(unsafe.Pointer(rgid)), uintptr(unsafe.Pointer(egid)), uintptr(unsafe.Pointer(sgid))) + return +} + +var libc_getresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresgid getresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -527,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -535,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -561,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2189,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2198,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +var libc_getfsstat_trampoline_addr uintptr -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2227,3 +2269,31 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 04f0de34b2..41b5617316 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -158,6 +158,16 @@ TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $4 DATA ·libc_getcwd_trampoline_addr(SB)/4, $libc_getcwd_trampoline<>(SB) +TEXT libc_getresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresuid(SB) +GLOBL ·libc_getresuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getresuid_trampoline_addr(SB)/4, $libc_getresuid_trampoline<>(SB) + +TEXT libc_getresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresgid(SB) +GLOBL ·libc_getresgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getresgid_trampoline_addr(SB)/4, $libc_getresgid_trampoline<>(SB) + TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $4 @@ -168,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4 DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4 @@ -658,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $4 DATA ·libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getfsstat_trampoline_addr(SB)/4, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $4 DATA ·libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pledge_trampoline_addr(SB)/4, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unveil_trampoline_addr(SB)/4, $libc_unveil_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 1e775fe057..0d3a0751cd 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && amd64 -// +build openbsd,amd64 package unix @@ -519,6 +518,28 @@ var libc_getcwd_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) { + syscall_rawSyscall(libc_getresuid_trampoline_addr, uintptr(unsafe.Pointer(ruid)), uintptr(unsafe.Pointer(euid)), uintptr(unsafe.Pointer(suid))) + return +} + +var libc_getresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresuid getresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) { + syscall_rawSyscall(libc_getresgid_trampoline_addr, uintptr(unsafe.Pointer(rgid)), uintptr(unsafe.Pointer(egid)), uintptr(unsafe.Pointer(sgid))) + return +} + +var libc_getresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresgid getresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -527,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -535,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -561,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2189,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2198,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +var libc_getfsstat_trampoline_addr uintptr -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2227,3 +2269,31 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 27b6f4df74..4019a656f6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -158,6 +158,16 @@ TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) +TEXT libc_getresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresuid(SB) +GLOBL ·libc_getresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresuid_trampoline_addr(SB)/8, $libc_getresuid_trampoline<>(SB) + +TEXT libc_getresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresgid(SB) +GLOBL ·libc_getresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresgid_trampoline_addr(SB)/8, $libc_getresgid_trampoline<>(SB) + TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 @@ -168,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 @@ -658,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index 7f6427899a..c39f7776db 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && arm -// +build openbsd,arm package unix @@ -519,6 +518,28 @@ var libc_getcwd_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) { + syscall_rawSyscall(libc_getresuid_trampoline_addr, uintptr(unsafe.Pointer(ruid)), uintptr(unsafe.Pointer(euid)), uintptr(unsafe.Pointer(suid))) + return +} + +var libc_getresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresuid getresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) { + syscall_rawSyscall(libc_getresgid_trampoline_addr, uintptr(unsafe.Pointer(rgid)), uintptr(unsafe.Pointer(egid)), uintptr(unsafe.Pointer(sgid))) + return +} + +var libc_getresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresgid getresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -527,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -535,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -561,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2189,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2198,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +var libc_getfsstat_trampoline_addr uintptr -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2227,3 +2269,31 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index b797045fd2..ac4af24f90 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -158,6 +158,16 @@ TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $4 DATA ·libc_getcwd_trampoline_addr(SB)/4, $libc_getcwd_trampoline<>(SB) +TEXT libc_getresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresuid(SB) +GLOBL ·libc_getresuid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getresuid_trampoline_addr(SB)/4, $libc_getresuid_trampoline<>(SB) + +TEXT libc_getresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresgid(SB) +GLOBL ·libc_getresgid_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getresgid_trampoline_addr(SB)/4, $libc_getresgid_trampoline<>(SB) + TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $4 @@ -168,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4 DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4 @@ -658,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $4 DATA ·libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $4 +DATA ·libc_getfsstat_trampoline_addr(SB)/4, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $4 DATA ·libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $4 +DATA ·libc_pledge_trampoline_addr(SB)/4, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $4 +DATA ·libc_unveil_trampoline_addr(SB)/4, $libc_unveil_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 756ef7b173..57571d072f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && arm64 -// +build openbsd,arm64 package unix @@ -519,6 +518,28 @@ var libc_getcwd_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) { + syscall_rawSyscall(libc_getresuid_trampoline_addr, uintptr(unsafe.Pointer(ruid)), uintptr(unsafe.Pointer(euid)), uintptr(unsafe.Pointer(suid))) + return +} + +var libc_getresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresuid getresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) { + syscall_rawSyscall(libc_getresgid_trampoline_addr, uintptr(unsafe.Pointer(rgid)), uintptr(unsafe.Pointer(egid)), uintptr(unsafe.Pointer(sgid))) + return +} + +var libc_getresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresgid getresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -527,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -535,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -561,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2189,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2198,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +var libc_getfsstat_trampoline_addr uintptr -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2227,3 +2269,31 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index a871266221..f77d532121 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -158,6 +158,16 @@ TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) +TEXT libc_getresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresuid(SB) +GLOBL ·libc_getresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresuid_trampoline_addr(SB)/8, $libc_getresuid_trampoline<>(SB) + +TEXT libc_getresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresgid(SB) +GLOBL ·libc_getresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresgid_trampoline_addr(SB)/8, $libc_getresgid_trampoline<>(SB) + TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 @@ -168,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 @@ -658,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index 7bc2e24eb9..e62963e67e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && mips64 -// +build openbsd,mips64 package unix @@ -519,6 +518,28 @@ var libc_getcwd_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) { + syscall_rawSyscall(libc_getresuid_trampoline_addr, uintptr(unsafe.Pointer(ruid)), uintptr(unsafe.Pointer(euid)), uintptr(unsafe.Pointer(suid))) + return +} + +var libc_getresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresuid getresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) { + syscall_rawSyscall(libc_getresgid_trampoline_addr, uintptr(unsafe.Pointer(rgid)), uintptr(unsafe.Pointer(egid)), uintptr(unsafe.Pointer(sgid))) + return +} + +var libc_getresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresgid getresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -527,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -535,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -561,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2189,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2198,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +var libc_getfsstat_trampoline_addr uintptr -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2227,3 +2269,31 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index 05d4bffd79..fae140b62c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -158,6 +158,16 @@ TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) +TEXT libc_getresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresuid(SB) +GLOBL ·libc_getresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresuid_trampoline_addr(SB)/8, $libc_getresuid_trampoline<>(SB) + +TEXT libc_getresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresgid(SB) +GLOBL ·libc_getresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresgid_trampoline_addr(SB)/8, $libc_getresgid_trampoline<>(SB) + TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 @@ -168,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 @@ -658,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index 739be6217a..00831354c8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && ppc64 -// +build openbsd,ppc64 package unix @@ -519,6 +518,28 @@ var libc_getcwd_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) { + syscall_rawSyscall(libc_getresuid_trampoline_addr, uintptr(unsafe.Pointer(ruid)), uintptr(unsafe.Pointer(euid)), uintptr(unsafe.Pointer(suid))) + return +} + +var libc_getresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresuid getresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) { + syscall_rawSyscall(libc_getresgid_trampoline_addr, uintptr(unsafe.Pointer(rgid)), uintptr(unsafe.Pointer(egid)), uintptr(unsafe.Pointer(sgid))) + return +} + +var libc_getresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresgid getresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -527,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -535,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -561,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2189,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2198,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +var libc_getfsstat_trampoline_addr uintptr -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2227,3 +2269,31 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index 74a25f8d64..9d1e0ff06d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -189,6 +189,18 @@ TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) +TEXT libc_getresuid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getresuid(SB) + RET +GLOBL ·libc_getresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresuid_trampoline_addr(SB)/8, $libc_getresuid_trampoline<>(SB) + +TEXT libc_getresgid_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getresgid(SB) + RET +GLOBL ·libc_getresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresgid_trampoline_addr(SB)/8, $libc_getresgid_trampoline<>(SB) + TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_ioctl(SB) RET @@ -201,6 +213,12 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fcntl(SB) + RET +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_ppoll(SB) RET @@ -789,8 +807,26 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_getfsstat(SB) + RET +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_utimensat(SB) RET GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_pledge(SB) + RET +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_unveil(SB) + RET +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index 7d95a19780..79029ed584 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build openbsd && riscv64 -// +build openbsd,riscv64 package unix @@ -519,6 +518,28 @@ var libc_getcwd_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func getresuid(ruid *_C_int, euid *_C_int, suid *_C_int) { + syscall_rawSyscall(libc_getresuid_trampoline_addr, uintptr(unsafe.Pointer(ruid)), uintptr(unsafe.Pointer(euid)), uintptr(unsafe.Pointer(suid))) + return +} + +var libc_getresuid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresuid getresuid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int) { + syscall_rawSyscall(libc_getresgid_trampoline_addr, uintptr(unsafe.Pointer(rgid)), uintptr(unsafe.Pointer(egid)), uintptr(unsafe.Pointer(sgid))) + return +} + +var libc_getresgid_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getresgid getresgid "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -527,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { return } +var libc_ioctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -535,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { return } -var libc_ioctl_trampoline_addr uintptr - -//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -561,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -2189,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) +func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2198,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +var libc_getfsstat_trampoline_addr uintptr -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2227,3 +2269,31 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error var libc_utimensat_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pledge(promises *byte, execpromises *byte) (err error) { + _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pledge_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pledge pledge "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unveil(path *byte, flags *byte) (err error) { + _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_unveil_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_unveil unveil "libc.so" diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index 990be24574..da115f9a4b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -158,6 +158,16 @@ TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) +TEXT libc_getresuid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresuid(SB) +GLOBL ·libc_getresuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresuid_trampoline_addr(SB)/8, $libc_getresuid_trampoline<>(SB) + +TEXT libc_getresgid_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getresgid(SB) +GLOBL ·libc_getresgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getresgid_trampoline_addr(SB)/8, $libc_getresgid_trampoline<>(SB) + TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 @@ -168,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 @@ -658,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getfsstat(SB) +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8 DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB) + +TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pledge(SB) +GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB) + +TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_unveil(SB) +GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 609d1c598a..829b87feb8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build solaris && amd64 -// +build solaris,amd64 package unix @@ -436,7 +435,7 @@ func pipe(p *[2]_C_int) (n int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe)), 1, uintptr(unsafe.Pointer(p)), 0, 0, 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -446,7 +445,7 @@ func pipe(p *[2]_C_int) (n int, err error) { func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -456,7 +455,7 @@ func pipe2(p *[2]_C_int, flags int) (err error) { func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -471,7 +470,7 @@ func Getcwd(buf []byte) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetcwd)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0, 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -482,7 +481,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -492,7 +491,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procsetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -503,7 +502,7 @@ func wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32, r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwait4)), 4, uintptr(pid), uintptr(unsafe.Pointer(statusp)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int32(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -518,7 +517,7 @@ func gethostname(buf []byte) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgethostname)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0, 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -533,7 +532,7 @@ func utimes(path string, times *[2]Timeval) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procutimes)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -548,7 +547,7 @@ func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procutimensat)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -559,7 +558,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0) val = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -569,7 +568,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { func futimesat(fildes int, path *byte, times *[2]Timeval) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfutimesat)), 3, uintptr(fildes), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times)), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -580,7 +579,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept)), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) fd = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -591,7 +590,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_recvmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -602,7 +601,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_sendmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -612,7 +611,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { func acct(path *byte) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procacct)), 1, uintptr(unsafe.Pointer(path)), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -647,7 +646,7 @@ func ioctlRet(fd int, req int, arg uintptr) (ret int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) ret = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -658,7 +657,7 @@ func ioctlPtrRet(fd int, req int, arg unsafe.Pointer) (ret int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) ret = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -669,7 +668,7 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpoll)), 3, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -684,7 +683,7 @@ func Access(path string, mode uint32) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAccess)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -694,7 +693,7 @@ func Access(path string, mode uint32) (err error) { func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAdjtime)), 2, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -709,7 +708,7 @@ func Chdir(path string) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChdir)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -724,7 +723,7 @@ func Chmod(path string, mode uint32) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChmod)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -739,7 +738,7 @@ func Chown(path string, uid int, gid int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChown)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -754,7 +753,7 @@ func Chroot(path string) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChroot)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -764,7 +763,7 @@ func Chroot(path string) (err error) { func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClockGettime)), 2, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -774,7 +773,7 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { func Close(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClose)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -790,7 +789,7 @@ func Creat(path string, mode uint32) (fd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procCreat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) fd = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -801,7 +800,7 @@ func Dup(fd int) (nfd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup)), 1, uintptr(fd), 0, 0, 0, 0, 0) nfd = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -811,7 +810,7 @@ func Dup(fd int) (nfd int, err error) { func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup2)), 2, uintptr(oldfd), uintptr(newfd), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -833,7 +832,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFaccessat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -843,7 +842,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { func Fchdir(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchdir)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -853,7 +852,7 @@ func Fchdir(fd int) (err error) { func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmod)), 2, uintptr(fd), uintptr(mode), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -868,7 +867,7 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmodat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -878,7 +877,7 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchown)), 3, uintptr(fd), uintptr(uid), uintptr(gid), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -893,7 +892,7 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchownat)), 5, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -903,7 +902,7 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { func Fdatasync(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFdatasync)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -913,7 +912,7 @@ func Fdatasync(fd int) (err error) { func Flock(fd int, how int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFlock)), 2, uintptr(fd), uintptr(how), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -924,7 +923,7 @@ func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFpathconf)), 2, uintptr(fd), uintptr(name), 0, 0, 0, 0) val = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -934,7 +933,7 @@ func Fpathconf(fd int, name int) (val int, err error) { func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstat)), 2, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -949,7 +948,7 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstatat)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -959,7 +958,7 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { func Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstatvfs)), 2, uintptr(fd), uintptr(unsafe.Pointer(vfsstat)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -974,7 +973,7 @@ func Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetdents)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1001,7 +1000,7 @@ func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) pgid = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1012,7 +1011,7 @@ func Getpgrp() (pgid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgrp)), 0, 0, 0, 0, 0, 0, 0) pgid = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1047,7 +1046,7 @@ func Getpriority(which int, who int) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetpriority)), 2, uintptr(which), uintptr(who), 0, 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1057,7 +1056,7 @@ func Getpriority(which int, who int) (n int, err error) { func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1067,7 +1066,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) { func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrusage)), 2, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1078,7 +1077,7 @@ func Getsid(pid int) (sid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetsid)), 1, uintptr(pid), 0, 0, 0, 0, 0) sid = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1088,7 +1087,7 @@ func Getsid(pid int) (sid int, err error) { func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGettimeofday)), 1, uintptr(unsafe.Pointer(tv)), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1106,7 +1105,7 @@ func Getuid() (uid int) { func Kill(pid int, signum syscall.Signal) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procKill)), 2, uintptr(pid), uintptr(signum), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1121,7 +1120,7 @@ func Lchown(path string, uid int, gid int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLchown)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1141,7 +1140,7 @@ func Link(path string, link string) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLink)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1151,7 +1150,7 @@ func Link(path string, link string) (err error) { func Listen(s int, backlog int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_llisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1166,7 +1165,7 @@ func Lstat(path string, stat *Stat_t) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLstat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1180,7 +1179,7 @@ func Madvise(b []byte, advice int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMadvise)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(advice), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1195,7 +1194,7 @@ func Mkdir(path string, mode uint32) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkdir)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1210,7 +1209,7 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkdirat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1225,7 +1224,7 @@ func Mkfifo(path string, mode uint32) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkfifo)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1240,7 +1239,7 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkfifoat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1255,7 +1254,7 @@ func Mknod(path string, mode uint32, dev int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMknod)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1270,7 +1269,7 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMknodat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1284,7 +1283,7 @@ func Mlock(b []byte) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMlock)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1294,7 +1293,7 @@ func Mlock(b []byte) (err error) { func Mlockall(flags int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMlockall)), 1, uintptr(flags), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1308,7 +1307,7 @@ func Mprotect(b []byte, prot int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMprotect)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(prot), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1322,7 +1321,7 @@ func Msync(b []byte, flags int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMsync)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(flags), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1336,7 +1335,7 @@ func Munlock(b []byte) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMunlock)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1346,7 +1345,7 @@ func Munlock(b []byte) (err error) { func Munlockall() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMunlockall)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1356,7 +1355,7 @@ func Munlockall() (err error) { func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procNanosleep)), 2, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1372,7 +1371,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procOpen)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0, 0) fd = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1388,7 +1387,7 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procOpenat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0) fd = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1404,7 +1403,7 @@ func Pathconf(path string, name int) (val int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPathconf)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0, 0, 0, 0) val = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1414,7 +1413,7 @@ func Pathconf(path string, name int) (val int, err error) { func Pause() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPause)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1429,7 +1428,7 @@ func pread(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpread)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1444,7 +1443,7 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpwrite)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1459,7 +1458,7 @@ func read(fd int, p []byte) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1479,7 +1478,7 @@ func Readlink(path string, buf []byte) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procReadlink)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(len(buf)), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1499,7 +1498,7 @@ func Rename(from string, to string) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRename)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1519,7 +1518,7 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRenameat)), 4, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1534,7 +1533,7 @@ func Rmdir(path string) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRmdir)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1545,7 +1544,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proclseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0) newoffset = int64(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1556,7 +1555,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSelect)), 5, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1566,7 +1565,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err func Setegid(egid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetegid)), 1, uintptr(egid), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1576,7 +1575,7 @@ func Setegid(egid int) (err error) { func Seteuid(euid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSeteuid)), 1, uintptr(euid), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1586,7 +1585,7 @@ func Seteuid(euid int) (err error) { func Setgid(gid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetgid)), 1, uintptr(gid), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1600,7 +1599,7 @@ func Sethostname(p []byte) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSethostname)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1610,7 +1609,7 @@ func Sethostname(p []byte) (err error) { func Setpgid(pid int, pgid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetpgid)), 2, uintptr(pid), uintptr(pgid), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1620,7 +1619,7 @@ func Setpgid(pid int, pgid int) (err error) { func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSetpriority)), 3, uintptr(which), uintptr(who), uintptr(prio), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1630,7 +1629,7 @@ func Setpriority(which int, who int, prio int) (err error) { func Setregid(rgid int, egid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetregid)), 2, uintptr(rgid), uintptr(egid), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1640,7 +1639,7 @@ func Setregid(rgid int, egid int) (err error) { func Setreuid(ruid int, euid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetreuid)), 2, uintptr(ruid), uintptr(euid), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1651,7 +1650,7 @@ func Setsid() (pid int, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetsid)), 0, 0, 0, 0, 0, 0, 0) pid = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1661,7 +1660,7 @@ func Setsid() (pid int, err error) { func Setuid(uid int) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetuid)), 1, uintptr(uid), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1671,7 +1670,7 @@ func Setuid(uid int) (err error) { func Shutdown(s int, how int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procshutdown)), 2, uintptr(s), uintptr(how), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1686,7 +1685,7 @@ func Stat(path string, stat *Stat_t) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procStat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1701,7 +1700,7 @@ func Statvfs(path string, vfsstat *Statvfs_t) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procStatvfs)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(vfsstat)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1721,7 +1720,7 @@ func Symlink(path string, link string) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSymlink)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1731,7 +1730,7 @@ func Symlink(path string, link string) (err error) { func Sync() (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSync)), 0, 0, 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1742,7 +1741,7 @@ func Sysconf(which int) (n int64, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSysconf)), 1, uintptr(which), 0, 0, 0, 0, 0) n = int64(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1753,7 +1752,7 @@ func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0) ticks = uintptr(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1768,7 +1767,7 @@ func Truncate(path string, length int64) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procTruncate)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1778,7 +1777,7 @@ func Truncate(path string, length int64) (err error) { func Fsync(fd int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFsync)), 1, uintptr(fd), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1788,7 +1787,7 @@ func Fsync(fd int) (err error) { func Ftruncate(fd int, length int64) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFtruncate)), 2, uintptr(fd), uintptr(length), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1806,7 +1805,7 @@ func Umask(mask int) (oldmask int) { func Uname(buf *Utsname) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procUname)), 1, uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1821,7 +1820,7 @@ func Unmount(target string, flags int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procumount)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1836,7 +1835,7 @@ func Unlink(path string) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUnlink)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1851,7 +1850,7 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUnlinkat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1861,7 +1860,7 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { func Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUstat)), 2, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1876,7 +1875,7 @@ func Utime(path string, buf *Utimbuf) (err error) { } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUtime)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1886,7 +1885,7 @@ func Utime(path string, buf *Utimbuf) (err error) { func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_bind)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1896,7 +1895,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_connect)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1907,7 +1906,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmmap)), 6, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1917,7 +1916,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmunmap)), 2, uintptr(addr), uintptr(length), 0, 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1928,7 +1927,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsendfile)), 4, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1942,7 +1941,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_sendto)), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1953,7 +1952,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_socket)), 3, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0) fd = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1963,7 +1962,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) { func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&proc__xnet_socketpair)), 4, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1978,7 +1977,7 @@ func write(fd int, p []byte) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1988,7 +1987,7 @@ func write(fd int, p []byte) (n int, err error) { func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_getsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -1998,7 +1997,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetpeername)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2008,7 +2007,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsetsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2023,7 +2022,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procrecvfrom)), 6, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2034,7 +2033,7 @@ func port_create() (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_create)), 0, 0, 0, 0, 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2045,7 +2044,7 @@ func port_associate(port int, source int, object uintptr, events int, user *byte r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_associate)), 5, uintptr(port), uintptr(source), uintptr(object), uintptr(events), uintptr(unsafe.Pointer(user)), 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2056,7 +2055,7 @@ func port_dissociate(port int, source int, object uintptr) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_dissociate)), 3, uintptr(port), uintptr(source), uintptr(object), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2067,7 +2066,7 @@ func port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) { r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_get)), 3, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(unsafe.Pointer(timeout)), 0, 0, 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2078,7 +2077,7 @@ func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Times r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_getn)), 5, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(max), uintptr(unsafe.Pointer(nget)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2088,7 +2087,7 @@ func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Times func putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procputmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(flags), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } @@ -2098,7 +2097,7 @@ func putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) { func getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(unsafe.Pointer(flags)), 0, 0) if e1 != 0 { - err = e1 + err = errnoErr(e1) } return } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go index c31681743c..94f0112383 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build zos && s390x -// +build zos,s390x package unix @@ -40,17 +39,6 @@ func read(fd int, p []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go index 55e0484719..3a58ae819a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index d2243cf83f..dcb7a0eb72 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go index 82dc51bd8b..db5a7bf13c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go index cbdda1a4ae..7be575a777 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go index f55eae1a82..d6e3174c69 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go index e44054470b..ee97157d01 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go index a0db82fce2..35c3b91d0f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index f8298ff9b5..5edda76870 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go index 5eb433bbf0..0dc9e8b4d9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index 703675c0c4..308ddf3a1f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 4e0d96107b..418664e3dc 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 01636b838d..34d0b86d7c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index ad99bc106a..b71cf45e2e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go index 89dcc42747..e32df1c1ee 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go index ee37aaa0c9..15ad6111f3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index c9c4ad0314..0cc3ce496e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux package unix @@ -447,4 +446,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 12ff3417c5..856d92d69e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux package unix @@ -369,4 +368,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index c3fb5e77ab..8d467094cf 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux package unix @@ -411,4 +410,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 358c847a40..edc173244d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux package unix @@ -314,4 +313,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index 81c4849b16..445eba2061 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux package unix @@ -308,4 +307,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 202a57e900..adba01bca7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux package unix @@ -431,4 +430,10 @@ const ( SYS_PROCESS_MRELEASE = 4448 SYS_FUTEX_WAITV = 4449 SYS_SET_MEMPOLICY_HOME_NODE = 4450 + SYS_CACHESTAT = 4451 + SYS_FCHMODAT2 = 4452 + SYS_MAP_SHADOW_STACK = 4453 + SYS_FUTEX_WAKE = 4454 + SYS_FUTEX_WAIT = 4455 + SYS_FUTEX_REQUEUE = 4456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 1fbceb52d7..014c4e9c7a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux package unix @@ -361,4 +360,10 @@ const ( SYS_PROCESS_MRELEASE = 5448 SYS_FUTEX_WAITV = 5449 SYS_SET_MEMPOLICY_HOME_NODE = 5450 + SYS_CACHESTAT = 5451 + SYS_FCHMODAT2 = 5452 + SYS_MAP_SHADOW_STACK = 5453 + SYS_FUTEX_WAKE = 5454 + SYS_FUTEX_WAIT = 5455 + SYS_FUTEX_REQUEUE = 5456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index b4ffb7a207..ccc97d74d0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux package unix @@ -361,4 +360,10 @@ const ( SYS_PROCESS_MRELEASE = 5448 SYS_FUTEX_WAITV = 5449 SYS_SET_MEMPOLICY_HOME_NODE = 5450 + SYS_CACHESTAT = 5451 + SYS_FCHMODAT2 = 5452 + SYS_MAP_SHADOW_STACK = 5453 + SYS_FUTEX_WAKE = 5454 + SYS_FUTEX_WAIT = 5455 + SYS_FUTEX_REQUEUE = 5456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 867985f9b4..ec2b64a95d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux package unix @@ -431,4 +430,10 @@ const ( SYS_PROCESS_MRELEASE = 4448 SYS_FUTEX_WAITV = 4449 SYS_SET_MEMPOLICY_HOME_NODE = 4450 + SYS_CACHESTAT = 4451 + SYS_FCHMODAT2 = 4452 + SYS_MAP_SHADOW_STACK = 4453 + SYS_FUTEX_WAKE = 4454 + SYS_FUTEX_WAIT = 4455 + SYS_FUTEX_REQUEUE = 4456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index a8cce69ede..21a839e338 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux package unix @@ -438,4 +437,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index d44c5b39d7..c11121ec3b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux package unix @@ -410,4 +409,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 4214dd9c03..909b631fcb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux package unix @@ -410,4 +409,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 3e594a8c09..e49bed16ea 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux package unix @@ -251,6 +250,8 @@ const ( SYS_ACCEPT4 = 242 SYS_RECVMMSG = 243 SYS_ARCH_SPECIFIC_SYSCALL = 244 + SYS_RISCV_HWPROBE = 258 + SYS_RISCV_FLUSH_ICACHE = 259 SYS_WAIT4 = 260 SYS_PRLIMIT64 = 261 SYS_FANOTIFY_INIT = 262 @@ -313,4 +314,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 7ea465204b..66017d2d32 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux package unix @@ -372,7 +371,14 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 92f628ef4f..47bab18dce 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux package unix @@ -389,4 +388,10 @@ const ( SYS_PROCESS_MRELEASE = 448 SYS_FUTEX_WAITV = 449 SYS_SET_MEMPOLICY_HOME_NODE = 450 + SYS_CACHESTAT = 451 + SYS_FCHMODAT2 = 452 + SYS_MAP_SHADOW_STACK = 453 + SYS_FUTEX_WAKE = 454 + SYS_FUTEX_WAIT = 455 + SYS_FUTEX_REQUEUE = 456 ) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go index 3a6699eba9..b2aa8cd495 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go index 5677cd4f15..524a1b1c9a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go index e784cb6db1..d59b943ac2 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go index bd4952efa5..31e771d53e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index 597733813e..9fd77c6cb4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index 16af291899..af10af28cb 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go index f59b18a977..cc2028af4b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go index 721ef59103..c06dd4415a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go index 01c43a01fd..9ddbf3e08f 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go index f258cfa24e..19a6ee4134 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go index 07919e0ecc..05192a782d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go index 073daad43b..b2e3085819 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go index 7a8161c1d1..3e6d57cae7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && aix -// +build ppc,aix package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go index 07ed733c51..3a219bdce7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && aix -// +build ppc64,aix package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 690cefc3d0..091d107f3a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && darwin -// +build amd64,darwin package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 5bffc10eac..28ff4ef74d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && darwin -// +build arm64,darwin package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index d0ba8e9b86..30e405bb4c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && dragonfly -// +build amd64,dragonfly package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 29dc483378..6cbd094a3a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && freebsd -// +build 386,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index 0a89b28906..7c03b6ee77 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && freebsd -// +build amd64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index c8666bb152..422107ee8b 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && freebsd -// +build arm,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 88fb48a887..505a12acfd 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && freebsd -// +build arm64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go index 698dc975e9..cc986c7900 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && freebsd -// +build riscv64,freebsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux.go index ca84727cfe..eff6bcdef8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -1,7 +1,6 @@ // Code generated by mkmerge; DO NOT EDIT. //go:build linux -// +build linux package unix @@ -175,7 +174,8 @@ type FscryptPolicyV2 struct { Contents_encryption_mode uint8 Filenames_encryption_mode uint8 Flags uint8 - _ [4]uint8 + Log2_data_unit_size uint8 + _ [3]uint8 Master_key_identifier [16]uint8 } @@ -456,60 +456,63 @@ type Ucred struct { } type TCPInfo struct { - State uint8 - Ca_state uint8 - Retransmits uint8 - Probes uint8 - Backoff uint8 - Options uint8 - Rto uint32 - Ato uint32 - Snd_mss uint32 - Rcv_mss uint32 - Unacked uint32 - Sacked uint32 - Lost uint32 - Retrans uint32 - Fackets uint32 - Last_data_sent uint32 - Last_ack_sent uint32 - Last_data_recv uint32 - Last_ack_recv uint32 - Pmtu uint32 - Rcv_ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Snd_ssthresh uint32 - Snd_cwnd uint32 - Advmss uint32 - Reordering uint32 - Rcv_rtt uint32 - Rcv_space uint32 - Total_retrans uint32 - Pacing_rate uint64 - Max_pacing_rate uint64 - Bytes_acked uint64 - Bytes_received uint64 - Segs_out uint32 - Segs_in uint32 - Notsent_bytes uint32 - Min_rtt uint32 - Data_segs_in uint32 - Data_segs_out uint32 - Delivery_rate uint64 - Busy_time uint64 - Rwnd_limited uint64 - Sndbuf_limited uint64 - Delivered uint32 - Delivered_ce uint32 - Bytes_sent uint64 - Bytes_retrans uint64 - Dsack_dups uint32 - Reord_seen uint32 - Rcv_ooopack uint32 - Snd_wnd uint32 - Rcv_wnd uint32 - Rehash uint32 + State uint8 + Ca_state uint8 + Retransmits uint8 + Probes uint8 + Backoff uint8 + Options uint8 + Rto uint32 + Ato uint32 + Snd_mss uint32 + Rcv_mss uint32 + Unacked uint32 + Sacked uint32 + Lost uint32 + Retrans uint32 + Fackets uint32 + Last_data_sent uint32 + Last_ack_sent uint32 + Last_data_recv uint32 + Last_ack_recv uint32 + Pmtu uint32 + Rcv_ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Snd_ssthresh uint32 + Snd_cwnd uint32 + Advmss uint32 + Reordering uint32 + Rcv_rtt uint32 + Rcv_space uint32 + Total_retrans uint32 + Pacing_rate uint64 + Max_pacing_rate uint64 + Bytes_acked uint64 + Bytes_received uint64 + Segs_out uint32 + Segs_in uint32 + Notsent_bytes uint32 + Min_rtt uint32 + Data_segs_in uint32 + Data_segs_out uint32 + Delivery_rate uint64 + Busy_time uint64 + Rwnd_limited uint64 + Sndbuf_limited uint64 + Delivered uint32 + Delivered_ce uint32 + Bytes_sent uint64 + Bytes_retrans uint64 + Dsack_dups uint32 + Reord_seen uint32 + Rcv_ooopack uint32 + Snd_wnd uint32 + Rcv_wnd uint32 + Rehash uint32 + Total_rto uint16 + Total_rto_recoveries uint16 + Total_rto_time uint32 } type CanFilter struct { @@ -552,7 +555,7 @@ const ( SizeofIPv6MTUInfo = 0x20 SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc - SizeofTCPInfo = 0xf0 + SizeofTCPInfo = 0xf8 SizeofCanFilter = 0x8 SizeofTCPRepairOpt = 0x8 ) @@ -833,6 +836,15 @@ const ( FSPICK_EMPTY_PATH = 0x8 FSMOUNT_CLOEXEC = 0x1 + + FSCONFIG_SET_FLAG = 0x0 + FSCONFIG_SET_STRING = 0x1 + FSCONFIG_SET_BINARY = 0x2 + FSCONFIG_SET_PATH = 0x3 + FSCONFIG_SET_PATH_EMPTY = 0x4 + FSCONFIG_SET_FD = 0x5 + FSCONFIG_CMD_CREATE = 0x6 + FSCONFIG_CMD_RECONFIGURE = 0x7 ) type OpenHow struct { @@ -866,6 +878,11 @@ const ( POLLNVAL = 0x20 ) +type sigset_argpack struct { + ss *Sigset_t + ssLen uintptr +} + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1538,6 +1555,11 @@ const ( IFLA_GRO_MAX_SIZE = 0x3a IFLA_TSO_MAX_SIZE = 0x3b IFLA_TSO_MAX_SEGS = 0x3c + IFLA_ALLMULTI = 0x3d + IFLA_DEVLINK_PORT = 0x3e + IFLA_GSO_IPV4_MAX_SIZE = 0x3f + IFLA_GRO_IPV4_MAX_SIZE = 0x40 + IFLA_DPLL_PIN = 0x41 IFLA_PROTO_DOWN_REASON_UNSPEC = 0x0 IFLA_PROTO_DOWN_REASON_MASK = 0x1 IFLA_PROTO_DOWN_REASON_VALUE = 0x2 @@ -1553,6 +1575,7 @@ const ( IFLA_INET6_ICMP6STATS = 0x6 IFLA_INET6_TOKEN = 0x7 IFLA_INET6_ADDR_GEN_MODE = 0x8 + IFLA_INET6_RA_MTU = 0x9 IFLA_BR_UNSPEC = 0x0 IFLA_BR_FORWARD_DELAY = 0x1 IFLA_BR_HELLO_TIME = 0x2 @@ -1600,6 +1623,9 @@ const ( IFLA_BR_MCAST_MLD_VERSION = 0x2c IFLA_BR_VLAN_STATS_PER_PORT = 0x2d IFLA_BR_MULTI_BOOLOPT = 0x2e + IFLA_BR_MCAST_QUERIER_STATE = 0x2f + IFLA_BR_FDB_N_LEARNED = 0x30 + IFLA_BR_FDB_MAX_LEARNED = 0x31 IFLA_BRPORT_UNSPEC = 0x0 IFLA_BRPORT_STATE = 0x1 IFLA_BRPORT_PRIORITY = 0x2 @@ -1637,6 +1663,14 @@ const ( IFLA_BRPORT_BACKUP_PORT = 0x22 IFLA_BRPORT_MRP_RING_OPEN = 0x23 IFLA_BRPORT_MRP_IN_OPEN = 0x24 + IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT = 0x25 + IFLA_BRPORT_MCAST_EHT_HOSTS_CNT = 0x26 + IFLA_BRPORT_LOCKED = 0x27 + IFLA_BRPORT_MAB = 0x28 + IFLA_BRPORT_MCAST_N_GROUPS = 0x29 + IFLA_BRPORT_MCAST_MAX_GROUPS = 0x2a + IFLA_BRPORT_NEIGH_VLAN_SUPPRESS = 0x2b + IFLA_BRPORT_BACKUP_NHID = 0x2c IFLA_INFO_UNSPEC = 0x0 IFLA_INFO_KIND = 0x1 IFLA_INFO_DATA = 0x2 @@ -1658,6 +1692,9 @@ const ( IFLA_MACVLAN_MACADDR = 0x4 IFLA_MACVLAN_MACADDR_DATA = 0x5 IFLA_MACVLAN_MACADDR_COUNT = 0x6 + IFLA_MACVLAN_BC_QUEUE_LEN = 0x7 + IFLA_MACVLAN_BC_QUEUE_LEN_USED = 0x8 + IFLA_MACVLAN_BC_CUTOFF = 0x9 IFLA_VRF_UNSPEC = 0x0 IFLA_VRF_TABLE = 0x1 IFLA_VRF_PORT_UNSPEC = 0x0 @@ -1681,9 +1718,22 @@ const ( IFLA_XFRM_UNSPEC = 0x0 IFLA_XFRM_LINK = 0x1 IFLA_XFRM_IF_ID = 0x2 + IFLA_XFRM_COLLECT_METADATA = 0x3 IFLA_IPVLAN_UNSPEC = 0x0 IFLA_IPVLAN_MODE = 0x1 IFLA_IPVLAN_FLAGS = 0x2 + NETKIT_NEXT = -0x1 + NETKIT_PASS = 0x0 + NETKIT_DROP = 0x2 + NETKIT_REDIRECT = 0x7 + NETKIT_L2 = 0x0 + NETKIT_L3 = 0x1 + IFLA_NETKIT_UNSPEC = 0x0 + IFLA_NETKIT_PEER_INFO = 0x1 + IFLA_NETKIT_PRIMARY = 0x2 + IFLA_NETKIT_POLICY = 0x3 + IFLA_NETKIT_PEER_POLICY = 0x4 + IFLA_NETKIT_MODE = 0x5 IFLA_VXLAN_UNSPEC = 0x0 IFLA_VXLAN_ID = 0x1 IFLA_VXLAN_GROUP = 0x2 @@ -1714,6 +1764,8 @@ const ( IFLA_VXLAN_GPE = 0x1b IFLA_VXLAN_TTL_INHERIT = 0x1c IFLA_VXLAN_DF = 0x1d + IFLA_VXLAN_VNIFILTER = 0x1e + IFLA_VXLAN_LOCALBYPASS = 0x1f IFLA_GENEVE_UNSPEC = 0x0 IFLA_GENEVE_ID = 0x1 IFLA_GENEVE_REMOTE = 0x2 @@ -1728,6 +1780,7 @@ const ( IFLA_GENEVE_LABEL = 0xb IFLA_GENEVE_TTL_INHERIT = 0xc IFLA_GENEVE_DF = 0xd + IFLA_GENEVE_INNER_PROTO_INHERIT = 0xe IFLA_BAREUDP_UNSPEC = 0x0 IFLA_BAREUDP_PORT = 0x1 IFLA_BAREUDP_ETHERTYPE = 0x2 @@ -1740,6 +1793,8 @@ const ( IFLA_GTP_FD1 = 0x2 IFLA_GTP_PDP_HASHSIZE = 0x3 IFLA_GTP_ROLE = 0x4 + IFLA_GTP_CREATE_SOCKETS = 0x5 + IFLA_GTP_RESTART_COUNT = 0x6 IFLA_BOND_UNSPEC = 0x0 IFLA_BOND_MODE = 0x1 IFLA_BOND_ACTIVE_SLAVE = 0x2 @@ -1769,6 +1824,9 @@ const ( IFLA_BOND_AD_ACTOR_SYSTEM = 0x1a IFLA_BOND_TLB_DYNAMIC_LB = 0x1b IFLA_BOND_PEER_NOTIF_DELAY = 0x1c + IFLA_BOND_AD_LACP_ACTIVE = 0x1d + IFLA_BOND_MISSED_MAX = 0x1e + IFLA_BOND_NS_IP6_TARGET = 0x1f IFLA_BOND_AD_INFO_UNSPEC = 0x0 IFLA_BOND_AD_INFO_AGGREGATOR = 0x1 IFLA_BOND_AD_INFO_NUM_PORTS = 0x2 @@ -1784,6 +1842,7 @@ const ( IFLA_BOND_SLAVE_AD_AGGREGATOR_ID = 0x6 IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE = 0x7 IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE = 0x8 + IFLA_BOND_SLAVE_PRIO = 0x9 IFLA_VF_INFO_UNSPEC = 0x0 IFLA_VF_INFO = 0x1 IFLA_VF_UNSPEC = 0x0 @@ -1842,8 +1901,16 @@ const ( IFLA_STATS_LINK_XSTATS_SLAVE = 0x3 IFLA_STATS_LINK_OFFLOAD_XSTATS = 0x4 IFLA_STATS_AF_SPEC = 0x5 + IFLA_STATS_GETSET_UNSPEC = 0x0 + IFLA_STATS_GET_FILTERS = 0x1 + IFLA_STATS_SET_OFFLOAD_XSTATS_L3_STATS = 0x2 IFLA_OFFLOAD_XSTATS_UNSPEC = 0x0 IFLA_OFFLOAD_XSTATS_CPU_HIT = 0x1 + IFLA_OFFLOAD_XSTATS_HW_S_INFO = 0x2 + IFLA_OFFLOAD_XSTATS_L3_STATS = 0x3 + IFLA_OFFLOAD_XSTATS_HW_S_INFO_UNSPEC = 0x0 + IFLA_OFFLOAD_XSTATS_HW_S_INFO_REQUEST = 0x1 + IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED = 0x2 IFLA_XDP_UNSPEC = 0x0 IFLA_XDP_FD = 0x1 IFLA_XDP_ATTACHED = 0x2 @@ -1873,6 +1940,11 @@ const ( IFLA_RMNET_UNSPEC = 0x0 IFLA_RMNET_MUX_ID = 0x1 IFLA_RMNET_FLAGS = 0x2 + IFLA_MCTP_UNSPEC = 0x0 + IFLA_MCTP_NET = 0x1 + IFLA_DSA_UNSPEC = 0x0 + IFLA_DSA_CONDUIT = 0x1 + IFLA_DSA_MASTER = 0x1 ) const ( @@ -1968,7 +2040,7 @@ const ( NFT_MSG_GETFLOWTABLE = 0x17 NFT_MSG_DELFLOWTABLE = 0x18 NFT_MSG_GETRULE_RESET = 0x19 - NFT_MSG_MAX = 0x1a + NFT_MSG_MAX = 0x22 NFTA_LIST_UNSPEC = 0x0 NFTA_LIST_ELEM = 0x1 NFTA_HOOK_UNSPEC = 0x0 @@ -2555,6 +2627,11 @@ const ( BPF_REG_8 = 0x8 BPF_REG_9 = 0x9 BPF_REG_10 = 0xa + BPF_CGROUP_ITER_ORDER_UNSPEC = 0x0 + BPF_CGROUP_ITER_SELF_ONLY = 0x1 + BPF_CGROUP_ITER_DESCENDANTS_PRE = 0x2 + BPF_CGROUP_ITER_DESCENDANTS_POST = 0x3 + BPF_CGROUP_ITER_ANCESTORS_UP = 0x4 BPF_MAP_CREATE = 0x0 BPF_MAP_LOOKUP_ELEM = 0x1 BPF_MAP_UPDATE_ELEM = 0x2 @@ -2566,6 +2643,7 @@ const ( BPF_PROG_ATTACH = 0x8 BPF_PROG_DETACH = 0x9 BPF_PROG_TEST_RUN = 0xa + BPF_PROG_RUN = 0xa BPF_PROG_GET_NEXT_ID = 0xb BPF_MAP_GET_NEXT_ID = 0xc BPF_PROG_GET_FD_BY_ID = 0xd @@ -2610,6 +2688,7 @@ const ( BPF_MAP_TYPE_CPUMAP = 0x10 BPF_MAP_TYPE_XSKMAP = 0x11 BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED = 0x13 BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 @@ -2620,6 +2699,10 @@ const ( BPF_MAP_TYPE_STRUCT_OPS = 0x1a BPF_MAP_TYPE_RINGBUF = 0x1b BPF_MAP_TYPE_INODE_STORAGE = 0x1c + BPF_MAP_TYPE_TASK_STORAGE = 0x1d + BPF_MAP_TYPE_BLOOM_FILTER = 0x1e + BPF_MAP_TYPE_USER_RINGBUF = 0x1f + BPF_MAP_TYPE_CGRP_STORAGE = 0x20 BPF_PROG_TYPE_UNSPEC = 0x0 BPF_PROG_TYPE_SOCKET_FILTER = 0x1 BPF_PROG_TYPE_KPROBE = 0x2 @@ -2651,6 +2734,8 @@ const ( BPF_PROG_TYPE_EXT = 0x1c BPF_PROG_TYPE_LSM = 0x1d BPF_PROG_TYPE_SK_LOOKUP = 0x1e + BPF_PROG_TYPE_SYSCALL = 0x1f + BPF_PROG_TYPE_NETFILTER = 0x20 BPF_CGROUP_INET_INGRESS = 0x0 BPF_CGROUP_INET_EGRESS = 0x1 BPF_CGROUP_INET_SOCK_CREATE = 0x2 @@ -2689,6 +2774,17 @@ const ( BPF_XDP_CPUMAP = 0x23 BPF_SK_LOOKUP = 0x24 BPF_XDP = 0x25 + BPF_SK_SKB_VERDICT = 0x26 + BPF_SK_REUSEPORT_SELECT = 0x27 + BPF_SK_REUSEPORT_SELECT_OR_MIGRATE = 0x28 + BPF_PERF_EVENT = 0x29 + BPF_TRACE_KPROBE_MULTI = 0x2a + BPF_LSM_CGROUP = 0x2b + BPF_STRUCT_OPS = 0x2c + BPF_NETFILTER = 0x2d + BPF_TCX_INGRESS = 0x2e + BPF_TCX_EGRESS = 0x2f + BPF_TRACE_UPROBE_MULTI = 0x30 BPF_LINK_TYPE_UNSPEC = 0x0 BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1 BPF_LINK_TYPE_TRACING = 0x2 @@ -2696,6 +2792,21 @@ const ( BPF_LINK_TYPE_ITER = 0x4 BPF_LINK_TYPE_NETNS = 0x5 BPF_LINK_TYPE_XDP = 0x6 + BPF_LINK_TYPE_PERF_EVENT = 0x7 + BPF_LINK_TYPE_KPROBE_MULTI = 0x8 + BPF_LINK_TYPE_STRUCT_OPS = 0x9 + BPF_LINK_TYPE_NETFILTER = 0xa + BPF_LINK_TYPE_TCX = 0xb + BPF_LINK_TYPE_UPROBE_MULTI = 0xc + BPF_PERF_EVENT_UNSPEC = 0x0 + BPF_PERF_EVENT_UPROBE = 0x1 + BPF_PERF_EVENT_URETPROBE = 0x2 + BPF_PERF_EVENT_KPROBE = 0x3 + BPF_PERF_EVENT_KRETPROBE = 0x4 + BPF_PERF_EVENT_TRACEPOINT = 0x5 + BPF_PERF_EVENT_EVENT = 0x6 + BPF_F_KPROBE_MULTI_RETURN = 0x1 + BPF_F_UPROBE_MULTI_RETURN = 0x1 BPF_ANY = 0x0 BPF_NOEXIST = 0x1 BPF_EXIST = 0x2 @@ -2713,6 +2824,8 @@ const ( BPF_F_MMAPABLE = 0x400 BPF_F_PRESERVE_ELEMS = 0x800 BPF_F_INNER_MAP = 0x1000 + BPF_F_LINK = 0x2000 + BPF_F_PATH_FD = 0x4000 BPF_STATS_RUN_TIME = 0x0 BPF_STACK_BUILD_ID_EMPTY = 0x0 BPF_STACK_BUILD_ID_VALID = 0x1 @@ -2733,6 +2846,8 @@ const ( BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_DONT_FRAGMENT = 0x4 BPF_F_SEQ_NUMBER = 0x8 + BPF_F_NO_TUNNEL_KEY = 0x10 + BPF_F_TUNINFO_FLAGS = 0x10 BPF_F_INDEX_MASK = 0xffffffff BPF_F_CURRENT_CPU = 0xffffffff BPF_F_CTXLEN_MASK = 0xfffff00000000 @@ -2747,6 +2862,9 @@ const ( BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20 + BPF_F_ADJ_ROOM_ENCAP_L2_ETH = 0x40 + BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = 0x80 + BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = 0x100 BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_F_SYSCTL_BASE_NAME = 0x1 @@ -2771,10 +2889,16 @@ const ( BPF_LWT_ENCAP_SEG6 = 0x0 BPF_LWT_ENCAP_SEG6_INLINE = 0x1 BPF_LWT_ENCAP_IP = 0x2 + BPF_F_BPRM_SECUREEXEC = 0x1 + BPF_F_BROADCAST = 0x8 + BPF_F_EXCLUDE_INGRESS = 0x10 + BPF_SKB_TSTAMP_UNSPEC = 0x0 + BPF_SKB_TSTAMP_DELIVERY_MONO = 0x1 BPF_OK = 0x0 BPF_DROP = 0x2 BPF_REDIRECT = 0x7 BPF_LWT_REROUTE = 0x80 + BPF_FLOW_DISSECTOR_CONTINUE = 0x81 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 @@ -2829,6 +2953,8 @@ const ( BPF_DEVCG_DEV_CHAR = 0x2 BPF_FIB_LOOKUP_DIRECT = 0x1 BPF_FIB_LOOKUP_OUTPUT = 0x2 + BPF_FIB_LOOKUP_SKIP_NEIGH = 0x4 + BPF_FIB_LOOKUP_TBID = 0x8 BPF_FIB_LKUP_RET_SUCCESS = 0x0 BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 @@ -2838,6 +2964,10 @@ const ( BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_MTU_CHK_SEGS = 0x1 + BPF_MTU_CHK_RET_SUCCESS = 0x0 + BPF_MTU_CHK_RET_FRAG_NEEDED = 0x1 + BPF_MTU_CHK_RET_SEGS_TOOBIG = 0x2 BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 BPF_FD_TYPE_TRACEPOINT = 0x1 BPF_FD_TYPE_KPROBE = 0x2 @@ -2847,6 +2977,20 @@ const ( BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = 0x1 BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = 0x2 BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = 0x4 + BPF_CORE_FIELD_BYTE_OFFSET = 0x0 + BPF_CORE_FIELD_BYTE_SIZE = 0x1 + BPF_CORE_FIELD_EXISTS = 0x2 + BPF_CORE_FIELD_SIGNED = 0x3 + BPF_CORE_FIELD_LSHIFT_U64 = 0x4 + BPF_CORE_FIELD_RSHIFT_U64 = 0x5 + BPF_CORE_TYPE_ID_LOCAL = 0x6 + BPF_CORE_TYPE_ID_TARGET = 0x7 + BPF_CORE_TYPE_EXISTS = 0x8 + BPF_CORE_TYPE_SIZE = 0x9 + BPF_CORE_ENUMVAL_EXISTS = 0xa + BPF_CORE_ENUMVAL_VALUE = 0xb + BPF_CORE_TYPE_MATCHES = 0xc + BPF_F_TIMER_ABS = 0x1 ) const ( @@ -2925,6 +3069,12 @@ type LoopInfo64 struct { Encrypt_key [32]uint8 Init [2]uint64 } +type LoopConfig struct { + Fd uint32 + Size uint32 + Info LoopInfo64 + _ [8]uint64 +} type TIPCSocketAddr struct { Ref uint32 @@ -3313,7 +3463,7 @@ const ( DEVLINK_PORT_FN_ATTR_STATE = 0x2 DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 DEVLINK_PORT_FN_ATTR_CAPS = 0x4 - DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x4 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x5 ) type FsverityDigest struct { @@ -3605,7 +3755,7 @@ const ( ETHTOOL_MSG_PSE_GET = 0x24 ETHTOOL_MSG_PSE_SET = 0x25 ETHTOOL_MSG_RSS_GET = 0x26 - ETHTOOL_MSG_USER_MAX = 0x26 + ETHTOOL_MSG_USER_MAX = 0x2b ETHTOOL_MSG_KERNEL_NONE = 0x0 ETHTOOL_MSG_STRSET_GET_REPLY = 0x1 ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2 @@ -3645,7 +3795,7 @@ const ( ETHTOOL_MSG_MODULE_NTF = 0x24 ETHTOOL_MSG_PSE_GET_REPLY = 0x25 ETHTOOL_MSG_RSS_GET_REPLY = 0x26 - ETHTOOL_MSG_KERNEL_MAX = 0x26 + ETHTOOL_MSG_KERNEL_MAX = 0x2b ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 @@ -3749,7 +3899,7 @@ const ( ETHTOOL_A_RINGS_TCP_DATA_SPLIT = 0xb ETHTOOL_A_RINGS_CQE_SIZE = 0xc ETHTOOL_A_RINGS_TX_PUSH = 0xd - ETHTOOL_A_RINGS_MAX = 0xd + ETHTOOL_A_RINGS_MAX = 0x10 ETHTOOL_A_CHANNELS_UNSPEC = 0x0 ETHTOOL_A_CHANNELS_HEADER = 0x1 ETHTOOL_A_CHANNELS_RX_MAX = 0x2 @@ -3787,14 +3937,14 @@ const ( ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17 ETHTOOL_A_COALESCE_USE_CQE_MODE_TX = 0x18 ETHTOOL_A_COALESCE_USE_CQE_MODE_RX = 0x19 - ETHTOOL_A_COALESCE_MAX = 0x19 + ETHTOOL_A_COALESCE_MAX = 0x1c ETHTOOL_A_PAUSE_UNSPEC = 0x0 ETHTOOL_A_PAUSE_HEADER = 0x1 ETHTOOL_A_PAUSE_AUTONEG = 0x2 ETHTOOL_A_PAUSE_RX = 0x3 ETHTOOL_A_PAUSE_TX = 0x4 ETHTOOL_A_PAUSE_STATS = 0x5 - ETHTOOL_A_PAUSE_MAX = 0x5 + ETHTOOL_A_PAUSE_MAX = 0x6 ETHTOOL_A_PAUSE_STAT_UNSPEC = 0x0 ETHTOOL_A_PAUSE_STAT_PAD = 0x1 ETHTOOL_A_PAUSE_STAT_TX_FRAMES = 0x2 @@ -4097,7 +4247,8 @@ const ( ) type LandlockRulesetAttr struct { - Access_fs uint64 + Access_fs uint64 + Access_net uint64 } type LandlockPathBeneathAttr struct { @@ -4444,7 +4595,7 @@ const ( NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca - NL80211_ATTR_MAX = 0x141 + NL80211_ATTR_MAX = 0x146 NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_MATCH_SETS = 0x85 @@ -4673,7 +4824,7 @@ const ( NL80211_BAND_ATTR_HT_CAPA = 0x4 NL80211_BAND_ATTR_HT_MCS_SET = 0x3 NL80211_BAND_ATTR_IFTYPE_DATA = 0x9 - NL80211_BAND_ATTR_MAX = 0xb + NL80211_BAND_ATTR_MAX = 0xd NL80211_BAND_ATTR_RATES = 0x2 NL80211_BAND_ATTR_VHT_CAPA = 0x8 NL80211_BAND_ATTR_VHT_MCS_SET = 0x7 @@ -4814,7 +4965,7 @@ const ( NL80211_CMD_LEAVE_IBSS = 0x2c NL80211_CMD_LEAVE_MESH = 0x45 NL80211_CMD_LEAVE_OCB = 0x6d - NL80211_CMD_MAX = 0x98 + NL80211_CMD_MAX = 0x9a NL80211_CMD_MICHAEL_MIC_FAILURE = 0x29 NL80211_CMD_MODIFY_LINK_STA = 0x97 NL80211_CMD_NAN_MATCH = 0x78 @@ -5048,7 +5199,7 @@ const ( NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf - NL80211_FREQUENCY_ATTR_MAX = 0x1b + NL80211_FREQUENCY_ATTR_MAX = 0x1c NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc @@ -5448,7 +5599,7 @@ const ( NL80211_RATE_INFO_HE_RU_ALLOC_52 = 0x1 NL80211_RATE_INFO_HE_RU_ALLOC_996 = 0x5 NL80211_RATE_INFO_HE_RU_ALLOC = 0x11 - NL80211_RATE_INFO_MAX = 0x16 + NL80211_RATE_INFO_MAX = 0x1d NL80211_RATE_INFO_MCS = 0x2 NL80211_RATE_INFO_SHORT_GI = 0x4 NL80211_RATE_INFO_VHT_MCS = 0x6 @@ -5461,7 +5612,7 @@ const ( NL80211_REGDOM_TYPE_CUSTOM_WORLD = 0x2 NL80211_REGDOM_TYPE_INTERSECTION = 0x3 NL80211_REGDOM_TYPE_WORLD = 0x1 - NL80211_REG_RULE_ATTR_MAX = 0x7 + NL80211_REG_RULE_ATTR_MAX = 0x8 NL80211_REKEY_DATA_AKM = 0x4 NL80211_REKEY_DATA_KCK = 0x2 NL80211_REKEY_DATA_KEK = 0x1 @@ -5795,6 +5946,8 @@ const ( TUN_F_TSO6 = 0x4 TUN_F_TSO_ECN = 0x8 TUN_F_UFO = 0x10 + TUN_F_USO4 = 0x20 + TUN_F_USO6 = 0x40 ) const ( @@ -5804,9 +5957,37 @@ const ( ) const ( - VIRTIO_NET_HDR_GSO_NONE = 0x0 - VIRTIO_NET_HDR_GSO_TCPV4 = 0x1 - VIRTIO_NET_HDR_GSO_UDP = 0x3 - VIRTIO_NET_HDR_GSO_TCPV6 = 0x4 - VIRTIO_NET_HDR_GSO_ECN = 0x80 + VIRTIO_NET_HDR_GSO_NONE = 0x0 + VIRTIO_NET_HDR_GSO_TCPV4 = 0x1 + VIRTIO_NET_HDR_GSO_UDP = 0x3 + VIRTIO_NET_HDR_GSO_TCPV6 = 0x4 + VIRTIO_NET_HDR_GSO_UDP_L4 = 0x5 + VIRTIO_NET_HDR_GSO_ECN = 0x80 ) + +type SchedAttr struct { + Size uint32 + Policy uint32 + Flags uint64 + Nice int32 + Priority uint32 + Runtime uint64 + Deadline uint64 + Period uint64 + Util_min uint32 + Util_max uint32 +} + +const SizeofSchedAttr = 0x38 + +type Cachestat_t struct { + Cache uint64 + Dirty uint64 + Writeback uint64 + Evicted uint64 + Recently_evicted uint64 +} +type CachestatRange struct { + Off uint64 + Len uint64 +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 4ecc1495cd..438a30affa 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux -// +build 386,linux package unix @@ -337,6 +336,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint32 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 34fddff964..adceca3553 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux -// +build amd64,linux package unix @@ -350,6 +349,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 3b14a6031f..eeaa00a37d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux -// +build arm,linux package unix @@ -328,6 +327,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint32 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 0517651ab3..6739aa91d4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux -// +build arm64,linux package unix @@ -329,6 +328,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index 3b0c518134..9920ef6317 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build loong64 && linux -// +build loong64,linux package unix @@ -330,6 +329,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index fccdf4dd0f..2923b799a4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux -// +build mips,linux package unix @@ -333,6 +332,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint32 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 500de8fc07..ce2750ee41 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux -// +build mips64,linux package unix @@ -332,6 +331,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index d0434cd2c6..3038811d70 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux -// +build mips64le,linux package unix @@ -332,6 +331,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 84206ba534..efc6fed18c 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux -// +build mipsle,linux package unix @@ -333,6 +332,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint32 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index ab078cf1f5..9a654b75a9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux -// +build ppc,linux package unix @@ -340,6 +339,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint32 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 42eb2c4cef..40d358e33e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux -// +build ppc64,linux package unix @@ -339,6 +338,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 31304a4e8b..148c6ceb86 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux -// +build ppc64le,linux package unix @@ -339,6 +338,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index c311f9612d..72ba81543e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux -// +build riscv64,linux package unix @@ -357,6 +356,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 @@ -716,3 +717,30 @@ type SysvShmDesc struct { _ uint64 _ uint64 } + +type RISCVHWProbePairs struct { + Key int64 + Value uint64 +} + +const ( + RISCV_HWPROBE_KEY_MVENDORID = 0x0 + RISCV_HWPROBE_KEY_MARCHID = 0x1 + RISCV_HWPROBE_KEY_MIMPID = 0x2 + RISCV_HWPROBE_KEY_BASE_BEHAVIOR = 0x3 + RISCV_HWPROBE_BASE_BEHAVIOR_IMA = 0x1 + RISCV_HWPROBE_KEY_IMA_EXT_0 = 0x4 + RISCV_HWPROBE_IMA_FD = 0x1 + RISCV_HWPROBE_IMA_C = 0x2 + RISCV_HWPROBE_IMA_V = 0x4 + RISCV_HWPROBE_EXT_ZBA = 0x8 + RISCV_HWPROBE_EXT_ZBB = 0x10 + RISCV_HWPROBE_EXT_ZBS = 0x20 + RISCV_HWPROBE_KEY_CPUPERF_0 = 0x5 + RISCV_HWPROBE_MISALIGNED_UNKNOWN = 0x0 + RISCV_HWPROBE_MISALIGNED_EMULATED = 0x1 + RISCV_HWPROBE_MISALIGNED_SLOW = 0x2 + RISCV_HWPROBE_MISALIGNED_FAST = 0x3 + RISCV_HWPROBE_MISALIGNED_UNSUPPORTED = 0x4 + RISCV_HWPROBE_MISALIGNED_MASK = 0x7 +) diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index bba3cefac1..71e765508e 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux -// +build s390x,linux package unix @@ -352,6 +351,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index ad8a013804..4abbdb9de9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux -// +build sparc64,linux package unix @@ -334,6 +333,8 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 + Irq_count uint64 + Irq_delay_total uint64 } type cpuMask uint64 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index 9bc4c8f9d8..f22e7947d9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && netbsd -// +build 386,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index bb05f655d2..066a7d83d2 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && netbsd -// +build amd64,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index db40e3a19c..439548ec9a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && netbsd -// +build arm,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go index 11121151cc..16085d3bbc 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && netbsd -// +build arm64,netbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 26eba23b72..afd13a3af7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && openbsd -// +build 386,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 5a54798869..5d97f1f9b6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && openbsd -// +build amd64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index be58c4e1ff..34871cdc15 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && openbsd -// +build arm,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go index 52338266cb..5911bceb31 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && openbsd -// +build arm64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go index 605cfdb12b..e4f24f3bc9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && openbsd -// +build mips64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go index d6724c0102..ca50a79303 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && openbsd -// +build ppc64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go index ddfd27a434..d7d7f79023 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && openbsd -// +build riscv64,openbsd package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index 0400747c67..14160576d2 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -2,7 +2,6 @@ // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && solaris -// +build amd64,solaris package unix diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go index aec1efcb30..54f31be637 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build zos && s390x -// +build zos,s390x // Hand edited based on ztypes_linux_s390x.go // TODO: auto-generate. diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/aliases.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/aliases.go index a20ebea633..ce2d713d62 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/aliases.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/aliases.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows && go1.9 -// +build windows,go1.9 package windows diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/empty.s b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/empty.s index fdbbbcd317..ba64caca5d 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/empty.s +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/empty.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.12 -// +build !go1.12 // This file is here to allow bodyless functions with go:linkname for Go 1.11 // and earlier (see https://golang.org/issue/23311). diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/env_windows.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/env_windows.go index b8ad192506..d4577a4238 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/env_windows.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/env_windows.go @@ -37,14 +37,17 @@ func (token Token) Environ(inheritExisting bool) (env []string, err error) { return nil, err } defer DestroyEnvironmentBlock(block) - blockp := unsafe.Pointer(block) - for { - entry := UTF16PtrToString((*uint16)(blockp)) - if len(entry) == 0 { - break + size := unsafe.Sizeof(*block) + for *block != 0 { + // find NUL terminator + end := unsafe.Pointer(block) + for *(*uint16)(end) != 0 { + end = unsafe.Add(end, size) } - env = append(env, entry) - blockp = unsafe.Add(blockp, 2*(len(entry)+1)) + + entry := unsafe.Slice(block, (uintptr(end)-uintptr(unsafe.Pointer(block)))/size) + env = append(env, UTF16ToString(entry)) + block = (*uint16)(unsafe.Add(end, size)) } return env, nil } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/eventlog.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/eventlog.go index 2cd60645ee..6c366955d9 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/eventlog.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/eventlog.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package windows diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/exec_windows.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/exec_windows.go index a52e0331d8..9cabbb6941 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/exec_windows.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/exec_windows.go @@ -22,7 +22,7 @@ import ( // but only if there is space or tab inside s. func EscapeArg(s string) string { if len(s) == 0 { - return "\"\"" + return `""` } n := len(s) hasSpace := false @@ -35,7 +35,7 @@ func EscapeArg(s string) string { } } if hasSpace { - n += 2 + n += 2 // Reserve space for quotes. } if n == len(s) { return s @@ -82,20 +82,68 @@ func EscapeArg(s string) string { // in CreateProcess's CommandLine argument, CreateService/ChangeServiceConfig's BinaryPathName argument, // or any program that uses CommandLineToArgv. func ComposeCommandLine(args []string) string { - var commandLine string - for i := range args { - if i > 0 { - commandLine += " " + if len(args) == 0 { + return "" + } + + // Per https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw: + // “This function accepts command lines that contain a program name; the + // program name can be enclosed in quotation marks or not.” + // + // Unfortunately, it provides no means of escaping interior quotation marks + // within that program name, and we have no way to report them here. + prog := args[0] + mustQuote := len(prog) == 0 + for i := 0; i < len(prog); i++ { + c := prog[i] + if c <= ' ' || (c == '"' && i == 0) { + // Force quotes for not only the ASCII space and tab as described in the + // MSDN article, but also ASCII control characters. + // The documentation for CommandLineToArgvW doesn't say what happens when + // the first argument is not a valid program name, but it empirically + // seems to drop unquoted control characters. + mustQuote = true + break + } + } + var commandLine []byte + if mustQuote { + commandLine = make([]byte, 0, len(prog)+2) + commandLine = append(commandLine, '"') + for i := 0; i < len(prog); i++ { + c := prog[i] + if c == '"' { + // This quote would interfere with our surrounding quotes. + // We have no way to report an error, so just strip out + // the offending character instead. + continue + } + commandLine = append(commandLine, c) } - commandLine += EscapeArg(args[i]) + commandLine = append(commandLine, '"') + } else { + if len(args) == 1 { + // args[0] is a valid command line representing itself. + // No need to allocate a new slice or string for it. + return prog + } + commandLine = []byte(prog) } - return commandLine + + for _, arg := range args[1:] { + commandLine = append(commandLine, ' ') + // TODO(bcmills): since we're already appending to a slice, it would be nice + // to avoid the intermediate allocations of EscapeArg. + // Perhaps we can factor out an appendEscapedArg function. + commandLine = append(commandLine, EscapeArg(arg)...) + } + return string(commandLine) } // DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv, // as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that // command lines are passed around. -// DecomposeCommandLine returns error if commandLine contains NUL. +// DecomposeCommandLine returns an error if commandLine contains NUL. func DecomposeCommandLine(commandLine string) ([]string, error) { if len(commandLine) == 0 { return []string{}, nil @@ -105,18 +153,35 @@ func DecomposeCommandLine(commandLine string) ([]string, error) { return nil, errorspkg.New("string with NUL passed to DecomposeCommandLine") } var argc int32 - argv, err := CommandLineToArgv(&utf16CommandLine[0], &argc) + argv, err := commandLineToArgv(&utf16CommandLine[0], &argc) if err != nil { return nil, err } defer LocalFree(Handle(unsafe.Pointer(argv))) + var args []string - for _, v := range (*argv)[:argc] { - args = append(args, UTF16ToString((*v)[:])) + for _, p := range unsafe.Slice(argv, argc) { + args = append(args, UTF16PtrToString(p)) } return args, nil } +// CommandLineToArgv parses a Unicode command line string and sets +// argc to the number of parsed arguments. +// +// The returned memory should be freed using a single call to LocalFree. +// +// Note that although the return type of CommandLineToArgv indicates 8192 +// entries of up to 8192 characters each, the actual count of parsed arguments +// may exceed 8192, and the documentation for CommandLineToArgvW does not mention +// any bound on the lengths of the individual argument strings. +// (See https://go.dev/issue/63236.) +func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { + argp, err := commandLineToArgv(cmd, argc) + argv = (*[8192]*[8192]uint16)(unsafe.Pointer(argp)) + return argv, err +} + func CloseOnExec(fd Handle) { SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/mksyscall.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/mksyscall.go index 8563f79c57..dbcdb090c0 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/mksyscall.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/mksyscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build generate -// +build generate package windows diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/race.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/race.go index 9196b089ca..0f1bdc3860 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/race.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/race.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows && race -// +build windows,race package windows diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/race0.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/race0.go index 7bae4817a0..0c78da78b1 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/race0.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/race0.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows && !race -// +build windows,!race package windows diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/security_windows.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/security_windows.go index d414ef13be..26be94a8a7 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/security_windows.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/security_windows.go @@ -7,8 +7,6 @@ package windows import ( "syscall" "unsafe" - - "golang.org/x/sys/internal/unsafeheader" ) const ( @@ -1341,21 +1339,14 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor() sdLen = min } - var src []byte - h := (*unsafeheader.Slice)(unsafe.Pointer(&src)) - h.Data = unsafe.Pointer(selfRelativeSD) - h.Len = sdLen - h.Cap = sdLen - + src := unsafe.Slice((*byte)(unsafe.Pointer(selfRelativeSD)), sdLen) + // SECURITY_DESCRIPTOR has pointers in it, which means checkptr expects for it to + // be aligned properly. When we're copying a Windows-allocated struct to a + // Go-allocated one, make sure that the Go allocation is aligned to the + // pointer size. const psize = int(unsafe.Sizeof(uintptr(0))) - - var dst []byte - h = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) alloc := make([]uintptr, (sdLen+psize-1)/psize) - h.Data = (*unsafeheader.Slice)(unsafe.Pointer(&alloc)).Data - h.Len = sdLen - h.Cap = sdLen - + dst := unsafe.Slice((*byte)(unsafe.Pointer(&alloc[0])), sdLen) copy(dst, src) return (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&dst[0])) } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/service.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/service.go index c964b6848d..a9dc6308d6 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/service.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/service.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package windows @@ -218,6 +217,10 @@ type SERVICE_FAILURE_ACTIONS struct { Actions *SC_ACTION } +type SERVICE_FAILURE_ACTIONS_FLAG struct { + FailureActionsOnNonCrashFailures int32 +} + type SC_ACTION struct { Type uint32 Delay uint32 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/str.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/str.go index 4fc01434e4..6a4f9ce6aa 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/str.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/str.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package windows diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/syscall.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/syscall.go index 8732cdb957..e85ed6b9c8 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/syscall.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows // Package windows contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/syscall_windows.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/syscall_windows.go index 3723b2c224..6395a031d4 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -15,8 +15,6 @@ import ( "time" "unicode/utf16" "unsafe" - - "golang.org/x/sys/internal/unsafeheader" ) type Handle uintptr @@ -127,22 +125,21 @@ func UTF16PtrToString(p *uint16) string { for ptr := unsafe.Pointer(p); *(*uint16)(ptr) != 0; n++ { ptr = unsafe.Pointer(uintptr(ptr) + unsafe.Sizeof(*p)) } - - return string(utf16.Decode(unsafe.Slice(p, n))) + return UTF16ToString(unsafe.Slice(p, n)) } func Getpagesize() int { return 4096 } // NewCallback converts a Go function to a function pointer conforming to the stdcall calling convention. // This is useful when interoperating with Windows code requiring callbacks. -// The argument is expected to be a function with with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. +// The argument is expected to be a function with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. func NewCallback(fn interface{}) uintptr { return syscall.NewCallback(fn) } // NewCallbackCDecl converts a Go function to a function pointer conforming to the cdecl calling convention. // This is useful when interoperating with Windows code requiring callbacks. -// The argument is expected to be a function with with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. +// The argument is expected to be a function with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. func NewCallbackCDecl(fn interface{}) uintptr { return syscall.NewCallbackCDecl(fn) } @@ -157,6 +154,8 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) = kernel32.GetModuleFileNameW //sys GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) = kernel32.GetModuleHandleExW //sys SetDefaultDllDirectories(directoryFlags uint32) (err error) +//sys AddDllDirectory(path *uint16) (cookie uintptr, err error) = kernel32.AddDllDirectory +//sys RemoveDllDirectory(cookie uintptr) (err error) = kernel32.RemoveDllDirectory //sys SetDllDirectory(path string) (err error) = kernel32.SetDllDirectoryW //sys GetVersion() (ver uint32, err error) //sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW @@ -194,6 +193,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetComputerName(buf *uint16, n *uint32) (err error) = GetComputerNameW //sys GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) = GetComputerNameExW //sys SetEndOfFile(handle Handle) (err error) +//sys SetFileValidData(handle Handle, validDataLength int64) (err error) //sys GetSystemTimeAsFileTime(time *Filetime) //sys GetSystemTimePreciseAsFileTime(time *Filetime) //sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff] @@ -216,7 +216,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath //sys TerminateProcess(handle Handle, exitcode uint32) (err error) //sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) -//sys GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW +//sys getStartupInfo(startupInfo *StartupInfo) = GetStartupInfoW //sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) //sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) //sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] @@ -235,12 +235,13 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock //sys DestroyEnvironmentBlock(block *uint16) (err error) = userenv.DestroyEnvironmentBlock //sys getTickCount64() (ms uint64) = kernel32.GetTickCount64 +//sys GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) //sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) //sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW //sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW //sys GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) = kernel32.GetFileAttributesExW //sys GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW -//sys CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW +//sys commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW //sys LocalFree(hmem Handle) (handle Handle, err error) [failretval!=0] //sys LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) //sys SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) @@ -299,12 +300,15 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) = advapi32.RegNotifyChangeKeyValue //sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId //sys ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) = kernel32.ProcessIdToSessionId +//sys ClosePseudoConsole(console Handle) = kernel32.ClosePseudoConsole +//sys createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) = kernel32.CreatePseudoConsole //sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo //sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition //sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW //sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW +//sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole //sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot //sys Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32FirstW //sys Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32NextW @@ -405,7 +409,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) = version.VerQueryValueW // Process Status API (PSAPI) -//sys EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses +//sys enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses //sys EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) = psapi.EnumProcessModules //sys EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) = psapi.EnumProcessModulesEx //sys GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation @@ -437,6 +441,10 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmGetWindowAttribute //sys DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) = dwmapi.DwmSetWindowAttribute +// Windows Multimedia API +//sys TimeBeginPeriod (period uint32) (err error) [failretval != 0] = winmm.timeBeginPeriod +//sys TimeEndPeriod (period uint32) (err error) [failretval != 0] = winmm.timeEndPeriod + // syscall interface implementation for other packages // GetCurrentProcess returns the handle for the current process. @@ -964,7 +972,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) { if n > 0 { sl += int32(n) + 1 } - if sa.raw.Path[0] == '@' { + if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) { + // Check sl > 3 so we don't change unnamed socket behavior. sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. sl-- @@ -1354,6 +1363,17 @@ func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return syscall.EWINDOWS } +func EnumProcesses(processIds []uint32, bytesReturned *uint32) error { + // EnumProcesses syscall expects the size parameter to be in bytes, but the code generated with mksyscall uses + // the length of the processIds slice instead. Hence, this wrapper function is added to fix the discrepancy. + var p *uint32 + if len(processIds) > 0 { + p = &processIds[0] + } + size := uint32(len(processIds) * 4) + return enumProcesses(p, size, bytesReturned) +} + func Getpid() (pid int) { return int(GetCurrentProcessId()) } func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) { @@ -1613,6 +1633,11 @@ func SetConsoleCursorPosition(console Handle, position Coord) error { return setConsoleCursorPosition(console, *((*uint32)(unsafe.Pointer(&position)))) } +func GetStartupInfo(startupInfo *StartupInfo) error { + getStartupInfo(startupInfo) + return nil +} + func (s NTStatus) Errno() syscall.Errno { return rtlNtStatusToDosErrorNoTeb(s) } @@ -1647,12 +1672,8 @@ func NewNTUnicodeString(s string) (*NTUnicodeString, error) { // Slice returns a uint16 slice that aliases the data in the NTUnicodeString. func (s *NTUnicodeString) Slice() []uint16 { - var slice []uint16 - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice)) - hdr.Data = unsafe.Pointer(s.Buffer) - hdr.Len = int(s.Length) - hdr.Cap = int(s.MaximumLength) - return slice + slice := unsafe.Slice(s.Buffer, s.MaximumLength) + return slice[:s.Length] } func (s *NTUnicodeString) String() string { @@ -1675,12 +1696,8 @@ func NewNTString(s string) (*NTString, error) { // Slice returns a byte slice that aliases the data in the NTString. func (s *NTString) Slice() []byte { - var slice []byte - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice)) - hdr.Data = unsafe.Pointer(s.Buffer) - hdr.Len = int(s.Length) - hdr.Cap = int(s.MaximumLength) - return slice + slice := unsafe.Slice(s.Buffer, s.MaximumLength) + return slice[:s.Length] } func (s *NTString) String() string { @@ -1732,10 +1749,7 @@ func LoadResourceData(module, resInfo Handle) (data []byte, err error) { if err != nil { return } - h := (*unsafeheader.Slice)(unsafe.Pointer(&data)) - h.Data = unsafe.Pointer(ptr) - h.Len = int(size) - h.Cap = int(size) + data = unsafe.Slice((*byte)(unsafe.Pointer(ptr)), size) return } @@ -1806,3 +1820,17 @@ type PSAPI_WORKING_SET_EX_INFORMATION struct { // A PSAPI_WORKING_SET_EX_BLOCK union that indicates the attributes of the page at VirtualAddress. VirtualAttributes PSAPI_WORKING_SET_EX_BLOCK } + +// CreatePseudoConsole creates a windows pseudo console. +func CreatePseudoConsole(size Coord, in Handle, out Handle, flags uint32, pconsole *Handle) error { + // We need this wrapper to manually cast Coord to uint32. The autogenerated wrappers only + // accept arguments that can be casted to uintptr, and Coord can't. + return createPseudoConsole(*((*uint32)(unsafe.Pointer(&size))), in, out, flags, pconsole) +} + +// ResizePseudoConsole resizes the internal buffers of the pseudo console to the width and height specified in `size`. +func ResizePseudoConsole(pconsole Handle, size Coord) error { + // We need this wrapper to manually cast Coord to uint32. The autogenerated wrappers only + // accept arguments that can be casted to uintptr, and Coord can't. + return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size)))) +} diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/types_windows.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/types_windows.go index 88e62a6385..359780f6ac 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/types_windows.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/types_windows.go @@ -247,6 +247,7 @@ const ( PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY = 0x00020007 PROC_THREAD_ATTRIBUTE_UMS_THREAD = 0x00030006 PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL = 0x0002000b + PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE = 0x00020016 ) const ( @@ -1093,7 +1094,33 @@ const ( SOMAXCONN = 0x7fffffff - TCP_NODELAY = 1 + TCP_NODELAY = 1 + TCP_EXPEDITED_1122 = 2 + TCP_KEEPALIVE = 3 + TCP_MAXSEG = 4 + TCP_MAXRT = 5 + TCP_STDURG = 6 + TCP_NOURG = 7 + TCP_ATMARK = 8 + TCP_NOSYNRETRIES = 9 + TCP_TIMESTAMPS = 10 + TCP_OFFLOAD_PREFERENCE = 11 + TCP_CONGESTION_ALGORITHM = 12 + TCP_DELAY_FIN_ACK = 13 + TCP_MAXRTMS = 14 + TCP_FASTOPEN = 15 + TCP_KEEPCNT = 16 + TCP_KEEPIDLE = TCP_KEEPALIVE + TCP_KEEPINTVL = 17 + TCP_FAIL_CONNECT_ON_ICMP_ERROR = 18 + TCP_ICMP_ERROR_INFO = 19 + + UDP_NOCHECKSUM = 1 + UDP_SEND_MSG_SIZE = 2 + UDP_RECV_MAX_COALESCED_SIZE = 3 + UDP_CHECKSUM_COVERAGE = 20 + + UDP_COALESCED_INFO = 3 SHUT_RD = 0 SHUT_WR = 1 @@ -2139,6 +2166,12 @@ const ( ENABLE_LVB_GRID_WORLDWIDE = 0x10 ) +// Pseudo console related constants used for the flags parameter to +// CreatePseudoConsole. See: https://learn.microsoft.com/en-us/windows/console/createpseudoconsole +const ( + PSEUDOCONSOLE_INHERIT_CURSOR = 0x1 +) + type Coord struct { X int16 Y int16 diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/zsyscall_windows.go index a81ea2c700..e8791c82c3 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -55,6 +55,7 @@ var ( moduser32 = NewLazySystemDLL("user32.dll") moduserenv = NewLazySystemDLL("userenv.dll") modversion = NewLazySystemDLL("version.dll") + modwinmm = NewLazySystemDLL("winmm.dll") modwintrust = NewLazySystemDLL("wintrust.dll") modws2_32 = NewLazySystemDLL("ws2_32.dll") modwtsapi32 = NewLazySystemDLL("wtsapi32.dll") @@ -183,10 +184,12 @@ var ( procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo") procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx") procGetIfEntry = modiphlpapi.NewProc("GetIfEntry") + procAddDllDirectory = modkernel32.NewProc("AddDllDirectory") procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") procCancelIo = modkernel32.NewProc("CancelIo") procCancelIoEx = modkernel32.NewProc("CancelIoEx") procCloseHandle = modkernel32.NewProc("CloseHandle") + procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole") procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe") procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW") procCreateEventExW = modkernel32.NewProc("CreateEventExW") @@ -201,6 +204,7 @@ var ( procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW") procCreatePipe = modkernel32.NewProc("CreatePipe") procCreateProcessW = modkernel32.NewProc("CreateProcessW") + procCreatePseudoConsole = modkernel32.NewProc("CreatePseudoConsole") procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW") procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW") @@ -250,6 +254,7 @@ var ( procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW") procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle") procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx") + procGetFileTime = modkernel32.NewProc("GetFileTime") procGetFileType = modkernel32.NewProc("GetFileType") procGetFinalPathNameByHandleW = modkernel32.NewProc("GetFinalPathNameByHandleW") procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW") @@ -326,7 +331,9 @@ var ( procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory") procReleaseMutex = modkernel32.NewProc("ReleaseMutex") procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW") + procRemoveDllDirectory = modkernel32.NewProc("RemoveDllDirectory") procResetEvent = modkernel32.NewProc("ResetEvent") + procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole") procResumeThread = modkernel32.NewProc("ResumeThread") procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts") procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition") @@ -335,6 +342,7 @@ var ( procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories") procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW") procSetEndOfFile = modkernel32.NewProc("SetEndOfFile") + procSetFileValidData = modkernel32.NewProc("SetFileValidData") procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW") procSetErrorMode = modkernel32.NewProc("SetErrorMode") procSetEvent = modkernel32.NewProc("SetEvent") @@ -468,6 +476,8 @@ var ( procGetFileVersionInfoSizeW = modversion.NewProc("GetFileVersionInfoSizeW") procGetFileVersionInfoW = modversion.NewProc("GetFileVersionInfoW") procVerQueryValueW = modversion.NewProc("VerQueryValueW") + proctimeBeginPeriod = modwinmm.NewProc("timeBeginPeriod") + proctimeEndPeriod = modwinmm.NewProc("timeEndPeriod") procWinVerifyTrustEx = modwintrust.NewProc("WinVerifyTrustEx") procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW") procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW") @@ -1598,6 +1608,15 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) { return } +func AddDllDirectory(path *uint16) (cookie uintptr, err error) { + r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + cookie = uintptr(r0) + if cookie == 0 { + err = errnoErr(e1) + } + return +} + func AssignProcessToJobObject(job Handle, process Handle) (err error) { r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) if r1 == 0 { @@ -1630,6 +1649,11 @@ func CloseHandle(handle Handle) (err error) { return } +func ClosePseudoConsole(console Handle) { + syscall.Syscall(procClosePseudoConsole.Addr(), 1, uintptr(console), 0, 0) + return +} + func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { @@ -1759,6 +1783,14 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA return } +func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) { + r0, _, _ := syscall.Syscall6(procCreatePseudoConsole.Addr(), 5, uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole)), 0) + if r0 != 0 { + hr = syscall.Errno(r0) + } + return +} + func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) if r1&0xff == 0 { @@ -2166,6 +2198,14 @@ func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, return } +func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { + r1, _, e1 := syscall.Syscall6(procGetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func GetFileType(filehandle Handle) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) n = uint32(r0) @@ -2367,11 +2407,8 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin return } -func GetStartupInfo(startupInfo *StartupInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) - if r1 == 0 { - err = errnoErr(e1) - } +func getStartupInfo(startupInfo *StartupInfo) { + syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) return } @@ -2854,6 +2891,14 @@ func RemoveDirectory(path *uint16) (err error) { return } +func RemoveDllDirectory(cookie uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procRemoveDllDirectory.Addr(), 1, uintptr(cookie), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func ResetEvent(event Handle) (err error) { r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { @@ -2862,6 +2907,14 @@ func ResetEvent(event Handle) (err error) { return } +func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { + r0, _, _ := syscall.Syscall(procResizePseudoConsole.Addr(), 2, uintptr(pconsole), uintptr(size), 0) + if r0 != 0 { + hr = syscall.Errno(r0) + } + return +} + func ResumeThread(thread Handle) (ret uint32, err error) { r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) ret = uint32(r0) @@ -2936,6 +2989,14 @@ func SetEndOfFile(handle Handle) (err error) { return } +func SetFileValidData(handle Handle, validDataLength int64) (err error) { + r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) if r1 == 0 { @@ -3516,12 +3577,8 @@ func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *u return } -func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) { - var _p0 *uint32 - if len(processIds) > 0 { - _p0 = &processIds[0] - } - r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned))) +func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) if r1 == 0 { err = errnoErr(e1) } @@ -3824,9 +3881,9 @@ func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (er return } -func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { +func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) - argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) + argv = (**uint16)(unsafe.Pointer(r0)) if argv == nil { err = errnoErr(e1) } @@ -4021,6 +4078,22 @@ func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPoint return } +func TimeBeginPeriod(period uint32) (err error) { + r1, _, e1 := syscall.Syscall(proctimeBeginPeriod.Addr(), 1, uintptr(period), 0, 0) + if r1 != 0 { + err = errnoErr(e1) + } + return +} + +func TimeEndPeriod(period uint32) (err error) { + r1, _, e1 := syscall.Syscall(proctimeEndPeriod.Addr(), 1, uintptr(period), 0, 0) + if r1 != 0 { + err = errnoErr(e1) + } + return +} + func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) { r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) if r0 != 0 { diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix.go index a4e31ab1b2..1ad0ddfe30 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package term @@ -60,7 +59,7 @@ func restore(fd int, state *State) error { func getSize(fd int) (width, height int, err error) { ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ) if err != nil { - return -1, -1, err + return 0, 0, err } return int(ws.Col), int(ws.Row), nil } diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix_bsd.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix_bsd.go index 853b3d6986..9dbf546298 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix_bsd.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix_bsd.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || netbsd || openbsd -// +build darwin dragonfly freebsd netbsd openbsd package term diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix_other.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix_other.go index 1e8955c934..1b36de799a 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix_other.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unix_other.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || linux || solaris || zos -// +build aix linux solaris zos package term diff --git a/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unsupported.go b/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unsupported.go index f1df850651..3c409e5885 100644 --- a/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unsupported.go +++ b/trunk/3rdparty/srs-bench/vendor/golang.org/x/term/term_unsupported.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !zos && !windows && !solaris && !plan9 -// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!zos,!windows,!solaris,!plan9 package term diff --git a/trunk/3rdparty/srs-bench/vendor/modules.txt b/trunk/3rdparty/srs-bench/vendor/modules.txt index 5c2db51abe..6bc1276680 100644 --- a/trunk/3rdparty/srs-bench/vendor/modules.txt +++ b/trunk/3rdparty/srs-bench/vendor/modules.txt @@ -30,6 +30,9 @@ github.com/google/gopacket/pcapgo # github.com/google/uuid v1.3.0 ## explicit github.com/google/uuid +# github.com/haivision/srtgo v0.0.0-20230627061225-a70d53fcd618 +## explicit; go 1.12 +github.com/haivision/srtgo # github.com/konsorten/go-windows-terminal-sequences v1.0.2 ## explicit github.com/konsorten/go-windows-terminal-sequences @@ -39,6 +42,9 @@ github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.8 ## explicit github.com/mattn/go-isatty +# github.com/mattn/go-pointer v0.0.1 +## explicit +github.com/mattn/go-pointer # github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b ## explicit github.com/mgutz/ansi @@ -164,8 +170,8 @@ github.com/satori/go.uuid # github.com/sirupsen/logrus v1.4.2 ## explicit github.com/sirupsen/logrus -# github.com/stretchr/testify v1.8.4 -## explicit; go 1.20 +# github.com/stretchr/testify v1.9.0 +## explicit; go 1.17 github.com/stretchr/testify/assert github.com/stretchr/testify/require # github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5 @@ -180,15 +186,15 @@ github.com/yapingcat/gomedia/codec # github.com/yapingcat/gomedia/mpeg2 v0.0.0-20220617074658-94762898dc25 ## explicit; go 1.16 github.com/yapingcat/gomedia/mpeg2 -# golang.org/x/crypto v0.9.0 -## explicit; go 1.17 +# golang.org/x/crypto v0.21.0 +## explicit; go 1.18 golang.org/x/crypto/cryptobyte golang.org/x/crypto/cryptobyte/asn1 golang.org/x/crypto/curve25519 golang.org/x/crypto/curve25519/internal/field golang.org/x/crypto/ssh/terminal -# golang.org/x/net v0.10.0 -## explicit; go 1.17 +# golang.org/x/net v0.21.0 +## explicit; go 1.18 golang.org/x/net/bpf golang.org/x/net/dns/dnsmessage golang.org/x/net/internal/iana @@ -196,15 +202,14 @@ golang.org/x/net/internal/socket golang.org/x/net/internal/socks golang.org/x/net/ipv4 golang.org/x/net/proxy -# golang.org/x/sys v0.8.0 -## explicit; go 1.17 +# golang.org/x/sys v0.18.0 +## explicit; go 1.18 golang.org/x/sys/cpu -golang.org/x/sys/internal/unsafeheader golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/term v0.8.0 -## explicit; go 1.17 +# golang.org/x/term v0.18.0 +## explicit; go 1.18 golang.org/x/term # gopkg.in/yaml.v3 v3.0.1 ## explicit diff --git a/trunk/3rdparty/st-srs/Makefile b/trunk/3rdparty/st-srs/Makefile index cc3fedf6de..8fb418c57a 100644 --- a/trunk/3rdparty/st-srs/Makefile +++ b/trunk/3rdparty/st-srs/Makefile @@ -46,6 +46,7 @@ VERSION = 1.9 ########################## CC = cc +CXX = g++ AR = ar LD = ld RANLIB = ranlib @@ -184,13 +185,23 @@ endif # make EXTRA_CFLAGS=-UMD_HAVE_EPOLL # # or to enable sendmmsg(2) support: -# # make EXTRA_CFLAGS="-DMD_HAVE_SENDMMSG -D_GNU_SOURCE" # # or to enable stats for ST: -# # make EXTRA_CFLAGS=-DDEBUG_STATS # +# or cache the stack and reuse it: +# make EXTRA_CFLAGS=-DMD_CACHE_STACK +# +# or enable support for valgrind: +# make EXTRA_CFLAGS="-DMD_VALGRIND" +# +# or enable support for asan: +# make EXTRA_CFLAGS="-DMD_ASAN -fsanitize=address -fno-omit-frame-pointer" +# +# or to disable the clock_gettime for MacOS before 10.12, see https://github.com/ossrs/srs/issues/3978 +# make EXTRA_CFLAGS=-DMD_OSX_NO_CLOCK_GETTIME +# # or enable the coverage for utest: # make UTEST_FLAGS="-fprofile-arcs -ftest-coverage" # @@ -204,7 +215,8 @@ OBJS = $(TARGETDIR)/sched.o \ $(TARGETDIR)/sync.o \ $(TARGETDIR)/key.o \ $(TARGETDIR)/io.o \ - $(TARGETDIR)/event.o + $(TARGETDIR)/event.o \ + $(TARGETDIR)/common.o OBJS += $(EXTRA_OBJS) HEADER = $(TARGETDIR)/st.h SLIBRARY = $(TARGETDIR)/libst.a @@ -267,21 +279,16 @@ $(HEADER): public.h rm -f $@ cp public.h $@ -$(TARGETDIR)/md_linux.o: md_linux.S - $(CC) $(CFLAGS) -c $< -o $@ - -$(TARGETDIR)/md_linux2.o: md_linux2.S - $(CC) $(CFLAGS) -c $< -o $@ - -$(TARGETDIR)/md_darwin.o: md_darwin.S - $(CC) $(CFLAGS) -c $< -o $@ - -$(TARGETDIR)/md_cygwin64.o: md_cygwin64.S +$(TARGETDIR)/%.o: %.S $(CC) $(CFLAGS) -c $< -o $@ $(TARGETDIR)/%.o: %.c common.h md.h $(CC) $(CFLAGS) -c $< -o $@ +# Note that we use C++98 standard for the C++ files. +$(TARGETDIR)/%.o: %.cc common.h md.h + $(CXX) $(CFLAGS) -c $< -o $@ -std=c++98 + clean: rm -rf *_OPT *_DBG obj st.pc diff --git a/trunk/3rdparty/st-srs/README.md b/trunk/3rdparty/st-srs/README.md index 67d224ab2a..f033d8eaee 100644 --- a/trunk/3rdparty/st-srs/README.md +++ b/trunk/3rdparty/st-srs/README.md @@ -51,6 +51,12 @@ Linux with valgrind and epoll: make linux-debug EXTRA_CFLAGS="-DMD_HAVE_EPOLL -DMD_VALGRIND" ``` +Linux with ASAN(Google Address Sanitizer): + +```bash +make linux-debug EXTRA_CFLAGS="-DMD_ASAN" +``` + ## Mac: Usage Get code: @@ -119,6 +125,7 @@ The branch [srs](https://github.com/ossrs/state-threads/tree/srs) was patched an - [x] Check capability for backtrack. - [x] Support set specifics for any thread. - [x] Support st_destroy to free resources for asan. +- [x] Support free the stack, [#38](https://github.com/ossrs/state-threads/issues/38). - [ ] System: Support sendmmsg for UDP, [#12](https://github.com/ossrs/state-threads/issues/12). ## GDB Tools diff --git a/trunk/3rdparty/st-srs/common.c b/trunk/3rdparty/st-srs/common.c new file mode 100644 index 0000000000..e241ec5f37 --- /dev/null +++ b/trunk/3rdparty/st-srs/common.c @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright (c) 2021-2022 The SRS Authors */ + +#include "common.h" + +void *_st_primordial_stack_bottom = NULL; +size_t _st_primordial_stack_size = 0; + +void st_set_primordial_stack(void *top, void *bottom) +{ + _st_primordial_stack_bottom = bottom; + _st_primordial_stack_size = (char *)top - (char *)bottom; +} + diff --git a/trunk/3rdparty/st-srs/common.h b/trunk/3rdparty/st-srs/common.h index acedf3da94..74b6afe213 100644 --- a/trunk/3rdparty/st-srs/common.h +++ b/trunk/3rdparty/st-srs/common.h @@ -69,13 +69,8 @@ #include "public.h" #include "md.h" -/* merge from https://github.com/toffaletti/state-threads/commit/7f57fc9acc05e657bca1223f1e5b9b1a45ed929b */ -#ifndef MD_VALGRIND - #ifndef NVALGRIND - #define NVALGRIND - #endif -#else - #undef NVALGRIND +#ifdef __cplusplus +extern "C" { #endif @@ -88,58 +83,37 @@ typedef struct _st_clist { struct _st_clist *prev; } _st_clist_t; -/* Insert element "_e" into the list, before "_l" */ -#define ST_INSERT_BEFORE(_e,_l) \ - ST_BEGIN_MACRO \ - (_e)->next = (_l); \ - (_e)->prev = (_l)->prev; \ - (_l)->prev->next = (_e); \ - (_l)->prev = (_e); \ - ST_END_MACRO - -/* Insert element "_e" into the list, after "_l" */ -#define ST_INSERT_AFTER(_e,_l) \ - ST_BEGIN_MACRO \ - (_e)->next = (_l)->next; \ - (_e)->prev = (_l); \ - (_l)->next->prev = (_e); \ - (_l)->next = (_e); \ - ST_END_MACRO - -/* Return the element following element "_e" */ -#define ST_NEXT_LINK(_e) ((_e)->next) - -/* Append an element "_e" to the end of the list "_l" */ -#define ST_APPEND_LINK(_e,_l) ST_INSERT_BEFORE(_e,_l) - -/* Insert an element "_e" at the head of the list "_l" */ -#define ST_INSERT_LINK(_e,_l) ST_INSERT_AFTER(_e,_l) - -/* Return the head/tail of the list */ -#define ST_LIST_HEAD(_l) (_l)->next -#define ST_LIST_TAIL(_l) (_l)->prev +/* Initialize a circular list */ +static inline void st_clist_init(_st_clist_t *l) +{ + l->next = l; + l->prev = l; +} /* Remove the element "_e" from it's circular list */ -#define ST_REMOVE_LINK(_e) \ - ST_BEGIN_MACRO \ - (_e)->prev->next = (_e)->next; \ - (_e)->next->prev = (_e)->prev; \ - ST_END_MACRO +static inline void st_clist_remove(_st_clist_t *e) +{ + e->prev->next = e->next; + e->next->prev = e->prev; +} -/* Return non-zero if the given circular list "_l" is empty, */ -/* zero if the circular list is not empty */ -#define ST_CLIST_IS_EMPTY(_l) \ - ((_l)->next == (_l)) - -/* Initialize a circular list */ -#define ST_INIT_CLIST(_l) \ - ST_BEGIN_MACRO \ - (_l)->next = (_l); \ - (_l)->prev = (_l); \ - ST_END_MACRO +/* Insert element "_e" into the list, before "_l" */ +static inline void st_clist_insert_before(_st_clist_t *e, _st_clist_t *l) +{ + e->next = l; + e->prev = l->prev; + l->prev->next = e; + l->prev = e; +} -#define ST_INIT_STATIC_CLIST(_l) \ - {(_l), (_l)} +/* Insert element "_e" into the list, after "_l" */ +static inline void st_clist_insert_after(_st_clist_t *e, _st_clist_t *l) +{ + e->next = l->next; + e->prev = l; + l->next->prev = e; + l->next = e; +} /***************************************** @@ -158,7 +132,7 @@ typedef struct _st_stack { char *stk_top; /* Highest address of stack's usable portion */ void *sp; /* Stack pointer from C's point of view */ /* merge from https://github.com/toffaletti/state-threads/commit/7f57fc9acc05e657bca1223f1e5b9b1a45ed929b */ -#ifndef NVALGRIND +#ifdef MD_VALGRIND /* id returned by VALGRIND_STACK_REGISTER */ /* http://valgrind.org/docs/manual/manual-core-adv.html */ unsigned long valgrind_stack_id; @@ -188,6 +162,10 @@ struct _st_thread { _st_clist_t tlink; /* For putting on thread queue */ #endif +#ifdef MD_ASAN + void *fake_stack; /* Fake stack for ASAN */ +#endif + st_utime_t due; /* Wakeup time when thread is sleeping */ _st_thread_t *left; /* For putting in timeout heap */ _st_thread_t *right; /* -- see docs/timeout_heap.txt for details */ @@ -270,48 +248,6 @@ extern __thread _st_vp_t _st_this_vp; extern __thread _st_thread_t *_st_this_thread; extern __thread _st_eventsys_t *_st_eventsys; -#define _ST_CURRENT_THREAD() (_st_this_thread) -#define _ST_SET_CURRENT_THREAD(_thread) (_st_this_thread = (_thread)) - -#define _ST_LAST_CLOCK (_st_this_vp.last_clock) - -#define _ST_RUNQ (_st_this_vp.run_q) -#define _ST_IOQ (_st_this_vp.io_q) -#define _ST_ZOMBIEQ (_st_this_vp.zombie_q) -#ifdef DEBUG - #define _ST_THREADQ (_st_this_vp.thread_q) -#endif - -#define _ST_PAGE_SIZE (_st_this_vp.pagesize) - -#define _ST_SLEEPQ (_st_this_vp.sleep_q) -#define _ST_SLEEPQ_SIZE (_st_this_vp.sleepq_size) - -#define _ST_VP_IDLE() (*_st_eventsys->dispatch)() - - -/***************************************** - * vp queues operations - */ - -#define _ST_ADD_IOQ(_pq) ST_APPEND_LINK(&_pq.links, &_ST_IOQ) -#define _ST_DEL_IOQ(_pq) ST_REMOVE_LINK(&_pq.links) - -#define _ST_ADD_RUNQ(_thr) ST_APPEND_LINK(&(_thr)->links, &_ST_RUNQ) -#define _ST_INSERT_RUNQ(_thr) ST_INSERT_LINK(&(_thr)->links, &_ST_RUNQ) -#define _ST_DEL_RUNQ(_thr) ST_REMOVE_LINK(&(_thr)->links) - -#define _ST_ADD_SLEEPQ(_thr, _timeout) _st_add_sleep_q(_thr, _timeout) -#define _ST_DEL_SLEEPQ(_thr) _st_del_sleep_q(_thr) - -#define _ST_ADD_ZOMBIEQ(_thr) ST_APPEND_LINK(&(_thr)->links, &_ST_ZOMBIEQ) -#define _ST_DEL_ZOMBIEQ(_thr) ST_REMOVE_LINK(&(_thr)->links) - -#ifdef DEBUG - #define _ST_ADD_THREADQ(_thr) ST_APPEND_LINK(&(_thr)->tlink, &_ST_THREADQ) - #define _ST_DEL_THREADQ(_thr) ST_REMOVE_LINK(&(_thr)->tlink) -#endif - /***************************************** * Thread states and flags @@ -378,6 +314,32 @@ extern __thread _st_eventsys_t *_st_eventsys; #endif +/***************************************** + * Forward declarations + */ + +void _st_vp_schedule(_st_thread_t *from); +void _st_vp_check_clock(void); +void *_st_idle_thread_start(void *arg); +void _st_thread_main(void); +void _st_thread_cleanup(_st_thread_t *thread); +void _st_add_sleep_q(_st_thread_t *thread, st_utime_t timeout); +void _st_del_sleep_q(_st_thread_t *thread); +_st_stack_t *_st_stack_new(int stack_size); +void _st_stack_free(_st_stack_t *ts); +int _st_io_init(void); + +st_utime_t st_utime(void); +_st_cond_t *st_cond_new(void); +int st_cond_destroy(_st_cond_t *cvar); +int st_cond_timedwait(_st_cond_t *cvar, st_utime_t timeout); +int st_cond_signal(_st_cond_t *cvar); +ssize_t st_read(_st_netfd_t *fd, void *buf, size_t nbyte, st_utime_t timeout); +ssize_t st_write(_st_netfd_t *fd, const void *buf, size_t nbyte, st_utime_t timeout); +int st_poll(struct pollfd *pds, int npds, st_utime_t timeout); +_st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg, int joinable, int stk_size); + + /***************************************** * Threads context switching */ @@ -407,69 +369,106 @@ extern __thread _st_eventsys_t *_st_eventsys; #define ST_SWITCH_IN_CB(_thread) #endif +#ifdef MD_ASAN /* - * Switch away from the current thread context by saving its state and - * calling the thread scheduler + * Fiber annotation interface. + * + * Before switching to a different stack, one must call + * __sanitizer_start_switch_fiber with a pointer to the bottom of the + * destination stack and its size. When code starts running on the new stack, + * it must call __sanitizer_finish_switch_fiber to finalize the switch. + * The start_switch function takes a void** to store the current fake stack if + * there is one (it is needed when detect_stack_use_after_return is enabled). + * When restoring a stack, this pointer must be given to the finish_switch + * function. In most cases, this void* can be stored on the stack just before + * switching. When leaving a fiber definitely, null must be passed as first + * argument to the start_switch function so that the fake stack is destroyed. + * If you do not want support for stack use-after-return detection, you can + * always pass null to these two functions. + * Note that the fake stack mechanism is disabled during fiber switch, so if a + * signal callback runs during the switch, it will not benefit from the stack + * use-after-return detection. + * + * See https://github.com/google/sanitizers/issues/189#issuecomment-1346243598 */ -#define _ST_SWITCH_CONTEXT(_thread) \ - ST_BEGIN_MACRO \ - ST_SWITCH_OUT_CB(_thread); \ - if (!MD_SETJMP((_thread)->context)) { \ - _st_vp_schedule(); \ - } \ - ST_DEBUG_ITERATE_THREADS(); \ - ST_SWITCH_IN_CB(_thread); \ - ST_END_MACRO +extern void __sanitizer_start_switch_fiber(void **fake_stack_save, + const void *bottom, size_t size); + +extern void __sanitizer_finish_switch_fiber(void *fake_stack_save, + const void **bottom_old, + size_t *size_old); + +/* The stack for primoridal thread. */ +extern void *_st_primordial_stack_bottom; +extern size_t _st_primordial_stack_size; + +static inline void _st_asan_start_switch(_st_thread_t *from, _st_thread_t *thread) +{ + /* For primordial thread, the stack is NULL, so asan can not capture it. */ + const void *stk_bottom = thread->stack ? thread->stack->stk_bottom : NULL; + size_t stk_size = thread->stack ? thread->stack->stk_size : 0; + + /* For primordial thread, user should setup the stack information. */ + if (!stk_bottom && (thread->flags & _ST_FL_PRIMORDIAL)) { + stk_bottom = _st_primordial_stack_bottom; + stk_size = _st_primordial_stack_size; + } + + /* + * Save the current stack to fake_stack of from, tell asan the target stack + * we are targeting to switch to. + */ + __sanitizer_start_switch_fiber(&from->fake_stack, stk_bottom, stk_size); +} + +static inline void _st_asan_finish_switch(_st_thread_t *thread) +{ + __sanitizer_finish_switch_fiber(thread->fake_stack, NULL, NULL); +} +#endif /* - * Restore a thread context that was saved by _ST_SWITCH_CONTEXT or - * initialized by _ST_INIT_CONTEXT + * Switch away from the current thread context by saving its state and + * calling the thread scheduler */ -#define _ST_RESTORE_CONTEXT(_thread) \ - ST_BEGIN_MACRO \ - _ST_SET_CURRENT_THREAD(_thread); \ - MD_LONGJMP((_thread)->context, 1); \ - ST_END_MACRO +static inline void _st_switch_context(_st_thread_t *thread) +{ + ST_SWITCH_OUT_CB(thread); + + if (!_st_md_cxt_save(thread->context)) { + _st_vp_schedule(thread); + } + +#ifdef MD_ASAN + /* Switch from other thread to this running thread. */ + _st_asan_finish_switch(thread); +#endif + + ST_DEBUG_ITERATE_THREADS(); + ST_SWITCH_IN_CB(thread); +} /* - * Initialize the thread context preparing it to execute _main + * Restore a thread context that was saved by _st_switch_context or + * initialized by _ST_INIT_CONTEXT */ -#ifdef MD_INIT_CONTEXT - #define _ST_INIT_CONTEXT MD_INIT_CONTEXT -#else - #error Unknown OS +static inline void _st_restore_context(_st_thread_t *from, _st_thread_t *thread) +{ +#ifdef MD_ASAN + _st_asan_start_switch(from, thread); #endif + _st_this_thread = thread; + _st_md_cxt_restore(thread->context, 1); +} /* * Number of bytes reserved under the stack "bottom" */ -#define _ST_STACK_PAD_SIZE MD_STACK_PAD_SIZE - - -/***************************************** - * Forward declarations - */ - -void _st_vp_schedule(void); -void _st_vp_check_clock(void); -void *_st_idle_thread_start(void *arg); -void _st_thread_main(void); -void _st_thread_cleanup(_st_thread_t *thread); -void _st_add_sleep_q(_st_thread_t *thread, st_utime_t timeout); -void _st_del_sleep_q(_st_thread_t *thread); -_st_stack_t *_st_stack_new(int stack_size); -void _st_stack_free(_st_stack_t *ts); -int _st_io_init(void); +#define _ST_STACK_PAD_SIZE 128 -st_utime_t st_utime(void); -_st_cond_t *st_cond_new(void); -int st_cond_destroy(_st_cond_t *cvar); -int st_cond_timedwait(_st_cond_t *cvar, st_utime_t timeout); -int st_cond_signal(_st_cond_t *cvar); -ssize_t st_read(_st_netfd_t *fd, void *buf, size_t nbyte, st_utime_t timeout); -ssize_t st_write(_st_netfd_t *fd, const void *buf, size_t nbyte, st_utime_t timeout); -int st_poll(struct pollfd *pds, int npds, st_utime_t timeout); -_st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg, int joinable, int stk_size); +#ifdef __cplusplus +} /* extern "C" */ +#endif #endif /* !__ST_COMMON_H__ */ diff --git a/trunk/3rdparty/st-srs/docs/timeout_heap.txt b/trunk/3rdparty/st-srs/docs/timeout_heap.txt index 1582dc1293..82fb077dd3 100644 --- a/trunk/3rdparty/st-srs/docs/timeout_heap.txt +++ b/trunk/3rdparty/st-srs/docs/timeout_heap.txt @@ -22,7 +22,7 @@ appropriate for ST than introducing a separate array. Thus, the new ST timeout heap works by organizing the existing _st_thread_t objects in a balanced binary tree, just as they were previously organized into a doubly-linked, sorted list. The global -_ST_SLEEPQ variable, formerly a linked list head, is now simply a +_st_this_vp.sleep_q variable, formerly a linked list head, is now simply a pointer to the root of this tree, and the root node of the tree is the thread with the earliest timeout. Each thread object has two child pointers, "left" and "right", pointing to threads with later timeouts. diff --git a/trunk/3rdparty/st-srs/event.c b/trunk/3rdparty/st-srs/event.c index 00a951c8b0..c6e125b51d 100644 --- a/trunk/3rdparty/st-srs/event.c +++ b/trunk/3rdparty/st-srs/event.c @@ -233,7 +233,7 @@ ST_HIDDEN void _st_select_find_bad_fd(void) _ST_SELECT_MAX_OSFD = -1; - for (q = _ST_IOQ.next; q != &_ST_IOQ; q = q->next) { + for (q = _st_this_vp.io_q.next; q != &_st_this_vp.io_q; q = q->next) { pq = _ST_POLLQUEUE_PTR(q); notify = 0; epds = pq->pds + pq->npds; @@ -254,7 +254,7 @@ ST_HIDDEN void _st_select_find_bad_fd(void) } if (notify) { - ST_REMOVE_LINK(&pq->links); + st_clist_remove(&pq->links); pq->on_ioq = 0; /* * Decrement the count of descriptors for each descriptor/event @@ -281,9 +281,9 @@ ST_HIDDEN void _st_select_find_bad_fd(void) } if (pq->thread->flags & _ST_FL_ON_SLEEPQ) - _ST_DEL_SLEEPQ(pq->thread); + _st_del_sleep_q(pq->thread); pq->thread->state = _ST_ST_RUNNABLE; - _ST_ADD_RUNQ(pq->thread); + st_clist_insert_before(&pq->thread->links, &_st_this_vp.run_q); } else { if (_ST_SELECT_MAX_OSFD < pq_max_osfd) _ST_SELECT_MAX_OSFD = pq_max_osfd; @@ -315,11 +315,11 @@ ST_HIDDEN void _st_select_dispatch(void) wp = &w; ep = &e; - if (_ST_SLEEPQ == NULL) { + if (_st_this_vp.sleep_q == NULL) { tvp = NULL; } else { - min_timeout = (_ST_SLEEPQ->due <= _ST_LAST_CLOCK) ? 0 : - (_ST_SLEEPQ->due - _ST_LAST_CLOCK); + min_timeout = (_st_this_vp.sleep_q->due <= _st_this_vp.last_clock) ? 0 : + (_st_this_vp.sleep_q->due - _st_this_vp.last_clock); timeout.tv_sec = (int) (min_timeout / 1000000); timeout.tv_usec = (int) (min_timeout % 1000000); tvp = &timeout; @@ -331,7 +331,7 @@ ST_HIDDEN void _st_select_dispatch(void) /* Notify threads that are associated with the selected descriptors */ if (nfd > 0) { _ST_SELECT_MAX_OSFD = -1; - for (q = _ST_IOQ.next; q != &_ST_IOQ; q = q->next) { + for (q = _st_this_vp.io_q.next; q != &_st_this_vp.io_q; q = q->next) { pq = _ST_POLLQUEUE_PTR(q); notify = 0; epds = pq->pds + pq->npds; @@ -359,7 +359,7 @@ ST_HIDDEN void _st_select_dispatch(void) } } if (notify) { - ST_REMOVE_LINK(&pq->links); + st_clist_remove(&pq->links); pq->on_ioq = 0; /* * Decrement the count of descriptors for each descriptor/event @@ -386,9 +386,9 @@ ST_HIDDEN void _st_select_dispatch(void) } if (pq->thread->flags & _ST_FL_ON_SLEEPQ) - _ST_DEL_SLEEPQ(pq->thread); + _st_del_sleep_q(pq->thread); pq->thread->state = _ST_ST_RUNNABLE; - _ST_ADD_RUNQ(pq->thread); + st_clist_insert_before(&pq->thread->links, &_st_this_vp.run_q); } else { if (_ST_SELECT_MAX_OSFD < pq_max_osfd) _ST_SELECT_MAX_OSFD = pq_max_osfd; @@ -697,10 +697,10 @@ ST_HIDDEN void _st_kq_dispatch(void) int nfd, i, osfd, notify, filter; short events, revents; - if (_ST_SLEEPQ == NULL) { + if (_st_this_vp.sleep_q == NULL) { tsp = NULL; } else { - min_timeout = (_ST_SLEEPQ->due <= _ST_LAST_CLOCK) ? 0 : (_ST_SLEEPQ->due - _ST_LAST_CLOCK); + min_timeout = (_st_this_vp.sleep_q->due <= _st_this_vp.last_clock) ? 0 : (_st_this_vp.sleep_q->due - _st_this_vp.last_clock); timeout.tv_sec = (time_t) (min_timeout / 1000000); timeout.tv_nsec = (long) ((min_timeout % 1000000) * 1000); tsp = &timeout; @@ -735,7 +735,7 @@ ST_HIDDEN void _st_kq_dispatch(void) _st_kq_data->dellist_cnt = 0; - for (q = _ST_IOQ.next; q != &_ST_IOQ; q = q->next) { + for (q = _st_this_vp.io_q.next; q != &_st_this_vp.io_q; q = q->next) { pq = _ST_POLLQUEUE_PTR(q); notify = 0; epds = pq->pds + pq->npds; @@ -756,7 +756,7 @@ ST_HIDDEN void _st_kq_dispatch(void) } } if (notify) { - ST_REMOVE_LINK(&pq->links); + st_clist_remove(&pq->links); pq->on_ioq = 0; for (pds = pq->pds; pds < epds; pds++) { osfd = pds->fd; @@ -782,9 +782,9 @@ ST_HIDDEN void _st_kq_dispatch(void) } if (pq->thread->flags & _ST_FL_ON_SLEEPQ) - _ST_DEL_SLEEPQ(pq->thread); + _st_del_sleep_q(pq->thread); pq->thread->state = _ST_ST_RUNNABLE; - _ST_ADD_RUNQ(pq->thread); + st_clist_insert_before(&pq->thread->links, &_st_this_vp.run_q); } } @@ -811,7 +811,7 @@ ST_HIDDEN void _st_kq_dispatch(void) _st_kq_data->pid = getpid(); /* Re-register all descriptors on ioq with new kqueue */ memset(_st_kq_data->fd_data, 0, _st_kq_data->fd_data_size * sizeof(_kq_fd_data_t)); - for (q = _ST_IOQ.next; q != &_ST_IOQ; q = q->next) { + for (q = _st_this_vp.io_q.next; q != &_st_this_vp.io_q; q = q->next) { pq = _ST_POLLQUEUE_PTR(q); _st_kq_pollset_add(pq->pds, pq->npds); } @@ -1064,10 +1064,10 @@ ST_HIDDEN void _st_epoll_dispatch(void) ++_st_stat_epoll; #endif - if (_ST_SLEEPQ == NULL) { + if (_st_this_vp.sleep_q == NULL) { timeout = -1; } else { - min_timeout = (_ST_SLEEPQ->due <= _ST_LAST_CLOCK) ? 0 : (_ST_SLEEPQ->due - _ST_LAST_CLOCK); + min_timeout = (_st_this_vp.sleep_q->due <= _st_this_vp.last_clock) ? 0 : (_st_this_vp.sleep_q->due - _st_this_vp.last_clock); timeout = (int) (min_timeout / 1000); // At least wait 1ms when <1ms, to avoid epoll_wait spin loop. @@ -1105,7 +1105,7 @@ ST_HIDDEN void _st_epoll_dispatch(void) } } - for (q = _ST_IOQ.next; q != &_ST_IOQ; q = q->next) { + for (q = _st_this_vp.io_q.next; q != &_st_this_vp.io_q; q = q->next) { pq = _ST_POLLQUEUE_PTR(q); notify = 0; epds = pq->pds + pq->npds; @@ -1135,7 +1135,7 @@ ST_HIDDEN void _st_epoll_dispatch(void) } } if (notify) { - ST_REMOVE_LINK(&pq->links); + st_clist_remove(&pq->links); pq->on_ioq = 0; /* * Here we will only delete/modify descriptors that @@ -1144,9 +1144,9 @@ ST_HIDDEN void _st_epoll_dispatch(void) _st_epoll_pollset_del(pq->pds, pq->npds); if (pq->thread->flags & _ST_FL_ON_SLEEPQ) - _ST_DEL_SLEEPQ(pq->thread); + _st_del_sleep_q(pq->thread); pq->thread->state = _ST_ST_RUNNABLE; - _ST_ADD_RUNQ(pq->thread); + st_clist_insert_before(&pq->thread->links, &_st_this_vp.run_q); } } diff --git a/trunk/3rdparty/st-srs/key.c b/trunk/3rdparty/st-srs/key.c index 23746800e5..86c042b8b4 100644 --- a/trunk/3rdparty/st-srs/key.c +++ b/trunk/3rdparty/st-srs/key.c @@ -78,7 +78,7 @@ int st_key_getlimit(void) int st_thread_setspecific(int key, void *value) { - _st_thread_t *me = _ST_CURRENT_THREAD(); + _st_thread_t *me = _st_this_thread; return st_thread_setspecific2(me, key, value); } @@ -107,7 +107,7 @@ void *st_thread_getspecific(int key) if (key < 0 || key >= key_max) return NULL; - return ((_ST_CURRENT_THREAD())->private_data[key]); + return _st_this_thread->private_data[key]; } diff --git a/trunk/3rdparty/st-srs/md.h b/trunk/3rdparty/st-srs/md.h index d3158db3fc..a25c0087af 100644 --- a/trunk/3rdparty/st-srs/md.h +++ b/trunk/3rdparty/st-srs/md.h @@ -74,13 +74,11 @@ typedef struct _st_jmp_buf { long __jmpbuf[22]; } _st_jmp_buf_t[1]; +/* Defined in *.S file and implemented by ASM. */ extern int _st_md_cxt_save(_st_jmp_buf_t env); extern void _st_md_cxt_restore(_st_jmp_buf_t env, int val); /* Always use builtin setjmp/longjmp, use asm code. */ -#define MD_USE_BUILTIN_SETJMP -#define MD_SETJMP(env) _st_md_cxt_save(env) -#define MD_LONGJMP(env, val) _st_md_cxt_restore(env, val) #if defined(USE_LIBC_SETJMP) #error The libc setjmp is not supported now #endif @@ -102,18 +100,22 @@ extern void _st_md_cxt_restore(_st_jmp_buf_t env, int val); #else #error Unknown CPU architecture #endif - - #define MD_INIT_CONTEXT(_thread, _sp, _main) \ - ST_BEGIN_MACRO \ - if (MD_SETJMP((_thread)->context)) \ - _main(); \ - MD_GET_SP(_thread) = (long) (_sp); \ - ST_END_MACRO - #define MD_GET_UTIME() \ - struct timeval tv; \ - (void) gettimeofday(&tv, NULL); \ - return (tv.tv_sec * 1000000LL + tv.tv_usec) + #if defined (MD_OSX_NO_CLOCK_GETTIME) + #define MD_GET_UTIME() \ + struct timeval tv; \ + (void) gettimeofday(&tv, NULL); \ + return (tv.tv_sec * 1000000LL + tv.tv_usec) + #else + /* + * https://github.com/ossrs/srs/issues/3978 + * use clock_gettime to get the timestamp in microseconds. + */ + #define MD_GET_UTIME() \ + struct timespec ts; \ + clock_gettime(CLOCK_MONOTONIC, &ts); \ + return (ts.tv_sec * 1000000LL + ts.tv_nsec / 1000) + #endif #elif defined (LINUX) @@ -129,13 +131,13 @@ extern void _st_md_cxt_restore(_st_jmp_buf_t env, int val); #define MD_HAVE_SOCKLEN_T /* - * All architectures and flavors of linux have the gettimeofday - * function but if you know of a faster way, use it. + * https://github.com/ossrs/srs/issues/3978 + * use clock_gettime to get the timestamp in microseconds. */ - #define MD_GET_UTIME() \ - struct timeval tv; \ - (void) gettimeofday(&tv, NULL); \ - return (tv.tv_sec * 1000000LL + tv.tv_usec) + #define MD_GET_UTIME() \ + struct timespec ts; \ + clock_gettime(CLOCK_MONOTONIC, &ts); \ + return (ts.tv_sec * 1000000LL + ts.tv_nsec / 1000) #if defined(__i386__) #define MD_GET_SP(_t) *((long *)&((_t)->context[0].__jmpbuf[4])) @@ -161,14 +163,7 @@ extern void _st_md_cxt_restore(_st_jmp_buf_t env, int val); #define MD_GET_SP(_t) *((long *)&((_t)->context[0].__jmpbuf[0])) #else #error "Unknown CPU architecture" - #endif /* Cases with common MD_INIT_CONTEXT and different SP locations */ - - #define MD_INIT_CONTEXT(_thread, _sp, _main) \ - ST_BEGIN_MACRO \ - if (MD_SETJMP((_thread)->context)) \ - _main(); \ - MD_GET_SP(_thread) = (long) (_sp); \ - ST_END_MACRO + #endif #elif defined (CYGWIN64) @@ -177,21 +172,12 @@ extern void _st_md_cxt_restore(_st_jmp_buf_t env, int val); #define MD_ACCEPT_NB_INHERITED #define MD_HAVE_SOCKLEN_T - #define MD_USE_BUILTIN_SETJMP - #if defined(__amd64__) || defined(__x86_64__) #define MD_GET_SP(_t) *((long *)&((_t)->context[0].__jmpbuf[6])) #else #error Unknown CPU architecture #endif - #define MD_INIT_CONTEXT(_thread, _sp, _main) \ - ST_BEGIN_MACRO \ - if (MD_SETJMP((_thread)->context)) \ - _main(); \ - MD_GET_SP(_thread) = (long) (_sp); \ - ST_END_MACRO - #define MD_GET_UTIME() \ struct timeval tv; \ (void) gettimeofday(&tv, NULL); \ @@ -201,10 +187,6 @@ extern void _st_md_cxt_restore(_st_jmp_buf_t env, int val); #error Unknown OS #endif /* OS */ -#ifndef MD_STACK_PAD_SIZE - #define MD_STACK_PAD_SIZE 128 -#endif - #if !defined(MD_HAVE_SOCKLEN_T) && !defined(socklen_t) #define socklen_t int #endif diff --git a/trunk/3rdparty/st-srs/public.h b/trunk/3rdparty/st-srs/public.h index 97da146429..6555c02c0e 100644 --- a/trunk/3rdparty/st-srs/public.h +++ b/trunk/3rdparty/st-srs/public.h @@ -159,6 +159,8 @@ extern st_netfd_t st_open(const char *path, int oflags, mode_t mode); extern void st_destroy(void); extern int st_thread_setspecific2(st_thread_t thread, int key, void *value); +extern void st_set_primordial_stack(void *top, void *bottom); + #ifdef DEBUG extern void _st_show_thread_stack(st_thread_t thread, const char *messg); extern void _st_iterate_threads(void); diff --git a/trunk/3rdparty/st-srs/sched.c b/trunk/3rdparty/st-srs/sched.c index 176e9d1a10..691f2a2aa4 100644 --- a/trunk/3rdparty/st-srs/sched.c +++ b/trunk/3rdparty/st-srs/sched.c @@ -50,7 +50,7 @@ #include "common.h" /* merge from https://github.com/toffaletti/state-threads/commit/7f57fc9acc05e657bca1223f1e5b9b1a45ed929b */ -#ifndef NVALGRIND +#ifdef MD_VALGRIND #include #endif @@ -89,7 +89,7 @@ int st_poll(struct pollfd *pds, int npds, st_utime_t timeout) struct pollfd *pd; struct pollfd *epd = pds + npds; _st_pollq_t pq; - _st_thread_t *me = _ST_CURRENT_THREAD(); + _st_thread_t *me = _st_this_thread; int n; if (me->flags & _ST_FL_INTERRUPT) { @@ -105,17 +105,17 @@ int st_poll(struct pollfd *pds, int npds, st_utime_t timeout) pq.npds = npds; pq.thread = me; pq.on_ioq = 1; - _ST_ADD_IOQ(pq); + st_clist_insert_before(&pq.links, &_st_this_vp.io_q); if (timeout != ST_UTIME_NO_TIMEOUT) - _ST_ADD_SLEEPQ(me, timeout); + _st_add_sleep_q(me, timeout); me->state = _ST_ST_IO_WAIT; - _ST_SWITCH_CONTEXT(me); + _st_switch_context(me); n = 0; if (pq.on_ioq) { /* If we timed out, the pollq might still be on the ioq. Remove it */ - _ST_DEL_IOQ(pq); + st_clist_remove(&pq.links); (*_st_eventsys->pollset_del)(pds, npds); } else { /* Count the number of ready descriptors */ @@ -135,18 +135,18 @@ int st_poll(struct pollfd *pds, int npds, st_utime_t timeout) } -void _st_vp_schedule(void) +void _st_vp_schedule(_st_thread_t *from) { _st_thread_t *thread; - if (_ST_RUNQ.next != &_ST_RUNQ) { + if (_st_this_vp.run_q.next != &_st_this_vp.run_q) { #if defined(DEBUG) && defined(DEBUG_STATS) ++_st_stat_thread_run; #endif /* Pull thread off of the run queue */ - thread = _ST_THREAD_PTR(_ST_RUNQ.next); - _ST_DEL_RUNQ(thread); + thread = _ST_THREAD_PTR(_st_this_vp.run_q.next); + st_clist_remove(&thread->links); } else { #if defined(DEBUG) && defined(DEBUG_STATS) ++_st_stat_thread_idle; @@ -159,7 +159,7 @@ void _st_vp_schedule(void) /* Resume the thread */ thread->state = _ST_ST_RUNNING; - _ST_RESTORE_CONTEXT(thread); + _st_restore_context(from, thread); } @@ -182,16 +182,16 @@ int st_init(void) return -1; // Initialize the thread-local variables. - ST_INIT_CLIST(&_st_free_stacks); + st_clist_init(&_st_free_stacks); // Initialize ST. memset(&_st_this_vp, 0, sizeof(_st_vp_t)); - ST_INIT_CLIST(&_ST_RUNQ); - ST_INIT_CLIST(&_ST_IOQ); - ST_INIT_CLIST(&_ST_ZOMBIEQ); + st_clist_init(&_st_this_vp.run_q); + st_clist_init(&_st_this_vp.io_q); + st_clist_init(&_st_this_vp.zombie_q); #ifdef DEBUG - ST_INIT_CLIST(&_ST_THREADQ); + st_clist_init(&_st_this_vp.thread_q); #endif if ((*_st_eventsys->init)() < 0) @@ -208,7 +208,7 @@ int st_init(void) return -1; _st_this_vp.idle_thread->flags = _ST_FL_IDLE_THREAD; _st_active_count--; - _ST_DEL_RUNQ(_st_this_vp.idle_thread); + st_clist_remove(&_st_this_vp.idle_thread->links); /* * Initialize primordial thread @@ -219,10 +219,10 @@ int st_init(void) thread->private_data = (void **) (thread + 1); thread->state = _ST_ST_RUNNING; thread->flags = _ST_FL_PRIMORDIAL; - _ST_SET_CURRENT_THREAD(thread); + _st_this_thread = thread; _st_active_count++; #ifdef DEBUG - _ST_ADD_THREADQ(thread); + st_clist_insert_before(&thread->tlink, &_st_this_vp.thread_q); #endif return 0; @@ -261,17 +261,17 @@ st_switch_cb_t st_set_switch_out_cb(st_switch_cb_t cb) /* ARGSUSED */ void *_st_idle_thread_start(void *arg) { - _st_thread_t *me = _ST_CURRENT_THREAD(); + _st_thread_t *me = _st_this_thread; while (_st_active_count > 0) { /* Idle vp till I/O is ready or the smallest timeout expired */ - _ST_VP_IDLE(); + (*_st_eventsys->dispatch)(); /* Check sleep queue for expired threads */ _st_vp_check_clock(); me->state = _ST_ST_RUNNABLE; - _ST_SWITCH_CONTEXT(me); + _st_switch_context(me); } /* No more threads */ @@ -284,7 +284,7 @@ void *_st_idle_thread_start(void *arg) void st_thread_exit(void *retval) { - _st_thread_t *thread = _ST_CURRENT_THREAD(); + _st_thread_t *thread = _st_this_thread; thread->retval = retval; _st_thread_cleanup(thread); @@ -292,13 +292,13 @@ void st_thread_exit(void *retval) if (thread->term) { /* Put thread on the zombie queue */ thread->state = _ST_ST_ZOMBIE; - _ST_ADD_ZOMBIEQ(thread); + st_clist_insert_before(&thread->links, &_st_this_vp.zombie_q); /* Notify on our termination condition variable */ st_cond_signal(thread->term); /* Switch context and come back later */ - _ST_SWITCH_CONTEXT(thread); + _st_switch_context(thread); /* Continue the cleanup */ st_cond_destroy(thread->term); @@ -306,11 +306,11 @@ void st_thread_exit(void *retval) } #ifdef DEBUG - _ST_DEL_THREADQ(thread); + st_clist_remove(&thread->tlink); #endif /* merge from https://github.com/toffaletti/state-threads/commit/7f57fc9acc05e657bca1223f1e5b9b1a45ed929b */ -#ifndef NVALGRIND +#ifdef MD_VALGRIND if (!(thread->flags & _ST_FL_PRIMORDIAL)) { VALGRIND_STACK_DEREGISTER(thread->stack->valgrind_stack_id); } @@ -320,7 +320,7 @@ void st_thread_exit(void *retval) _st_stack_free(thread->stack); /* Find another thread to run */ - _ST_SWITCH_CONTEXT(thread); + _st_switch_context(thread); /* Not going to land here */ } @@ -334,7 +334,7 @@ int st_thread_join(_st_thread_t *thread, void **retvalp) errno = EINVAL; return -1; } - if (_ST_CURRENT_THREAD() == thread) { + if (_st_this_thread == thread) { errno = EDEADLK; return -1; } @@ -358,8 +358,8 @@ int st_thread_join(_st_thread_t *thread, void **retvalp) * When it gets scheduled later, it will do the clean up. */ thread->state = _ST_ST_RUNNABLE; - _ST_DEL_ZOMBIEQ(thread); - _ST_ADD_RUNQ(thread); + st_clist_remove(&thread->links); + st_clist_insert_before(&thread->links, &_st_this_vp.run_q); return 0; } @@ -367,7 +367,12 @@ int st_thread_join(_st_thread_t *thread, void **retvalp) void _st_thread_main(void) { - _st_thread_t *thread = _ST_CURRENT_THREAD(); + _st_thread_t *thread = _st_this_thread; + +#ifdef MD_ASAN + /* Switch from other thread to this new created thread. */ + _st_asan_finish_switch(thread); +#endif /* * Cap the stack by zeroing out the saved return address register @@ -392,7 +397,7 @@ void _st_thread_main(void) static _st_thread_t **heap_insert(_st_thread_t *thread) { int target = thread->heap_index; int s = target; - _st_thread_t **p = &_ST_SLEEPQ; + _st_thread_t **p = &_st_this_vp.sleep_q; int bits = 0; int bit; int index = 1; @@ -434,14 +439,14 @@ static void heap_delete(_st_thread_t *thread) { int s, bit; /* First find and unlink the last heap element */ - p = &_ST_SLEEPQ; - s = _ST_SLEEPQ_SIZE; + p = &_st_this_vp.sleep_q; + s = _st_this_vp.sleepq_size; while (s) { s >>= 1; bits++; } for (bit = bits - 2; bit >= 0; bit--) { - if (_ST_SLEEPQ_SIZE & (1 << bit)) { + if (_st_this_vp.sleepq_size & (1 << bit)) { p = &((*p)->right); } else { p = &((*p)->left); @@ -449,7 +454,7 @@ static void heap_delete(_st_thread_t *thread) { } t = *p; *p = NULL; - --_ST_SLEEPQ_SIZE; + --_st_this_vp.sleepq_size; if (t != thread) { /* * Insert the unlinked last element in place of the element we are deleting @@ -503,9 +508,9 @@ static void heap_delete(_st_thread_t *thread) { void _st_add_sleep_q(_st_thread_t *thread, st_utime_t timeout) { - thread->due = _ST_LAST_CLOCK + timeout; + thread->due = _st_this_vp.last_clock + timeout; thread->flags |= _ST_FL_ON_SLEEPQ; - thread->heap_index = ++_ST_SLEEPQ_SIZE; + thread->heap_index = ++_st_this_vp.sleepq_size; heap_insert(thread); } @@ -527,9 +532,9 @@ void _st_vp_check_clock(void) now = st_utime(); #if defined(DEBUG) && defined(DEBUG_STATS) - elapsed = now < _ST_LAST_CLOCK? 0 : now - _ST_LAST_CLOCK; // Might step back. + elapsed = now < _st_this_vp.last_clock? 0 : now - _st_this_vp.last_clock; // Might step back. #endif - _ST_LAST_CLOCK = now; + _st_this_vp.last_clock = now; #if defined(DEBUG) && defined(DEBUG_STATS) if (elapsed <= 10000) { @@ -558,12 +563,12 @@ void _st_vp_check_clock(void) _st_last_tset = now; } - while (_ST_SLEEPQ != NULL) { - thread = _ST_SLEEPQ; + while (_st_this_vp.sleep_q != NULL) { + thread = _st_this_vp.sleep_q; ST_ASSERT(thread->flags & _ST_FL_ON_SLEEPQ); if (thread->due > now) break; - _ST_DEL_SLEEPQ(thread); + _st_del_sleep_q(thread); /* If thread is waiting on condition variable, set the time out flag */ if (thread->state == _ST_ST_COND_WAIT) @@ -572,15 +577,15 @@ void _st_vp_check_clock(void) /* Make thread runnable */ ST_ASSERT(!(thread->flags & _ST_FL_IDLE_THREAD)); thread->state = _ST_ST_RUNNABLE; - // Insert at the head of RunQ, to execute timer first. - _ST_INSERT_RUNQ(thread); + /* Insert at the head of RunQ, to execute timer first. */ + st_clist_insert_after(&thread->links, &_st_this_vp.run_q); } } void st_thread_yield() { - _st_thread_t *me = _ST_CURRENT_THREAD(); + _st_thread_t *me = _st_this_thread; #if defined(DEBUG) && defined(DEBUG_STATS) ++_st_stat_thread_yield; @@ -589,8 +594,8 @@ void st_thread_yield() /* Check sleep queue for expired threads */ _st_vp_check_clock(); - // If not thread in RunQ to yield to, ignore and continue to run. - if (_ST_RUNQ.next == &_ST_RUNQ) { + /* If not thread in RunQ to yield to, ignore and continue to run. */ + if (_st_this_vp.run_q.next == &_st_this_vp.run_q) { return; } @@ -598,12 +603,12 @@ void st_thread_yield() ++_st_stat_thread_yield2; #endif - // Append thread to the tail of RunQ, we will back after all threads executed. + /* Append thread to the tail of RunQ, we will back after all threads executed. */ me->state = _ST_ST_RUNNABLE; - _ST_ADD_RUNQ(me); + st_clist_insert_before(&me->links, &_st_this_vp.run_q); - // Yield to other threads in the RunQ. - _ST_SWITCH_CONTEXT(me); + /* Yield to other threads in the RunQ. */ + _st_switch_context(me); } @@ -619,11 +624,11 @@ void st_thread_interrupt(_st_thread_t *thread) return; if (thread->flags & _ST_FL_ON_SLEEPQ) - _ST_DEL_SLEEPQ(thread); + _st_del_sleep_q(thread); /* Make thread runnable */ thread->state = _ST_ST_RUNNABLE; - _ST_ADD_RUNQ(thread); + st_clist_insert_before(&thread->links, &_st_this_vp.run_q); } @@ -637,7 +642,7 @@ _st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg, int joinabl /* Adjust stack size */ if (stk_size == 0) stk_size = ST_DEFAULT_STACK_SIZE; - stk_size = ((stk_size + _ST_PAGE_SIZE - 1) / _ST_PAGE_SIZE) * _ST_PAGE_SIZE; + stk_size = ((stk_size + _st_this_vp.pagesize - 1) / _st_this_vp.pagesize) * _st_this_vp.pagesize; stack = _st_stack_new(stk_size); if (!stack) return NULL; @@ -663,7 +668,11 @@ _st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg, int joinabl thread->start = start; thread->arg = arg; - _ST_INIT_CONTEXT(thread, stack->sp, _st_thread_main); + /* Note that we must directly call rather than call any functions. */ + if (_st_md_cxt_save(thread->context)) { + _st_thread_main(); + } + MD_GET_SP(thread) = (long)(stack->sp); /* If thread is joinable, allocate a termination condition variable */ if (joinable) { @@ -677,13 +686,13 @@ _st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg, int joinabl /* Make thread runnable */ thread->state = _ST_ST_RUNNABLE; _st_active_count++; - _ST_ADD_RUNQ(thread); + st_clist_insert_before(&thread->links, &_st_this_vp.run_q); #ifdef DEBUG - _ST_ADD_THREADQ(thread); + st_clist_insert_before(&thread->tlink, &_st_this_vp.thread_q); #endif /* merge from https://github.com/toffaletti/state-threads/commit/7f57fc9acc05e657bca1223f1e5b9b1a45ed929b */ -#ifndef NVALGRIND +#ifdef MD_VALGRIND if (!(thread->flags & _ST_FL_PRIMORDIAL)) { thread->stack->valgrind_stack_id = VALGRIND_STACK_REGISTER(thread->stack->stk_top, thread->stack->stk_bottom); } @@ -695,7 +704,7 @@ _st_thread_t *st_thread_create(void *(*start)(void *arg), void *arg, int joinabl _st_thread_t *st_thread_self(void) { - return _ST_CURRENT_THREAD(); + return _st_this_thread; } #ifdef DEBUG @@ -717,7 +726,7 @@ void _st_iterate_threads(void) if (!_st_iterate_threads_flag) { if (thread) { memcpy(thread->context, save_jb, sizeof(_st_jmp_buf_t)); - MD_LONGJMP(orig_jb, 1); + _st_md_cxt_restore(orig_jb, 1); } return; } @@ -726,25 +735,25 @@ void _st_iterate_threads(void) memcpy(thread->context, save_jb, sizeof(_st_jmp_buf_t)); _st_show_thread_stack(thread, NULL); } else { - if (MD_SETJMP(orig_jb)) { + if (_st_md_cxt_save(orig_jb)) { _st_iterate_threads_flag = 0; thread = NULL; _st_show_thread_stack(thread, "Iteration completed"); return; } - thread = _ST_CURRENT_THREAD(); + thread = _st_this_thread; _st_show_thread_stack(thread, "Iteration started"); } q = thread->tlink.next; - if (q == &_ST_THREADQ) + if (q == &_st_this_vp.thread_q) q = q->next; - ST_ASSERT(q != &_ST_THREADQ); + ST_ASSERT(q != &_st_this_vp.thread_q); thread = _ST_THREAD_THREADQ_PTR(q); - if (thread == _ST_CURRENT_THREAD()) - MD_LONGJMP(orig_jb, 1); + if (thread == _st_this_thread) + _st_md_cxt_restore(orig_jb, 1); memcpy(save_jb, thread->context, sizeof(_st_jmp_buf_t)); - MD_LONGJMP(thread->context, 1); + _st_md_cxt_restore(thread->context, 1); } #endif /* DEBUG */ diff --git a/trunk/3rdparty/st-srs/stk.c b/trunk/3rdparty/st-srs/stk.c index a81bee019b..0919756921 100644 --- a/trunk/3rdparty/st-srs/stk.c +++ b/trunk/3rdparty/st-srs/stk.c @@ -50,36 +50,62 @@ /* How much space to leave between the stacks, at each end */ -#define REDZONE _ST_PAGE_SIZE +#define REDZONE _st_this_vp.pagesize __thread _st_clist_t _st_free_stacks; __thread int _st_num_free_stacks = 0; __thread int _st_randomize_stacks = 0; static char *_st_new_stk_segment(int size); +static void _st_delete_stk_segment(char *vaddr, int size); _st_stack_t *_st_stack_new(int stack_size) { _st_clist_t *qp; _st_stack_t *ts; int extra; - + + /* If cache stack, we try to use stack from the cache list. */ +#ifdef MD_CACHE_STACK for (qp = _st_free_stacks.next; qp != &_st_free_stacks; qp = qp->next) { ts = _ST_THREAD_STACK_PTR(qp); if (ts->stk_size >= stack_size) { /* Found a stack that is big enough */ - ST_REMOVE_LINK(&ts->links); + st_clist_remove(&ts->links); _st_num_free_stacks--; ts->links.next = NULL; ts->links.prev = NULL; return ts; } } +#endif + + extra = _st_randomize_stacks ? _st_this_vp.pagesize : 0; + /* If not cache stack, we will free all stack in the list, which contains the stack to be freed. + * Note that we should never directly free it at _st_stack_free, because it is still be used, + * and will cause crash. */ +#ifndef MD_CACHE_STACK + for (qp = _st_free_stacks.next; qp != &_st_free_stacks;) { + ts = _ST_THREAD_STACK_PTR(qp); + /* Before qp is freed, move to next one, because the qp will be freed when free the ts. */ + qp = qp->next; + + st_clist_remove(&ts->links); + _st_num_free_stacks--; + +#if defined(DEBUG) && !defined(MD_NO_PROTECT) + mprotect(ts->vaddr, REDZONE, PROT_READ | PROT_WRITE); + mprotect(ts->stk_top + extra, REDZONE, PROT_READ | PROT_WRITE); +#endif + + _st_delete_stk_segment(ts->vaddr, ts->vaddr_size); + free(ts); + } +#endif /* Make a new thread stack object. */ if ((ts = (_st_stack_t *)calloc(1, sizeof(_st_stack_t))) == NULL) return NULL; - extra = _st_randomize_stacks ? _ST_PAGE_SIZE : 0; ts->vaddr_size = stack_size + 2*REDZONE + extra; ts->vaddr = _st_new_stk_segment(ts->vaddr_size); if (!ts->vaddr) { @@ -114,9 +140,9 @@ void _st_stack_free(_st_stack_t *ts) { if (!ts) return; - + /* Put the stack on the free list */ - ST_APPEND_LINK(&ts->links, _st_free_stacks.prev); + st_clist_insert_before(&ts->links, _st_free_stacks.prev); _st_num_free_stacks++; } @@ -152,8 +178,6 @@ static char *_st_new_stk_segment(int size) } -/* Not used */ -#if 0 void _st_delete_stk_segment(char *vaddr, int size) { #ifdef MALLOC_STACK @@ -162,7 +186,6 @@ void _st_delete_stk_segment(char *vaddr, int size) (void) munmap(vaddr, size); #endif } -#endif int st_randomize_stacks(int on) { diff --git a/trunk/3rdparty/st-srs/sync.c b/trunk/3rdparty/st-srs/sync.c index 74138bd0fe..eb9f60b9cb 100644 --- a/trunk/3rdparty/st-srs/sync.c +++ b/trunk/3rdparty/st-srs/sync.c @@ -87,7 +87,7 @@ int st_set_utime_function(st_utime_t (*func)(void)) st_utime_t st_utime_last_clock(void) { - return _ST_LAST_CLOCK; + return _st_this_vp.last_clock; } @@ -116,7 +116,7 @@ time_t st_time(void) int st_usleep(st_utime_t usecs) { - _st_thread_t *me = _ST_CURRENT_THREAD(); + _st_thread_t *me = _st_this_thread; if (me->flags & _ST_FL_INTERRUPT) { me->flags &= ~_ST_FL_INTERRUPT; @@ -126,11 +126,11 @@ int st_usleep(st_utime_t usecs) if (usecs != ST_UTIME_NO_TIMEOUT) { me->state = _ST_ST_SLEEPING; - _ST_ADD_SLEEPQ(me, usecs); + _st_add_sleep_q(me, usecs); } else me->state = _ST_ST_SUSPENDED; - _ST_SWITCH_CONTEXT(me); + _st_switch_context(me); if (me->flags & _ST_FL_INTERRUPT) { me->flags &= ~_ST_FL_INTERRUPT; @@ -158,7 +158,7 @@ _st_cond_t *st_cond_new(void) cvar = (_st_cond_t *) calloc(1, sizeof(_st_cond_t)); if (cvar) { - ST_INIT_CLIST(&cvar->wait_q); + st_clist_init(&cvar->wait_q); } return cvar; @@ -180,7 +180,7 @@ int st_cond_destroy(_st_cond_t *cvar) int st_cond_timedwait(_st_cond_t *cvar, st_utime_t timeout) { - _st_thread_t *me = _ST_CURRENT_THREAD(); + _st_thread_t *me = _st_this_thread; int rv; if (me->flags & _ST_FL_INTERRUPT) { @@ -191,14 +191,14 @@ int st_cond_timedwait(_st_cond_t *cvar, st_utime_t timeout) /* Put caller thread on the condition variable's wait queue */ me->state = _ST_ST_COND_WAIT; - ST_APPEND_LINK(&me->wait_links, &cvar->wait_q); + st_clist_insert_before(&me->wait_links, &cvar->wait_q); if (timeout != ST_UTIME_NO_TIMEOUT) - _ST_ADD_SLEEPQ(me, timeout); + _st_add_sleep_q(me, timeout); - _ST_SWITCH_CONTEXT(me); + _st_switch_context(me); - ST_REMOVE_LINK(&me->wait_links); + st_clist_remove(&me->wait_links); rv = 0; if (me->flags & _ST_FL_TIMEDOUT) { @@ -231,11 +231,11 @@ static int _st_cond_signal(_st_cond_t *cvar, int broadcast) thread = _ST_THREAD_WAITQ_PTR(q); if (thread->state == _ST_ST_COND_WAIT) { if (thread->flags & _ST_FL_ON_SLEEPQ) - _ST_DEL_SLEEPQ(thread); + _st_del_sleep_q(thread); /* Make thread runnable */ thread->state = _ST_ST_RUNNABLE; - _ST_ADD_RUNQ(thread); + st_clist_insert_before(&thread->links, &_st_this_vp.run_q); if (!broadcast) break; } @@ -267,7 +267,7 @@ _st_mutex_t *st_mutex_new(void) lock = (_st_mutex_t *) calloc(1, sizeof(_st_mutex_t)); if (lock) { - ST_INIT_CLIST(&lock->wait_q); + st_clist_init(&lock->wait_q); lock->owner = NULL; } @@ -290,7 +290,7 @@ int st_mutex_destroy(_st_mutex_t *lock) int st_mutex_lock(_st_mutex_t *lock) { - _st_thread_t *me = _ST_CURRENT_THREAD(); + _st_thread_t *me = _st_this_thread; if (me->flags & _ST_FL_INTERRUPT) { me->flags &= ~_ST_FL_INTERRUPT; @@ -311,11 +311,11 @@ int st_mutex_lock(_st_mutex_t *lock) /* Put caller thread on the mutex's wait queue */ me->state = _ST_ST_LOCK_WAIT; - ST_APPEND_LINK(&me->wait_links, &lock->wait_q); + st_clist_insert_before(&me->wait_links, &lock->wait_q); - _ST_SWITCH_CONTEXT(me); + _st_switch_context(me); - ST_REMOVE_LINK(&me->wait_links); + st_clist_remove(&me->wait_links); if ((me->flags & _ST_FL_INTERRUPT) && lock->owner != me) { me->flags &= ~_ST_FL_INTERRUPT; @@ -332,7 +332,7 @@ int st_mutex_unlock(_st_mutex_t *lock) _st_thread_t *thread; _st_clist_t *q; - if (lock->owner != _ST_CURRENT_THREAD()) { + if (lock->owner != _st_this_thread) { errno = EPERM; return -1; } @@ -343,7 +343,7 @@ int st_mutex_unlock(_st_mutex_t *lock) lock->owner = thread; /* Make thread runnable */ thread->state = _ST_ST_RUNNABLE; - _ST_ADD_RUNQ(thread); + st_clist_insert_before(&thread->links, &_st_this_vp.run_q); return 0; } } @@ -363,7 +363,7 @@ int st_mutex_trylock(_st_mutex_t *lock) } /* Got the mutex */ - lock->owner = _ST_CURRENT_THREAD(); + lock->owner = _st_this_thread; return 0; } diff --git a/trunk/3rdparty/st-srs/tools/backtrace/backtrace.c b/trunk/3rdparty/st-srs/tools/backtrace/backtrace.c index 61480b7cc0..0af24cfaf6 100644 --- a/trunk/3rdparty/st-srs/tools/backtrace/backtrace.c +++ b/trunk/3rdparty/st-srs/tools/backtrace/backtrace.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2013-2023 Winlin */ +/* Copyright (c) 2013-2024 The SRS Authors */ #ifdef __linux__ #define _GNU_SOURCE diff --git a/trunk/3rdparty/st-srs/tools/helloworld/helloworld.c b/trunk/3rdparty/st-srs/tools/helloworld/helloworld.c index 316a438c03..5c30d690b8 100644 --- a/trunk/3rdparty/st-srs/tools/helloworld/helloworld.c +++ b/trunk/3rdparty/st-srs/tools/helloworld/helloworld.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2013-2023 Winlin */ +/* Copyright (c) 2013-2024 The SRS Authors */ #include diff --git a/trunk/3rdparty/st-srs/tools/porting/porting.c b/trunk/3rdparty/st-srs/tools/porting/porting.c index 3e1479fb8c..7267ac7a72 100644 --- a/trunk/3rdparty/st-srs/tools/porting/porting.c +++ b/trunk/3rdparty/st-srs/tools/porting/porting.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2013-2023 Winlin */ +/* Copyright (c) 2013-2024 The SRS Authors */ #include #include diff --git a/trunk/3rdparty/st-srs/tools/verify/verify.c b/trunk/3rdparty/st-srs/tools/verify/verify.c index 4a1ae1c386..ea96e233b7 100644 --- a/trunk/3rdparty/st-srs/tools/verify/verify.c +++ b/trunk/3rdparty/st-srs/tools/verify/verify.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2013-2023 Winlin */ +/* Copyright (c) 2013-2024 The SRS Authors */ #include diff --git a/trunk/3rdparty/st-srs/utest/st_utest.cpp b/trunk/3rdparty/st-srs/utest/st_utest.cpp index 325d3cf52f..4571bfbb3a 100644 --- a/trunk/3rdparty/st-srs/utest/st_utest.cpp +++ b/trunk/3rdparty/st-srs/utest/st_utest.cpp @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2013-2023 Winlin */ +/* Copyright (c) 2013-2024 The SRS Authors */ #include diff --git a/trunk/3rdparty/st-srs/utest/st_utest.hpp b/trunk/3rdparty/st-srs/utest/st_utest.hpp index ff1c5f6ceb..26d993398e 100644 --- a/trunk/3rdparty/st-srs/utest/st_utest.hpp +++ b/trunk/3rdparty/st-srs/utest/st_utest.hpp @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2013-2023 Winlin */ +/* Copyright (c) 2013-2024 The SRS Authors */ #ifndef ST_UTEST_PUBLIC_HPP #define ST_UTEST_PUBLIC_HPP @@ -44,7 +44,7 @@ struct ErrorObject { }; extern std::ostream& operator<<(std::ostream& out, const ErrorObject* err); #define ST_ASSERT_ERROR(error, r0, message) if (error) return new ErrorObject(r0, message) -#define ST_COROUTINE_JOIN(trd, r0) ErrorObject* r0 = NULL; SrsAutoFree(ErrorObject, r0); if (trd) st_thread_join(trd, (void**)&r0) +#define ST_COROUTINE_JOIN(trd, r0) ErrorObject* r0 = NULL; if (trd) st_thread_join(trd, (void**)&r0); SrsUniquePtr r0_uptr(r0) #define ST_EXPECT_SUCCESS(r0) EXPECT_TRUE(!r0) << r0 #define ST_EXPECT_FAILED(r0) EXPECT_TRUE(r0) << r0 diff --git a/trunk/3rdparty/st-srs/utest/st_utest_coroutines.cpp b/trunk/3rdparty/st-srs/utest/st_utest_coroutines.cpp index 5628cd76f8..fe57aa7261 100644 --- a/trunk/3rdparty/st-srs/utest/st_utest_coroutines.cpp +++ b/trunk/3rdparty/st-srs/utest/st_utest_coroutines.cpp @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2013-2023 Winlin */ +/* Copyright (c) 2013-2024 The SRS Authors */ #include diff --git a/trunk/3rdparty/st-srs/utest/st_utest_tcp.cpp b/trunk/3rdparty/st-srs/utest/st_utest_tcp.cpp index 82c9f83856..ecbd839e0d 100644 --- a/trunk/3rdparty/st-srs/utest/st_utest_tcp.cpp +++ b/trunk/3rdparty/st-srs/utest/st_utest_tcp.cpp @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2013-2023 Winlin */ +/* Copyright (c) 2013-2024 The SRS Authors */ #include diff --git a/trunk/Dockerfile.test b/trunk/Dockerfile.test index 8b0bde656a..aae3f09180 100644 --- a/trunk/Dockerfile.test +++ b/trunk/Dockerfile.test @@ -16,7 +16,9 @@ COPY . /srs WORKDIR /srs/trunk # Note that we must enable the gcc7 or link failed. -RUN ./configure --srt=on --gb28181=on --srt=on --gb28181=on --apm=on --h265=on --utest=on +# Please note that we must disable the ffmpeg-opus, as it negatively impacts performance. We may consider +# enabling it in the future when support for multi-threading transcoding is available. +RUN ./configure --srt=on --gb28181=on --srt=on --apm=on --h265=on --utest=on --ffmpeg-opus=off --build-cache=on RUN make utest ${MAKEARGS} # Build benchmark tool. diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index 1998a93745..34428955e0 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -171,6 +171,11 @@ if [ $SRS_SANITIZER_LOG == YES ]; then else srs_undefine_macro "SRS_SANITIZER_LOG" $SRS_AUTO_HEADERS_H fi +if [ $SRS_VALGRIND == YES ]; then + srs_define_macro "SRS_VALGRIND" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_VALGRIND" $SRS_AUTO_HEADERS_H +fi ##################################################################################### # for embeded. @@ -196,6 +201,11 @@ if [[ $SRS_SINGLE_THREAD == YES ]]; then else srs_undefine_macro "SRS_SINGLE_THREAD" $SRS_AUTO_HEADERS_H fi +if [[ $SRS_SIGNAL_API == YES ]]; then + srs_define_macro "SRS_SIGNAL_API" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_SIGNAL_API" $SRS_AUTO_HEADERS_H +fi if [[ $SRS_LOG_LEVEL_V2 == YES ]]; then srs_define_macro "SRS_LOG_LEVEL_V2" $SRS_AUTO_HEADERS_H else diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 8c33d58395..349feec2fb 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -189,7 +189,7 @@ fi ##################################################################################### # Use srs-cache from base image. See https://github.com/ossrs/dev-docker/blob/ubuntu20-cache/Dockerfile # Note that the cache for cygwin is not under /usr/local, but copy to objs instead. -if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/srs/trunk" ]]; then +if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/srs/trunk" && $SRS_BUILD_CACHE == YES ]]; then SOURCE_DIR=$(ls -d /usr/local/srs-cache/srs/trunk/objs/Platform-SRS${SRS_MAJOR}-* 2>/dev/null|head -n 1) if [[ -d $SOURCE_DIR ]]; then TARGET_DIR=${SRS_OBJS}/${SRS_PLATFORM} && @@ -205,7 +205,7 @@ fi ##################################################################################### # Check for address sanitizer, see https://github.com/google/sanitizers ##################################################################################### -if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then +if [[ $SRS_SANITIZER == YES ]]; then echo 'int main() { return 0; }' > ${SRS_OBJS}/test_sanitizer.c && gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 ${SRS_OBJS}/test_sanitizer.c \ -o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1; @@ -217,7 +217,7 @@ if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then fi fi -if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES && $SRS_SANITIZER_STATIC == NO ]]; then +if [[ $SRS_SANITIZER == YES && $SRS_SANITIZER_STATIC == NO ]]; then echo 'int main() { return 0; }' > ${SRS_OBJS}/test_sanitizer.c && gcc -fsanitize=address -fno-omit-frame-pointer -static-libasan -g -O0 ${SRS_OBJS}/test_sanitizer.c \ -o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1; @@ -228,7 +228,7 @@ if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES && $SRS_SANITIZER_STATIC == fi fi -if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES && $SRS_SANITIZER_LOG == NO ]]; then +if [[ $SRS_SANITIZER == YES && $SRS_SANITIZER_LOG == NO ]]; then echo "#include " > ${SRS_OBJS}/test_sanitizer.c && echo "int main() { return 0; }" >> ${SRS_OBJS}/test_sanitizer.c && gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 ${SRS_OBJS}/test_sanitizer.c \ @@ -240,6 +240,18 @@ if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES && $SRS_SANITIZER_LOG == NO fi fi +if [[ $SRS_SANITIZER == YES ]]; then + echo "#include " > ${SRS_OBJS}/test_sanitizer.c && + echo "int main() { __sanitizer_start_switch_fiber(NULL, NULL, 0); }" >> ${SRS_OBJS}/test_sanitizer.c && + gcc -fsanitize=address -fno-omit-frame-pointer -g -O0 ${SRS_OBJS}/test_sanitizer.c \ + -o ${SRS_OBJS}/test_sanitizer 1>/dev/null 2>&1; + ret=$?; rm -rf ${SRS_OBJS}/test_sanitizer* + if [[ $ret -eq 0 ]]; then + echo "libasan fiber switch api found ok!"; + SRS_SANITIZER_FIBER_SWITCH=YES + fi +fi + ##################################################################################### # state-threads ##################################################################################### @@ -254,6 +266,9 @@ fi # for osx, use darwin for st, donot use epoll. if [[ $SRS_OSX == YES ]]; then _ST_MAKE=darwin-debug && _ST_OBJ="DARWIN_`uname -r`_DBG" + if [[ $SRS_OSX_HAS_CLOCK_GETTIME != YES ]]; then + _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_OSX_NO_CLOCK_GETTIME" + fi fi # for windows/cygwin if [[ $SRS_CYGWIN64 = YES ]]; then @@ -267,6 +282,13 @@ fi if [[ $SRS_DEBUG_STATS == YES ]]; then _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DDEBUG_STATS" fi +# Whether to enable asan. +if [[ $SRS_SANITIZER_FIBER_SWITCH == YES ]]; then + _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_ASAN" +fi +if [[ $SRS_SANITIZER == YES ]]; then + _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -fsanitize=address -fno-omit-frame-pointer" +fi # Pass the global extra flags. if [[ $SRS_EXTRA_FLAGS != '' ]]; then _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS" @@ -514,7 +536,7 @@ fi # libopus, for WebRTC to transcode AAC with Opus. ##################################################################################### # For cross build, we use opus of FFmpeg, so we don't build the libopus. -if [[ $SRS_RTC == YES && $SRS_FFMPEG_OPUS != YES ]]; then +if [[ $SRS_RTC == YES && $SRS_USE_SYS_FFMPEG != YES && $SRS_FFMPEG_OPUS != YES ]]; then # Only build static libraries if no shared FFmpeg. if [[ $SRS_SHARED_FFMPEG != YES ]]; then OPUS_OPTIONS="--disable-shared --disable-doc" diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 9d924d309c..e5dcfeda92 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -6,7 +6,7 @@ help=no SRS_HDS=NO SRS_SRT=YES SRS_RTC=YES -SRS_H265=NO +SRS_H265=YES SRS_GB28181=NO SRS_CXX11=YES SRS_CXX14=NO @@ -37,7 +37,8 @@ SRS_FFMPEG_TOOL=NO # FFmpeg fit is the source code for RTC, to transcode audio or video in SRS. SRS_FFMPEG_FIT=RESERVED # Whether use FFmpeg native opus codec for RTC. If not, use libopus instead. -SRS_FFMPEG_OPUS=YES +# Should disable it by default, because the cost of it is very high, see https://github.com/ossrs/srs/pull/3868 +SRS_FFMPEG_OPUS=NO # arguments SRS_PREFIX=/usr/local/srs SRS_DEFAULT_CONFIG=conf/srs.conf @@ -83,7 +84,8 @@ SRS_BUILD_TAG= # Set the object files tag name. SRS_CLEAN=YES # Whether do "make clean" when configure. SRS_SIMULATOR=NO # Whether enable RTC simulate API. SRS_GENERATE_OBJS=NO # Whether generate objs and quit. -SRS_SINGLE_THREAD=NO # Whether force single thread mode. +SRS_SINGLE_THREAD=YES # Whether force single thread mode. +SRS_SIGNAL_API=NO # Use http API to simulate sending signal to SRS, for debugging. # ################################################################ # Performance options. @@ -108,6 +110,10 @@ SRS_CROSS_BUILD_ARCH= SRS_CROSS_BUILD_HOST= # For cross build, the cross prefix, for example(FFmpeg), --cross-prefix=aarch64-linux-gnu- SRS_CROSS_BUILD_PREFIX= +# For cache build +SRS_BUILD_CACHE=YES +# Only support MacOS 10.12+ for clock_gettime, see https://github.com/ossrs/srs/issues/3978 +SRS_OSX_HAS_CLOCK_GETTIME=YES # ##################################################################################### # Toolchain for cross-build on Ubuntu for ARM or MIPS. @@ -117,6 +123,7 @@ SRS_TOOL_AR=ar SRS_TOOL_LD=ld SRS_TOOL_RANDLIB=randlib SRS_EXTRA_FLAGS= +SRS_EXTRA_LDFLAGS= # ##################################################################################### # Performance optimize. @@ -145,7 +152,9 @@ function apply_system_options() { OS_IS_RISCV=$(gcc -dM -E - /dev/null || echo 1); fi @@ -207,6 +216,7 @@ Toolchain options: --ld= Toolchain: Use linker tool LD. Default: $SRS_TOOL_CXX --randlib= Toolchain: Use randlib tool RANDLIB. Default: $SRS_TOOL_CXX --extra-flags= Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS. + --extra-ldflags= Set ELDFLAGS as LDFLAGS. Cross Build options: @see https://ossrs.net/lts/zh-cn/docs/v4/doc/arm#ubuntu-cross-build-srs --cross=on|off Enable cross-build, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD) @@ -230,6 +240,7 @@ Experts: --simulator=on|off RTC: Whether enable network simulator. Default: $(value2switch $SRS_SIMULATOR) --generate-objs=on|off RTC: Whether generate objs and quit. Default: $(value2switch $SRS_GENERATE_OBJS) --single-thread=on|off Whether force single thread mode. Default: $(value2switch $SRS_SINGLE_THREAD) + --signal-api=on|off Whether support sending signal by HTTP API. Default: $(value2switch $SRS_SIGNAL_API) --build-tag= Set the build object directory suffix. --debug=on|off Whether enable the debug code, may hurt performance. Default: $(value2switch $SRS_DEBUG) --debug-stats=on|off Whether enable the debug stats, may hurt performance. Default: $(value2switch $SRS_DEBUG_STATS) @@ -311,92 +322,44 @@ function parse_user_option() { --ld) SRS_TOOL_LD=${value} ;; --randlib) SRS_TOOL_RANDLIB=${value} ;; --extra-flags) SRS_EXTRA_FLAGS=${value} ;; + --extra-ldflags) SRS_EXTRA_LDFLAGS=${value} ;; --build-tag) SRS_BUILD_TAG=${value} ;; - --without-srtp-nasm) SRS_SRTP_ASM=NO ;; - --with-srtp-nasm) SRS_SRTP_ASM=YES ;; --srtp-nasm) SRS_SRTP_ASM=$(switch2value $value) ;; - - --without-nasm) SRS_NASM=NO ;; - --with-nasm) SRS_NASM=YES ;; --nasm) SRS_NASM=$(switch2value $value) ;; - - --with-ssl) SRS_SSL=YES ;; --ssl) SRS_SSL=$(switch2value $value) ;; --https) SRS_HTTPS=$(switch2value $value) ;; --ssl-1-0) SRS_SSL_1_0=$(switch2value $value) ;; --ssl-local) SRS_SSL_LOCAL=$(switch2value $value) ;; - - --with-hds) SRS_HDS=YES ;; - --without-hds) SRS_HDS=NO ;; --hds) SRS_HDS=$(switch2value $value) ;; - - --with-transcode) SRS_TRANSCODE=YES ;; --transcode) SRS_TRANSCODE=$(switch2value $value) ;; - - --with-ingest) SRS_INGEST=YES ;; --ingest) SRS_INGEST=$(switch2value $value) ;; - - --with-stat) SRS_STAT=YES ;; --stat) SRS_STAT=$(switch2value $value) ;; - - --with-stream-caster) SRS_STREAM_CASTER=YES ;; --stream-caster) SRS_STREAM_CASTER=$(switch2value $value) ;; --stream-converter) SRS_STREAM_CASTER=$(switch2value $value) ;; - - --with-utest) SRS_UTEST=YES ;; - --without-utest) SRS_UTEST=NO ;; --utest) SRS_UTEST=$(switch2value $value) ;; --gcov) SRS_GCOV=$(switch2value $value) ;; --apm) SRS_APM=$(switch2value $value) ;; - - --with-srt) SRS_SRT=YES ;; - --without-srt) SRS_SRT=NO ;; --srt) SRS_SRT=$(switch2value $value) ;; - - --with-rtc) SRS_RTC=YES ;; - --without-rtc) SRS_RTC=NO ;; --rtc) SRS_RTC=$(switch2value $value) ;; --simulator) SRS_SIMULATOR=$(switch2value $value) ;; --generate-objs) SRS_GENERATE_OBJS=$(switch2value $value) ;; --single-thread) SRS_SINGLE_THREAD=$(switch2value $value) ;; + --signal-api) SRS_SIGNAL_API=$(switch2value $value) ;; --ffmpeg-fit) SRS_FFMPEG_FIT=$(switch2value $value) ;; --ffmpeg-opus) SRS_FFMPEG_OPUS=$(switch2value $value) ;; --h265) SRS_H265=$(switch2value $value) ;; --gb28181) SRS_GB28181=$(switch2value $value) ;; - --cxx11) SRS_CXX11=$(switch2value $value) ;; --cxx14) SRS_CXX14=$(switch2value $value) ;; --backtrace) SRS_BACKTRACE=$(switch2value $value) ;; - - --with-clean) SRS_CLEAN=YES ;; - --without-clean) SRS_CLEAN=NO ;; --clean) SRS_CLEAN=$(switch2value $value) ;; - - --with-gperf) SRS_GPERF=YES ;; - --without-gperf) SRS_GPERF=NO ;; --gperf) SRS_GPERF=$(switch2value $value) ;; - - --with-gmc) SRS_GPERF_MC=YES ;; - --without-gmc) SRS_GPERF_MC=NO ;; --gmc) SRS_GPERF_MC=$(switch2value $value) ;; - - --with-gmd) SRS_GPERF_MD=YES ;; - --without-gmd) SRS_GPERF_MD=NO ;; --gmd) SRS_GPERF_MD=$(switch2value $value) ;; - - --with-gmp) SRS_GPERF_MP=YES ;; - --without-gmp) SRS_GPERF_MP=NO ;; --gmp) SRS_GPERF_MP=$(switch2value $value) ;; - - --with-gcp) SRS_GPERF_CP=YES ;; - --without-gcp) SRS_GPERF_CP=NO ;; --gcp) SRS_GPERF_CP=$(switch2value $value) ;; - - --with-gprof) SRS_GPROF=YES ;; - --without-gprof) SRS_GPROF=NO ;; --gprof) SRS_GPROF=$(switch2value $value) ;; - --sanitizer) SRS_SANITIZER=$(switch2value $value) ;; --sanitizer-static) SRS_SANITIZER_STATIC=$(switch2value $value) ;; --sanitizer-log) SRS_SANITIZER_LOG=$(switch2value $value) ;; @@ -416,9 +379,6 @@ function parse_user_option() { --shared-srtp) SRS_SHARED_SRTP=$(switch2value $value) ;; --use-sys-srtp) SRS_USE_SYS_SRTP=YES ;; --sys-srtp) SRS_USE_SYS_SRTP=$(switch2value $value) ;; - - --with-valgrind) SRS_VALGRIND=YES ;; - --without-valgrind) SRS_VALGRIND=NO ;; --valgrind) SRS_VALGRIND=$(switch2value $value) ;; --log-verbose) SRS_LOG_VERBOSE=$(switch2value $value) ;; @@ -428,25 +388,59 @@ function parse_user_option() { --debug) SRS_DEBUG=$(switch2value $value) ;; --debug-stats) SRS_DEBUG_STATS=$(switch2value $value) ;; - --generic-linux) SRS_GENERIC_LINUX=$(switch2value $value) ;; - - # Alias for --arm, cross build. - --cross) SRS_CROSS_BUILD=$(switch2value $value) ;; --cross-build) SRS_CROSS_BUILD=YES ;; - --enable-cross-compile) SRS_CROSS_BUILD=YES ;; - - # Deprecated, might be removed in future. - --osx) SRS_OSX=YES ;; - --cygwin64) SRS_CYGWIN64=YES ;; - --x86-x64) SRS_X86_X64=YES ;; - --x86-64) SRS_X86_X64=YES ;; - --with-nginx) SRS_NGINX=YES ;; - --without-nginx) SRS_NGINX=NO ;; - --nginx) SRS_NGINX=$(switch2value $value) ;; - --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; - --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; - --ffmpeg) SRS_FFMPEG_TOOL=$(switch2value $value) ;; - --ffmpeg-tool) SRS_FFMPEG_TOOL=$(switch2value $value) ;; + --generic-linux) SRS_GENERIC_LINUX=$(switch2value $value) ;; + --build-cache) SRS_BUILD_CACHE=$(switch2value $value) ;; + + ########################################################################################## + --without-srtp-nasm) SRS_SRTP_ASM=NO ;; # Deprecated, might be removed in future. + --with-srtp-nasm) SRS_SRTP_ASM=YES ;; # Deprecated, might be removed in future. + --without-nasm) SRS_NASM=NO ;; # Deprecated, might be removed in future. + --with-nasm) SRS_NASM=YES ;; # Deprecated, might be removed in future. + --with-ssl) SRS_SSL=YES ;; # Deprecated, might be removed in future. + --with-hds) SRS_HDS=YES ;; # Deprecated, might be removed in future. + --without-hds) SRS_HDS=NO ;; # Deprecated, might be removed in future. + --with-transcode) SRS_TRANSCODE=YES ;; # Deprecated, might be removed in future. + --with-ingest) SRS_INGEST=YES ;; # Deprecated, might be removed in future. + --with-stat) SRS_STAT=YES ;; # Deprecated, might be removed in future. + --with-stream-caster) SRS_STREAM_CASTER=YES ;; # Deprecated, might be removed in future. + --with-utest) SRS_UTEST=YES ;; # Deprecated, might be removed in future. + --without-utest) SRS_UTEST=NO ;; # Deprecated, might be removed in future. + --with-srt) SRS_SRT=YES ;; # Deprecated, might be removed in future. + --without-srt) SRS_SRT=NO ;; # Deprecated, might be removed in future. + --with-rtc) SRS_RTC=YES ;; # Deprecated, might be removed in future. + --without-rtc) SRS_RTC=NO ;; # Deprecated, might be removed in future. + --with-clean) SRS_CLEAN=YES ;; # Deprecated, might be removed in future. + --without-clean) SRS_CLEAN=NO ;; # Deprecated, might be removed in future. + --with-gperf) SRS_GPERF=YES ;; # Deprecated, might be removed in future. + --without-gperf) SRS_GPERF=NO ;; # Deprecated, might be removed in future. + --with-gmc) SRS_GPERF_MC=YES ;; # Deprecated, might be removed in future. + --without-gmc) SRS_GPERF_MC=NO ;; # Deprecated, might be removed in future. + --with-gmd) SRS_GPERF_MD=YES ;; # Deprecated, might be removed in future. + --without-gmd) SRS_GPERF_MD=NO ;; # Deprecated, might be removed in future. + --with-gmp) SRS_GPERF_MP=YES ;; # Deprecated, might be removed in future. + --without-gmp) SRS_GPERF_MP=NO ;; # Deprecated, might be removed in future. + --with-gcp) SRS_GPERF_CP=YES ;; # Deprecated, might be removed in future. + --without-gcp) SRS_GPERF_CP=NO ;; # Deprecated, might be removed in future. + --with-gprof) SRS_GPROF=YES ;; # Deprecated, might be removed in future. + --without-gprof) SRS_GPROF=NO ;; # Deprecated, might be removed in future. + --with-valgrind) SRS_VALGRIND=YES ;; # Deprecated, might be removed in future. + --without-valgrind) SRS_VALGRIND=NO ;; # Deprecated, might be removed in future. + --cross) SRS_CROSS_BUILD=$(switch2value $value) ;; # Deprecated, might be removed in future. + --enable-cross-compile) SRS_CROSS_BUILD=YES ;; # Deprecated, might be removed in future. + + ########################################################################################## + --osx) SRS_OSX=YES ;; # Deprecated, might be removed in future. + --cygwin64) SRS_CYGWIN64=YES ;; # Deprecated, might be removed in future. + --x86-x64) SRS_X86_X64=YES ;; # Deprecated, might be removed in future. + --x86-64) SRS_X86_X64=YES ;; # Deprecated, might be removed in future. + --with-nginx) SRS_NGINX=YES ;; # Deprecated, might be removed in future. + --without-nginx) SRS_NGINX=NO ;; # Deprecated, might be removed in future. + --nginx) SRS_NGINX=$(switch2value $value) ;; # Deprecated, might be removed in future. + --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; # Deprecated, might be removed in future. + --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; # Deprecated, might be removed in future. + --ffmpeg) SRS_FFMPEG_TOOL=$(switch2value $value) ;; # Deprecated, might be removed in future. + --ffmpeg-tool) SRS_FFMPEG_TOOL=$(switch2value $value) ;; # Deprecated, might be removed in future. *) echo "$0: error: invalid option \"$option\"" @@ -459,7 +453,7 @@ function parse_user_option_to_value_and_option() { case "$option" in -*=*) value=`echo "$option" | sed -e 's|[-_a-zA-Z0-9/]*=||'` - option=`echo "$option" | sed -e 's|=[-_a-zA-Z0-9/. +]*||'` + option=`echo "$option" | sed -e 's|=[-_a-zA-Z0-9/. +,=]*||'` ;; *) value="" ;; esac @@ -694,12 +688,15 @@ function regenerate_options() { SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer-log=$(value2switch $SRS_SANITIZER_LOG)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cygwin64=$(value2switch $SRS_CYGWIN64)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --single-thread=$(value2switch $SRS_SINGLE_THREAD)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --signal-api=$(value2switch $SRS_SIGNAL_API)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --generic-linux=$(value2switch $SRS_GENERIC_LINUX)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --build-cache=$(value2switch $SRS_BUILD_CACHE)" if [[ $SRS_CROSS_BUILD_ARCH != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --arch=$SRS_CROSS_BUILD_ARCH"; fi if [[ $SRS_CROSS_BUILD_CPU != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --cpu=$SRS_CROSS_BUILD_CPU"; fi if [[ $SRS_CROSS_BUILD_HOST != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --host=$SRS_CROSS_BUILD_HOST"; fi if [[ $SRS_CROSS_BUILD_PREFIX != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --cross-prefix=$SRS_CROSS_BUILD_PREFIX"; fi if [[ $SRS_EXTRA_FLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-flags=\\\"$SRS_EXTRA_FLAGS\\\""; fi + if [[ $SRS_EXTRA_LDFLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-ldflags=\\\"$SRS_EXTRA_LDFLAGS\\\""; fi if [[ $SRS_BUILD_TAG != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --build-tag=\\\"$SRS_BUILD_TAG\\\""; fi if [[ $SRS_TOOL_CC != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cc=$SRS_TOOL_CC"; fi if [[ $SRS_TOOL_CXX != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx=$SRS_TOOL_CXX"; fi diff --git a/trunk/conf/edge.token.traverse.conf b/trunk/conf/edge.token.traverse.conf index 9d6ba4ce8e..9b75a3dccb 100644 --- a/trunk/conf/edge.token.traverse.conf +++ b/trunk/conf/edge.token.traverse.conf @@ -2,7 +2,7 @@ # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/drm # @see full.conf for detail config. -listen 1935 +listen 1935; max_connections 1000; daemon off; srs_log_tank console; diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 8b68d40ad7..a84309c226 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -217,6 +217,7 @@ http_api { password admin; } # For https_api or HTTPS API. + # Note: The SRS HTTPS server is for demo only, please use Nginx/Caddy to proxy to SRS in production environment. https { # Whether enable HTTPS API. # Overwrite by env SRS_HTTP_API_HTTPS_ENABLED @@ -272,6 +273,7 @@ http_server { # default: on crossdomain on; # For https_server or HTTPS Streaming. + # Note: The SRS HTTPS server is for demo only, please use Nginx/Caddy to proxy to SRS in production environment. https { # Whether enable HTTPS Streaming. # Overwrite by env SRS_HTTP_SERVER_HTTPS_ENABLED @@ -434,6 +436,10 @@ rtc_server { # * Retrieve server IP automatically, from all network interfaces. # $CANDIDATE Read the IP from ENV variable, use * if not set. # x.x.x.x A specified IP address or DNS name, use * if 0.0.0.0. + # You can also set the candidate by the query string eip, note that you can also set the UDP port, + # for example: + # http://locahost:1985/rtc/v1/whip/?app=live&stream=livestream&eip=192.168.3.11 + # http://locahost:1985/rtc/v1/whip/?app=live&stream=livestream&eip=192.168.3.11:18000 # @remark For Firefox, the candidate MUST be IP, MUST NOT be DNS name, see https://bugzilla.mozilla.org/show_bug.cgi?id=1239006 # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate # Overwrite by env SRS_RTC_SERVER_CANDIDATE @@ -556,6 +562,13 @@ vhost rtc.vhost.srs.com { # Overwrite by env SRS_VHOST_RTC_KEEP_BFRAME for all vhosts. # default: off keep_bframe off; + # Whether to keep the h.264 SEI type NALU packet. + # DJI drone M30T will send many SEI type NALU packet, while iOS hardware decoder (Video Toolbox) + # dislike to feed it so many SEI NALU between NonIDR and IDR NALU packets. + # @see https://github.com/ossrs/srs/issues/4052 + # Overwrite by env SRS_VHOST_RTC_KEEP_AVC_NALU_SEI for all vhosts. + # Default: on + keep_avc_nalu_sei on; # The transcode audio bitrate, for RTMP to RTC. # Overwrite by env SRS_VHOST_RTC_OPUS_BITRATE for all vhosts. # [8000, 320000] @@ -663,9 +676,11 @@ stream_caster { listen 9000; # SIP server for GB28181. Please note that this is only a demonstrated SIP server, please never use it in your # online production environment. Instead please use [jsip](https://github.com/usnistgov/jsip) and there is a demo - # [srs-sip](https://github.com/ossrs/srs-sip) also base on it. + # [srs-sip](https://github.com/ossrs/srs-sip) also base on it, for more information please see project + # [GB: External SIP](https://ossrs.net/lts/zh-cn/docs/v6/doc/gb28181#external-sip). sip { - # Whether enable embedded SIP server. + # Whether enable embedded SIP server. Please disable it if you want to use your own SIP server, see + # [GB: External SIP](https://ossrs.net/lts/zh-cn/docs/v6/doc/gb28181#external-sip). # Default: on enabled on; # The SIP listen port, for TCP protocol. @@ -701,8 +716,8 @@ tcmalloc_release_rate 0.8; # @see https://github.com/ossrs/srs/issues/2424 # @see https://github.com/ossrs/srs/issues/2508 # Overwrite by env SRS_QUERY_LATEST_VERSION -# Default: on -query_latest_version on; +# Default: off +query_latest_version off; # First wait when qlv(query latest version), in seconds. # Only available when qlv is enabled. @@ -892,6 +907,14 @@ heartbeat { # Overwrite by env SRS_HEARTBEAT_SUMMARIES # default: off summaries off; + # Whether report with listen ports. + # if on, request with the ports of SRS: + # { + # "rtmp": ["1935"], "http": ["8080"], "api": ["1985"], "srt": ["10080"], "rtc": ["8000"] + # } + # Overwrite by env SRS_HEARTBEAT_PORTS + # default: off + ports off; } # system statistics section. @@ -1745,6 +1768,21 @@ vhost dash.srs.com { # Overwrite by env SRS_VHOST_DASH_DASH_MPD_FILE for all vhosts. # Default: [app]/[stream].mpd dash_mpd_file [app]/[stream].mpd; + # The dash windows size in seconds. + # Overwrite by env SRS_VHOST_DASH_DASH_WINDOW_SIZE for all vhosts. + # Default: 5 + dash_window_size 5; + # whether cleanup the old expired dash files. + # Overwrite by env SRS_VHOST_DASH_DASH_CLEANUP for all vhosts. + # default: on + dash_cleanup on; + # If there is no incoming packets, dispose DASH in this timeout in seconds, + # which removes all DASH files including m3u8 and ts files. + # @remark 0 to disable dispose for publisher. + # @remark apply for publisher timeout only, while "etc/init.d/srs stop" always dispose DASH. + # Overwrite by env SRS_VHOST_DASH_DASH_DISPOSE for all vhosts. + # default: 120 + dash_dispose 120; } } @@ -1772,8 +1810,8 @@ vhost hls.srs.com { # for example, the hls_fragment is 10s, hls_aof_ratio is 1.2, # the segment will reap to 12s for pure audio. # Overwrite by env SRS_VHOST_HLS_HLS_AOF_RATIO for all vhosts. - # default: 1.2 - hls_aof_ratio 1.2; + # default: 2.1 + hls_aof_ratio 2.1; # the hls window in seconds, the number of ts in m3u8. # Overwrite by env SRS_VHOST_HLS_HLS_WINDOW for all vhosts. # default: 60 @@ -2659,7 +2697,7 @@ vhost stream.transcode.srs.com { # # @see https://github.com/ossrs/srs/issues/1399 ############################################################################################# -include include.vhost.conf; +include ./conf/include.vhost.conf; ############################################################################################# # The origin cluster section diff --git a/trunk/conf/gb28181-without-sip.conf b/trunk/conf/gb28181-without-sip.conf new file mode 100644 index 0000000000..1b19326b43 --- /dev/null +++ b/trunk/conf/gb28181-without-sip.conf @@ -0,0 +1,53 @@ + +listen 1935; +max_connections 1000; +daemon off; +srs_log_tank console; + +stream_caster { + enabled on; + caster gb28181; + output rtmp://127.0.0.1/live/[stream]; + listen 9000; + sip { + enabled off; + } +} + +http_server { + enabled on; + listen 8080; + dir ./objs/nginx/html; +} + +http_api { + enabled on; + listen 1985; +} +stats { + network 0; +} +rtc_server { + enabled on; + listen 8000; # UDP port + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate + candidate $CANDIDATE; +} + +vhost __defaultVhost__ { + rtc { + enabled on; + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc + rtmp_to_rtc on; + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp + rtc_to_rtmp on; + } + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } + hls { + enabled on; + } +} + diff --git a/trunk/conf/http.heartbeat.conf b/trunk/conf/http.heartbeat.conf index d15ff6a56d..d2125ed332 100644 --- a/trunk/conf/http.heartbeat.conf +++ b/trunk/conf/http.heartbeat.conf @@ -1,7 +1,7 @@ # the config for srs http heartbeat, report its info to api-server # @see full.conf for detail config. -listen 1935 +listen 1935; max_connections 1000; daemon off; srs_log_tank console; diff --git a/trunk/conf/origin1-for-proxy.conf b/trunk/conf/origin1-for-proxy.conf new file mode 100644 index 0000000000..baca5c9f40 --- /dev/null +++ b/trunk/conf/origin1-for-proxy.conf @@ -0,0 +1,57 @@ + +listen 19351; +max_connections 1000; +pid objs/origin1.pid; +daemon off; +srs_log_tank console; +http_server { + enabled on; + listen 8081; + dir ./objs/nginx/html; +} +http_api { + enabled on; + listen 19851; +} +rtc_server { + enabled on; + listen 8001; # UDP port + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate + candidate $CANDIDATE; +} +srt_server { + enabled on; + listen 10081; + tsbpdmode off; + tlpktdrop off; +} +heartbeat { + enabled on; + interval 9; + url http://127.0.0.1:12025/api/v1/srs/register; + device_id origin1; + ports on; +} +vhost __defaultVhost__ { + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } + hls { + enabled on; + hls_path ./objs/nginx/html; + hls_fragment 10; + hls_window 60; + } + rtc { + enabled on; + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc + rtmp_to_rtc on; + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp + rtc_to_rtmp on; + } + srt { + enabled on; + srt_to_rtmp on; + } +} diff --git a/trunk/conf/origin2-for-proxy.conf b/trunk/conf/origin2-for-proxy.conf new file mode 100644 index 0000000000..48f6398930 --- /dev/null +++ b/trunk/conf/origin2-for-proxy.conf @@ -0,0 +1,57 @@ + +listen 19352; +max_connections 1000; +pid objs/origin2.pid; +daemon off; +srs_log_tank console; +http_server { + enabled on; + listen 8082; + dir ./objs/nginx/html; +} +http_api { + enabled on; + listen 19853; +} +rtc_server { + enabled on; + listen 8001; # UDP port + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate + candidate $CANDIDATE; +} +srt_server { + enabled on; + listen 10082; + tsbpdmode off; + tlpktdrop off; +} +heartbeat { + enabled on; + interval 9; + url http://127.0.0.1:12025/api/v1/srs/register; + device_id origin2; + ports on; +} +vhost __defaultVhost__ { + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } + hls { + enabled on; + hls_path ./objs/nginx/html; + hls_fragment 10; + hls_window 60; + } + rtc { + enabled on; + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc + rtmp_to_rtc on; + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp + rtc_to_rtmp on; + } + srt { + enabled on; + srt_to_rtmp on; + } +} diff --git a/trunk/conf/origin3-for-proxy.conf b/trunk/conf/origin3-for-proxy.conf new file mode 100644 index 0000000000..95624fb773 --- /dev/null +++ b/trunk/conf/origin3-for-proxy.conf @@ -0,0 +1,57 @@ + +listen 19353; +max_connections 1000; +pid objs/origin3.pid; +daemon off; +srs_log_tank console; +http_server { + enabled on; + listen 8083; + dir ./objs/nginx/html; +} +http_api { + enabled on; + listen 19852; +} +rtc_server { + enabled on; + listen 8001; # UDP port + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate + candidate $CANDIDATE; +} +srt_server { + enabled on; + listen 10083; + tsbpdmode off; + tlpktdrop off; +} +heartbeat { + enabled on; + interval 9; + url http://127.0.0.1:12025/api/v1/srs/register; + device_id origin3; + ports on; +} +vhost __defaultVhost__ { + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } + hls { + enabled on; + hls_path ./objs/nginx/html; + hls_fragment 10; + hls_window 60; + } + rtc { + enabled on; + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc + rtmp_to_rtc on; + # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp + rtc_to_rtmp on; + } + srt { + enabled on; + srt_to_rtmp on; + } +} diff --git a/trunk/configure b/trunk/configure index 1a1f4ead23..b7f004059a 100755 --- a/trunk/configure +++ b/trunk/configure @@ -122,13 +122,13 @@ fi # For Sanitizer # @doc: https://github.com/google/sanitizers/wiki/AddressSanitizer -if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then +if [[ $SRS_SANITIZER == YES ]]; then CXXFLAGS="${CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer"; fi # Start to generate the Makefile. cat << END >> ${SRS_OBJS}/Makefile -GCC = ${SRS_TOOL_CC} +CC = ${SRS_TOOL_CC} CXX = ${SRS_TOOL_CXX} AR = ${SRS_TOOL_AR} LINK = ${SRS_TOOL_CXX} @@ -145,6 +145,10 @@ END # header(.h): add to ModuleLibIncs if need the specified library. for example, LibSTRoot # library(.a): add to ModuleLibFiles if binary need the specifeid library. for example, LibSTfile # + +# the link options, always use static link +SrsLinkOptions="-ldl -lpthread"; + # st(state-threads) the basic network library for SRS. LibSTRoot="${SRS_OBJS}/st"; LibSTfile="${LibSTRoot}/libst.a" if [[ $SRS_SHARED_ST == YES ]]; then LibSTfile="-L${LibSTRoot} -lst"; fi @@ -154,7 +158,10 @@ if [[ $SRS_RTC == YES ]]; then LibSrtpRoot="${SRS_OBJS}/srtp2/include"; LibSrtpFile="${SRS_OBJS}/srtp2/lib/libsrtp2.a" if [[ $SRS_USE_SYS_SRTP == YES ]]; then LibSrtpRoot=""; LibSrtpFile="libsrtp2.a" - if [[ $SRS_SHARED_SRTP == YES ]]; then LibSrtpFile="-lsrtp2"; fi + if [[ $SRS_SHARED_SRTP == YES ]]; then + LibSrtpFile=""; + SrsLinkOptions="${SrsLinkOptions} -lsrtp2"; + fi fi fi @@ -175,7 +182,8 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then LibFfmpegRoot="" LibFfmpegFile="libavcodec.a libswresample.a libavutil.a libopus.a"; if [[ $SRS_SHARED_FFMPEG == YES ]]; then - LibFfmpegFile="-lavcodec -lswresample -lavutil -lopus" + LibFfmpegFile="" + SrsLinkOptions="${SrsLinkOptions} -lavcodec -lswresample -lavutil -lopus"; fi fi fi @@ -201,12 +209,13 @@ if [[ $SRS_SRT == YES ]]; then if [[ $SRS_SHARED_SRT == YES ]]; then LibSRTfile="-L${SRS_OBJS}/srt/lib -lsrt"; fi if [[ $SRS_USE_SYS_SRT == YES ]]; then LibSRTRoot=""; LibSRTfile="libsrt.a" - if [[ $SRS_SHARED_SRT == YES ]]; then LibSRTfile="-lsrt"; fi + if [[ $SRS_SHARED_SRT == YES ]]; then + LibSRTfile=""; + SrsLinkOptions="${SrsLinkOptions} -lsrt"; + fi fi fi -# the link options, always use static link -SrsLinkOptions="-ldl -lpthread"; if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == YES ]]; then SrsLinkOptions="${SrsLinkOptions} -lssl -lcrypto"; fi @@ -235,7 +244,7 @@ fi # For address sanitizer # @doc: https://github.com/google/sanitizers/wiki/AddressSanitizer -if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then +if [[ $SRS_SANITIZER == YES ]]; then SrsLinkOptions="${SrsLinkOptions} -fsanitize=address -fno-omit-frame-pointer"; if [[ $SRS_SANITIZER_STATIC == YES ]]; then SrsLinkOptions="${SrsLinkOptions} -static-libasan"; @@ -247,6 +256,11 @@ if [[ $SRS_CYGWIN64 == YES && $SRS_FFMPEG_FIT == YES ]]; then SrsLinkOptions="${SrsLinkOptions} -lbcrypt"; fi +# User configed options. +if [[ $SRS_EXTRA_LDFLAGS != '' ]]; then + SrsLinkOptions="${SrsLinkOptions} $SRS_EXTRA_LDFLAGS"; +fi + ##################################################################################### # Modules, compile each module, then link to binary # @@ -254,8 +268,8 @@ fi MODULE_ID="CORE" MODULE_DEPENDS=() ModuleLibIncs=(${SRS_OBJS}) -MODULE_FILES=("srs_core" "srs_core_version" "srs_core_version5" "srs_core_autofree" "srs_core_performance" - "srs_core_time" "srs_core_platform") +MODULE_FILES=("srs_core" "srs_core_version" "srs_core_version7" "srs_core_autofree" "srs_core_performance" + "srs_core_time" "srs_core_platform" "srs_core_deprecated") CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . $SRS_WORKDIR/auto/modules.sh CORE_OBJS="${MODULE_OBJS[@]}" # @@ -415,7 +429,7 @@ if [[ $SRS_SRT == YES ]]; then ModuleLibIncs+=(${LibSRTRoot}) MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}" fi -LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}" +LINK_OPTIONS="${LDFLAGS} ${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}" # # srs: srs(simple rtmp server) over st(state-threads) BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . $SRS_WORKDIR/auto/apps.sh @@ -450,7 +464,8 @@ if [[ $SRS_UTEST == YES ]]; then MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_kernel" "srs_utest_core" "srs_utest_config" "srs_utest_rtmp" "srs_utest_http" "srs_utest_avc" "srs_utest_reload" "srs_utest_mp4" "srs_utest_service" "srs_utest_app" "srs_utest_rtc" "srs_utest_config2" - "srs_utest_protocol" "srs_utest_protocol2" "srs_utest_kernel2") + "srs_utest_protocol" "srs_utest_protocol2" "srs_utest_kernel2" "srs_utest_protocol3" + "srs_utest_st") if [[ $SRS_SRT == YES ]]; then MODULE_FILES+=("srs_utest_srt") fi @@ -479,7 +494,7 @@ if [[ $SRS_UTEST == YES ]]; then fi MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP") MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${SRT_OBJS[@]}" - LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . $SRS_WORKDIR/auto/utest.sh + LINK_OPTIONS="${LDFLAGS} -lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . $SRS_WORKDIR/auto/utest.sh fi ##################################################################################### @@ -496,16 +511,17 @@ mv ${SRS_MAKEFILE} ${SRS_MAKEFILE}.bk # generate phony header cat << END > ${SRS_MAKEFILE} -.PHONY: default all _default install help clean destroy server srs_ingest_hls utest _prepare_dir $__mphonys +.PHONY: default all _default install help clean destroy server utest _prepare_dir $__mphonys .PHONY: clean_srs clean_modules clean_openssl clean_srtp2 clean_opus clean_ffmpeg clean_st .PHONY: st ffmpeg -GCC = ${SRS_TOOL_CC} +CC = ${SRS_TOOL_CC} CXX = ${SRS_TOOL_CXX} AR = ${SRS_TOOL_AR} LINK = ${SRS_TOOL_LD} RANDLIB = ${SRS_TOOL_RANDLIB} CXXFLAGS = ${CXXFLAGS} +LDFLAGS = ${LDFLAGS} # install prefix. SRS_PREFIX=${SRS_PREFIX} @@ -528,7 +544,7 @@ default: server all: _default -_default: server srs_ingest_hls utest $__mdefaults +_default: server utest $__mdefaults help: @echo "Usage: make ||||||" @@ -591,7 +607,7 @@ clean_st: st: @rm -f ${SRS_OBJS}/srs srs_utest @\$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs clean - @env EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs ${_ST_MAKE_ARGS} CC=\$(GCC) AR=\$(AR) LD=\$(LINK) RANDLIB=\$(RANDLIB) + @env EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs ${_ST_MAKE_ARGS} CC=\$(CC) CXX=\$(CXX) AR=\$(AR) LD=\$(LINK) RANDLIB=\$(RANDLIB) @echo "Please rebuild srs by: make" ffmpeg: @@ -633,9 +649,8 @@ install: @mkdir -p \$(__REAL_INSTALL) @echo "Now make the http root dir" @mkdir -p \$(__REAL_INSTALL)/objs/nginx/html - @cp -f research/api-server/static-dir/index.html \$(__REAL_INSTALL)/objs/nginx/html - @cp -f research/players/crossdomain.xml \$(__REAL_INSTALL)/objs/nginx/html - @cp -f research/api-server/static-dir/favicon.ico \$(__REAL_INSTALL)/objs/nginx/html + @cp -f research/index.html \$(__REAL_INSTALL)/objs/nginx/html + @cp -f research/favicon.ico \$(__REAL_INSTALL)/objs/nginx/html @cp -Rf research/players \$(__REAL_INSTALL)/objs/nginx/html/ @cp -Rf research/console \$(__REAL_INSTALL)/objs/nginx/html/ @cp -Rf 3rdparty/signaling/www/demos \$(__REAL_INSTALL)/objs/nginx/html/ @@ -831,6 +846,12 @@ if [[ $SRS_VALGRIND == YES ]]; then else echo -e "${GREEN}Note: The valgrind is disabled.${BLACK}" fi +if [[ $SRS_SANITIZER == YES ]]; then + echo -e "${GREEN}The sanitizer is enabled.${BLACK}" +else + echo -e "${GREEN}Note: The sanitizer is disabled.${BLACK}" +fi + # add each modules for application for SRS_MODULE in ${SRS_MODULES[*]}; do echo -e "${GREEN}Enable module: $SRS_MODULE${BLACK}" diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 20e97cd0a6..c831ec94bb 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -4,9 +4,93 @@ The changelog for SRS. + + +## SRS 7.0 Changelog +* v7.0, 2024-10-15, Merge [#4160](https://github.com/ossrs/srs/pull/4160): RTC2RTMP: Fix screen sharing stutter caused by packet loss. v7.0.18 (#4160) +* v7.0, 2024-10-15, Merge [#3979](https://github.com/ossrs/srs/pull/3979): ST: Use clock_gettime to prevent time jumping backwards. v7.0.17 (#3979) +* v7.0, 2024-09-09, Merge [#4158](https://github.com/ossrs/srs/pull/4158): Proxy: Support proxy server for SRS. v7.0.16 (#4158) +* v7.0, 2024-09-09, Merge [#4171](https://github.com/ossrs/srs/pull/4171): Heartbeat: Report ports for proxy server. v7.0.15 (#4171) +* v7.0, 2024-09-01, Merge [#4165](https://github.com/ossrs/srs/pull/4165): FLV: Refine source and http handler. v7.0.14 (#4165) +* v7.0, 2024-09-01, Merge [#4166](https://github.com/ossrs/srs/pull/4166): Edge: Fix flv edge crash when http unmount. v7.0.13 (#4166) +* v7.0, 2024-08-31, Merge [#4162](https://github.com/ossrs/srs/pull/4162): Fix #3767: RTMP: Do not response empty data packet. v7.0.12 (#4162) +* v7.0, 2024-08-31, Merge [#4164](https://github.com/ossrs/srs/pull/4164): HTTP-FLV: Notify connection to expire when unpublishing. v7.0.11 (#4164) +* v7.0, 2024-08-24, Merge [#4157](https://github.com/ossrs/srs/pull/4157): Fix crash when quiting. v7.0.10 (#4157) +* v7.0, 2024-08-24, Merge [#4156](https://github.com/ossrs/srs/pull/4156): Build: Fix srs_mp4_parser compiling error. v7.0.9 (#4156) +* v7.0, 2024-08-22, Merge [#4154](https://github.com/ossrs/srs/pull/4154): ASAN: Disable memory leak detection by default. v7.0.8 (#4154) +* v7.0, 2024-08-21, Merge [#4149](https://github.com/ossrs/srs/pull/4149): ST: Replace macros with explicit code for better understanding. v7.0.7 (#4149) +* v7.0, 2024-08-21, Merge [#4150](https://github.com/ossrs/srs/pull/4150): API: Support new HTTP API for VALGRIND. v7.0.6 (#4150) +* v7.0, 2024-08-15, Merge [#4144](https://github.com/ossrs/srs/pull/4144): HTTP-FLV: Crash when multiple viewers. v7.0.5 (#4144) +* v7.0, 2024-08-15, Merge [#4142](https://github.com/ossrs/srs/pull/4142): Config: Add more utest for env config. v7.0.4 (#4142) +* v7.0, 2024-08-14, Merge [#4141](https://github.com/ossrs/srs/pull/4141): Live: Crash for invalid live stream state when unmount HTTP. v7.0.3 (#4141) +* v7.0, 2024-08-13, Merge [#4092](https://github.com/ossrs/srs/pull/4092): Config: Improve env config to support multi values. v7.0.2 (#4092) +* v7.0, 2024-08-12, Merge [#4131](https://github.com/ossrs/srs/pull/4131): Transcode: More generic h264/h265 codec support. v7.0.1 (#4131) +* v7.0, 2024-08-12, Init SRS 7 branch. v7.0.0 + ## SRS 6.0 Changelog +* v6.0, 2024-10-15, Merge [#4160](https://github.com/ossrs/srs/pull/4160): RTC2RTMP: Fix screen sharing stutter caused by packet loss. v6.0.157 (#4160) +* v6.0, 2024-09-09, Merge [#4171](https://github.com/ossrs/srs/pull/4171): Heartbeat: Report ports for proxy server. v6.0.156 (#4171) +* v6.0, 2024-09-01, Merge [#4165](https://github.com/ossrs/srs/pull/4165): FLV: Refine source and http handler. v6.0.155 (#4165) +* v6.0, 2024-09-01, Merge [#4166](https://github.com/ossrs/srs/pull/4166): Edge: Fix flv edge crash when http unmount. v6.0.154 (#4166) +* v6.0, 2024-08-31, Merge [#4162](https://github.com/ossrs/srs/pull/4162): Fix #3767: RTMP: Do not response empty data packet. v6.0.153 (#4162) +* v6.0, 2024-08-31, Merge [#4164](https://github.com/ossrs/srs/pull/4164): HTTP-FLV: Notify connection to expire when unpublishing. v6.0.152 (#4164) +* v6.0, 2024-08-24, Merge [#4157](https://github.com/ossrs/srs/pull/4157): Fix crash when quiting. v6.0.151 (#4157) +* v6.0, 2024-08-24, Merge [#4156](https://github.com/ossrs/srs/pull/4156): Build: Fix srs_mp4_parser compiling error. v6.0.150 (#4156) +* v6.0, 2024-08-21, Merge [#4150](https://github.com/ossrs/srs/pull/4150): API: Support new HTTP API for VALGRIND. v6.0.149 (#4150) +* v6.0, 2024-08-15, Merge [#4144](https://github.com/ossrs/srs/pull/4144): HTTP-FLV: Crash when multiple viewers. v6.0.148 (#4144) +* v6.0, 2024-08-15, Merge [#4142](https://github.com/ossrs/srs/pull/4142): Config: Add more utest for env config. v6.0.147 (#4142) +* v6.0, 2024-08-14, Merge [#4141](https://github.com/ossrs/srs/pull/4141): Live: Crash for invalid live stream state when unmount HTTP. v6.0.146 (#4141) +* v6.0, 2024-07-27, Merge [#4127](https://github.com/ossrs/srs/pull/4127): Transcode: Support video codec such as h264_qsv and libx265. v6.0.145 (#4127) +* v6.0, 2024-07-27, Merge [#4101](https://github.com/ossrs/srs/pull/4101): GB28181: Support external SIP server. v6.0.144 (#4101) +* v6.0, 2024-07-24, Merge [#4115](https://github.com/ossrs/srs/pull/4115): HLS: Add missing newline to end of session manifest. v6.0.143 (#4115) +* v6.0, 2024-07-24, Merge [#4029](https://github.com/ossrs/srs/pull/4029): Player: Fix empty img tag occupy 20px size in safari. v6.0.142 (#4029) +* v6.0, 2024-07-24, Merge [#4063](https://github.com/ossrs/srs/pull/4063): let http-remux ts stream support guess_has_av feature;. v6.0.141 (#4063) +* v6.0, 2024-07-24, Merge [#4116](https://github.com/ossrs/srs/pull/4116): Dockerfile: Consistently use proper ENV syntax using "=". v6.0.140 (#4116) +* v6.0, 2024-07-24, Merge [#4126](https://github.com/ossrs/srs/pull/4126): Edge: Improve stability for state and fd closing. v6.0.139 (#4126) +* v6.0, 2024-07-13, Merge [#4111](https://github.com/ossrs/srs/pull/4111): DASH: Fix time unit error for disposing. v6.0.138 (#4111) +* v6.0, 2024-07-09, Merge [#4028](https://github.com/ossrs/srs/pull/4028): HTTPS: Support config key/cert for HTTPS API. v6.0.137 (#4028) +* v6.0, 2024-07-09, Merge [#4109](https://github.com/ossrs/srs/pull/4109): UniquePtr: Support SrsUniquePtr to replace SrsAutoFree. v6.0.136 (#4109) +* v6.0, 2024-07-08, Merge [#4042](https://github.com/ossrs/srs/pull/4042): Refine config directive token parsing. v6.0.135 (#4042) +* v6.0, 2024-07-04, Merge [#4106](https://github.com/ossrs/srs/pull/4106): SmartPtr: Fix SRT source memory leaking. v6.0.134 (#4106) +* v6.0, 2024-06-29, Merge [#4077](https://github.com/ossrs/srs/pull/4077): Fix misspelling error in app config. v6.0.133 (#4077) +* v6.0, 2024-06-29, Merge [#4102](https://github.com/ossrs/srs/pull/4102): SmartPtr: Support detect memory leak by valgrind. v6.0.132 (#4102) +* v6.0, 2024-06-21, Merge [#4100](https://github.com/ossrs/srs/pull/4100): Fix security scan problems. v6.0.131 (#4100) +* v6.0, 2024-06-21, Merge [#4097](https://github.com/ossrs/srs/pull/4097): SmartPtr: Support load test for source by srs-bench. v6.0.130 (#4097) +* v6.0, 2024-06-15, Merge [#4089](https://github.com/ossrs/srs/pull/4089): SmartPtr: Support shared ptr for live source. v6.0.129 (#4089) +* v6.0, 2024-06-14, Merge [#4085](https://github.com/ossrs/srs/pull/4085): SmartPtr: Support shared ptr for RTC source. v6.0.128 (#4085) +* v6.0, 2024-06-13, Merge [#4083](https://github.com/ossrs/srs/pull/4083): SmartPtr: Use shared ptr in RTC TCP connection. v6.0.127 (#4083) +* v6.0, 2024-06-12, Merge [#4080](https://github.com/ossrs/srs/pull/4080): SmartPtr: Use shared ptr to manage GB objects. v6.0.126 (#4080) +* v6.0, 2024-06-03, Merge [#4057](https://github.com/ossrs/srs/pull/4057): RTC: Support dropping h.264 SEI from NALUs. v6.0.125 (#4057) +* v6.0, 2024-04-26, Merge [#4044](https://github.com/ossrs/srs/pull/4044): fix: correct SRS_ERRNO_MAP_HTTP duplicate error code. v6.0.124 (#4044) +* v6.0, 2024-04-23, Merge [#4038](https://github.com/ossrs/srs/pull/4038): RTMP: Do not response publish start message if hooks fail. v6.0.123 (#4038) +* v6.0, 2024-04-22, Merge [#4033](https://github.com/ossrs/srs/pull/4033): issue #3967: support x509 certification chiain in single pem file. v6.0.122 (#4033) +* v6.0, 2024-03-26, Filter JSONP callback function name. v6.0.121 +* v6.0, 2024-03-26, Merge [#3995](https://github.com/ossrs/srs/pull/3995): Build: Refine workflow for cygwin and remove scorecard. v6.0.120 (#3995) +* v6.0, 2024-03-26, Merge [#4005](https://github.com/ossrs/srs/pull/4005): Build: Fix module failed for main_ingest_hls and mp4_parser. v6.0.119 (#4005) +* v6.0, 2024-03-24, Merge [#3989](https://github.com/ossrs/srs/pull/3989): ST: Research adds examples that demos pthread and helloworld. v6.0.118 (#3989) +* v6.0, 2024-03-19, Merge [#3958](https://github.com/ossrs/srs/pull/3958): Add a TCP proxy for debugging. v6.0.117 (#3958) +* v6.0, 2024-03-20, Merge [#3964](https://github.com/ossrs/srs/pull/3964): WebRTC: Add support for A/V only WHEP/WHEP player. v6.0.116 (#3964) +* v6.0, 2024-03-19, Merge [#3990](https://github.com/ossrs/srs/pull/3990): System: Disable feature that obtains versions and check features status. v6.0.115 (#3990) +* v6.0, 2024-03-18, Merge [#3973](https://github.com/ossrs/srs/pull/3973): Typo: Fix some typo for #3973 #3976 #3982. v6.0.114 (#3973) +* v6.0, 2024-02-06, Merge [#3920](https://github.com/ossrs/srs/pull/3920): WHIP: Fix bug for converting WHIP to RTMP/HLS. v6.0.113 (#3920) +* v6.0, 2024-02-05, Merge [#3924](https://github.com/ossrs/srs/pull/3924): Upgrade hls.js and set in low latency mode. v6.0.112 (#3924) +* v6.0, 2024-02-05, Merge [#3925](https://github.com/ossrs/srs/pull/3925): RTC: Fix video and audio track pt_ is not change in player before publisher. v6.0.111 (#3925) +* v6.0, 2024-02-05, Merge [#3923](https://github.com/ossrs/srs/pull/3923): Configure: print enabled/disable sanitizer. v6.0.110 (#3923) +* v6.0, 2023-12-30, Merge [#3916](https://github.com/ossrs/srs/pull/3916): Enhancing the compatibility of options.sh. v6.0.108 (#3916) +* v6.0, 2023-12-30, Merge [#3914](https://github.com/ossrs/srs/pull/3914): Forward: when unpublish crash caused by uninitialized forward connection. v6.0.107 (#3914) +* v6.0, 2023-12-15, Merge [#3854](https://github.com/ossrs/srs/pull/3854): Typo: line 263 - srs_app_srt_conn.cpp. v6.0.106 (#3854) +* v6.0, 2023-12-14, Merge [#3910](https://github.com/ossrs/srs/pull/3910): RTC: Support OPUS stereo SDP option. v6.0.105 (#3910) +* v6.0, 2023-12-14, Merge [#3902](https://github.com/ossrs/srs/pull/3902): Security: Support IP whitelist for HTTP-FLV, HLS, WebRTC, and SRT. v6.0.104 (#3902) +* v6.0, 2023-11-22, Merge [#3891](https://github.com/ossrs/srs/pull/3891): fix 'sed' error in options.sh. v6.0.103 (#3891) +* v6.0, 2023-11-22, Merge [#3883](https://github.com/ossrs/srs/pull/3883): Fix opus delay options, use ffmpeg-opus in docker test. v6.0.102 (#3883) +* v6.0, 2023-11-19, Merge [#3886](https://github.com/ossrs/srs/pull/3886): Change the hls_aof_ratio to 2.1. v6.0.101 (#3886) +* v6.0, 2023-11-16, Merge [#3868](https://github.com/ossrs/srs/pull/3868): Fix the test fail when enable ffmpeg-opus. v6.0.100 (#3868) +* v6.0, 2023-11-15, Merge [#3879](https://github.com/ossrs/srs/pull/3879): Add --extra-ldflags. v6.0.99 (#3879) +* v6.0, 2023-11-06, Merge [#3851](https://github.com/ossrs/srs/pull/3851): donot compile libopus when enable sys-ffmpeg. v6.0.98 (#3851) +* v6.0, 2023-11-04, Merge [#3852](https://github.com/ossrs/srs/pull/3852): RTC: Refine FFmpeg opus audio noisy issue. v6.0.97 (#3852) +* v6.0, 2023-11-01, Merge [#3858](https://github.com/ossrs/srs/pull/3858): Support build without cache to test if actions fail. v6.0.96 (#3858) * v6.0, 2023-10-25, Merge [#3845](https://github.com/ossrs/srs/pull/3845): RTC: Fix FFmpeg opus audio noisy issue. v6.0.95 (#3845) * v6.0, 2023-10-21, Merge [#3847](https://github.com/ossrs/srs/pull/3847): WebRTC: TCP transport should use read_fully instead of read. v6.0.94 (#3847) * v6.0, 2023-10-20, Merge [#3846](https://github.com/ossrs/srs/pull/3846): Added system library option for ffmpeg, srtp, srt libraries. v6.0.93 (#3846) @@ -107,6 +191,26 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2024-10-15, Merge [#4160](https://github.com/ossrs/srs/pull/4160): RTC2RTMP: Fix screen sharing stutter caused by packet loss. v5.0.216 (#4160) +* v5.0, 2024-09-09, Merge [#4171](https://github.com/ossrs/srs/pull/4171): Heartbeat: Report ports for proxy server. v5.0.215 (#4171) +* v5.0, 2024-07-24, Merge [#4126](https://github.com/ossrs/srs/pull/4126): Edge: Improve stability for state and fd closing. v5.0.214 (#4126) +* v5.0, 2024-06-03, Merge [#4057](https://github.com/ossrs/srs/pull/4057): RTC: Support dropping h.264 SEI from NALUs. v5.0.213 (#4057) +* v5.0, 2024-04-23, Merge [#4038](https://github.com/ossrs/srs/pull/4038): RTMP: Do not response publish start message if hooks fail. v5.0.212 (#4038) +* v5.0, 2024-04-22, Merge [#4033](https://github.com/ossrs/srs/pull/4033): issue #3967: support x509 certification chiain in single pem file. v5.0.211 (#4033) +* v5.0, 2024-03-26, Filter JSONP callback function name. v5.0.210 +* v5.0, 2024-03-19, Merge [#3990](https://github.com/ossrs/srs/pull/3990): System: Disable feature that obtains versions and check features status. v5.0.209 (#3990) +* v5.0, 2024-02-06, Merge [#3920](https://github.com/ossrs/srs/pull/3920): WHIP: Fix bug for converting WHIP to RTMP/HLS. v5.0.208 (#3920) +* v5.0, 2024-02-05, Merge [#3925](https://github.com/ossrs/srs/pull/3925): RTC: Fix video and audio track pt_ is not change in player before publisher. v5.0.207 (#3925) +* v5.0, 2024-02-05, Merge [#3923](https://github.com/ossrs/srs/pull/3923): Configure: print enabled/disable sanitizer. v5.0.206 (#3923) +* v5.0, 2023-12-30, Merge [#3916](https://github.com/ossrs/srs/pull/3916): Enhancing the compatibility of options.sh. v5.0.204 (#3916) +* v5.0, 2023-12-14, Merge [#3910](https://github.com/ossrs/srs/pull/3910): RTC: Support OPUS stereo SDP option. v5.0.203 (#3910) +* v5.0, 2023-12-14, Merge [#3902](https://github.com/ossrs/srs/pull/3902): Security: Support IP whitelist for HTTP-FLV, HLS, WebRTC, and SRT. v5.0.202 (#3902) +* v5.0, 2023-11-22, Merge [#3891](https://github.com/ossrs/srs/pull/3891): fix 'sed' error in options.sh. v5.0.201 (#3891) +* v5.0, 2023-11-19, Merge [#3886](https://github.com/ossrs/srs/pull/3886): Change the hls_aof_ratio to 2.1. v5.0.200 (#3886) +* v5.0, 2023-11-15, Merge [#3879](https://github.com/ossrs/srs/pull/3879): Add --extra-ldflags. v5.0.199 (#3879) +* v5.0, 2023-11-06, Merge [#3851](https://github.com/ossrs/srs/pull/3851): donot compile libopus when enable sys-ffmpeg. v5.0.198 (#3851) +* v5.0, 2023-11-04, Merge [#3852](https://github.com/ossrs/srs/pull/3852): RTC: Refine FFmpeg opus audio noisy issue. v5.0.197 (#3852) +* v5.0, 2023-11-01, Merge [#3858](https://github.com/ossrs/srs/pull/3858): Support build without cache to test if actions fail. v5.0.196 (#3858) * v5.0, 2023-10-25, Merge [#3845](https://github.com/ossrs/srs/pull/3845): RTC: Fix FFmpeg opus audio noisy issue. v5.0.195 (#3845) * v5.0, 2023-10-21, Merge [#3847](https://github.com/ossrs/srs/pull/3847): WebRTC: TCP transport should use read_fully instead of read. v5.0.194 (#3847) * v5.0, 2023-10-20, Merge [#3846](https://github.com/ossrs/srs/pull/3846): Added system library option for ffmpeg, srtp, srt libraries. v5.0.193 (#3846) diff --git a/trunk/ide/srs_clion/CMakeLists.txt b/trunk/ide/srs_clion/CMakeLists.txt index deb36a5df9..63cb7fd7a1 100755 --- a/trunk/ide/srs_clion/CMakeLists.txt +++ b/trunk/ide/srs_clion/CMakeLists.txt @@ -27,11 +27,11 @@ ProcessorCount(JOBS) # We should always configure SRS for switching between branches. IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") EXECUTE_PROCESS( - COMMAND ./configure --osx --srt=on --gb28181=on --apm=on --h265=on --utest=on --jobs=${JOBS} + COMMAND ./configure --osx --srt=on --gb28181=on --apm=on --h265=on --hds=on --utest=on --ffmpeg-opus=off --jobs=${JOBS} WORKING_DIRECTORY ${SRS_DIR} RESULT_VARIABLE ret) ELSE () EXECUTE_PROCESS( - COMMAND ./configure --srt=on --gb28181=on --apm=on --h265=on --utest=on --jobs=${JOBS} + COMMAND ./configure --srt=on --gb28181=on --apm=on --h265=on --hds=on --utest=on --ffmpeg-opus=off --jobs=${JOBS} WORKING_DIRECTORY ${SRS_DIR} RESULT_VARIABLE ret) ENDIF () if(NOT ret EQUAL 0) @@ -45,6 +45,7 @@ set(DEPS_LIBS ${SRS_DIR}/objs/st/libst.a ${SRS_DIR}/objs/ffmpeg/lib/libavcodec.a ${SRS_DIR}/objs/ffmpeg/lib/libavutil.a ${SRS_DIR}/objs/ffmpeg/lib/libswresample.a + ${SRS_DIR}/objs/opus/lib/libopus.a ${SRS_DIR}/objs/srt/lib/libsrt.a) foreach(DEPS_LIB ${DEPS_LIBS}) IF (NOT EXISTS ${DEPS_LIB}) diff --git a/trunk/research/api-server/static-dir/favicon.ico b/trunk/research/api-server/static-dir/favicon.ico deleted file mode 100644 index 8c68afab84..0000000000 Binary files a/trunk/research/api-server/static-dir/favicon.ico and /dev/null differ diff --git a/trunk/research/api-server/static-dir/favicon.ico b/trunk/research/api-server/static-dir/favicon.ico new file mode 120000 index 0000000000..251568d4d1 --- /dev/null +++ b/trunk/research/api-server/static-dir/favicon.ico @@ -0,0 +1 @@ +../../favicon.ico \ No newline at end of file diff --git a/trunk/research/api-server/static-dir/index.html b/trunk/research/api-server/static-dir/index.html deleted file mode 100755 index 8d92fc12cc..0000000000 --- a/trunk/research/api-server/static-dir/index.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - SRS - - - - -
-

SRS works!

-

- Click here to enter SRS console.
- 点击进入SRS控制台 -

-

- Publish stream by FFmpeg or OBS:
- 请使用工具FFmpeg或者OBS推流到下面地址: -


-        

-

- Click here to start SRS player.
- 点击进入SRS播放器 -

-

SRS Team © 2022

-
- - diff --git a/trunk/research/api-server/static-dir/index.html b/trunk/research/api-server/static-dir/index.html new file mode 120000 index 0000000000..c90ed45dd3 --- /dev/null +++ b/trunk/research/api-server/static-dir/index.html @@ -0,0 +1 @@ +../../index.html \ No newline at end of file diff --git a/trunk/research/console/en_index.html b/trunk/research/console/en_index.html index 45c6a43b48..fd45b31d34 100644 --- a/trunk/research/console/en_index.html +++ b/trunk/research/console/en_index.html @@ -20,7 +20,7 @@ - +