diff options
author | lurchi <lurchi@strangeplace.net> | 2016-08-14 12:45:07 +0200 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2016-08-14 12:45:07 +0200 |
commit | 17321bfb3c7ef6a05073f9656460c00547e89ed8 (patch) | |
tree | 8ad93f2c49e3ff968f8f6c3f5255677d52fb581e | |
parent | 0372b4a9b8c788ace44a52430d29f4e3ece1c119 (diff) | |
download | secushare-17321bfb3c7ef6a05073f9656460c00547e89ed8.tar.gz secushare-17321bfb3c7ef6a05073f9656460c00547e89ed8.zip |
add libc subtree
78 files changed, 16009 insertions, 0 deletions
diff --git a/third_party/libc/.gitignore b/third_party/libc/.gitignore new file mode 100644 index 0000000..f0ff259 --- /dev/null +++ b/third_party/libc/.gitignore | |||
@@ -0,0 +1,3 @@ | |||
1 | target | ||
2 | Cargo.lock | ||
3 | *~ | ||
diff --git a/third_party/libc/.travis.yml b/third_party/libc/.travis.yml new file mode 100644 index 0000000..e258303 --- /dev/null +++ b/third_party/libc/.travis.yml | |||
@@ -0,0 +1,107 @@ | |||
1 | language: rust | ||
2 | sudo: required | ||
3 | dist: trusty | ||
4 | services: | ||
5 | - docker | ||
6 | install: | ||
7 | - curl https://static.rust-lang.org/rustup.sh | | ||
8 | sh -s -- --add-target=$TARGET --disable-sudo -y --prefix=`rustc --print sysroot` | ||
9 | script: | ||
10 | - cargo build | ||
11 | - cargo build --no-default-features | ||
12 | - cargo generate-lockfile --manifest-path libc-test/Cargo.toml | ||
13 | - if [[ $TRAVIS_OS_NAME = "linux" ]]; then | ||
14 | sh ci/run-docker.sh $TARGET; | ||
15 | else | ||
16 | export CARGO_TARGET_DIR=`pwd`/target; | ||
17 | sh ci/run.sh $TARGET; | ||
18 | fi | ||
19 | - rustc ci/style.rs && ./style src | ||
20 | osx_image: xcode7.3 | ||
21 | env: | ||
22 | global: | ||
23 | secure: eIDEoQdTyglcsTD13zSGotAX2HDhRSXIaaTnVZTThqLSrySOc3/6KY3qmOc2Msf7XaBqfFy9QA+alk7OwfePp253eiy1Kced67ffjjFOytEcRT7FlQiYpcYQD6WNHZEj62/bJBO4LTM9sGtWNCTJVEDKW0WM8mUK7qNuC+honPM= | ||
24 | matrix: | ||
25 | include: | ||
26 | # 1.0.0 compat | ||
27 | - os: linux | ||
28 | env: TARGET=x86_64-unknown-linux-gnu | ||
29 | rust: 1.0.0 | ||
30 | script: cargo build | ||
31 | install: | ||
32 | |||
33 | # build documentation | ||
34 | - os: linux | ||
35 | env: TARGET=x86_64-unknown-linux-gnu | ||
36 | rust: stable | ||
37 | script: sh ci/dox.sh | ||
38 | |||
39 | # stable compat | ||
40 | - os: linux | ||
41 | env: TARGET=x86_64-unknown-linux-gnu | ||
42 | rust: stable | ||
43 | - os: linux | ||
44 | env: TARGET=i686-unknown-linux-gnu | ||
45 | rust: stable | ||
46 | - os: osx | ||
47 | env: TARGET=x86_64-apple-darwin | ||
48 | rust: stable | ||
49 | - os: osx | ||
50 | env: TARGET=i686-apple-darwin | ||
51 | rust: stable | ||
52 | - os: linux | ||
53 | env: TARGET=arm-linux-androideabi | ||
54 | rust: stable | ||
55 | - os: linux | ||
56 | env: TARGET=x86_64-unknown-linux-musl | ||
57 | rust: stable | ||
58 | - os: linux | ||
59 | env: TARGET=arm-unknown-linux-gnueabihf | ||
60 | rust: stable | ||
61 | - os: linux | ||
62 | env: TARGET=aarch64-unknown-linux-gnu | ||
63 | rust: stable | ||
64 | - os: osx | ||
65 | env: TARGET=i386-apple-ios | ||
66 | rust: stable | ||
67 | - os: osx | ||
68 | env: TARGET=x86_64-apple-ios | ||
69 | rust: stable | ||
70 | - os: linux | ||
71 | env: TARGET=x86_64-rumprun-netbsd | ||
72 | rust: stable | ||
73 | |||
74 | # beta | ||
75 | - os: linux | ||
76 | env: TARGET=x86_64-unknown-linux-gnu | ||
77 | rust: beta | ||
78 | - os: osx | ||
79 | env: TARGET=x86_64-apple-darwin | ||
80 | rust: beta | ||
81 | |||
82 | # nightly | ||
83 | - os: linux | ||
84 | env: TARGET=x86_64-unknown-linux-gnu | ||
85 | rust: nightly | ||
86 | - os: osx | ||
87 | env: TARGET=x86_64-apple-darwin | ||
88 | rust: nightly | ||
89 | - os: linux | ||
90 | env: TARGET=mips-unknown-linux-gnu | ||
91 | # not sure why this has to be nightly... | ||
92 | rust: nightly | ||
93 | |||
94 | # QEMU based targets that compile in an emulator | ||
95 | - os: linux | ||
96 | env: TARGET=x86_64-unknown-freebsd | ||
97 | rust: stable | ||
98 | - os: linux | ||
99 | env: TARGET=x86_64-unknown-openbsd QEMU=openbsd.qcow2 | ||
100 | rust: stable | ||
101 | script: sh ci/run-docker.sh $TARGET | ||
102 | install: | ||
103 | |||
104 | notifications: | ||
105 | email: | ||
106 | on_success: never | ||
107 | webhooks: http://buildbot.rust-lang.org/homu/travis | ||
diff --git a/third_party/libc/Cargo.toml b/third_party/libc/Cargo.toml new file mode 100644 index 0000000..ed18494 --- /dev/null +++ b/third_party/libc/Cargo.toml | |||
@@ -0,0 +1,18 @@ | |||
1 | [package] | ||
2 | |||
3 | name = "libc" | ||
4 | version = "0.2.15" | ||
5 | authors = ["The Rust Project Developers"] | ||
6 | license = "MIT/Apache-2.0" | ||
7 | readme = "README.md" | ||
8 | repository = "https://github.com/rust-lang/libc" | ||
9 | homepage = "https://github.com/rust-lang/libc" | ||
10 | documentation = "http://doc.rust-lang.org/libc" | ||
11 | description = """ | ||
12 | A library for types and bindings to native C functions often found in libc or | ||
13 | other common platform libraries. | ||
14 | """ | ||
15 | |||
16 | [features] | ||
17 | default = ["use_std"] | ||
18 | use_std = [] | ||
diff --git a/third_party/libc/LICENSE-APACHE b/third_party/libc/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/third_party/libc/LICENSE-APACHE | |||
@@ -0,0 +1,201 @@ | |||
1 | Apache License | ||
2 | Version 2.0, January 2004 | ||
3 | http://www.apache.org/licenses/ | ||
4 | |||
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
6 | |||
7 | 1. Definitions. | ||
8 | |||
9 | "License" shall mean the terms and conditions for use, reproduction, | ||
10 | and distribution as defined by Sections 1 through 9 of this document. | ||
11 | |||
12 | "Licensor" shall mean the copyright owner or entity authorized by | ||
13 | the copyright owner that is granting the License. | ||
14 | |||
15 | "Legal Entity" shall mean the union of the acting entity and all | ||
16 | other entities that control, are controlled by, or are under common | ||
17 | control with that entity. For the purposes of this definition, | ||
18 | "control" means (i) the power, direct or indirect, to cause the | ||
19 | direction or management of such entity, whether by contract or | ||
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
21 | outstanding shares, or (iii) beneficial ownership of such entity. | ||
22 | |||
23 | "You" (or "Your") shall mean an individual or Legal Entity | ||
24 | exercising permissions granted by this License. | ||
25 | |||
26 | "Source" form shall mean the preferred form for making modifications, | ||
27 | including but not limited to software source code, documentation | ||
28 | source, and configuration files. | ||
29 | |||
30 | "Object" form shall mean any form resulting from mechanical | ||
31 | transformation or translation of a Source form, including but | ||
32 | not limited to compiled object code, generated documentation, | ||
33 | and conversions to other media types. | ||
34 | |||
35 | "Work" shall mean the work of authorship, whether in Source or | ||
36 | Object form, made available under the License, as indicated by a | ||
37 | copyright notice that is included in or attached to the work | ||
38 | (an example is provided in the Appendix below). | ||
39 | |||
40 | "Derivative Works" shall mean any work, whether in Source or Object | ||
41 | form, that is based on (or derived from) the Work and for which the | ||
42 | editorial revisions, annotations, elaborations, or other modifications | ||
43 | represent, as a whole, an original work of authorship. For the purposes | ||
44 | of this License, Derivative Works shall not include works that remain | ||
45 | separable from, or merely link (or bind by name) to the interfaces of, | ||
46 | the Work and Derivative Works thereof. | ||
47 | |||
48 | "Contribution" shall mean any work of authorship, including | ||
49 | the original version of the Work and any modifications or additions | ||
50 | to that Work or Derivative Works thereof, that is intentionally | ||
51 | submitted to Licensor for inclusion in the Work by the copyright owner | ||
52 | or by an individual or Legal Entity authorized to submit on behalf of | ||
53 | the copyright owner. For the purposes of this definition, "submitted" | ||
54 | means any form of electronic, verbal, or written communication sent | ||
55 | to the Licensor or its representatives, including but not limited to | ||
56 | communication on electronic mailing lists, source code control systems, | ||
57 | and issue tracking systems that are managed by, or on behalf of, the | ||
58 | Licensor for the purpose of discussing and improving the Work, but | ||
59 | excluding communication that is conspicuously marked or otherwise | ||
60 | designated in writing by the copyright owner as "Not a Contribution." | ||
61 | |||
62 | "Contributor" shall mean Licensor and any individual or Legal Entity | ||
63 | on behalf of whom a Contribution has been received by Licensor and | ||
64 | subsequently incorporated within the Work. | ||
65 | |||
66 | 2. Grant of Copyright License. Subject to the terms and conditions of | ||
67 | this License, each Contributor hereby grants to You a perpetual, | ||
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
69 | copyright license to reproduce, prepare Derivative Works of, | ||
70 | publicly display, publicly perform, sublicense, and distribute the | ||
71 | Work and such Derivative Works in Source or Object form. | ||
72 | |||
73 | 3. Grant of Patent License. Subject to the terms and conditions of | ||
74 | this License, each Contributor hereby grants to You a perpetual, | ||
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
76 | (except as stated in this section) patent license to make, have made, | ||
77 | use, offer to sell, sell, import, and otherwise transfer the Work, | ||
78 | where such license applies only to those patent claims licensable | ||
79 | by such Contributor that are necessarily infringed by their | ||
80 | Contribution(s) alone or by combination of their Contribution(s) | ||
81 | with the Work to which such Contribution(s) was submitted. If You | ||
82 | institute patent litigation against any entity (including a | ||
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work | ||
84 | or a Contribution incorporated within the Work constitutes direct | ||
85 | or contributory patent infringement, then any patent licenses | ||
86 | granted to You under this License for that Work shall terminate | ||
87 | as of the date such litigation is filed. | ||
88 | |||
89 | 4. Redistribution. You may reproduce and distribute copies of the | ||
90 | Work or Derivative Works thereof in any medium, with or without | ||
91 | modifications, and in Source or Object form, provided that You | ||
92 | meet the following conditions: | ||
93 | |||
94 | (a) You must give any other recipients of the Work or | ||
95 | Derivative Works a copy of this License; and | ||
96 | |||
97 | (b) You must cause any modified files to carry prominent notices | ||
98 | stating that You changed the files; and | ||
99 | |||
100 | (c) You must retain, in the Source form of any Derivative Works | ||
101 | that You distribute, all copyright, patent, trademark, and | ||
102 | attribution notices from the Source form of the Work, | ||
103 | excluding those notices that do not pertain to any part of | ||
104 | the Derivative Works; and | ||
105 | |||
106 | (d) If the Work includes a "NOTICE" text file as part of its | ||
107 | distribution, then any Derivative Works that You distribute must | ||
108 | include a readable copy of the attribution notices contained | ||
109 | within such NOTICE file, excluding those notices that do not | ||
110 | pertain to any part of the Derivative Works, in at least one | ||
111 | of the following places: within a NOTICE text file distributed | ||
112 | as part of the Derivative Works; within the Source form or | ||
113 | documentation, if provided along with the Derivative Works; or, | ||
114 | within a display generated by the Derivative Works, if and | ||
115 | wherever such third-party notices normally appear. The contents | ||
116 | of the NOTICE file are for informational purposes only and | ||
117 | do not modify the License. You may add Your own attribution | ||
118 | notices within Derivative Works that You distribute, alongside | ||
119 | or as an addendum to the NOTICE text from the Work, provided | ||
120 | that such additional attribution notices cannot be construed | ||
121 | as modifying the License. | ||
122 | |||
123 | You may add Your own copyright statement to Your modifications and | ||
124 | may provide additional or different license terms and conditions | ||
125 | for use, reproduction, or distribution of Your modifications, or | ||
126 | for any such Derivative Works as a whole, provided Your use, | ||
127 | reproduction, and distribution of the Work otherwise complies with | ||
128 | the conditions stated in this License. | ||
129 | |||
130 | 5. Submission of Contributions. Unless You explicitly state otherwise, | ||
131 | any Contribution intentionally submitted for inclusion in the Work | ||
132 | by You to the Licensor shall be under the terms and conditions of | ||
133 | this License, without any additional terms or conditions. | ||
134 | Notwithstanding the above, nothing herein shall supersede or modify | ||
135 | the terms of any separate license agreement you may have executed | ||
136 | with Licensor regarding such Contributions. | ||
137 | |||
138 | 6. Trademarks. This License does not grant permission to use the trade | ||
139 | names, trademarks, service marks, or product names of the Licensor, | ||
140 | except as required for reasonable and customary use in describing the | ||
141 | origin of the Work and reproducing the content of the NOTICE file. | ||
142 | |||
143 | 7. Disclaimer of Warranty. Unless required by applicable law or | ||
144 | agreed to in writing, Licensor provides the Work (and each | ||
145 | Contributor provides its Contributions) on an "AS IS" BASIS, | ||
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
147 | implied, including, without limitation, any warranties or conditions | ||
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
149 | PARTICULAR PURPOSE. You are solely responsible for determining the | ||
150 | appropriateness of using or redistributing the Work and assume any | ||
151 | risks associated with Your exercise of permissions under this License. | ||
152 | |||
153 | 8. Limitation of Liability. In no event and under no legal theory, | ||
154 | whether in tort (including negligence), contract, or otherwise, | ||
155 | unless required by applicable law (such as deliberate and grossly | ||
156 | negligent acts) or agreed to in writing, shall any Contributor be | ||
157 | liable to You for damages, including any direct, indirect, special, | ||
158 | incidental, or consequential damages of any character arising as a | ||
159 | result of this License or out of the use or inability to use the | ||
160 | Work (including but not limited to damages for loss of goodwill, | ||
161 | work stoppage, computer failure or malfunction, or any and all | ||
162 | other commercial damages or losses), even if such Contributor | ||
163 | has been advised of the possibility of such damages. | ||
164 | |||
165 | 9. Accepting Warranty or Additional Liability. While redistributing | ||
166 | the Work or Derivative Works thereof, You may choose to offer, | ||
167 | and charge a fee for, acceptance of support, warranty, indemnity, | ||
168 | or other liability obligations and/or rights consistent with this | ||
169 | License. However, in accepting such obligations, You may act only | ||
170 | on Your own behalf and on Your sole responsibility, not on behalf | ||
171 | of any other Contributor, and only if You agree to indemnify, | ||
172 | defend, and hold each Contributor harmless for any liability | ||
173 | incurred by, or claims asserted against, such Contributor by reason | ||
174 | of your accepting any such warranty or additional liability. | ||
175 | |||
176 | END OF TERMS AND CONDITIONS | ||
177 | |||
178 | APPENDIX: How to apply the Apache License to your work. | ||
179 | |||
180 | To apply the Apache License to your work, attach the following | ||
181 | boilerplate notice, with the fields enclosed by brackets "[]" | ||
182 | replaced with your own identifying information. (Don't include | ||
183 | the brackets!) The text should be enclosed in the appropriate | ||
184 | comment syntax for the file format. We also recommend that a | ||
185 | file or class name and description of purpose be included on the | ||
186 | same "printed page" as the copyright notice for easier | ||
187 | identification within third-party archives. | ||
188 | |||
189 | Copyright [yyyy] [name of copyright owner] | ||
190 | |||
191 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
192 | you may not use this file except in compliance with the License. | ||
193 | You may obtain a copy of the License at | ||
194 | |||
195 | http://www.apache.org/licenses/LICENSE-2.0 | ||
196 | |||
197 | Unless required by applicable law or agreed to in writing, software | ||
198 | distributed under the License is distributed on an "AS IS" BASIS, | ||
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
200 | See the License for the specific language governing permissions and | ||
201 | limitations under the License. | ||
diff --git a/third_party/libc/LICENSE-MIT b/third_party/libc/LICENSE-MIT new file mode 100644 index 0000000..39d4bdb --- /dev/null +++ b/third_party/libc/LICENSE-MIT | |||
@@ -0,0 +1,25 @@ | |||
1 | Copyright (c) 2014 The Rust Project Developers | ||
2 | |||
3 | Permission is hereby granted, free of charge, to any | ||
4 | person obtaining a copy of this software and associated | ||
5 | documentation files (the "Software"), to deal in the | ||
6 | Software without restriction, including without | ||
7 | limitation the rights to use, copy, modify, merge, | ||
8 | publish, distribute, sublicense, and/or sell copies of | ||
9 | the Software, and to permit persons to whom the Software | ||
10 | is furnished to do so, subject to the following | ||
11 | conditions: | ||
12 | |||
13 | The above copyright notice and this permission notice | ||
14 | shall be included in all copies or substantial portions | ||
15 | of the Software. | ||
16 | |||
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF | ||
18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | ||
21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR | ||
24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
25 | DEALINGS IN THE SOFTWARE. | ||
diff --git a/third_party/libc/README.md b/third_party/libc/README.md new file mode 100644 index 0000000..09b9a56 --- /dev/null +++ b/third_party/libc/README.md | |||
@@ -0,0 +1,135 @@ | |||
1 | libc | ||
2 | ==== | ||
3 | |||
4 | A Rust library with native bindings to the types and functions commonly found on | ||
5 | various systems, including libc. | ||
6 | |||
7 | [![Build Status](https://travis-ci.org/rust-lang/libc.svg?branch=master)](https://travis-ci.org/rust-lang/libc) | ||
8 | [![Build status](https://ci.appveyor.com/api/projects/status/34csq3uurnw7c0rl?svg=true)](https://ci.appveyor.com/project/alexcrichton/libc) | ||
9 | |||
10 | [Documentation](#platforms-and-documentation) | ||
11 | |||
12 | ## Usage | ||
13 | |||
14 | First, add the following to your `Cargo.toml`: | ||
15 | |||
16 | ```toml | ||
17 | [dependencies] | ||
18 | libc = "0.2" | ||
19 | ``` | ||
20 | |||
21 | Next, add this to your crate root: | ||
22 | |||
23 | ```rust | ||
24 | extern crate libc; | ||
25 | ``` | ||
26 | |||
27 | Currently libc by default links to the standard library, but if you would | ||
28 | instead like to use libc in a `#![no_std]` situation or crate you can request | ||
29 | this via: | ||
30 | |||
31 | ```toml | ||
32 | [dependencies] | ||
33 | libc = { version = "0.2", default-features = false } | ||
34 | ``` | ||
35 | |||
36 | ## What is libc? | ||
37 | |||
38 | The primary purpose of this crate is to provide all of the definitions necessary | ||
39 | to easily interoperate with C code (or "C-like" code) on each of the platforms | ||
40 | that Rust supports. This includes type definitions (e.g. `c_int`), constants | ||
41 | (e.g. `EINVAL`) as well as function headers (e.g. `malloc`). | ||
42 | |||
43 | This crate does not strive to have any form of compatibility across platforms, | ||
44 | but rather it is simply a straight binding to the system libraries on the | ||
45 | platform in question. | ||
46 | |||
47 | ## Public API | ||
48 | |||
49 | This crate exports all underlying platform types, functions, and constants under | ||
50 | the crate root, so all items are accessible as `libc::foo`. The types and values | ||
51 | of all the exported APIs match the platform that libc is compiled for. | ||
52 | |||
53 | More detailed information about the design of this library can be found in its | ||
54 | [associated RFC][rfc]. | ||
55 | |||
56 | [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1291-promote-libc.md | ||
57 | |||
58 | ## Adding an API | ||
59 | |||
60 | Want to use an API which currently isn't bound in `libc`? It's quite easy to add | ||
61 | one! | ||
62 | |||
63 | The internal structure of this crate is designed to minimize the number of | ||
64 | `#[cfg]` attributes in order to easily be able to add new items which apply | ||
65 | to all platforms in the future. As a result, the crate is organized | ||
66 | hierarchically based on platform. Each module has a number of `#[cfg]`'d | ||
67 | children, but only one is ever actually compiled. Each module then reexports all | ||
68 | the contents of its children. | ||
69 | |||
70 | This means that for each platform that libc supports, the path from a | ||
71 | leaf module to the root will contain all bindings for the platform in question. | ||
72 | Consequently, this indicates where an API should be added! Adding an API at a | ||
73 | particular level in the hierarchy means that it is supported on all the child | ||
74 | platforms of that level. For example, when adding a Unix API it should be added | ||
75 | to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to | ||
76 | `src/unix/notbsd/linux/mod.rs`. | ||
77 | |||
78 | If you're not 100% sure at what level of the hierarchy an API should be added | ||
79 | at, fear not! This crate has CI support which tests any binding against all | ||
80 | platforms supported, so you'll see failures if an API is added at the wrong | ||
81 | level or has different signatures across platforms. | ||
82 | |||
83 | With that in mind, the steps for adding a new API are: | ||
84 | |||
85 | 1. Determine where in the module hierarchy your API should be added. | ||
86 | 2. Add the API. | ||
87 | 3. Send a PR to this repo. | ||
88 | 4. Wait for CI to pass, fixing errors. | ||
89 | 5. Wait for a merge! | ||
90 | |||
91 | ### Test before you commit | ||
92 | |||
93 | We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc): | ||
94 | |||
95 | 1. [`libc-test`](https://github.com/alexcrichton/ctest) | ||
96 | - `cd libc-test && cargo run` | ||
97 | - Use the `skip_*()` functions in `build.rs` if you really need a workaround. | ||
98 | 2. Style checker | ||
99 | - `rustc ci/style.rs && ./style src` | ||
100 | |||
101 | ## Platforms and Documentation | ||
102 | |||
103 | The following platforms are currently tested and have documentation available: | ||
104 | |||
105 | Tested: | ||
106 | * [`i686-pc-windows-msvc`](https://doc.rust-lang.org/libc/i686-pc-windows-msvc/libc/) | ||
107 | * [`x86_64-pc-windows-msvc`](https://doc.rust-lang.org/libc/x86_64-pc-windows-msvc/libc/) | ||
108 | (Windows) | ||
109 | * [`i686-pc-windows-gnu`](https://doc.rust-lang.org/libc/i686-pc-windows-gnu/libc/) | ||
110 | * [`x86_64-pc-windows-gnu`](https://doc.rust-lang.org/libc/x86_64-pc-windows-gnu/libc/) | ||
111 | * [`i686-apple-darwin`](https://doc.rust-lang.org/libc/i686-apple-darwin/libc/) | ||
112 | * [`x86_64-apple-darwin`](https://doc.rust-lang.org/libc/x86_64-apple-darwin/libc/) | ||
113 | (OSX) | ||
114 | * `i686-apple-ios` | ||
115 | * `x86_64-apple-ios` | ||
116 | * [`i686-unknown-linux-gnu`](https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/) | ||
117 | * [`x86_64-unknown-linux-gnu`](https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu/libc/) | ||
118 | (Linux) | ||
119 | * [`x86_64-unknown-linux-musl`](https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl/libc/) | ||
120 | (Linux MUSL) | ||
121 | * [`aarch64-unknown-linux-gnu`](https://doc.rust-lang.org/libc/aarch64-unknown-linux-gnu/libc/) | ||
122 | * [`mips-unknown-linux-gnu`](https://doc.rust-lang.org/libc/mips-unknown-linux-gnu/libc/) | ||
123 | * [`arm-unknown-linux-gnueabihf`](https://doc.rust-lang.org/libc/arm-unknown-linux-gnueabihf/libc/) | ||
124 | * [`arm-linux-androideabi`](https://doc.rust-lang.org/libc/arm-linux-androideabi/libc/) | ||
125 | (Android) | ||
126 | * [`x86_64-unknown-freebsd`](https://doc.rust-lang.org/libc/x86_64-unknown-freebsd/libc/) | ||
127 | * [`x86_64-unknown-openbsd`](https://doc.rust-lang.org/libc/x86_64-unknown-openbsd/libc/) | ||
128 | * [`x86_64-rumprun-netbsd`](https://doc.rust-lang.org/libc/x86_64-unknown-netbsd/libc/) | ||
129 | |||
130 | The following may be supported, but are not guaranteed to always work: | ||
131 | |||
132 | * `i686-unknown-freebsd` | ||
133 | * [`x86_64-unknown-bitrig`](https://doc.rust-lang.org/libc/x86_64-unknown-bitrig/libc/) | ||
134 | * [`x86_64-unknown-dragonfly`](https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly/libc/) | ||
135 | * [`x86_64-unknown-netbsd`](https://doc.rust-lang.org/libc/x86_64-unknown-netbsd/libc/) | ||
diff --git a/third_party/libc/appveyor.yml b/third_party/libc/appveyor.yml new file mode 100644 index 0000000..93bd0f9 --- /dev/null +++ b/third_party/libc/appveyor.yml | |||
@@ -0,0 +1,21 @@ | |||
1 | environment: | ||
2 | matrix: | ||
3 | - TARGET: x86_64-pc-windows-gnu | ||
4 | MSYS2_BITS: 64 | ||
5 | - TARGET: i686-pc-windows-gnu | ||
6 | MSYS2_BITS: 32 | ||
7 | - TARGET: x86_64-pc-windows-msvc | ||
8 | - TARGET: i686-pc-windows-msvc | ||
9 | install: | ||
10 | - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" | ||
11 | - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" | ||
12 | - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin | ||
13 | - if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin | ||
14 | - rustc -V | ||
15 | - cargo -V | ||
16 | |||
17 | build: false | ||
18 | |||
19 | test_script: | ||
20 | - cargo test | ||
21 | - cargo run --manifest-path libc-test/Cargo.toml | ||
diff --git a/third_party/libc/ci/README.md b/third_party/libc/ci/README.md new file mode 100644 index 0000000..13c7c8d --- /dev/null +++ b/third_party/libc/ci/README.md | |||
@@ -0,0 +1,203 @@ | |||
1 | The goal of the libc crate is to have CI running everywhere to have the | ||
2 | strongest guarantees about the definitions that this library contains, and as a | ||
3 | result the CI is pretty complicated and also pretty large! Hopefully this can | ||
4 | serve as a guide through the sea of scripts in this directory and elsewhere in | ||
5 | this project. | ||
6 | |||
7 | # Files | ||
8 | |||
9 | First up, let's talk about the files in this directory: | ||
10 | |||
11 | * `run-travis.sh` - a shell script run by all Travis builders, this is | ||
12 | responsible for setting up the rest of the environment such as installing new | ||
13 | packages, downloading Rust target libraries, etc. | ||
14 | |||
15 | * `run.sh` - the actual script which runs tests for a particular architecture. | ||
16 | Called from the `run-travis.sh` script this will run all tests for the target | ||
17 | specified. | ||
18 | |||
19 | * `cargo-config` - Cargo configuration of linkers to use copied into place by | ||
20 | the `run-travis.sh` script before builds are run. | ||
21 | |||
22 | * `dox.sh` - script called from `run-travis.sh` on only the linux 64-bit nightly | ||
23 | Travis bots to build documentation for this crate. | ||
24 | |||
25 | * `landing-page-*.html` - used by `dox.sh` to generate a landing page for all | ||
26 | architectures' documentation. | ||
27 | |||
28 | * `run-qemu.sh` - see discussion about QEMU below | ||
29 | |||
30 | * `mips`, `rumprun` - instructions to build the docker image for each respective | ||
31 | CI target | ||
32 | |||
33 | # CI Systems | ||
34 | |||
35 | Currently this repository leverages a combination of Travis CI and AppVeyor for | ||
36 | running tests. The triples tested are: | ||
37 | |||
38 | * AppVeyor | ||
39 | * `{i686,x86_64}-pc-windows-{msvc,gnu}` | ||
40 | * Travis | ||
41 | * `{i686,x86_64,mips,aarch64}-unknown-linux-gnu` | ||
42 | * `x86_64-unknown-linux-musl` | ||
43 | * `arm-unknown-linux-gnueabihf` | ||
44 | * `arm-linux-androideabi` | ||
45 | * `{i686,x86_64}-apple-{darwin,ios}` | ||
46 | * `x86_64-rumprun-netbsd` | ||
47 | * `x86_64-unknown-freebsd` | ||
48 | * `x86_64-unknown-openbsd` | ||
49 | |||
50 | The Windows triples are all pretty standard, they just set up their environment | ||
51 | then run tests, no need for downloading any extra target libs (we just download | ||
52 | the right installer). The Intel Linux/OSX builds are similar in that we just | ||
53 | download the right target libs and run tests. Note that the Intel Linux/OSX | ||
54 | builds are run on stable/beta/nightly, but are the only ones that do so. | ||
55 | |||
56 | The remaining architectures look like: | ||
57 | |||
58 | * Android runs in a [docker image][android-docker] with an emulator, the NDK, | ||
59 | and the SDK already set up. The entire build happens within the docker image. | ||
60 | * The MIPS, ARM, and AArch64 builds all use the QEMU userspace emulator to run | ||
61 | the generated binary to actually verify the tests pass. | ||
62 | * The MUSL build just has to download a MUSL compiler and target libraries and | ||
63 | then otherwise runs tests normally. | ||
64 | * iOS builds need an extra linker flag currently, but beyond that they're built | ||
65 | as standard as everything else. | ||
66 | * The rumprun target builds an entire kernel from the test suite and then runs | ||
67 | it inside QEMU using the serial console to test whether it succeeded or | ||
68 | failed. | ||
69 | * The BSD builds, currently OpenBSD and FreeBSD, use QEMU to boot up a system | ||
70 | and compile/run tests. More information on that below. | ||
71 | |||
72 | [android-docker]: https://github.com/rust-lang/rust-buildbot/blob/master/slaves/android/Dockerfile | ||
73 | |||
74 | ## QEMU | ||
75 | |||
76 | Lots of the architectures tested here use QEMU in the tests, so it's worth going | ||
77 | over all the crazy capabilities QEMU has and the various flavors in which we use | ||
78 | it! | ||
79 | |||
80 | First up, QEMU has userspace emulation where it doesn't boot a full kernel, it | ||
81 | just runs a binary from another architecture (using the `qemu-<arch>` wrappers). | ||
82 | We provide it the runtime path for the dynamically loaded system libraries, | ||
83 | however. This strategy is used for all Linux architectures that aren't intel. | ||
84 | Note that one downside of this QEMU system is that threads are barely | ||
85 | implemented, so we're careful to not spawn many threads. | ||
86 | |||
87 | For the rumprun target the only output is a kernel image, so we just use that | ||
88 | plus the `rumpbake` command to create a full kernel image which is then run from | ||
89 | within QEMU. | ||
90 | |||
91 | Finally, the fun part, the BSDs. Quite a few hoops are jumped through to get CI | ||
92 | working for these platforms, but the gist of it looks like: | ||
93 | |||
94 | * Cross compiling from Linux to any of the BSDs seems to be quite non-standard. | ||
95 | We may be able to get it working but it might be difficult at that point to | ||
96 | ensure that the libc definitions align with what you'd get on the BSD itself. | ||
97 | As a result, we try to do compiles within the BSD distro. | ||
98 | * On Travis we can't run a VM-in-a-VM, so we resort to userspace emulation | ||
99 | (QEMU). | ||
100 | * Unfortunately on Travis we also can't use KVM, so the emulation is super slow. | ||
101 | |||
102 | With all that in mind, the way BSD is tested looks like: | ||
103 | |||
104 | 1. Download a pre-prepared image for the OS being tested. | ||
105 | 2. Generate the tests for the OS being tested. This involves running the `ctest` | ||
106 | library over libc to generate a Rust file and a C file which will then be | ||
107 | compiled into the final test. | ||
108 | 3. Generate a disk image which will later be mounted by the OS being tested. | ||
109 | This image is mostly just the libc directory, but some modifications are made | ||
110 | to compile the generated files from step 2. | ||
111 | 4. The kernel is booted in QEMU, and it is configured to detect the libc-test | ||
112 | image being available, run the test script, and then shut down afterwards. | ||
113 | 5. Look for whether the tests passed in the serial console output of the kernel. | ||
114 | |||
115 | There's some pretty specific instructions for setting up each image (detailed | ||
116 | below), but the main gist of this is that we must avoid a vanilla `cargo run` | ||
117 | inside of the `libc-test` directory (which is what it's intended for) because | ||
118 | that would compile `syntex_syntax`, a large library, with userspace emulation. | ||
119 | This invariably times out on Travis, so we can't do that. | ||
120 | |||
121 | Once all those hoops are jumped through, however, we can be happy that we're | ||
122 | testing almost everything! | ||
123 | |||
124 | Below are some details of how to set up the initial OS images which are | ||
125 | downloaded. Each image must be enabled have input/output over the serial | ||
126 | console, log in automatically at the serial console, detect if a second drive in | ||
127 | QEMU is available, and if so mount it, run a script (it'll specifically be | ||
128 | `run-qemu.sh` in this folder which is copied into the generated image talked | ||
129 | about above), and then shut down. | ||
130 | |||
131 | ### QEMU setup - FreeBSD | ||
132 | |||
133 | 1. Download CD installer (most minimal is fine) | ||
134 | 2. `qemu-img create -f qcow2 foo.qcow2 2G` | ||
135 | 3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user` | ||
136 | 4. run installer | ||
137 | 5. `echo 'console="comconsole"' >> /boot/loader.conf` | ||
138 | 6. `echo 'autoboot_delay="0"' >> /boot/loader.conf` | ||
139 | 7. look at /etc/ttys, see what getty argument is for ttyu0 | ||
140 | 8. edit /etc/gettytab, look for ttyu0 argument, prepend `:al=root` to line | ||
141 | beneath | ||
142 | |||
143 | (note that the current image has a `freebsd` user, but this isn't really | ||
144 | necessary) | ||
145 | |||
146 | Once that's done, arrange for this script to run at login: | ||
147 | |||
148 | ``` | ||
149 | #!/bin/sh | ||
150 | |||
151 | sudo kldload ext2fs | ||
152 | [ -e /dev/vtbd1 ] || exit 0 | ||
153 | sudo mount -t ext2fs /dev/vtbd1 /mnt | ||
154 | sh /mnt/run.sh /mnt | ||
155 | sudo poweroff | ||
156 | ``` | ||
157 | |||
158 | Helpful links | ||
159 | |||
160 | * https://en.wikibooks.org/wiki/QEMU/Images | ||
161 | * https://blog.nekoconeko.nl/blog/2015/06/04/creating-an-openstack-freebsd-image.html | ||
162 | * https://www.freebsd.org/doc/handbook/serialconsole-setup.html | ||
163 | |||
164 | |||
165 | ### QEMU setup - OpenBSD | ||
166 | |||
167 | 1. Download CD installer | ||
168 | 2. `qemu-img create -f qcow2 foo.qcow2 2G` | ||
169 | 3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user` | ||
170 | 4. run installer | ||
171 | 5. `echo 'set tty com0' >> /etc/boot.conf` | ||
172 | 6. `echo 'boot' >> /etc/boot.conf` | ||
173 | 7. Modify /etc/ttys, change the `tty00` at the end from 'unknown off' to | ||
174 | 'vt220 on secure' | ||
175 | 8. Modify same line in /etc/ttys to have `"/root/foo.sh"` as the shell | ||
176 | 9. Add this script to `/root/foo.sh` | ||
177 | |||
178 | ``` | ||
179 | #!/bin/sh | ||
180 | exec 1>/dev/tty00 | ||
181 | exec 2>&1 | ||
182 | |||
183 | if mount -t ext2fs /dev/sd1c /mnt; then | ||
184 | sh /mnt/run.sh /mnt | ||
185 | shutdown -ph now | ||
186 | fi | ||
187 | |||
188 | # limited shell... | ||
189 | exec /bin/sh < /dev/tty00 | ||
190 | ``` | ||
191 | |||
192 | 10. `chmod +x /root/foo.sh` | ||
193 | |||
194 | Helpful links: | ||
195 | |||
196 | * https://en.wikibooks.org/wiki/QEMU/Images | ||
197 | * http://www.openbsd.org/faq/faq7.html#SerCon | ||
198 | |||
199 | # Questions? | ||
200 | |||
201 | Hopefully that's at least somewhat of an introduction to everything going on | ||
202 | here, and feel free to ping @alexcrichton with questions! | ||
203 | |||
diff --git a/third_party/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/third_party/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000..1c7235c --- /dev/null +++ b/third_party/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile | |||
@@ -0,0 +1,7 @@ | |||
1 | FROM ubuntu:14.04 | ||
2 | RUN apt-get update | ||
3 | RUN apt-get install -y --no-install-recommends \ | ||
4 | gcc libc6-dev ca-certificates \ | ||
5 | gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user | ||
6 | ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ | ||
7 | PATH=$PATH:/rust/bin | ||
diff --git a/third_party/libc/ci/docker/arm-linux-androideabi/Dockerfile b/third_party/libc/ci/docker/arm-linux-androideabi/Dockerfile new file mode 100644 index 0000000..0e41ba6 --- /dev/null +++ b/third_party/libc/ci/docker/arm-linux-androideabi/Dockerfile | |||
@@ -0,0 +1,4 @@ | |||
1 | FROM alexcrichton/rust-slave-android:2015-11-22 | ||
2 | ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ | ||
3 | PATH=$PATH:/rust/bin | ||
4 | ENTRYPOINT ["sh"] | ||
diff --git a/third_party/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/third_party/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile new file mode 100644 index 0000000..3a858e3 --- /dev/null +++ b/third_party/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile | |||
@@ -0,0 +1,7 @@ | |||
1 | FROM ubuntu:16.04 | ||
2 | RUN apt-get update | ||
3 | RUN apt-get install -y --no-install-recommends \ | ||
4 | gcc libc6-dev ca-certificates \ | ||
5 | gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user | ||
6 | ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \ | ||
7 | PATH=$PATH:/rust/bin | ||
diff --git a/third_party/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile b/third_party/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000..63450ff --- /dev/null +++ b/third_party/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile | |||
@@ -0,0 +1,5 @@ | |||
1 | FROM ubuntu:16.04 | ||
2 | RUN apt-get update | ||
3 | RUN apt-get install -y --no-install-recommends \ | ||
4 | gcc-multilib libc6-dev ca-certificates | ||
5 | ENV PATH=$PATH:/rust/bin | ||
diff --git a/third_party/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile b/third_party/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000..8eb6a26 --- /dev/null +++ b/third_party/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile | |||
@@ -0,0 +1,13 @@ | |||
1 | FROM ubuntu:15.10 | ||
2 | |||
3 | RUN apt-get update | ||
4 | RUN apt-get install -y --no-install-recommends \ | ||
5 | software-properties-common gcc libc6-dev qemu-user | ||
6 | RUN add-apt-repository ppa:angelsl/mips-cross | ||
7 | RUN apt-get update | ||
8 | RUN apt-get install -y --no-install-recommends \ | ||
9 | gcc-5-mips-linux-gnu libc6-dev-mips-cross | ||
10 | |||
11 | ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc-5 \ | ||
12 | CC_mips_unknown_linux_gnu=mips-linux-gnu-gcc-5 \ | ||
13 | PATH=$PATH:/rust/bin | ||
diff --git a/third_party/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile b/third_party/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile new file mode 100644 index 0000000..129771e --- /dev/null +++ b/third_party/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile | |||
@@ -0,0 +1,6 @@ | |||
1 | FROM mato/rumprun-toolchain-hw-x86_64 | ||
2 | USER root | ||
3 | RUN apt-get update | ||
4 | RUN apt-get install -y --no-install-recommends \ | ||
5 | qemu | ||
6 | ENV PATH=$PATH:/rust/bin | ||
diff --git a/third_party/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile b/third_party/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile new file mode 100644 index 0000000..bffcaa0 --- /dev/null +++ b/third_party/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile | |||
@@ -0,0 +1,13 @@ | |||
1 | FROM alexcrichton/rust-slave-linux-cross:2016-04-15 | ||
2 | USER root | ||
3 | |||
4 | RUN apt-get update | ||
5 | RUN apt-get install -y --no-install-recommends \ | ||
6 | qemu qemu-kvm kmod cpu-checker | ||
7 | |||
8 | ENTRYPOINT ["sh"] | ||
9 | |||
10 | ENV PATH=$PATH:/rust/bin \ | ||
11 | QEMU=freebsd.qcow2 \ | ||
12 | CAN_CROSS=1 \ | ||
13 | CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc | ||
diff --git a/third_party/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/third_party/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000..294a062 --- /dev/null +++ b/third_party/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile | |||
@@ -0,0 +1,5 @@ | |||
1 | FROM ubuntu:16.04 | ||
2 | RUN apt-get update | ||
3 | RUN apt-get install -y --no-install-recommends \ | ||
4 | gcc libc6-dev ca-certificates | ||
5 | ENV PATH=$PATH:/rust/bin | ||
diff --git a/third_party/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/third_party/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile new file mode 100644 index 0000000..f440038 --- /dev/null +++ b/third_party/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile | |||
@@ -0,0 +1,13 @@ | |||
1 | FROM ubuntu:16.04 | ||
2 | |||
3 | RUN apt-get update | ||
4 | RUN apt-get install -y --no-install-recommends \ | ||
5 | gcc make libc6-dev git curl ca-certificates | ||
6 | RUN curl https://www.musl-libc.org/releases/musl-1.1.14.tar.gz | \ | ||
7 | tar xzf - && \ | ||
8 | cd musl-1.1.14 && \ | ||
9 | ./configure --prefix=/musl-x86_64 && \ | ||
10 | make install -j4 && \ | ||
11 | cd .. && \ | ||
12 | rm -rf musl-1.1.14 | ||
13 | ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin | ||
diff --git a/third_party/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile b/third_party/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile new file mode 100644 index 0000000..f0343c1 --- /dev/null +++ b/third_party/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile | |||
@@ -0,0 +1,7 @@ | |||
1 | FROM ubuntu:16.04 | ||
2 | |||
3 | RUN apt-get update | ||
4 | RUN apt-get install -y --no-install-recommends \ | ||
5 | gcc libc6-dev qemu qemu-kvm curl ca-certificates kmod cpu-checker | ||
6 | ENV PATH=$PATH:/rust/bin \ | ||
7 | QEMU=openbsd.qcow2 | ||
diff --git a/third_party/libc/ci/dox.sh b/third_party/libc/ci/dox.sh new file mode 100644 index 0000000..88d882d --- /dev/null +++ b/third_party/libc/ci/dox.sh | |||
@@ -0,0 +1,33 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Builds documentation for all target triples that we have a registered URL for | ||
4 | # in liblibc. This scrapes the list of triples to document from `src/lib.rs` | ||
5 | # which has a bunch of `html_root_url` directives we pick up. | ||
6 | |||
7 | set -e | ||
8 | |||
9 | TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'` | ||
10 | |||
11 | rm -rf target/doc | ||
12 | mkdir -p target/doc | ||
13 | |||
14 | cp ci/landing-page-head.html target/doc/index.html | ||
15 | |||
16 | for target in $TARGETS; do | ||
17 | echo documenting $target | ||
18 | |||
19 | rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \ | ||
20 | --crate-name libc | ||
21 | |||
22 | echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \ | ||
23 | >> target/doc/index.html | ||
24 | done | ||
25 | |||
26 | cat ci/landing-page-footer.html >> target/doc/index.html | ||
27 | |||
28 | # If we're on travis, not a PR, and on the right branch, publish! | ||
29 | if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then | ||
30 | pip install ghp-import --user $USER | ||
31 | $HOME/.local/bin/ghp-import -n target/doc | ||
32 | git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages | ||
33 | fi | ||
diff --git a/third_party/libc/ci/landing-page-footer.html b/third_party/libc/ci/landing-page-footer.html new file mode 100644 index 0000000..941cc8d --- /dev/null +++ b/third_party/libc/ci/landing-page-footer.html | |||
@@ -0,0 +1,3 @@ | |||
1 | </ul> | ||
2 | </body> | ||
3 | </html> | ||
diff --git a/third_party/libc/ci/landing-page-head.html b/third_party/libc/ci/landing-page-head.html new file mode 100644 index 0000000..fc69fa8 --- /dev/null +++ b/third_party/libc/ci/landing-page-head.html | |||
@@ -0,0 +1,7 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html lang="en"> | ||
3 | <head> | ||
4 | <meta charset="utf-8"> | ||
5 | </head> | ||
6 | <body> | ||
7 | <ul> | ||
diff --git a/third_party/libc/ci/run-docker.sh b/third_party/libc/ci/run-docker.sh new file mode 100644 index 0000000..5ad9065 --- /dev/null +++ b/third_party/libc/ci/run-docker.sh | |||
@@ -0,0 +1,25 @@ | |||
1 | # Small script to run tests for a target (or all targets) inside all the | ||
2 | # respective docker images. | ||
3 | |||
4 | set -ex | ||
5 | |||
6 | run() { | ||
7 | echo $1 | ||
8 | docker build -t libc ci/docker/$1 | ||
9 | docker run \ | ||
10 | -v `rustc --print sysroot`:/rust:ro \ | ||
11 | -v `pwd`:/checkout:ro \ | ||
12 | -e CARGO_TARGET_DIR=/tmp/target \ | ||
13 | -w /checkout \ | ||
14 | --privileged \ | ||
15 | -it libc \ | ||
16 | ci/run.sh $1 | ||
17 | } | ||
18 | |||
19 | if [ -z "$1" ]; then | ||
20 | for d in `ls ci/docker/`; do | ||
21 | run $d | ||
22 | done | ||
23 | else | ||
24 | run $1 | ||
25 | fi | ||
diff --git a/third_party/libc/ci/run-qemu.sh b/third_party/libc/ci/run-qemu.sh new file mode 100644 index 0000000..70f312e --- /dev/null +++ b/third_party/libc/ci/run-qemu.sh | |||
@@ -0,0 +1,35 @@ | |||
1 | # Initial script which is run inside of all qemu images. The first argument to | ||
2 | # this script (as arranged by the qemu image itself) is the path to where the | ||
3 | # libc crate is mounted. | ||
4 | # | ||
5 | # For qemu images we currently need to install Rust manually as this wasn't done | ||
6 | # by the initial run-travis.sh script | ||
7 | # | ||
8 | # FIXME: feels like run-travis.sh should be responsible for downloading the | ||
9 | # compiler. | ||
10 | |||
11 | set -ex | ||
12 | |||
13 | ROOT=$1 | ||
14 | cp -r $ROOT/libc /tmp/libc | ||
15 | cd /tmp/libc | ||
16 | |||
17 | TARGET=$(cat $ROOT/TARGET) | ||
18 | export CARGO_TARGET_DIR=/tmp | ||
19 | |||
20 | case $TARGET in | ||
21 | *-openbsd) | ||
22 | pkg_add rust curl gcc-4.8.4p4 | ||
23 | curl https://static.rust-lang.org/cargo-dist/2015-04-02/cargo-nightly-x86_64-unknown-openbsd.tar.gz | \ | ||
24 | tar xzf - -C /tmp | ||
25 | export PATH=$PATH:/tmp/cargo-nightly-x86_64-unknown-openbsd/cargo/bin | ||
26 | export CC=egcc | ||
27 | ;; | ||
28 | |||
29 | *) | ||
30 | echo "Unknown target: $TARGET" | ||
31 | exit 1 | ||
32 | ;; | ||
33 | esac | ||
34 | |||
35 | exec sh ci/run.sh $TARGET | ||
diff --git a/third_party/libc/ci/run.sh b/third_party/libc/ci/run.sh new file mode 100755 index 0000000..aea1de8 --- /dev/null +++ b/third_party/libc/ci/run.sh | |||
@@ -0,0 +1,135 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Builds and runs tests for a particular target passed as an argument to this | ||
4 | # script. | ||
5 | |||
6 | set -ex | ||
7 | |||
8 | TARGET=$1 | ||
9 | |||
10 | # If we're going to run tests inside of a qemu image, then we don't need any of | ||
11 | # the scripts below. Instead, download the image, prepare a filesystem which has | ||
12 | # the current state of this repository, and then run the image. | ||
13 | # | ||
14 | # It's assume that all images, when run with two disks, will run the `run.sh` | ||
15 | # script from the second which we place inside. | ||
16 | if [ "$QEMU" != "" ]; then | ||
17 | tmpdir=/tmp/qemu-img-creation | ||
18 | mkdir -p $tmpdir | ||
19 | if [ ! -f $tmpdir/$QEMU ]; then | ||
20 | curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU.gz | \ | ||
21 | gunzip -d > $tmpdir/$QEMU | ||
22 | fi | ||
23 | |||
24 | # Create a mount a fresh new filesystem image that we'll later pass to QEMU. | ||
25 | # This will have a `run.sh` script will which use the artifacts inside to run | ||
26 | # on the host. | ||
27 | rm -f $tmpdir/libc-test.img | ||
28 | dd if=/dev/null of=$tmpdir/libc-test.img bs=1M seek=50 | ||
29 | mkfs.ext2 -F $tmpdir/libc-test.img | ||
30 | rm -rf $tmpdir/mount | ||
31 | mkdir $tmpdir/mount | ||
32 | mount -t ext2 -o loop $tmpdir/libc-test.img $tmpdir/mount | ||
33 | |||
34 | # If we have a cross compiler, then we just do the standard rigamarole of | ||
35 | # cross-compiling an executable and then the script to run just executes the | ||
36 | # binary. | ||
37 | # | ||
38 | # If we don't have a cross-compiler, however, then we need to do some crazy | ||
39 | # acrobatics to get this to work. Generate all.{c,rs} on the host which will | ||
40 | # be compiled inside QEMU. Do this here because compiling syntex_syntax in | ||
41 | # QEMU would time out basically everywhere. | ||
42 | if [ "$CAN_CROSS" = "1" ]; then | ||
43 | cargo build --manifest-path libc-test/Cargo.toml --target $TARGET | ||
44 | cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/ | ||
45 | echo 'exec $1/libc-test' > $tmpdir/mount/run.sh | ||
46 | else | ||
47 | rm -rf $tmpdir/generated | ||
48 | mkdir -p $tmpdir/generated | ||
49 | cargo build --manifest-path libc-test/generate-files/Cargo.toml | ||
50 | (cd libc-test && TARGET=$TARGET OUT_DIR=$tmpdir/generated SKIP_COMPILE=1 \ | ||
51 | $CARGO_TARGET_DIR/debug/generate-files) | ||
52 | |||
53 | # Copy this folder into the mounted image, the `run.sh` entry point, and | ||
54 | # overwrite the standard libc-test Cargo.toml with the overlay one which will | ||
55 | # assume the all.{c,rs} test files have already been generated | ||
56 | mkdir $tmpdir/mount/libc | ||
57 | cp -r Cargo.* libc-test src ci $tmpdir/mount/libc/ | ||
58 | ln -s libc-test/target $tmpdir/mount/libc/target | ||
59 | cp ci/run-qemu.sh $tmpdir/mount/run.sh | ||
60 | echo $TARGET | tee -a $tmpdir/mount/TARGET | ||
61 | cp $tmpdir/generated/* $tmpdir/mount/libc/libc-test | ||
62 | cp libc-test/run-generated-Cargo.toml $tmpdir/mount/libc/libc-test/Cargo.toml | ||
63 | fi | ||
64 | |||
65 | umount $tmpdir/mount | ||
66 | |||
67 | # If we can use kvm, prefer that, otherwise just fall back to user-space | ||
68 | # emulation. | ||
69 | if kvm-ok; then | ||
70 | program=kvm | ||
71 | else | ||
72 | program=qemu-system-x86_64 | ||
73 | fi | ||
74 | |||
75 | # Pass -snapshot to prevent tampering with the disk images, this helps when | ||
76 | # running this script in development. The two drives are then passed next, | ||
77 | # first is the OS and second is the one we just made. Next the network is | ||
78 | # configured to work (I'm not entirely sure how), and then finally we turn off | ||
79 | # graphics and redirect the serial console output to out.log. | ||
80 | $program \ | ||
81 | -m 1024 \ | ||
82 | -snapshot \ | ||
83 | -drive if=virtio,file=$tmpdir/$QEMU \ | ||
84 | -drive if=virtio,file=$tmpdir/libc-test.img \ | ||
85 | -net nic,model=virtio \ | ||
86 | -net user \ | ||
87 | -nographic \ | ||
88 | -vga none 2>&1 | tee $CARGO_TARGET_DIR/out.log | ||
89 | exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log | ||
90 | fi | ||
91 | |||
92 | case "$TARGET" in | ||
93 | *-apple-ios) | ||
94 | cargo rustc --manifest-path libc-test/Cargo.toml --target $TARGET -- \ | ||
95 | -C link-args=-mios-simulator-version-min=7.0 | ||
96 | ;; | ||
97 | |||
98 | *) | ||
99 | cargo build --manifest-path libc-test/Cargo.toml --target $TARGET | ||
100 | ;; | ||
101 | esac | ||
102 | |||
103 | case "$TARGET" in | ||
104 | arm-linux-androideabi) | ||
105 | emulator @arm-21 -no-window & | ||
106 | adb wait-for-device | ||
107 | adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/libc-test | ||
108 | adb shell /data/libc-test 2>&1 | tee /tmp/out | ||
109 | grep "^PASSED .* tests" /tmp/out | ||
110 | ;; | ||
111 | |||
112 | arm-unknown-linux-gnueabihf) | ||
113 | qemu-arm -L /usr/arm-linux-gnueabihf $CARGO_TARGET_DIR/$TARGET/debug/libc-test | ||
114 | ;; | ||
115 | |||
116 | mips-unknown-linux-gnu) | ||
117 | qemu-mips -L /usr/mips-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test | ||
118 | ;; | ||
119 | |||
120 | aarch64-unknown-linux-gnu) | ||
121 | qemu-aarch64 -L /usr/aarch64-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/libc-test | ||
122 | ;; | ||
123 | |||
124 | *-rumprun-netbsd) | ||
125 | rumprun-bake hw_virtio /tmp/libc-test.img $CARGO_TARGET_DIR/$TARGET/debug/libc-test | ||
126 | qemu-system-x86_64 -nographic -vga none -m 64 \ | ||
127 | -kernel /tmp/libc-test.img 2>&1 | tee /tmp/out & | ||
128 | sleep 5 | ||
129 | grep "^PASSED .* tests" /tmp/out | ||
130 | ;; | ||
131 | |||
132 | *) | ||
133 | $CARGO_TARGET_DIR/$TARGET/debug/libc-test | ||
134 | ;; | ||
135 | esac | ||
diff --git a/third_party/libc/ci/style.rs b/third_party/libc/ci/style.rs new file mode 100644 index 0000000..32e4ba7 --- /dev/null +++ b/third_party/libc/ci/style.rs | |||
@@ -0,0 +1,204 @@ | |||
1 | //! Simple script to verify the coding style of this library | ||
2 | //! | ||
3 | //! ## How to run | ||
4 | //! | ||
5 | //! The first argument to this script is the directory to run on, so running | ||
6 | //! this script should be as simple as: | ||
7 | //! | ||
8 | //! ```notrust | ||
9 | //! rustc ci/style.rs | ||
10 | //! ./style src | ||
11 | //! ``` | ||
12 | //! | ||
13 | //! ## Guidelines | ||
14 | //! | ||
15 | //! The current style is: | ||
16 | //! | ||
17 | //! * No trailing whitespace | ||
18 | //! * No tabs | ||
19 | //! * 80-character lines | ||
20 | //! * `extern` instead of `extern "C"` | ||
21 | //! * Specific module layout: | ||
22 | //! 1. use directives | ||
23 | //! 2. typedefs | ||
24 | //! 3. structs | ||
25 | //! 4. constants | ||
26 | //! 5. f! { ... } functions | ||
27 | //! 6. extern functions | ||
28 | //! 7. modules + pub use | ||
29 | //! | ||
30 | //! Things not verified: | ||
31 | //! | ||
32 | //! * alignment | ||
33 | //! * 4-space tabs | ||
34 | //! * leading colons on paths | ||
35 | |||
36 | use std::env; | ||
37 | use std::fs; | ||
38 | use std::io::prelude::*; | ||
39 | use std::path::Path; | ||
40 | |||
41 | macro_rules! t { | ||
42 | ($e:expr) => (match $e { | ||
43 | Ok(e) => e, | ||
44 | Err(e) => panic!("{} failed with {}", stringify!($e), e), | ||
45 | }) | ||
46 | } | ||
47 | |||
48 | fn main() { | ||
49 | let arg = env::args().skip(1).next().unwrap_or(".".to_string()); | ||
50 | |||
51 | let mut errors = Errors { errs: false }; | ||
52 | walk(Path::new(&arg), &mut errors); | ||
53 | |||
54 | if errors.errs { | ||
55 | panic!("found some lint errors"); | ||
56 | } else { | ||
57 | println!("good style!"); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | fn walk(path: &Path, err: &mut Errors) { | ||
62 | for entry in t!(path.read_dir()).map(|e| t!(e)) { | ||
63 | let path = entry.path(); | ||
64 | if t!(entry.file_type()).is_dir() { | ||
65 | walk(&path, err); | ||
66 | continue | ||
67 | } | ||
68 | |||
69 | let name = entry.file_name().into_string().unwrap(); | ||
70 | match &name[..] { | ||
71 | n if !n.ends_with(".rs") => continue, | ||
72 | |||
73 | "dox.rs" | | ||
74 | "lib.rs" | | ||
75 | "macros.rs" => continue, | ||
76 | |||
77 | _ => {} | ||
78 | } | ||
79 | |||
80 | let mut contents = String::new(); | ||
81 | t!(t!(fs::File::open(&path)).read_to_string(&mut contents)); | ||
82 | |||
83 | check_style(&contents, &path, err); | ||
84 | } | ||
85 | } | ||
86 | |||
87 | struct Errors { | ||
88 | errs: bool, | ||
89 | } | ||
90 | |||
91 | #[derive(Clone, Copy, PartialEq)] | ||
92 | enum State { | ||
93 | Start, | ||
94 | Imports, | ||
95 | Typedefs, | ||
96 | Structs, | ||
97 | Constants, | ||
98 | FunctionDefinitions, | ||
99 | Functions, | ||
100 | Modules, | ||
101 | } | ||
102 | |||
103 | fn check_style(file: &str, path: &Path, err: &mut Errors) { | ||
104 | let mut state = State::Start; | ||
105 | let mut s_macros = 0; | ||
106 | let mut f_macros = 0; | ||
107 | let mut prev_blank = false; | ||
108 | |||
109 | for (i, line) in file.lines().enumerate() { | ||
110 | if line == "" { | ||
111 | if prev_blank { | ||
112 | err.error(path, i, "double blank line"); | ||
113 | } | ||
114 | prev_blank = true; | ||
115 | } else { | ||
116 | prev_blank = false; | ||
117 | } | ||
118 | if line != line.trim_right() { | ||
119 | err.error(path, i, "trailing whitespace"); | ||
120 | } | ||
121 | if line.contains("\t") { | ||
122 | err.error(path, i, "tab character"); | ||
123 | } | ||
124 | if line.len() > 80 { | ||
125 | err.error(path, i, "line longer than 80 chars"); | ||
126 | } | ||
127 | if line.contains("extern \"C\"") { | ||
128 | err.error(path, i, "use `extern` instead of `extern \"C\""); | ||
129 | } | ||
130 | if line.contains("#[cfg(") && !line.contains(" if ") { | ||
131 | if state != State::Structs { | ||
132 | err.error(path, i, "use cfg_if! and submodules \ | ||
133 | instead of #[cfg]"); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | let line = line.trim_left(); | ||
138 | let is_pub = line.starts_with("pub "); | ||
139 | let line = if is_pub {&line[4..]} else {line}; | ||
140 | |||
141 | let line_state = if line.starts_with("use ") { | ||
142 | if is_pub { | ||
143 | State::Modules | ||
144 | } else { | ||
145 | State::Imports | ||
146 | } | ||
147 | } else if line.starts_with("const ") { | ||
148 | State::Constants | ||
149 | } else if line.starts_with("type ") { | ||
150 | State::Typedefs | ||
151 | } else if line.starts_with("s! {") { | ||
152 | s_macros += 1; | ||
153 | State::Structs | ||
154 | } else if line.starts_with("f! {") { | ||
155 | f_macros += 1; | ||
156 | State::FunctionDefinitions | ||
157 | } else if line.starts_with("extern ") { | ||
158 | State::Functions | ||
159 | } else if line.starts_with("mod ") { | ||
160 | State::Modules | ||
161 | } else { | ||
162 | continue | ||
163 | }; | ||
164 | |||
165 | if state as usize > line_state as usize { | ||
166 | err.error(path, i, &format!("{} found after {} when \ | ||
167 | it belongs before", | ||
168 | line_state.desc(), state.desc())); | ||
169 | } | ||
170 | |||
171 | if f_macros == 2 { | ||
172 | f_macros += 1; | ||
173 | err.error(path, i, "multiple f! macros in one module"); | ||
174 | } | ||
175 | if s_macros == 2 { | ||
176 | s_macros += 1; | ||
177 | err.error(path, i, "multiple s! macros in one module"); | ||
178 | } | ||
179 | |||
180 | state = line_state; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | impl State { | ||
185 | fn desc(&self) -> &str { | ||
186 | match *self { | ||
187 | State::Start => "start", | ||
188 | State::Imports => "import", | ||
189 | State::Typedefs => "typedef", | ||
190 | State::Structs => "struct", | ||
191 | State::Constants => "constant", | ||
192 | State::FunctionDefinitions => "function definition", | ||
193 | State::Functions => "extern function", | ||
194 | State::Modules => "module", | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | |||
199 | impl Errors { | ||
200 | fn error(&mut self, path: &Path, line: usize, msg: &str) { | ||
201 | self.errs = true; | ||
202 | println!("{}:{} - {}", path.display(), line + 1, msg); | ||
203 | } | ||
204 | } | ||
diff --git a/third_party/libc/libc-test/Cargo.lock b/third_party/libc/libc-test/Cargo.lock new file mode 100644 index 0000000..d15562d --- /dev/null +++ b/third_party/libc/libc-test/Cargo.lock | |||
@@ -0,0 +1,92 @@ | |||
1 | [root] | ||
2 | name = "libc-test" | ||
3 | version = "0.1.0" | ||
4 | dependencies = [ | ||
5 | "ctest 0.1.0 (git+https://github.com/alexcrichton/ctest)", | ||
6 | "libc 0.2.15", | ||
7 | ] | ||
8 | |||
9 | [[package]] | ||
10 | name = "bitflags" | ||
11 | version = "0.3.3" | ||
12 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
13 | |||
14 | [[package]] | ||
15 | name = "ctest" | ||
16 | version = "0.1.0" | ||
17 | source = "git+https://github.com/alexcrichton/ctest#a6becb6d7fd23d9863cba86eac31d1ffc4082734" | ||
18 | dependencies = [ | ||
19 | "gcc 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)", | ||
20 | "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
21 | ] | ||
22 | |||
23 | [[package]] | ||
24 | name = "gcc" | ||
25 | version = "0.3.28" | ||
26 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
27 | |||
28 | [[package]] | ||
29 | name = "kernel32-sys" | ||
30 | version = "0.2.2" | ||
31 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
32 | dependencies = [ | ||
33 | "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
34 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
35 | ] | ||
36 | |||
37 | [[package]] | ||
38 | name = "libc" | ||
39 | version = "0.1.12" | ||
40 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
41 | |||
42 | [[package]] | ||
43 | name = "libc" | ||
44 | version = "0.2.15" | ||
45 | |||
46 | [[package]] | ||
47 | name = "log" | ||
48 | version = "0.3.6" | ||
49 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
50 | |||
51 | [[package]] | ||
52 | name = "rustc-serialize" | ||
53 | version = "0.3.19" | ||
54 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
55 | |||
56 | [[package]] | ||
57 | name = "syntex_syntax" | ||
58 | version = "0.19.1" | ||
59 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
60 | dependencies = [ | ||
61 | "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
62 | "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", | ||
63 | "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
64 | "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", | ||
65 | "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", | ||
66 | "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
67 | ] | ||
68 | |||
69 | [[package]] | ||
70 | name = "term" | ||
71 | version = "0.2.14" | ||
72 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
73 | dependencies = [ | ||
74 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
75 | "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
76 | ] | ||
77 | |||
78 | [[package]] | ||
79 | name = "unicode-xid" | ||
80 | version = "0.0.3" | ||
81 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
82 | |||
83 | [[package]] | ||
84 | name = "winapi" | ||
85 | version = "0.2.6" | ||
86 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
87 | |||
88 | [[package]] | ||
89 | name = "winapi-build" | ||
90 | version = "0.1.1" | ||
91 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
92 | |||
diff --git a/third_party/libc/libc-test/Cargo.toml b/third_party/libc/libc-test/Cargo.toml new file mode 100644 index 0000000..9ff4765 --- /dev/null +++ b/third_party/libc/libc-test/Cargo.toml | |||
@@ -0,0 +1,11 @@ | |||
1 | [package] | ||
2 | name = "libc-test" | ||
3 | version = "0.1.0" | ||
4 | authors = ["Alex Crichton <alex@alexcrichton.com>"] | ||
5 | build = "build.rs" | ||
6 | |||
7 | [dependencies] | ||
8 | libc = { path = ".." } | ||
9 | |||
10 | [build-dependencies] | ||
11 | ctest = { git = "https://github.com/alexcrichton/ctest" } | ||
diff --git a/third_party/libc/libc-test/build-generated.rs b/third_party/libc/libc-test/build-generated.rs new file mode 100644 index 0000000..a51c0e3 --- /dev/null +++ b/third_party/libc/libc-test/build-generated.rs | |||
@@ -0,0 +1,16 @@ | |||
1 | // This build script is distinct from the standard build.rs as it is only used | ||
2 | // for the BSDs which run a stripped down version. The `all.c` file is assumed | ||
3 | // to have been already generated for this build script. | ||
4 | |||
5 | extern crate gcc; | ||
6 | |||
7 | fn main() { | ||
8 | gcc::Config::new() | ||
9 | .file("all.c") | ||
10 | .flag("-Wall") | ||
11 | .flag("-Wextra") | ||
12 | .flag("-Werror") | ||
13 | .flag("-Wno-deprecated-declarations") | ||
14 | .flag("-Wno-type-limits") | ||
15 | .compile("liball.a"); | ||
16 | } | ||
diff --git a/third_party/libc/libc-test/build.rs b/third_party/libc/libc-test/build.rs new file mode 100644 index 0000000..48a922f --- /dev/null +++ b/third_party/libc/libc-test/build.rs | |||
@@ -0,0 +1,467 @@ | |||
1 | #![deny(warnings)] | ||
2 | |||
3 | extern crate ctest; | ||
4 | |||
5 | use std::env; | ||
6 | |||
7 | fn main() { | ||
8 | let target = env::var("TARGET").unwrap(); | ||
9 | let x86_64 = target.contains("x86_64"); | ||
10 | let windows = target.contains("windows"); | ||
11 | let mingw = target.contains("windows-gnu"); | ||
12 | let linux = target.contains("unknown-linux"); | ||
13 | let android = target.contains("android"); | ||
14 | let apple = target.contains("apple"); | ||
15 | let musl = target.contains("musl"); | ||
16 | let freebsd = target.contains("freebsd"); | ||
17 | let dragonfly = target.contains("dragonfly"); | ||
18 | let mips = target.contains("mips"); | ||
19 | let netbsd = target.contains("netbsd"); | ||
20 | let openbsd = target.contains("openbsd"); | ||
21 | let rumprun = target.contains("rumprun"); | ||
22 | let bsdlike = freebsd || apple || netbsd || openbsd || dragonfly; | ||
23 | let mut cfg = ctest::TestGenerator::new(); | ||
24 | |||
25 | // Pull in extra goodies | ||
26 | if linux || android { | ||
27 | cfg.define("_GNU_SOURCE", None); | ||
28 | } else if netbsd { | ||
29 | cfg.define("_NETBSD_SOURCE", Some("1")); | ||
30 | } else if windows { | ||
31 | cfg.define("_WIN32_WINNT", Some("0x8000")); | ||
32 | } | ||
33 | |||
34 | // Android doesn't actually have in_port_t but it's much easier if we | ||
35 | // provide one for us to test against | ||
36 | if android { | ||
37 | cfg.define("in_port_t", Some("uint16_t")); | ||
38 | } | ||
39 | |||
40 | cfg.header("errno.h") | ||
41 | .header("fcntl.h") | ||
42 | .header("limits.h") | ||
43 | .header("locale.h") | ||
44 | .header("stddef.h") | ||
45 | .header("stdint.h") | ||
46 | .header("stdio.h") | ||
47 | .header("stdlib.h") | ||
48 | .header("sys/stat.h") | ||
49 | .header("sys/types.h") | ||
50 | .header("time.h") | ||
51 | .header("wchar.h"); | ||
52 | |||
53 | if windows { | ||
54 | cfg.header("winsock2.h"); // must be before windows.h | ||
55 | |||
56 | cfg.header("direct.h"); | ||
57 | cfg.header("io.h"); | ||
58 | cfg.header("sys/utime.h"); | ||
59 | cfg.header("windows.h"); | ||
60 | cfg.header("process.h"); | ||
61 | cfg.header("ws2ipdef.h"); | ||
62 | |||
63 | if target.contains("gnu") { | ||
64 | cfg.header("ws2tcpip.h"); | ||
65 | } | ||
66 | } else { | ||
67 | cfg.flag("-Wno-deprecated-declarations"); | ||
68 | |||
69 | cfg.header("ctype.h"); | ||
70 | cfg.header("dirent.h"); | ||
71 | if openbsd { | ||
72 | cfg.header("sys/socket.h"); | ||
73 | } | ||
74 | cfg.header("net/if.h"); | ||
75 | cfg.header("netdb.h"); | ||
76 | cfg.header("netinet/in.h"); | ||
77 | cfg.header("netinet/ip.h"); | ||
78 | cfg.header("netinet/tcp.h"); | ||
79 | cfg.header("pthread.h"); | ||
80 | cfg.header("dlfcn.h"); | ||
81 | cfg.header("signal.h"); | ||
82 | cfg.header("string.h"); | ||
83 | cfg.header("sys/file.h"); | ||
84 | cfg.header("sys/ioctl.h"); | ||
85 | cfg.header("sys/mman.h"); | ||
86 | cfg.header("sys/resource.h"); | ||
87 | cfg.header("sys/socket.h"); | ||
88 | cfg.header("sys/time.h"); | ||
89 | cfg.header("sys/un.h"); | ||
90 | cfg.header("sys/wait.h"); | ||
91 | cfg.header("unistd.h"); | ||
92 | cfg.header("utime.h"); | ||
93 | cfg.header("pwd.h"); | ||
94 | cfg.header("grp.h"); | ||
95 | cfg.header("sys/utsname.h"); | ||
96 | cfg.header("sys/ptrace.h"); | ||
97 | cfg.header("sys/mount.h"); | ||
98 | cfg.header("sys/uio.h"); | ||
99 | cfg.header("sched.h"); | ||
100 | cfg.header("termios.h"); | ||
101 | cfg.header("poll.h"); | ||
102 | cfg.header("syslog.h"); | ||
103 | cfg.header("semaphore.h"); | ||
104 | } | ||
105 | |||
106 | if android { | ||
107 | cfg.header("arpa/inet.h"); | ||
108 | cfg.header("time64.h"); | ||
109 | cfg.header("xlocale.h"); | ||
110 | cfg.header("utmp.h"); | ||
111 | } else if !windows { | ||
112 | cfg.header("glob.h"); | ||
113 | cfg.header("ifaddrs.h"); | ||
114 | cfg.header("sys/statvfs.h"); | ||
115 | cfg.header("langinfo.h"); | ||
116 | |||
117 | if !openbsd && !freebsd && !dragonfly { | ||
118 | cfg.header("sys/quota.h"); | ||
119 | } | ||
120 | |||
121 | if !musl { | ||
122 | cfg.header("sys/sysctl.h"); | ||
123 | |||
124 | if !netbsd && !openbsd { | ||
125 | cfg.header("execinfo.h"); | ||
126 | cfg.header("xlocale.h"); | ||
127 | } | ||
128 | |||
129 | if openbsd { | ||
130 | cfg.header("utmp.h"); | ||
131 | } else { | ||
132 | cfg.header("utmpx.h"); | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | if apple { | ||
138 | cfg.header("mach-o/dyld.h"); | ||
139 | cfg.header("mach/mach_time.h"); | ||
140 | cfg.header("malloc/malloc.h"); | ||
141 | cfg.header("util.h"); | ||
142 | if target.starts_with("x86") { | ||
143 | cfg.header("crt_externs.h"); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | if bsdlike { | ||
148 | cfg.header("sys/event.h"); | ||
149 | |||
150 | if freebsd { | ||
151 | cfg.header("libutil.h"); | ||
152 | } else { | ||
153 | cfg.header("util.h"); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | if linux { | ||
158 | cfg.header("mqueue.h"); | ||
159 | cfg.header("ucontext.h"); | ||
160 | cfg.header("sys/signalfd.h"); | ||
161 | cfg.header("sys/xattr.h"); | ||
162 | cfg.header("sys/ipc.h"); | ||
163 | cfg.header("sys/shm.h"); | ||
164 | cfg.header("pty.h"); | ||
165 | } | ||
166 | |||
167 | if linux || android { | ||
168 | cfg.header("malloc.h"); | ||
169 | cfg.header("net/ethernet.h"); | ||
170 | cfg.header("netpacket/packet.h"); | ||
171 | cfg.header("sched.h"); | ||
172 | cfg.header("sys/epoll.h"); | ||
173 | cfg.header("sys/eventfd.h"); | ||
174 | cfg.header("sys/prctl.h"); | ||
175 | cfg.header("sys/sendfile.h"); | ||
176 | cfg.header("sys/vfs.h"); | ||
177 | cfg.header("sys/syscall.h"); | ||
178 | cfg.header("sys/sysinfo.h"); | ||
179 | cfg.header("sys/reboot.h"); | ||
180 | if !musl { | ||
181 | cfg.header("linux/netlink.h"); | ||
182 | cfg.header("linux/magic.h"); | ||
183 | cfg.header("linux/reboot.h"); | ||
184 | |||
185 | if !mips { | ||
186 | cfg.header("linux/quota.h"); | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
191 | if freebsd { | ||
192 | cfg.header("pthread_np.h"); | ||
193 | cfg.header("sched.h"); | ||
194 | cfg.header("ufs/ufs/quota.h"); | ||
195 | } | ||
196 | |||
197 | if netbsd { | ||
198 | cfg.header("ufs/ufs/quota.h"); | ||
199 | cfg.header("ufs/ufs/quota1.h"); | ||
200 | cfg.header("sys/ioctl_compat.h"); | ||
201 | } | ||
202 | |||
203 | if openbsd { | ||
204 | cfg.header("ufs/ufs/quota.h"); | ||
205 | cfg.header("rpcsvc/rex.h"); | ||
206 | cfg.header("pthread_np.h"); | ||
207 | cfg.header("sys/syscall.h"); | ||
208 | } | ||
209 | |||
210 | if dragonfly { | ||
211 | cfg.header("ufs/ufs/quota.h"); | ||
212 | cfg.header("pthread_np.h"); | ||
213 | cfg.header("sys/ioctl_compat.h"); | ||
214 | } | ||
215 | |||
216 | cfg.type_name(move |ty, is_struct| { | ||
217 | match ty { | ||
218 | // Just pass all these through, no need for a "struct" prefix | ||
219 | "FILE" | | ||
220 | "fd_set" | | ||
221 | "Dl_info" | | ||
222 | "DIR" => ty.to_string(), | ||
223 | |||
224 | // Fixup a few types on windows that don't actually exist. | ||
225 | "time64_t" if windows => "__time64_t".to_string(), | ||
226 | "ssize_t" if windows => "SSIZE_T".to_string(), | ||
227 | |||
228 | // OSX calls this something else | ||
229 | "sighandler_t" if bsdlike => "sig_t".to_string(), | ||
230 | |||
231 | t if t.ends_with("_t") => t.to_string(), | ||
232 | |||
233 | // Windows uppercase structs don't have `struct` in front, there's a | ||
234 | // few special cases for windows, and then otherwise put `struct` in | ||
235 | // front of everything. | ||
236 | t if is_struct => { | ||
237 | if windows && ty.chars().next().unwrap().is_uppercase() { | ||
238 | t.to_string() | ||
239 | } else if windows && t == "stat" { | ||
240 | "struct __stat64".to_string() | ||
241 | } else if windows && t == "utimbuf" { | ||
242 | "struct __utimbuf64".to_string() | ||
243 | } else { | ||
244 | format!("struct {}", t) | ||
245 | } | ||
246 | } | ||
247 | |||
248 | t => t.to_string(), | ||
249 | } | ||
250 | }); | ||
251 | |||
252 | let target2 = target.clone(); | ||
253 | cfg.field_name(move |struct_, field| { | ||
254 | match field { | ||
255 | "st_birthtime" if openbsd && struct_ == "stat" => "__st_birthtime".to_string(), | ||
256 | "st_birthtime_nsec" if openbsd && struct_ == "stat" => "__st_birthtimensec".to_string(), | ||
257 | // Our stat *_nsec fields normally don't actually exist but are part | ||
258 | // of a timeval struct | ||
259 | s if s.ends_with("_nsec") && struct_.starts_with("stat") => { | ||
260 | if target2.contains("apple") { | ||
261 | s.replace("_nsec", "spec.tv_nsec") | ||
262 | } else if target2.contains("android") { | ||
263 | s.to_string() | ||
264 | } else { | ||
265 | s.replace("e_nsec", ".tv_nsec") | ||
266 | } | ||
267 | } | ||
268 | "u64" if struct_ == "epoll_event" => "data.u64".to_string(), | ||
269 | s => s.to_string(), | ||
270 | } | ||
271 | }); | ||
272 | |||
273 | cfg.skip_type(move |ty| { | ||
274 | match ty { | ||
275 | // sighandler_t is crazy across platforms | ||
276 | "sighandler_t" => true, | ||
277 | |||
278 | _ => false | ||
279 | } | ||
280 | }); | ||
281 | |||
282 | cfg.skip_struct(move |ty| { | ||
283 | match ty { | ||
284 | "sockaddr_nl" => musl, | ||
285 | |||
286 | // On Linux, the type of `ut_tv` field of `struct utmpx` | ||
287 | // can be an anonymous struct, so an extra struct, | ||
288 | // which is absent in glibc, has to be defined. | ||
289 | "__timeval" if linux => true, | ||
290 | |||
291 | // The alignment of this is 4 on 64-bit OSX... | ||
292 | "kevent" if apple && x86_64 => true, | ||
293 | |||
294 | _ => false | ||
295 | } | ||
296 | }); | ||
297 | |||
298 | cfg.skip_signededness(move |c| { | ||
299 | match c { | ||
300 | "LARGE_INTEGER" | | ||
301 | "mach_timebase_info_data_t" | | ||
302 | "float" | | ||
303 | "double" => true, | ||
304 | // uuid_t is a struct, not an integer. | ||
305 | "uuid_t" if dragonfly => true, | ||
306 | n if n.starts_with("pthread") => true, | ||
307 | // sem_t is a struct or pointer | ||
308 | "sem_t" if openbsd || freebsd || rumprun => true, | ||
309 | |||
310 | // windows-isms | ||
311 | n if n.starts_with("P") => true, | ||
312 | n if n.starts_with("H") => true, | ||
313 | n if n.starts_with("LP") => true, | ||
314 | _ => false, | ||
315 | } | ||
316 | }); | ||
317 | |||
318 | cfg.skip_const(move |name| { | ||
319 | match name { | ||
320 | // Apparently these don't exist in mingw headers? | ||
321 | "MEM_RESET_UNDO" | | ||
322 | "FILE_ATTRIBUTE_NO_SCRUB_DATA" | | ||
323 | "FILE_ATTRIBUTE_INTEGRITY_STREAM" | | ||
324 | "ERROR_NOTHING_TO_TERMINATE" if mingw => true, | ||
325 | |||
326 | "SIG_IGN" => true, // sighandler_t weirdness | ||
327 | |||
328 | // types on musl are defined a little differently | ||
329 | n if musl && n.contains("__SIZEOF_PTHREAD") => true, | ||
330 | |||
331 | // Skip constants not defined in MUSL but just passed down to the | ||
332 | // kernel regardless | ||
333 | "RLIMIT_NLIMITS" | | ||
334 | "TCP_COOKIE_TRANSACTIONS" | | ||
335 | "RLIMIT_RTTIME" if musl => true, | ||
336 | // work around super old mips toolchain | ||
337 | "SCHED_IDLE" | "SHM_NORESERVE" => mips, | ||
338 | |||
339 | // weird signed extension or something like that? | ||
340 | "MS_NOUSER" => true, | ||
341 | "MS_RMT_MASK" => true, // updated in glibc 2.22 and musl 1.1.13 | ||
342 | |||
343 | // These OSX constants are flagged as deprecated | ||
344 | "NOTE_EXIT_REPARENTED" | | ||
345 | "NOTE_REAP" if apple => true, | ||
346 | |||
347 | // The linux/quota.h header file which defines these can't be | ||
348 | // included with sys/quota.h currently on MIPS, so we don't include | ||
349 | // it and just ignore these constants | ||
350 | "QFMT_VFS_OLD" | | ||
351 | "QFMT_VFS_V0" if mips && linux => true, | ||
352 | |||
353 | _ => false, | ||
354 | } | ||
355 | }); | ||
356 | |||
357 | cfg.skip_fn(move |name| { | ||
358 | // skip those that are manually verified | ||
359 | match name { | ||
360 | "execv" | // crazy stuff with const/mut | ||
361 | "execve" | | ||
362 | "execvp" | | ||
363 | "execvpe" => true, | ||
364 | |||
365 | "getrlimit" | "getrlimit64" | // non-int in 1st arg | ||
366 | "setrlimit" | "setrlimit64" | // non-int in 1st arg | ||
367 | "prlimit" | "prlimit64" | // non-int in 2nd arg | ||
368 | "strerror_r" if linux => true, // actually xpg-something-or-other | ||
369 | |||
370 | // typed 2nd arg on linux and android | ||
371 | "gettimeofday" if linux || android || freebsd || openbsd || dragonfly => true, | ||
372 | |||
373 | // not declared in newer android toolchains | ||
374 | "getdtablesize" if android => true, | ||
375 | |||
376 | "dlerror" if android => true, // const-ness is added | ||
377 | "dladdr" if musl => true, // const-ness only added recently | ||
378 | |||
379 | // OSX has 'struct tm *const' which we can't actually represent in | ||
380 | // Rust, but is close enough to *mut | ||
381 | "timegm" if apple => true, | ||
382 | |||
383 | // OSX's daemon is deprecated in 10.5 so we'll get a warning (which | ||
384 | // we turn into an error) so just ignore it. | ||
385 | "daemon" if apple => true, | ||
386 | |||
387 | // Deprecated on OSX | ||
388 | "sem_destroy" if apple => true, | ||
389 | "sem_init" if apple => true, | ||
390 | |||
391 | // These functions presumably exist on netbsd but don't look like | ||
392 | // they're implemented on rumprun yet, just let them slide for now. | ||
393 | // Some of them look like they have headers but then don't have | ||
394 | // corresponding actual definitions either... | ||
395 | "shm_open" | | ||
396 | "shm_unlink" | | ||
397 | "syscall" | | ||
398 | "ptrace" | | ||
399 | "sigaltstack" if rumprun => true, | ||
400 | |||
401 | // There seems to be a small error in EGLIBC's eventfd.h header. The | ||
402 | // [underlying system call][1] always takes its first `count` | ||
403 | // argument as an `unsigned int`, but [EGLIBC's <sys/eventfd.h> | ||
404 | // header][2] declares it to take an `int`. [GLIBC's header][3] | ||
405 | // matches the kernel. | ||
406 | // | ||
407 | // EGLIBC is no longer actively developed, and Debian, the largest | ||
408 | // distribution that had been using it, switched back to GLIBC in | ||
409 | // April 2015. So effectively all Linux <sys/eventfd.h> headers will | ||
410 | // be using `unsigned int` soon. | ||
411 | // | ||
412 | // [1]: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/fs/eventfd.c?id=refs/tags/v3.12.51#n397 | ||
413 | // [2]: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/eglibc/trusty/view/head:/sysdeps/unix/sysv/linux/sys/eventfd.h | ||
414 | // [3]: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sys/eventfd.h;h=6295f32e937e779e74318eb9d3bdbe76aef8a8f3;hb=4e42b5b8f89f0e288e68be7ad70f9525aebc2cff#l34 | ||
415 | "eventfd" if linux => true, | ||
416 | |||
417 | // The `uname` funcion in freebsd is now an inline wrapper that | ||
418 | // delegates to another, but the symbol still exists, so don't check | ||
419 | // the symbol. | ||
420 | "uname" if freebsd => true, | ||
421 | |||
422 | _ => false, | ||
423 | } | ||
424 | }); | ||
425 | |||
426 | cfg.skip_fn_ptrcheck(move |name| { | ||
427 | match name { | ||
428 | // dllimport weirdness? | ||
429 | _ if windows => true, | ||
430 | |||
431 | _ => false, | ||
432 | } | ||
433 | }); | ||
434 | |||
435 | cfg.skip_field_type(move |struct_, field| { | ||
436 | // This is a weird union, don't check the type. | ||
437 | (struct_ == "ifaddrs" && field == "ifa_ifu") || | ||
438 | // sighandler_t type is super weird | ||
439 | (struct_ == "sigaction" && field == "sa_sigaction") || | ||
440 | // __timeval type is a patch which doesn't exist in glibc | ||
441 | (linux && struct_ == "utmpx" && field == "ut_tv") | ||
442 | }); | ||
443 | |||
444 | cfg.skip_field(move |struct_, field| { | ||
445 | // this is actually a union on linux, so we can't represent it well and | ||
446 | // just insert some padding. | ||
447 | (struct_ == "siginfo_t" && field == "_pad") || | ||
448 | // musl names this __dummy1 but it's still there | ||
449 | (musl && struct_ == "glob_t" && field == "gl_flags") || | ||
450 | // musl seems to define this as an *anonymous* bitfield | ||
451 | (musl && struct_ == "statvfs" && field == "__f_unused") | ||
452 | }); | ||
453 | |||
454 | cfg.fn_cname(move |name, cname| { | ||
455 | if windows { | ||
456 | cname.unwrap_or(name).to_string() | ||
457 | } else { | ||
458 | name.to_string() | ||
459 | } | ||
460 | }); | ||
461 | |||
462 | if env::var("SKIP_COMPILE").is_ok() { | ||
463 | cfg.generate_files("../src/lib.rs", "all.rs"); | ||
464 | } else { | ||
465 | cfg.generate("../src/lib.rs", "all.rs"); | ||
466 | } | ||
467 | } | ||
diff --git a/third_party/libc/libc-test/generate-files/Cargo.lock b/third_party/libc/libc-test/generate-files/Cargo.lock new file mode 100644 index 0000000..662fe8a --- /dev/null +++ b/third_party/libc/libc-test/generate-files/Cargo.lock | |||
@@ -0,0 +1,108 @@ | |||
1 | [root] | ||
2 | name = "generate-files" | ||
3 | version = "0.1.0" | ||
4 | dependencies = [ | ||
5 | "ctest 0.1.0 (git+https://github.com/alexcrichton/ctest)", | ||
6 | ] | ||
7 | |||
8 | [[package]] | ||
9 | name = "advapi32-sys" | ||
10 | version = "0.1.2" | ||
11 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
12 | dependencies = [ | ||
13 | "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
14 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
15 | ] | ||
16 | |||
17 | [[package]] | ||
18 | name = "bitflags" | ||
19 | version = "0.3.3" | ||
20 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
21 | |||
22 | [[package]] | ||
23 | name = "ctest" | ||
24 | version = "0.1.0" | ||
25 | source = "git+https://github.com/alexcrichton/ctest#a6becb6d7fd23d9863cba86eac31d1ffc4082734" | ||
26 | dependencies = [ | ||
27 | "gcc 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)", | ||
28 | "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
29 | ] | ||
30 | |||
31 | [[package]] | ||
32 | name = "gcc" | ||
33 | version = "0.3.21" | ||
34 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
35 | dependencies = [ | ||
36 | "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
37 | "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
38 | ] | ||
39 | |||
40 | [[package]] | ||
41 | name = "kernel32-sys" | ||
42 | version = "0.2.1" | ||
43 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
44 | dependencies = [ | ||
45 | "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
46 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
47 | ] | ||
48 | |||
49 | [[package]] | ||
50 | name = "libc" | ||
51 | version = "0.1.12" | ||
52 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
53 | |||
54 | [[package]] | ||
55 | name = "libc" | ||
56 | version = "0.2.5" | ||
57 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
58 | |||
59 | [[package]] | ||
60 | name = "log" | ||
61 | version = "0.3.5" | ||
62 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
63 | dependencies = [ | ||
64 | "libc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
65 | ] | ||
66 | |||
67 | [[package]] | ||
68 | name = "rustc-serialize" | ||
69 | version = "0.3.16" | ||
70 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
71 | |||
72 | [[package]] | ||
73 | name = "syntex_syntax" | ||
74 | version = "0.19.1" | ||
75 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
76 | dependencies = [ | ||
77 | "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
78 | "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", | ||
79 | "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
80 | "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", | ||
81 | "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", | ||
82 | "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
83 | ] | ||
84 | |||
85 | [[package]] | ||
86 | name = "term" | ||
87 | version = "0.2.14" | ||
88 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
89 | dependencies = [ | ||
90 | "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
91 | "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||
92 | ] | ||
93 | |||
94 | [[package]] | ||
95 | name = "unicode-xid" | ||
96 | version = "0.0.3" | ||
97 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
98 | |||
99 | [[package]] | ||
100 | name = "winapi" | ||
101 | version = "0.2.6" | ||
102 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
103 | |||
104 | [[package]] | ||
105 | name = "winapi-build" | ||
106 | version = "0.1.1" | ||
107 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
108 | |||
diff --git a/third_party/libc/libc-test/generate-files/Cargo.toml b/third_party/libc/libc-test/generate-files/Cargo.toml new file mode 100644 index 0000000..9615a63 --- /dev/null +++ b/third_party/libc/libc-test/generate-files/Cargo.toml | |||
@@ -0,0 +1,16 @@ | |||
1 | # Cargo.toml which is used to just generate the all.{c,rs} files used to test | ||
2 | # some platforms. These files are then combined with the overlay files commented | ||
3 | # in the above directory as well to assemble a libc-test project which will | ||
4 | # compile/run all tests. | ||
5 | |||
6 | [package] | ||
7 | name = "generate-files" | ||
8 | version = "0.1.0" | ||
9 | authors = ["Alex Crichton <alex@alexcrichton.com>"] | ||
10 | |||
11 | [[bin]] | ||
12 | name = "generate-files" | ||
13 | path = "../build.rs" | ||
14 | |||
15 | [dependencies] | ||
16 | ctest = { git = "https://github.com/alexcrichton/ctest" } | ||
diff --git a/third_party/libc/libc-test/run-generated-Cargo.toml b/third_party/libc/libc-test/run-generated-Cargo.toml new file mode 100644 index 0000000..64862a5 --- /dev/null +++ b/third_party/libc/libc-test/run-generated-Cargo.toml | |||
@@ -0,0 +1,19 @@ | |||
1 | # Note that this Cargo.toml is not used by default, it is only intended to be | ||
2 | # used on the BSDs where it is too expensive to compile syntex_syntax in a QEMU | ||
3 | # emulator without KVM. Scripts will move this file into place on the BSD CI. | ||
4 | |||
5 | [package] | ||
6 | name = "libc-test" | ||
7 | version = "0.1.0" | ||
8 | authors = ["Alex Crichton <alex@alexcrichton.com>"] | ||
9 | build = "build-generated.rs" | ||
10 | |||
11 | [dependencies] | ||
12 | libc = { path = ".." } | ||
13 | |||
14 | [[bin]] | ||
15 | name = "libc-test" | ||
16 | path = "src/main-generated.rs" | ||
17 | |||
18 | [build-dependencies] | ||
19 | gcc = "0.3" | ||
diff --git a/third_party/libc/libc-test/src/main-generated.rs b/third_party/libc/libc-test/src/main-generated.rs new file mode 100644 index 0000000..608fe4e --- /dev/null +++ b/third_party/libc/libc-test/src/main-generated.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | // Note that this main file is meant to mirror `main.rs` but is only used on the | ||
2 | // BSDs where the generated location of `all.rs` is slightly different | ||
3 | |||
4 | #![allow(bad_style, improper_ctypes)] | ||
5 | extern crate libc; | ||
6 | |||
7 | use libc::*; | ||
8 | |||
9 | include!("../all.rs"); | ||
diff --git a/third_party/libc/libc-test/src/main.rs b/third_party/libc/libc-test/src/main.rs new file mode 100644 index 0000000..fff188d --- /dev/null +++ b/third_party/libc/libc-test/src/main.rs | |||
@@ -0,0 +1,6 @@ | |||
1 | #![allow(bad_style, improper_ctypes)] | ||
2 | extern crate libc; | ||
3 | |||
4 | use libc::*; | ||
5 | |||
6 | include!(concat!(env!("OUT_DIR"), "/all.rs")); | ||
diff --git a/third_party/libc/src/dox.rs b/third_party/libc/src/dox.rs new file mode 100644 index 0000000..c7d3dc9 --- /dev/null +++ b/third_party/libc/src/dox.rs | |||
@@ -0,0 +1,134 @@ | |||
1 | pub use self::imp::*; | ||
2 | |||
3 | #[cfg(not(dox))] | ||
4 | mod imp { | ||
5 | pub use core::option::Option; | ||
6 | pub use core::clone::Clone; | ||
7 | pub use core::marker::Copy; | ||
8 | pub use core::mem; | ||
9 | } | ||
10 | |||
11 | #[cfg(dox)] | ||
12 | mod imp { | ||
13 | pub enum Option<T> { | ||
14 | Some(T), | ||
15 | None, | ||
16 | } | ||
17 | impl<T: Copy> Copy for Option<T> {} | ||
18 | impl<T: Clone> Clone for Option<T> { | ||
19 | fn clone(&self) -> Option<T> { loop {} } | ||
20 | } | ||
21 | |||
22 | pub trait Clone { | ||
23 | fn clone(&self) -> Self; | ||
24 | } | ||
25 | |||
26 | #[lang = "copy"] | ||
27 | pub trait Copy {} | ||
28 | |||
29 | #[lang = "sync"] | ||
30 | pub trait Sync {} | ||
31 | impl<T> Sync for T {} | ||
32 | |||
33 | #[lang = "sized"] | ||
34 | pub trait Sized {} | ||
35 | |||
36 | macro_rules! each_int { | ||
37 | ($mac:ident) => ( | ||
38 | $mac!(u8); | ||
39 | $mac!(u16); | ||
40 | $mac!(u32); | ||
41 | $mac!(u64); | ||
42 | $mac!(usize); | ||
43 | $mac!(i8); | ||
44 | $mac!(i16); | ||
45 | $mac!(i32); | ||
46 | $mac!(i64); | ||
47 | $mac!(isize); | ||
48 | ) | ||
49 | } | ||
50 | |||
51 | #[lang = "div"] | ||
52 | pub trait Div<RHS> { | ||
53 | type Output; | ||
54 | fn div(self, rhs: RHS) -> Self::Output; | ||
55 | } | ||
56 | |||
57 | macro_rules! impl_div { | ||
58 | ($($i:ident)*) => ($( | ||
59 | impl Div<$i> for $i { | ||
60 | type Output = $i; | ||
61 | fn div(self, rhs: $i) -> $i { self / rhs } | ||
62 | } | ||
63 | )*) | ||
64 | } | ||
65 | each_int!(impl_div); | ||
66 | |||
67 | #[lang = "shl"] | ||
68 | pub trait Shl<RHS> { | ||
69 | type Output; | ||
70 | fn shl(self, rhs: RHS) -> Self::Output; | ||
71 | } | ||
72 | |||
73 | macro_rules! impl_shl { | ||
74 | ($($i:ident)*) => ($( | ||
75 | impl Shl<$i> for $i { | ||
76 | type Output = $i; | ||
77 | fn shl(self, rhs: $i) -> $i { self << rhs } | ||
78 | } | ||
79 | )*) | ||
80 | } | ||
81 | each_int!(impl_shl); | ||
82 | |||
83 | #[lang = "mul"] | ||
84 | pub trait Mul<RHS=Self> { | ||
85 | type Output; | ||
86 | fn mul(self, rhs: RHS) -> Self::Output; | ||
87 | } | ||
88 | |||
89 | macro_rules! impl_mul { | ||
90 | ($($i:ident)*) => ($( | ||
91 | impl Mul for $i { | ||
92 | type Output = $i; | ||
93 | fn mul(self, rhs: $i) -> $i { self * rhs } | ||
94 | } | ||
95 | )*) | ||
96 | } | ||
97 | each_int!(impl_mul); | ||
98 | |||
99 | #[lang = "sub"] | ||
100 | pub trait Sub<RHS=Self> { | ||
101 | type Output; | ||
102 | fn sub(self, rhs: RHS) -> Self::Output; | ||
103 | } | ||
104 | |||
105 | macro_rules! impl_sub { | ||
106 | ($($i:ident)*) => ($( | ||
107 | impl Sub for $i { | ||
108 | type Output = $i; | ||
109 | fn sub(self, rhs: $i) -> $i { self - rhs } | ||
110 | } | ||
111 | )*) | ||
112 | } | ||
113 | each_int!(impl_sub); | ||
114 | |||
115 | #[lang = "bitor"] | ||
116 | pub trait Bitor<RHS=Self> { | ||
117 | type Output; | ||
118 | fn bitor(self, rhs: RHS) -> Self::Output; | ||
119 | } | ||
120 | |||
121 | macro_rules! impl_bitor { | ||
122 | ($($i:ident)*) => ($( | ||
123 | impl Bitor for $i { | ||
124 | type Output = $i; | ||
125 | fn bitor(self, rhs: $i) -> $i { self | rhs } | ||
126 | } | ||
127 | )*) | ||
128 | } | ||
129 | each_int!(impl_bitor); | ||
130 | |||
131 | pub mod mem { | ||
132 | pub fn size_of_val<T>(_: &T) -> usize { 4 } | ||
133 | } | ||
134 | } | ||
diff --git a/third_party/libc/src/lib.rs b/third_party/libc/src/lib.rs new file mode 100644 index 0000000..0f7a5b5 --- /dev/null +++ b/third_party/libc/src/lib.rs | |||
@@ -0,0 +1,272 @@ | |||
1 | // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT | ||
2 | // file at the top-level directory of this distribution and at | ||
3 | // http://rust-lang.org/COPYRIGHT. | ||
4 | // | ||
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
8 | // option. This file may not be copied, modified, or distributed | ||
9 | // except according to those terms. | ||
10 | |||
11 | //! Crate docs | ||
12 | |||
13 | #![allow(bad_style, overflowing_literals, improper_ctypes)] | ||
14 | #![crate_type = "rlib"] | ||
15 | #![crate_name = "libc"] | ||
16 | #![cfg_attr(dox, feature(no_core, lang_items))] | ||
17 | #![cfg_attr(dox, no_core)] | ||
18 | #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", | ||
19 | html_favicon_url = "https://doc.rust-lang.org/favicon.ico")] | ||
20 | |||
21 | #![cfg_attr(all(target_os = "linux", target_arch = "x86_64"), doc( | ||
22 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu" | ||
23 | ))] | ||
24 | #![cfg_attr(all(target_os = "linux", target_arch = "x86"), doc( | ||
25 | html_root_url = "https://doc.rust-lang.org/libc/i686-unknown-linux-gnu" | ||
26 | ))] | ||
27 | #![cfg_attr(all(target_os = "linux", target_arch = "arm"), doc( | ||
28 | html_root_url = "https://doc.rust-lang.org/libc/arm-unknown-linux-gnueabihf" | ||
29 | ))] | ||
30 | #![cfg_attr(all(target_os = "linux", target_arch = "mips"), doc( | ||
31 | html_root_url = "https://doc.rust-lang.org/libc/mips-unknown-linux-gnu" | ||
32 | ))] | ||
33 | #![cfg_attr(all(target_os = "linux", target_arch = "aarch64"), doc( | ||
34 | html_root_url = "https://doc.rust-lang.org/libc/aarch64-unknown-linux-gnu" | ||
35 | ))] | ||
36 | #![cfg_attr(all(target_os = "linux", target_env = "musl"), doc( | ||
37 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl" | ||
38 | ))] | ||
39 | #![cfg_attr(all(target_os = "macos", target_arch = "x86_64"), doc( | ||
40 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-apple-darwin" | ||
41 | ))] | ||
42 | #![cfg_attr(all(target_os = "macos", target_arch = "x86"), doc( | ||
43 | html_root_url = "https://doc.rust-lang.org/libc/i686-apple-darwin" | ||
44 | ))] | ||
45 | #![cfg_attr(all(windows, target_arch = "x86_64", target_env = "gnu"), doc( | ||
46 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-pc-windows-gnu" | ||
47 | ))] | ||
48 | #![cfg_attr(all(windows, target_arch = "x86", target_env = "gnu"), doc( | ||
49 | html_root_url = "https://doc.rust-lang.org/libc/i686-pc-windows-gnu" | ||
50 | ))] | ||
51 | #![cfg_attr(all(windows, target_arch = "x86_64", target_env = "msvc"), doc( | ||
52 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-pc-windows-msvc" | ||
53 | ))] | ||
54 | #![cfg_attr(all(windows, target_arch = "x86", target_env = "msvc"), doc( | ||
55 | html_root_url = "https://doc.rust-lang.org/libc/i686-pc-windows-msvc" | ||
56 | ))] | ||
57 | #![cfg_attr(target_os = "android", doc( | ||
58 | html_root_url = "https://doc.rust-lang.org/libc/arm-linux-androideabi" | ||
59 | ))] | ||
60 | #![cfg_attr(target_os = "freebsd", doc( | ||
61 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-freebsd" | ||
62 | ))] | ||
63 | #![cfg_attr(target_os = "openbsd", doc( | ||
64 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-openbsd" | ||
65 | ))] | ||
66 | #![cfg_attr(target_os = "bitrig", doc( | ||
67 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-bitrig" | ||
68 | ))] | ||
69 | #![cfg_attr(target_os = "netbsd", doc( | ||
70 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-netbsd" | ||
71 | ))] | ||
72 | #![cfg_attr(target_os = "dragonfly", doc( | ||
73 | html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly" | ||
74 | ))] | ||
75 | |||
76 | // Attributes needed when building as part of the standard library | ||
77 | #![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))] | ||
78 | #![cfg_attr(stdbuild, no_std)] | ||
79 | #![cfg_attr(stdbuild, staged_api)] | ||
80 | #![cfg_attr(stdbuild, allow(warnings))] | ||
81 | #![cfg_attr(stdbuild, unstable(feature = "libc", | ||
82 | reason = "use `libc` from crates.io", | ||
83 | issue = "27783"))] | ||
84 | |||
85 | #![cfg_attr(not(feature = "use_std"), no_std)] | ||
86 | |||
87 | #[cfg(all(not(stdbuild), not(dox), feature = "use_std"))] | ||
88 | extern crate std as core; | ||
89 | |||
90 | #[macro_use] mod macros; | ||
91 | mod dox; | ||
92 | |||
93 | // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable | ||
94 | // more optimization opportunities around it recognizing things like | ||
95 | // malloc/free. | ||
96 | #[repr(u8)] | ||
97 | pub enum c_void { | ||
98 | // Two dummy variants so the #[repr] attribute can be used. | ||
99 | #[doc(hidden)] | ||
100 | __variant1, | ||
101 | #[doc(hidden)] | ||
102 | __variant2, | ||
103 | } | ||
104 | |||
105 | pub type int8_t = i8; | ||
106 | pub type int16_t = i16; | ||
107 | pub type int32_t = i32; | ||
108 | pub type int64_t = i64; | ||
109 | pub type uint8_t = u8; | ||
110 | pub type uint16_t = u16; | ||
111 | pub type uint32_t = u32; | ||
112 | pub type uint64_t = u64; | ||
113 | |||
114 | pub type c_schar = i8; | ||
115 | pub type c_uchar = u8; | ||
116 | pub type c_short = i16; | ||
117 | pub type c_ushort = u16; | ||
118 | pub type c_int = i32; | ||
119 | pub type c_uint = u32; | ||
120 | pub type c_float = f32; | ||
121 | pub type c_double = f64; | ||
122 | pub type c_longlong = i64; | ||
123 | pub type c_ulonglong = u64; | ||
124 | pub type intmax_t = i64; | ||
125 | pub type uintmax_t = u64; | ||
126 | |||
127 | pub type size_t = usize; | ||
128 | pub type ptrdiff_t = isize; | ||
129 | pub type intptr_t = isize; | ||
130 | pub type uintptr_t = usize; | ||
131 | pub type ssize_t = isize; | ||
132 | |||
133 | pub enum FILE {} | ||
134 | pub enum fpos_t {} // TODO: fill this out with a struct | ||
135 | |||
136 | extern { | ||
137 | pub fn isalnum(c: c_int) -> c_int; | ||
138 | pub fn isalpha(c: c_int) -> c_int; | ||
139 | pub fn iscntrl(c: c_int) -> c_int; | ||
140 | pub fn isdigit(c: c_int) -> c_int; | ||
141 | pub fn isgraph(c: c_int) -> c_int; | ||
142 | pub fn islower(c: c_int) -> c_int; | ||
143 | pub fn isprint(c: c_int) -> c_int; | ||
144 | pub fn ispunct(c: c_int) -> c_int; | ||
145 | pub fn isspace(c: c_int) -> c_int; | ||
146 | pub fn isupper(c: c_int) -> c_int; | ||
147 | pub fn isxdigit(c: c_int) -> c_int; | ||
148 | pub fn tolower(c: c_int) -> c_int; | ||
149 | pub fn toupper(c: c_int) -> c_int; | ||
150 | |||
151 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
152 | link_name = "fopen$UNIX2003")] | ||
153 | pub fn fopen(filename: *const c_char, | ||
154 | mode: *const c_char) -> *mut FILE; | ||
155 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
156 | link_name = "freopen$UNIX2003")] | ||
157 | pub fn freopen(filename: *const c_char, mode: *const c_char, | ||
158 | file: *mut FILE) -> *mut FILE; | ||
159 | pub fn fflush(file: *mut FILE) -> c_int; | ||
160 | pub fn fclose(file: *mut FILE) -> c_int; | ||
161 | pub fn remove(filename: *const c_char) -> c_int; | ||
162 | pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; | ||
163 | pub fn tmpfile() -> *mut FILE; | ||
164 | pub fn setvbuf(stream: *mut FILE, | ||
165 | buffer: *mut c_char, | ||
166 | mode: c_int, | ||
167 | size: size_t) -> c_int; | ||
168 | pub fn setbuf(stream: *mut FILE, buf: *mut c_char); | ||
169 | pub fn fgetc(stream: *mut FILE) -> c_int; | ||
170 | pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; | ||
171 | pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; | ||
172 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
173 | link_name = "fputs$UNIX2003")] | ||
174 | pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int; | ||
175 | pub fn puts(s: *const c_char) -> c_int; | ||
176 | pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; | ||
177 | pub fn fread(ptr: *mut c_void, | ||
178 | size: size_t, | ||
179 | nobj: size_t, | ||
180 | stream: *mut FILE) | ||
181 | -> size_t; | ||
182 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
183 | link_name = "fwrite$UNIX2003")] | ||
184 | pub fn fwrite(ptr: *const c_void, | ||
185 | size: size_t, | ||
186 | nobj: size_t, | ||
187 | stream: *mut FILE) | ||
188 | -> size_t; | ||
189 | pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; | ||
190 | pub fn ftell(stream: *mut FILE) -> c_long; | ||
191 | pub fn rewind(stream: *mut FILE); | ||
192 | #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] | ||
193 | pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; | ||
194 | #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] | ||
195 | pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; | ||
196 | pub fn feof(stream: *mut FILE) -> c_int; | ||
197 | pub fn ferror(stream: *mut FILE) -> c_int; | ||
198 | pub fn perror(s: *const c_char); | ||
199 | pub fn atoi(s: *const c_char) -> c_int; | ||
200 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
201 | link_name = "strtod$UNIX2003")] | ||
202 | pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; | ||
203 | pub fn strtol(s: *const c_char, | ||
204 | endp: *mut *mut c_char, base: c_int) -> c_long; | ||
205 | pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, | ||
206 | base: c_int) -> c_ulong; | ||
207 | pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; | ||
208 | pub fn malloc(size: size_t) -> *mut c_void; | ||
209 | pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; | ||
210 | pub fn free(p: *mut c_void); | ||
211 | pub fn abort() -> !; | ||
212 | pub fn exit(status: c_int) -> !; | ||
213 | pub fn _exit(status: c_int) -> !; | ||
214 | pub fn atexit(cb: extern fn()) -> c_int; | ||
215 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
216 | link_name = "system$UNIX2003")] | ||
217 | pub fn system(s: *const c_char) -> c_int; | ||
218 | pub fn getenv(s: *const c_char) -> *mut c_char; | ||
219 | |||
220 | pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; | ||
221 | pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) | ||
222 | -> *mut c_char; | ||
223 | pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; | ||
224 | pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; | ||
225 | pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; | ||
226 | pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; | ||
227 | pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; | ||
228 | pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; | ||
229 | pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; | ||
230 | pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; | ||
231 | pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; | ||
232 | pub fn strdup(cs: *const c_char) -> *mut c_char; | ||
233 | pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; | ||
234 | pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; | ||
235 | pub fn strlen(cs: *const c_char) -> size_t; | ||
236 | pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; | ||
237 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
238 | link_name = "strerror$UNIX2003")] | ||
239 | pub fn strerror(n: c_int) -> *mut c_char; | ||
240 | pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; | ||
241 | pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; | ||
242 | pub fn wcslen(buf: *const wchar_t) -> size_t; | ||
243 | |||
244 | pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; | ||
245 | pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; | ||
246 | pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; | ||
247 | pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; | ||
248 | pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; | ||
249 | } | ||
250 | |||
251 | // These are all inline functions on android, so they end up just being entirely | ||
252 | // missing on that platform. | ||
253 | #[cfg(not(target_os = "android"))] | ||
254 | extern { | ||
255 | pub fn abs(i: c_int) -> c_int; | ||
256 | pub fn atof(s: *const c_char) -> c_double; | ||
257 | pub fn labs(i: c_long) -> c_long; | ||
258 | pub fn rand() -> c_int; | ||
259 | pub fn srand(seed: c_uint); | ||
260 | } | ||
261 | |||
262 | cfg_if! { | ||
263 | if #[cfg(windows)] { | ||
264 | mod windows; | ||
265 | pub use windows::*; | ||
266 | } else if #[cfg(unix)] { | ||
267 | mod unix; | ||
268 | pub use unix::*; | ||
269 | } else { | ||
270 | // Unknown target_family | ||
271 | } | ||
272 | } | ||
diff --git a/third_party/libc/src/macros.rs b/third_party/libc/src/macros.rs new file mode 100644 index 0000000..5811c84 --- /dev/null +++ b/third_party/libc/src/macros.rs | |||
@@ -0,0 +1,108 @@ | |||
1 | /// A macro for defining #[cfg] if-else statements. | ||
2 | /// | ||
3 | /// This is similar to the `if/elif` C preprocessor macro by allowing definition | ||
4 | /// of a cascade of `#[cfg]` cases, emitting the implementation which matches | ||
5 | /// first. | ||
6 | /// | ||
7 | /// This allows you to conveniently provide a long list #[cfg]'d blocks of code | ||
8 | /// without having to rewrite each clause multiple times. | ||
9 | macro_rules! cfg_if { | ||
10 | ($( | ||
11 | if #[cfg($($meta:meta),*)] { $($it:item)* } | ||
12 | ) else * else { | ||
13 | $($it2:item)* | ||
14 | }) => { | ||
15 | __cfg_if_items! { | ||
16 | () ; | ||
17 | $( ( ($($meta),*) ($($it)*) ), )* | ||
18 | ( () ($($it2)*) ), | ||
19 | } | ||
20 | } | ||
21 | } | ||
22 | |||
23 | macro_rules! __cfg_if_items { | ||
24 | (($($not:meta,)*) ; ) => {}; | ||
25 | (($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => { | ||
26 | __cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* } | ||
27 | __cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* } | ||
28 | } | ||
29 | } | ||
30 | |||
31 | macro_rules! __cfg_if_apply { | ||
32 | ($m:meta, $($it:item)*) => { | ||
33 | $(#[$m] $it)* | ||
34 | } | ||
35 | } | ||
36 | |||
37 | macro_rules! s { | ||
38 | ($($(#[$attr:meta])* pub struct $i:ident { $($field:tt)* })*) => ($( | ||
39 | __item! { | ||
40 | #[repr(C)] | ||
41 | $(#[$attr])* | ||
42 | pub struct $i { $($field)* } | ||
43 | } | ||
44 | impl ::dox::Copy for $i {} | ||
45 | impl ::dox::Clone for $i { | ||
46 | fn clone(&self) -> $i { *self } | ||
47 | } | ||
48 | )*) | ||
49 | } | ||
50 | |||
51 | macro_rules! f { | ||
52 | ($(pub fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { | ||
53 | $($body:stmt);* | ||
54 | })*) => ($( | ||
55 | #[inline] | ||
56 | #[cfg(not(dox))] | ||
57 | pub unsafe extern fn $i($($arg: $argty),*) -> $ret { | ||
58 | $($body);* | ||
59 | } | ||
60 | |||
61 | #[cfg(dox)] | ||
62 | #[allow(dead_code)] | ||
63 | pub unsafe extern fn $i($($arg: $argty),*) -> $ret { | ||
64 | loop {} | ||
65 | } | ||
66 | )*) | ||
67 | } | ||
68 | |||
69 | macro_rules! __item { | ||
70 | ($i:item) => ($i) | ||
71 | } | ||
72 | |||
73 | #[cfg(test)] | ||
74 | mod tests { | ||
75 | cfg_if! { | ||
76 | if #[cfg(test)] { | ||
77 | use std::option::Option as Option2; | ||
78 | fn works1() -> Option2<u32> { Some(1) } | ||
79 | } else { | ||
80 | fn works1() -> Option<u32> { None } | ||
81 | } | ||
82 | } | ||
83 | |||
84 | cfg_if! { | ||
85 | if #[cfg(foo)] { | ||
86 | fn works2() -> bool { false } | ||
87 | } else if #[cfg(test)] { | ||
88 | fn works2() -> bool { true } | ||
89 | } else { | ||
90 | fn works2() -> bool { false } | ||
91 | } | ||
92 | } | ||
93 | |||
94 | cfg_if! { | ||
95 | if #[cfg(foo)] { | ||
96 | fn works3() -> bool { false } | ||
97 | } else { | ||
98 | fn works3() -> bool { true } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | #[test] | ||
103 | fn it_works() { | ||
104 | assert!(works1().is_some()); | ||
105 | assert!(works2()); | ||
106 | assert!(works3()); | ||
107 | } | ||
108 | } | ||
diff --git a/third_party/libc/src/unix/bsd/apple/b32.rs b/third_party/libc/src/unix/bsd/apple/b32.rs new file mode 100644 index 0000000..8ca0254 --- /dev/null +++ b/third_party/libc/src/unix/bsd/apple/b32.rs | |||
@@ -0,0 +1,19 @@ | |||
1 | //! 32-bit specific Apple (ios/darwin) definitions | ||
2 | |||
3 | pub type c_long = i32; | ||
4 | pub type c_ulong = u32; | ||
5 | |||
6 | s! { | ||
7 | pub struct pthread_attr_t { | ||
8 | __sig: c_long, | ||
9 | __opaque: [::c_char; 36] | ||
10 | } | ||
11 | } | ||
12 | |||
13 | pub const __PTHREAD_MUTEX_SIZE__: usize = 40; | ||
14 | pub const __PTHREAD_COND_SIZE__: usize = 24; | ||
15 | pub const __PTHREAD_CONDATTR_SIZE__: usize = 4; | ||
16 | pub const __PTHREAD_RWLOCK_SIZE__: usize = 124; | ||
17 | |||
18 | pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459; | ||
19 | pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458; | ||
diff --git a/third_party/libc/src/unix/bsd/apple/b64.rs b/third_party/libc/src/unix/bsd/apple/b64.rs new file mode 100644 index 0000000..327a4b6 --- /dev/null +++ b/third_party/libc/src/unix/bsd/apple/b64.rs | |||
@@ -0,0 +1,19 @@ | |||
1 | //! 64-bit specific Apple (ios/darwin) definitions | ||
2 | |||
3 | pub type c_long = i64; | ||
4 | pub type c_ulong = u64; | ||
5 | |||
6 | s! { | ||
7 | pub struct pthread_attr_t { | ||
8 | __sig: c_long, | ||
9 | __opaque: [::c_char; 56] | ||
10 | } | ||
11 | } | ||
12 | |||
13 | pub const __PTHREAD_MUTEX_SIZE__: usize = 56; | ||
14 | pub const __PTHREAD_COND_SIZE__: usize = 40; | ||
15 | pub const __PTHREAD_CONDATTR_SIZE__: usize = 8; | ||
16 | pub const __PTHREAD_RWLOCK_SIZE__: usize = 192; | ||
17 | |||
18 | pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; | ||
19 | pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458; | ||
diff --git a/third_party/libc/src/unix/bsd/apple/mod.rs b/third_party/libc/src/unix/bsd/apple/mod.rs new file mode 100644 index 0000000..50dad1f --- /dev/null +++ b/third_party/libc/src/unix/bsd/apple/mod.rs | |||
@@ -0,0 +1,1464 @@ | |||
1 | //! Apple (ios/darwin)-specific definitions | ||
2 | //! | ||
3 | //! This covers *-apple-* triples currently | ||
4 | |||
5 | pub type clock_t = c_ulong; | ||
6 | pub type time_t = c_long; | ||
7 | pub type suseconds_t = i32; | ||
8 | pub type dev_t = i32; | ||
9 | pub type ino_t = u64; | ||
10 | pub type mode_t = u16; | ||
11 | pub type nlink_t = u16; | ||
12 | pub type blksize_t = i32; | ||
13 | pub type rlim_t = u64; | ||
14 | pub type mach_timebase_info_data_t = mach_timebase_info; | ||
15 | pub type pthread_key_t = c_ulong; | ||
16 | pub type sigset_t = u32; | ||
17 | pub type fsblkcnt_t = ::c_uint; | ||
18 | pub type fsfilcnt_t = ::c_uint; | ||
19 | pub type speed_t = ::c_ulong; | ||
20 | pub type tcflag_t = ::c_ulong; | ||
21 | pub type nl_item = ::c_int; | ||
22 | pub type id_t = ::c_uint; | ||
23 | pub type sem_t = ::c_int; | ||
24 | |||
25 | pub enum timezone {} | ||
26 | |||
27 | s! { | ||
28 | pub struct utmpx { | ||
29 | pub ut_user: [::c_char; _UTX_USERSIZE], | ||
30 | pub ut_id: [::c_char; _UTX_IDSIZE], | ||
31 | pub ut_line: [::c_char; _UTX_LINESIZE], | ||
32 | pub ut_pid: ::pid_t, | ||
33 | pub ut_type: ::c_short, | ||
34 | pub ut_tv: ::timeval, | ||
35 | pub ut_host: [::c_char; _UTX_HOSTSIZE], | ||
36 | ut_pad: [::uint32_t; 16], | ||
37 | } | ||
38 | |||
39 | pub struct glob_t { | ||
40 | pub gl_pathc: ::size_t, | ||
41 | __unused1: ::c_int, | ||
42 | pub gl_offs: ::size_t, | ||
43 | __unused2: ::c_int, | ||
44 | pub gl_pathv: *mut *mut ::c_char, | ||
45 | |||
46 | __unused3: *mut ::c_void, | ||
47 | |||
48 | __unused4: *mut ::c_void, | ||
49 | __unused5: *mut ::c_void, | ||
50 | __unused6: *mut ::c_void, | ||
51 | __unused7: *mut ::c_void, | ||
52 | __unused8: *mut ::c_void, | ||
53 | } | ||
54 | |||
55 | pub struct sockaddr_storage { | ||
56 | pub ss_len: u8, | ||
57 | pub ss_family: ::sa_family_t, | ||
58 | __ss_pad1: [u8; 6], | ||
59 | __ss_align: i64, | ||
60 | __ss_pad2: [u8; 112], | ||
61 | } | ||
62 | |||
63 | pub struct addrinfo { | ||
64 | pub ai_flags: ::c_int, | ||
65 | pub ai_family: ::c_int, | ||
66 | pub ai_socktype: ::c_int, | ||
67 | pub ai_protocol: ::c_int, | ||
68 | pub ai_addrlen: ::socklen_t, | ||
69 | pub ai_canonname: *mut ::c_char, | ||
70 | pub ai_addr: *mut ::sockaddr, | ||
71 | pub ai_next: *mut addrinfo, | ||
72 | } | ||
73 | |||
74 | pub struct mach_timebase_info { | ||
75 | pub numer: u32, | ||
76 | pub denom: u32, | ||
77 | } | ||
78 | |||
79 | pub struct stat { | ||
80 | pub st_dev: dev_t, | ||
81 | pub st_mode: mode_t, | ||
82 | pub st_nlink: nlink_t, | ||
83 | pub st_ino: ino_t, | ||
84 | pub st_uid: ::uid_t, | ||
85 | pub st_gid: ::gid_t, | ||
86 | pub st_rdev: dev_t, | ||
87 | pub st_atime: time_t, | ||
88 | pub st_atime_nsec: c_long, | ||
89 | pub st_mtime: time_t, | ||
90 | pub st_mtime_nsec: c_long, | ||
91 | pub st_ctime: time_t, | ||
92 | pub st_ctime_nsec: c_long, | ||
93 | pub st_birthtime: time_t, | ||
94 | pub st_birthtime_nsec: c_long, | ||
95 | pub st_size: ::off_t, | ||
96 | pub st_blocks: ::blkcnt_t, | ||
97 | pub st_blksize: blksize_t, | ||
98 | pub st_flags: ::uint32_t, | ||
99 | pub st_gen: ::uint32_t, | ||
100 | pub st_lspare: ::int32_t, | ||
101 | pub st_qspare: [::int64_t; 2], | ||
102 | } | ||
103 | |||
104 | pub struct dirent { | ||
105 | pub d_ino: u64, | ||
106 | pub d_seekoff: u64, | ||
107 | pub d_reclen: u16, | ||
108 | pub d_namlen: u16, | ||
109 | pub d_type: u8, | ||
110 | pub d_name: [::c_char; 1024], | ||
111 | } | ||
112 | |||
113 | pub struct pthread_mutex_t { | ||
114 | __sig: ::c_long, | ||
115 | __opaque: [u8; __PTHREAD_MUTEX_SIZE__], | ||
116 | } | ||
117 | |||
118 | pub struct pthread_mutexattr_t { | ||
119 | __sig: ::c_long, | ||
120 | __opaque: [u8; 8], | ||
121 | } | ||
122 | |||
123 | pub struct pthread_cond_t { | ||
124 | __sig: ::c_long, | ||
125 | __opaque: [u8; __PTHREAD_COND_SIZE__], | ||
126 | } | ||
127 | |||
128 | pub struct pthread_condattr_t { | ||
129 | __sig: ::c_long, | ||
130 | __opaque: [u8; __PTHREAD_CONDATTR_SIZE__], | ||
131 | } | ||
132 | |||
133 | pub struct pthread_rwlock_t { | ||
134 | __sig: ::c_long, | ||
135 | __opaque: [u8; __PTHREAD_RWLOCK_SIZE__], | ||
136 | } | ||
137 | |||
138 | pub struct siginfo_t { | ||
139 | pub si_signo: ::c_int, | ||
140 | pub si_errno: ::c_int, | ||
141 | pub si_code: ::c_int, | ||
142 | pub si_pid: ::pid_t, | ||
143 | pub si_uid: ::uid_t, | ||
144 | pub si_status: ::c_int, | ||
145 | pub si_addr: *mut ::c_void, | ||
146 | _pad: [usize; 9], | ||
147 | } | ||
148 | |||
149 | pub struct sigaction { | ||
150 | pub sa_sigaction: ::sighandler_t, | ||
151 | pub sa_mask: sigset_t, | ||
152 | pub sa_flags: ::c_int, | ||
153 | } | ||
154 | |||
155 | pub struct stack_t { | ||
156 | pub ss_sp: *mut ::c_void, | ||
157 | pub ss_size: ::size_t, | ||
158 | pub ss_flags: ::c_int, | ||
159 | } | ||
160 | |||
161 | pub struct fstore_t { | ||
162 | pub fst_flags: ::c_uint, | ||
163 | pub fst_posmode: ::c_int, | ||
164 | pub fst_offset: ::off_t, | ||
165 | pub fst_length: ::off_t, | ||
166 | pub fst_bytesalloc: ::off_t, | ||
167 | } | ||
168 | |||
169 | pub struct radvisory { | ||
170 | pub ra_offset: ::off_t, | ||
171 | pub ra_count: ::c_int, | ||
172 | } | ||
173 | |||
174 | pub struct statvfs { | ||
175 | pub f_bsize: ::c_ulong, | ||
176 | pub f_frsize: ::c_ulong, | ||
177 | pub f_blocks: ::fsblkcnt_t, | ||
178 | pub f_bfree: ::fsblkcnt_t, | ||
179 | pub f_bavail: ::fsblkcnt_t, | ||
180 | pub f_files: ::fsfilcnt_t, | ||
181 | pub f_ffree: ::fsfilcnt_t, | ||
182 | pub f_favail: ::fsfilcnt_t, | ||
183 | pub f_fsid: ::c_ulong, | ||
184 | pub f_flag: ::c_ulong, | ||
185 | pub f_namemax: ::c_ulong, | ||
186 | } | ||
187 | |||
188 | pub struct Dl_info { | ||
189 | pub dli_fname: *const ::c_char, | ||
190 | pub dli_fbase: *mut ::c_void, | ||
191 | pub dli_sname: *const ::c_char, | ||
192 | pub dli_saddr: *mut ::c_void, | ||
193 | } | ||
194 | |||
195 | pub struct sockaddr_in { | ||
196 | pub sin_len: u8, | ||
197 | pub sin_family: ::sa_family_t, | ||
198 | pub sin_port: ::in_port_t, | ||
199 | pub sin_addr: ::in_addr, | ||
200 | pub sin_zero: [::c_char; 8], | ||
201 | } | ||
202 | |||
203 | pub struct statfs { | ||
204 | pub f_bsize: ::uint32_t, | ||
205 | pub f_iosize: ::int32_t, | ||
206 | pub f_blocks: ::uint64_t, | ||
207 | pub f_bfree: ::uint64_t, | ||
208 | pub f_bavail: ::uint64_t, | ||
209 | pub f_files: ::uint64_t, | ||
210 | pub f_ffree: ::uint64_t, | ||
211 | pub f_fsid: ::fsid_t, | ||
212 | pub f_owner: ::uid_t, | ||
213 | pub f_type: ::uint32_t, | ||
214 | pub f_flags: ::uint32_t, | ||
215 | pub f_fssubtype: ::uint32_t, | ||
216 | pub f_fstypename: [::c_char; 16], | ||
217 | pub f_mntonname: [::c_char; 1024], | ||
218 | pub f_mntfromname: [::c_char; 1024], | ||
219 | pub f_reserved: [::uint32_t; 8], | ||
220 | } | ||
221 | |||
222 | // FIXME: this should have align 4 but it's got align 8 on 64-bit | ||
223 | pub struct kevent { | ||
224 | pub ident: ::uintptr_t, | ||
225 | pub filter: ::int16_t, | ||
226 | pub flags: ::uint16_t, | ||
227 | pub fflags: ::uint32_t, | ||
228 | pub data: ::intptr_t, | ||
229 | pub udata: *mut ::c_void, | ||
230 | } | ||
231 | |||
232 | pub struct kevent64_s { | ||
233 | pub ident: ::uint64_t, | ||
234 | pub filter: ::int16_t, | ||
235 | pub flags: ::uint16_t, | ||
236 | pub fflags: ::uint32_t, | ||
237 | pub data: ::int64_t, | ||
238 | pub udata: ::uint64_t, | ||
239 | pub ext: [::uint64_t; 2], | ||
240 | } | ||
241 | |||
242 | pub struct dqblk { | ||
243 | pub dqb_bhardlimit: ::uint64_t, | ||
244 | pub dqb_bsoftlimit: ::uint64_t, | ||
245 | pub dqb_curbytes: ::uint64_t, | ||
246 | pub dqb_ihardlimit: ::uint32_t, | ||
247 | pub dqb_isoftlimit: ::uint32_t, | ||
248 | pub dqb_curinodes: ::uint32_t, | ||
249 | pub dqb_btime: ::uint32_t, | ||
250 | pub dqb_itime: ::uint32_t, | ||
251 | pub dqb_id: ::uint32_t, | ||
252 | pub dqb_spare: [::uint32_t; 4], | ||
253 | } | ||
254 | |||
255 | pub struct termios { | ||
256 | pub c_iflag: ::tcflag_t, | ||
257 | pub c_oflag: ::tcflag_t, | ||
258 | pub c_cflag: ::tcflag_t, | ||
259 | pub c_lflag: ::tcflag_t, | ||
260 | pub c_cc: [::cc_t; ::NCCS], | ||
261 | pub c_ispeed: ::speed_t, | ||
262 | pub c_ospeed: ::speed_t, | ||
263 | } | ||
264 | |||
265 | pub struct flock { | ||
266 | pub l_start: ::off_t, | ||
267 | pub l_len: ::off_t, | ||
268 | pub l_pid: ::pid_t, | ||
269 | pub l_type: ::c_short, | ||
270 | pub l_whence: ::c_short, | ||
271 | } | ||
272 | |||
273 | pub struct sf_hdtr { | ||
274 | pub headers: *mut ::iovec, | ||
275 | pub hdr_cnt: ::c_int, | ||
276 | pub trailers: *mut ::iovec, | ||
277 | pub trl_cnt: ::c_int, | ||
278 | } | ||
279 | |||
280 | pub struct lconv { | ||
281 | pub decimal_point: *mut ::c_char, | ||
282 | pub thousands_sep: *mut ::c_char, | ||
283 | pub grouping: *mut ::c_char, | ||
284 | pub int_curr_symbol: *mut ::c_char, | ||
285 | pub currency_symbol: *mut ::c_char, | ||
286 | pub mon_decimal_point: *mut ::c_char, | ||
287 | pub mon_thousands_sep: *mut ::c_char, | ||
288 | pub mon_grouping: *mut ::c_char, | ||
289 | pub positive_sign: *mut ::c_char, | ||
290 | pub negative_sign: *mut ::c_char, | ||
291 | pub int_frac_digits: ::c_char, | ||
292 | pub frac_digits: ::c_char, | ||
293 | pub p_cs_precedes: ::c_char, | ||
294 | pub p_sep_by_space: ::c_char, | ||
295 | pub n_cs_precedes: ::c_char, | ||
296 | pub n_sep_by_space: ::c_char, | ||
297 | pub p_sign_posn: ::c_char, | ||
298 | pub n_sign_posn: ::c_char, | ||
299 | pub int_p_cs_precedes: ::c_char, | ||
300 | pub int_n_cs_precedes: ::c_char, | ||
301 | pub int_p_sep_by_space: ::c_char, | ||
302 | pub int_n_sep_by_space: ::c_char, | ||
303 | pub int_p_sign_posn: ::c_char, | ||
304 | pub int_n_sign_posn: ::c_char, | ||
305 | } | ||
306 | } | ||
307 | |||
308 | pub const _UTX_USERSIZE: usize = 256; | ||
309 | pub const _UTX_LINESIZE: usize = 32; | ||
310 | pub const _UTX_IDSIZE: usize = 4; | ||
311 | pub const _UTX_HOSTSIZE: usize = 256; | ||
312 | |||
313 | pub const EMPTY: ::c_short = 0; | ||
314 | pub const RUN_LVL: ::c_short = 1; | ||
315 | pub const BOOT_TIME: ::c_short = 2; | ||
316 | pub const OLD_TIME: ::c_short = 3; | ||
317 | pub const NEW_TIME: ::c_short = 4; | ||
318 | pub const INIT_PROCESS: ::c_short = 5; | ||
319 | pub const LOGIN_PROCESS: ::c_short = 6; | ||
320 | pub const USER_PROCESS: ::c_short = 7; | ||
321 | pub const DEAD_PROCESS: ::c_short = 8; | ||
322 | pub const ACCOUNTING: ::c_short = 9; | ||
323 | pub const SIGNATURE: ::c_short = 10; | ||
324 | pub const SHUTDOWN_TIME: ::c_short = 11; | ||
325 | |||
326 | pub const LC_COLLATE_MASK: ::c_int = (1 << 0); | ||
327 | pub const LC_CTYPE_MASK: ::c_int = (1 << 1); | ||
328 | pub const LC_MESSAGES_MASK: ::c_int = (1 << 2); | ||
329 | pub const LC_MONETARY_MASK: ::c_int = (1 << 3); | ||
330 | pub const LC_NUMERIC_MASK: ::c_int = (1 << 4); | ||
331 | pub const LC_TIME_MASK: ::c_int = (1 << 5); | ||
332 | pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK | ||
333 | | LC_CTYPE_MASK | ||
334 | | LC_MESSAGES_MASK | ||
335 | | LC_MONETARY_MASK | ||
336 | | LC_NUMERIC_MASK | ||
337 | | LC_TIME_MASK; | ||
338 | |||
339 | pub const CODESET: ::nl_item = 0; | ||
340 | pub const D_T_FMT: ::nl_item = 1; | ||
341 | pub const D_FMT: ::nl_item = 2; | ||
342 | pub const T_FMT: ::nl_item = 3; | ||
343 | pub const T_FMT_AMPM: ::nl_item = 4; | ||
344 | pub const AM_STR: ::nl_item = 5; | ||
345 | pub const PM_STR: ::nl_item = 6; | ||
346 | |||
347 | pub const DAY_1: ::nl_item = 7; | ||
348 | pub const DAY_2: ::nl_item = 8; | ||
349 | pub const DAY_3: ::nl_item = 9; | ||
350 | pub const DAY_4: ::nl_item = 10; | ||
351 | pub const DAY_5: ::nl_item = 11; | ||
352 | pub const DAY_6: ::nl_item = 12; | ||
353 | pub const DAY_7: ::nl_item = 13; | ||
354 | |||
355 | pub const ABDAY_1: ::nl_item = 14; | ||
356 | pub const ABDAY_2: ::nl_item = 15; | ||
357 | pub const ABDAY_3: ::nl_item = 16; | ||
358 | pub const ABDAY_4: ::nl_item = 17; | ||
359 | pub const ABDAY_5: ::nl_item = 18; | ||
360 | pub const ABDAY_6: ::nl_item = 19; | ||
361 | pub const ABDAY_7: ::nl_item = 20; | ||
362 | |||
363 | pub const MON_1: ::nl_item = 21; | ||
364 | pub const MON_2: ::nl_item = 22; | ||
365 | pub const MON_3: ::nl_item = 23; | ||
366 | pub const MON_4: ::nl_item = 24; | ||
367 | pub const MON_5: ::nl_item = 25; | ||
368 | pub const MON_6: ::nl_item = 26; | ||
369 | pub const MON_7: ::nl_item = 27; | ||
370 | pub const MON_8: ::nl_item = 28; | ||
371 | pub const MON_9: ::nl_item = 29; | ||
372 | pub const MON_10: ::nl_item = 30; | ||
373 | pub const MON_11: ::nl_item = 31; | ||
374 | pub const MON_12: ::nl_item = 32; | ||
375 | |||
376 | pub const ABMON_1: ::nl_item = 33; | ||
377 | pub const ABMON_2: ::nl_item = 34; | ||
378 | pub const ABMON_3: ::nl_item = 35; | ||
379 | pub const ABMON_4: ::nl_item = 36; | ||
380 | pub const ABMON_5: ::nl_item = 37; | ||
381 | pub const ABMON_6: ::nl_item = 38; | ||
382 | pub const ABMON_7: ::nl_item = 39; | ||
383 | pub const ABMON_8: ::nl_item = 40; | ||
384 | pub const ABMON_9: ::nl_item = 41; | ||
385 | pub const ABMON_10: ::nl_item = 42; | ||
386 | pub const ABMON_11: ::nl_item = 43; | ||
387 | pub const ABMON_12: ::nl_item = 44; | ||
388 | |||
389 | pub const ERA: ::nl_item = 45; | ||
390 | pub const ERA_D_FMT: ::nl_item = 46; | ||
391 | pub const ERA_D_T_FMT: ::nl_item = 47; | ||
392 | pub const ERA_T_FMT: ::nl_item = 48; | ||
393 | pub const ALT_DIGITS: ::nl_item = 49; | ||
394 | |||
395 | pub const RADIXCHAR: ::nl_item = 50; | ||
396 | pub const THOUSEP: ::nl_item = 51; | ||
397 | |||
398 | pub const YESEXPR: ::nl_item = 52; | ||
399 | pub const NOEXPR: ::nl_item = 53; | ||
400 | |||
401 | pub const YESSTR: ::nl_item = 54; | ||
402 | pub const NOSTR: ::nl_item = 55; | ||
403 | |||
404 | pub const CRNCYSTR: ::nl_item = 56; | ||
405 | |||
406 | pub const D_MD_ORDER: ::nl_item = 57; | ||
407 | |||
408 | pub const EXIT_FAILURE: ::c_int = 1; | ||
409 | pub const EXIT_SUCCESS: ::c_int = 0; | ||
410 | pub const RAND_MAX: ::c_int = 2147483647; | ||
411 | pub const EOF: ::c_int = -1; | ||
412 | pub const SEEK_SET: ::c_int = 0; | ||
413 | pub const SEEK_CUR: ::c_int = 1; | ||
414 | pub const SEEK_END: ::c_int = 2; | ||
415 | pub const _IOFBF: ::c_int = 0; | ||
416 | pub const _IONBF: ::c_int = 2; | ||
417 | pub const _IOLBF: ::c_int = 1; | ||
418 | pub const BUFSIZ: ::c_uint = 1024; | ||
419 | pub const FOPEN_MAX: ::c_uint = 20; | ||
420 | pub const FILENAME_MAX: ::c_uint = 1024; | ||
421 | pub const L_tmpnam: ::c_uint = 1024; | ||
422 | pub const TMP_MAX: ::c_uint = 308915776; | ||
423 | pub const _PC_LINK_MAX: ::c_int = 1; | ||
424 | pub const _PC_MAX_CANON: ::c_int = 2; | ||
425 | pub const _PC_MAX_INPUT: ::c_int = 3; | ||
426 | pub const _PC_NAME_MAX: ::c_int = 4; | ||
427 | pub const _PC_PATH_MAX: ::c_int = 5; | ||
428 | pub const _PC_PIPE_BUF: ::c_int = 6; | ||
429 | pub const _PC_CHOWN_RESTRICTED: ::c_int = 7; | ||
430 | pub const _PC_NO_TRUNC: ::c_int = 8; | ||
431 | pub const _PC_VDISABLE: ::c_int = 9; | ||
432 | pub const O_RDONLY: ::c_int = 0; | ||
433 | pub const O_WRONLY: ::c_int = 1; | ||
434 | pub const O_RDWR: ::c_int = 2; | ||
435 | pub const O_APPEND: ::c_int = 8; | ||
436 | pub const O_CREAT: ::c_int = 512; | ||
437 | pub const O_EXCL: ::c_int = 2048; | ||
438 | pub const O_NOCTTY: ::c_int = 131072; | ||
439 | pub const O_TRUNC: ::c_int = 1024; | ||
440 | pub const O_CLOEXEC: ::c_int = 0x1000000; | ||
441 | pub const O_DIRECTORY: ::c_int = 0x100000; | ||
442 | pub const S_IFIFO: mode_t = 4096; | ||
443 | pub const S_IFCHR: mode_t = 8192; | ||
444 | pub const S_IFBLK: mode_t = 24576; | ||
445 | pub const S_IFDIR: mode_t = 16384; | ||
446 | pub const S_IFREG: mode_t = 32768; | ||
447 | pub const S_IFLNK: mode_t = 40960; | ||
448 | pub const S_IFSOCK: mode_t = 49152; | ||
449 | pub const S_IFMT: mode_t = 61440; | ||
450 | pub const S_IEXEC: mode_t = 64; | ||
451 | pub const S_IWRITE: mode_t = 128; | ||
452 | pub const S_IREAD: mode_t = 256; | ||
453 | pub const S_IRWXU: mode_t = 448; | ||
454 | pub const S_IXUSR: mode_t = 64; | ||
455 | pub const S_IWUSR: mode_t = 128; | ||
456 | pub const S_IRUSR: mode_t = 256; | ||
457 | pub const S_IRWXG: mode_t = 56; | ||
458 | pub const S_IXGRP: mode_t = 8; | ||
459 | pub const S_IWGRP: mode_t = 16; | ||
460 | pub const S_IRGRP: mode_t = 32; | ||
461 | pub const S_IRWXO: mode_t = 7; | ||
462 | pub const S_IXOTH: mode_t = 1; | ||
463 | pub const S_IWOTH: mode_t = 2; | ||
464 | pub const S_IROTH: mode_t = 4; | ||
465 | pub const F_OK: ::c_int = 0; | ||
466 | pub const R_OK: ::c_int = 4; | ||
467 | pub const W_OK: ::c_int = 2; | ||
468 | pub const X_OK: ::c_int = 1; | ||
469 | pub const STDIN_FILENO: ::c_int = 0; | ||
470 | pub const STDOUT_FILENO: ::c_int = 1; | ||
471 | pub const STDERR_FILENO: ::c_int = 2; | ||
472 | pub const F_LOCK: ::c_int = 1; | ||
473 | pub const F_TEST: ::c_int = 3; | ||
474 | pub const F_TLOCK: ::c_int = 2; | ||
475 | pub const F_ULOCK: ::c_int = 0; | ||
476 | pub const F_GETLK: ::c_int = 7; | ||
477 | pub const F_SETLK: ::c_int = 8; | ||
478 | pub const F_SETLKW: ::c_int = 9; | ||
479 | pub const SIGHUP: ::c_int = 1; | ||
480 | pub const SIGINT: ::c_int = 2; | ||
481 | pub const SIGQUIT: ::c_int = 3; | ||
482 | pub const SIGILL: ::c_int = 4; | ||
483 | pub const SIGABRT: ::c_int = 6; | ||
484 | pub const SIGEMT: ::c_int = 7; | ||
485 | pub const SIGFPE: ::c_int = 8; | ||
486 | pub const SIGKILL: ::c_int = 9; | ||
487 | pub const SIGSEGV: ::c_int = 11; | ||
488 | pub const SIGPIPE: ::c_int = 13; | ||
489 | pub const SIGALRM: ::c_int = 14; | ||
490 | pub const SIGTERM: ::c_int = 15; | ||
491 | |||
492 | pub const PROT_NONE: ::c_int = 0; | ||
493 | pub const PROT_READ: ::c_int = 1; | ||
494 | pub const PROT_WRITE: ::c_int = 2; | ||
495 | pub const PROT_EXEC: ::c_int = 4; | ||
496 | |||
497 | pub const MAP_FILE: ::c_int = 0x0000; | ||
498 | pub const MAP_SHARED: ::c_int = 0x0001; | ||
499 | pub const MAP_PRIVATE: ::c_int = 0x0002; | ||
500 | pub const MAP_FIXED: ::c_int = 0x0010; | ||
501 | pub const MAP_ANON: ::c_int = 0x1000; | ||
502 | |||
503 | pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; | ||
504 | |||
505 | pub const MCL_CURRENT: ::c_int = 0x0001; | ||
506 | pub const MCL_FUTURE: ::c_int = 0x0002; | ||
507 | |||
508 | pub const MS_ASYNC: ::c_int = 0x0001; | ||
509 | pub const MS_INVALIDATE: ::c_int = 0x0002; | ||
510 | pub const MS_SYNC: ::c_int = 0x0010; | ||
511 | |||
512 | pub const MS_KILLPAGES: ::c_int = 0x0004; | ||
513 | pub const MS_DEACTIVATE: ::c_int = 0x0008; | ||
514 | |||
515 | pub const EPERM: ::c_int = 1; | ||
516 | pub const ENOENT: ::c_int = 2; | ||
517 | pub const ESRCH: ::c_int = 3; | ||
518 | pub const EINTR: ::c_int = 4; | ||
519 | pub const EIO: ::c_int = 5; | ||
520 | pub const ENXIO: ::c_int = 6; | ||
521 | pub const E2BIG: ::c_int = 7; | ||
522 | pub const ENOEXEC: ::c_int = 8; | ||
523 | pub const EBADF: ::c_int = 9; | ||
524 | pub const ECHILD: ::c_int = 10; | ||
525 | pub const EDEADLK: ::c_int = 11; | ||
526 | pub const ENOMEM: ::c_int = 12; | ||
527 | pub const EACCES: ::c_int = 13; | ||
528 | pub const EFAULT: ::c_int = 14; | ||
529 | pub const ENOTBLK: ::c_int = 15; | ||
530 | pub const EBUSY: ::c_int = 16; | ||
531 | pub const EEXIST: ::c_int = 17; | ||
532 | pub const EXDEV: ::c_int = 18; | ||
533 | pub const ENODEV: ::c_int = 19; | ||
534 | pub const ENOTDIR: ::c_int = 20; | ||
535 | pub const EISDIR: ::c_int = 21; | ||
536 | pub const EINVAL: ::c_int = 22; | ||
537 | pub const ENFILE: ::c_int = 23; | ||
538 | pub const EMFILE: ::c_int = 24; | ||
539 | pub const ENOTTY: ::c_int = 25; | ||
540 | pub const ETXTBSY: ::c_int = 26; | ||
541 | pub const EFBIG: ::c_int = 27; | ||
542 | pub const ENOSPC: ::c_int = 28; | ||
543 | pub const ESPIPE: ::c_int = 29; | ||
544 | pub const EROFS: ::c_int = 30; | ||
545 | pub const EMLINK: ::c_int = 31; | ||
546 | pub const EPIPE: ::c_int = 32; | ||
547 | pub const EDOM: ::c_int = 33; | ||
548 | pub const ERANGE: ::c_int = 34; | ||
549 | pub const EAGAIN: ::c_int = 35; | ||
550 | pub const EWOULDBLOCK: ::c_int = EAGAIN; | ||
551 | pub const EINPROGRESS: ::c_int = 36; | ||
552 | pub const EALREADY: ::c_int = 37; | ||
553 | pub const ENOTSOCK: ::c_int = 38; | ||
554 | pub const EDESTADDRREQ: ::c_int = 39; | ||
555 | pub const EMSGSIZE: ::c_int = 40; | ||
556 | pub const EPROTOTYPE: ::c_int = 41; | ||
557 | pub const ENOPROTOOPT: ::c_int = 42; | ||
558 | pub const EPROTONOSUPPORT: ::c_int = 43; | ||
559 | pub const ESOCKTNOSUPPORT: ::c_int = 44; | ||
560 | pub const ENOTSUP: ::c_int = 45; | ||
561 | pub const EPFNOSUPPORT: ::c_int = 46; | ||
562 | pub const EAFNOSUPPORT: ::c_int = 47; | ||
563 | pub const EADDRINUSE: ::c_int = 48; | ||
564 | pub const EADDRNOTAVAIL: ::c_int = 49; | ||
565 | pub const ENETDOWN: ::c_int = 50; | ||
566 | pub const ENETUNREACH: ::c_int = 51; | ||
567 | pub const ENETRESET: ::c_int = 52; | ||
568 | pub const ECONNABORTED: ::c_int = 53; | ||
569 | pub const ECONNRESET: ::c_int = 54; | ||
570 | pub const ENOBUFS: ::c_int = 55; | ||
571 | pub const EISCONN: ::c_int = 56; | ||
572 | pub const ENOTCONN: ::c_int = 57; | ||
573 | pub const ESHUTDOWN: ::c_int = 58; | ||
574 | pub const ETOOMANYREFS: ::c_int = 59; | ||
575 | pub const ETIMEDOUT: ::c_int = 60; | ||
576 | pub const ECONNREFUSED: ::c_int = 61; | ||
577 | pub const ELOOP: ::c_int = 62; | ||
578 | pub const ENAMETOOLONG: ::c_int = 63; | ||
579 | pub const EHOSTDOWN: ::c_int = 64; | ||
580 | pub const EHOSTUNREACH: ::c_int = 65; | ||
581 | pub const ENOTEMPTY: ::c_int = 66; | ||
582 | pub const EPROCLIM: ::c_int = 67; | ||
583 | pub const EUSERS: ::c_int = 68; | ||
584 | pub const EDQUOT: ::c_int = 69; | ||
585 | pub const ESTALE: ::c_int = 70; | ||
586 | pub const EREMOTE: ::c_int = 71; | ||
587 | pub const EBADRPC: ::c_int = 72; | ||
588 | pub const ERPCMISMATCH: ::c_int = 73; | ||
589 | pub const EPROGUNAVAIL: ::c_int = 74; | ||
590 | pub const EPROGMISMATCH: ::c_int = 75; | ||
591 | pub const EPROCUNAVAIL: ::c_int = 76; | ||
592 | pub const ENOLCK: ::c_int = 77; | ||
593 | pub const ENOSYS: ::c_int = 78; | ||
594 | pub const EFTYPE: ::c_int = 79; | ||
595 | pub const EAUTH: ::c_int = 80; | ||
596 | pub const ENEEDAUTH: ::c_int = 81; | ||
597 | pub const EPWROFF: ::c_int = 82; | ||
598 | pub const EDEVERR: ::c_int = 83; | ||
599 | pub const EOVERFLOW: ::c_int = 84; | ||
600 | pub const EBADEXEC: ::c_int = 85; | ||
601 | pub const EBADARCH: ::c_int = 86; | ||
602 | pub const ESHLIBVERS: ::c_int = 87; | ||
603 | pub const EBADMACHO: ::c_int = 88; | ||
604 | pub const ECANCELED: ::c_int = 89; | ||
605 | pub const EIDRM: ::c_int = 90; | ||
606 | pub const ENOMSG: ::c_int = 91; | ||
607 | pub const EILSEQ: ::c_int = 92; | ||
608 | pub const ENOATTR: ::c_int = 93; | ||
609 | pub const EBADMSG: ::c_int = 94; | ||
610 | pub const EMULTIHOP: ::c_int = 95; | ||
611 | pub const ENODATA: ::c_int = 96; | ||
612 | pub const ENOLINK: ::c_int = 97; | ||
613 | pub const ENOSR: ::c_int = 98; | ||
614 | pub const ENOSTR: ::c_int = 99; | ||
615 | pub const EPROTO: ::c_int = 100; | ||
616 | pub const ETIME: ::c_int = 101; | ||
617 | pub const EOPNOTSUPP: ::c_int = 102; | ||
618 | pub const ENOPOLICY: ::c_int = 103; | ||
619 | pub const ENOTRECOVERABLE: ::c_int = 104; | ||
620 | pub const EOWNERDEAD: ::c_int = 105; | ||
621 | pub const EQFULL: ::c_int = 106; | ||
622 | pub const ELAST: ::c_int = 106; | ||
623 | |||
624 | pub const F_DUPFD: ::c_int = 0; | ||
625 | pub const F_DUPFD_CLOEXEC: ::c_int = 67; | ||
626 | pub const F_GETFD: ::c_int = 1; | ||
627 | pub const F_SETFD: ::c_int = 2; | ||
628 | pub const F_GETFL: ::c_int = 3; | ||
629 | pub const F_SETFL: ::c_int = 4; | ||
630 | pub const F_PREALLOCATE: ::c_int = 42; | ||
631 | pub const F_RDADVISE: ::c_int = 44; | ||
632 | pub const F_RDAHEAD: ::c_int = 45; | ||
633 | pub const F_NOCACHE: ::c_int = 48; | ||
634 | pub const F_GETPATH: ::c_int = 50; | ||
635 | pub const F_FULLFSYNC: ::c_int = 51; | ||
636 | pub const F_FREEZE_FS: ::c_int = 53; | ||
637 | pub const F_THAW_FS: ::c_int = 54; | ||
638 | pub const F_GLOBAL_NOCACHE: ::c_int = 55; | ||
639 | pub const F_NODIRECT: ::c_int = 62; | ||
640 | |||
641 | pub const F_ALLOCATECONTIG: ::c_uint = 0x02; | ||
642 | pub const F_ALLOCATEALL: ::c_uint = 0x04; | ||
643 | |||
644 | pub const F_PEOFPOSMODE: ::c_int = 3; | ||
645 | pub const F_VOLPOSMODE: ::c_int = 4; | ||
646 | |||
647 | pub const O_ACCMODE: ::c_int = 3; | ||
648 | |||
649 | pub const TIOCMODG: ::c_ulong = 0x40047403; | ||
650 | pub const TIOCMODS: ::c_ulong = 0x80047404; | ||
651 | pub const TIOCM_LE: ::c_int = 0x1; | ||
652 | pub const TIOCM_DTR: ::c_int = 0x2; | ||
653 | pub const TIOCM_RTS: ::c_int = 0x4; | ||
654 | pub const TIOCM_ST: ::c_int = 0x8; | ||
655 | pub const TIOCM_SR: ::c_int = 0x10; | ||
656 | pub const TIOCM_CTS: ::c_int = 0x20; | ||
657 | pub const TIOCM_CAR: ::c_int = 0x40; | ||
658 | pub const TIOCM_CD: ::c_int = 0x40; | ||
659 | pub const TIOCM_RNG: ::c_int = 0x80; | ||
660 | pub const TIOCM_RI: ::c_int = 0x80; | ||
661 | pub const TIOCM_DSR: ::c_int = 0x100; | ||
662 | pub const TIOCEXCL: ::c_int = 0x2000740d; | ||
663 | pub const TIOCNXCL: ::c_int = 0x2000740e; | ||
664 | pub const TIOCFLUSH: ::c_ulong = 0x80047410; | ||
665 | pub const TIOCGETD: ::c_ulong = 0x4004741a; | ||
666 | pub const TIOCSETD: ::c_ulong = 0x8004741b; | ||
667 | pub const TIOCIXON: ::c_uint = 0x20007481; | ||
668 | pub const TIOCIXOFF: ::c_uint = 0x20007480; | ||
669 | pub const TIOCSBRK: ::c_uint = 0x2000747b; | ||
670 | pub const TIOCCBRK: ::c_uint = 0x2000747a; | ||
671 | pub const TIOCSDTR: ::c_uint = 0x20007479; | ||
672 | pub const TIOCCDTR: ::c_uint = 0x20007478; | ||
673 | pub const TIOCGPGRP: ::c_ulong = 0x40047477; | ||
674 | pub const TIOCSPGRP: ::c_ulong = 0x80047476; | ||
675 | pub const TIOCOUTQ: ::c_ulong = 0x40047473; | ||
676 | pub const TIOCSTI: ::c_ulong = 0x80017472; | ||
677 | pub const TIOCNOTTY: ::c_uint = 0x20007471; | ||
678 | pub const TIOCPKT: ::c_ulong = 0x80047470; | ||
679 | pub const TIOCPKT_DATA: ::c_int = 0x0; | ||
680 | pub const TIOCPKT_FLUSHREAD: ::c_int = 0x1; | ||
681 | pub const TIOCPKT_FLUSHWRITE: ::c_int = 0x2; | ||
682 | pub const TIOCPKT_STOP: ::c_int = 0x4; | ||
683 | pub const TIOCPKT_START: ::c_int = 0x8; | ||
684 | pub const TIOCPKT_NOSTOP: ::c_int = 0x10; | ||
685 | pub const TIOCPKT_DOSTOP: ::c_int = 0x20; | ||
686 | pub const TIOCPKT_IOCTL: ::c_int = 0x40; | ||
687 | pub const TIOCSTOP: ::c_uint = 0x2000746f; | ||
688 | pub const TIOCSTART: ::c_uint = 0x2000746e; | ||
689 | pub const TIOCMSET: ::c_ulong = 0x8004746d; | ||
690 | pub const TIOCMBIS: ::c_ulong = 0x8004746c; | ||
691 | pub const TIOCMBIC: ::c_ulong = 0x8004746b; | ||
692 | pub const TIOCMGET: ::c_ulong = 0x4004746a; | ||
693 | pub const TIOCREMOTE: ::c_ulong = 0x80047469; | ||
694 | pub const TIOCGWINSZ: ::c_ulong = 0x40087468; | ||
695 | pub const TIOCSWINSZ: ::c_ulong = 0x80087467; | ||
696 | pub const TIOCUCNTL: ::c_ulong = 0x80047466; | ||
697 | pub const TIOCSTAT: ::c_uint = 0x20007465; | ||
698 | pub const TIOCSCONS: ::c_uint = 0x20007463; | ||
699 | pub const TIOCCONS: ::c_ulong = 0x80047462; | ||
700 | pub const TIOCSCTTY: ::c_uint = 0x20007461; | ||
701 | pub const TIOCEXT: ::c_ulong = 0x80047460; | ||
702 | pub const TIOCSIG: ::c_uint = 0x2000745f; | ||
703 | pub const TIOCDRAIN: ::c_uint = 0x2000745e; | ||
704 | pub const TIOCMSDTRWAIT: ::c_ulong = 0x8004745b; | ||
705 | pub const TIOCMGDTRWAIT: ::c_ulong = 0x4004745a; | ||
706 | pub const TIOCSDRAINWAIT: ::c_ulong = 0x80047457; | ||
707 | pub const TIOCGDRAINWAIT: ::c_ulong = 0x40047456; | ||
708 | pub const TIOCDSIMICROCODE: ::c_uint = 0x20007455; | ||
709 | pub const TIOCPTYGRANT: ::c_uint = 0x20007454; | ||
710 | pub const TIOCPTYGNAME: ::c_uint = 0x40807453; | ||
711 | pub const TIOCPTYUNLK: ::c_uint = 0x20007452; | ||
712 | |||
713 | pub const SIGTRAP: ::c_int = 5; | ||
714 | |||
715 | pub const GLOB_APPEND : ::c_int = 0x0001; | ||
716 | pub const GLOB_DOOFFS : ::c_int = 0x0002; | ||
717 | pub const GLOB_ERR : ::c_int = 0x0004; | ||
718 | pub const GLOB_MARK : ::c_int = 0x0008; | ||
719 | pub const GLOB_NOCHECK : ::c_int = 0x0010; | ||
720 | pub const GLOB_NOSORT : ::c_int = 0x0020; | ||
721 | pub const GLOB_NOESCAPE: ::c_int = 0x2000; | ||
722 | |||
723 | pub const GLOB_NOSPACE : ::c_int = -1; | ||
724 | pub const GLOB_ABORTED : ::c_int = -2; | ||
725 | pub const GLOB_NOMATCH : ::c_int = -3; | ||
726 | |||
727 | pub const POSIX_MADV_NORMAL: ::c_int = 0; | ||
728 | pub const POSIX_MADV_RANDOM: ::c_int = 1; | ||
729 | pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; | ||
730 | pub const POSIX_MADV_WILLNEED: ::c_int = 3; | ||
731 | pub const POSIX_MADV_DONTNEED: ::c_int = 4; | ||
732 | |||
733 | pub const _SC_IOV_MAX: ::c_int = 56; | ||
734 | pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70; | ||
735 | pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71; | ||
736 | pub const _SC_LOGIN_NAME_MAX: ::c_int = 73; | ||
737 | pub const _SC_MQ_PRIO_MAX: ::c_int = 75; | ||
738 | pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82; | ||
739 | pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83; | ||
740 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85; | ||
741 | pub const _SC_THREAD_KEYS_MAX: ::c_int = 86; | ||
742 | pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87; | ||
743 | pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88; | ||
744 | pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89; | ||
745 | pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90; | ||
746 | pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91; | ||
747 | pub const _SC_THREAD_STACK_MIN: ::c_int = 93; | ||
748 | pub const _SC_THREAD_THREADS_MAX: ::c_int = 94; | ||
749 | pub const _SC_THREADS: ::c_int = 96; | ||
750 | pub const _SC_TTY_NAME_MAX: ::c_int = 101; | ||
751 | pub const _SC_ATEXIT_MAX: ::c_int = 107; | ||
752 | pub const _SC_XOPEN_CRYPT: ::c_int = 108; | ||
753 | pub const _SC_XOPEN_ENH_I18N: ::c_int = 109; | ||
754 | pub const _SC_XOPEN_LEGACY: ::c_int = 110; | ||
755 | pub const _SC_XOPEN_REALTIME: ::c_int = 111; | ||
756 | pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112; | ||
757 | pub const _SC_XOPEN_SHM: ::c_int = 113; | ||
758 | pub const _SC_XOPEN_UNIX: ::c_int = 115; | ||
759 | pub const _SC_XOPEN_VERSION: ::c_int = 116; | ||
760 | pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121; | ||
761 | |||
762 | pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1; | ||
763 | pub const PTHREAD_CREATE_DETACHED: ::c_int = 2; | ||
764 | pub const PTHREAD_STACK_MIN: ::size_t = 8192; | ||
765 | |||
766 | pub const RLIMIT_CPU: ::c_int = 0; | ||
767 | pub const RLIMIT_FSIZE: ::c_int = 1; | ||
768 | pub const RLIMIT_DATA: ::c_int = 2; | ||
769 | pub const RLIMIT_STACK: ::c_int = 3; | ||
770 | pub const RLIMIT_CORE: ::c_int = 4; | ||
771 | pub const RLIMIT_AS: ::c_int = 5; | ||
772 | pub const RLIMIT_RSS: ::c_int = RLIMIT_AS; | ||
773 | pub const RLIMIT_MEMLOCK: ::c_int = 6; | ||
774 | pub const RLIMIT_NPROC: ::c_int = 7; | ||
775 | pub const RLIMIT_NOFILE: ::c_int = 8; | ||
776 | pub const RLIM_NLIMITS: ::c_int = 9; | ||
777 | pub const _RLIMIT_POSIX_FLAG: ::c_int = 0x1000; | ||
778 | |||
779 | pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff; | ||
780 | |||
781 | pub const RUSAGE_SELF: ::c_int = 0; | ||
782 | pub const RUSAGE_CHILDREN: ::c_int = -1; | ||
783 | |||
784 | pub const MADV_NORMAL: ::c_int = 0; | ||
785 | pub const MADV_RANDOM: ::c_int = 1; | ||
786 | pub const MADV_SEQUENTIAL: ::c_int = 2; | ||
787 | pub const MADV_WILLNEED: ::c_int = 3; | ||
788 | pub const MADV_DONTNEED: ::c_int = 4; | ||
789 | pub const MADV_FREE: ::c_int = 5; | ||
790 | pub const MADV_ZERO_WIRED_PAGES: ::c_int = 6; | ||
791 | pub const MADV_FREE_REUSABLE: ::c_int = 7; | ||
792 | pub const MADV_FREE_REUSE: ::c_int = 8; | ||
793 | pub const MADV_CAN_REUSE: ::c_int = 9; | ||
794 | |||
795 | pub const MINCORE_INCORE: ::c_int = 0x1; | ||
796 | pub const MINCORE_REFERENCED: ::c_int = 0x2; | ||
797 | pub const MINCORE_MODIFIED: ::c_int = 0x4; | ||
798 | pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8; | ||
799 | pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10; | ||
800 | |||
801 | pub const AF_UNIX: ::c_int = 1; | ||
802 | pub const AF_INET: ::c_int = 2; | ||
803 | pub const AF_INET6: ::c_int = 30; | ||
804 | pub const SOCK_STREAM: ::c_int = 1; | ||
805 | pub const SOCK_DGRAM: ::c_int = 2; | ||
806 | pub const SOCK_RAW: ::c_int = 3; | ||
807 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
808 | pub const IPPROTO_TCP: ::c_int = 6; | ||
809 | pub const IPPROTO_IP: ::c_int = 0; | ||
810 | pub const IPPROTO_IPV6: ::c_int = 41; | ||
811 | pub const IP_MULTICAST_TTL: ::c_int = 10; | ||
812 | pub const IP_MULTICAST_LOOP: ::c_int = 11; | ||
813 | pub const IP_TTL: ::c_int = 4; | ||
814 | pub const IP_HDRINCL: ::c_int = 2; | ||
815 | pub const IP_ADD_MEMBERSHIP: ::c_int = 12; | ||
816 | pub const IP_DROP_MEMBERSHIP: ::c_int = 13; | ||
817 | pub const IPV6_JOIN_GROUP: ::c_int = 12; | ||
818 | pub const IPV6_LEAVE_GROUP: ::c_int = 13; | ||
819 | |||
820 | pub const TCP_NODELAY: ::c_int = 0x01; | ||
821 | pub const TCP_KEEPALIVE: ::c_int = 0x10; | ||
822 | pub const SOL_SOCKET: ::c_int = 0xffff; | ||
823 | |||
824 | pub const SO_DEBUG: ::c_int = 0x01; | ||
825 | pub const SO_ACCEPTCONN: ::c_int = 0x0002; | ||
826 | pub const SO_REUSEADDR: ::c_int = 0x0004; | ||
827 | pub const SO_KEEPALIVE: ::c_int = 0x0008; | ||
828 | pub const SO_DONTROUTE: ::c_int = 0x0010; | ||
829 | pub const SO_BROADCAST: ::c_int = 0x0020; | ||
830 | pub const SO_USELOOPBACK: ::c_int = 0x0040; | ||
831 | pub const SO_LINGER: ::c_int = 0x0080; | ||
832 | pub const SO_OOBINLINE: ::c_int = 0x0100; | ||
833 | pub const SO_REUSEPORT: ::c_int = 0x0200; | ||
834 | pub const SO_SNDBUF: ::c_int = 0x1001; | ||
835 | pub const SO_RCVBUF: ::c_int = 0x1002; | ||
836 | pub const SO_SNDLOWAT: ::c_int = 0x1003; | ||
837 | pub const SO_RCVLOWAT: ::c_int = 0x1004; | ||
838 | pub const SO_SNDTIMEO: ::c_int = 0x1005; | ||
839 | pub const SO_RCVTIMEO: ::c_int = 0x1006; | ||
840 | pub const SO_ERROR: ::c_int = 0x1007; | ||
841 | pub const SO_TYPE: ::c_int = 0x1008; | ||
842 | |||
843 | pub const IFF_LOOPBACK: ::c_int = 0x8; | ||
844 | |||
845 | pub const SHUT_RD: ::c_int = 0; | ||
846 | pub const SHUT_WR: ::c_int = 1; | ||
847 | pub const SHUT_RDWR: ::c_int = 2; | ||
848 | |||
849 | pub const LOCK_SH: ::c_int = 1; | ||
850 | pub const LOCK_EX: ::c_int = 2; | ||
851 | pub const LOCK_NB: ::c_int = 4; | ||
852 | pub const LOCK_UN: ::c_int = 8; | ||
853 | |||
854 | pub const O_DSYNC: ::c_int = 4194304; | ||
855 | pub const O_SYNC: ::c_int = 128; | ||
856 | pub const O_NONBLOCK: ::c_int = 4; | ||
857 | |||
858 | pub const MAP_COPY: ::c_int = 0x0002; | ||
859 | pub const MAP_RENAME: ::c_int = 0x0020; | ||
860 | pub const MAP_NORESERVE: ::c_int = 0x0040; | ||
861 | pub const MAP_NOEXTEND: ::c_int = 0x0100; | ||
862 | pub const MAP_HASSEMAPHORE: ::c_int = 0x0200; | ||
863 | pub const MAP_NOCACHE: ::c_int = 0x0400; | ||
864 | pub const MAP_JIT: ::c_int = 0x0800; | ||
865 | |||
866 | pub const IPPROTO_RAW: ::c_int = 255; | ||
867 | |||
868 | pub const SO_NREAD: ::c_int = 0x1020; | ||
869 | pub const SO_NKE: ::c_int = 0x1021; | ||
870 | pub const SO_NOSIGPIPE: ::c_int = 0x1022; | ||
871 | pub const SO_NOADDRERR: ::c_int = 0x1023; | ||
872 | pub const SO_NWRITE: ::c_int = 0x1024; | ||
873 | pub const SO_DONTTRUNC: ::c_int = 0x2000; | ||
874 | pub const SO_WANTMORE: ::c_int = 0x4000; | ||
875 | pub const SO_WANTOOBFLAG: ::c_int = 0x8000; | ||
876 | |||
877 | pub const _SC_ARG_MAX: ::c_int = 1; | ||
878 | pub const _SC_CHILD_MAX: ::c_int = 2; | ||
879 | pub const _SC_CLK_TCK: ::c_int = 3; | ||
880 | pub const _SC_NGROUPS_MAX: ::c_int = 4; | ||
881 | pub const _SC_OPEN_MAX: ::c_int = 5; | ||
882 | pub const _SC_JOB_CONTROL: ::c_int = 6; | ||
883 | pub const _SC_SAVED_IDS: ::c_int = 7; | ||
884 | pub const _SC_VERSION: ::c_int = 8; | ||
885 | pub const _SC_BC_BASE_MAX: ::c_int = 9; | ||
886 | pub const _SC_BC_DIM_MAX: ::c_int = 10; | ||
887 | pub const _SC_BC_SCALE_MAX: ::c_int = 11; | ||
888 | pub const _SC_BC_STRING_MAX: ::c_int = 12; | ||
889 | pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13; | ||
890 | pub const _SC_EXPR_NEST_MAX: ::c_int = 14; | ||
891 | pub const _SC_LINE_MAX: ::c_int = 15; | ||
892 | pub const _SC_RE_DUP_MAX: ::c_int = 16; | ||
893 | pub const _SC_2_VERSION: ::c_int = 17; | ||
894 | pub const _SC_2_C_BIND: ::c_int = 18; | ||
895 | pub const _SC_2_C_DEV: ::c_int = 19; | ||
896 | pub const _SC_2_CHAR_TERM: ::c_int = 20; | ||
897 | pub const _SC_2_FORT_DEV: ::c_int = 21; | ||
898 | pub const _SC_2_FORT_RUN: ::c_int = 22; | ||
899 | pub const _SC_2_LOCALEDEF: ::c_int = 23; | ||
900 | pub const _SC_2_SW_DEV: ::c_int = 24; | ||
901 | pub const _SC_2_UPE: ::c_int = 25; | ||
902 | pub const _SC_STREAM_MAX: ::c_int = 26; | ||
903 | pub const _SC_TZNAME_MAX: ::c_int = 27; | ||
904 | pub const _SC_ASYNCHRONOUS_IO: ::c_int = 28; | ||
905 | pub const _SC_PAGESIZE: ::c_int = 29; | ||
906 | pub const _SC_MEMLOCK: ::c_int = 30; | ||
907 | pub const _SC_MEMLOCK_RANGE: ::c_int = 31; | ||
908 | pub const _SC_MEMORY_PROTECTION: ::c_int = 32; | ||
909 | pub const _SC_MESSAGE_PASSING: ::c_int = 33; | ||
910 | pub const _SC_PRIORITIZED_IO: ::c_int = 34; | ||
911 | pub const _SC_PRIORITY_SCHEDULING: ::c_int = 35; | ||
912 | pub const _SC_REALTIME_SIGNALS: ::c_int = 36; | ||
913 | pub const _SC_SEMAPHORES: ::c_int = 37; | ||
914 | pub const _SC_FSYNC: ::c_int = 38; | ||
915 | pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 39; | ||
916 | pub const _SC_SYNCHRONIZED_IO: ::c_int = 40; | ||
917 | pub const _SC_TIMERS: ::c_int = 41; | ||
918 | pub const _SC_AIO_LISTIO_MAX: ::c_int = 42; | ||
919 | pub const _SC_AIO_MAX: ::c_int = 43; | ||
920 | pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44; | ||
921 | pub const _SC_DELAYTIMER_MAX: ::c_int = 45; | ||
922 | pub const _SC_MQ_OPEN_MAX: ::c_int = 46; | ||
923 | pub const _SC_MAPPED_FILES: ::c_int = 47; | ||
924 | pub const _SC_RTSIG_MAX: ::c_int = 48; | ||
925 | pub const _SC_SEM_NSEMS_MAX: ::c_int = 49; | ||
926 | pub const _SC_SEM_VALUE_MAX: ::c_int = 50; | ||
927 | pub const _SC_SIGQUEUE_MAX: ::c_int = 51; | ||
928 | pub const _SC_TIMER_MAX: ::c_int = 52; | ||
929 | pub const _SC_NPROCESSORS_CONF: ::c_int = 57; | ||
930 | pub const _SC_NPROCESSORS_ONLN: ::c_int = 58; | ||
931 | pub const _SC_2_PBS: ::c_int = 59; | ||
932 | pub const _SC_2_PBS_ACCOUNTING: ::c_int = 60; | ||
933 | pub const _SC_2_PBS_CHECKPOINT: ::c_int = 61; | ||
934 | pub const _SC_2_PBS_LOCATE: ::c_int = 62; | ||
935 | pub const _SC_2_PBS_MESSAGE: ::c_int = 63; | ||
936 | pub const _SC_2_PBS_TRACK: ::c_int = 64; | ||
937 | pub const _SC_ADVISORY_INFO: ::c_int = 65; | ||
938 | pub const _SC_BARRIERS: ::c_int = 66; | ||
939 | pub const _SC_CLOCK_SELECTION: ::c_int = 67; | ||
940 | pub const _SC_CPUTIME: ::c_int = 68; | ||
941 | pub const _SC_FILE_LOCKING: ::c_int = 69; | ||
942 | pub const _SC_HOST_NAME_MAX: ::c_int = 72; | ||
943 | pub const _SC_MONOTONIC_CLOCK: ::c_int = 74; | ||
944 | pub const _SC_READER_WRITER_LOCKS: ::c_int = 76; | ||
945 | pub const _SC_REGEXP: ::c_int = 77; | ||
946 | pub const _SC_SHELL: ::c_int = 78; | ||
947 | pub const _SC_SPAWN: ::c_int = 79; | ||
948 | pub const _SC_SPIN_LOCKS: ::c_int = 80; | ||
949 | pub const _SC_SPORADIC_SERVER: ::c_int = 81; | ||
950 | pub const _SC_THREAD_CPUTIME: ::c_int = 84; | ||
951 | pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 92; | ||
952 | pub const _SC_TIMEOUTS: ::c_int = 95; | ||
953 | pub const _SC_TRACE: ::c_int = 97; | ||
954 | pub const _SC_TRACE_EVENT_FILTER: ::c_int = 98; | ||
955 | pub const _SC_TRACE_INHERIT: ::c_int = 99; | ||
956 | pub const _SC_TRACE_LOG: ::c_int = 100; | ||
957 | pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 102; | ||
958 | pub const _SC_V6_ILP32_OFF32: ::c_int = 103; | ||
959 | pub const _SC_V6_ILP32_OFFBIG: ::c_int = 104; | ||
960 | pub const _SC_V6_LP64_OFF64: ::c_int = 105; | ||
961 | pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 106; | ||
962 | pub const _SC_IPV6: ::c_int = 118; | ||
963 | pub const _SC_RAW_SOCKETS: ::c_int = 119; | ||
964 | pub const _SC_SYMLOOP_MAX: ::c_int = 120; | ||
965 | pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; | ||
966 | pub const _SC_XOPEN_STREAMS: ::c_int = 114; | ||
967 | pub const _SC_XBS5_ILP32_OFF32: ::c_int = 122; | ||
968 | pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 123; | ||
969 | pub const _SC_XBS5_LP64_OFF64: ::c_int = 124; | ||
970 | pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 125; | ||
971 | pub const _SC_SS_REPL_MAX: ::c_int = 126; | ||
972 | pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 127; | ||
973 | pub const _SC_TRACE_NAME_MAX: ::c_int = 128; | ||
974 | pub const _SC_TRACE_SYS_MAX: ::c_int = 129; | ||
975 | pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 130; | ||
976 | pub const _SC_PASS_MAX: ::c_int = 131; | ||
977 | |||
978 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; | ||
979 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1; | ||
980 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; | ||
981 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; | ||
982 | pub const _PTHREAD_MUTEX_SIG_init: ::c_long = 0x32AAABA7; | ||
983 | pub const _PTHREAD_COND_SIG_init: ::c_long = 0x3CB0B1BB; | ||
984 | pub const _PTHREAD_RWLOCK_SIG_init: ::c_long = 0x2DA8B3B4; | ||
985 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { | ||
986 | __sig: _PTHREAD_MUTEX_SIG_init, | ||
987 | __opaque: [0; __PTHREAD_MUTEX_SIZE__], | ||
988 | }; | ||
989 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { | ||
990 | __sig: _PTHREAD_COND_SIG_init, | ||
991 | __opaque: [0; __PTHREAD_COND_SIZE__], | ||
992 | }; | ||
993 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { | ||
994 | __sig: _PTHREAD_RWLOCK_SIG_init, | ||
995 | __opaque: [0; __PTHREAD_RWLOCK_SIZE__], | ||
996 | }; | ||
997 | |||
998 | pub const SIGSTKSZ: ::size_t = 131072; | ||
999 | |||
1000 | pub const FD_SETSIZE: usize = 1024; | ||
1001 | |||
1002 | pub const ST_NOSUID: ::c_ulong = 2; | ||
1003 | |||
1004 | pub const EVFILT_AIO: ::int16_t = 0xfffd; | ||
1005 | pub const EVFILT_PROC: ::int16_t = 0xfffb; | ||
1006 | pub const EVFILT_READ: ::int16_t = 0xffff; | ||
1007 | pub const EVFILT_SIGNAL: ::int16_t = 0xfffa; | ||
1008 | pub const EVFILT_SYSCOUNT: ::int16_t = 0xe; | ||
1009 | pub const EVFILT_TIMER: ::int16_t = 0xfff9; | ||
1010 | pub const EVFILT_VNODE: ::int16_t = 0xfffc; | ||
1011 | pub const EVFILT_WRITE: ::int16_t = 0xfffe; | ||
1012 | pub const EVFILT_FS: ::int16_t = 0xfff7; | ||
1013 | pub const EVFILT_MACHPORT: ::int16_t = 0xfff8; | ||
1014 | pub const EVFILT_USER: ::int16_t = 0xfff6; | ||
1015 | pub const EVFILT_VM: ::int16_t = 0xfff4; | ||
1016 | |||
1017 | pub const EV_DISPATCH: ::uint16_t = 0x80; | ||
1018 | pub const EV_FLAG0: ::uint16_t = 0x1000; | ||
1019 | pub const EV_OOBAND: ::uint16_t = 0x2000; | ||
1020 | pub const EV_POLL: ::uint16_t = 0x1000; | ||
1021 | pub const EV_RECEIPT: ::uint16_t = 0x40; | ||
1022 | |||
1023 | pub const NOTE_ABSOLUTE: ::uint32_t = 0x8; | ||
1024 | pub const NOTE_EXITSTATUS: ::uint32_t = 0x04000000; | ||
1025 | pub const NOTE_EXIT_REPARENTED: ::uint32_t = 0x00080000; | ||
1026 | pub const NOTE_FFAND: ::uint32_t = 0x40000000; | ||
1027 | pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000; | ||
1028 | pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000; | ||
1029 | pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff; | ||
1030 | pub const NOTE_FFNOP: ::uint32_t = 0x0; | ||
1031 | pub const NOTE_FFOR: ::uint32_t = 0x80000000; | ||
1032 | pub const NOTE_NONE: ::uint32_t = 0x80; | ||
1033 | pub const NOTE_NSECONDS: ::uint32_t = 0x4; | ||
1034 | pub const NOTE_REAP: ::uint32_t = 0x10000000; | ||
1035 | pub const NOTE_SECONDS: ::uint32_t = 0x1; | ||
1036 | pub const NOTE_SIGNAL: ::uint32_t = 0x8000000; | ||
1037 | pub const NOTE_TRIGGER: ::uint32_t = 0x01000000; | ||
1038 | pub const NOTE_USECONDS: ::uint32_t = 0x2; | ||
1039 | pub const NOTE_VM_ERROR: ::uint32_t = 0x10000000; | ||
1040 | pub const NOTE_VM_PRESSURE: ::uint32_t = 0x80000000; | ||
1041 | pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: ::uint32_t = 0x20000000; | ||
1042 | pub const NOTE_VM_PRESSURE_TERMINATE: ::uint32_t = 0x40000000; | ||
1043 | pub const NOTE_PCTRLMASK: ::uint32_t = 0xfff00000; | ||
1044 | |||
1045 | pub const NL0: ::c_int = 0x00000000; | ||
1046 | pub const NL1: ::c_int = 0x00000100; | ||
1047 | pub const TAB0: ::c_int = 0x00000000; | ||
1048 | pub const TAB1: ::c_int = 0x00000400; | ||
1049 | pub const TAB2: ::c_int = 0x00000800; | ||
1050 | pub const CR0: ::c_int = 0x00000000; | ||
1051 | pub const CR1: ::c_int = 0x00001000; | ||
1052 | pub const CR2: ::c_int = 0x00002000; | ||
1053 | pub const CR3: ::c_int = 0x00003000; | ||
1054 | pub const FF0: ::c_int = 0x00000000; | ||
1055 | pub const FF1: ::c_int = 0x00004000; | ||
1056 | pub const BS0: ::c_int = 0x00000000; | ||
1057 | pub const BS1: ::c_int = 0x00008000; | ||
1058 | pub const TAB3: ::c_int = 0x00000004; | ||
1059 | pub const VT0: ::c_int = 0x00000000; | ||
1060 | pub const VT1: ::c_int = 0x00010000; | ||
1061 | pub const IUTF8: ::tcflag_t = 0x00004000; | ||
1062 | pub const CRTSCTS: ::tcflag_t = 0x00030000; | ||
1063 | |||
1064 | pub const NI_MAXHOST: ::socklen_t = 1025; | ||
1065 | |||
1066 | pub const Q_GETQUOTA: ::c_int = 0x300; | ||
1067 | pub const Q_SETQUOTA: ::c_int = 0x400; | ||
1068 | |||
1069 | pub const RTLD_LOCAL: ::c_int = 0x4; | ||
1070 | pub const RTLD_FIRST: ::c_int = 0x100; | ||
1071 | pub const RTLD_NODELETE: ::c_int = 0x80; | ||
1072 | pub const RTLD_NOLOAD: ::c_int = 0x10; | ||
1073 | pub const RTLD_GLOBAL: ::c_int = 0x8; | ||
1074 | |||
1075 | pub const _WSTOPPED: ::c_int = 0o177; | ||
1076 | |||
1077 | pub const LOG_NETINFO: ::c_int = 12 << 3; | ||
1078 | pub const LOG_REMOTEAUTH: ::c_int = 13 << 3; | ||
1079 | pub const LOG_INSTALL: ::c_int = 14 << 3; | ||
1080 | pub const LOG_RAS: ::c_int = 15 << 3; | ||
1081 | pub const LOG_LAUNCHD: ::c_int = 24 << 3; | ||
1082 | pub const LOG_NFACILITIES: ::c_int = 25; | ||
1083 | |||
1084 | pub const CTLTYPE: ::c_int = 0xf; | ||
1085 | pub const CTLTYPE_NODE: ::c_int = 1; | ||
1086 | pub const CTLTYPE_INT: ::c_int = 2; | ||
1087 | pub const CTLTYPE_STRING: ::c_int = 3; | ||
1088 | pub const CTLTYPE_QUAD: ::c_int = 4; | ||
1089 | pub const CTLTYPE_OPAQUE: ::c_int = 5; | ||
1090 | pub const CTLTYPE_STRUCT: ::c_int = CTLTYPE_OPAQUE; | ||
1091 | pub const CTLFLAG_RD: ::c_int = 0x80000000; | ||
1092 | pub const CTLFLAG_WR: ::c_int = 0x40000000; | ||
1093 | pub const CTLFLAG_RW: ::c_int = CTLFLAG_RD | CTLFLAG_WR; | ||
1094 | pub const CTLFLAG_NOLOCK: ::c_int = 0x20000000; | ||
1095 | pub const CTLFLAG_ANYBODY: ::c_int = 0x10000000; | ||
1096 | pub const CTLFLAG_SECURE: ::c_int = 0x08000000; | ||
1097 | pub const CTLFLAG_MASKED: ::c_int = 0x04000000; | ||
1098 | pub const CTLFLAG_NOAUTO: ::c_int = 0x02000000; | ||
1099 | pub const CTLFLAG_KERN: ::c_int = 0x01000000; | ||
1100 | pub const CTLFLAG_LOCKED: ::c_int = 0x00800000; | ||
1101 | pub const CTLFLAG_OID2: ::c_int = 0x00400000; | ||
1102 | pub const CTL_UNSPEC: ::c_int = 0; | ||
1103 | pub const CTL_KERN: ::c_int = 1; | ||
1104 | pub const CTL_VM: ::c_int = 2; | ||
1105 | pub const CTL_VFS: ::c_int = 3; | ||
1106 | pub const CTL_NET: ::c_int = 4; | ||
1107 | pub const CTL_DEBUG: ::c_int = 5; | ||
1108 | pub const CTL_HW: ::c_int = 6; | ||
1109 | pub const CTL_MACHDEP: ::c_int = 7; | ||
1110 | pub const CTL_USER: ::c_int = 8; | ||
1111 | pub const CTL_MAXID: ::c_int = 9; | ||
1112 | pub const KERN_OSTYPE: ::c_int = 1; | ||
1113 | pub const KERN_OSRELEASE: ::c_int = 2; | ||
1114 | pub const KERN_OSREV: ::c_int = 3; | ||
1115 | pub const KERN_VERSION: ::c_int = 4; | ||
1116 | pub const KERN_MAXVNODES: ::c_int = 5; | ||
1117 | pub const KERN_MAXPROC: ::c_int = 6; | ||
1118 | pub const KERN_MAXFILES: ::c_int = 7; | ||
1119 | pub const KERN_ARGMAX: ::c_int = 8; | ||
1120 | pub const KERN_SECURELVL: ::c_int = 9; | ||
1121 | pub const KERN_HOSTNAME: ::c_int = 10; | ||
1122 | pub const KERN_HOSTID: ::c_int = 11; | ||
1123 | pub const KERN_CLOCKRATE: ::c_int = 12; | ||
1124 | pub const KERN_VNODE: ::c_int = 13; | ||
1125 | pub const KERN_PROC: ::c_int = 14; | ||
1126 | pub const KERN_FILE: ::c_int = 15; | ||
1127 | pub const KERN_PROF: ::c_int = 16; | ||
1128 | pub const KERN_POSIX1: ::c_int = 17; | ||
1129 | pub const KERN_NGROUPS: ::c_int = 18; | ||
1130 | pub const KERN_JOB_CONTROL: ::c_int = 19; | ||
1131 | pub const KERN_SAVED_IDS: ::c_int = 20; | ||
1132 | pub const KERN_BOOTTIME: ::c_int = 21; | ||
1133 | pub const KERN_NISDOMAINNAME: ::c_int = 22; | ||
1134 | pub const KERN_DOMAINNAME: ::c_int = KERN_NISDOMAINNAME; | ||
1135 | pub const KERN_MAXPARTITIONS: ::c_int = 23; | ||
1136 | pub const KERN_KDEBUG: ::c_int = 24; | ||
1137 | pub const KERN_UPDATEINTERVAL: ::c_int = 25; | ||
1138 | pub const KERN_OSRELDATE: ::c_int = 26; | ||
1139 | pub const KERN_NTP_PLL: ::c_int = 27; | ||
1140 | pub const KERN_BOOTFILE: ::c_int = 28; | ||
1141 | pub const KERN_MAXFILESPERPROC: ::c_int = 29; | ||
1142 | pub const KERN_MAXPROCPERUID: ::c_int = 30; | ||
1143 | pub const KERN_DUMPDEV: ::c_int = 31; | ||
1144 | pub const KERN_IPC: ::c_int = 32; | ||
1145 | pub const KERN_DUMMY: ::c_int = 33; | ||
1146 | pub const KERN_PS_STRINGS: ::c_int = 34; | ||
1147 | pub const KERN_USRSTACK32: ::c_int = 35; | ||
1148 | pub const KERN_LOGSIGEXIT: ::c_int = 36; | ||
1149 | pub const KERN_SYMFILE: ::c_int = 37; | ||
1150 | pub const KERN_PROCARGS: ::c_int = 38; | ||
1151 | pub const KERN_NETBOOT: ::c_int = 40; | ||
1152 | pub const KERN_SYSV: ::c_int = 42; | ||
1153 | pub const KERN_AFFINITY: ::c_int = 43; | ||
1154 | pub const KERN_TRANSLATE: ::c_int = 44; | ||
1155 | pub const KERN_CLASSIC: ::c_int = KERN_TRANSLATE; | ||
1156 | pub const KERN_EXEC: ::c_int = 45; | ||
1157 | pub const KERN_CLASSICHANDLER: ::c_int = KERN_EXEC; | ||
1158 | pub const KERN_AIOMAX: ::c_int = 46; | ||
1159 | pub const KERN_AIOPROCMAX: ::c_int = 47; | ||
1160 | pub const KERN_AIOTHREADS: ::c_int = 48; | ||
1161 | pub const KERN_COREFILE: ::c_int = 50; | ||
1162 | pub const KERN_COREDUMP: ::c_int = 51; | ||
1163 | pub const KERN_SUGID_COREDUMP: ::c_int = 52; | ||
1164 | pub const KERN_PROCDELAYTERM: ::c_int = 53; | ||
1165 | pub const KERN_SHREG_PRIVATIZABLE: ::c_int = 54; | ||
1166 | pub const KERN_LOW_PRI_WINDOW: ::c_int = 56; | ||
1167 | pub const KERN_LOW_PRI_DELAY: ::c_int = 57; | ||
1168 | pub const KERN_POSIX: ::c_int = 58; | ||
1169 | pub const KERN_USRSTACK64: ::c_int = 59; | ||
1170 | pub const KERN_NX_PROTECTION: ::c_int = 60; | ||
1171 | pub const KERN_TFP: ::c_int = 61; | ||
1172 | pub const KERN_PROCNAME: ::c_int = 62; | ||
1173 | pub const KERN_THALTSTACK: ::c_int = 63; | ||
1174 | pub const KERN_SPECULATIVE_READS: ::c_int = 64; | ||
1175 | pub const KERN_OSVERSION: ::c_int = 65; | ||
1176 | pub const KERN_SAFEBOOT: ::c_int = 66; | ||
1177 | pub const KERN_RAGEVNODE: ::c_int = 68; | ||
1178 | pub const KERN_TTY: ::c_int = 69; | ||
1179 | pub const KERN_CHECKOPENEVT: ::c_int = 70; | ||
1180 | pub const KERN_THREADNAME: ::c_int = 71; | ||
1181 | pub const KERN_MAXID: ::c_int = 72; | ||
1182 | pub const KERN_RAGE_PROC: ::c_int = 1; | ||
1183 | pub const KERN_RAGE_THREAD: ::c_int = 2; | ||
1184 | pub const KERN_UNRAGE_PROC: ::c_int = 3; | ||
1185 | pub const KERN_UNRAGE_THREAD: ::c_int = 4; | ||
1186 | pub const KERN_OPENEVT_PROC: ::c_int = 1; | ||
1187 | pub const KERN_UNOPENEVT_PROC: ::c_int = 2; | ||
1188 | pub const KERN_TFP_POLICY: ::c_int = 1; | ||
1189 | pub const KERN_TFP_POLICY_DENY: ::c_int = 0; | ||
1190 | pub const KERN_TFP_POLICY_DEFAULT: ::c_int = 2; | ||
1191 | pub const KERN_KDEFLAGS: ::c_int = 1; | ||
1192 | pub const KERN_KDDFLAGS: ::c_int = 2; | ||
1193 | pub const KERN_KDENABLE: ::c_int = 3; | ||
1194 | pub const KERN_KDSETBUF: ::c_int = 4; | ||
1195 | pub const KERN_KDGETBUF: ::c_int = 5; | ||
1196 | pub const KERN_KDSETUP: ::c_int = 6; | ||
1197 | pub const KERN_KDREMOVE: ::c_int = 7; | ||
1198 | pub const KERN_KDSETREG: ::c_int = 8; | ||
1199 | pub const KERN_KDGETREG: ::c_int = 9; | ||
1200 | pub const KERN_KDREADTR: ::c_int = 10; | ||
1201 | pub const KERN_KDPIDTR: ::c_int = 11; | ||
1202 | pub const KERN_KDTHRMAP: ::c_int = 12; | ||
1203 | pub const KERN_KDPIDEX: ::c_int = 14; | ||
1204 | pub const KERN_KDSETRTCDEC: ::c_int = 15; | ||
1205 | pub const KERN_KDGETENTROPY: ::c_int = 16; | ||
1206 | pub const KERN_KDWRITETR: ::c_int = 17; | ||
1207 | pub const KERN_KDWRITEMAP: ::c_int = 18; | ||
1208 | pub const KERN_KDENABLE_BG_TRACE: ::c_int = 19; | ||
1209 | pub const KERN_KDDISABLE_BG_TRACE: ::c_int = 20; | ||
1210 | pub const KERN_KDREADCURTHRMAP: ::c_int = 21; | ||
1211 | pub const KERN_KDSET_TYPEFILTER: ::c_int = 22; | ||
1212 | pub const KERN_KDBUFWAIT: ::c_int = 23; | ||
1213 | pub const KERN_KDCPUMAP: ::c_int = 24; | ||
1214 | pub const KERN_PROC_ALL: ::c_int = 0; | ||
1215 | pub const KERN_PROC_PID: ::c_int = 1; | ||
1216 | pub const KERN_PROC_PGRP: ::c_int = 2; | ||
1217 | pub const KERN_PROC_SESSION: ::c_int = 3; | ||
1218 | pub const KERN_PROC_TTY: ::c_int = 4; | ||
1219 | pub const KERN_PROC_UID: ::c_int = 5; | ||
1220 | pub const KERN_PROC_RUID: ::c_int = 6; | ||
1221 | pub const KERN_PROC_LCID: ::c_int = 7; | ||
1222 | pub const KIPC_MAXSOCKBUF: ::c_int = 1; | ||
1223 | pub const KIPC_SOCKBUF_WASTE: ::c_int = 2; | ||
1224 | pub const KIPC_SOMAXCONN: ::c_int = 3; | ||
1225 | pub const KIPC_MAX_LINKHDR: ::c_int = 4; | ||
1226 | pub const KIPC_MAX_PROTOHDR: ::c_int = 5; | ||
1227 | pub const KIPC_MAX_HDR: ::c_int = 6; | ||
1228 | pub const KIPC_MAX_DATALEN: ::c_int = 7; | ||
1229 | pub const KIPC_MBSTAT: ::c_int = 8; | ||
1230 | pub const KIPC_NMBCLUSTERS: ::c_int = 9; | ||
1231 | pub const KIPC_SOQLIMITCOMPAT: ::c_int = 10; | ||
1232 | pub const VM_METER: ::c_int = 1; | ||
1233 | pub const VM_LOADAVG: ::c_int = 2; | ||
1234 | pub const VM_MACHFACTOR: ::c_int = 4; | ||
1235 | pub const VM_SWAPUSAGE: ::c_int = 5; | ||
1236 | pub const VM_MAXID: ::c_int = 6; | ||
1237 | pub const HW_MACHINE: ::c_int = 1; | ||
1238 | pub const HW_MODEL: ::c_int = 2; | ||
1239 | pub const HW_NCPU: ::c_int = 3; | ||
1240 | pub const HW_BYTEORDER: ::c_int = 4; | ||
1241 | pub const HW_PHYSMEM: ::c_int = 5; | ||
1242 | pub const HW_USERMEM: ::c_int = 6; | ||
1243 | pub const HW_PAGESIZE: ::c_int = 7; | ||
1244 | pub const HW_DISKNAMES: ::c_int = 8; | ||
1245 | pub const HW_DISKSTATS: ::c_int = 9; | ||
1246 | pub const HW_EPOCH: ::c_int = 10; | ||
1247 | pub const HW_FLOATINGPT: ::c_int = 11; | ||
1248 | pub const HW_MACHINE_ARCH: ::c_int = 12; | ||
1249 | pub const HW_VECTORUNIT: ::c_int = 13; | ||
1250 | pub const HW_BUS_FREQ: ::c_int = 14; | ||
1251 | pub const HW_CPU_FREQ: ::c_int = 15; | ||
1252 | pub const HW_CACHELINE: ::c_int = 16; | ||
1253 | pub const HW_L1ICACHESIZE: ::c_int = 17; | ||
1254 | pub const HW_L1DCACHESIZE: ::c_int = 18; | ||
1255 | pub const HW_L2SETTINGS: ::c_int = 19; | ||
1256 | pub const HW_L2CACHESIZE: ::c_int = 20; | ||
1257 | pub const HW_L3SETTINGS: ::c_int = 21; | ||
1258 | pub const HW_L3CACHESIZE: ::c_int = 22; | ||
1259 | pub const HW_TB_FREQ: ::c_int = 23; | ||
1260 | pub const HW_MEMSIZE: ::c_int = 24; | ||
1261 | pub const HW_AVAILCPU: ::c_int = 25; | ||
1262 | pub const HW_MAXID: ::c_int = 26; | ||
1263 | pub const USER_CS_PATH: ::c_int = 1; | ||
1264 | pub const USER_BC_BASE_MAX: ::c_int = 2; | ||
1265 | pub const USER_BC_DIM_MAX: ::c_int = 3; | ||
1266 | pub const USER_BC_SCALE_MAX: ::c_int = 4; | ||
1267 | pub const USER_BC_STRING_MAX: ::c_int = 5; | ||
1268 | pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6; | ||
1269 | pub const USER_EXPR_NEST_MAX: ::c_int = 7; | ||
1270 | pub const USER_LINE_MAX: ::c_int = 8; | ||
1271 | pub const USER_RE_DUP_MAX: ::c_int = 9; | ||
1272 | pub const USER_POSIX2_VERSION: ::c_int = 10; | ||
1273 | pub const USER_POSIX2_C_BIND: ::c_int = 11; | ||
1274 | pub const USER_POSIX2_C_DEV: ::c_int = 12; | ||
1275 | pub const USER_POSIX2_CHAR_TERM: ::c_int = 13; | ||
1276 | pub const USER_POSIX2_FORT_DEV: ::c_int = 14; | ||
1277 | pub const USER_POSIX2_FORT_RUN: ::c_int = 15; | ||
1278 | pub const USER_POSIX2_LOCALEDEF: ::c_int = 16; | ||
1279 | pub const USER_POSIX2_SW_DEV: ::c_int = 17; | ||
1280 | pub const USER_POSIX2_UPE: ::c_int = 18; | ||
1281 | pub const USER_STREAM_MAX: ::c_int = 19; | ||
1282 | pub const USER_TZNAME_MAX: ::c_int = 20; | ||
1283 | pub const USER_MAXID: ::c_int = 21; | ||
1284 | pub const CTL_DEBUG_NAME: ::c_int = 0; | ||
1285 | pub const CTL_DEBUG_VALUE: ::c_int = 1; | ||
1286 | pub const CTL_DEBUG_MAXID: ::c_int = 20; | ||
1287 | |||
1288 | pub const POLLRDNORM: ::c_short = 0x040; | ||
1289 | pub const POLLWRNORM: ::c_short = 0x004; | ||
1290 | pub const POLLRDBAND: ::c_short = 0x080; | ||
1291 | pub const POLLWRBAND: ::c_short = 0x100; | ||
1292 | |||
1293 | pub const PRIO_DARWIN_THREAD: ::c_int = 3; | ||
1294 | pub const PRIO_DARWIN_PROCESS: ::c_int = 4; | ||
1295 | pub const PRIO_DARWIN_BG: ::c_int = 0x1000; | ||
1296 | pub const PRIO_DARWIN_NONUI: ::c_int = 0x1001; | ||
1297 | |||
1298 | pub const SEM_FAILED: *mut sem_t = -1isize as *mut ::sem_t; | ||
1299 | |||
1300 | f! { | ||
1301 | pub fn WSTOPSIG(status: ::c_int) -> ::c_int { | ||
1302 | status >> 8 | ||
1303 | } | ||
1304 | |||
1305 | pub fn _WSTATUS(status: ::c_int) -> ::c_int { | ||
1306 | status & 0x7f | ||
1307 | } | ||
1308 | |||
1309 | pub fn WIFCONTINUED(status: ::c_int) -> bool { | ||
1310 | _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) == 0x13 | ||
1311 | } | ||
1312 | |||
1313 | pub fn WIFSIGNALED(status: ::c_int) -> bool { | ||
1314 | _WSTATUS(status) != _WSTOPPED && _WSTATUS(status) != 0 | ||
1315 | } | ||
1316 | |||
1317 | pub fn WIFSTOPPED(status: ::c_int) -> bool { | ||
1318 | _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) != 0x13 | ||
1319 | } | ||
1320 | } | ||
1321 | |||
1322 | extern { | ||
1323 | pub fn getutxent() -> *mut utmpx; | ||
1324 | pub fn getutxid(ut: *const utmpx) -> *mut utmpx; | ||
1325 | pub fn getutxline(ut: *const utmpx) -> *mut utmpx; | ||
1326 | pub fn pututxline(ut: *const utmpx) -> *mut utmpx; | ||
1327 | pub fn setutxent(); | ||
1328 | pub fn endutxent(); | ||
1329 | pub fn utmpxname(file: *const ::c_char) -> ::c_int; | ||
1330 | |||
1331 | pub fn getnameinfo(sa: *const ::sockaddr, | ||
1332 | salen: ::socklen_t, | ||
1333 | host: *mut ::c_char, | ||
1334 | hostlen: ::socklen_t, | ||
1335 | serv: *mut ::c_char, | ||
1336 | sevlen: ::socklen_t, | ||
1337 | flags: ::c_int) -> ::c_int; | ||
1338 | pub fn mincore(addr: *const ::c_void, len: ::size_t, | ||
1339 | vec: *mut ::c_char) -> ::c_int; | ||
1340 | pub fn sysctlnametomib(name: *const ::c_char, | ||
1341 | mibp: *mut ::c_int, | ||
1342 | sizep: *mut ::size_t) | ||
1343 | -> ::c_int; | ||
1344 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
1345 | link_name = "mprotect$UNIX2003")] | ||
1346 | pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) | ||
1347 | -> ::c_int; | ||
1348 | pub fn shm_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::c_int; | ||
1349 | pub fn sysctl(name: *mut ::c_int, | ||
1350 | namelen: ::c_uint, | ||
1351 | oldp: *mut ::c_void, | ||
1352 | oldlenp: *mut ::size_t, | ||
1353 | newp: *mut ::c_void, | ||
1354 | newlen: ::size_t) | ||
1355 | -> ::c_int; | ||
1356 | pub fn sysctlbyname(name: *const ::c_char, | ||
1357 | oldp: *mut ::c_void, | ||
1358 | oldlenp: *mut ::size_t, | ||
1359 | newp: *mut ::c_void, | ||
1360 | newlen: ::size_t) | ||
1361 | -> ::c_int; | ||
1362 | pub fn mach_absolute_time() -> u64; | ||
1363 | pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int; | ||
1364 | pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int; | ||
1365 | pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void; | ||
1366 | pub fn pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t; | ||
1367 | pub fn __error() -> *mut ::c_int; | ||
1368 | pub fn backtrace(buf: *mut *mut ::c_void, | ||
1369 | sz: ::c_int) -> ::c_int; | ||
1370 | #[cfg_attr(target_os = "macos", link_name = "statfs$INODE64")] | ||
1371 | pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; | ||
1372 | #[cfg_attr(target_os = "macos", link_name = "fstatfs$INODE64")] | ||
1373 | pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; | ||
1374 | pub fn kevent(kq: ::c_int, | ||
1375 | changelist: *const ::kevent, | ||
1376 | nchanges: ::c_int, | ||
1377 | eventlist: *mut ::kevent, | ||
1378 | nevents: ::c_int, | ||
1379 | timeout: *const ::timespec) -> ::c_int; | ||
1380 | pub fn kevent64(kq: ::c_int, | ||
1381 | changelist: *const ::kevent64_s, | ||
1382 | nchanges: ::c_int, | ||
1383 | eventlist: *mut ::kevent64_s, | ||
1384 | nevents: ::c_int, | ||
1385 | flags: ::c_uint, | ||
1386 | timeout: *const ::timespec) -> ::c_int; | ||
1387 | pub fn mount(src: *const ::c_char, | ||
1388 | target: *const ::c_char, | ||
1389 | flags: ::c_int, | ||
1390 | data: *mut ::c_void) -> ::c_int; | ||
1391 | pub fn ptrace(requeset: ::c_int, | ||
1392 | pid: ::pid_t, | ||
1393 | addr: *mut ::c_char, | ||
1394 | data: ::c_int) -> ::c_int; | ||
1395 | pub fn quotactl(special: *const ::c_char, | ||
1396 | cmd: ::c_int, | ||
1397 | id: ::c_int, | ||
1398 | data: *mut ::c_char) -> ::c_int; | ||
1399 | pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int; | ||
1400 | pub fn sendfile(fd: ::c_int, | ||
1401 | s: ::c_int, | ||
1402 | offset: ::off_t, | ||
1403 | len: *mut ::off_t, | ||
1404 | hdtr: *mut ::sf_hdtr, | ||
1405 | flags: ::c_int) -> ::c_int; | ||
1406 | pub fn openpty(amaster: *mut ::c_int, | ||
1407 | aslave: *mut ::c_int, | ||
1408 | name: *mut ::c_char, | ||
1409 | termp: *mut termios, | ||
1410 | winp: *mut ::winsize) -> ::c_int; | ||
1411 | pub fn forkpty(amaster: *mut ::c_int, | ||
1412 | name: *mut ::c_char, | ||
1413 | termp: *mut termios, | ||
1414 | winp: *mut ::winsize) -> ::pid_t; | ||
1415 | pub fn duplocale(base: ::locale_t) -> ::locale_t; | ||
1416 | pub fn freelocale(loc: ::locale_t) -> ::c_int; | ||
1417 | pub fn localeconv_l(loc: ::locale_t) -> *mut lconv; | ||
1418 | pub fn newlocale(mask: ::c_int, | ||
1419 | locale: *const ::c_char, | ||
1420 | base: ::locale_t) -> ::locale_t; | ||
1421 | pub fn uselocale(loc: ::locale_t) -> ::locale_t; | ||
1422 | pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char; | ||
1423 | pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; | ||
1424 | pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; | ||
1425 | |||
1426 | pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1427 | flags: ::c_int, ...) -> ::c_int; | ||
1428 | pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1429 | mode: ::c_int, flags: ::c_int) -> ::c_int; | ||
1430 | pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1431 | mode: ::mode_t, flags: ::c_int) -> ::c_int; | ||
1432 | pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1433 | owner: ::uid_t, group: ::gid_t, | ||
1434 | flags: ::c_int) -> ::c_int; | ||
1435 | #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")] | ||
1436 | pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1437 | buf: *mut stat, flags: ::c_int) -> ::c_int; | ||
1438 | pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
1439 | newdirfd: ::c_int, newpath: *const ::c_char, | ||
1440 | flags: ::c_int) -> ::c_int; | ||
1441 | pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1442 | mode: ::mode_t) -> ::c_int; | ||
1443 | pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1444 | buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t; | ||
1445 | pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
1446 | newdirfd: ::c_int, newpath: *const ::c_char) | ||
1447 | -> ::c_int; | ||
1448 | pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int, | ||
1449 | linkpath: *const ::c_char) -> ::c_int; | ||
1450 | pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1451 | flags: ::c_int) -> ::c_int; | ||
1452 | } | ||
1453 | |||
1454 | cfg_if! { | ||
1455 | if #[cfg(any(target_arch = "arm", target_arch = "x86"))] { | ||
1456 | mod b32; | ||
1457 | pub use self::b32::*; | ||
1458 | } else if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] { | ||
1459 | mod b64; | ||
1460 | pub use self::b64::*; | ||
1461 | } else { | ||
1462 | // Unknown target_arch | ||
1463 | } | ||
1464 | } | ||
diff --git a/third_party/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/third_party/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs new file mode 100644 index 0000000..6d31ad8 --- /dev/null +++ b/third_party/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs | |||
@@ -0,0 +1,251 @@ | |||
1 | pub type clock_t = u64; | ||
2 | pub type ino_t = u64; | ||
3 | pub type nlink_t = u32; | ||
4 | pub type blksize_t = i64; | ||
5 | pub type clockid_t = ::c_ulong; | ||
6 | |||
7 | pub type c_long = i64; | ||
8 | pub type c_ulong = u64; | ||
9 | pub type time_t = i64; | ||
10 | pub type suseconds_t = i64; | ||
11 | |||
12 | pub type uuid_t = ::uuid; | ||
13 | |||
14 | pub type fsblkcnt_t = u64; | ||
15 | pub type fsfilcnt_t = u64; | ||
16 | |||
17 | s! { | ||
18 | pub struct dirent { | ||
19 | pub d_fileno: ::ino_t, | ||
20 | pub d_namlen: u16, | ||
21 | pub d_type: u8, | ||
22 | __unused1: u8, | ||
23 | __unused2: u32, | ||
24 | pub d_name: [::c_char; 256], | ||
25 | } | ||
26 | |||
27 | pub struct uuid { | ||
28 | pub time_low: u32, | ||
29 | pub time_mid: u16, | ||
30 | pub time_hi_and_version: u16, | ||
31 | pub clock_seq_hi_and_reserved: u8, | ||
32 | pub clock_seq_low: u8, | ||
33 | pub node: [u8; 6], | ||
34 | } | ||
35 | |||
36 | pub struct statvfs { | ||
37 | pub f_bsize: ::c_ulong, | ||
38 | pub f_frsize: ::c_ulong, | ||
39 | pub f_blocks: ::fsblkcnt_t, | ||
40 | pub f_bfree: ::fsblkcnt_t, | ||
41 | pub f_bavail: ::fsblkcnt_t, | ||
42 | pub f_files: ::fsfilcnt_t, | ||
43 | pub f_ffree: ::fsfilcnt_t, | ||
44 | pub f_favail: ::fsfilcnt_t, | ||
45 | pub f_fsid: ::c_ulong, | ||
46 | pub f_flag: ::c_ulong, | ||
47 | pub f_namemax: ::c_ulong, | ||
48 | pub f_owner: ::uid_t, | ||
49 | pub f_type: ::c_uint, | ||
50 | pub f_syncreads: u64, | ||
51 | pub f_syncwrites: u64, | ||
52 | pub f_asyncreads: u64, | ||
53 | pub f_asyncwrites: u64, | ||
54 | pub f_fsid_uuid: ::uuid_t, | ||
55 | pub f_uid_uuid: ::uuid_t, | ||
56 | } | ||
57 | |||
58 | pub struct stat { | ||
59 | pub st_ino: ::ino_t, | ||
60 | pub st_nlink: ::nlink_t, | ||
61 | pub st_dev: ::dev_t, | ||
62 | pub st_mode: ::mode_t, | ||
63 | pub st_padding1: ::uint16_t, | ||
64 | pub st_uid: ::uid_t, | ||
65 | pub st_gid: ::gid_t, | ||
66 | pub st_rdev: ::dev_t, | ||
67 | pub st_atime: ::time_t, | ||
68 | pub st_atime_nsec: ::c_long, | ||
69 | pub st_mtime: ::time_t, | ||
70 | pub st_mtime_nsec: ::c_long, | ||
71 | pub st_ctime: ::time_t, | ||
72 | pub st_ctime_nsec: ::c_long, | ||
73 | pub st_size: ::off_t, | ||
74 | pub st_blocks: ::int64_t, | ||
75 | pub st_blksize: ::uint32_t, | ||
76 | pub st_flags: ::uint32_t, | ||
77 | pub st_gen: ::uint32_t, | ||
78 | pub st_lspare: ::int32_t, | ||
79 | pub st_qspare1: ::int64_t, | ||
80 | pub st_qspare2: ::int64_t, | ||
81 | } | ||
82 | } | ||
83 | |||
84 | pub const RAND_MAX: ::c_int = 0x7fff_ffff; | ||
85 | pub const PTHREAD_STACK_MIN: ::size_t = 1024; | ||
86 | pub const SIGSTKSZ: ::size_t = 40960; | ||
87 | pub const MADV_INVAL: ::c_int = 10; | ||
88 | pub const O_CLOEXEC: ::c_int = 0x00020000; | ||
89 | pub const F_GETLK: ::c_int = 7; | ||
90 | pub const F_SETLK: ::c_int = 8; | ||
91 | pub const F_SETLKW: ::c_int = 9; | ||
92 | pub const ELAST: ::c_int = 99; | ||
93 | pub const RLIMIT_POSIXLOCKS: ::c_int = 11; | ||
94 | pub const RLIM_NLIMITS: ::rlim_t = 12; | ||
95 | |||
96 | pub const Q_GETQUOTA: ::c_int = 0x300; | ||
97 | pub const Q_SETQUOTA: ::c_int = 0x400; | ||
98 | |||
99 | pub const CLOCK_REALTIME: clockid_t = 0; | ||
100 | pub const CLOCK_VIRTUAL: clockid_t = 1; | ||
101 | pub const CLOCK_PROF: clockid_t = 2; | ||
102 | pub const CLOCK_MONOTONIC: clockid_t = 4; | ||
103 | pub const CLOCK_UPTIME: clockid_t = 5; | ||
104 | pub const CLOCK_UPTIME_PRECISE: clockid_t = 7; | ||
105 | pub const CLOCK_UPTIME_FAST: clockid_t = 8; | ||
106 | pub const CLOCK_REALTIME_PRECISE: clockid_t = 9; | ||
107 | pub const CLOCK_REALTIME_FAST: clockid_t = 10; | ||
108 | pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11; | ||
109 | pub const CLOCK_MONOTONIC_FAST: clockid_t = 12; | ||
110 | pub const CLOCK_SECOND: clockid_t = 13; | ||
111 | pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14; | ||
112 | pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15; | ||
113 | |||
114 | pub const CTL_UNSPEC: ::c_int = 0; | ||
115 | pub const CTL_KERN: ::c_int = 1; | ||
116 | pub const CTL_VM: ::c_int = 2; | ||
117 | pub const CTL_VFS: ::c_int = 3; | ||
118 | pub const CTL_NET: ::c_int = 4; | ||
119 | pub const CTL_DEBUG: ::c_int = 5; | ||
120 | pub const CTL_HW: ::c_int = 6; | ||
121 | pub const CTL_MACHDEP: ::c_int = 7; | ||
122 | pub const CTL_USER: ::c_int = 8; | ||
123 | pub const CTL_P1003_1B: ::c_int = 9; | ||
124 | pub const CTL_LWKT: ::c_int = 10; | ||
125 | pub const CTL_MAXID: ::c_int = 11; | ||
126 | pub const KERN_OSTYPE: ::c_int = 1; | ||
127 | pub const KERN_OSRELEASE: ::c_int = 2; | ||
128 | pub const KERN_OSREV: ::c_int = 3; | ||
129 | pub const KERN_VERSION: ::c_int = 4; | ||
130 | pub const KERN_MAXVNODES: ::c_int = 5; | ||
131 | pub const KERN_MAXPROC: ::c_int = 6; | ||
132 | pub const KERN_MAXFILES: ::c_int = 7; | ||
133 | pub const KERN_ARGMAX: ::c_int = 8; | ||
134 | pub const KERN_SECURELVL: ::c_int = 9; | ||
135 | pub const KERN_HOSTNAME: ::c_int = 10; | ||
136 | pub const KERN_HOSTID: ::c_int = 11; | ||
137 | pub const KERN_CLOCKRATE: ::c_int = 12; | ||
138 | pub const KERN_VNODE: ::c_int = 13; | ||
139 | pub const KERN_PROC: ::c_int = 14; | ||
140 | pub const KERN_FILE: ::c_int = 15; | ||
141 | pub const KERN_PROF: ::c_int = 16; | ||
142 | pub const KERN_POSIX1: ::c_int = 17; | ||
143 | pub const KERN_NGROUPS: ::c_int = 18; | ||
144 | pub const KERN_JOB_CONTROL: ::c_int = 19; | ||
145 | pub const KERN_SAVED_IDS: ::c_int = 20; | ||
146 | pub const KERN_BOOTTIME: ::c_int = 21; | ||
147 | pub const KERN_NISDOMAINNAME: ::c_int = 22; | ||
148 | pub const KERN_UPDATEINTERVAL: ::c_int = 23; | ||
149 | pub const KERN_OSRELDATE: ::c_int = 24; | ||
150 | pub const KERN_NTP_PLL: ::c_int = 25; | ||
151 | pub const KERN_BOOTFILE: ::c_int = 26; | ||
152 | pub const KERN_MAXFILESPERPROC: ::c_int = 27; | ||
153 | pub const KERN_MAXPROCPERUID: ::c_int = 28; | ||
154 | pub const KERN_DUMPDEV: ::c_int = 29; | ||
155 | pub const KERN_IPC: ::c_int = 30; | ||
156 | pub const KERN_DUMMY: ::c_int = 31; | ||
157 | pub const KERN_PS_STRINGS: ::c_int = 32; | ||
158 | pub const KERN_USRSTACK: ::c_int = 33; | ||
159 | pub const KERN_LOGSIGEXIT: ::c_int = 34; | ||
160 | pub const KERN_IOV_MAX: ::c_int = 35; | ||
161 | pub const KERN_MAXPOSIXLOCKSPERUID: ::c_int = 36; | ||
162 | pub const KERN_MAXID: ::c_int = 37; | ||
163 | pub const KERN_PROC_ALL: ::c_int = 0; | ||
164 | pub const KERN_PROC_PID: ::c_int = 1; | ||
165 | pub const KERN_PROC_PGRP: ::c_int = 2; | ||
166 | pub const KERN_PROC_SESSION: ::c_int = 3; | ||
167 | pub const KERN_PROC_TTY: ::c_int = 4; | ||
168 | pub const KERN_PROC_UID: ::c_int = 5; | ||
169 | pub const KERN_PROC_RUID: ::c_int = 6; | ||
170 | pub const KERN_PROC_ARGS: ::c_int = 7; | ||
171 | pub const KERN_PROC_CWD: ::c_int = 8; | ||
172 | pub const KERN_PROC_PATHNAME: ::c_int = 9; | ||
173 | pub const KERN_PROC_FLAGMASK: ::c_int = 0x10; | ||
174 | pub const KERN_PROC_FLAG_LWP: ::c_int = 0x10; | ||
175 | pub const KIPC_MAXSOCKBUF: ::c_int = 1; | ||
176 | pub const KIPC_SOCKBUF_WASTE: ::c_int = 2; | ||
177 | pub const KIPC_SOMAXCONN: ::c_int = 3; | ||
178 | pub const KIPC_MAX_LINKHDR: ::c_int = 4; | ||
179 | pub const KIPC_MAX_PROTOHDR: ::c_int = 5; | ||
180 | pub const KIPC_MAX_HDR: ::c_int = 6; | ||
181 | pub const KIPC_MAX_DATALEN: ::c_int = 7; | ||
182 | pub const KIPC_MBSTAT: ::c_int = 8; | ||
183 | pub const KIPC_NMBCLUSTERS: ::c_int = 9; | ||
184 | pub const HW_MACHINE: ::c_int = 1; | ||
185 | pub const HW_MODEL: ::c_int = 2; | ||
186 | pub const HW_NCPU: ::c_int = 3; | ||
187 | pub const HW_BYTEORDER: ::c_int = 4; | ||
188 | pub const HW_PHYSMEM: ::c_int = 5; | ||
189 | pub const HW_USERMEM: ::c_int = 6; | ||
190 | pub const HW_PAGESIZE: ::c_int = 7; | ||
191 | pub const HW_DISKNAMES: ::c_int = 8; | ||
192 | pub const HW_DISKSTATS: ::c_int = 9; | ||
193 | pub const HW_FLOATINGPT: ::c_int = 10; | ||
194 | pub const HW_MACHINE_ARCH: ::c_int = 11; | ||
195 | pub const HW_MACHINE_PLATFORM: ::c_int = 12; | ||
196 | pub const HW_SENSORS: ::c_int = 13; | ||
197 | pub const HW_MAXID: ::c_int = 14; | ||
198 | pub const USER_CS_PATH: ::c_int = 1; | ||
199 | pub const USER_BC_BASE_MAX: ::c_int = 2; | ||
200 | pub const USER_BC_DIM_MAX: ::c_int = 3; | ||
201 | pub const USER_BC_SCALE_MAX: ::c_int = 4; | ||
202 | pub const USER_BC_STRING_MAX: ::c_int = 5; | ||
203 | pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6; | ||
204 | pub const USER_EXPR_NEST_MAX: ::c_int = 7; | ||
205 | pub const USER_LINE_MAX: ::c_int = 8; | ||
206 | pub const USER_RE_DUP_MAX: ::c_int = 9; | ||
207 | pub const USER_POSIX2_VERSION: ::c_int = 10; | ||
208 | pub const USER_POSIX2_C_BIND: ::c_int = 11; | ||
209 | pub const USER_POSIX2_C_DEV: ::c_int = 12; | ||
210 | pub const USER_POSIX2_CHAR_TERM: ::c_int = 13; | ||
211 | pub const USER_POSIX2_FORT_DEV: ::c_int = 14; | ||
212 | pub const USER_POSIX2_FORT_RUN: ::c_int = 15; | ||
213 | pub const USER_POSIX2_LOCALEDEF: ::c_int = 16; | ||
214 | pub const USER_POSIX2_SW_DEV: ::c_int = 17; | ||
215 | pub const USER_POSIX2_UPE: ::c_int = 18; | ||
216 | pub const USER_STREAM_MAX: ::c_int = 19; | ||
217 | pub const USER_TZNAME_MAX: ::c_int = 20; | ||
218 | pub const USER_MAXID: ::c_int = 21; | ||
219 | pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1; | ||
220 | pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2; | ||
221 | pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3; | ||
222 | pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4; | ||
223 | pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5; | ||
224 | pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6; | ||
225 | pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7; | ||
226 | pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8; | ||
227 | pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9; | ||
228 | pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10; | ||
229 | pub const CTL_P1003_1B_FSYNC: ::c_int = 11; | ||
230 | pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12; | ||
231 | pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13; | ||
232 | pub const CTL_P1003_1B_TIMERS: ::c_int = 14; | ||
233 | pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15; | ||
234 | pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16; | ||
235 | pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17; | ||
236 | pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18; | ||
237 | pub const CTL_P1003_1B_UNUSED1: ::c_int = 19; | ||
238 | pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20; | ||
239 | pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21; | ||
240 | pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22; | ||
241 | pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23; | ||
242 | pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24; | ||
243 | pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25; | ||
244 | pub const CTL_P1003_1B_MAXID: ::c_int = 26; | ||
245 | |||
246 | extern { | ||
247 | pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) | ||
248 | -> ::c_int; | ||
249 | pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
250 | pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
251 | } | ||
diff --git a/third_party/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/third_party/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs new file mode 100644 index 0000000..1596a93 --- /dev/null +++ b/third_party/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs | |||
@@ -0,0 +1,251 @@ | |||
1 | pub type fflags_t = u32; | ||
2 | pub type clock_t = i32; | ||
3 | pub type ino_t = u32; | ||
4 | pub type nlink_t = u16; | ||
5 | pub type blksize_t = u32; | ||
6 | pub type clockid_t = ::c_int; | ||
7 | |||
8 | pub type fsblkcnt_t = ::uint64_t; | ||
9 | pub type fsfilcnt_t = ::uint64_t; | ||
10 | |||
11 | s! { | ||
12 | pub struct dirent { | ||
13 | pub d_fileno: u32, | ||
14 | pub d_reclen: u16, | ||
15 | pub d_type: u8, | ||
16 | pub d_namlen: u8, | ||
17 | pub d_name: [::c_char; 256], | ||
18 | } | ||
19 | |||
20 | pub struct statvfs { | ||
21 | pub f_bavail: ::fsblkcnt_t, | ||
22 | pub f_bfree: ::fsblkcnt_t, | ||
23 | pub f_blocks: ::fsblkcnt_t, | ||
24 | pub f_favail: ::fsfilcnt_t, | ||
25 | pub f_ffree: ::fsfilcnt_t, | ||
26 | pub f_files: ::fsfilcnt_t, | ||
27 | pub f_bsize: ::c_ulong, | ||
28 | pub f_flag: ::c_ulong, | ||
29 | pub f_frsize: ::c_ulong, | ||
30 | pub f_fsid: ::c_ulong, | ||
31 | pub f_namemax: ::c_ulong, | ||
32 | } | ||
33 | } | ||
34 | |||
35 | pub const RAND_MAX: ::c_int = 0x7fff_fffd; | ||
36 | pub const PTHREAD_STACK_MIN: ::size_t = 2048; | ||
37 | pub const SIGSTKSZ: ::size_t = 34816; | ||
38 | pub const SF_NODISKIO: ::c_int = 0x00000001; | ||
39 | pub const SF_MNOWAIT: ::c_int = 0x00000002; | ||
40 | pub const SF_SYNC: ::c_int = 0x00000004; | ||
41 | pub const O_CLOEXEC: ::c_int = 0x00100000; | ||
42 | pub const F_GETLK: ::c_int = 11; | ||
43 | pub const F_SETLK: ::c_int = 12; | ||
44 | pub const F_SETLKW: ::c_int = 13; | ||
45 | pub const ELAST: ::c_int = 96; | ||
46 | pub const RLIMIT_NPTS: ::c_int = 11; | ||
47 | pub const RLIMIT_SWAP: ::c_int = 12; | ||
48 | pub const RLIM_NLIMITS: ::rlim_t = 13; | ||
49 | |||
50 | pub const Q_GETQUOTA: ::c_int = 0x700; | ||
51 | pub const Q_SETQUOTA: ::c_int = 0x800; | ||
52 | |||
53 | pub const POSIX_FADV_NORMAL: ::c_int = 0; | ||
54 | pub const POSIX_FADV_RANDOM: ::c_int = 1; | ||
55 | pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; | ||
56 | pub const POSIX_FADV_WILLNEED: ::c_int = 3; | ||
57 | pub const POSIX_FADV_DONTNEED: ::c_int = 4; | ||
58 | pub const POSIX_FADV_NOREUSE: ::c_int = 5; | ||
59 | |||
60 | pub const MADV_PROTECT: ::c_int = 10; | ||
61 | pub const RUSAGE_THREAD: ::c_int = 1; | ||
62 | |||
63 | pub const CLOCK_REALTIME: clockid_t = 0; | ||
64 | pub const CLOCK_VIRTUAL: clockid_t = 1; | ||
65 | pub const CLOCK_PROF: clockid_t = 2; | ||
66 | pub const CLOCK_MONOTONIC: clockid_t = 4; | ||
67 | pub const CLOCK_UPTIME: clockid_t = 5; | ||
68 | pub const CLOCK_UPTIME_PRECISE: clockid_t = 7; | ||
69 | pub const CLOCK_UPTIME_FAST: clockid_t = 8; | ||
70 | pub const CLOCK_REALTIME_PRECISE: clockid_t = 9; | ||
71 | pub const CLOCK_REALTIME_FAST: clockid_t = 10; | ||
72 | pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11; | ||
73 | pub const CLOCK_MONOTONIC_FAST: clockid_t = 12; | ||
74 | pub const CLOCK_SECOND: clockid_t = 13; | ||
75 | pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14; | ||
76 | pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15; | ||
77 | |||
78 | pub const CTL_UNSPEC: ::c_int = 0; | ||
79 | pub const CTL_KERN: ::c_int = 1; | ||
80 | pub const CTL_VM: ::c_int = 2; | ||
81 | pub const CTL_VFS: ::c_int = 3; | ||
82 | pub const CTL_NET: ::c_int = 4; | ||
83 | pub const CTL_DEBUG: ::c_int = 5; | ||
84 | pub const CTL_HW: ::c_int = 6; | ||
85 | pub const CTL_MACHDEP: ::c_int = 7; | ||
86 | pub const CTL_USER: ::c_int = 8; | ||
87 | pub const CTL_P1003_1B: ::c_int = 9; | ||
88 | pub const CTL_MAXID: ::c_int = 10; | ||
89 | pub const KERN_OSTYPE: ::c_int = 1; | ||
90 | pub const KERN_OSRELEASE: ::c_int = 2; | ||
91 | pub const KERN_OSREV: ::c_int = 3; | ||
92 | pub const KERN_VERSION: ::c_int = 4; | ||
93 | pub const KERN_MAXVNODES: ::c_int = 5; | ||
94 | pub const KERN_MAXPROC: ::c_int = 6; | ||
95 | pub const KERN_MAXFILES: ::c_int = 7; | ||
96 | pub const KERN_ARGMAX: ::c_int = 8; | ||
97 | pub const KERN_SECURELVL: ::c_int = 9; | ||
98 | pub const KERN_HOSTNAME: ::c_int = 10; | ||
99 | pub const KERN_HOSTID: ::c_int = 11; | ||
100 | pub const KERN_CLOCKRATE: ::c_int = 12; | ||
101 | pub const KERN_VNODE: ::c_int = 13; | ||
102 | pub const KERN_PROC: ::c_int = 14; | ||
103 | pub const KERN_FILE: ::c_int = 15; | ||
104 | pub const KERN_PROF: ::c_int = 16; | ||
105 | pub const KERN_POSIX1: ::c_int = 17; | ||
106 | pub const KERN_NGROUPS: ::c_int = 18; | ||
107 | pub const KERN_JOB_CONTROL: ::c_int = 19; | ||
108 | pub const KERN_SAVED_IDS: ::c_int = 20; | ||
109 | pub const KERN_BOOTTIME: ::c_int = 21; | ||
110 | pub const KERN_NISDOMAINNAME: ::c_int = 22; | ||
111 | pub const KERN_UPDATEINTERVAL: ::c_int = 23; | ||
112 | pub const KERN_OSRELDATE: ::c_int = 24; | ||
113 | pub const KERN_NTP_PLL: ::c_int = 25; | ||
114 | pub const KERN_BOOTFILE: ::c_int = 26; | ||
115 | pub const KERN_MAXFILESPERPROC: ::c_int = 27; | ||
116 | pub const KERN_MAXPROCPERUID: ::c_int = 28; | ||
117 | pub const KERN_DUMPDEV: ::c_int = 29; | ||
118 | pub const KERN_IPC: ::c_int = 30; | ||
119 | pub const KERN_DUMMY: ::c_int = 31; | ||
120 | pub const KERN_PS_STRINGS: ::c_int = 32; | ||
121 | pub const KERN_USRSTACK: ::c_int = 33; | ||
122 | pub const KERN_LOGSIGEXIT: ::c_int = 34; | ||
123 | pub const KERN_IOV_MAX: ::c_int = 35; | ||
124 | pub const KERN_HOSTUUID: ::c_int = 36; | ||
125 | pub const KERN_ARND: ::c_int = 37; | ||
126 | pub const KERN_MAXID: ::c_int = 38; | ||
127 | pub const KERN_PROC_ALL: ::c_int = 0; | ||
128 | pub const KERN_PROC_PID: ::c_int = 1; | ||
129 | pub const KERN_PROC_PGRP: ::c_int = 2; | ||
130 | pub const KERN_PROC_SESSION: ::c_int = 3; | ||
131 | pub const KERN_PROC_TTY: ::c_int = 4; | ||
132 | pub const KERN_PROC_UID: ::c_int = 5; | ||
133 | pub const KERN_PROC_RUID: ::c_int = 6; | ||
134 | pub const KERN_PROC_ARGS: ::c_int = 7; | ||
135 | pub const KERN_PROC_PROC: ::c_int = 8; | ||
136 | pub const KERN_PROC_SV_NAME: ::c_int = 9; | ||
137 | pub const KERN_PROC_RGID: ::c_int = 10; | ||
138 | pub const KERN_PROC_GID: ::c_int = 11; | ||
139 | pub const KERN_PROC_PATHNAME: ::c_int = 12; | ||
140 | pub const KERN_PROC_OVMMAP: ::c_int = 13; | ||
141 | pub const KERN_PROC_OFILEDESC: ::c_int = 14; | ||
142 | pub const KERN_PROC_KSTACK: ::c_int = 15; | ||
143 | pub const KERN_PROC_INC_THREAD: ::c_int = 0x10; | ||
144 | pub const KERN_PROC_VMMAP: ::c_int = 32; | ||
145 | pub const KERN_PROC_FILEDESC: ::c_int = 33; | ||
146 | pub const KERN_PROC_GROUPS: ::c_int = 34; | ||
147 | pub const KERN_PROC_ENV: ::c_int = 35; | ||
148 | pub const KERN_PROC_AUXV: ::c_int = 36; | ||
149 | pub const KERN_PROC_RLIMIT: ::c_int = 37; | ||
150 | pub const KERN_PROC_PS_STRINGS: ::c_int = 38; | ||
151 | pub const KERN_PROC_UMASK: ::c_int = 39; | ||
152 | pub const KERN_PROC_OSREL: ::c_int = 40; | ||
153 | pub const KERN_PROC_SIGTRAMP: ::c_int = 41; | ||
154 | pub const KIPC_MAXSOCKBUF: ::c_int = 1; | ||
155 | pub const KIPC_SOCKBUF_WASTE: ::c_int = 2; | ||
156 | pub const KIPC_SOMAXCONN: ::c_int = 3; | ||
157 | pub const KIPC_MAX_LINKHDR: ::c_int = 4; | ||
158 | pub const KIPC_MAX_PROTOHDR: ::c_int = 5; | ||
159 | pub const KIPC_MAX_HDR: ::c_int = 6; | ||
160 | pub const KIPC_MAX_DATALEN: ::c_int = 7; | ||
161 | pub const HW_MACHINE: ::c_int = 1; | ||
162 | pub const HW_MODEL: ::c_int = 2; | ||
163 | pub const HW_NCPU: ::c_int = 3; | ||
164 | pub const HW_BYTEORDER: ::c_int = 4; | ||
165 | pub const HW_PHYSMEM: ::c_int = 5; | ||
166 | pub const HW_USERMEM: ::c_int = 6; | ||
167 | pub const HW_PAGESIZE: ::c_int = 7; | ||
168 | pub const HW_DISKNAMES: ::c_int = 8; | ||
169 | pub const HW_DISKSTATS: ::c_int = 9; | ||
170 | pub const HW_FLOATINGPT: ::c_int = 10; | ||
171 | pub const HW_MACHINE_ARCH: ::c_int = 11; | ||
172 | pub const HW_REALMEM: ::c_int = 12; | ||
173 | pub const HW_MAXID: ::c_int = 13; | ||
174 | pub const USER_CS_PATH: ::c_int = 1; | ||
175 | pub const USER_BC_BASE_MAX: ::c_int = 2; | ||
176 | pub const USER_BC_DIM_MAX: ::c_int = 3; | ||
177 | pub const USER_BC_SCALE_MAX: ::c_int = 4; | ||
178 | pub const USER_BC_STRING_MAX: ::c_int = 5; | ||
179 | pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6; | ||
180 | pub const USER_EXPR_NEST_MAX: ::c_int = 7; | ||
181 | pub const USER_LINE_MAX: ::c_int = 8; | ||
182 | pub const USER_RE_DUP_MAX: ::c_int = 9; | ||
183 | pub const USER_POSIX2_VERSION: ::c_int = 10; | ||
184 | pub const USER_POSIX2_C_BIND: ::c_int = 11; | ||
185 | pub const USER_POSIX2_C_DEV: ::c_int = 12; | ||
186 | pub const USER_POSIX2_CHAR_TERM: ::c_int = 13; | ||
187 | pub const USER_POSIX2_FORT_DEV: ::c_int = 14; | ||
188 | pub const USER_POSIX2_FORT_RUN: ::c_int = 15; | ||
189 | pub const USER_POSIX2_LOCALEDEF: ::c_int = 16; | ||
190 | pub const USER_POSIX2_SW_DEV: ::c_int = 17; | ||
191 | pub const USER_POSIX2_UPE: ::c_int = 18; | ||
192 | pub const USER_STREAM_MAX: ::c_int = 19; | ||
193 | pub const USER_TZNAME_MAX: ::c_int = 20; | ||
194 | pub const USER_MAXID: ::c_int = 21; | ||
195 | pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1; | ||
196 | pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2; | ||
197 | pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3; | ||
198 | pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4; | ||
199 | pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5; | ||
200 | pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6; | ||
201 | pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7; | ||
202 | pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8; | ||
203 | pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9; | ||
204 | pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10; | ||
205 | pub const CTL_P1003_1B_FSYNC: ::c_int = 11; | ||
206 | pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12; | ||
207 | pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13; | ||
208 | pub const CTL_P1003_1B_TIMERS: ::c_int = 14; | ||
209 | pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15; | ||
210 | pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16; | ||
211 | pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17; | ||
212 | pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18; | ||
213 | pub const CTL_P1003_1B_MQ_OPEN_MAX: ::c_int = 19; | ||
214 | pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20; | ||
215 | pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21; | ||
216 | pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22; | ||
217 | pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23; | ||
218 | pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24; | ||
219 | pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25; | ||
220 | pub const CTL_P1003_1B_MAXID: ::c_int = 26; | ||
221 | |||
222 | extern { | ||
223 | pub fn __error() -> *mut ::c_int; | ||
224 | |||
225 | pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) | ||
226 | -> ::c_int; | ||
227 | |||
228 | pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
229 | pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
230 | |||
231 | pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, | ||
232 | len: ::off_t) -> ::c_int; | ||
233 | pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, | ||
234 | advise: ::c_int) -> ::c_int; | ||
235 | pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; | ||
236 | pub fn mkostemps(template: *mut ::c_char, | ||
237 | suffixlen: ::c_int, | ||
238 | flags: ::c_int) -> ::c_int; | ||
239 | } | ||
240 | |||
241 | cfg_if! { | ||
242 | if #[cfg(target_arch = "x86")] { | ||
243 | mod x86; | ||
244 | pub use self::x86::*; | ||
245 | } else if #[cfg(target_arch = "x86_64")] { | ||
246 | mod x86_64; | ||
247 | pub use self::x86_64::*; | ||
248 | } else { | ||
249 | // Unknown target_arch | ||
250 | } | ||
251 | } | ||
diff --git a/third_party/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs b/third_party/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs new file mode 100644 index 0000000..8a5e5f9 --- /dev/null +++ b/third_party/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs | |||
@@ -0,0 +1,31 @@ | |||
1 | pub type c_long = i32; | ||
2 | pub type c_ulong = u32; | ||
3 | pub type time_t = i32; | ||
4 | pub type suseconds_t = i32; | ||
5 | |||
6 | s! { | ||
7 | pub struct stat { | ||
8 | pub st_dev: ::dev_t, | ||
9 | pub st_ino: ::ino_t, | ||
10 | pub st_mode: ::mode_t, | ||
11 | pub st_nlink: ::nlink_t, | ||
12 | pub st_uid: ::uid_t, | ||
13 | pub st_gid: ::gid_t, | ||
14 | pub st_rdev: ::dev_t, | ||
15 | pub st_atime: ::time_t, | ||
16 | pub st_atime_nsec: ::c_long, | ||
17 | pub st_mtime: ::time_t, | ||
18 | pub st_mtime_nsec: ::c_long, | ||
19 | pub st_ctime: ::time_t, | ||
20 | pub st_ctime_nsec: ::c_long, | ||
21 | pub st_size: ::off_t, | ||
22 | pub st_blocks: ::blkcnt_t, | ||
23 | pub st_blksize: ::blksize_t, | ||
24 | pub st_flags: ::fflags_t, | ||
25 | pub st_gen: ::uint32_t, | ||
26 | pub st_lspare: ::int32_t, | ||
27 | pub st_birthtime: ::time_t, | ||
28 | pub st_birthtime_nsec: ::c_long, | ||
29 | __unused: [u8; 8], | ||
30 | } | ||
31 | } | ||
diff --git a/third_party/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs b/third_party/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs new file mode 100644 index 0000000..a2da845 --- /dev/null +++ b/third_party/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs | |||
@@ -0,0 +1,30 @@ | |||
1 | pub type c_long = i64; | ||
2 | pub type c_ulong = u64; | ||
3 | pub type time_t = i64; | ||
4 | pub type suseconds_t = i64; | ||
5 | |||
6 | s! { | ||
7 | pub struct stat { | ||
8 | pub st_dev: ::dev_t, | ||
9 | pub st_ino: ::ino_t, | ||
10 | pub st_mode: ::mode_t, | ||
11 | pub st_nlink: ::nlink_t, | ||
12 | pub st_uid: ::uid_t, | ||
13 | pub st_gid: ::gid_t, | ||
14 | pub st_rdev: ::dev_t, | ||
15 | pub st_atime: ::time_t, | ||
16 | pub st_atime_nsec: ::c_long, | ||
17 | pub st_mtime: ::time_t, | ||
18 | pub st_mtime_nsec: ::c_long, | ||
19 | pub st_ctime: ::time_t, | ||
20 | pub st_ctime_nsec: ::c_long, | ||
21 | pub st_size: ::off_t, | ||
22 | pub st_blocks: ::blkcnt_t, | ||
23 | pub st_blksize: ::blksize_t, | ||
24 | pub st_flags: ::fflags_t, | ||
25 | pub st_gen: ::uint32_t, | ||
26 | pub st_lspare: ::int32_t, | ||
27 | pub st_birthtime: ::time_t, | ||
28 | pub st_birthtime_nsec: ::c_long, | ||
29 | } | ||
30 | } | ||
diff --git a/third_party/libc/src/unix/bsd/freebsdlike/mod.rs b/third_party/libc/src/unix/bsd/freebsdlike/mod.rs new file mode 100644 index 0000000..201ee59 --- /dev/null +++ b/third_party/libc/src/unix/bsd/freebsdlike/mod.rs | |||
@@ -0,0 +1,859 @@ | |||
1 | pub type dev_t = u32; | ||
2 | pub type mode_t = u16; | ||
3 | pub type pthread_attr_t = *mut ::c_void; | ||
4 | pub type rlim_t = i64; | ||
5 | pub type pthread_mutex_t = *mut ::c_void; | ||
6 | pub type pthread_mutexattr_t = *mut ::c_void; | ||
7 | pub type pthread_cond_t = *mut ::c_void; | ||
8 | pub type pthread_condattr_t = *mut ::c_void; | ||
9 | pub type pthread_rwlock_t = *mut ::c_void; | ||
10 | pub type pthread_key_t = ::c_int; | ||
11 | pub type tcflag_t = ::c_uint; | ||
12 | pub type speed_t = ::c_uint; | ||
13 | pub type nl_item = ::c_int; | ||
14 | pub type id_t = i64; | ||
15 | pub type sem_t = _sem; | ||
16 | |||
17 | pub enum timezone {} | ||
18 | |||
19 | s! { | ||
20 | pub struct utmpx { | ||
21 | pub ut_type: ::c_short, | ||
22 | pub ut_tv: ::timeval, | ||
23 | pub ut_id: [::c_char; 8], | ||
24 | pub ut_pid: ::pid_t, | ||
25 | pub ut_user: [::c_char; 32], | ||
26 | pub ut_line: [::c_char; 16], | ||
27 | pub ut_host: [::c_char; 128], | ||
28 | pub __ut_spare: [::c_char; 64], | ||
29 | } | ||
30 | |||
31 | pub struct glob_t { | ||
32 | pub gl_pathc: ::size_t, | ||
33 | __unused1: ::size_t, | ||
34 | pub gl_offs: ::size_t, | ||
35 | __unused2: ::c_int, | ||
36 | pub gl_pathv: *mut *mut ::c_char, | ||
37 | |||
38 | __unused3: *mut ::c_void, | ||
39 | |||
40 | __unused4: *mut ::c_void, | ||
41 | __unused5: *mut ::c_void, | ||
42 | __unused6: *mut ::c_void, | ||
43 | __unused7: *mut ::c_void, | ||
44 | __unused8: *mut ::c_void, | ||
45 | } | ||
46 | |||
47 | pub struct sockaddr_storage { | ||
48 | pub ss_len: u8, | ||
49 | pub ss_family: ::sa_family_t, | ||
50 | __ss_pad1: [u8; 6], | ||
51 | __ss_align: i64, | ||
52 | __ss_pad2: [u8; 112], | ||
53 | } | ||
54 | |||
55 | pub struct addrinfo { | ||
56 | pub ai_flags: ::c_int, | ||
57 | pub ai_family: ::c_int, | ||
58 | pub ai_socktype: ::c_int, | ||
59 | pub ai_protocol: ::c_int, | ||
60 | pub ai_addrlen: ::socklen_t, | ||
61 | pub ai_canonname: *mut ::c_char, | ||
62 | pub ai_addr: *mut ::sockaddr, | ||
63 | pub ai_next: *mut addrinfo, | ||
64 | } | ||
65 | |||
66 | pub struct sigset_t { | ||
67 | bits: [u32; 4], | ||
68 | } | ||
69 | |||
70 | pub struct siginfo_t { | ||
71 | pub si_signo: ::c_int, | ||
72 | pub si_errno: ::c_int, | ||
73 | pub si_code: ::c_int, | ||
74 | pub si_pid: ::pid_t, | ||
75 | pub si_uid: ::uid_t, | ||
76 | pub si_status: ::c_int, | ||
77 | pub si_addr: *mut ::c_void, | ||
78 | _pad: [::c_int; 12], | ||
79 | } | ||
80 | |||
81 | pub struct sigaction { | ||
82 | pub sa_sigaction: ::sighandler_t, | ||
83 | pub sa_flags: ::c_int, | ||
84 | pub sa_mask: sigset_t, | ||
85 | } | ||
86 | |||
87 | pub struct stack_t { | ||
88 | pub ss_sp: *mut ::c_char, | ||
89 | pub ss_size: ::size_t, | ||
90 | pub ss_flags: ::c_int, | ||
91 | } | ||
92 | |||
93 | pub struct sched_param { | ||
94 | pub sched_priority: ::c_int, | ||
95 | } | ||
96 | |||
97 | pub struct Dl_info { | ||
98 | pub dli_fname: *const ::c_char, | ||
99 | pub dli_fbase: *mut ::c_void, | ||
100 | pub dli_sname: *const ::c_char, | ||
101 | pub dli_saddr: *mut ::c_void, | ||
102 | } | ||
103 | |||
104 | pub struct sockaddr_in { | ||
105 | pub sin_len: u8, | ||
106 | pub sin_family: ::sa_family_t, | ||
107 | pub sin_port: ::in_port_t, | ||
108 | pub sin_addr: ::in_addr, | ||
109 | pub sin_zero: [::c_char; 8], | ||
110 | } | ||
111 | |||
112 | pub struct termios { | ||
113 | pub c_iflag: ::tcflag_t, | ||
114 | pub c_oflag: ::tcflag_t, | ||
115 | pub c_cflag: ::tcflag_t, | ||
116 | pub c_lflag: ::tcflag_t, | ||
117 | pub c_cc: [::cc_t; ::NCCS], | ||
118 | pub c_ispeed: ::speed_t, | ||
119 | pub c_ospeed: ::speed_t, | ||
120 | } | ||
121 | |||
122 | pub struct flock { | ||
123 | pub l_start: ::off_t, | ||
124 | pub l_len: ::off_t, | ||
125 | pub l_pid: ::pid_t, | ||
126 | pub l_type: ::c_short, | ||
127 | pub l_whence: ::c_short, | ||
128 | #[cfg(not(target_os = "dragonfly"))] | ||
129 | pub l_sysid: ::c_int, | ||
130 | } | ||
131 | |||
132 | pub struct sf_hdtr { | ||
133 | pub headers: *mut ::iovec, | ||
134 | pub hdr_cnt: ::c_int, | ||
135 | pub trailers: *mut ::iovec, | ||
136 | pub trl_cnt: ::c_int, | ||
137 | } | ||
138 | |||
139 | pub struct lconv { | ||
140 | pub decimal_point: *mut ::c_char, | ||
141 | pub thousands_sep: *mut ::c_char, | ||
142 | pub grouping: *mut ::c_char, | ||
143 | pub int_curr_symbol: *mut ::c_char, | ||
144 | pub currency_symbol: *mut ::c_char, | ||
145 | pub mon_decimal_point: *mut ::c_char, | ||
146 | pub mon_thousands_sep: *mut ::c_char, | ||
147 | pub mon_grouping: *mut ::c_char, | ||
148 | pub positive_sign: *mut ::c_char, | ||
149 | pub negative_sign: *mut ::c_char, | ||
150 | pub int_frac_digits: ::c_char, | ||
151 | pub frac_digits: ::c_char, | ||
152 | pub p_cs_precedes: ::c_char, | ||
153 | pub p_sep_by_space: ::c_char, | ||
154 | pub n_cs_precedes: ::c_char, | ||
155 | pub n_sep_by_space: ::c_char, | ||
156 | pub p_sign_posn: ::c_char, | ||
157 | pub n_sign_posn: ::c_char, | ||
158 | pub int_p_cs_precedes: ::c_char, | ||
159 | pub int_n_cs_precedes: ::c_char, | ||
160 | pub int_p_sep_by_space: ::c_char, | ||
161 | pub int_n_sep_by_space: ::c_char, | ||
162 | pub int_p_sign_posn: ::c_char, | ||
163 | pub int_n_sign_posn: ::c_char, | ||
164 | } | ||
165 | |||
166 | // internal structure has changed over time | ||
167 | pub struct _sem { | ||
168 | data: [u32; 4], | ||
169 | } | ||
170 | } | ||
171 | |||
172 | pub const EMPTY: ::c_short = 0; | ||
173 | pub const BOOT_TIME: ::c_short = 1; | ||
174 | pub const OLD_TIME: ::c_short = 2; | ||
175 | pub const NEW_TIME: ::c_short = 3; | ||
176 | pub const USER_PROCESS: ::c_short = 4; | ||
177 | pub const INIT_PROCESS: ::c_short = 5; | ||
178 | pub const LOGIN_PROCESS: ::c_short = 6; | ||
179 | pub const DEAD_PROCESS: ::c_short = 7; | ||
180 | pub const SHUTDOWN_TIME: ::c_short = 8; | ||
181 | |||
182 | pub const LC_COLLATE_MASK: ::c_int = (1 << 0); | ||
183 | pub const LC_CTYPE_MASK: ::c_int = (1 << 1); | ||
184 | pub const LC_MESSAGES_MASK: ::c_int = (1 << 2); | ||
185 | pub const LC_MONETARY_MASK: ::c_int = (1 << 3); | ||
186 | pub const LC_NUMERIC_MASK: ::c_int = (1 << 4); | ||
187 | pub const LC_TIME_MASK: ::c_int = (1 << 5); | ||
188 | pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK | ||
189 | | LC_CTYPE_MASK | ||
190 | | LC_MESSAGES_MASK | ||
191 | | LC_MONETARY_MASK | ||
192 | | LC_NUMERIC_MASK | ||
193 | | LC_TIME_MASK; | ||
194 | |||
195 | pub const CODESET: ::nl_item = 0; | ||
196 | pub const D_T_FMT: ::nl_item = 1; | ||
197 | pub const D_FMT: ::nl_item = 2; | ||
198 | pub const T_FMT: ::nl_item = 3; | ||
199 | pub const T_FMT_AMPM: ::nl_item = 4; | ||
200 | pub const AM_STR: ::nl_item = 5; | ||
201 | pub const PM_STR: ::nl_item = 6; | ||
202 | |||
203 | pub const DAY_1: ::nl_item = 7; | ||
204 | pub const DAY_2: ::nl_item = 8; | ||
205 | pub const DAY_3: ::nl_item = 9; | ||
206 | pub const DAY_4: ::nl_item = 10; | ||
207 | pub const DAY_5: ::nl_item = 11; | ||
208 | pub const DAY_6: ::nl_item = 12; | ||
209 | pub const DAY_7: ::nl_item = 13; | ||
210 | |||
211 | pub const ABDAY_1: ::nl_item = 14; | ||
212 | pub const ABDAY_2: ::nl_item = 15; | ||
213 | pub const ABDAY_3: ::nl_item = 16; | ||
214 | pub const ABDAY_4: ::nl_item = 17; | ||
215 | pub const ABDAY_5: ::nl_item = 18; | ||
216 | pub const ABDAY_6: ::nl_item = 19; | ||
217 | pub const ABDAY_7: ::nl_item = 20; | ||
218 | |||
219 | pub const MON_1: ::nl_item = 21; | ||
220 | pub const MON_2: ::nl_item = 22; | ||
221 | pub const MON_3: ::nl_item = 23; | ||
222 | pub const MON_4: ::nl_item = 24; | ||
223 | pub const MON_5: ::nl_item = 25; | ||
224 | pub const MON_6: ::nl_item = 26; | ||
225 | pub const MON_7: ::nl_item = 27; | ||
226 | pub const MON_8: ::nl_item = 28; | ||
227 | pub const MON_9: ::nl_item = 29; | ||
228 | pub const MON_10: ::nl_item = 30; | ||
229 | pub const MON_11: ::nl_item = 31; | ||
230 | pub const MON_12: ::nl_item = 32; | ||
231 | |||
232 | pub const ABMON_1: ::nl_item = 33; | ||
233 | pub const ABMON_2: ::nl_item = 34; | ||
234 | pub const ABMON_3: ::nl_item = 35; | ||
235 | pub const ABMON_4: ::nl_item = 36; | ||
236 | pub const ABMON_5: ::nl_item = 37; | ||
237 | pub const ABMON_6: ::nl_item = 38; | ||
238 | pub const ABMON_7: ::nl_item = 39; | ||
239 | pub const ABMON_8: ::nl_item = 40; | ||
240 | pub const ABMON_9: ::nl_item = 41; | ||
241 | pub const ABMON_10: ::nl_item = 42; | ||
242 | pub const ABMON_11: ::nl_item = 43; | ||
243 | pub const ABMON_12: ::nl_item = 44; | ||
244 | |||
245 | pub const ERA: ::nl_item = 45; | ||
246 | pub const ERA_D_FMT: ::nl_item = 46; | ||
247 | pub const ERA_D_T_FMT: ::nl_item = 47; | ||
248 | pub const ERA_T_FMT: ::nl_item = 48; | ||
249 | pub const ALT_DIGITS: ::nl_item = 49; | ||
250 | |||
251 | pub const RADIXCHAR: ::nl_item = 50; | ||
252 | pub const THOUSEP: ::nl_item = 51; | ||
253 | |||
254 | pub const YESEXPR: ::nl_item = 52; | ||
255 | pub const NOEXPR: ::nl_item = 53; | ||
256 | |||
257 | pub const YESSTR: ::nl_item = 54; | ||
258 | pub const NOSTR: ::nl_item = 55; | ||
259 | |||
260 | pub const CRNCYSTR: ::nl_item = 56; | ||
261 | |||
262 | pub const D_MD_ORDER: ::nl_item = 57; | ||
263 | |||
264 | pub const ALTMON_1: ::nl_item = 58; | ||
265 | pub const ALTMON_2: ::nl_item = 59; | ||
266 | pub const ALTMON_3: ::nl_item = 60; | ||
267 | pub const ALTMON_4: ::nl_item = 61; | ||
268 | pub const ALTMON_5: ::nl_item = 62; | ||
269 | pub const ALTMON_6: ::nl_item = 63; | ||
270 | pub const ALTMON_7: ::nl_item = 64; | ||
271 | pub const ALTMON_8: ::nl_item = 65; | ||
272 | pub const ALTMON_9: ::nl_item = 66; | ||
273 | pub const ALTMON_10: ::nl_item = 67; | ||
274 | pub const ALTMON_11: ::nl_item = 68; | ||
275 | pub const ALTMON_12: ::nl_item = 69; | ||
276 | |||
277 | pub const EXIT_FAILURE: ::c_int = 1; | ||
278 | pub const EXIT_SUCCESS: ::c_int = 0; | ||
279 | pub const EOF: ::c_int = -1; | ||
280 | pub const SEEK_SET: ::c_int = 0; | ||
281 | pub const SEEK_CUR: ::c_int = 1; | ||
282 | pub const SEEK_END: ::c_int = 2; | ||
283 | pub const _IOFBF: ::c_int = 0; | ||
284 | pub const _IONBF: ::c_int = 2; | ||
285 | pub const _IOLBF: ::c_int = 1; | ||
286 | pub const BUFSIZ: ::c_uint = 1024; | ||
287 | pub const FOPEN_MAX: ::c_uint = 20; | ||
288 | pub const FILENAME_MAX: ::c_uint = 1024; | ||
289 | pub const L_tmpnam: ::c_uint = 1024; | ||
290 | pub const TMP_MAX: ::c_uint = 308915776; | ||
291 | |||
292 | pub const O_RDONLY: ::c_int = 0; | ||
293 | pub const O_WRONLY: ::c_int = 1; | ||
294 | pub const O_RDWR: ::c_int = 2; | ||
295 | pub const O_ACCMODE: ::c_int = 3; | ||
296 | pub const O_APPEND: ::c_int = 8; | ||
297 | pub const O_CREAT: ::c_int = 512; | ||
298 | pub const O_EXCL: ::c_int = 2048; | ||
299 | pub const O_NOCTTY: ::c_int = 32768; | ||
300 | pub const O_TRUNC: ::c_int = 1024; | ||
301 | pub const S_IFIFO: mode_t = 4096; | ||
302 | pub const S_IFCHR: mode_t = 8192; | ||
303 | pub const S_IFBLK: mode_t = 24576; | ||
304 | pub const S_IFDIR: mode_t = 16384; | ||
305 | pub const S_IFREG: mode_t = 32768; | ||
306 | pub const S_IFLNK: mode_t = 40960; | ||
307 | pub const S_IFSOCK: mode_t = 49152; | ||
308 | pub const S_IFMT: mode_t = 61440; | ||
309 | pub const S_IEXEC: mode_t = 64; | ||
310 | pub const S_IWRITE: mode_t = 128; | ||
311 | pub const S_IREAD: mode_t = 256; | ||
312 | pub const S_IRWXU: mode_t = 448; | ||
313 | pub const S_IXUSR: mode_t = 64; | ||
314 | pub const S_IWUSR: mode_t = 128; | ||
315 | pub const S_IRUSR: mode_t = 256; | ||
316 | pub const S_IRWXG: mode_t = 56; | ||
317 | pub const S_IXGRP: mode_t = 8; | ||
318 | pub const S_IWGRP: mode_t = 16; | ||
319 | pub const S_IRGRP: mode_t = 32; | ||
320 | pub const S_IRWXO: mode_t = 7; | ||
321 | pub const S_IXOTH: mode_t = 1; | ||
322 | pub const S_IWOTH: mode_t = 2; | ||
323 | pub const S_IROTH: mode_t = 4; | ||
324 | pub const F_OK: ::c_int = 0; | ||
325 | pub const R_OK: ::c_int = 4; | ||
326 | pub const W_OK: ::c_int = 2; | ||
327 | pub const X_OK: ::c_int = 1; | ||
328 | pub const STDIN_FILENO: ::c_int = 0; | ||
329 | pub const STDOUT_FILENO: ::c_int = 1; | ||
330 | pub const STDERR_FILENO: ::c_int = 2; | ||
331 | pub const F_LOCK: ::c_int = 1; | ||
332 | pub const F_TEST: ::c_int = 3; | ||
333 | pub const F_TLOCK: ::c_int = 2; | ||
334 | pub const F_ULOCK: ::c_int = 0; | ||
335 | pub const F_DUPFD_CLOEXEC: ::c_int = 17; | ||
336 | pub const SIGHUP: ::c_int = 1; | ||
337 | pub const SIGINT: ::c_int = 2; | ||
338 | pub const SIGQUIT: ::c_int = 3; | ||
339 | pub const SIGILL: ::c_int = 4; | ||
340 | pub const SIGABRT: ::c_int = 6; | ||
341 | pub const SIGEMT: ::c_int = 7; | ||
342 | pub const SIGFPE: ::c_int = 8; | ||
343 | pub const SIGKILL: ::c_int = 9; | ||
344 | pub const SIGSEGV: ::c_int = 11; | ||
345 | pub const SIGPIPE: ::c_int = 13; | ||
346 | pub const SIGALRM: ::c_int = 14; | ||
347 | pub const SIGTERM: ::c_int = 15; | ||
348 | |||
349 | pub const PROT_NONE: ::c_int = 0; | ||
350 | pub const PROT_READ: ::c_int = 1; | ||
351 | pub const PROT_WRITE: ::c_int = 2; | ||
352 | pub const PROT_EXEC: ::c_int = 4; | ||
353 | |||
354 | pub const MAP_FILE: ::c_int = 0x0000; | ||
355 | pub const MAP_SHARED: ::c_int = 0x0001; | ||
356 | pub const MAP_PRIVATE: ::c_int = 0x0002; | ||
357 | pub const MAP_FIXED: ::c_int = 0x0010; | ||
358 | pub const MAP_ANON: ::c_int = 0x1000; | ||
359 | |||
360 | pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; | ||
361 | |||
362 | pub const MCL_CURRENT: ::c_int = 0x0001; | ||
363 | pub const MCL_FUTURE: ::c_int = 0x0002; | ||
364 | |||
365 | pub const MS_SYNC: ::c_int = 0x0000; | ||
366 | pub const MS_ASYNC: ::c_int = 0x0001; | ||
367 | pub const MS_INVALIDATE: ::c_int = 0x0002; | ||
368 | |||
369 | pub const EPERM: ::c_int = 1; | ||
370 | pub const ENOENT: ::c_int = 2; | ||
371 | pub const ESRCH: ::c_int = 3; | ||
372 | pub const EINTR: ::c_int = 4; | ||
373 | pub const EIO: ::c_int = 5; | ||
374 | pub const ENXIO: ::c_int = 6; | ||
375 | pub const E2BIG: ::c_int = 7; | ||
376 | pub const ENOEXEC: ::c_int = 8; | ||
377 | pub const EBADF: ::c_int = 9; | ||
378 | pub const ECHILD: ::c_int = 10; | ||
379 | pub const EDEADLK: ::c_int = 11; | ||
380 | pub const ENOMEM: ::c_int = 12; | ||
381 | pub const EACCES: ::c_int = 13; | ||
382 | pub const EFAULT: ::c_int = 14; | ||
383 | pub const ENOTBLK: ::c_int = 15; | ||
384 | pub const EBUSY: ::c_int = 16; | ||
385 | pub const EEXIST: ::c_int = 17; | ||
386 | pub const EXDEV: ::c_int = 18; | ||
387 | pub const ENODEV: ::c_int = 19; | ||
388 | pub const ENOTDIR: ::c_int = 20; | ||
389 | pub const EISDIR: ::c_int = 21; | ||
390 | pub const EINVAL: ::c_int = 22; | ||
391 | pub const ENFILE: ::c_int = 23; | ||
392 | pub const EMFILE: ::c_int = 24; | ||
393 | pub const ENOTTY: ::c_int = 25; | ||
394 | pub const ETXTBSY: ::c_int = 26; | ||
395 | pub const EFBIG: ::c_int = 27; | ||
396 | pub const ENOSPC: ::c_int = 28; | ||
397 | pub const ESPIPE: ::c_int = 29; | ||
398 | pub const EROFS: ::c_int = 30; | ||
399 | pub const EMLINK: ::c_int = 31; | ||
400 | pub const EPIPE: ::c_int = 32; | ||
401 | pub const EDOM: ::c_int = 33; | ||
402 | pub const ERANGE: ::c_int = 34; | ||
403 | pub const EAGAIN: ::c_int = 35; | ||
404 | pub const EWOULDBLOCK: ::c_int = 35; | ||
405 | pub const EINPROGRESS: ::c_int = 36; | ||
406 | pub const EALREADY: ::c_int = 37; | ||
407 | pub const ENOTSOCK: ::c_int = 38; | ||
408 | pub const EDESTADDRREQ: ::c_int = 39; | ||
409 | pub const EMSGSIZE: ::c_int = 40; | ||
410 | pub const EPROTOTYPE: ::c_int = 41; | ||
411 | pub const ENOPROTOOPT: ::c_int = 42; | ||
412 | pub const EPROTONOSUPPORT: ::c_int = 43; | ||
413 | pub const ESOCKTNOSUPPORT: ::c_int = 44; | ||
414 | pub const EOPNOTSUPP: ::c_int = 45; | ||
415 | pub const EPFNOSUPPORT: ::c_int = 46; | ||
416 | pub const EAFNOSUPPORT: ::c_int = 47; | ||
417 | pub const EADDRINUSE: ::c_int = 48; | ||
418 | pub const EADDRNOTAVAIL: ::c_int = 49; | ||
419 | pub const ENETDOWN: ::c_int = 50; | ||
420 | pub const ENETUNREACH: ::c_int = 51; | ||
421 | pub const ENETRESET: ::c_int = 52; | ||
422 | pub const ECONNABORTED: ::c_int = 53; | ||
423 | pub const ECONNRESET: ::c_int = 54; | ||
424 | pub const ENOBUFS: ::c_int = 55; | ||
425 | pub const EISCONN: ::c_int = 56; | ||
426 | pub const ENOTCONN: ::c_int = 57; | ||
427 | pub const ESHUTDOWN: ::c_int = 58; | ||
428 | pub const ETOOMANYREFS: ::c_int = 59; | ||
429 | pub const ETIMEDOUT: ::c_int = 60; | ||
430 | pub const ECONNREFUSED: ::c_int = 61; | ||
431 | pub const ELOOP: ::c_int = 62; | ||
432 | pub const ENAMETOOLONG: ::c_int = 63; | ||
433 | pub const EHOSTDOWN: ::c_int = 64; | ||
434 | pub const EHOSTUNREACH: ::c_int = 65; | ||
435 | pub const ENOTEMPTY: ::c_int = 66; | ||
436 | pub const EPROCLIM: ::c_int = 67; | ||
437 | pub const EUSERS: ::c_int = 68; | ||
438 | pub const EDQUOT: ::c_int = 69; | ||
439 | pub const ESTALE: ::c_int = 70; | ||
440 | pub const EREMOTE: ::c_int = 71; | ||
441 | pub const EBADRPC: ::c_int = 72; | ||
442 | pub const ERPCMISMATCH: ::c_int = 73; | ||
443 | pub const EPROGUNAVAIL: ::c_int = 74; | ||
444 | pub const EPROGMISMATCH: ::c_int = 75; | ||
445 | pub const EPROCUNAVAIL: ::c_int = 76; | ||
446 | pub const ENOLCK: ::c_int = 77; | ||
447 | pub const ENOSYS: ::c_int = 78; | ||
448 | pub const EFTYPE: ::c_int = 79; | ||
449 | pub const EAUTH: ::c_int = 80; | ||
450 | pub const ENEEDAUTH: ::c_int = 81; | ||
451 | pub const EIDRM: ::c_int = 82; | ||
452 | pub const ENOMSG: ::c_int = 83; | ||
453 | pub const EOVERFLOW: ::c_int = 84; | ||
454 | pub const ECANCELED: ::c_int = 85; | ||
455 | pub const EILSEQ: ::c_int = 86; | ||
456 | pub const ENOATTR: ::c_int = 87; | ||
457 | pub const EDOOFUS: ::c_int = 88; | ||
458 | pub const EBADMSG: ::c_int = 89; | ||
459 | pub const EMULTIHOP: ::c_int = 90; | ||
460 | pub const ENOLINK: ::c_int = 91; | ||
461 | pub const EPROTO: ::c_int = 92; | ||
462 | |||
463 | pub const F_DUPFD: ::c_int = 0; | ||
464 | pub const F_GETFD: ::c_int = 1; | ||
465 | pub const F_SETFD: ::c_int = 2; | ||
466 | pub const F_GETFL: ::c_int = 3; | ||
467 | pub const F_SETFL: ::c_int = 4; | ||
468 | |||
469 | pub const SIGTRAP: ::c_int = 5; | ||
470 | |||
471 | pub const GLOB_APPEND : ::c_int = 0x0001; | ||
472 | pub const GLOB_DOOFFS : ::c_int = 0x0002; | ||
473 | pub const GLOB_ERR : ::c_int = 0x0004; | ||
474 | pub const GLOB_MARK : ::c_int = 0x0008; | ||
475 | pub const GLOB_NOCHECK : ::c_int = 0x0010; | ||
476 | pub const GLOB_NOSORT : ::c_int = 0x0020; | ||
477 | pub const GLOB_NOESCAPE: ::c_int = 0x2000; | ||
478 | |||
479 | pub const GLOB_NOSPACE : ::c_int = -1; | ||
480 | pub const GLOB_ABORTED : ::c_int = -2; | ||
481 | pub const GLOB_NOMATCH : ::c_int = -3; | ||
482 | |||
483 | pub const POSIX_MADV_NORMAL: ::c_int = 0; | ||
484 | pub const POSIX_MADV_RANDOM: ::c_int = 1; | ||
485 | pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; | ||
486 | pub const POSIX_MADV_WILLNEED: ::c_int = 3; | ||
487 | pub const POSIX_MADV_DONTNEED: ::c_int = 4; | ||
488 | |||
489 | pub const _SC_IOV_MAX: ::c_int = 56; | ||
490 | pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70; | ||
491 | pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71; | ||
492 | pub const _SC_LOGIN_NAME_MAX: ::c_int = 73; | ||
493 | pub const _SC_MQ_PRIO_MAX: ::c_int = 75; | ||
494 | pub const _SC_NPROCESSORS_ONLN: ::c_int = 58; | ||
495 | pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82; | ||
496 | pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83; | ||
497 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85; | ||
498 | pub const _SC_THREAD_KEYS_MAX: ::c_int = 86; | ||
499 | pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87; | ||
500 | pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88; | ||
501 | pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89; | ||
502 | pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90; | ||
503 | pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91; | ||
504 | pub const _SC_THREAD_STACK_MIN: ::c_int = 93; | ||
505 | pub const _SC_THREAD_THREADS_MAX: ::c_int = 94; | ||
506 | pub const _SC_THREADS: ::c_int = 96; | ||
507 | pub const _SC_TTY_NAME_MAX: ::c_int = 101; | ||
508 | pub const _SC_ATEXIT_MAX: ::c_int = 107; | ||
509 | pub const _SC_XOPEN_CRYPT: ::c_int = 108; | ||
510 | pub const _SC_XOPEN_ENH_I18N: ::c_int = 109; | ||
511 | pub const _SC_XOPEN_LEGACY: ::c_int = 110; | ||
512 | pub const _SC_XOPEN_REALTIME: ::c_int = 111; | ||
513 | pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112; | ||
514 | pub const _SC_XOPEN_SHM: ::c_int = 113; | ||
515 | pub const _SC_XOPEN_UNIX: ::c_int = 115; | ||
516 | pub const _SC_XOPEN_VERSION: ::c_int = 116; | ||
517 | pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117; | ||
518 | |||
519 | pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; | ||
520 | pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; | ||
521 | |||
522 | pub const RLIMIT_CPU: ::c_int = 0; | ||
523 | pub const RLIMIT_FSIZE: ::c_int = 1; | ||
524 | pub const RLIMIT_DATA: ::c_int = 2; | ||
525 | pub const RLIMIT_STACK: ::c_int = 3; | ||
526 | pub const RLIMIT_CORE: ::c_int = 4; | ||
527 | pub const RLIMIT_RSS: ::c_int = 5; | ||
528 | pub const RLIMIT_MEMLOCK: ::c_int = 6; | ||
529 | pub const RLIMIT_NPROC: ::c_int = 7; | ||
530 | pub const RLIMIT_NOFILE: ::c_int = 8; | ||
531 | pub const RLIMIT_SBSIZE: ::c_int = 9; | ||
532 | pub const RLIMIT_VMEM: ::c_int = 10; | ||
533 | pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM; | ||
534 | pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff; | ||
535 | |||
536 | pub const RUSAGE_SELF: ::c_int = 0; | ||
537 | pub const RUSAGE_CHILDREN: ::c_int = -1; | ||
538 | |||
539 | pub const MADV_NORMAL: ::c_int = 0; | ||
540 | pub const MADV_RANDOM: ::c_int = 1; | ||
541 | pub const MADV_SEQUENTIAL: ::c_int = 2; | ||
542 | pub const MADV_WILLNEED: ::c_int = 3; | ||
543 | pub const MADV_DONTNEED: ::c_int = 4; | ||
544 | pub const MADV_FREE: ::c_int = 5; | ||
545 | pub const MADV_NOSYNC: ::c_int = 6; | ||
546 | pub const MADV_AUTOSYNC: ::c_int = 7; | ||
547 | pub const MADV_NOCORE: ::c_int = 8; | ||
548 | pub const MADV_CORE: ::c_int = 9; | ||
549 | |||
550 | pub const MINCORE_INCORE: ::c_int = 0x1; | ||
551 | pub const MINCORE_REFERENCED: ::c_int = 0x2; | ||
552 | pub const MINCORE_MODIFIED: ::c_int = 0x4; | ||
553 | pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8; | ||
554 | pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10; | ||
555 | pub const MINCORE_SUPER: ::c_int = 0x20; | ||
556 | |||
557 | pub const AF_INET: ::c_int = 2; | ||
558 | pub const AF_INET6: ::c_int = 28; | ||
559 | pub const AF_UNIX: ::c_int = 1; | ||
560 | pub const SOCK_STREAM: ::c_int = 1; | ||
561 | pub const SOCK_DGRAM: ::c_int = 2; | ||
562 | pub const SOCK_RAW: ::c_int = 3; | ||
563 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
564 | pub const IPPROTO_TCP: ::c_int = 6; | ||
565 | pub const IPPROTO_IP: ::c_int = 0; | ||
566 | pub const IPPROTO_IPV6: ::c_int = 41; | ||
567 | pub const IP_MULTICAST_TTL: ::c_int = 10; | ||
568 | pub const IP_MULTICAST_LOOP: ::c_int = 11; | ||
569 | pub const IP_TTL: ::c_int = 4; | ||
570 | pub const IP_HDRINCL: ::c_int = 2; | ||
571 | pub const IP_ADD_MEMBERSHIP: ::c_int = 12; | ||
572 | pub const IP_DROP_MEMBERSHIP: ::c_int = 13; | ||
573 | pub const IPV6_JOIN_GROUP: ::c_int = 12; | ||
574 | pub const IPV6_LEAVE_GROUP: ::c_int = 13; | ||
575 | |||
576 | pub const TCP_NODELAY: ::c_int = 1; | ||
577 | pub const TCP_KEEPIDLE: ::c_int = 256; | ||
578 | pub const SOL_SOCKET: ::c_int = 0xffff; | ||
579 | pub const SO_DEBUG: ::c_int = 0x01; | ||
580 | pub const SO_ACCEPTCONN: ::c_int = 0x0002; | ||
581 | pub const SO_REUSEADDR: ::c_int = 0x0004; | ||
582 | pub const SO_KEEPALIVE: ::c_int = 0x0008; | ||
583 | pub const SO_DONTROUTE: ::c_int = 0x0010; | ||
584 | pub const SO_BROADCAST: ::c_int = 0x0020; | ||
585 | pub const SO_USELOOPBACK: ::c_int = 0x0040; | ||
586 | pub const SO_LINGER: ::c_int = 0x0080; | ||
587 | pub const SO_OOBINLINE: ::c_int = 0x0100; | ||
588 | pub const SO_REUSEPORT: ::c_int = 0x0200; | ||
589 | pub const SO_SNDBUF: ::c_int = 0x1001; | ||
590 | pub const SO_RCVBUF: ::c_int = 0x1002; | ||
591 | pub const SO_SNDLOWAT: ::c_int = 0x1003; | ||
592 | pub const SO_RCVLOWAT: ::c_int = 0x1004; | ||
593 | pub const SO_SNDTIMEO: ::c_int = 0x1005; | ||
594 | pub const SO_RCVTIMEO: ::c_int = 0x1006; | ||
595 | pub const SO_ERROR: ::c_int = 0x1007; | ||
596 | pub const SO_TYPE: ::c_int = 0x1008; | ||
597 | |||
598 | pub const IFF_LOOPBACK: ::c_int = 0x8; | ||
599 | |||
600 | pub const SHUT_RD: ::c_int = 0; | ||
601 | pub const SHUT_WR: ::c_int = 1; | ||
602 | pub const SHUT_RDWR: ::c_int = 2; | ||
603 | |||
604 | pub const LOCK_SH: ::c_int = 1; | ||
605 | pub const LOCK_EX: ::c_int = 2; | ||
606 | pub const LOCK_NB: ::c_int = 4; | ||
607 | pub const LOCK_UN: ::c_int = 8; | ||
608 | |||
609 | pub const O_SYNC: ::c_int = 128; | ||
610 | pub const O_NONBLOCK: ::c_int = 4; | ||
611 | |||
612 | pub const MAP_COPY: ::c_int = 0x0002; | ||
613 | pub const MAP_RENAME: ::c_int = 0x0020; | ||
614 | pub const MAP_NORESERVE: ::c_int = 0x0040; | ||
615 | pub const MAP_HASSEMAPHORE: ::c_int = 0x0200; | ||
616 | pub const MAP_STACK: ::c_int = 0x0400; | ||
617 | pub const MAP_NOSYNC: ::c_int = 0x0800; | ||
618 | pub const MAP_NOCORE: ::c_int = 0x020000; | ||
619 | |||
620 | pub const IPPROTO_RAW: ::c_int = 255; | ||
621 | |||
622 | pub const _SC_ARG_MAX: ::c_int = 1; | ||
623 | pub const _SC_CHILD_MAX: ::c_int = 2; | ||
624 | pub const _SC_CLK_TCK: ::c_int = 3; | ||
625 | pub const _SC_NGROUPS_MAX: ::c_int = 4; | ||
626 | pub const _SC_OPEN_MAX: ::c_int = 5; | ||
627 | pub const _SC_JOB_CONTROL: ::c_int = 6; | ||
628 | pub const _SC_SAVED_IDS: ::c_int = 7; | ||
629 | pub const _SC_VERSION: ::c_int = 8; | ||
630 | pub const _SC_BC_BASE_MAX: ::c_int = 9; | ||
631 | pub const _SC_BC_DIM_MAX: ::c_int = 10; | ||
632 | pub const _SC_BC_SCALE_MAX: ::c_int = 11; | ||
633 | pub const _SC_BC_STRING_MAX: ::c_int = 12; | ||
634 | pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13; | ||
635 | pub const _SC_EXPR_NEST_MAX: ::c_int = 14; | ||
636 | pub const _SC_LINE_MAX: ::c_int = 15; | ||
637 | pub const _SC_RE_DUP_MAX: ::c_int = 16; | ||
638 | pub const _SC_2_VERSION: ::c_int = 17; | ||
639 | pub const _SC_2_C_BIND: ::c_int = 18; | ||
640 | pub const _SC_2_C_DEV: ::c_int = 19; | ||
641 | pub const _SC_2_CHAR_TERM: ::c_int = 20; | ||
642 | pub const _SC_2_FORT_DEV: ::c_int = 21; | ||
643 | pub const _SC_2_FORT_RUN: ::c_int = 22; | ||
644 | pub const _SC_2_LOCALEDEF: ::c_int = 23; | ||
645 | pub const _SC_2_SW_DEV: ::c_int = 24; | ||
646 | pub const _SC_2_UPE: ::c_int = 25; | ||
647 | pub const _SC_STREAM_MAX: ::c_int = 26; | ||
648 | pub const _SC_TZNAME_MAX: ::c_int = 27; | ||
649 | pub const _SC_ASYNCHRONOUS_IO: ::c_int = 28; | ||
650 | pub const _SC_MAPPED_FILES: ::c_int = 29; | ||
651 | pub const _SC_MEMLOCK: ::c_int = 30; | ||
652 | pub const _SC_MEMLOCK_RANGE: ::c_int = 31; | ||
653 | pub const _SC_MEMORY_PROTECTION: ::c_int = 32; | ||
654 | pub const _SC_MESSAGE_PASSING: ::c_int = 33; | ||
655 | pub const _SC_PRIORITIZED_IO: ::c_int = 34; | ||
656 | pub const _SC_PRIORITY_SCHEDULING: ::c_int = 35; | ||
657 | pub const _SC_REALTIME_SIGNALS: ::c_int = 36; | ||
658 | pub const _SC_SEMAPHORES: ::c_int = 37; | ||
659 | pub const _SC_FSYNC: ::c_int = 38; | ||
660 | pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 39; | ||
661 | pub const _SC_SYNCHRONIZED_IO: ::c_int = 40; | ||
662 | pub const _SC_TIMERS: ::c_int = 41; | ||
663 | pub const _SC_AIO_LISTIO_MAX: ::c_int = 42; | ||
664 | pub const _SC_AIO_MAX: ::c_int = 43; | ||
665 | pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44; | ||
666 | pub const _SC_DELAYTIMER_MAX: ::c_int = 45; | ||
667 | pub const _SC_MQ_OPEN_MAX: ::c_int = 46; | ||
668 | pub const _SC_PAGESIZE: ::c_int = 47; | ||
669 | pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; | ||
670 | pub const _SC_RTSIG_MAX: ::c_int = 48; | ||
671 | pub const _SC_SEM_NSEMS_MAX: ::c_int = 49; | ||
672 | pub const _SC_SEM_VALUE_MAX: ::c_int = 50; | ||
673 | pub const _SC_SIGQUEUE_MAX: ::c_int = 51; | ||
674 | pub const _SC_TIMER_MAX: ::c_int = 52; | ||
675 | pub const _SC_HOST_NAME_MAX: ::c_int = 72; | ||
676 | |||
677 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _; | ||
678 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _; | ||
679 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _; | ||
680 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1; | ||
681 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; | ||
682 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3; | ||
683 | pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4; | ||
684 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_ERRORCHECK; | ||
685 | |||
686 | pub const SCHED_FIFO: ::c_int = 1; | ||
687 | pub const SCHED_OTHER: ::c_int = 2; | ||
688 | pub const SCHED_RR: ::c_int = 3; | ||
689 | |||
690 | pub const FD_SETSIZE: usize = 1024; | ||
691 | |||
692 | pub const ST_NOSUID: ::c_ulong = 2; | ||
693 | |||
694 | pub const NI_MAXHOST: ::size_t = 1025; | ||
695 | |||
696 | pub const RTLD_LOCAL: ::c_int = 0; | ||
697 | pub const RTLD_NODELETE: ::c_int = 0x1000; | ||
698 | pub const RTLD_NOLOAD: ::c_int = 0x2000; | ||
699 | pub const RTLD_GLOBAL: ::c_int = 0x100; | ||
700 | |||
701 | pub const LOG_NTP: ::c_int = 12 << 3; | ||
702 | pub const LOG_SECURITY: ::c_int = 13 << 3; | ||
703 | pub const LOG_CONSOLE: ::c_int = 14 << 3; | ||
704 | pub const LOG_NFACILITIES: ::c_int = 24; | ||
705 | |||
706 | pub const TIOCGWINSZ: ::c_ulong = 0x40087468; | ||
707 | pub const TIOCSWINSZ: ::c_ulong = 0x80087467; | ||
708 | |||
709 | pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t; | ||
710 | |||
711 | f! { | ||
712 | pub fn WSTOPSIG(status: ::c_int) -> ::c_int { | ||
713 | status >> 8 | ||
714 | } | ||
715 | |||
716 | pub fn WIFSIGNALED(status: ::c_int) -> bool { | ||
717 | (status & 0o177) != 0o177 && (status & 0o177) != 0 | ||
718 | } | ||
719 | |||
720 | pub fn WIFSTOPPED(status: ::c_int) -> bool { | ||
721 | (status & 0o177) == 0o177 | ||
722 | } | ||
723 | } | ||
724 | |||
725 | extern { | ||
726 | pub fn endutxent(); | ||
727 | pub fn getutxent() -> *mut utmpx; | ||
728 | pub fn getutxid(ut: *const utmpx) -> *mut utmpx; | ||
729 | pub fn getutxline(ut: *const utmpx) -> *mut utmpx; | ||
730 | pub fn pututxline(ut: *const utmpx) -> *mut utmpx; | ||
731 | pub fn setutxent(); | ||
732 | pub fn getutxuser(user: *const ::c_char) -> *mut utmpx; | ||
733 | pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int; | ||
734 | } | ||
735 | |||
736 | #[link(name = "util")] | ||
737 | extern { | ||
738 | pub fn getnameinfo(sa: *const ::sockaddr, | ||
739 | salen: ::socklen_t, | ||
740 | host: *mut ::c_char, | ||
741 | hostlen: ::size_t, | ||
742 | serv: *mut ::c_char, | ||
743 | servlen: ::size_t, | ||
744 | flags: ::c_int) -> ::c_int; | ||
745 | pub fn mincore(addr: *const ::c_void, len: ::size_t, | ||
746 | vec: *mut ::c_char) -> ::c_int; | ||
747 | pub fn sysctlnametomib(name: *const ::c_char, | ||
748 | mibp: *mut ::c_int, | ||
749 | sizep: *mut ::size_t) | ||
750 | -> ::c_int; | ||
751 | pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) | ||
752 | -> ::c_int; | ||
753 | pub fn sysctl(name: *const ::c_int, | ||
754 | namelen: ::c_uint, | ||
755 | oldp: *mut ::c_void, | ||
756 | oldlenp: *mut ::size_t, | ||
757 | newp: *const ::c_void, | ||
758 | newlen: ::size_t) | ||
759 | -> ::c_int; | ||
760 | pub fn sysctlbyname(name: *const ::c_char, | ||
761 | oldp: *mut ::c_void, | ||
762 | oldlenp: *mut ::size_t, | ||
763 | newp: *const ::c_void, | ||
764 | newlen: ::size_t) | ||
765 | -> ::c_int; | ||
766 | pub fn sched_setscheduler(pid: ::pid_t, | ||
767 | policy: ::c_int, | ||
768 | param: *const sched_param) -> ::c_int; | ||
769 | pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; | ||
770 | pub fn memrchr(cx: *const ::c_void, | ||
771 | c: ::c_int, | ||
772 | n: ::size_t) -> *mut ::c_void; | ||
773 | pub fn sendfile(fd: ::c_int, | ||
774 | s: ::c_int, | ||
775 | offset: ::off_t, | ||
776 | nbytes: ::size_t, | ||
777 | hdtr: *mut ::sf_hdtr, | ||
778 | sbytes: *mut ::off_t, | ||
779 | flags: ::c_int) -> ::c_int; | ||
780 | pub fn sigtimedwait(set: *const sigset_t, | ||
781 | info: *mut siginfo_t, | ||
782 | timeout: *const ::timespec) -> ::c_int; | ||
783 | pub fn sigwaitinfo(set: *const sigset_t, | ||
784 | info: *mut siginfo_t) -> ::c_int; | ||
785 | pub fn openpty(amaster: *mut ::c_int, | ||
786 | aslave: *mut ::c_int, | ||
787 | name: *mut ::c_char, | ||
788 | termp: *mut termios, | ||
789 | winp: *mut ::winsize) -> ::c_int; | ||
790 | pub fn forkpty(amaster: *mut ::c_int, | ||
791 | name: *mut ::c_char, | ||
792 | termp: *mut termios, | ||
793 | winp: *mut ::winsize) -> ::pid_t; | ||
794 | pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; | ||
795 | pub fn duplocale(base: ::locale_t) -> ::locale_t; | ||
796 | pub fn freelocale(loc: ::locale_t) -> ::c_int; | ||
797 | pub fn newlocale(mask: ::c_int, | ||
798 | locale: *const ::c_char, | ||
799 | base: ::locale_t) -> ::locale_t; | ||
800 | pub fn uselocale(loc: ::locale_t) -> ::locale_t; | ||
801 | pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char; | ||
802 | pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); | ||
803 | pub fn pthread_attr_get_np(tid: ::pthread_t, | ||
804 | attr: *mut ::pthread_attr_t) -> ::c_int; | ||
805 | pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, | ||
806 | guardsize: *mut ::size_t) -> ::c_int; | ||
807 | pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, | ||
808 | stackaddr: *mut *mut ::c_void, | ||
809 | stacksize: *mut ::size_t) -> ::c_int; | ||
810 | pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int; | ||
811 | pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; | ||
812 | |||
813 | pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, | ||
814 | flags: ::c_int, ...) -> ::c_int; | ||
815 | pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, | ||
816 | mode: ::c_int, flags: ::c_int) -> ::c_int; | ||
817 | pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
818 | mode: ::mode_t, flags: ::c_int) -> ::c_int; | ||
819 | pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char, | ||
820 | owner: ::uid_t, group: ::gid_t, | ||
821 | flags: ::c_int) -> ::c_int; | ||
822 | pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, | ||
823 | buf: *mut stat, flags: ::c_int) -> ::c_int; | ||
824 | pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
825 | newdirfd: ::c_int, newpath: *const ::c_char, | ||
826 | flags: ::c_int) -> ::c_int; | ||
827 | pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, | ||
828 | mode: ::mode_t) -> ::c_int; | ||
829 | pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
830 | mode: ::mode_t, dev: dev_t) -> ::c_int; | ||
831 | pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
832 | buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t; | ||
833 | pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
834 | newdirfd: ::c_int, newpath: *const ::c_char) | ||
835 | -> ::c_int; | ||
836 | pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int, | ||
837 | linkpath: *const ::c_char) -> ::c_int; | ||
838 | pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
839 | flags: ::c_int) -> ::c_int; | ||
840 | pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, | ||
841 | mode: ::mode_t) -> ::c_int; | ||
842 | pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, | ||
843 | clock_id: *mut clockid_t) -> ::c_int; | ||
844 | pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, | ||
845 | clock_id: clockid_t) -> ::c_int; | ||
846 | pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int; | ||
847 | } | ||
848 | |||
849 | cfg_if! { | ||
850 | if #[cfg(target_os = "freebsd")] { | ||
851 | mod freebsd; | ||
852 | pub use self::freebsd::*; | ||
853 | } else if #[cfg(target_os = "dragonfly")] { | ||
854 | mod dragonfly; | ||
855 | pub use self::dragonfly::*; | ||
856 | } else { | ||
857 | // ... | ||
858 | } | ||
859 | } | ||
diff --git a/third_party/libc/src/unix/bsd/mod.rs b/third_party/libc/src/unix/bsd/mod.rs new file mode 100644 index 0000000..a2e2dd7 --- /dev/null +++ b/third_party/libc/src/unix/bsd/mod.rs | |||
@@ -0,0 +1,393 @@ | |||
1 | use dox::mem; | ||
2 | |||
3 | pub type c_char = i8; | ||
4 | pub type wchar_t = i32; | ||
5 | pub type off_t = i64; | ||
6 | pub type useconds_t = u32; | ||
7 | pub type blkcnt_t = i64; | ||
8 | pub type socklen_t = u32; | ||
9 | pub type sa_family_t = u8; | ||
10 | pub type pthread_t = ::uintptr_t; | ||
11 | pub type nfds_t = ::c_uint; | ||
12 | |||
13 | s! { | ||
14 | pub struct sockaddr { | ||
15 | pub sa_len: u8, | ||
16 | pub sa_family: sa_family_t, | ||
17 | pub sa_data: [::c_char; 14], | ||
18 | } | ||
19 | |||
20 | pub struct sockaddr_in6 { | ||
21 | pub sin6_len: u8, | ||
22 | pub sin6_family: sa_family_t, | ||
23 | pub sin6_port: ::in_port_t, | ||
24 | pub sin6_flowinfo: u32, | ||
25 | pub sin6_addr: ::in6_addr, | ||
26 | pub sin6_scope_id: u32, | ||
27 | } | ||
28 | |||
29 | pub struct sockaddr_un { | ||
30 | pub sun_len: u8, | ||
31 | pub sun_family: sa_family_t, | ||
32 | pub sun_path: [c_char; 104] | ||
33 | } | ||
34 | |||
35 | pub struct passwd { | ||
36 | pub pw_name: *mut ::c_char, | ||
37 | pub pw_passwd: *mut ::c_char, | ||
38 | pub pw_uid: ::uid_t, | ||
39 | pub pw_gid: ::gid_t, | ||
40 | pub pw_change: ::time_t, | ||
41 | pub pw_class: *mut ::c_char, | ||
42 | pub pw_gecos: *mut ::c_char, | ||
43 | pub pw_dir: *mut ::c_char, | ||
44 | pub pw_shell: *mut ::c_char, | ||
45 | pub pw_expire: ::time_t, | ||
46 | |||
47 | #[cfg(not(any(target_os = "macos", | ||
48 | target_os = "ios", | ||
49 | target_os = "netbsd", | ||
50 | target_os = "openbsd")))] | ||
51 | pub pw_fields: ::c_int, | ||
52 | } | ||
53 | |||
54 | pub struct ifaddrs { | ||
55 | pub ifa_next: *mut ifaddrs, | ||
56 | pub ifa_name: *mut ::c_char, | ||
57 | pub ifa_flags: ::c_uint, | ||
58 | pub ifa_addr: *mut ::sockaddr, | ||
59 | pub ifa_netmask: *mut ::sockaddr, | ||
60 | pub ifa_dstaddr: *mut ::sockaddr, | ||
61 | pub ifa_data: *mut ::c_void | ||
62 | } | ||
63 | |||
64 | pub struct fd_set { | ||
65 | #[cfg(all(target_pointer_width = "64", | ||
66 | any(target_os = "freebsd", target_os = "dragonfly")))] | ||
67 | fds_bits: [i64; FD_SETSIZE / 64], | ||
68 | #[cfg(not(all(target_pointer_width = "64", | ||
69 | any(target_os = "freebsd", target_os = "dragonfly"))))] | ||
70 | fds_bits: [i32; FD_SETSIZE / 32], | ||
71 | } | ||
72 | |||
73 | pub struct tm { | ||
74 | pub tm_sec: ::c_int, | ||
75 | pub tm_min: ::c_int, | ||
76 | pub tm_hour: ::c_int, | ||
77 | pub tm_mday: ::c_int, | ||
78 | pub tm_mon: ::c_int, | ||
79 | pub tm_year: ::c_int, | ||
80 | pub tm_wday: ::c_int, | ||
81 | pub tm_yday: ::c_int, | ||
82 | pub tm_isdst: ::c_int, | ||
83 | pub tm_gmtoff: ::c_long, | ||
84 | pub tm_zone: *mut ::c_char, | ||
85 | } | ||
86 | |||
87 | pub struct utsname { | ||
88 | #[cfg(not(target_os = "dragonfly"))] | ||
89 | pub sysname: [::c_char; 256], | ||
90 | #[cfg(target_os = "dragonfly")] | ||
91 | pub sysname: [::c_char; 32], | ||
92 | #[cfg(not(target_os = "dragonfly"))] | ||
93 | pub nodename: [::c_char; 256], | ||
94 | #[cfg(target_os = "dragonfly")] | ||
95 | pub nodename: [::c_char; 32], | ||
96 | #[cfg(not(target_os = "dragonfly"))] | ||
97 | pub release: [::c_char; 256], | ||
98 | #[cfg(target_os = "dragonfly")] | ||
99 | pub release: [::c_char; 32], | ||
100 | #[cfg(not(target_os = "dragonfly"))] | ||
101 | pub version: [::c_char; 256], | ||
102 | #[cfg(target_os = "dragonfly")] | ||
103 | pub version: [::c_char; 32], | ||
104 | #[cfg(not(target_os = "dragonfly"))] | ||
105 | pub machine: [::c_char; 256], | ||
106 | #[cfg(target_os = "dragonfly")] | ||
107 | pub machine: [::c_char; 32], | ||
108 | } | ||
109 | |||
110 | pub struct msghdr { | ||
111 | pub msg_name: *mut ::c_void, | ||
112 | pub msg_namelen: ::socklen_t, | ||
113 | pub msg_iov: *mut ::iovec, | ||
114 | pub msg_iovlen: ::c_int, | ||
115 | pub msg_control: *mut ::c_void, | ||
116 | pub msg_controllen: ::socklen_t, | ||
117 | pub msg_flags: ::c_int, | ||
118 | } | ||
119 | |||
120 | pub struct fsid_t { | ||
121 | __fsid_val: [::int32_t; 2], | ||
122 | } | ||
123 | |||
124 | pub struct if_nameindex { | ||
125 | pub if_index: ::c_uint, | ||
126 | pub if_name: *mut ::c_char, | ||
127 | } | ||
128 | } | ||
129 | |||
130 | pub const LC_ALL: ::c_int = 0; | ||
131 | pub const LC_COLLATE: ::c_int = 1; | ||
132 | pub const LC_CTYPE: ::c_int = 2; | ||
133 | pub const LC_MONETARY: ::c_int = 3; | ||
134 | pub const LC_NUMERIC: ::c_int = 4; | ||
135 | pub const LC_TIME: ::c_int = 5; | ||
136 | pub const LC_MESSAGES: ::c_int = 6; | ||
137 | |||
138 | pub const FIOCLEX: ::c_ulong = 0x20006601; | ||
139 | pub const FIONBIO: ::c_ulong = 0x8004667e; | ||
140 | |||
141 | pub const PATH_MAX: ::c_int = 1024; | ||
142 | |||
143 | pub const SA_ONSTACK: ::c_int = 0x0001; | ||
144 | pub const SA_SIGINFO: ::c_int = 0x0040; | ||
145 | pub const SA_RESTART: ::c_int = 0x0002; | ||
146 | pub const SA_RESETHAND: ::c_int = 0x0004; | ||
147 | pub const SA_NOCLDSTOP: ::c_int = 0x0008; | ||
148 | pub const SA_NODEFER: ::c_int = 0x0010; | ||
149 | pub const SA_NOCLDWAIT: ::c_int = 0x0020; | ||
150 | |||
151 | pub const SS_ONSTACK: ::c_int = 1; | ||
152 | pub const SS_DISABLE: ::c_int = 4; | ||
153 | |||
154 | pub const SIGCHLD: ::c_int = 20; | ||
155 | pub const SIGBUS: ::c_int = 10; | ||
156 | pub const SIGUSR1: ::c_int = 30; | ||
157 | pub const SIGUSR2: ::c_int = 31; | ||
158 | pub const SIGCONT: ::c_int = 19; | ||
159 | pub const SIGSTOP: ::c_int = 17; | ||
160 | pub const SIGTSTP: ::c_int = 18; | ||
161 | pub const SIGURG: ::c_int = 16; | ||
162 | pub const SIGIO: ::c_int = 23; | ||
163 | pub const SIGSYS: ::c_int = 12; | ||
164 | pub const SIGTTIN: ::c_int = 21; | ||
165 | pub const SIGTTOU: ::c_int = 22; | ||
166 | pub const SIGXCPU: ::c_int = 24; | ||
167 | pub const SIGXFSZ: ::c_int = 25; | ||
168 | pub const SIGVTALRM: ::c_int = 26; | ||
169 | pub const SIGPROF: ::c_int = 27; | ||
170 | pub const SIGWINCH: ::c_int = 28; | ||
171 | pub const SIGINFO: ::c_int = 29; | ||
172 | |||
173 | pub const SIG_SETMASK: ::c_int = 3; | ||
174 | pub const SIG_BLOCK: ::c_int = 0x1; | ||
175 | pub const SIG_UNBLOCK: ::c_int = 0x2; | ||
176 | |||
177 | pub const IPV6_MULTICAST_LOOP: ::c_int = 11; | ||
178 | pub const IPV6_V6ONLY: ::c_int = 27; | ||
179 | |||
180 | pub const ST_RDONLY: ::c_ulong = 1; | ||
181 | |||
182 | pub const EV_ADD: ::uint16_t = 0x1; | ||
183 | pub const EV_CLEAR: ::uint16_t = 0x20; | ||
184 | pub const EV_DELETE: ::uint16_t = 0x2; | ||
185 | pub const EV_DISABLE: ::uint16_t = 0x8; | ||
186 | pub const EV_ENABLE: ::uint16_t = 0x4; | ||
187 | pub const EV_EOF: ::uint16_t = 0x8000; | ||
188 | pub const EV_ERROR: ::uint16_t = 0x4000; | ||
189 | pub const EV_FLAG1: ::uint16_t = 0x2000; | ||
190 | pub const EV_ONESHOT: ::uint16_t = 0x10; | ||
191 | pub const EV_SYSFLAGS: ::uint16_t = 0xf000; | ||
192 | |||
193 | pub const NOTE_ATTRIB: ::uint32_t = 0x8; | ||
194 | pub const NOTE_CHILD: ::uint32_t = 0x4; | ||
195 | pub const NOTE_DELETE: ::uint32_t = 0x1; | ||
196 | pub const NOTE_EXEC: ::uint32_t = 0x20000000; | ||
197 | pub const NOTE_EXIT: ::uint32_t = 0x80000000; | ||
198 | pub const NOTE_EXTEND: ::uint32_t = 0x4; | ||
199 | pub const NOTE_FORK: ::uint32_t = 0x40000000; | ||
200 | pub const NOTE_LINK: ::uint32_t = 0x10; | ||
201 | pub const NOTE_LOWAT: ::uint32_t = 0x1; | ||
202 | pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; | ||
203 | pub const NOTE_RENAME: ::uint32_t = 0x20; | ||
204 | pub const NOTE_REVOKE: ::uint32_t = 0x40; | ||
205 | pub const NOTE_TRACK: ::uint32_t = 0x1; | ||
206 | pub const NOTE_TRACKERR: ::uint32_t = 0x2; | ||
207 | pub const NOTE_WRITE: ::uint32_t = 0x2; | ||
208 | |||
209 | pub const NCCS: usize = 20; | ||
210 | |||
211 | pub const O_ASYNC: ::c_int = 0x40; | ||
212 | pub const O_FSYNC: ::c_int = 0x80; | ||
213 | pub const O_NDELAY: ::c_int = 0x4; | ||
214 | pub const O_NOFOLLOW: ::c_int = 0x100; | ||
215 | |||
216 | pub const F_GETOWN: ::c_int = 5; | ||
217 | pub const F_SETOWN: ::c_int = 6; | ||
218 | |||
219 | pub const MNT_FORCE: ::c_int = 0x80000; | ||
220 | |||
221 | pub const Q_SYNC: ::c_int = 0x600; | ||
222 | pub const Q_QUOTAON: ::c_int = 0x100; | ||
223 | pub const Q_QUOTAOFF: ::c_int = 0x200; | ||
224 | |||
225 | pub const TCIOFF: ::c_int = 3; | ||
226 | pub const TCION: ::c_int = 4; | ||
227 | pub const TCOOFF: ::c_int = 1; | ||
228 | pub const TCOON: ::c_int = 2; | ||
229 | pub const TCIFLUSH: ::c_int = 1; | ||
230 | pub const TCOFLUSH: ::c_int = 2; | ||
231 | pub const TCIOFLUSH: ::c_int = 3; | ||
232 | pub const TCSANOW: ::c_int = 0; | ||
233 | pub const TCSADRAIN: ::c_int = 1; | ||
234 | pub const TCSAFLUSH: ::c_int = 2; | ||
235 | pub const VEOF: usize = 0; | ||
236 | pub const VEOL: usize = 1; | ||
237 | pub const VEOL2: usize = 2; | ||
238 | pub const VERASE: usize = 3; | ||
239 | pub const VWERASE: usize = 4; | ||
240 | pub const VKILL: usize = 5; | ||
241 | pub const VREPRINT: usize = 6; | ||
242 | pub const VINTR: usize = 8; | ||
243 | pub const VQUIT: usize = 9; | ||
244 | pub const VSUSP: usize = 10; | ||
245 | pub const VSTART: usize = 12; | ||
246 | pub const VSTOP: usize = 13; | ||
247 | pub const VLNEXT: usize = 14; | ||
248 | pub const VDISCARD: usize = 15; | ||
249 | pub const VMIN: usize = 16; | ||
250 | pub const VTIME: usize = 17; | ||
251 | pub const IGNBRK: ::tcflag_t = 0x00000001; | ||
252 | pub const BRKINT: ::tcflag_t = 0x00000002; | ||
253 | pub const IGNPAR: ::tcflag_t = 0x00000004; | ||
254 | pub const PARMRK: ::tcflag_t = 0x00000008; | ||
255 | pub const INPCK: ::tcflag_t = 0x00000010; | ||
256 | pub const ISTRIP: ::tcflag_t = 0x00000020; | ||
257 | pub const INLCR: ::tcflag_t = 0x00000040; | ||
258 | pub const IGNCR: ::tcflag_t = 0x00000080; | ||
259 | pub const ICRNL: ::tcflag_t = 0x00000100; | ||
260 | pub const IXON: ::tcflag_t = 0x00000200; | ||
261 | pub const IXOFF: ::tcflag_t = 0x00000400; | ||
262 | pub const IXANY: ::tcflag_t = 0x00000800; | ||
263 | pub const IMAXBEL: ::tcflag_t = 0x00002000; | ||
264 | pub const OPOST: ::tcflag_t = 0x1; | ||
265 | pub const ONLCR: ::tcflag_t = 0x2; | ||
266 | pub const CSIZE: ::tcflag_t = 0x00000300; | ||
267 | pub const CS5: ::tcflag_t = 0x00000000; | ||
268 | pub const CS6: ::tcflag_t = 0x00000100; | ||
269 | pub const CS7: ::tcflag_t = 0x00000200; | ||
270 | pub const CS8: ::tcflag_t = 0x00000300; | ||
271 | pub const CSTOPB: ::tcflag_t = 0x00000400; | ||
272 | pub const CREAD: ::tcflag_t = 0x00000800; | ||
273 | pub const PARENB: ::tcflag_t = 0x00001000; | ||
274 | pub const PARODD: ::tcflag_t = 0x00002000; | ||
275 | pub const HUPCL: ::tcflag_t = 0x00004000; | ||
276 | pub const CLOCAL: ::tcflag_t = 0x00008000; | ||
277 | pub const ECHOKE: ::tcflag_t = 0x00000001; | ||
278 | pub const ECHOE: ::tcflag_t = 0x00000002; | ||
279 | pub const ECHOK: ::tcflag_t = 0x00000004; | ||
280 | pub const ECHO: ::tcflag_t = 0x00000008; | ||
281 | pub const ECHONL: ::tcflag_t = 0x00000010; | ||
282 | pub const ECHOPRT: ::tcflag_t = 0x00000020; | ||
283 | pub const ECHOCTL: ::tcflag_t = 0x00000040; | ||
284 | pub const ISIG: ::tcflag_t = 0x00000080; | ||
285 | pub const ICANON: ::tcflag_t = 0x00000100; | ||
286 | pub const IEXTEN: ::tcflag_t = 0x00000400; | ||
287 | pub const EXTPROC: ::tcflag_t = 0x00000800; | ||
288 | pub const TOSTOP: ::tcflag_t = 0x00400000; | ||
289 | pub const FLUSHO: ::tcflag_t = 0x00800000; | ||
290 | pub const PENDIN: ::tcflag_t = 0x20000000; | ||
291 | pub const NOFLSH: ::tcflag_t = 0x80000000; | ||
292 | |||
293 | pub const WNOHANG: ::c_int = 0x00000001; | ||
294 | pub const WUNTRACED: ::c_int = 0x00000002; | ||
295 | |||
296 | pub const RTLD_NOW: ::c_int = 0x2; | ||
297 | pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void; | ||
298 | |||
299 | pub const LOG_CRON: ::c_int = 9 << 3; | ||
300 | pub const LOG_AUTHPRIV: ::c_int = 10 << 3; | ||
301 | pub const LOG_FTP: ::c_int = 11 << 3; | ||
302 | pub const LOG_PERROR: ::c_int = 0x20; | ||
303 | |||
304 | pub const PIPE_BUF: usize = 512; | ||
305 | |||
306 | f! { | ||
307 | pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { | ||
308 | let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; | ||
309 | let fd = fd as usize; | ||
310 | (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); | ||
311 | return | ||
312 | } | ||
313 | |||
314 | pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { | ||
315 | let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; | ||
316 | let fd = fd as usize; | ||
317 | return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0 | ||
318 | } | ||
319 | |||
320 | pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { | ||
321 | let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; | ||
322 | let fd = fd as usize; | ||
323 | (*set).fds_bits[fd / bits] |= 1 << (fd % bits); | ||
324 | return | ||
325 | } | ||
326 | |||
327 | pub fn FD_ZERO(set: *mut fd_set) -> () { | ||
328 | for slot in (*set).fds_bits.iter_mut() { | ||
329 | *slot = 0; | ||
330 | } | ||
331 | } | ||
332 | |||
333 | pub fn WTERMSIG(status: ::c_int) -> ::c_int { | ||
334 | status & 0o177 | ||
335 | } | ||
336 | |||
337 | pub fn WIFEXITED(status: ::c_int) -> bool { | ||
338 | (status & 0o177) == 0 | ||
339 | } | ||
340 | |||
341 | pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { | ||
342 | status >> 8 | ||
343 | } | ||
344 | |||
345 | pub fn WCOREDUMP(status: ::c_int) -> bool { | ||
346 | (status & 0o200) != 0 | ||
347 | } | ||
348 | } | ||
349 | |||
350 | extern { | ||
351 | pub fn setgroups(ngroups: ::c_int, | ||
352 | ptr: *const ::gid_t) -> ::c_int; | ||
353 | pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; | ||
354 | pub fn kqueue() -> ::c_int; | ||
355 | pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int; | ||
356 | pub fn syscall(num: ::c_int, ...) -> ::c_int; | ||
357 | #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] | ||
358 | pub fn getpwnam_r(name: *const ::c_char, | ||
359 | pwd: *mut passwd, | ||
360 | buf: *mut ::c_char, | ||
361 | buflen: ::size_t, | ||
362 | result: *mut *mut passwd) -> ::c_int; | ||
363 | #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] | ||
364 | pub fn getpwuid_r(uid: ::uid_t, | ||
365 | pwd: *mut passwd, | ||
366 | buf: *mut ::c_char, | ||
367 | buflen: ::size_t, | ||
368 | result: *mut *mut passwd) -> ::c_int; | ||
369 | #[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")] | ||
370 | pub fn getpwent() -> *mut passwd; | ||
371 | pub fn setpwent(); | ||
372 | pub fn getprogname() -> *const ::c_char; | ||
373 | pub fn setprogname(name: *const ::c_char); | ||
374 | pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; | ||
375 | pub fn if_nameindex() -> *mut if_nameindex; | ||
376 | pub fn if_freenameindex(ptr: *mut if_nameindex); | ||
377 | } | ||
378 | |||
379 | cfg_if! { | ||
380 | if #[cfg(any(target_os = "macos", target_os = "ios"))] { | ||
381 | mod apple; | ||
382 | pub use self::apple::*; | ||
383 | } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd", | ||
384 | target_os = "bitrig"))] { | ||
385 | mod openbsdlike; | ||
386 | pub use self::openbsdlike::*; | ||
387 | } else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] { | ||
388 | mod freebsdlike; | ||
389 | pub use self::freebsdlike::*; | ||
390 | } else { | ||
391 | // Unknown target_os | ||
392 | } | ||
393 | } | ||
diff --git a/third_party/libc/src/unix/bsd/openbsdlike/bitrig.rs b/third_party/libc/src/unix/bsd/openbsdlike/bitrig.rs new file mode 100644 index 0000000..cb1eae8 --- /dev/null +++ b/third_party/libc/src/unix/bsd/openbsdlike/bitrig.rs | |||
@@ -0,0 +1,435 @@ | |||
1 | pub type clock_t = i64; | ||
2 | pub type suseconds_t = i64; | ||
3 | pub type dev_t = i32; | ||
4 | pub type sigset_t = ::c_uint; | ||
5 | pub type blksize_t = ::uint32_t; | ||
6 | pub type fsblkcnt_t = ::c_uint; | ||
7 | pub type fsfilcnt_t = ::c_uint; | ||
8 | pub type pthread_attr_t = *mut ::c_void; | ||
9 | pub type pthread_mutex_t = *mut ::c_void; | ||
10 | pub type pthread_mutexattr_t = *mut ::c_void; | ||
11 | pub type pthread_cond_t = *mut ::c_void; | ||
12 | pub type pthread_condattr_t = *mut ::c_void; | ||
13 | pub type pthread_rwlock_t = *mut ::c_void; | ||
14 | |||
15 | s! { | ||
16 | pub struct dirent { | ||
17 | pub d_fileno: ::ino_t, | ||
18 | pub d_off: ::off_t, | ||
19 | pub d_reclen: u16, | ||
20 | pub d_type: u8, | ||
21 | pub d_namlen: u8, | ||
22 | __d_padding: [u8; 4], | ||
23 | pub d_name: [::c_char; 256], | ||
24 | } | ||
25 | |||
26 | pub struct glob_t { | ||
27 | pub gl_pathc: ::c_int, | ||
28 | pub gl_matchc: ::c_int, | ||
29 | pub gl_offs: ::c_int, | ||
30 | pub gl_flags: ::c_int, | ||
31 | pub gl_pathv: *mut *mut ::c_char, | ||
32 | __unused1: *mut ::c_void, | ||
33 | __unused2: *mut ::c_void, | ||
34 | __unused3: *mut ::c_void, | ||
35 | __unused4: *mut ::c_void, | ||
36 | __unused5: *mut ::c_void, | ||
37 | __unused6: *mut ::c_void, | ||
38 | __unused7: *mut ::c_void, | ||
39 | } | ||
40 | |||
41 | pub struct stat { | ||
42 | pub st_mode: ::mode_t, | ||
43 | pub st_dev: ::dev_t, | ||
44 | pub st_ino: ::ino_t, | ||
45 | pub st_nlink: ::nlink_t, | ||
46 | pub st_uid: ::uid_t, | ||
47 | pub st_gid: ::gid_t, | ||
48 | pub st_rdev: ::dev_t, | ||
49 | pub st_atime: ::time_t, | ||
50 | pub st_atime_nsec: ::c_long, | ||
51 | pub st_mtime: ::time_t, | ||
52 | pub st_mtime_nsec: ::c_long, | ||
53 | pub st_ctime: ::time_t, | ||
54 | pub st_ctime_nsec: ::c_long, | ||
55 | pub st_size: ::off_t, | ||
56 | pub st_blocks: ::blkcnt_t, | ||
57 | pub st_blksize: ::blksize_t, | ||
58 | pub st_flags: ::uint32_t, | ||
59 | pub st_gen: ::uint32_t, | ||
60 | pub st_birthtime: ::time_t, | ||
61 | pub st_birthtime_nsec: ::c_long, | ||
62 | } | ||
63 | |||
64 | pub struct statvfs { | ||
65 | pub f_bsize: ::c_ulong, | ||
66 | pub f_frsize: ::c_ulong, | ||
67 | pub f_blocks: ::fsblkcnt_t, | ||
68 | pub f_bfree: ::fsblkcnt_t, | ||
69 | pub f_bavail: ::fsblkcnt_t, | ||
70 | pub f_files: ::fsfilcnt_t, | ||
71 | pub f_ffree: ::fsfilcnt_t, | ||
72 | pub f_favail: ::fsfilcnt_t, | ||
73 | pub f_fsid: ::c_ulong, | ||
74 | pub f_flag: ::c_ulong, | ||
75 | pub f_namemax: ::c_ulong, | ||
76 | } | ||
77 | |||
78 | pub struct addrinfo { | ||
79 | pub ai_flags: ::c_int, | ||
80 | pub ai_family: ::c_int, | ||
81 | pub ai_socktype: ::c_int, | ||
82 | pub ai_protocol: ::c_int, | ||
83 | pub ai_addrlen: ::socklen_t, | ||
84 | pub ai_addr: *mut ::sockaddr, | ||
85 | pub ai_canonname: *mut ::c_char, | ||
86 | pub ai_next: *mut ::addrinfo, | ||
87 | } | ||
88 | |||
89 | pub struct sockaddr_storage { | ||
90 | pub ss_len: u8, | ||
91 | pub ss_family: ::sa_family_t, | ||
92 | __ss_pad1: [u8; 6], | ||
93 | __ss_pad2: i64, | ||
94 | __ss_pad3: [u8; 240], | ||
95 | } | ||
96 | |||
97 | pub struct siginfo_t { | ||
98 | pub si_signo: ::c_int, | ||
99 | pub si_code: ::c_int, | ||
100 | pub si_errno: ::c_int, | ||
101 | pub si_addr: *mut ::c_void | ||
102 | } | ||
103 | |||
104 | pub struct Dl_info { | ||
105 | pub dli_fname: *const ::c_char, | ||
106 | pub dli_fbase: *mut ::c_void, | ||
107 | pub dli_sname: *const ::c_char, | ||
108 | pub dli_saddr: *mut ::c_void, | ||
109 | } | ||
110 | |||
111 | pub struct lconv { | ||
112 | pub decimal_point: *mut ::c_char, | ||
113 | pub thousands_sep: *mut ::c_char, | ||
114 | pub grouping: *mut ::c_char, | ||
115 | pub int_curr_symbol: *mut ::c_char, | ||
116 | pub currency_symbol: *mut ::c_char, | ||
117 | pub mon_decimal_point: *mut ::c_char, | ||
118 | pub mon_thousands_sep: *mut ::c_char, | ||
119 | pub mon_grouping: *mut ::c_char, | ||
120 | pub positive_sign: *mut ::c_char, | ||
121 | pub negative_sign: *mut ::c_char, | ||
122 | pub int_frac_digits: ::c_char, | ||
123 | pub frac_digits: ::c_char, | ||
124 | pub p_cs_precedes: ::c_char, | ||
125 | pub p_sep_by_space: ::c_char, | ||
126 | pub n_cs_precedes: ::c_char, | ||
127 | pub n_sep_by_space: ::c_char, | ||
128 | pub p_sign_posn: ::c_char, | ||
129 | pub n_sign_posn: ::c_char, | ||
130 | pub int_p_cs_precedes: ::c_char, | ||
131 | pub int_n_cs_precedes: ::c_char, | ||
132 | pub int_p_sep_by_space: ::c_char, | ||
133 | pub int_n_sep_by_space: ::c_char, | ||
134 | pub int_p_sign_posn: ::c_char, | ||
135 | pub int_n_sign_posn: ::c_char, | ||
136 | } | ||
137 | } | ||
138 | |||
139 | pub const LC_COLLATE_MASK: ::c_int = (1 << 0); | ||
140 | pub const LC_CTYPE_MASK: ::c_int = (1 << 1); | ||
141 | pub const LC_MESSAGES_MASK: ::c_int = (1 << 2); | ||
142 | pub const LC_MONETARY_MASK: ::c_int = (1 << 3); | ||
143 | pub const LC_NUMERIC_MASK: ::c_int = (1 << 4); | ||
144 | pub const LC_TIME_MASK: ::c_int = (1 << 5); | ||
145 | pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK | ||
146 | | LC_CTYPE_MASK | ||
147 | | LC_MESSAGES_MASK | ||
148 | | LC_MONETARY_MASK | ||
149 | | LC_NUMERIC_MASK | ||
150 | | LC_TIME_MASK; | ||
151 | |||
152 | pub const ERA: ::nl_item = 52; | ||
153 | pub const ERA_D_FMT: ::nl_item = 53; | ||
154 | pub const ERA_D_T_FMT: ::nl_item = 54; | ||
155 | pub const ERA_T_FMT: ::nl_item = 55; | ||
156 | pub const ALT_DIGITS: ::nl_item = 56; | ||
157 | |||
158 | pub const D_MD_ORDER: ::nl_item = 57; | ||
159 | |||
160 | pub const ALTMON_1: ::nl_item = 58; | ||
161 | pub const ALTMON_2: ::nl_item = 59; | ||
162 | pub const ALTMON_3: ::nl_item = 60; | ||
163 | pub const ALTMON_4: ::nl_item = 61; | ||
164 | pub const ALTMON_5: ::nl_item = 62; | ||
165 | pub const ALTMON_6: ::nl_item = 63; | ||
166 | pub const ALTMON_7: ::nl_item = 64; | ||
167 | pub const ALTMON_8: ::nl_item = 65; | ||
168 | pub const ALTMON_9: ::nl_item = 66; | ||
169 | pub const ALTMON_10: ::nl_item = 67; | ||
170 | pub const ALTMON_11: ::nl_item = 68; | ||
171 | pub const ALTMON_12: ::nl_item = 69; | ||
172 | |||
173 | pub const O_CLOEXEC: ::c_int = 0x10000; | ||
174 | |||
175 | pub const MS_SYNC : ::c_int = 0x0002; | ||
176 | pub const MS_INVALIDATE : ::c_int = 0x0004; | ||
177 | |||
178 | pub const PTHREAD_STACK_MIN : ::size_t = 2048; | ||
179 | |||
180 | pub const ENOATTR : ::c_int = 83; | ||
181 | pub const EILSEQ : ::c_int = 84; | ||
182 | pub const EOVERFLOW : ::c_int = 87; | ||
183 | pub const ECANCELED : ::c_int = 88; | ||
184 | pub const EIDRM : ::c_int = 89; | ||
185 | pub const ENOMSG : ::c_int = 90; | ||
186 | pub const ENOTSUP : ::c_int = 91; | ||
187 | pub const ELAST : ::c_int = 91; | ||
188 | |||
189 | pub const F_DUPFD_CLOEXEC : ::c_int = 10; | ||
190 | |||
191 | pub const RLIM_NLIMITS: ::c_int = 9; | ||
192 | |||
193 | pub const SO_SNDTIMEO: ::c_int = 0x1005; | ||
194 | pub const SO_RCVTIMEO: ::c_int = 0x1006; | ||
195 | |||
196 | pub const O_DSYNC : ::c_int = 128; | ||
197 | |||
198 | pub const MAP_RENAME : ::c_int = 0x0000; | ||
199 | pub const MAP_NORESERVE : ::c_int = 0x0000; | ||
200 | pub const MAP_HASSEMAPHORE : ::c_int = 0x0000; | ||
201 | |||
202 | pub const EIPSEC : ::c_int = 82; | ||
203 | pub const ENOMEDIUM : ::c_int = 85; | ||
204 | pub const EMEDIUMTYPE : ::c_int = 86; | ||
205 | |||
206 | pub const RUSAGE_THREAD: ::c_int = 1; | ||
207 | |||
208 | pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12; | ||
209 | pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13; | ||
210 | |||
211 | pub const MAP_COPY : ::c_int = 0x0002; | ||
212 | pub const MAP_NOEXTEND : ::c_int = 0x0000; | ||
213 | |||
214 | pub const _SC_IOV_MAX : ::c_int = 51; | ||
215 | pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100; | ||
216 | pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101; | ||
217 | pub const _SC_LOGIN_NAME_MAX : ::c_int = 102; | ||
218 | pub const _SC_MQ_PRIO_MAX : ::c_int = 59; | ||
219 | pub const _SC_NPROCESSORS_ONLN : ::c_int = 503; | ||
220 | pub const _SC_THREADS : ::c_int = 91; | ||
221 | pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77; | ||
222 | pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78; | ||
223 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80; | ||
224 | pub const _SC_THREAD_KEYS_MAX : ::c_int = 81; | ||
225 | pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82; | ||
226 | pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83; | ||
227 | pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84; | ||
228 | pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85; | ||
229 | pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103; | ||
230 | pub const _SC_THREAD_STACK_MIN : ::c_int = 89; | ||
231 | pub const _SC_THREAD_THREADS_MAX : ::c_int = 90; | ||
232 | pub const _SC_TTY_NAME_MAX : ::c_int = 107; | ||
233 | pub const _SC_ATEXIT_MAX : ::c_int = 46; | ||
234 | pub const _SC_CLK_TCK : ::c_int = 3; | ||
235 | pub const _SC_AIO_LISTIO_MAX : ::c_int = 42; | ||
236 | pub const _SC_AIO_MAX : ::c_int = 43; | ||
237 | pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45; | ||
238 | pub const _SC_MAPPED_FILES : ::c_int = 53; | ||
239 | pub const _SC_MEMLOCK : ::c_int = 54; | ||
240 | pub const _SC_MEMLOCK_RANGE : ::c_int = 55; | ||
241 | pub const _SC_MEMORY_PROTECTION : ::c_int = 56; | ||
242 | pub const _SC_MESSAGE_PASSING : ::c_int = 57; | ||
243 | pub const _SC_MQ_OPEN_MAX : ::c_int = 58; | ||
244 | pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61; | ||
245 | pub const _SC_SEMAPHORES : ::c_int = 67; | ||
246 | pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68; | ||
247 | pub const _SC_SYNCHRONIZED_IO : ::c_int = 75; | ||
248 | pub const _SC_TIMERS : ::c_int = 94; | ||
249 | pub const _SC_XOPEN_CRYPT : ::c_int = 117; | ||
250 | pub const _SC_XOPEN_ENH_I18N : ::c_int = 118; | ||
251 | pub const _SC_XOPEN_LEGACY : ::c_int = 119; | ||
252 | pub const _SC_XOPEN_REALTIME : ::c_int = 120; | ||
253 | pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121; | ||
254 | pub const _SC_XOPEN_UNIX : ::c_int = 123; | ||
255 | pub const _SC_XOPEN_VERSION : ::c_int = 125; | ||
256 | pub const _SC_SEM_NSEMS_MAX : ::c_int = 31; | ||
257 | pub const _SC_SEM_VALUE_MAX : ::c_int = 32; | ||
258 | pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44; | ||
259 | pub const _SC_DELAYTIMER_MAX : ::c_int = 50; | ||
260 | pub const _SC_PRIORITIZED_IO : ::c_int = 60; | ||
261 | pub const _SC_REALTIME_SIGNALS : ::c_int = 64; | ||
262 | pub const _SC_RTSIG_MAX : ::c_int = 66; | ||
263 | pub const _SC_SIGQUEUE_MAX : ::c_int = 70; | ||
264 | pub const _SC_TIMER_MAX : ::c_int = 93; | ||
265 | pub const _SC_HOST_NAME_MAX: ::c_int = 33; | ||
266 | |||
267 | pub const FD_SETSIZE: usize = 1024; | ||
268 | |||
269 | pub const ST_NOSUID: ::c_ulong = 2; | ||
270 | |||
271 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _; | ||
272 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _; | ||
273 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _; | ||
274 | |||
275 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1; | ||
276 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; | ||
277 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3; | ||
278 | pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4; | ||
279 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP; | ||
280 | |||
281 | pub const TMP_MAX : ::c_uint = 0x7fffffff; | ||
282 | |||
283 | pub const NI_MAXHOST: ::size_t = 256; | ||
284 | |||
285 | pub const CTL_MAXNAME: ::c_int = 12; | ||
286 | pub const CTLTYPE_NODE: ::c_int = 1; | ||
287 | pub const CTLTYPE_INT: ::c_int = 2; | ||
288 | pub const CTLTYPE_STRING: ::c_int = 3; | ||
289 | pub const CTLTYPE_QUAD: ::c_int = 4; | ||
290 | pub const CTLTYPE_STRUCT: ::c_int = 5; | ||
291 | pub const CTL_UNSPEC: ::c_int = 0; | ||
292 | pub const CTL_KERN: ::c_int = 1; | ||
293 | pub const CTL_VM: ::c_int = 2; | ||
294 | pub const CTL_FS: ::c_int = 3; | ||
295 | pub const CTL_NET: ::c_int = 4; | ||
296 | pub const CTL_DEBUG: ::c_int = 5; | ||
297 | pub const CTL_HW: ::c_int = 6; | ||
298 | pub const CTL_MACHDEP: ::c_int = 7; | ||
299 | pub const CTL_DDB: ::c_int = 9; | ||
300 | pub const CTL_VFS: ::c_int = 10; | ||
301 | pub const CTL_MAXID: ::c_int = 11; | ||
302 | pub const KERN_OSTYPE: ::c_int = 1; | ||
303 | pub const KERN_OSRELEASE: ::c_int = 2; | ||
304 | pub const KERN_OSREV: ::c_int = 3; | ||
305 | pub const KERN_VERSION: ::c_int = 4; | ||
306 | pub const KERN_MAXVNODES: ::c_int = 5; | ||
307 | pub const KERN_MAXPROC: ::c_int = 6; | ||
308 | pub const KERN_MAXFILES: ::c_int = 7; | ||
309 | pub const KERN_ARGMAX: ::c_int = 8; | ||
310 | pub const KERN_SECURELVL: ::c_int = 9; | ||
311 | pub const KERN_HOSTNAME: ::c_int = 10; | ||
312 | pub const KERN_HOSTID: ::c_int = 11; | ||
313 | pub const KERN_CLOCKRATE: ::c_int = 12; | ||
314 | pub const KERN_PROF: ::c_int = 16; | ||
315 | pub const KERN_POSIX1: ::c_int = 17; | ||
316 | pub const KERN_NGROUPS: ::c_int = 18; | ||
317 | pub const KERN_JOB_CONTROL: ::c_int = 19; | ||
318 | pub const KERN_SAVED_IDS: ::c_int = 20; | ||
319 | pub const KERN_BOOTTIME: ::c_int = 21; | ||
320 | pub const KERN_DOMAINNAME: ::c_int = 22; | ||
321 | pub const KERN_MAXPARTITIONS: ::c_int = 23; | ||
322 | pub const KERN_RAWPARTITION: ::c_int = 24; | ||
323 | pub const KERN_MAXTHREAD: ::c_int = 25; | ||
324 | pub const KERN_NTHREADS: ::c_int = 26; | ||
325 | pub const KERN_OSVERSION: ::c_int = 27; | ||
326 | pub const KERN_SOMAXCONN: ::c_int = 28; | ||
327 | pub const KERN_SOMINCONN: ::c_int = 29; | ||
328 | pub const KERN_USERMOUNT: ::c_int = 30; | ||
329 | pub const KERN_RND: ::c_int = 31; | ||
330 | pub const KERN_NOSUIDCOREDUMP: ::c_int = 32; | ||
331 | pub const KERN_FSYNC: ::c_int = 33; | ||
332 | pub const KERN_SYSVMSG: ::c_int = 34; | ||
333 | pub const KERN_SYSVSEM: ::c_int = 35; | ||
334 | pub const KERN_SYSVSHM: ::c_int = 36; | ||
335 | pub const KERN_ARND: ::c_int = 37; | ||
336 | pub const KERN_MSGBUFSIZE: ::c_int = 38; | ||
337 | pub const KERN_MALLOCSTATS: ::c_int = 39; | ||
338 | pub const KERN_CPTIME: ::c_int = 40; | ||
339 | pub const KERN_NCHSTATS: ::c_int = 41; | ||
340 | pub const KERN_FORKSTAT: ::c_int = 42; | ||
341 | pub const KERN_NSELCOLL: ::c_int = 43; | ||
342 | pub const KERN_TTY: ::c_int = 44; | ||
343 | pub const KERN_CCPU: ::c_int = 45; | ||
344 | pub const KERN_FSCALE: ::c_int = 46; | ||
345 | pub const KERN_NPROCS: ::c_int = 47; | ||
346 | pub const KERN_MSGBUF: ::c_int = 48; | ||
347 | pub const KERN_POOL: ::c_int = 49; | ||
348 | pub const KERN_STACKGAPRANDOM: ::c_int = 50; | ||
349 | pub const KERN_SYSVIPC_INFO: ::c_int = 51; | ||
350 | pub const KERN_SPLASSERT: ::c_int = 54; | ||
351 | pub const KERN_PROC_ARGS: ::c_int = 55; | ||
352 | pub const KERN_NFILES: ::c_int = 56; | ||
353 | pub const KERN_TTYCOUNT: ::c_int = 57; | ||
354 | pub const KERN_NUMVNODES: ::c_int = 58; | ||
355 | pub const KERN_MBSTAT: ::c_int = 59; | ||
356 | pub const KERN_SEMINFO: ::c_int = 61; | ||
357 | pub const KERN_SHMINFO: ::c_int = 62; | ||
358 | pub const KERN_INTRCNT: ::c_int = 63; | ||
359 | pub const KERN_WATCHDOG: ::c_int = 64; | ||
360 | pub const KERN_PROC: ::c_int = 66; | ||
361 | pub const KERN_MAXCLUSTERS: ::c_int = 67; | ||
362 | pub const KERN_EVCOUNT: ::c_int = 68; | ||
363 | pub const KERN_TIMECOUNTER: ::c_int = 69; | ||
364 | pub const KERN_MAXLOCKSPERUID: ::c_int = 70; | ||
365 | pub const KERN_CPTIME2: ::c_int = 71; | ||
366 | pub const KERN_CACHEPCT: ::c_int = 72; | ||
367 | pub const KERN_FILE: ::c_int = 73; | ||
368 | pub const KERN_CONSDEV: ::c_int = 75; | ||
369 | pub const KERN_NETLIVELOCKS: ::c_int = 76; | ||
370 | pub const KERN_POOL_DEBUG: ::c_int = 77; | ||
371 | pub const KERN_PROC_CWD: ::c_int = 78; | ||
372 | pub const KERN_PROC_NOBROADCASTKILL: ::c_int = 79; | ||
373 | pub const KERN_PROC_VMMAP: ::c_int = 80; | ||
374 | pub const KERN_GLOBAL_PTRACE: ::c_int = 81; | ||
375 | pub const KERN_CONSBUFSIZE: ::c_int = 82; | ||
376 | pub const KERN_CONSBUF: ::c_int = 83; | ||
377 | pub const KERN_MAXID: ::c_int = 84; | ||
378 | pub const KERN_PROC_ALL: ::c_int = 0; | ||
379 | pub const KERN_PROC_PID: ::c_int = 1; | ||
380 | pub const KERN_PROC_PGRP: ::c_int = 2; | ||
381 | pub const KERN_PROC_SESSION: ::c_int = 3; | ||
382 | pub const KERN_PROC_TTY: ::c_int = 4; | ||
383 | pub const KERN_PROC_UID: ::c_int = 5; | ||
384 | pub const KERN_PROC_RUID: ::c_int = 6; | ||
385 | pub const KERN_PROC_KTHREAD: ::c_int = 7; | ||
386 | pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000; | ||
387 | pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1; | ||
388 | pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2; | ||
389 | pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3; | ||
390 | pub const KERN_PROC_ARGV: ::c_int = 1; | ||
391 | pub const KERN_PROC_NARGV: ::c_int = 2; | ||
392 | pub const KERN_PROC_ENV: ::c_int = 3; | ||
393 | pub const KERN_PROC_NENV: ::c_int = 4; | ||
394 | pub const KI_NGROUPS: ::c_int = 16; | ||
395 | pub const KI_MAXCOMLEN: ::c_int = 24; | ||
396 | pub const KI_WMESGLEN: ::c_int = 8; | ||
397 | pub const KI_MAXLOGNAME: ::c_int = 32; | ||
398 | pub const KI_EMULNAMELEN: ::c_int = 8; | ||
399 | |||
400 | extern { | ||
401 | pub fn getnameinfo(sa: *const ::sockaddr, | ||
402 | salen: ::socklen_t, | ||
403 | host: *mut ::c_char, | ||
404 | hostlen: ::size_t, | ||
405 | serv: *mut ::c_char, | ||
406 | servlen: ::size_t, | ||
407 | flags: ::c_int) -> ::c_int; | ||
408 | pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) | ||
409 | -> ::c_int; | ||
410 | pub fn pthread_main_np() -> ::c_int; | ||
411 | pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); | ||
412 | pub fn pthread_stackseg_np(thread: ::pthread_t, | ||
413 | sinfo: *mut ::stack_t) -> ::c_int; | ||
414 | pub fn sysctl(name: *mut ::c_int, | ||
415 | namelen: ::c_uint, | ||
416 | oldp: *mut ::c_void, | ||
417 | oldlenp: *mut ::size_t, | ||
418 | newp: *mut ::c_void, | ||
419 | newlen: ::size_t) | ||
420 | -> ::c_int; | ||
421 | pub fn sysctlbyname(name: *const ::c_char, | ||
422 | oldp: *mut ::c_void, | ||
423 | oldlenp: *mut ::size_t, | ||
424 | newp: *mut ::c_void, | ||
425 | newlen: ::size_t) | ||
426 | -> ::c_int; | ||
427 | pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; | ||
428 | pub fn duplocale(base: ::locale_t) -> ::locale_t; | ||
429 | pub fn freelocale(loc: ::locale_t) -> ::c_int; | ||
430 | pub fn newlocale(mask: ::c_int, | ||
431 | locale: *const ::c_char, | ||
432 | base: ::locale_t) -> ::locale_t; | ||
433 | pub fn uselocale(loc: ::locale_t) -> ::locale_t; | ||
434 | pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char; | ||
435 | } | ||
diff --git a/third_party/libc/src/unix/bsd/openbsdlike/mod.rs b/third_party/libc/src/unix/bsd/openbsdlike/mod.rs new file mode 100644 index 0000000..e81640f --- /dev/null +++ b/third_party/libc/src/unix/bsd/openbsdlike/mod.rs | |||
@@ -0,0 +1,545 @@ | |||
1 | pub type c_long = i64; | ||
2 | pub type c_ulong = u64; | ||
3 | pub type time_t = i64; | ||
4 | pub type mode_t = u32; | ||
5 | pub type nlink_t = ::uint32_t; | ||
6 | pub type ino_t = ::uint64_t; | ||
7 | pub type pthread_key_t = ::c_int; | ||
8 | pub type rlim_t = u64; | ||
9 | pub type speed_t = ::c_uint; | ||
10 | pub type tcflag_t = ::c_uint; | ||
11 | pub type nl_item = c_long; | ||
12 | pub type clockid_t = ::c_int; | ||
13 | pub type id_t = ::uint32_t; | ||
14 | pub type sem_t = *mut sem; | ||
15 | |||
16 | pub enum timezone {} | ||
17 | pub enum sem {} | ||
18 | |||
19 | s! { | ||
20 | pub struct sigaction { | ||
21 | pub sa_sigaction: ::sighandler_t, | ||
22 | pub sa_mask: ::sigset_t, | ||
23 | pub sa_flags: ::c_int, | ||
24 | } | ||
25 | |||
26 | pub struct stack_t { | ||
27 | pub ss_sp: *mut ::c_void, | ||
28 | pub ss_size: ::size_t, | ||
29 | pub ss_flags: ::c_int, | ||
30 | } | ||
31 | |||
32 | pub struct sockaddr_in { | ||
33 | pub sin_len: u8, | ||
34 | pub sin_family: ::sa_family_t, | ||
35 | pub sin_port: ::in_port_t, | ||
36 | pub sin_addr: ::in_addr, | ||
37 | pub sin_zero: [::int8_t; 8], | ||
38 | } | ||
39 | |||
40 | pub struct termios { | ||
41 | pub c_iflag: ::tcflag_t, | ||
42 | pub c_oflag: ::tcflag_t, | ||
43 | pub c_cflag: ::tcflag_t, | ||
44 | pub c_lflag: ::tcflag_t, | ||
45 | pub c_cc: [::cc_t; ::NCCS], | ||
46 | pub c_ispeed: ::c_int, | ||
47 | pub c_ospeed: ::c_int, | ||
48 | } | ||
49 | |||
50 | pub struct flock { | ||
51 | pub l_start: ::off_t, | ||
52 | pub l_len: ::off_t, | ||
53 | pub l_pid: ::pid_t, | ||
54 | pub l_type: ::c_short, | ||
55 | pub l_whence: ::c_short, | ||
56 | } | ||
57 | } | ||
58 | |||
59 | pub const D_T_FMT: ::nl_item = 0; | ||
60 | pub const D_FMT: ::nl_item = 1; | ||
61 | pub const T_FMT: ::nl_item = 2; | ||
62 | pub const T_FMT_AMPM: ::nl_item = 3; | ||
63 | pub const AM_STR: ::nl_item = 4; | ||
64 | pub const PM_STR: ::nl_item = 5; | ||
65 | |||
66 | pub const DAY_1: ::nl_item = 6; | ||
67 | pub const DAY_2: ::nl_item = 7; | ||
68 | pub const DAY_3: ::nl_item = 8; | ||
69 | pub const DAY_4: ::nl_item = 9; | ||
70 | pub const DAY_5: ::nl_item = 10; | ||
71 | pub const DAY_6: ::nl_item = 11; | ||
72 | pub const DAY_7: ::nl_item = 12; | ||
73 | |||
74 | pub const ABDAY_1: ::nl_item = 13; | ||
75 | pub const ABDAY_2: ::nl_item = 14; | ||
76 | pub const ABDAY_3: ::nl_item = 15; | ||
77 | pub const ABDAY_4: ::nl_item = 16; | ||
78 | pub const ABDAY_5: ::nl_item = 17; | ||
79 | pub const ABDAY_6: ::nl_item = 18; | ||
80 | pub const ABDAY_7: ::nl_item = 19; | ||
81 | |||
82 | pub const MON_1: ::nl_item = 20; | ||
83 | pub const MON_2: ::nl_item = 21; | ||
84 | pub const MON_3: ::nl_item = 22; | ||
85 | pub const MON_4: ::nl_item = 23; | ||
86 | pub const MON_5: ::nl_item = 24; | ||
87 | pub const MON_6: ::nl_item = 25; | ||
88 | pub const MON_7: ::nl_item = 26; | ||
89 | pub const MON_8: ::nl_item = 27; | ||
90 | pub const MON_9: ::nl_item = 28; | ||
91 | pub const MON_10: ::nl_item = 29; | ||
92 | pub const MON_11: ::nl_item = 30; | ||
93 | pub const MON_12: ::nl_item = 31; | ||
94 | |||
95 | pub const ABMON_1: ::nl_item = 32; | ||
96 | pub const ABMON_2: ::nl_item = 33; | ||
97 | pub const ABMON_3: ::nl_item = 34; | ||
98 | pub const ABMON_4: ::nl_item = 35; | ||
99 | pub const ABMON_5: ::nl_item = 36; | ||
100 | pub const ABMON_6: ::nl_item = 37; | ||
101 | pub const ABMON_7: ::nl_item = 38; | ||
102 | pub const ABMON_8: ::nl_item = 39; | ||
103 | pub const ABMON_9: ::nl_item = 40; | ||
104 | pub const ABMON_10: ::nl_item = 41; | ||
105 | pub const ABMON_11: ::nl_item = 42; | ||
106 | pub const ABMON_12: ::nl_item = 43; | ||
107 | |||
108 | pub const RADIXCHAR: ::nl_item = 44; | ||
109 | pub const THOUSEP: ::nl_item = 45; | ||
110 | pub const YESSTR: ::nl_item = 46; | ||
111 | pub const YESEXPR: ::nl_item = 47; | ||
112 | pub const NOSTR: ::nl_item = 48; | ||
113 | pub const NOEXPR: ::nl_item = 49; | ||
114 | pub const CRNCYSTR: ::nl_item = 50; | ||
115 | |||
116 | pub const CODESET: ::nl_item = 51; | ||
117 | |||
118 | pub const EXIT_FAILURE : ::c_int = 1; | ||
119 | pub const EXIT_SUCCESS : ::c_int = 0; | ||
120 | pub const RAND_MAX : ::c_int = 2147483647; | ||
121 | pub const EOF : ::c_int = -1; | ||
122 | pub const SEEK_SET : ::c_int = 0; | ||
123 | pub const SEEK_CUR : ::c_int = 1; | ||
124 | pub const SEEK_END : ::c_int = 2; | ||
125 | pub const _IOFBF : ::c_int = 0; | ||
126 | pub const _IONBF : ::c_int = 2; | ||
127 | pub const _IOLBF : ::c_int = 1; | ||
128 | pub const BUFSIZ : ::c_uint = 1024; | ||
129 | pub const FOPEN_MAX : ::c_uint = 20; | ||
130 | pub const FILENAME_MAX : ::c_uint = 1024; | ||
131 | pub const L_tmpnam : ::c_uint = 1024; | ||
132 | pub const O_RDONLY : ::c_int = 0; | ||
133 | pub const O_WRONLY : ::c_int = 1; | ||
134 | pub const O_RDWR : ::c_int = 2; | ||
135 | pub const O_ACCMODE : ::c_int = 3; | ||
136 | pub const O_APPEND : ::c_int = 8; | ||
137 | pub const O_CREAT : ::c_int = 512; | ||
138 | pub const O_EXCL : ::c_int = 2048; | ||
139 | pub const O_NOCTTY : ::c_int = 32768; | ||
140 | pub const O_TRUNC : ::c_int = 1024; | ||
141 | pub const O_SYNC : ::c_int = 128; | ||
142 | pub const S_IFIFO : mode_t = 4096; | ||
143 | pub const S_IFCHR : mode_t = 8192; | ||
144 | pub const S_IFBLK : mode_t = 24576; | ||
145 | pub const S_IFDIR : mode_t = 16384; | ||
146 | pub const S_IFREG : mode_t = 32768; | ||
147 | pub const S_IFLNK : mode_t = 40960; | ||
148 | pub const S_IFSOCK : mode_t = 49152; | ||
149 | pub const S_IFMT : mode_t = 61440; | ||
150 | pub const S_IEXEC : mode_t = 64; | ||
151 | pub const S_IWRITE : mode_t = 128; | ||
152 | pub const S_IREAD : mode_t = 256; | ||
153 | pub const S_IRWXU : mode_t = 448; | ||
154 | pub const S_IXUSR : mode_t = 64; | ||
155 | pub const S_IWUSR : mode_t = 128; | ||
156 | pub const S_IRUSR : mode_t = 256; | ||
157 | pub const S_IRWXG : mode_t = 56; | ||
158 | pub const S_IXGRP : mode_t = 8; | ||
159 | pub const S_IWGRP : mode_t = 16; | ||
160 | pub const S_IRGRP : mode_t = 32; | ||
161 | pub const S_IRWXO : mode_t = 7; | ||
162 | pub const S_IXOTH : mode_t = 1; | ||
163 | pub const S_IWOTH : mode_t = 2; | ||
164 | pub const S_IROTH : mode_t = 4; | ||
165 | pub const F_OK : ::c_int = 0; | ||
166 | pub const R_OK : ::c_int = 4; | ||
167 | pub const W_OK : ::c_int = 2; | ||
168 | pub const X_OK : ::c_int = 1; | ||
169 | pub const STDIN_FILENO : ::c_int = 0; | ||
170 | pub const STDOUT_FILENO : ::c_int = 1; | ||
171 | pub const STDERR_FILENO : ::c_int = 2; | ||
172 | pub const F_LOCK : ::c_int = 1; | ||
173 | pub const F_TEST : ::c_int = 3; | ||
174 | pub const F_TLOCK : ::c_int = 2; | ||
175 | pub const F_ULOCK : ::c_int = 0; | ||
176 | pub const F_GETLK: ::c_int = 7; | ||
177 | pub const F_SETLK: ::c_int = 8; | ||
178 | pub const F_SETLKW: ::c_int = 9; | ||
179 | pub const SIGHUP : ::c_int = 1; | ||
180 | pub const SIGINT : ::c_int = 2; | ||
181 | pub const SIGQUIT : ::c_int = 3; | ||
182 | pub const SIGILL : ::c_int = 4; | ||
183 | pub const SIGABRT : ::c_int = 6; | ||
184 | pub const SIGEMT: ::c_int = 7; | ||
185 | pub const SIGFPE : ::c_int = 8; | ||
186 | pub const SIGKILL : ::c_int = 9; | ||
187 | pub const SIGSEGV : ::c_int = 11; | ||
188 | pub const SIGPIPE : ::c_int = 13; | ||
189 | pub const SIGALRM : ::c_int = 14; | ||
190 | pub const SIGTERM : ::c_int = 15; | ||
191 | pub const SIGSTKSZ : ::size_t = 40960; | ||
192 | |||
193 | pub const PROT_NONE : ::c_int = 0; | ||
194 | pub const PROT_READ : ::c_int = 1; | ||
195 | pub const PROT_WRITE : ::c_int = 2; | ||
196 | pub const PROT_EXEC : ::c_int = 4; | ||
197 | |||
198 | pub const MAP_FILE : ::c_int = 0x0000; | ||
199 | pub const MAP_SHARED : ::c_int = 0x0001; | ||
200 | pub const MAP_PRIVATE : ::c_int = 0x0002; | ||
201 | pub const MAP_FIXED : ::c_int = 0x0010; | ||
202 | pub const MAP_ANON : ::c_int = 0x1000; | ||
203 | |||
204 | pub const MAP_FAILED : *mut ::c_void = !0 as *mut ::c_void; | ||
205 | |||
206 | pub const MCL_CURRENT : ::c_int = 0x0001; | ||
207 | pub const MCL_FUTURE : ::c_int = 0x0002; | ||
208 | |||
209 | pub const MS_ASYNC : ::c_int = 0x0001; | ||
210 | |||
211 | pub const EPERM : ::c_int = 1; | ||
212 | pub const ENOENT : ::c_int = 2; | ||
213 | pub const ESRCH : ::c_int = 3; | ||
214 | pub const EINTR : ::c_int = 4; | ||
215 | pub const EIO : ::c_int = 5; | ||
216 | pub const ENXIO : ::c_int = 6; | ||
217 | pub const E2BIG : ::c_int = 7; | ||
218 | pub const ENOEXEC : ::c_int = 8; | ||
219 | pub const EBADF : ::c_int = 9; | ||
220 | pub const ECHILD : ::c_int = 10; | ||
221 | pub const EDEADLK : ::c_int = 11; | ||
222 | pub const ENOMEM : ::c_int = 12; | ||
223 | pub const EACCES : ::c_int = 13; | ||
224 | pub const EFAULT : ::c_int = 14; | ||
225 | pub const ENOTBLK : ::c_int = 15; | ||
226 | pub const EBUSY : ::c_int = 16; | ||
227 | pub const EEXIST : ::c_int = 17; | ||
228 | pub const EXDEV : ::c_int = 18; | ||
229 | pub const ENODEV : ::c_int = 19; | ||
230 | pub const ENOTDIR : ::c_int = 20; | ||
231 | pub const EISDIR : ::c_int = 21; | ||
232 | pub const EINVAL : ::c_int = 22; | ||
233 | pub const ENFILE : ::c_int = 23; | ||
234 | pub const EMFILE : ::c_int = 24; | ||
235 | pub const ENOTTY : ::c_int = 25; | ||
236 | pub const ETXTBSY : ::c_int = 26; | ||
237 | pub const EFBIG : ::c_int = 27; | ||
238 | pub const ENOSPC : ::c_int = 28; | ||
239 | pub const ESPIPE : ::c_int = 29; | ||
240 | pub const EROFS : ::c_int = 30; | ||
241 | pub const EMLINK : ::c_int = 31; | ||
242 | pub const EPIPE : ::c_int = 32; | ||
243 | pub const EDOM : ::c_int = 33; | ||
244 | pub const ERANGE : ::c_int = 34; | ||
245 | pub const EAGAIN : ::c_int = 35; | ||
246 | pub const EWOULDBLOCK : ::c_int = 35; | ||
247 | pub const EINPROGRESS : ::c_int = 36; | ||
248 | pub const EALREADY : ::c_int = 37; | ||
249 | pub const ENOTSOCK : ::c_int = 38; | ||
250 | pub const EDESTADDRREQ : ::c_int = 39; | ||
251 | pub const EMSGSIZE : ::c_int = 40; | ||
252 | pub const EPROTOTYPE : ::c_int = 41; | ||
253 | pub const ENOPROTOOPT : ::c_int = 42; | ||
254 | pub const EPROTONOSUPPORT : ::c_int = 43; | ||
255 | pub const ESOCKTNOSUPPORT : ::c_int = 44; | ||
256 | pub const EOPNOTSUPP : ::c_int = 45; | ||
257 | pub const EPFNOSUPPORT : ::c_int = 46; | ||
258 | pub const EAFNOSUPPORT : ::c_int = 47; | ||
259 | pub const EADDRINUSE : ::c_int = 48; | ||
260 | pub const EADDRNOTAVAIL : ::c_int = 49; | ||
261 | pub const ENETDOWN : ::c_int = 50; | ||
262 | pub const ENETUNREACH : ::c_int = 51; | ||
263 | pub const ENETRESET : ::c_int = 52; | ||
264 | pub const ECONNABORTED : ::c_int = 53; | ||
265 | pub const ECONNRESET : ::c_int = 54; | ||
266 | pub const ENOBUFS : ::c_int = 55; | ||
267 | pub const EISCONN : ::c_int = 56; | ||
268 | pub const ENOTCONN : ::c_int = 57; | ||
269 | pub const ESHUTDOWN : ::c_int = 58; | ||
270 | pub const ETOOMANYREFS : ::c_int = 59; | ||
271 | pub const ETIMEDOUT : ::c_int = 60; | ||
272 | pub const ECONNREFUSED : ::c_int = 61; | ||
273 | pub const ELOOP : ::c_int = 62; | ||
274 | pub const ENAMETOOLONG : ::c_int = 63; | ||
275 | pub const EHOSTDOWN : ::c_int = 64; | ||
276 | pub const EHOSTUNREACH : ::c_int = 65; | ||
277 | pub const ENOTEMPTY : ::c_int = 66; | ||
278 | pub const EPROCLIM : ::c_int = 67; | ||
279 | pub const EUSERS : ::c_int = 68; | ||
280 | pub const EDQUOT : ::c_int = 69; | ||
281 | pub const ESTALE : ::c_int = 70; | ||
282 | pub const EREMOTE : ::c_int = 71; | ||
283 | pub const EBADRPC : ::c_int = 72; | ||
284 | pub const ERPCMISMATCH : ::c_int = 73; | ||
285 | pub const EPROGUNAVAIL : ::c_int = 74; | ||
286 | pub const EPROGMISMATCH : ::c_int = 75; | ||
287 | pub const EPROCUNAVAIL : ::c_int = 76; | ||
288 | pub const ENOLCK : ::c_int = 77; | ||
289 | pub const ENOSYS : ::c_int = 78; | ||
290 | pub const EFTYPE : ::c_int = 79; | ||
291 | pub const EAUTH : ::c_int = 80; | ||
292 | pub const ENEEDAUTH : ::c_int = 81; | ||
293 | |||
294 | pub const F_DUPFD : ::c_int = 0; | ||
295 | pub const F_GETFD : ::c_int = 1; | ||
296 | pub const F_SETFD : ::c_int = 2; | ||
297 | pub const F_GETFL : ::c_int = 3; | ||
298 | pub const F_SETFL : ::c_int = 4; | ||
299 | |||
300 | pub const SIGTRAP : ::c_int = 5; | ||
301 | |||
302 | pub const GLOB_APPEND : ::c_int = 0x0001; | ||
303 | pub const GLOB_DOOFFS : ::c_int = 0x0002; | ||
304 | pub const GLOB_ERR : ::c_int = 0x0004; | ||
305 | pub const GLOB_MARK : ::c_int = 0x0008; | ||
306 | pub const GLOB_NOCHECK : ::c_int = 0x0010; | ||
307 | pub const GLOB_NOSORT : ::c_int = 0x0020; | ||
308 | pub const GLOB_NOESCAPE : ::c_int = 0x1000; | ||
309 | |||
310 | pub const GLOB_NOSPACE : ::c_int = -1; | ||
311 | pub const GLOB_ABORTED : ::c_int = -2; | ||
312 | pub const GLOB_NOMATCH : ::c_int = -3; | ||
313 | pub const GLOB_NOSYS : ::c_int = -4; | ||
314 | |||
315 | pub const POSIX_MADV_NORMAL : ::c_int = 0; | ||
316 | pub const POSIX_MADV_RANDOM : ::c_int = 1; | ||
317 | pub const POSIX_MADV_SEQUENTIAL : ::c_int = 2; | ||
318 | pub const POSIX_MADV_WILLNEED : ::c_int = 3; | ||
319 | pub const POSIX_MADV_DONTNEED : ::c_int = 4; | ||
320 | |||
321 | pub const _SC_XOPEN_SHM : ::c_int = 30; | ||
322 | |||
323 | pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0; | ||
324 | pub const PTHREAD_CREATE_DETACHED : ::c_int = 1; | ||
325 | |||
326 | // http://man.openbsd.org/OpenBSD-current/man2/clock_getres.2 | ||
327 | // The man page says clock_gettime(3) can accept various values as clockid_t but | ||
328 | // http://fxr.watson.org/fxr/source/kern/kern_time.c?v=OPENBSD;im=excerpts#L161 | ||
329 | // the implementation rejects anything other than the below two | ||
330 | // | ||
331 | // http://netbsd.gw.com/cgi-bin/man-cgi?clock_gettime | ||
332 | // https://github.com/jsonn/src/blob/HEAD/sys/kern/subr_time.c#L222 | ||
333 | // Basically the same goes for NetBSD | ||
334 | pub const CLOCK_REALTIME: clockid_t = 0; | ||
335 | pub const CLOCK_MONOTONIC: clockid_t = 3; | ||
336 | |||
337 | pub const RLIMIT_CPU: ::c_int = 0; | ||
338 | pub const RLIMIT_FSIZE: ::c_int = 1; | ||
339 | pub const RLIMIT_DATA: ::c_int = 2; | ||
340 | pub const RLIMIT_STACK: ::c_int = 3; | ||
341 | pub const RLIMIT_CORE: ::c_int = 4; | ||
342 | pub const RLIMIT_RSS: ::c_int = 5; | ||
343 | pub const RLIMIT_MEMLOCK: ::c_int = 6; | ||
344 | pub const RLIMIT_NPROC: ::c_int = 7; | ||
345 | pub const RLIMIT_NOFILE: ::c_int = 8; | ||
346 | |||
347 | pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff; | ||
348 | pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY; | ||
349 | pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY; | ||
350 | |||
351 | pub const RUSAGE_SELF: ::c_int = 0; | ||
352 | pub const RUSAGE_CHILDREN: ::c_int = -1; | ||
353 | |||
354 | pub const MADV_NORMAL : ::c_int = 0; | ||
355 | pub const MADV_RANDOM : ::c_int = 1; | ||
356 | pub const MADV_SEQUENTIAL : ::c_int = 2; | ||
357 | pub const MADV_WILLNEED : ::c_int = 3; | ||
358 | pub const MADV_DONTNEED : ::c_int = 4; | ||
359 | pub const MADV_FREE : ::c_int = 6; | ||
360 | |||
361 | pub const AF_UNIX: ::c_int = 1; | ||
362 | pub const AF_INET: ::c_int = 2; | ||
363 | pub const AF_INET6: ::c_int = 24; | ||
364 | pub const SOCK_STREAM: ::c_int = 1; | ||
365 | pub const SOCK_DGRAM: ::c_int = 2; | ||
366 | pub const SOCK_RAW: ::c_int = 3; | ||
367 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
368 | pub const IPPROTO_TCP: ::c_int = 6; | ||
369 | pub const IPPROTO_IP: ::c_int = 0; | ||
370 | pub const IPPROTO_IPV6: ::c_int = 41; | ||
371 | pub const IP_MULTICAST_TTL: ::c_int = 10; | ||
372 | pub const IP_MULTICAST_LOOP: ::c_int = 11; | ||
373 | pub const IP_TTL: ::c_int = 4; | ||
374 | pub const IP_HDRINCL: ::c_int = 2; | ||
375 | pub const IP_ADD_MEMBERSHIP: ::c_int = 12; | ||
376 | pub const IP_DROP_MEMBERSHIP: ::c_int = 13; | ||
377 | |||
378 | pub const TCP_NODELAY: ::c_int = 0x01; | ||
379 | pub const SOL_SOCKET: ::c_int = 0xffff; | ||
380 | pub const SO_DEBUG: ::c_int = 0x01; | ||
381 | pub const SO_ACCEPTCONN: ::c_int = 0x0002; | ||
382 | pub const SO_REUSEADDR: ::c_int = 0x0004; | ||
383 | pub const SO_KEEPALIVE: ::c_int = 0x0008; | ||
384 | pub const SO_DONTROUTE: ::c_int = 0x0010; | ||
385 | pub const SO_BROADCAST: ::c_int = 0x0020; | ||
386 | pub const SO_USELOOPBACK: ::c_int = 0x0040; | ||
387 | pub const SO_LINGER: ::c_int = 0x0080; | ||
388 | pub const SO_OOBINLINE: ::c_int = 0x0100; | ||
389 | pub const SO_REUSEPORT: ::c_int = 0x0200; | ||
390 | pub const SO_SNDBUF: ::c_int = 0x1001; | ||
391 | pub const SO_RCVBUF: ::c_int = 0x1002; | ||
392 | pub const SO_SNDLOWAT: ::c_int = 0x1003; | ||
393 | pub const SO_RCVLOWAT: ::c_int = 0x1004; | ||
394 | pub const SO_ERROR: ::c_int = 0x1007; | ||
395 | pub const SO_TYPE: ::c_int = 0x1008; | ||
396 | |||
397 | pub const IFF_LOOPBACK: ::c_int = 0x8; | ||
398 | |||
399 | pub const SHUT_RD: ::c_int = 0; | ||
400 | pub const SHUT_WR: ::c_int = 1; | ||
401 | pub const SHUT_RDWR: ::c_int = 2; | ||
402 | |||
403 | pub const LOCK_SH: ::c_int = 1; | ||
404 | pub const LOCK_EX: ::c_int = 2; | ||
405 | pub const LOCK_NB: ::c_int = 4; | ||
406 | pub const LOCK_UN: ::c_int = 8; | ||
407 | |||
408 | pub const O_NONBLOCK : ::c_int = 4; | ||
409 | |||
410 | pub const IPPROTO_RAW : ::c_int = 255; | ||
411 | |||
412 | pub const _SC_ARG_MAX : ::c_int = 1; | ||
413 | pub const _SC_CHILD_MAX : ::c_int = 2; | ||
414 | pub const _SC_NGROUPS_MAX : ::c_int = 4; | ||
415 | pub const _SC_OPEN_MAX : ::c_int = 5; | ||
416 | pub const _SC_JOB_CONTROL : ::c_int = 6; | ||
417 | pub const _SC_SAVED_IDS : ::c_int = 7; | ||
418 | pub const _SC_VERSION : ::c_int = 8; | ||
419 | pub const _SC_BC_BASE_MAX : ::c_int = 9; | ||
420 | pub const _SC_BC_DIM_MAX : ::c_int = 10; | ||
421 | pub const _SC_BC_SCALE_MAX : ::c_int = 11; | ||
422 | pub const _SC_BC_STRING_MAX : ::c_int = 12; | ||
423 | pub const _SC_COLL_WEIGHTS_MAX : ::c_int = 13; | ||
424 | pub const _SC_EXPR_NEST_MAX : ::c_int = 14; | ||
425 | pub const _SC_LINE_MAX : ::c_int = 15; | ||
426 | pub const _SC_RE_DUP_MAX : ::c_int = 16; | ||
427 | pub const _SC_2_VERSION : ::c_int = 17; | ||
428 | pub const _SC_2_C_BIND : ::c_int = 18; | ||
429 | pub const _SC_2_C_DEV : ::c_int = 19; | ||
430 | pub const _SC_2_CHAR_TERM : ::c_int = 20; | ||
431 | pub const _SC_2_FORT_DEV : ::c_int = 21; | ||
432 | pub const _SC_2_FORT_RUN : ::c_int = 22; | ||
433 | pub const _SC_2_LOCALEDEF : ::c_int = 23; | ||
434 | pub const _SC_2_SW_DEV : ::c_int = 24; | ||
435 | pub const _SC_2_UPE : ::c_int = 25; | ||
436 | pub const _SC_STREAM_MAX : ::c_int = 26; | ||
437 | pub const _SC_TZNAME_MAX : ::c_int = 27; | ||
438 | pub const _SC_PAGESIZE : ::c_int = 28; | ||
439 | pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; | ||
440 | pub const _SC_FSYNC : ::c_int = 29; | ||
441 | |||
442 | pub const Q_GETQUOTA: ::c_int = 0x300; | ||
443 | pub const Q_SETQUOTA: ::c_int = 0x400; | ||
444 | |||
445 | pub const RTLD_GLOBAL: ::c_int = 0x100; | ||
446 | |||
447 | pub const LOG_NFACILITIES: ::c_int = 24; | ||
448 | |||
449 | pub const HW_NCPU: ::c_int = 3; | ||
450 | |||
451 | pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t; | ||
452 | |||
453 | f! { | ||
454 | pub fn WSTOPSIG(status: ::c_int) -> ::c_int { | ||
455 | status >> 8 | ||
456 | } | ||
457 | |||
458 | pub fn WIFSIGNALED(status: ::c_int) -> bool { | ||
459 | (status & 0o177) != 0o177 && (status & 0o177) != 0 | ||
460 | } | ||
461 | |||
462 | pub fn WIFSTOPPED(status: ::c_int) -> bool { | ||
463 | (status & 0o177) == 0o177 | ||
464 | } | ||
465 | } | ||
466 | |||
467 | #[link(name = "util")] | ||
468 | extern { | ||
469 | pub fn mincore(addr: *mut ::c_void, len: ::size_t, | ||
470 | vec: *mut ::c_char) -> ::c_int; | ||
471 | #[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")] | ||
472 | pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
473 | #[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")] | ||
474 | pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
475 | pub fn __errno() -> *mut ::c_int; | ||
476 | pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) | ||
477 | -> ::c_int; | ||
478 | pub fn memrchr(cx: *const ::c_void, | ||
479 | c: ::c_int, | ||
480 | n: ::size_t) -> *mut ::c_void; | ||
481 | pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; | ||
482 | pub fn mkostemps(template: *mut ::c_char, | ||
483 | suffixlen: ::c_int, | ||
484 | flags: ::c_int) -> ::c_int; | ||
485 | pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; | ||
486 | pub fn fdatasync(fd: ::c_int) -> ::c_int; | ||
487 | pub fn openpty(amaster: *mut ::c_int, | ||
488 | aslave: *mut ::c_int, | ||
489 | name: *mut ::c_char, | ||
490 | termp: *mut termios, | ||
491 | winp: *mut ::winsize) -> ::c_int; | ||
492 | pub fn forkpty(amaster: *mut ::c_int, | ||
493 | name: *mut ::c_char, | ||
494 | termp: *mut termios, | ||
495 | winp: *mut ::winsize) -> ::pid_t; | ||
496 | pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; | ||
497 | pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; | ||
498 | |||
499 | pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, | ||
500 | flags: ::c_int, ...) -> ::c_int; | ||
501 | pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, | ||
502 | mode: ::c_int, flags: ::c_int) -> ::c_int; | ||
503 | pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
504 | mode: ::mode_t, flags: ::c_int) -> ::c_int; | ||
505 | pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char, | ||
506 | owner: ::uid_t, group: ::gid_t, | ||
507 | flags: ::c_int) -> ::c_int; | ||
508 | pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, | ||
509 | buf: *mut stat, flags: ::c_int) -> ::c_int; | ||
510 | pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
511 | newdirfd: ::c_int, newpath: *const ::c_char, | ||
512 | flags: ::c_int) -> ::c_int; | ||
513 | pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, | ||
514 | mode: ::mode_t) -> ::c_int; | ||
515 | pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
516 | mode: ::mode_t, dev: dev_t) -> ::c_int; | ||
517 | pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
518 | buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t; | ||
519 | pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
520 | newdirfd: ::c_int, newpath: *const ::c_char) | ||
521 | -> ::c_int; | ||
522 | pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int, | ||
523 | linkpath: *const ::c_char) -> ::c_int; | ||
524 | pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
525 | flags: ::c_int) -> ::c_int; | ||
526 | pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, | ||
527 | mode: ::mode_t) -> ::c_int; | ||
528 | pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, | ||
529 | clock_id: clockid_t) -> ::c_int; | ||
530 | } | ||
531 | |||
532 | cfg_if! { | ||
533 | if #[cfg(target_os = "bitrig")] { | ||
534 | mod bitrig; | ||
535 | pub use self::bitrig::*; | ||
536 | } else if #[cfg(target_os = "netbsd")] { | ||
537 | mod netbsd; | ||
538 | pub use self::netbsd::*; | ||
539 | } else if #[cfg(target_os = "openbsd")] { | ||
540 | mod openbsd; | ||
541 | pub use self::openbsd::*; | ||
542 | } else { | ||
543 | // Unknown target_os | ||
544 | } | ||
545 | } | ||
diff --git a/third_party/libc/src/unix/bsd/openbsdlike/netbsd.rs b/third_party/libc/src/unix/bsd/openbsdlike/netbsd.rs new file mode 100644 index 0000000..5e5e5ae --- /dev/null +++ b/third_party/libc/src/unix/bsd/openbsdlike/netbsd.rs | |||
@@ -0,0 +1,586 @@ | |||
1 | pub type clock_t = ::c_uint; | ||
2 | pub type suseconds_t = ::c_int; | ||
3 | pub type dev_t = u64; | ||
4 | pub type blksize_t = ::int32_t; | ||
5 | pub type fsblkcnt_t = ::uint64_t; | ||
6 | pub type fsfilcnt_t = ::uint64_t; | ||
7 | |||
8 | s! { | ||
9 | pub struct dirent { | ||
10 | pub d_fileno: ::ino_t, | ||
11 | pub d_reclen: u16, | ||
12 | pub d_namlen: u16, | ||
13 | pub d_type: u8, | ||
14 | pub d_name: [::c_char; 512], | ||
15 | } | ||
16 | |||
17 | pub struct glob_t { | ||
18 | pub gl_pathc: ::size_t, | ||
19 | __unused1: ::c_int, | ||
20 | pub gl_offs: ::size_t, | ||
21 | __unused2: ::c_int, | ||
22 | pub gl_pathv: *mut *mut ::c_char, | ||
23 | |||
24 | __unused3: *mut ::c_void, | ||
25 | |||
26 | __unused4: *mut ::c_void, | ||
27 | __unused5: *mut ::c_void, | ||
28 | __unused6: *mut ::c_void, | ||
29 | __unused7: *mut ::c_void, | ||
30 | __unused8: *mut ::c_void, | ||
31 | } | ||
32 | |||
33 | pub struct sigset_t { | ||
34 | __bits: [u32; 4], | ||
35 | } | ||
36 | |||
37 | pub struct stat { | ||
38 | pub st_dev: ::dev_t, | ||
39 | pub st_mode: ::mode_t, | ||
40 | pub st_ino: ::ino_t, | ||
41 | pub st_nlink: ::nlink_t, | ||
42 | pub st_uid: ::uid_t, | ||
43 | pub st_gid: ::gid_t, | ||
44 | pub st_rdev: ::dev_t, | ||
45 | pub st_atime: ::time_t, | ||
46 | pub st_atimensec: ::c_long, | ||
47 | pub st_mtime: ::time_t, | ||
48 | pub st_mtimensec: ::c_long, | ||
49 | pub st_ctime: ::time_t, | ||
50 | pub st_ctimensec: ::c_long, | ||
51 | pub st_birthtime: ::time_t, | ||
52 | pub st_birthtimensec: ::c_long, | ||
53 | pub st_size: ::off_t, | ||
54 | pub st_blocks: ::blkcnt_t, | ||
55 | pub st_blksize: ::blksize_t, | ||
56 | pub st_flags: ::uint32_t, | ||
57 | pub st_gen: ::uint32_t, | ||
58 | pub st_spare: [::uint32_t; 2], | ||
59 | } | ||
60 | |||
61 | pub struct statvfs { | ||
62 | pub f_flag: ::c_ulong, | ||
63 | pub f_bsize: ::c_ulong, | ||
64 | pub f_frsize: ::c_ulong, | ||
65 | pub f_iosize: ::c_ulong, | ||
66 | |||
67 | pub f_blocks: ::fsblkcnt_t, | ||
68 | pub f_bfree: ::fsblkcnt_t, | ||
69 | pub f_bavail: ::fsblkcnt_t, | ||
70 | pub f_bresvd: ::fsblkcnt_t, | ||
71 | |||
72 | pub f_files: ::fsfilcnt_t, | ||
73 | pub f_ffree: ::fsfilcnt_t, | ||
74 | pub f_favail: ::fsfilcnt_t, | ||
75 | pub f_fresvd: ::fsfilcnt_t, | ||
76 | |||
77 | pub f_syncreads: ::uint64_t, | ||
78 | pub f_syncwrites: ::uint64_t, | ||
79 | |||
80 | pub f_asyncreads: ::uint64_t, | ||
81 | pub f_asyncwrites: ::uint64_t, | ||
82 | |||
83 | pub f_fsidx: ::fsid_t, | ||
84 | pub f_fsid: ::c_ulong, | ||
85 | pub f_namemax: ::c_ulong, | ||
86 | pub f_owner: ::uid_t, | ||
87 | |||
88 | pub f_spare: [::uint32_t; 4], | ||
89 | |||
90 | pub f_fstypename: [::c_char; 32], | ||
91 | pub f_mntonname: [::c_char; 1024], | ||
92 | pub f_mntfromname: [::c_char; 1024], | ||
93 | } | ||
94 | |||
95 | pub struct addrinfo { | ||
96 | pub ai_flags: ::c_int, | ||
97 | pub ai_family: ::c_int, | ||
98 | pub ai_socktype: ::c_int, | ||
99 | pub ai_protocol: ::c_int, | ||
100 | pub ai_addrlen: ::socklen_t, | ||
101 | pub ai_canonname: *mut ::c_char, | ||
102 | pub ai_addr: *mut ::sockaddr, | ||
103 | pub ai_next: *mut ::addrinfo, | ||
104 | } | ||
105 | |||
106 | pub struct sockaddr_storage { | ||
107 | pub ss_len: u8, | ||
108 | pub ss_family: ::sa_family_t, | ||
109 | __ss_pad1: [u8; 6], | ||
110 | __ss_pad2: i64, | ||
111 | __ss_pad3: [u8; 112], | ||
112 | } | ||
113 | |||
114 | pub struct siginfo_t { | ||
115 | pub si_signo: ::c_int, | ||
116 | pub si_code: ::c_int, | ||
117 | pub si_errno: ::c_int, | ||
118 | __pad1: ::c_int, | ||
119 | pub si_addr: *mut ::c_void, | ||
120 | __pad2: [u64; 13], | ||
121 | } | ||
122 | |||
123 | pub struct pthread_attr_t { | ||
124 | pta_magic: ::c_uint, | ||
125 | pta_flags: ::c_int, | ||
126 | pta_private: *mut ::c_void, | ||
127 | } | ||
128 | |||
129 | pub struct pthread_mutex_t { | ||
130 | ptm_magic: ::c_uint, | ||
131 | ptm_errorcheck: ::c_uchar, | ||
132 | ptm_pad1: [u8; 3], | ||
133 | ptm_interlock: ::c_uchar, | ||
134 | ptm_pad2: [u8; 3], | ||
135 | ptm_owner: ::pthread_t, | ||
136 | ptm_waiters: *mut u8, | ||
137 | ptm_recursed: ::c_uint, | ||
138 | ptm_spare2: *mut ::c_void, | ||
139 | } | ||
140 | |||
141 | pub struct pthread_mutexattr_t { | ||
142 | ptma_magic: ::c_uint, | ||
143 | ptma_private: *mut ::c_void, | ||
144 | } | ||
145 | |||
146 | pub struct pthread_cond_t { | ||
147 | ptc_magic: ::c_uint, | ||
148 | ptc_lock: ::c_uchar, | ||
149 | ptc_waiters_first: *mut u8, | ||
150 | ptc_waiters_last: *mut u8, | ||
151 | ptc_mutex: *mut ::pthread_mutex_t, | ||
152 | ptc_private: *mut ::c_void, | ||
153 | } | ||
154 | |||
155 | pub struct pthread_condattr_t { | ||
156 | ptca_magic: ::c_uint, | ||
157 | ptca_private: *mut ::c_void, | ||
158 | } | ||
159 | |||
160 | pub struct pthread_rwlock_t { | ||
161 | ptr_magic: ::c_uint, | ||
162 | ptr_interlock: ::c_uchar, | ||
163 | ptr_rblocked_first: *mut u8, | ||
164 | ptr_rblocked_last: *mut u8, | ||
165 | ptr_wblocked_first: *mut u8, | ||
166 | ptr_wblocked_last: *mut u8, | ||
167 | ptr_nreaders: ::c_uint, | ||
168 | ptr_owner: ::pthread_t, | ||
169 | ptr_private: *mut ::c_void, | ||
170 | } | ||
171 | |||
172 | pub struct kevent { | ||
173 | pub ident: ::uintptr_t, | ||
174 | pub filter: ::uint32_t, | ||
175 | pub flags: ::uint32_t, | ||
176 | pub fflags: ::uint32_t, | ||
177 | pub data: ::int64_t, | ||
178 | pub udata: ::intptr_t, | ||
179 | } | ||
180 | |||
181 | pub struct dqblk { | ||
182 | pub dqb_bhardlimit: ::uint32_t, | ||
183 | pub dqb_bsoftlimit: ::uint32_t, | ||
184 | pub dqb_curblocks: ::uint32_t, | ||
185 | pub dqb_ihardlimit: ::uint32_t, | ||
186 | pub dqb_isoftlimit: ::uint32_t, | ||
187 | pub dqb_curinodes: ::uint32_t, | ||
188 | pub dqb_btime: ::int32_t, | ||
189 | pub dqb_itime: ::int32_t, | ||
190 | } | ||
191 | |||
192 | pub struct Dl_info { | ||
193 | pub dli_fname: *const ::c_char, | ||
194 | pub dli_fbase: *mut ::c_void, | ||
195 | pub dli_sname: *const ::c_char, | ||
196 | pub dli_saddr: *const ::c_void, | ||
197 | } | ||
198 | |||
199 | pub struct lconv { | ||
200 | pub decimal_point: *mut ::c_char, | ||
201 | pub thousands_sep: *mut ::c_char, | ||
202 | pub grouping: *mut ::c_char, | ||
203 | pub int_curr_symbol: *mut ::c_char, | ||
204 | pub currency_symbol: *mut ::c_char, | ||
205 | pub mon_decimal_point: *mut ::c_char, | ||
206 | pub mon_thousands_sep: *mut ::c_char, | ||
207 | pub mon_grouping: *mut ::c_char, | ||
208 | pub positive_sign: *mut ::c_char, | ||
209 | pub negative_sign: *mut ::c_char, | ||
210 | pub int_frac_digits: ::c_char, | ||
211 | pub frac_digits: ::c_char, | ||
212 | pub p_cs_precedes: ::c_char, | ||
213 | pub p_sep_by_space: ::c_char, | ||
214 | pub n_cs_precedes: ::c_char, | ||
215 | pub n_sep_by_space: ::c_char, | ||
216 | pub p_sign_posn: ::c_char, | ||
217 | pub n_sign_posn: ::c_char, | ||
218 | pub int_p_cs_precedes: ::c_char, | ||
219 | pub int_n_cs_precedes: ::c_char, | ||
220 | pub int_p_sep_by_space: ::c_char, | ||
221 | pub int_n_sep_by_space: ::c_char, | ||
222 | pub int_p_sign_posn: ::c_char, | ||
223 | pub int_n_sign_posn: ::c_char, | ||
224 | } | ||
225 | } | ||
226 | |||
227 | pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE); | ||
228 | pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE); | ||
229 | pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY); | ||
230 | pub const LC_NUMERIC_MASK: ::c_int = (1 << ::LC_NUMERIC); | ||
231 | pub const LC_TIME_MASK: ::c_int = (1 << ::LC_TIME); | ||
232 | pub const LC_MESSAGES_MASK: ::c_int = (1 << ::LC_MESSAGES); | ||
233 | pub const LC_ALL_MASK: ::c_int = !0; | ||
234 | |||
235 | pub const ERA: ::nl_item = 52; | ||
236 | pub const ERA_D_FMT: ::nl_item = 53; | ||
237 | pub const ERA_D_T_FMT: ::nl_item = 54; | ||
238 | pub const ERA_T_FMT: ::nl_item = 55; | ||
239 | pub const ALT_DIGITS: ::nl_item = 56; | ||
240 | |||
241 | pub const O_CLOEXEC: ::c_int = 0x400000; | ||
242 | pub const O_ALT_IO: ::c_int = 0x40000; | ||
243 | pub const O_NOSIGPIPE: ::c_int = 0x1000000; | ||
244 | pub const O_SEARCH: ::c_int = 0x800000; | ||
245 | pub const O_EXLOCK: ::c_int = 0x20; | ||
246 | pub const O_SHLOCK: ::c_int = 0x10; | ||
247 | pub const O_DIRECTORY: ::c_int = 0x200000; | ||
248 | |||
249 | pub const MS_SYNC : ::c_int = 0x4; | ||
250 | pub const MS_INVALIDATE : ::c_int = 0x2; | ||
251 | |||
252 | pub const RLIM_NLIMITS: ::c_int = 12; | ||
253 | |||
254 | pub const ENOATTR : ::c_int = 93; | ||
255 | pub const EILSEQ : ::c_int = 85; | ||
256 | pub const EOVERFLOW : ::c_int = 84; | ||
257 | pub const ECANCELED : ::c_int = 87; | ||
258 | pub const EIDRM : ::c_int = 82; | ||
259 | pub const ENOMSG : ::c_int = 83; | ||
260 | pub const ENOTSUP : ::c_int = 86; | ||
261 | pub const ELAST : ::c_int = 96; | ||
262 | |||
263 | pub const F_DUPFD_CLOEXEC : ::c_int = 12; | ||
264 | pub const F_CLOSEM: ::c_int = 10; | ||
265 | pub const F_GETNOSIGPIPE: ::c_int = 13; | ||
266 | pub const F_SETNOSIGPIPE: ::c_int = 14; | ||
267 | pub const F_MAXFD: ::c_int = 11; | ||
268 | |||
269 | pub const IPV6_JOIN_GROUP: ::c_int = 12; | ||
270 | pub const IPV6_LEAVE_GROUP: ::c_int = 13; | ||
271 | |||
272 | pub const SO_SNDTIMEO: ::c_int = 0x100b; | ||
273 | pub const SO_RCVTIMEO: ::c_int = 0x100c; | ||
274 | |||
275 | pub const O_DSYNC : ::c_int = 0x10000; | ||
276 | |||
277 | pub const MAP_RENAME : ::c_int = 0x20; | ||
278 | pub const MAP_NORESERVE : ::c_int = 0x40; | ||
279 | pub const MAP_HASSEMAPHORE : ::c_int = 0x200; | ||
280 | pub const MAP_WIRED: ::c_int = 0x800; | ||
281 | |||
282 | pub const _SC_IOV_MAX : ::c_int = 32; | ||
283 | pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47; | ||
284 | pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 48; | ||
285 | pub const _SC_LOGIN_NAME_MAX : ::c_int = 37; | ||
286 | pub const _SC_MQ_PRIO_MAX : ::c_int = 55; | ||
287 | pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002; | ||
288 | pub const _SC_THREADS : ::c_int = 41; | ||
289 | pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61; | ||
290 | pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62; | ||
291 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 57; | ||
292 | pub const _SC_THREAD_KEYS_MAX : ::c_int = 58; | ||
293 | pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 64; | ||
294 | pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 65; | ||
295 | pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63; | ||
296 | pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 66; | ||
297 | pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 67; | ||
298 | pub const _SC_THREAD_STACK_MIN : ::c_int = 59; | ||
299 | pub const _SC_THREAD_THREADS_MAX : ::c_int = 60; | ||
300 | pub const _SC_TTY_NAME_MAX : ::c_int = 68; | ||
301 | pub const _SC_ATEXIT_MAX : ::c_int = 40; | ||
302 | pub const _SC_CLK_TCK : ::c_int = 39; | ||
303 | pub const _SC_AIO_LISTIO_MAX : ::c_int = 51; | ||
304 | pub const _SC_AIO_MAX : ::c_int = 52; | ||
305 | pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50; | ||
306 | pub const _SC_MAPPED_FILES : ::c_int = 33; | ||
307 | pub const _SC_MEMLOCK : ::c_int = 34; | ||
308 | pub const _SC_MEMLOCK_RANGE : ::c_int = 35; | ||
309 | pub const _SC_MEMORY_PROTECTION : ::c_int = 36; | ||
310 | pub const _SC_MESSAGE_PASSING : ::c_int = 53; | ||
311 | pub const _SC_MQ_OPEN_MAX : ::c_int = 54; | ||
312 | pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56; | ||
313 | pub const _SC_SEMAPHORES : ::c_int = 42; | ||
314 | pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87; | ||
315 | pub const _SC_SYNCHRONIZED_IO : ::c_int = 31; | ||
316 | pub const _SC_TIMERS : ::c_int = 44; | ||
317 | pub const _SC_HOST_NAME_MAX : ::c_int = 69; | ||
318 | |||
319 | pub const FD_SETSIZE: usize = 0x100; | ||
320 | |||
321 | pub const ST_NOSUID: ::c_ulong = 8; | ||
322 | |||
323 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { | ||
324 | ptm_magic: 0x33330003, | ||
325 | ptm_errorcheck: 0, | ||
326 | ptm_interlock: 0, | ||
327 | ptm_waiters: 0 as *mut _, | ||
328 | ptm_owner: 0, | ||
329 | ptm_pad1: [0; 3], | ||
330 | ptm_pad2: [0; 3], | ||
331 | ptm_recursed: 0, | ||
332 | ptm_spare2: 0 as *mut _, | ||
333 | }; | ||
334 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { | ||
335 | ptc_magic: 0x55550005, | ||
336 | ptc_lock: 0, | ||
337 | ptc_waiters_first: 0 as *mut _, | ||
338 | ptc_waiters_last: 0 as *mut _, | ||
339 | ptc_mutex: 0 as *mut _, | ||
340 | ptc_private: 0 as *mut _, | ||
341 | }; | ||
342 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { | ||
343 | ptr_magic: 0x99990009, | ||
344 | ptr_interlock: 0, | ||
345 | ptr_rblocked_first: 0 as *mut _, | ||
346 | ptr_rblocked_last: 0 as *mut _, | ||
347 | ptr_wblocked_first: 0 as *mut _, | ||
348 | ptr_wblocked_last: 0 as *mut _, | ||
349 | ptr_nreaders: 0, | ||
350 | ptr_owner: 0, | ||
351 | ptr_private: 0 as *mut _, | ||
352 | }; | ||
353 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; | ||
354 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1; | ||
355 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; | ||
356 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; | ||
357 | |||
358 | pub const EVFILT_AIO: ::int16_t = 2; | ||
359 | pub const EVFILT_PROC: ::int16_t = 4; | ||
360 | pub const EVFILT_READ: ::int16_t = 0; | ||
361 | pub const EVFILT_SIGNAL: ::int16_t = 5; | ||
362 | pub const EVFILT_SYSCOUNT: ::int16_t = 7; | ||
363 | pub const EVFILT_TIMER: ::int16_t = 6; | ||
364 | pub const EVFILT_VNODE: ::int16_t = 3; | ||
365 | pub const EVFILT_WRITE: ::int16_t = 1; | ||
366 | |||
367 | pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000; | ||
368 | |||
369 | pub const CRTSCTS: ::tcflag_t = 0x00010000; | ||
370 | |||
371 | pub const TMP_MAX : ::c_uint = 308915776; | ||
372 | |||
373 | pub const NI_MAXHOST: ::socklen_t = 1025; | ||
374 | |||
375 | pub const RTLD_NOLOAD: ::c_int = 0x2000; | ||
376 | pub const RTLD_LOCAL: ::c_int = 0x200; | ||
377 | |||
378 | pub const CTL_MAXNAME: ::c_int = 12; | ||
379 | pub const SYSCTL_NAMELEN: ::c_int = 32; | ||
380 | pub const SYSCTL_DEFSIZE: ::c_int = 8; | ||
381 | pub const CTLTYPE_NODE: ::c_int = 1; | ||
382 | pub const CTLTYPE_INT: ::c_int = 2; | ||
383 | pub const CTLTYPE_STRING: ::c_int = 3; | ||
384 | pub const CTLTYPE_QUAD: ::c_int = 4; | ||
385 | pub const CTLTYPE_STRUCT: ::c_int = 5; | ||
386 | pub const CTLTYPE_BOOL: ::c_int = 6; | ||
387 | pub const CTLFLAG_READONLY: ::c_int = 0x00000000; | ||
388 | pub const CTLFLAG_READWRITE: ::c_int = 0x00000070; | ||
389 | pub const CTLFLAG_ANYWRITE: ::c_int = 0x00000080; | ||
390 | pub const CTLFLAG_PRIVATE: ::c_int = 0x00000100; | ||
391 | pub const CTLFLAG_PERMANENT: ::c_int = 0x00000200; | ||
392 | pub const CTLFLAG_OWNDATA: ::c_int = 0x00000400; | ||
393 | pub const CTLFLAG_IMMEDIATE: ::c_int = 0x00000800; | ||
394 | pub const CTLFLAG_HEX: ::c_int = 0x00001000; | ||
395 | pub const CTLFLAG_ROOT: ::c_int = 0x00002000; | ||
396 | pub const CTLFLAG_ANYNUMBER: ::c_int = 0x00004000; | ||
397 | pub const CTLFLAG_HIDDEN: ::c_int = 0x00008000; | ||
398 | pub const CTLFLAG_ALIAS: ::c_int = 0x00010000; | ||
399 | pub const CTLFLAG_MMAP: ::c_int = 0x00020000; | ||
400 | pub const CTLFLAG_OWNDESC: ::c_int = 0x00040000; | ||
401 | pub const CTLFLAG_UNSIGNED: ::c_int = 0x00080000; | ||
402 | pub const SYSCTL_VERS_MASK: ::c_int = 0xff000000; | ||
403 | pub const SYSCTL_VERS_0: ::c_int = 0x00000000; | ||
404 | pub const SYSCTL_VERS_1: ::c_int = 0x01000000; | ||
405 | pub const SYSCTL_VERSION: ::c_int = SYSCTL_VERS_1; | ||
406 | pub const CTL_EOL: ::c_int = -1; | ||
407 | pub const CTL_QUERY: ::c_int = -2; | ||
408 | pub const CTL_CREATE: ::c_int = -3; | ||
409 | pub const CTL_CREATESYM: ::c_int = -4; | ||
410 | pub const CTL_DESTROY: ::c_int = -5; | ||
411 | pub const CTL_MMAP: ::c_int = -6; | ||
412 | pub const CTL_DESCRIBE: ::c_int = -7; | ||
413 | pub const CTL_UNSPEC: ::c_int = 0; | ||
414 | pub const CTL_KERN: ::c_int = 1; | ||
415 | pub const CTL_VM: ::c_int = 2; | ||
416 | pub const CTL_VFS: ::c_int = 3; | ||
417 | pub const CTL_NET: ::c_int = 4; | ||
418 | pub const CTL_DEBUG: ::c_int = 5; | ||
419 | pub const CTL_HW: ::c_int = 6; | ||
420 | pub const CTL_MACHDEP: ::c_int = 7; | ||
421 | pub const CTL_USER: ::c_int = 8; | ||
422 | pub const CTL_DDB: ::c_int = 9; | ||
423 | pub const CTL_PROC: ::c_int = 10; | ||
424 | pub const CTL_VENDOR: ::c_int = 11; | ||
425 | pub const CTL_EMUL: ::c_int = 12; | ||
426 | pub const CTL_SECURITY: ::c_int = 13; | ||
427 | pub const CTL_MAXID: ::c_int = 14; | ||
428 | pub const KERN_OSTYPE: ::c_int = 1; | ||
429 | pub const KERN_OSRELEASE: ::c_int = 2; | ||
430 | pub const KERN_OSREV: ::c_int = 3; | ||
431 | pub const KERN_VERSION: ::c_int = 4; | ||
432 | pub const KERN_MAXVNODES: ::c_int = 5; | ||
433 | pub const KERN_MAXPROC: ::c_int = 6; | ||
434 | pub const KERN_MAXFILES: ::c_int = 7; | ||
435 | pub const KERN_ARGMAX: ::c_int = 8; | ||
436 | pub const KERN_SECURELVL: ::c_int = 9; | ||
437 | pub const KERN_HOSTNAME: ::c_int = 10; | ||
438 | pub const KERN_HOSTID: ::c_int = 11; | ||
439 | pub const KERN_CLOCKRATE: ::c_int = 12; | ||
440 | pub const KERN_VNODE: ::c_int = 13; | ||
441 | pub const KERN_PROC: ::c_int = 14; | ||
442 | pub const KERN_FILE: ::c_int = 15; | ||
443 | pub const KERN_PROF: ::c_int = 16; | ||
444 | pub const KERN_POSIX1: ::c_int = 17; | ||
445 | pub const KERN_NGROUPS: ::c_int = 18; | ||
446 | pub const KERN_JOB_CONTROL: ::c_int = 19; | ||
447 | pub const KERN_SAVED_IDS: ::c_int = 20; | ||
448 | pub const KERN_OBOOTTIME: ::c_int = 21; | ||
449 | pub const KERN_DOMAINNAME: ::c_int = 22; | ||
450 | pub const KERN_MAXPARTITIONS: ::c_int = 23; | ||
451 | pub const KERN_RAWPARTITION: ::c_int = 24; | ||
452 | pub const KERN_NTPTIME: ::c_int = 25; | ||
453 | pub const KERN_TIMEX: ::c_int = 26; | ||
454 | pub const KERN_AUTONICETIME: ::c_int = 27; | ||
455 | pub const KERN_AUTONICEVAL: ::c_int = 28; | ||
456 | pub const KERN_RTC_OFFSET: ::c_int = 29; | ||
457 | pub const KERN_ROOT_DEVICE: ::c_int = 30; | ||
458 | pub const KERN_MSGBUFSIZE: ::c_int = 31; | ||
459 | pub const KERN_FSYNC: ::c_int = 32; | ||
460 | pub const KERN_OLDSYSVMSG: ::c_int = 33; | ||
461 | pub const KERN_OLDSYSVSEM: ::c_int = 34; | ||
462 | pub const KERN_OLDSYSVSHM: ::c_int = 35; | ||
463 | pub const KERN_OLDSHORTCORENAME: ::c_int = 36; | ||
464 | pub const KERN_SYNCHRONIZED_IO: ::c_int = 37; | ||
465 | pub const KERN_IOV_MAX: ::c_int = 38; | ||
466 | pub const KERN_MBUF: ::c_int = 39; | ||
467 | pub const KERN_MAPPED_FILES: ::c_int = 40; | ||
468 | pub const KERN_MEMLOCK: ::c_int = 41; | ||
469 | pub const KERN_MEMLOCK_RANGE: ::c_int = 42; | ||
470 | pub const KERN_MEMORY_PROTECTION: ::c_int = 43; | ||
471 | pub const KERN_LOGIN_NAME_MAX: ::c_int = 44; | ||
472 | pub const KERN_DEFCORENAME: ::c_int = 45; | ||
473 | pub const KERN_LOGSIGEXIT: ::c_int = 46; | ||
474 | pub const KERN_PROC2: ::c_int = 47; | ||
475 | pub const KERN_PROC_ARGS: ::c_int = 48; | ||
476 | pub const KERN_FSCALE: ::c_int = 49; | ||
477 | pub const KERN_CCPU: ::c_int = 50; | ||
478 | pub const KERN_CP_TIME: ::c_int = 51; | ||
479 | pub const KERN_OLDSYSVIPC_INFO: ::c_int = 52; | ||
480 | pub const KERN_MSGBUF: ::c_int = 53; | ||
481 | pub const KERN_CONSDEV: ::c_int = 54; | ||
482 | pub const KERN_MAXPTYS: ::c_int = 55; | ||
483 | pub const KERN_PIPE: ::c_int = 56; | ||
484 | pub const KERN_MAXPHYS: ::c_int = 57; | ||
485 | pub const KERN_SBMAX: ::c_int = 58; | ||
486 | pub const KERN_TKSTAT: ::c_int = 59; | ||
487 | pub const KERN_MONOTONIC_CLOCK: ::c_int = 60; | ||
488 | pub const KERN_URND: ::c_int = 61; | ||
489 | pub const KERN_LABELSECTOR: ::c_int = 62; | ||
490 | pub const KERN_LABELOFFSET: ::c_int = 63; | ||
491 | pub const KERN_LWP: ::c_int = 64; | ||
492 | pub const KERN_FORKFSLEEP: ::c_int = 65; | ||
493 | pub const KERN_POSIX_THREADS: ::c_int = 66; | ||
494 | pub const KERN_POSIX_SEMAPHORES: ::c_int = 67; | ||
495 | pub const KERN_POSIX_BARRIERS: ::c_int = 68; | ||
496 | pub const KERN_POSIX_TIMERS: ::c_int = 69; | ||
497 | pub const KERN_POSIX_SPIN_LOCKS: ::c_int = 70; | ||
498 | pub const KERN_POSIX_READER_WRITER_LOCKS: ::c_int = 71; | ||
499 | pub const KERN_DUMP_ON_PANIC: ::c_int = 72; | ||
500 | pub const KERN_SOMAXKVA: ::c_int = 73; | ||
501 | pub const KERN_ROOT_PARTITION: ::c_int = 74; | ||
502 | pub const KERN_DRIVERS: ::c_int = 75; | ||
503 | pub const KERN_BUF: ::c_int = 76; | ||
504 | pub const KERN_FILE2: ::c_int = 77; | ||
505 | pub const KERN_VERIEXEC: ::c_int = 78; | ||
506 | pub const KERN_CP_ID: ::c_int = 79; | ||
507 | pub const KERN_HARDCLOCK_TICKS: ::c_int = 80; | ||
508 | pub const KERN_ARND: ::c_int = 81; | ||
509 | pub const KERN_SYSVIPC: ::c_int = 82; | ||
510 | pub const KERN_BOOTTIME: ::c_int = 83; | ||
511 | pub const KERN_EVCNT: ::c_int = 84; | ||
512 | pub const KERN_MAXID: ::c_int = 85; | ||
513 | pub const KERN_PROC_ALL: ::c_int = 0; | ||
514 | pub const KERN_PROC_PID: ::c_int = 1; | ||
515 | pub const KERN_PROC_PGRP: ::c_int = 2; | ||
516 | pub const KERN_PROC_SESSION: ::c_int = 3; | ||
517 | pub const KERN_PROC_TTY: ::c_int = 4; | ||
518 | pub const KERN_PROC_UID: ::c_int = 5; | ||
519 | pub const KERN_PROC_RUID: ::c_int = 6; | ||
520 | pub const KERN_PROC_GID: ::c_int = 7; | ||
521 | pub const KERN_PROC_RGID: ::c_int = 8; | ||
522 | |||
523 | extern { | ||
524 | pub fn getnameinfo(sa: *const ::sockaddr, | ||
525 | salen: ::socklen_t, | ||
526 | host: *mut ::c_char, | ||
527 | hostlen: ::socklen_t, | ||
528 | serv: *mut ::c_char, | ||
529 | sevlen: ::socklen_t, | ||
530 | flags: ::c_int) -> ::c_int; | ||
531 | pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) | ||
532 | -> ::c_int; | ||
533 | pub fn sysctl(name: *const ::c_int, | ||
534 | namelen: ::c_uint, | ||
535 | oldp: *mut ::c_void, | ||
536 | oldlenp: *mut ::size_t, | ||
537 | newp: *const ::c_void, | ||
538 | newlen: ::size_t) | ||
539 | -> ::c_int; | ||
540 | pub fn sysctlbyname(name: *const ::c_char, | ||
541 | oldp: *mut ::c_void, | ||
542 | oldlenp: *mut ::size_t, | ||
543 | newp: *const ::c_void, | ||
544 | newlen: ::size_t) | ||
545 | -> ::c_int; | ||
546 | #[link_name = "__kevent50"] | ||
547 | pub fn kevent(kq: ::c_int, | ||
548 | changelist: *const ::kevent, | ||
549 | nchanges: ::size_t, | ||
550 | eventlist: *mut ::kevent, | ||
551 | nevents: ::size_t, | ||
552 | timeout: *const ::timespec) -> ::c_int; | ||
553 | #[link_name = "__mount50"] | ||
554 | pub fn mount(src: *const ::c_char, | ||
555 | target: *const ::c_char, | ||
556 | flags: ::c_int, | ||
557 | data: *mut ::c_void, | ||
558 | size: ::size_t) -> ::c_int; | ||
559 | pub fn ptrace(requeset: ::c_int, | ||
560 | pid: ::pid_t, | ||
561 | addr: *mut ::c_void, | ||
562 | data: ::c_int) -> ::c_int; | ||
563 | pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; | ||
564 | pub fn pthread_setname_np(t: ::pthread_t, | ||
565 | name: *const ::c_char, | ||
566 | arg: *mut ::c_void) -> ::c_int; | ||
567 | pub fn pthread_getattr_np(native: ::pthread_t, | ||
568 | attr: *mut ::pthread_attr_t) -> ::c_int; | ||
569 | pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, | ||
570 | guardsize: *mut ::size_t) -> ::c_int; | ||
571 | pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, | ||
572 | stackaddr: *mut *mut ::c_void, | ||
573 | stacksize: *mut ::size_t) -> ::c_int; | ||
574 | #[link_name = "__sigtimedwait50"] | ||
575 | pub fn sigtimedwait(set: *const sigset_t, | ||
576 | info: *mut siginfo_t, | ||
577 | timeout: *const ::timespec) -> ::c_int; | ||
578 | pub fn sigwaitinfo(set: *const sigset_t, | ||
579 | info: *mut siginfo_t) -> ::c_int; | ||
580 | pub fn duplocale(base: ::locale_t) -> ::locale_t; | ||
581 | pub fn freelocale(loc: ::locale_t); | ||
582 | pub fn localeconv_l(loc: ::locale_t) -> *mut lconv; | ||
583 | pub fn newlocale(mask: ::c_int, | ||
584 | locale: *const ::c_char, | ||
585 | base: ::locale_t) -> ::locale_t; | ||
586 | } | ||
diff --git a/third_party/libc/src/unix/bsd/openbsdlike/openbsd.rs b/third_party/libc/src/unix/bsd/openbsdlike/openbsd.rs new file mode 100644 index 0000000..491ff84 --- /dev/null +++ b/third_party/libc/src/unix/bsd/openbsdlike/openbsd.rs | |||
@@ -0,0 +1,409 @@ | |||
1 | pub type clock_t = i64; | ||
2 | pub type suseconds_t = i64; | ||
3 | pub type dev_t = i32; | ||
4 | pub type sigset_t = ::c_uint; | ||
5 | pub type blksize_t = ::int32_t; | ||
6 | pub type fsblkcnt_t = ::uint64_t; | ||
7 | pub type fsfilcnt_t = ::uint64_t; | ||
8 | pub type pthread_attr_t = *mut ::c_void; | ||
9 | pub type pthread_mutex_t = *mut ::c_void; | ||
10 | pub type pthread_mutexattr_t = *mut ::c_void; | ||
11 | pub type pthread_cond_t = *mut ::c_void; | ||
12 | pub type pthread_condattr_t = *mut ::c_void; | ||
13 | pub type pthread_rwlock_t = *mut ::c_void; | ||
14 | |||
15 | s! { | ||
16 | pub struct dirent { | ||
17 | pub d_fileno: ::ino_t, | ||
18 | pub d_off: ::off_t, | ||
19 | pub d_reclen: u16, | ||
20 | pub d_type: u8, | ||
21 | pub d_namlen: u8, | ||
22 | __d_padding: [u8; 4], | ||
23 | pub d_name: [::c_char; 256], | ||
24 | } | ||
25 | |||
26 | pub struct glob_t { | ||
27 | pub gl_pathc: ::c_int, | ||
28 | __unused1: ::c_int, | ||
29 | pub gl_offs: ::c_int, | ||
30 | __unused2: ::c_int, | ||
31 | pub gl_pathv: *mut *mut ::c_char, | ||
32 | |||
33 | __unused3: *mut ::c_void, | ||
34 | |||
35 | __unused4: *mut ::c_void, | ||
36 | __unused5: *mut ::c_void, | ||
37 | __unused6: *mut ::c_void, | ||
38 | __unused7: *mut ::c_void, | ||
39 | __unused8: *mut ::c_void, | ||
40 | __unused9: *mut ::c_void, | ||
41 | } | ||
42 | |||
43 | pub struct stat { | ||
44 | pub st_mode: ::mode_t, | ||
45 | pub st_dev: ::dev_t, | ||
46 | pub st_ino: ::ino_t, | ||
47 | pub st_nlink: ::nlink_t, | ||
48 | pub st_uid: ::uid_t, | ||
49 | pub st_gid: ::gid_t, | ||
50 | pub st_rdev: ::dev_t, | ||
51 | pub st_atime: ::time_t, | ||
52 | pub st_atime_nsec: ::c_long, | ||
53 | pub st_mtime: ::time_t, | ||
54 | pub st_mtime_nsec: ::c_long, | ||
55 | pub st_ctime: ::time_t, | ||
56 | pub st_ctime_nsec: ::c_long, | ||
57 | pub st_size: ::off_t, | ||
58 | pub st_blocks: ::blkcnt_t, | ||
59 | pub st_blksize: ::blksize_t, | ||
60 | pub st_flags: ::uint32_t, | ||
61 | pub st_gen: ::uint32_t, | ||
62 | pub st_birthtime: ::time_t, | ||
63 | pub st_birthtime_nsec: ::c_long, | ||
64 | } | ||
65 | |||
66 | pub struct statvfs { | ||
67 | pub f_bsize: ::c_ulong, | ||
68 | pub f_frsize: ::c_ulong, | ||
69 | pub f_blocks: ::fsblkcnt_t, | ||
70 | pub f_bfree: ::fsblkcnt_t, | ||
71 | pub f_bavail: ::fsblkcnt_t, | ||
72 | pub f_files: ::fsfilcnt_t, | ||
73 | pub f_ffree: ::fsfilcnt_t, | ||
74 | pub f_favail: ::fsfilcnt_t, | ||
75 | pub f_fsid: ::c_ulong, | ||
76 | pub f_flag: ::c_ulong, | ||
77 | pub f_namemax: ::c_ulong, | ||
78 | } | ||
79 | |||
80 | pub struct addrinfo { | ||
81 | pub ai_flags: ::c_int, | ||
82 | pub ai_family: ::c_int, | ||
83 | pub ai_socktype: ::c_int, | ||
84 | pub ai_protocol: ::c_int, | ||
85 | pub ai_addrlen: ::socklen_t, | ||
86 | pub ai_addr: *mut ::sockaddr, | ||
87 | pub ai_canonname: *mut ::c_char, | ||
88 | pub ai_next: *mut ::addrinfo, | ||
89 | } | ||
90 | |||
91 | pub struct sockaddr_storage { | ||
92 | pub ss_len: u8, | ||
93 | pub ss_family: ::sa_family_t, | ||
94 | __ss_pad1: [u8; 6], | ||
95 | __ss_pad2: i64, | ||
96 | __ss_pad3: [u8; 240], | ||
97 | } | ||
98 | |||
99 | pub struct siginfo_t { | ||
100 | pub si_signo: ::c_int, | ||
101 | pub si_code: ::c_int, | ||
102 | pub si_errno: ::c_int, | ||
103 | pub si_addr: *mut ::c_char, | ||
104 | __pad: [u8; 108], | ||
105 | } | ||
106 | |||
107 | pub struct Dl_info { | ||
108 | pub dli_fname: *const ::c_char, | ||
109 | pub dli_fbase: *mut ::c_void, | ||
110 | pub dli_sname: *const ::c_char, | ||
111 | pub dli_saddr: *mut ::c_void, | ||
112 | } | ||
113 | |||
114 | pub struct lconv { | ||
115 | pub decimal_point: *mut ::c_char, | ||
116 | pub thousands_sep: *mut ::c_char, | ||
117 | pub grouping: *mut ::c_char, | ||
118 | pub int_curr_symbol: *mut ::c_char, | ||
119 | pub currency_symbol: *mut ::c_char, | ||
120 | pub mon_decimal_point: *mut ::c_char, | ||
121 | pub mon_thousands_sep: *mut ::c_char, | ||
122 | pub mon_grouping: *mut ::c_char, | ||
123 | pub positive_sign: *mut ::c_char, | ||
124 | pub negative_sign: *mut ::c_char, | ||
125 | pub int_frac_digits: ::c_char, | ||
126 | pub frac_digits: ::c_char, | ||
127 | pub p_cs_precedes: ::c_char, | ||
128 | pub p_sep_by_space: ::c_char, | ||
129 | pub n_cs_precedes: ::c_char, | ||
130 | pub n_sep_by_space: ::c_char, | ||
131 | pub p_sign_posn: ::c_char, | ||
132 | pub n_sign_posn: ::c_char, | ||
133 | pub int_p_cs_precedes: ::c_char, | ||
134 | pub int_p_sep_by_space: ::c_char, | ||
135 | pub int_n_cs_precedes: ::c_char, | ||
136 | pub int_n_sep_by_space: ::c_char, | ||
137 | pub int_p_sign_posn: ::c_char, | ||
138 | pub int_n_sign_posn: ::c_char, | ||
139 | } | ||
140 | |||
141 | pub struct lastlog { | ||
142 | ll_time: ::time_t, | ||
143 | ll_line: [::c_char; UT_LINESIZE], | ||
144 | ll_host: [::c_char; UT_HOSTSIZE], | ||
145 | } | ||
146 | |||
147 | pub struct utmp { | ||
148 | pub ut_line: [::c_char; UT_LINESIZE], | ||
149 | pub ut_name: [::c_char; UT_NAMESIZE], | ||
150 | pub ut_host: [::c_char; UT_HOSTSIZE], | ||
151 | pub ut_time: ::time_t, | ||
152 | } | ||
153 | } | ||
154 | |||
155 | pub const UT_NAMESIZE: usize = 32; | ||
156 | pub const UT_LINESIZE: usize = 8; | ||
157 | pub const UT_HOSTSIZE: usize = 256; | ||
158 | |||
159 | pub const O_CLOEXEC: ::c_int = 0x10000; | ||
160 | |||
161 | pub const MS_SYNC : ::c_int = 0x0002; | ||
162 | pub const MS_INVALIDATE : ::c_int = 0x0004; | ||
163 | |||
164 | pub const PTHREAD_STACK_MIN : ::size_t = 2048; | ||
165 | |||
166 | pub const ENOATTR : ::c_int = 83; | ||
167 | pub const EILSEQ : ::c_int = 84; | ||
168 | pub const EOVERFLOW : ::c_int = 87; | ||
169 | pub const ECANCELED : ::c_int = 88; | ||
170 | pub const EIDRM : ::c_int = 89; | ||
171 | pub const ENOMSG : ::c_int = 90; | ||
172 | pub const ENOTSUP : ::c_int = 91; | ||
173 | pub const ELAST : ::c_int = 91; | ||
174 | |||
175 | pub const F_DUPFD_CLOEXEC : ::c_int = 10; | ||
176 | |||
177 | pub const RLIM_NLIMITS: ::c_int = 9; | ||
178 | |||
179 | pub const SO_SNDTIMEO: ::c_int = 0x1005; | ||
180 | pub const SO_RCVTIMEO: ::c_int = 0x1006; | ||
181 | |||
182 | pub const IPV6_JOIN_GROUP: ::c_int = 12; | ||
183 | pub const IPV6_LEAVE_GROUP: ::c_int = 13; | ||
184 | |||
185 | pub const O_DSYNC : ::c_int = 128; | ||
186 | |||
187 | pub const MAP_RENAME : ::c_int = 0x0000; | ||
188 | pub const MAP_NORESERVE : ::c_int = 0x0000; | ||
189 | pub const MAP_HASSEMAPHORE : ::c_int = 0x0000; | ||
190 | |||
191 | pub const EIPSEC : ::c_int = 82; | ||
192 | pub const ENOMEDIUM : ::c_int = 85; | ||
193 | pub const EMEDIUMTYPE : ::c_int = 86; | ||
194 | |||
195 | pub const RUSAGE_THREAD: ::c_int = 1; | ||
196 | |||
197 | pub const MAP_COPY : ::c_int = 0x0002; | ||
198 | pub const MAP_NOEXTEND : ::c_int = 0x0000; | ||
199 | |||
200 | pub const _SC_CLK_TCK : ::c_int = 3; | ||
201 | pub const _SC_IOV_MAX : ::c_int = 51; | ||
202 | pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100; | ||
203 | pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101; | ||
204 | pub const _SC_LOGIN_NAME_MAX : ::c_int = 102; | ||
205 | pub const _SC_MQ_PRIO_MAX : ::c_int = 59; | ||
206 | pub const _SC_NPROCESSORS_ONLN : ::c_int = 503; | ||
207 | pub const _SC_THREADS : ::c_int = 91; | ||
208 | pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77; | ||
209 | pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78; | ||
210 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80; | ||
211 | pub const _SC_THREAD_KEYS_MAX : ::c_int = 81; | ||
212 | pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82; | ||
213 | pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83; | ||
214 | pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84; | ||
215 | pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85; | ||
216 | pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103; | ||
217 | pub const _SC_THREAD_STACK_MIN : ::c_int = 89; | ||
218 | pub const _SC_THREAD_THREADS_MAX : ::c_int = 90; | ||
219 | pub const _SC_TTY_NAME_MAX : ::c_int = 107; | ||
220 | pub const _SC_ATEXIT_MAX : ::c_int = 46; | ||
221 | pub const _SC_AIO_LISTIO_MAX : ::c_int = 42; | ||
222 | pub const _SC_AIO_MAX : ::c_int = 43; | ||
223 | pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45; | ||
224 | pub const _SC_MAPPED_FILES : ::c_int = 53; | ||
225 | pub const _SC_MEMLOCK : ::c_int = 54; | ||
226 | pub const _SC_MEMLOCK_RANGE : ::c_int = 55; | ||
227 | pub const _SC_MEMORY_PROTECTION : ::c_int = 56; | ||
228 | pub const _SC_MESSAGE_PASSING : ::c_int = 57; | ||
229 | pub const _SC_MQ_OPEN_MAX : ::c_int = 58; | ||
230 | pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61; | ||
231 | pub const _SC_SEMAPHORES : ::c_int = 67; | ||
232 | pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68; | ||
233 | pub const _SC_SYNCHRONIZED_IO : ::c_int = 75; | ||
234 | pub const _SC_TIMERS : ::c_int = 94; | ||
235 | pub const _SC_XOPEN_CRYPT : ::c_int = 117; | ||
236 | pub const _SC_XOPEN_ENH_I18N : ::c_int = 118; | ||
237 | pub const _SC_XOPEN_LEGACY : ::c_int = 119; | ||
238 | pub const _SC_XOPEN_REALTIME : ::c_int = 120; | ||
239 | pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121; | ||
240 | pub const _SC_XOPEN_UNIX : ::c_int = 123; | ||
241 | pub const _SC_XOPEN_VERSION : ::c_int = 125; | ||
242 | pub const _SC_SEM_NSEMS_MAX : ::c_int = 31; | ||
243 | pub const _SC_SEM_VALUE_MAX : ::c_int = 32; | ||
244 | pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44; | ||
245 | pub const _SC_DELAYTIMER_MAX : ::c_int = 50; | ||
246 | pub const _SC_PRIORITIZED_IO : ::c_int = 60; | ||
247 | pub const _SC_REALTIME_SIGNALS : ::c_int = 64; | ||
248 | pub const _SC_RTSIG_MAX : ::c_int = 66; | ||
249 | pub const _SC_SIGQUEUE_MAX : ::c_int = 70; | ||
250 | pub const _SC_TIMER_MAX : ::c_int = 93; | ||
251 | pub const _SC_HOST_NAME_MAX : ::c_int = 33; | ||
252 | |||
253 | pub const FD_SETSIZE: usize = 1024; | ||
254 | |||
255 | pub const ST_NOSUID: ::c_ulong = 2; | ||
256 | |||
257 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _; | ||
258 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _; | ||
259 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _; | ||
260 | |||
261 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1; | ||
262 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; | ||
263 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3; | ||
264 | pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4; | ||
265 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP; | ||
266 | |||
267 | pub const TMP_MAX : ::c_uint = 0x7fffffff; | ||
268 | |||
269 | pub const NI_MAXHOST: ::size_t = 256; | ||
270 | |||
271 | pub const RTLD_LOCAL: ::c_int = 0; | ||
272 | pub const CTL_MAXNAME: ::c_int = 12; | ||
273 | pub const CTLTYPE_NODE: ::c_int = 1; | ||
274 | pub const CTLTYPE_INT: ::c_int = 2; | ||
275 | pub const CTLTYPE_STRING: ::c_int = 3; | ||
276 | pub const CTLTYPE_QUAD: ::c_int = 4; | ||
277 | pub const CTLTYPE_STRUCT: ::c_int = 5; | ||
278 | pub const CTL_UNSPEC: ::c_int = 0; | ||
279 | pub const CTL_KERN: ::c_int = 1; | ||
280 | pub const CTL_VM: ::c_int = 2; | ||
281 | pub const CTL_FS: ::c_int = 3; | ||
282 | pub const CTL_NET: ::c_int = 4; | ||
283 | pub const CTL_DEBUG: ::c_int = 5; | ||
284 | pub const CTL_HW: ::c_int = 6; | ||
285 | pub const CTL_MACHDEP: ::c_int = 7; | ||
286 | pub const CTL_DDB: ::c_int = 9; | ||
287 | pub const CTL_VFS: ::c_int = 10; | ||
288 | pub const CTL_MAXID: ::c_int = 11; | ||
289 | pub const KERN_OSTYPE: ::c_int = 1; | ||
290 | pub const KERN_OSRELEASE: ::c_int = 2; | ||
291 | pub const KERN_OSREV: ::c_int = 3; | ||
292 | pub const KERN_VERSION: ::c_int = 4; | ||
293 | pub const KERN_MAXVNODES: ::c_int = 5; | ||
294 | pub const KERN_MAXPROC: ::c_int = 6; | ||
295 | pub const KERN_MAXFILES: ::c_int = 7; | ||
296 | pub const KERN_ARGMAX: ::c_int = 8; | ||
297 | pub const KERN_SECURELVL: ::c_int = 9; | ||
298 | pub const KERN_HOSTNAME: ::c_int = 10; | ||
299 | pub const KERN_HOSTID: ::c_int = 11; | ||
300 | pub const KERN_CLOCKRATE: ::c_int = 12; | ||
301 | pub const KERN_PROF: ::c_int = 16; | ||
302 | pub const KERN_POSIX1: ::c_int = 17; | ||
303 | pub const KERN_NGROUPS: ::c_int = 18; | ||
304 | pub const KERN_JOB_CONTROL: ::c_int = 19; | ||
305 | pub const KERN_SAVED_IDS: ::c_int = 20; | ||
306 | pub const KERN_BOOTTIME: ::c_int = 21; | ||
307 | pub const KERN_DOMAINNAME: ::c_int = 22; | ||
308 | pub const KERN_MAXPARTITIONS: ::c_int = 23; | ||
309 | pub const KERN_RAWPARTITION: ::c_int = 24; | ||
310 | pub const KERN_MAXTHREAD: ::c_int = 25; | ||
311 | pub const KERN_NTHREADS: ::c_int = 26; | ||
312 | pub const KERN_OSVERSION: ::c_int = 27; | ||
313 | pub const KERN_SOMAXCONN: ::c_int = 28; | ||
314 | pub const KERN_SOMINCONN: ::c_int = 29; | ||
315 | pub const KERN_USERMOUNT: ::c_int = 30; | ||
316 | pub const KERN_RND: ::c_int = 31; | ||
317 | pub const KERN_NOSUIDCOREDUMP: ::c_int = 32; | ||
318 | pub const KERN_FSYNC: ::c_int = 33; | ||
319 | pub const KERN_SYSVMSG: ::c_int = 34; | ||
320 | pub const KERN_SYSVSEM: ::c_int = 35; | ||
321 | pub const KERN_SYSVSHM: ::c_int = 36; | ||
322 | pub const KERN_ARND: ::c_int = 37; | ||
323 | pub const KERN_MSGBUFSIZE: ::c_int = 38; | ||
324 | pub const KERN_MALLOCSTATS: ::c_int = 39; | ||
325 | pub const KERN_CPTIME: ::c_int = 40; | ||
326 | pub const KERN_NCHSTATS: ::c_int = 41; | ||
327 | pub const KERN_FORKSTAT: ::c_int = 42; | ||
328 | pub const KERN_NSELCOLL: ::c_int = 43; | ||
329 | pub const KERN_TTY: ::c_int = 44; | ||
330 | pub const KERN_CCPU: ::c_int = 45; | ||
331 | pub const KERN_FSCALE: ::c_int = 46; | ||
332 | pub const KERN_NPROCS: ::c_int = 47; | ||
333 | pub const KERN_MSGBUF: ::c_int = 48; | ||
334 | pub const KERN_POOL: ::c_int = 49; | ||
335 | pub const KERN_STACKGAPRANDOM: ::c_int = 50; | ||
336 | pub const KERN_SYSVIPC_INFO: ::c_int = 51; | ||
337 | pub const KERN_SPLASSERT: ::c_int = 54; | ||
338 | pub const KERN_PROC_ARGS: ::c_int = 55; | ||
339 | pub const KERN_NFILES: ::c_int = 56; | ||
340 | pub const KERN_TTYCOUNT: ::c_int = 57; | ||
341 | pub const KERN_NUMVNODES: ::c_int = 58; | ||
342 | pub const KERN_MBSTAT: ::c_int = 59; | ||
343 | pub const KERN_SEMINFO: ::c_int = 61; | ||
344 | pub const KERN_SHMINFO: ::c_int = 62; | ||
345 | pub const KERN_INTRCNT: ::c_int = 63; | ||
346 | pub const KERN_WATCHDOG: ::c_int = 64; | ||
347 | pub const KERN_PROC: ::c_int = 66; | ||
348 | pub const KERN_MAXCLUSTERS: ::c_int = 67; | ||
349 | pub const KERN_EVCOUNT: ::c_int = 68; | ||
350 | pub const KERN_TIMECOUNTER: ::c_int = 69; | ||
351 | pub const KERN_MAXLOCKSPERUID: ::c_int = 70; | ||
352 | pub const KERN_CPTIME2: ::c_int = 71; | ||
353 | pub const KERN_CACHEPCT: ::c_int = 72; | ||
354 | pub const KERN_FILE: ::c_int = 73; | ||
355 | pub const KERN_CONSDEV: ::c_int = 75; | ||
356 | pub const KERN_NETLIVELOCKS: ::c_int = 76; | ||
357 | pub const KERN_POOL_DEBUG: ::c_int = 77; | ||
358 | pub const KERN_PROC_CWD: ::c_int = 78; | ||
359 | pub const KERN_PROC_NOBROADCASTKILL: ::c_int = 79; | ||
360 | pub const KERN_PROC_VMMAP: ::c_int = 80; | ||
361 | pub const KERN_GLOBAL_PTRACE: ::c_int = 81; | ||
362 | pub const KERN_CONSBUFSIZE: ::c_int = 82; | ||
363 | pub const KERN_CONSBUF: ::c_int = 83; | ||
364 | pub const KERN_MAXID: ::c_int = 84; | ||
365 | pub const KERN_PROC_ALL: ::c_int = 0; | ||
366 | pub const KERN_PROC_PID: ::c_int = 1; | ||
367 | pub const KERN_PROC_PGRP: ::c_int = 2; | ||
368 | pub const KERN_PROC_SESSION: ::c_int = 3; | ||
369 | pub const KERN_PROC_TTY: ::c_int = 4; | ||
370 | pub const KERN_PROC_UID: ::c_int = 5; | ||
371 | pub const KERN_PROC_RUID: ::c_int = 6; | ||
372 | pub const KERN_PROC_KTHREAD: ::c_int = 7; | ||
373 | pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000; | ||
374 | pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1; | ||
375 | pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2; | ||
376 | pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3; | ||
377 | pub const KERN_PROC_ARGV: ::c_int = 1; | ||
378 | pub const KERN_PROC_NARGV: ::c_int = 2; | ||
379 | pub const KERN_PROC_ENV: ::c_int = 3; | ||
380 | pub const KERN_PROC_NENV: ::c_int = 4; | ||
381 | pub const KI_NGROUPS: ::c_int = 16; | ||
382 | pub const KI_MAXCOMLEN: ::c_int = 24; | ||
383 | pub const KI_WMESGLEN: ::c_int = 8; | ||
384 | pub const KI_MAXLOGNAME: ::c_int = 32; | ||
385 | pub const KI_EMULNAMELEN: ::c_int = 8; | ||
386 | |||
387 | extern { | ||
388 | pub fn getnameinfo(sa: *const ::sockaddr, | ||
389 | salen: ::socklen_t, | ||
390 | host: *mut ::c_char, | ||
391 | hostlen: ::size_t, | ||
392 | serv: *mut ::c_char, | ||
393 | servlen: ::size_t, | ||
394 | flags: ::c_int) -> ::c_int; | ||
395 | pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) | ||
396 | -> ::c_int; | ||
397 | pub fn pthread_main_np() -> ::c_int; | ||
398 | pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); | ||
399 | pub fn pthread_stackseg_np(thread: ::pthread_t, | ||
400 | sinfo: *mut ::stack_t) -> ::c_int; | ||
401 | pub fn sysctl(name: *const ::c_int, | ||
402 | namelen: ::c_uint, | ||
403 | oldp: *mut ::c_void, | ||
404 | oldlenp: *mut ::size_t, | ||
405 | newp: *mut ::c_void, | ||
406 | newlen: ::size_t) | ||
407 | -> ::c_int; | ||
408 | pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; | ||
409 | } | ||
diff --git a/third_party/libc/src/unix/mod.rs b/third_party/libc/src/unix/mod.rs new file mode 100644 index 0000000..648a7aa --- /dev/null +++ b/third_party/libc/src/unix/mod.rs | |||
@@ -0,0 +1,851 @@ | |||
1 | //! Definitions found commonly among almost all Unix derivatives | ||
2 | //! | ||
3 | //! More functions and definitions can be found in the more specific modules | ||
4 | //! according to the platform in question. | ||
5 | |||
6 | use dox::Option; | ||
7 | |||
8 | pub type pid_t = i32; | ||
9 | pub type uid_t = u32; | ||
10 | pub type gid_t = u32; | ||
11 | pub type in_addr_t = u32; | ||
12 | pub type in_port_t = u16; | ||
13 | pub type sighandler_t = ::size_t; | ||
14 | pub type cc_t = ::c_uchar; | ||
15 | |||
16 | pub enum DIR {} | ||
17 | pub enum locale_t {} | ||
18 | |||
19 | s! { | ||
20 | pub struct group { | ||
21 | pub gr_name: *mut ::c_char, | ||
22 | pub gr_passwd: *mut ::c_char, | ||
23 | pub gr_gid: ::gid_t, | ||
24 | pub gr_mem: *mut *mut ::c_char, | ||
25 | } | ||
26 | |||
27 | pub struct utimbuf { | ||
28 | pub actime: time_t, | ||
29 | pub modtime: time_t, | ||
30 | } | ||
31 | |||
32 | pub struct timeval { | ||
33 | pub tv_sec: time_t, | ||
34 | pub tv_usec: suseconds_t, | ||
35 | } | ||
36 | |||
37 | pub struct timespec { | ||
38 | pub tv_sec: time_t, | ||
39 | pub tv_nsec: c_long, | ||
40 | } | ||
41 | |||
42 | pub struct rlimit { | ||
43 | pub rlim_cur: rlim_t, | ||
44 | pub rlim_max: rlim_t, | ||
45 | } | ||
46 | |||
47 | pub struct rusage { | ||
48 | pub ru_utime: timeval, | ||
49 | pub ru_stime: timeval, | ||
50 | pub ru_maxrss: c_long, | ||
51 | pub ru_ixrss: c_long, | ||
52 | pub ru_idrss: c_long, | ||
53 | pub ru_isrss: c_long, | ||
54 | pub ru_minflt: c_long, | ||
55 | pub ru_majflt: c_long, | ||
56 | pub ru_nswap: c_long, | ||
57 | pub ru_inblock: c_long, | ||
58 | pub ru_oublock: c_long, | ||
59 | pub ru_msgsnd: c_long, | ||
60 | pub ru_msgrcv: c_long, | ||
61 | pub ru_nsignals: c_long, | ||
62 | pub ru_nvcsw: c_long, | ||
63 | pub ru_nivcsw: c_long, | ||
64 | |||
65 | #[cfg(any(target_env = "musl"))] | ||
66 | __reserved: [c_long; 16], | ||
67 | } | ||
68 | |||
69 | #[cfg_attr(target_os = "netbsd", repr(packed))] | ||
70 | pub struct in_addr { | ||
71 | pub s_addr: in_addr_t, | ||
72 | } | ||
73 | |||
74 | pub struct in6_addr { | ||
75 | pub s6_addr: [u8; 16], | ||
76 | __align: [u32; 0], | ||
77 | } | ||
78 | |||
79 | pub struct ip_mreq { | ||
80 | pub imr_multiaddr: in_addr, | ||
81 | pub imr_interface: in_addr, | ||
82 | } | ||
83 | |||
84 | pub struct ipv6_mreq { | ||
85 | pub ipv6mr_multiaddr: in6_addr, | ||
86 | #[cfg(target_os = "android")] | ||
87 | pub ipv6mr_interface: ::c_int, | ||
88 | #[cfg(not(target_os = "android"))] | ||
89 | pub ipv6mr_interface: ::c_uint, | ||
90 | } | ||
91 | |||
92 | pub struct hostent { | ||
93 | pub h_name: *mut ::c_char, | ||
94 | pub h_aliases: *mut *mut ::c_char, | ||
95 | pub h_addrtype: ::c_int, | ||
96 | pub h_length: ::c_int, | ||
97 | pub h_addr_list: *mut *mut ::c_char, | ||
98 | } | ||
99 | |||
100 | pub struct iovec { | ||
101 | pub iov_base: *mut ::c_void, | ||
102 | pub iov_len: ::size_t, | ||
103 | } | ||
104 | |||
105 | pub struct pollfd { | ||
106 | pub fd: ::c_int, | ||
107 | pub events: ::c_short, | ||
108 | pub revents: ::c_short, | ||
109 | } | ||
110 | |||
111 | pub struct winsize { | ||
112 | pub ws_row: ::c_ushort, | ||
113 | pub ws_col: ::c_ushort, | ||
114 | pub ws_xpixel: ::c_ushort, | ||
115 | pub ws_ypixel: ::c_ushort, | ||
116 | } | ||
117 | |||
118 | pub struct linger { | ||
119 | pub l_onoff: ::c_int, | ||
120 | pub l_linger: ::c_int, | ||
121 | } | ||
122 | } | ||
123 | |||
124 | pub const SIG_DFL: sighandler_t = 0 as sighandler_t; | ||
125 | pub const SIG_IGN: sighandler_t = 1 as sighandler_t; | ||
126 | pub const SIG_ERR: sighandler_t = !0 as sighandler_t; | ||
127 | |||
128 | pub const DT_FIFO: u8 = 1; | ||
129 | pub const DT_CHR: u8 = 2; | ||
130 | pub const DT_DIR: u8 = 4; | ||
131 | pub const DT_BLK: u8 = 6; | ||
132 | pub const DT_REG: u8 = 8; | ||
133 | pub const DT_LNK: u8 = 10; | ||
134 | pub const DT_SOCK: u8 = 12; | ||
135 | |||
136 | pub const FD_CLOEXEC: ::c_int = 0x1; | ||
137 | |||
138 | pub const USRQUOTA: ::c_int = 0; | ||
139 | pub const GRPQUOTA: ::c_int = 1; | ||
140 | |||
141 | pub const SIGIOT: ::c_int = 6; | ||
142 | |||
143 | pub const S_ISUID: ::c_int = 0x800; | ||
144 | pub const S_ISGID: ::c_int = 0x400; | ||
145 | pub const S_ISVTX: ::c_int = 0x200; | ||
146 | |||
147 | pub const POLLIN: ::c_short = 0x1; | ||
148 | pub const POLLPRI: ::c_short = 0x2; | ||
149 | pub const POLLOUT: ::c_short = 0x4; | ||
150 | pub const POLLERR: ::c_short = 0x8; | ||
151 | pub const POLLHUP: ::c_short = 0x10; | ||
152 | pub const POLLNVAL: ::c_short = 0x20; | ||
153 | |||
154 | pub const IF_NAMESIZE: ::size_t = 16; | ||
155 | |||
156 | pub const RTLD_LAZY: ::c_int = 0x1; | ||
157 | |||
158 | pub const LOG_EMERG: ::c_int = 0; | ||
159 | pub const LOG_ALERT: ::c_int = 1; | ||
160 | pub const LOG_CRIT: ::c_int = 2; | ||
161 | pub const LOG_ERR: ::c_int = 3; | ||
162 | pub const LOG_WARNING: ::c_int = 4; | ||
163 | pub const LOG_NOTICE: ::c_int = 5; | ||
164 | pub const LOG_INFO: ::c_int = 6; | ||
165 | pub const LOG_DEBUG: ::c_int = 7; | ||
166 | |||
167 | pub const LOG_KERN: ::c_int = 0; | ||
168 | pub const LOG_USER: ::c_int = 1 << 3; | ||
169 | pub const LOG_MAIL: ::c_int = 2 << 3; | ||
170 | pub const LOG_DAEMON: ::c_int = 3 << 3; | ||
171 | pub const LOG_AUTH: ::c_int = 4 << 3; | ||
172 | pub const LOG_SYSLOG: ::c_int = 5 << 3; | ||
173 | pub const LOG_LPR: ::c_int = 6 << 3; | ||
174 | pub const LOG_NEWS: ::c_int = 7 << 3; | ||
175 | pub const LOG_UUCP: ::c_int = 8 << 3; | ||
176 | pub const LOG_LOCAL0: ::c_int = 16 << 3; | ||
177 | pub const LOG_LOCAL1: ::c_int = 17 << 3; | ||
178 | pub const LOG_LOCAL2: ::c_int = 18 << 3; | ||
179 | pub const LOG_LOCAL3: ::c_int = 19 << 3; | ||
180 | pub const LOG_LOCAL4: ::c_int = 20 << 3; | ||
181 | pub const LOG_LOCAL5: ::c_int = 21 << 3; | ||
182 | pub const LOG_LOCAL6: ::c_int = 22 << 3; | ||
183 | pub const LOG_LOCAL7: ::c_int = 23 << 3; | ||
184 | |||
185 | pub const LOG_PID: ::c_int = 0x01; | ||
186 | pub const LOG_CONS: ::c_int = 0x02; | ||
187 | pub const LOG_ODELAY: ::c_int = 0x04; | ||
188 | pub const LOG_NDELAY: ::c_int = 0x08; | ||
189 | pub const LOG_NOWAIT: ::c_int = 0x10; | ||
190 | |||
191 | pub const LOG_PRIMASK: ::c_int = 7; | ||
192 | pub const LOG_FACMASK: ::c_int = 0x3f8; | ||
193 | |||
194 | pub const PRIO_PROCESS: ::c_int = 0; | ||
195 | pub const PRIO_PGRP: ::c_int = 1; | ||
196 | pub const PRIO_USER: ::c_int = 2; | ||
197 | |||
198 | pub const PRIO_MIN: ::c_int = -20; | ||
199 | pub const PRIO_MAX: ::c_int = 20; | ||
200 | |||
201 | cfg_if! { | ||
202 | if #[cfg(dox)] { | ||
203 | // on dox builds don't pull in anything | ||
204 | } else if #[cfg(all(not(stdbuild), feature = "use_std"))] { | ||
205 | // cargo build, don't pull in anything extra as the libstd dep | ||
206 | // already pulls in all libs. | ||
207 | } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] { | ||
208 | #[link(name = "c", kind = "static")] | ||
209 | extern {} | ||
210 | } else if #[cfg(target_os = "emscripten")] { | ||
211 | #[link(name = "c")] | ||
212 | extern {} | ||
213 | } else if #[cfg(all(target_os = "netbsd", target_vendor = "rumprun"))] { | ||
214 | // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled | ||
215 | // in automatically by the linker. We avoid passing it explicitly, as it | ||
216 | // causes some versions of binutils to crash with an assertion failure. | ||
217 | #[link(name = "m")] | ||
218 | extern {} | ||
219 | } else if #[cfg(any(target_os = "macos", | ||
220 | target_os = "ios", | ||
221 | target_os = "android", | ||
222 | target_os = "openbsd", | ||
223 | target_os = "bitrig"))] { | ||
224 | #[link(name = "c")] | ||
225 | #[link(name = "m")] | ||
226 | extern {} | ||
227 | } else { | ||
228 | #[link(name = "c")] | ||
229 | #[link(name = "m")] | ||
230 | #[link(name = "rt")] | ||
231 | extern {} | ||
232 | } | ||
233 | } | ||
234 | |||
235 | extern { | ||
236 | pub fn getgrnam(name: *const ::c_char) -> *mut group; | ||
237 | pub fn getgrgid(gid: ::gid_t) -> *mut group; | ||
238 | |||
239 | pub fn endpwent(); | ||
240 | #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] | ||
241 | pub fn getpwnam(name: *const ::c_char) -> *mut passwd; | ||
242 | #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")] | ||
243 | pub fn getpwuid(uid: ::uid_t) -> *mut passwd; | ||
244 | |||
245 | pub fn fprintf(stream: *mut ::FILE, | ||
246 | format: *const ::c_char, ...) -> ::c_int; | ||
247 | pub fn printf(format: *const ::c_char, ...) -> ::c_int; | ||
248 | pub fn snprintf(s: *mut ::c_char, n: ::size_t, | ||
249 | format: *const ::c_char, ...) -> ::c_int; | ||
250 | pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; | ||
251 | pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; | ||
252 | pub fn scanf(format: *const ::c_char, ...) -> ::c_int; | ||
253 | pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; | ||
254 | |||
255 | #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] | ||
256 | pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; | ||
257 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
258 | link_name = "connect$UNIX2003")] | ||
259 | pub fn connect(socket: ::c_int, address: *const sockaddr, | ||
260 | len: socklen_t) -> ::c_int; | ||
261 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
262 | link_name = "bind$UNIX2003")] | ||
263 | pub fn bind(socket: ::c_int, address: *const sockaddr, | ||
264 | address_len: socklen_t) -> ::c_int; | ||
265 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
266 | link_name = "listen$UNIX2003")] | ||
267 | pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; | ||
268 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
269 | link_name = "accept$UNIX2003")] | ||
270 | pub fn accept(socket: ::c_int, address: *mut sockaddr, | ||
271 | address_len: *mut socklen_t) -> ::c_int; | ||
272 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
273 | link_name = "getpeername$UNIX2003")] | ||
274 | pub fn getpeername(socket: ::c_int, address: *mut sockaddr, | ||
275 | address_len: *mut socklen_t) -> ::c_int; | ||
276 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
277 | link_name = "getsockname$UNIX2003")] | ||
278 | pub fn getsockname(socket: ::c_int, address: *mut sockaddr, | ||
279 | address_len: *mut socklen_t) -> ::c_int; | ||
280 | pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int, | ||
281 | value: *const ::c_void, | ||
282 | option_len: socklen_t) -> ::c_int; | ||
283 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
284 | link_name = "socketpair$UNIX2003")] | ||
285 | pub fn socketpair(domain: ::c_int, type_: ::c_int, protocol: ::c_int, | ||
286 | socket_vector: *mut ::c_int) -> ::c_int; | ||
287 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
288 | link_name = "sendto$UNIX2003")] | ||
289 | pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t, | ||
290 | flags: ::c_int, addr: *const sockaddr, | ||
291 | addrlen: socklen_t) -> ::ssize_t; | ||
292 | pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; | ||
293 | |||
294 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
295 | link_name = "chmod$UNIX2003")] | ||
296 | pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; | ||
297 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
298 | link_name = "fchmod$UNIX2003")] | ||
299 | pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; | ||
300 | |||
301 | #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")] | ||
302 | #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] | ||
303 | pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; | ||
304 | |||
305 | pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; | ||
306 | |||
307 | #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")] | ||
308 | #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] | ||
309 | pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; | ||
310 | |||
311 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
312 | link_name = "popen$UNIX2003")] | ||
313 | pub fn popen(command: *const c_char, | ||
314 | mode: *const c_char) -> *mut ::FILE; | ||
315 | pub fn pclose(stream: *mut ::FILE) -> ::c_int; | ||
316 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
317 | link_name = "fdopen$UNIX2003")] | ||
318 | pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; | ||
319 | pub fn fileno(stream: *mut ::FILE) -> ::c_int; | ||
320 | |||
321 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
322 | link_name = "open$UNIX2003")] | ||
323 | pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; | ||
324 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
325 | link_name = "creat$UNIX2003")] | ||
326 | pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; | ||
327 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
328 | link_name = "fcntl$UNIX2003")] | ||
329 | pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; | ||
330 | |||
331 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), | ||
332 | link_name = "opendir$INODE64")] | ||
333 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
334 | link_name = "opendir$INODE64$UNIX2003")] | ||
335 | #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] | ||
336 | pub fn opendir(dirname: *const c_char) -> *mut ::DIR; | ||
337 | #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")] | ||
338 | #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] | ||
339 | pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, | ||
340 | result: *mut *mut ::dirent) -> ::c_int; | ||
341 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
342 | link_name = "closedir$UNIX2003")] | ||
343 | pub fn closedir(dirp: *mut ::DIR) -> ::c_int; | ||
344 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), | ||
345 | link_name = "rewinddir$INODE64")] | ||
346 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
347 | link_name = "rewinddir$INODE64$UNIX2003")] | ||
348 | pub fn rewinddir(dirp: *mut ::DIR); | ||
349 | |||
350 | pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; | ||
351 | pub fn alarm(seconds: ::c_uint) -> ::c_uint; | ||
352 | pub fn chdir(dir: *const c_char) -> ::c_int; | ||
353 | pub fn chown(path: *const c_char, uid: uid_t, | ||
354 | gid: gid_t) -> ::c_int; | ||
355 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
356 | link_name = "lchown$UNIX2003")] | ||
357 | pub fn lchown(path: *const c_char, uid: uid_t, | ||
358 | gid: gid_t) -> ::c_int; | ||
359 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
360 | link_name = "close$UNIX2003")] | ||
361 | pub fn close(fd: ::c_int) -> ::c_int; | ||
362 | pub fn dup(fd: ::c_int) -> ::c_int; | ||
363 | pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; | ||
364 | pub fn execv(prog: *const c_char, | ||
365 | argv: *const *const c_char) -> ::c_int; | ||
366 | pub fn execve(prog: *const c_char, argv: *const *const c_char, | ||
367 | envp: *const *const c_char) | ||
368 | -> ::c_int; | ||
369 | pub fn execvp(c: *const c_char, | ||
370 | argv: *const *const c_char) -> ::c_int; | ||
371 | pub fn fork() -> pid_t; | ||
372 | pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; | ||
373 | pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; | ||
374 | pub fn getegid() -> gid_t; | ||
375 | pub fn geteuid() -> uid_t; | ||
376 | pub fn getgid() -> gid_t; | ||
377 | pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) | ||
378 | -> ::c_int; | ||
379 | pub fn getlogin() -> *mut c_char; | ||
380 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
381 | link_name = "getopt$UNIX2003")] | ||
382 | pub fn getopt(argc: ::c_int, argv: *const *mut c_char, | ||
383 | optstr: *const c_char) -> ::c_int; | ||
384 | pub fn getpgid(pid: pid_t) -> pid_t; | ||
385 | pub fn getpgrp() -> pid_t; | ||
386 | pub fn getpid() -> pid_t; | ||
387 | pub fn getppid() -> pid_t; | ||
388 | pub fn getuid() -> uid_t; | ||
389 | pub fn isatty(fd: ::c_int) -> ::c_int; | ||
390 | pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; | ||
391 | pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; | ||
392 | pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; | ||
393 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
394 | link_name = "pause$UNIX2003")] | ||
395 | pub fn pause() -> ::c_int; | ||
396 | pub fn pipe(fds: *mut ::c_int) -> ::c_int; | ||
397 | pub fn posix_memalign(memptr: *mut *mut ::c_void, | ||
398 | align: ::size_t, | ||
399 | size: ::size_t) -> ::c_int; | ||
400 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
401 | link_name = "read$UNIX2003")] | ||
402 | pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) | ||
403 | -> ::ssize_t; | ||
404 | pub fn rmdir(path: *const c_char) -> ::c_int; | ||
405 | pub fn setgid(gid: gid_t) -> ::c_int; | ||
406 | pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; | ||
407 | pub fn setsid() -> pid_t; | ||
408 | pub fn setuid(uid: uid_t) -> ::c_int; | ||
409 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
410 | link_name = "sleep$UNIX2003")] | ||
411 | pub fn sleep(secs: ::c_uint) -> ::c_uint; | ||
412 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
413 | link_name = "nanosleep$UNIX2003")] | ||
414 | #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")] | ||
415 | pub fn nanosleep(rqtp: *const timespec, | ||
416 | rmtp: *mut timespec) -> ::c_int; | ||
417 | pub fn tcgetpgrp(fd: ::c_int) -> pid_t; | ||
418 | pub fn ttyname(fd: ::c_int) -> *mut c_char; | ||
419 | pub fn unlink(c: *const c_char) -> ::c_int; | ||
420 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
421 | link_name = "wait$UNIX2003")] | ||
422 | pub fn wait(status: *mut ::c_int) -> pid_t; | ||
423 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
424 | link_name = "waitpid$UNIX2003")] | ||
425 | pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) | ||
426 | -> pid_t; | ||
427 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
428 | link_name = "write$UNIX2003")] | ||
429 | pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) | ||
430 | -> ::ssize_t; | ||
431 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
432 | link_name = "pread$UNIX2003")] | ||
433 | pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, | ||
434 | offset: off_t) -> ::ssize_t; | ||
435 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
436 | link_name = "pwrite$UNIX2003")] | ||
437 | pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, | ||
438 | offset: off_t) -> ::ssize_t; | ||
439 | pub fn umask(mask: mode_t) -> mode_t; | ||
440 | |||
441 | #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] | ||
442 | pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; | ||
443 | |||
444 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
445 | link_name = "kill$UNIX2003")] | ||
446 | pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; | ||
447 | |||
448 | pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; | ||
449 | pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; | ||
450 | pub fn mlockall(flags: ::c_int) -> ::c_int; | ||
451 | pub fn munlockall() -> ::c_int; | ||
452 | |||
453 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
454 | link_name = "mmap$UNIX2003")] | ||
455 | pub fn mmap(addr: *mut ::c_void, | ||
456 | len: ::size_t, | ||
457 | prot: ::c_int, | ||
458 | flags: ::c_int, | ||
459 | fd: ::c_int, | ||
460 | offset: off_t) | ||
461 | -> *mut ::c_void; | ||
462 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
463 | link_name = "munmap$UNIX2003")] | ||
464 | pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; | ||
465 | |||
466 | pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; | ||
467 | pub fn if_indextoname(ifindex: ::c_uint, | ||
468 | ifname: *mut ::c_char) -> *mut ::c_char; | ||
469 | |||
470 | #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")] | ||
471 | #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] | ||
472 | pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; | ||
473 | |||
474 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
475 | link_name = "fsync$UNIX2003")] | ||
476 | pub fn fsync(fd: ::c_int) -> ::c_int; | ||
477 | |||
478 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
479 | link_name = "setenv$UNIX2003")] | ||
480 | pub fn setenv(name: *const c_char, val: *const c_char, | ||
481 | overwrite: ::c_int) -> ::c_int; | ||
482 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
483 | link_name = "unsetenv$UNIX2003")] | ||
484 | #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")] | ||
485 | pub fn unsetenv(name: *const c_char) -> ::c_int; | ||
486 | |||
487 | pub fn symlink(path1: *const c_char, | ||
488 | path2: *const c_char) -> ::c_int; | ||
489 | |||
490 | pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; | ||
491 | |||
492 | pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; | ||
493 | |||
494 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
495 | link_name = "getrlimit$UNIX2003")] | ||
496 | pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int; | ||
497 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
498 | link_name = "setrlimit$UNIX2003")] | ||
499 | pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int; | ||
500 | #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] | ||
501 | pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; | ||
502 | |||
503 | pub fn getdtablesize() -> ::c_int; | ||
504 | #[cfg_attr(any(target_os = "macos", target_os = "ios"), | ||
505 | link_name = "realpath$DARWIN_EXTSN")] | ||
506 | pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) | ||
507 | -> *mut ::c_char; | ||
508 | |||
509 | pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; | ||
510 | |||
511 | #[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")] | ||
512 | pub fn gettimeofday(tp: *mut ::timeval, | ||
513 | tz: *mut ::c_void) -> ::c_int; | ||
514 | |||
515 | pub fn pthread_self() -> ::pthread_t; | ||
516 | pub fn pthread_create(native: *mut ::pthread_t, | ||
517 | attr: *const ::pthread_attr_t, | ||
518 | f: extern fn(*mut ::c_void) -> *mut ::c_void, | ||
519 | value: *mut ::c_void) -> ::c_int; | ||
520 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
521 | link_name = "pthread_join$UNIX2003")] | ||
522 | pub fn pthread_join(native: ::pthread_t, | ||
523 | value: *mut *mut ::c_void) -> ::c_int; | ||
524 | pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; | ||
525 | pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int; | ||
526 | pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, | ||
527 | stack_size: ::size_t) -> ::c_int; | ||
528 | pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, | ||
529 | state: ::c_int) -> ::c_int; | ||
530 | pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; | ||
531 | #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] | ||
532 | pub fn sched_yield() -> ::c_int; | ||
533 | pub fn pthread_key_create(key: *mut pthread_key_t, | ||
534 | dtor: Option<unsafe extern fn(*mut ::c_void)>) | ||
535 | -> ::c_int; | ||
536 | pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; | ||
537 | pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; | ||
538 | pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) | ||
539 | -> ::c_int; | ||
540 | pub fn pthread_mutex_init(lock: *mut pthread_mutex_t, | ||
541 | attr: *const pthread_mutexattr_t) -> ::c_int; | ||
542 | pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; | ||
543 | pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; | ||
544 | pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; | ||
545 | pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; | ||
546 | |||
547 | pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; | ||
548 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
549 | link_name = "pthread_mutexattr_destroy$UNIX2003")] | ||
550 | pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; | ||
551 | pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, | ||
552 | _type: ::c_int) -> ::c_int; | ||
553 | |||
554 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
555 | link_name = "pthread_cond_init$UNIX2003")] | ||
556 | pub fn pthread_cond_init(cond: *mut pthread_cond_t, | ||
557 | attr: *const pthread_condattr_t) -> ::c_int; | ||
558 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
559 | link_name = "pthread_cond_wait$UNIX2003")] | ||
560 | pub fn pthread_cond_wait(cond: *mut pthread_cond_t, | ||
561 | lock: *mut pthread_mutex_t) -> ::c_int; | ||
562 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
563 | link_name = "pthread_cond_timedwait$UNIX2003")] | ||
564 | pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t, | ||
565 | lock: *mut pthread_mutex_t, | ||
566 | abstime: *const ::timespec) -> ::c_int; | ||
567 | pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; | ||
568 | pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; | ||
569 | pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; | ||
570 | pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; | ||
571 | pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; | ||
572 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
573 | link_name = "pthread_rwlock_destroy$UNIX2003")] | ||
574 | pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; | ||
575 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
576 | link_name = "pthread_rwlock_rdlock$UNIX2003")] | ||
577 | pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; | ||
578 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
579 | link_name = "pthread_rwlock_tryrdlock$UNIX2003")] | ||
580 | pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; | ||
581 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
582 | link_name = "pthread_rwlock_wrlock$UNIX2003")] | ||
583 | pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; | ||
584 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
585 | link_name = "pthread_rwlock_trywrlock$UNIX2003")] | ||
586 | pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; | ||
587 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
588 | link_name = "pthread_rwlock_unlock$UNIX2003")] | ||
589 | pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; | ||
590 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
591 | link_name = "pthread_sigmask$UNIX2003")] | ||
592 | pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, | ||
593 | oldset: *mut sigset_t) -> ::c_int; | ||
594 | pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; | ||
595 | #[cfg_attr(all(target_os = "linux", not(target_env = "musl")), | ||
596 | link_name = "__xpg_strerror_r")] | ||
597 | pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, | ||
598 | buflen: ::size_t) -> ::c_int; | ||
599 | |||
600 | pub fn getsockopt(sockfd: ::c_int, | ||
601 | level: ::c_int, | ||
602 | optname: ::c_int, | ||
603 | optval: *mut ::c_void, | ||
604 | optlen: *mut ::socklen_t) -> ::c_int; | ||
605 | pub fn raise(signum: ::c_int) -> ::c_int; | ||
606 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")] | ||
607 | pub fn sigaction(signum: ::c_int, | ||
608 | act: *const sigaction, | ||
609 | oldact: *mut sigaction) -> ::c_int; | ||
610 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
611 | link_name = "sigaltstack$UNIX2003")] | ||
612 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] | ||
613 | pub fn sigaltstack(ss: *const stack_t, | ||
614 | oss: *mut stack_t) -> ::c_int; | ||
615 | #[cfg_attr(all(target_os = "macos", target_arch ="x86"), | ||
616 | link_name = "sigwait$UNIX2003")] | ||
617 | pub fn sigwait(set: *const sigset_t, | ||
618 | sig: *mut ::c_int) -> ::c_int; | ||
619 | |||
620 | #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] | ||
621 | pub fn utimes(filename: *const ::c_char, | ||
622 | times: *const ::timeval) -> ::c_int; | ||
623 | pub fn dlopen(filename: *const ::c_char, | ||
624 | flag: ::c_int) -> *mut ::c_void; | ||
625 | pub fn dlerror() -> *mut ::c_char; | ||
626 | pub fn dlsym(handle: *mut ::c_void, | ||
627 | symbol: *const ::c_char) -> *mut ::c_void; | ||
628 | pub fn dlclose(handle: *mut ::c_void) -> ::c_int; | ||
629 | pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; | ||
630 | |||
631 | pub fn getaddrinfo(node: *const c_char, | ||
632 | service: *const c_char, | ||
633 | hints: *const addrinfo, | ||
634 | res: *mut *mut addrinfo) -> ::c_int; | ||
635 | pub fn freeaddrinfo(res: *mut addrinfo); | ||
636 | pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; | ||
637 | |||
638 | #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] | ||
639 | pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; | ||
640 | #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] | ||
641 | pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; | ||
642 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
643 | link_name = "mktime$UNIX2003")] | ||
644 | #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] | ||
645 | pub fn mktime(tm: *mut tm) -> time_t; | ||
646 | |||
647 | #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] | ||
648 | pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, | ||
649 | dev: ::dev_t) -> ::c_int; | ||
650 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
651 | link_name = "writev$UNIX2003")] | ||
652 | pub fn writev(fd: ::c_int, | ||
653 | iov: *const ::iovec, | ||
654 | iovcnt: ::c_int) -> ::ssize_t; | ||
655 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
656 | link_name = "readv$UNIX2003")] | ||
657 | pub fn readv(fd: ::c_int, | ||
658 | iov: *const ::iovec, | ||
659 | iovcnt: ::c_int) -> ::ssize_t; | ||
660 | pub fn uname(buf: *mut ::utsname) -> ::c_int; | ||
661 | pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; | ||
662 | pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; | ||
663 | pub fn chroot(name: *const ::c_char) -> ::c_int; | ||
664 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
665 | link_name = "usleep$UNIX2003")] | ||
666 | pub fn usleep(secs: ::c_uint) -> ::c_int; | ||
667 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
668 | link_name = "send$UNIX2003")] | ||
669 | pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, | ||
670 | flags: ::c_int) -> ::ssize_t; | ||
671 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
672 | link_name = "recv$UNIX2003")] | ||
673 | pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, | ||
674 | flags: ::c_int) -> ::ssize_t; | ||
675 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
676 | link_name = "putenv$UNIX2003")] | ||
677 | #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")] | ||
678 | pub fn putenv(string: *mut c_char) -> ::c_int; | ||
679 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
680 | link_name = "sendmsg$UNIX2003")] | ||
681 | pub fn sendmsg(fd: ::c_int, | ||
682 | msg: *const msghdr, | ||
683 | flags: ::c_int) -> ::ssize_t; | ||
684 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
685 | link_name = "recvmsg$UNIX2003")] | ||
686 | pub fn recvmsg(fd: ::c_int, msg: *mut msghdr, flags: ::c_int) -> ::ssize_t; | ||
687 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
688 | link_name = "poll$UNIX2003")] | ||
689 | pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; | ||
690 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), | ||
691 | link_name = "select$1050")] | ||
692 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
693 | link_name = "select$UNIX2003")] | ||
694 | #[cfg_attr(target_os = "netbsd", link_name = "__select50")] | ||
695 | pub fn select(nfds: ::c_int, | ||
696 | readfs: *mut fd_set, | ||
697 | writefds: *mut fd_set, | ||
698 | errorfds: *mut fd_set, | ||
699 | timeout: *mut timeval) -> ::c_int; | ||
700 | #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")] | ||
701 | pub fn setlocale(category: ::c_int, | ||
702 | locale: *const ::c_char) -> *mut ::c_char; | ||
703 | pub fn localeconv() -> *mut lconv; | ||
704 | |||
705 | pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; | ||
706 | pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t; | ||
707 | pub fn sem_close(sem: *mut sem_t) -> ::c_int; | ||
708 | pub fn sem_unlink(name: *const ::c_char) -> ::c_int; | ||
709 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
710 | link_name = "sem_wait$UNIX2003")] | ||
711 | pub fn sem_wait(sem: *mut sem_t) -> ::c_int; | ||
712 | pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; | ||
713 | pub fn sem_post(sem: *mut sem_t) -> ::c_int; | ||
714 | pub fn sem_init(sem: *mut sem_t, | ||
715 | pshared: ::c_int, | ||
716 | value: ::c_uint) | ||
717 | -> ::c_int; | ||
718 | } | ||
719 | |||
720 | // TODO: get rid of this cfg(not(...)) | ||
721 | #[cfg(not(target_os = "android"))] // " if " -- appease style checker | ||
722 | extern { | ||
723 | pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> ::c_int; | ||
724 | pub fn freeifaddrs(ifa: *mut ifaddrs); | ||
725 | #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] | ||
726 | #[cfg_attr(target_os = "netbsd", link_name = "__glob30")] | ||
727 | pub fn glob(pattern: *const c_char, | ||
728 | flags: ::c_int, | ||
729 | errfunc: Option<extern fn(epath: *const c_char, | ||
730 | errno: ::c_int) -> ::c_int>, | ||
731 | pglob: *mut glob_t) -> ::c_int; | ||
732 | #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] | ||
733 | pub fn globfree(pglob: *mut glob_t); | ||
734 | |||
735 | pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) | ||
736 | -> ::c_int; | ||
737 | |||
738 | pub fn shm_unlink(name: *const c_char) -> ::c_int; | ||
739 | |||
740 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), | ||
741 | link_name = "seekdir$INODE64")] | ||
742 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
743 | link_name = "seekdir$INODE64$UNIX2003")] | ||
744 | pub fn seekdir(dirp: *mut ::DIR, loc: c_long); | ||
745 | |||
746 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), | ||
747 | link_name = "telldir$INODE64")] | ||
748 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
749 | link_name = "telldir$INODE64$UNIX2003")] | ||
750 | pub fn telldir(dirp: *mut ::DIR) -> c_long; | ||
751 | |||
752 | pub fn getsid(pid: pid_t) -> pid_t; | ||
753 | pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) | ||
754 | -> ::c_int; | ||
755 | pub fn readlink(path: *const c_char, | ||
756 | buf: *mut c_char, | ||
757 | bufsz: ::size_t) | ||
758 | -> ::ssize_t; | ||
759 | |||
760 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
761 | link_name = "msync$UNIX2003")] | ||
762 | #[cfg_attr(target_os = "netbsd", link_name = "__msync13")] | ||
763 | pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; | ||
764 | pub fn sysconf(name: ::c_int) -> c_long; | ||
765 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
766 | link_name = "recvfrom$UNIX2003")] | ||
767 | pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, | ||
768 | flags: ::c_int, addr: *mut sockaddr, | ||
769 | addrlen: *mut socklen_t) -> ::ssize_t; | ||
770 | pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; | ||
771 | |||
772 | #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")] | ||
773 | pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; | ||
774 | #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")] | ||
775 | pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; | ||
776 | #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")] | ||
777 | pub fn sigfillset(set: *mut sigset_t) -> ::c_int; | ||
778 | #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")] | ||
779 | pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; | ||
780 | #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")] | ||
781 | pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; | ||
782 | #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), | ||
783 | link_name = "pselect$1050")] | ||
784 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
785 | link_name = "pselect$UNIX2003")] | ||
786 | #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")] | ||
787 | pub fn pselect(nfds: ::c_int, | ||
788 | readfs: *mut fd_set, | ||
789 | writefds: *mut fd_set, | ||
790 | errorfds: *mut fd_set, | ||
791 | timeout: *const timespec, | ||
792 | sigmask: *const sigset_t) -> ::c_int; | ||
793 | pub fn fseeko(stream: *mut ::FILE, | ||
794 | offset: ::off_t, | ||
795 | whence: ::c_int) -> ::c_int; | ||
796 | pub fn ftello(stream: *mut ::FILE) -> ::off_t; | ||
797 | #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] | ||
798 | pub fn timegm(tm: *mut ::tm) -> time_t; | ||
799 | pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; | ||
800 | pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; | ||
801 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
802 | link_name = "tcdrain$UNIX2003")] | ||
803 | pub fn tcdrain(fd: ::c_int) -> ::c_int; | ||
804 | pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; | ||
805 | pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; | ||
806 | pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; | ||
807 | pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; | ||
808 | pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; | ||
809 | pub fn tcsetattr(fd: ::c_int, | ||
810 | optional_actions: ::c_int, | ||
811 | termios: *const ::termios) -> ::c_int; | ||
812 | pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; | ||
813 | pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; | ||
814 | pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; | ||
815 | pub fn mkstemp(template: *mut ::c_char) -> ::c_int; | ||
816 | pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; | ||
817 | pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; | ||
818 | pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; | ||
819 | pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; | ||
820 | |||
821 | pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); | ||
822 | pub fn closelog(); | ||
823 | pub fn setlogmask(maskpri: ::c_int) -> ::c_int; | ||
824 | pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); | ||
825 | #[cfg_attr(all(target_os = "macos", target_arch = "x86"), | ||
826 | link_name = "nice$UNIX2003")] | ||
827 | pub fn nice(incr: ::c_int) -> ::c_int; | ||
828 | } | ||
829 | |||
830 | cfg_if! { | ||
831 | if #[cfg(any(target_os = "linux", | ||
832 | target_os = "android", | ||
833 | target_os = "emscripten"))] { | ||
834 | mod notbsd; | ||
835 | pub use self::notbsd::*; | ||
836 | } else if #[cfg(any(target_os = "macos", | ||
837 | target_os = "ios", | ||
838 | target_os = "freebsd", | ||
839 | target_os = "dragonfly", | ||
840 | target_os = "openbsd", | ||
841 | target_os = "netbsd", | ||
842 | target_os = "bitrig"))] { | ||
843 | mod bsd; | ||
844 | pub use self::bsd::*; | ||
845 | } else if #[cfg(target_os = "solaris")] { | ||
846 | mod solaris; | ||
847 | pub use self::solaris::*; | ||
848 | } else { | ||
849 | // Unknown target_os | ||
850 | } | ||
851 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/android/b32.rs b/third_party/libc/src/unix/notbsd/android/b32.rs new file mode 100644 index 0000000..bd69ccf --- /dev/null +++ b/third_party/libc/src/unix/notbsd/android/b32.rs | |||
@@ -0,0 +1,151 @@ | |||
1 | pub type c_long = i32; | ||
2 | pub type c_ulong = u32; | ||
3 | pub type mode_t = u16; | ||
4 | pub type off64_t = ::c_longlong; | ||
5 | |||
6 | s! { | ||
7 | pub struct sigaction { | ||
8 | pub sa_sigaction: ::sighandler_t, | ||
9 | pub sa_mask: ::sigset_t, | ||
10 | pub sa_flags: ::c_ulong, | ||
11 | pub sa_restorer: ::dox::Option<extern fn()>, | ||
12 | } | ||
13 | |||
14 | pub struct stat { | ||
15 | pub st_dev: ::c_ulonglong, | ||
16 | __pad0: [::c_uchar; 4], | ||
17 | __st_ino: ::ino_t, | ||
18 | pub st_mode: ::c_uint, | ||
19 | pub st_nlink: ::c_uint, | ||
20 | pub st_uid: ::uid_t, | ||
21 | pub st_gid: ::gid_t, | ||
22 | pub st_rdev: ::c_ulonglong, | ||
23 | __pad3: [::c_uchar; 4], | ||
24 | pub st_size: ::c_longlong, | ||
25 | pub st_blksize: ::blksize_t, | ||
26 | pub st_blocks: ::c_ulonglong, | ||
27 | pub st_atime: ::c_ulong, | ||
28 | pub st_atime_nsec: ::c_ulong, | ||
29 | pub st_mtime: ::c_ulong, | ||
30 | pub st_mtime_nsec: ::c_ulong, | ||
31 | pub st_ctime: ::c_ulong, | ||
32 | pub st_ctime_nsec: ::c_ulong, | ||
33 | pub st_ino: ::c_ulonglong, | ||
34 | } | ||
35 | |||
36 | pub struct stat64 { | ||
37 | pub st_dev: ::c_ulonglong, | ||
38 | __pad0: [::c_uchar; 4], | ||
39 | __st_ino: ::ino_t, | ||
40 | pub st_mode: ::c_uint, | ||
41 | pub st_nlink: ::c_uint, | ||
42 | pub st_uid: ::uid_t, | ||
43 | pub st_gid: ::gid_t, | ||
44 | pub st_rdev: ::c_ulonglong, | ||
45 | __pad3: [::c_uchar; 4], | ||
46 | pub st_size: ::c_longlong, | ||
47 | pub st_blksize: ::blksize_t, | ||
48 | pub st_blocks: ::c_ulonglong, | ||
49 | pub st_atime: ::c_ulong, | ||
50 | pub st_atime_nsec: ::c_ulong, | ||
51 | pub st_mtime: ::c_ulong, | ||
52 | pub st_mtime_nsec: ::c_ulong, | ||
53 | pub st_ctime: ::c_ulong, | ||
54 | pub st_ctime_nsec: ::c_ulong, | ||
55 | pub st_ino: ::c_ulonglong, | ||
56 | } | ||
57 | |||
58 | pub struct pthread_attr_t { | ||
59 | pub flags: ::uint32_t, | ||
60 | pub stack_base: *mut ::c_void, | ||
61 | pub stack_size: ::size_t, | ||
62 | pub guard_size: ::size_t, | ||
63 | pub sched_policy: ::int32_t, | ||
64 | pub sched_priority: ::int32_t, | ||
65 | } | ||
66 | |||
67 | pub struct pthread_mutex_t { value: ::c_int } | ||
68 | |||
69 | pub struct pthread_cond_t { value: ::c_int } | ||
70 | |||
71 | pub struct pthread_rwlock_t { | ||
72 | lock: pthread_mutex_t, | ||
73 | cond: pthread_cond_t, | ||
74 | numLocks: ::c_int, | ||
75 | writerThreadId: ::c_int, | ||
76 | pendingReaders: ::c_int, | ||
77 | pendingWriters: ::c_int, | ||
78 | attr: i32, | ||
79 | __reserved: [::c_char; 12], | ||
80 | } | ||
81 | |||
82 | pub struct passwd { | ||
83 | pub pw_name: *mut ::c_char, | ||
84 | pub pw_passwd: *mut ::c_char, | ||
85 | pub pw_uid: ::uid_t, | ||
86 | pub pw_gid: ::gid_t, | ||
87 | pub pw_dir: *mut ::c_char, | ||
88 | pub pw_shell: *mut ::c_char, | ||
89 | } | ||
90 | |||
91 | pub struct statfs { | ||
92 | pub f_type: ::uint32_t, | ||
93 | pub f_bsize: ::uint32_t, | ||
94 | pub f_blocks: ::uint64_t, | ||
95 | pub f_bfree: ::uint64_t, | ||
96 | pub f_bavail: ::uint64_t, | ||
97 | pub f_files: ::uint64_t, | ||
98 | pub f_ffree: ::uint64_t, | ||
99 | pub f_fsid: ::__fsid_t, | ||
100 | pub f_namelen: ::uint32_t, | ||
101 | pub f_frsize: ::uint32_t, | ||
102 | pub f_flags: ::uint32_t, | ||
103 | pub f_spare: [::uint32_t; 4], | ||
104 | } | ||
105 | |||
106 | pub struct sysinfo { | ||
107 | pub uptime: ::c_long, | ||
108 | pub loads: [::c_ulong; 3], | ||
109 | pub totalram: ::c_ulong, | ||
110 | pub freeram: ::c_ulong, | ||
111 | pub sharedram: ::c_ulong, | ||
112 | pub bufferram: ::c_ulong, | ||
113 | pub totalswap: ::c_ulong, | ||
114 | pub freeswap: ::c_ulong, | ||
115 | pub procs: ::c_ushort, | ||
116 | pub pad: ::c_ushort, | ||
117 | pub totalhigh: ::c_ulong, | ||
118 | pub freehigh: ::c_ulong, | ||
119 | pub mem_unit: ::c_uint, | ||
120 | pub _f: [::c_char; 8], | ||
121 | } | ||
122 | } | ||
123 | |||
124 | pub const SYS_gettid: ::c_long = 224; | ||
125 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { | ||
126 | value: 0, | ||
127 | }; | ||
128 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { | ||
129 | value: 0, | ||
130 | }; | ||
131 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { | ||
132 | lock: PTHREAD_MUTEX_INITIALIZER, | ||
133 | cond: PTHREAD_COND_INITIALIZER, | ||
134 | numLocks: 0, | ||
135 | writerThreadId: 0, | ||
136 | pendingReaders: 0, | ||
137 | pendingWriters: 0, | ||
138 | attr: 0, | ||
139 | __reserved: [0; 12], | ||
140 | }; | ||
141 | pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2; | ||
142 | pub const CPU_SETSIZE: ::size_t = 32; | ||
143 | pub const __CPU_BITS: ::size_t = 32; | ||
144 | |||
145 | pub const UT_LINESIZE: usize = 8; | ||
146 | pub const UT_NAMESIZE: usize = 8; | ||
147 | pub const UT_HOSTSIZE: usize = 16; | ||
148 | |||
149 | extern { | ||
150 | pub fn timegm64(tm: *const ::tm) -> ::time64_t; | ||
151 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/android/b64.rs b/third_party/libc/src/unix/notbsd/android/b64.rs new file mode 100644 index 0000000..b35dde4 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/android/b64.rs | |||
@@ -0,0 +1,161 @@ | |||
1 | // The following definitions are correct for aarch64 and may be wrong for x86_64 | ||
2 | |||
3 | pub type c_long = i64; | ||
4 | pub type c_ulong = u64; | ||
5 | pub type mode_t = u32; | ||
6 | pub type off64_t = i64; | ||
7 | |||
8 | s! { | ||
9 | pub struct sigaction { | ||
10 | pub sa_flags: ::c_uint, | ||
11 | pub sa_sigaction: ::sighandler_t, | ||
12 | pub sa_mask: ::sigset_t, | ||
13 | _restorer: *mut ::c_void, | ||
14 | } | ||
15 | |||
16 | pub struct stat { | ||
17 | pub st_dev: ::dev_t, | ||
18 | pub st_ino: ::ino_t, | ||
19 | pub st_mode: ::c_uint, | ||
20 | pub st_nlink: ::c_uint, | ||
21 | pub st_uid: ::uid_t, | ||
22 | pub st_gid: ::gid_t, | ||
23 | pub st_rdev: ::dev_t, | ||
24 | __pad1: ::c_ulong, | ||
25 | pub st_size: ::off64_t, | ||
26 | pub st_blksize: ::c_int, | ||
27 | __pad2: ::c_int, | ||
28 | pub st_blocks: ::c_long, | ||
29 | pub st_atime: ::time_t, | ||
30 | pub st_atime_nsec: ::c_ulong, | ||
31 | pub st_mtime: ::time_t, | ||
32 | pub st_mtime_nsec: ::c_ulong, | ||
33 | pub st_ctime: ::time_t, | ||
34 | pub st_ctime_nsec: ::c_ulong, | ||
35 | __unused4: ::c_uint, | ||
36 | __unused5: ::c_uint, | ||
37 | } | ||
38 | |||
39 | pub struct stat64 { | ||
40 | pub st_dev: ::dev_t, | ||
41 | pub st_ino: ::ino_t, | ||
42 | pub st_mode: ::c_uint, | ||
43 | pub st_nlink: ::c_uint, | ||
44 | pub st_uid: ::uid_t, | ||
45 | pub st_gid: ::gid_t, | ||
46 | pub st_rdev: ::dev_t, | ||
47 | __pad1: ::c_ulong, | ||
48 | pub st_size: ::off64_t, | ||
49 | pub st_blksize: ::c_int, | ||
50 | __pad2: ::c_int, | ||
51 | pub st_blocks: ::c_long, | ||
52 | pub st_atime: ::time_t, | ||
53 | pub st_atime_nsec: ::c_ulong, | ||
54 | pub st_mtime: ::time_t, | ||
55 | pub st_mtime_nsec: ::c_ulong, | ||
56 | pub st_ctime: ::time_t, | ||
57 | pub st_ctime_nsec: ::c_ulong, | ||
58 | __unused4: ::c_uint, | ||
59 | __unused5: ::c_uint, | ||
60 | } | ||
61 | |||
62 | pub struct pthread_attr_t { | ||
63 | pub flags: ::uint32_t, | ||
64 | pub stack_base: *mut ::c_void, | ||
65 | pub stack_size: ::size_t, | ||
66 | pub guard_size: ::size_t, | ||
67 | pub sched_policy: ::int32_t, | ||
68 | pub sched_priority: ::int32_t, | ||
69 | __reserved: [::c_char; 16], | ||
70 | } | ||
71 | |||
72 | pub struct pthread_mutex_t { | ||
73 | value: ::c_int, | ||
74 | __reserved: [::c_char; 36], | ||
75 | } | ||
76 | |||
77 | pub struct pthread_cond_t { | ||
78 | value: ::c_int, | ||
79 | __reserved: [::c_char; 44], | ||
80 | } | ||
81 | |||
82 | pub struct pthread_rwlock_t { | ||
83 | numLocks: ::c_int, | ||
84 | writerThreadId: ::c_int, | ||
85 | pendingReaders: ::c_int, | ||
86 | pendingWriters: ::c_int, | ||
87 | attr: i32, | ||
88 | __reserved: [::c_char; 36], | ||
89 | } | ||
90 | |||
91 | pub struct passwd { | ||
92 | pub pw_name: *mut ::c_char, | ||
93 | pub pw_passwd: *mut ::c_char, | ||
94 | pub pw_uid: ::uid_t, | ||
95 | pub pw_gid: ::gid_t, | ||
96 | pub pw_gecos: *mut ::c_char, | ||
97 | pub pw_dir: *mut ::c_char, | ||
98 | pub pw_shell: *mut ::c_char, | ||
99 | } | ||
100 | |||
101 | pub struct statfs { | ||
102 | pub f_type: ::uint64_t, | ||
103 | pub f_bsize: ::uint64_t, | ||
104 | pub f_blocks: ::uint64_t, | ||
105 | pub f_bfree: ::uint64_t, | ||
106 | pub f_bavail: ::uint64_t, | ||
107 | pub f_files: ::uint64_t, | ||
108 | pub f_ffree: ::uint64_t, | ||
109 | pub f_fsid: ::__fsid_t, | ||
110 | pub f_namelen: ::uint64_t, | ||
111 | pub f_frsize: ::uint64_t, | ||
112 | pub f_flags: ::uint64_t, | ||
113 | pub f_spare: [::uint64_t; 4], | ||
114 | } | ||
115 | |||
116 | pub struct sysinfo { | ||
117 | pub uptime: ::c_long, | ||
118 | pub loads: [::c_ulong; 3], | ||
119 | pub totalram: ::c_ulong, | ||
120 | pub freeram: ::c_ulong, | ||
121 | pub sharedram: ::c_ulong, | ||
122 | pub bufferram: ::c_ulong, | ||
123 | pub totalswap: ::c_ulong, | ||
124 | pub freeswap: ::c_ulong, | ||
125 | pub procs: ::c_ushort, | ||
126 | pub pad: ::c_ushort, | ||
127 | pub totalhigh: ::c_ulong, | ||
128 | pub freehigh: ::c_ulong, | ||
129 | pub mem_unit: ::c_uint, | ||
130 | pub _f: [::c_char; 0], | ||
131 | } | ||
132 | } | ||
133 | |||
134 | pub const SYS_gettid: ::c_long = 178; | ||
135 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { | ||
136 | value: 0, | ||
137 | __reserved: [0; 36], | ||
138 | }; | ||
139 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { | ||
140 | value: 0, | ||
141 | __reserved: [0; 44], | ||
142 | }; | ||
143 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { | ||
144 | numLocks: 0, | ||
145 | writerThreadId: 0, | ||
146 | pendingReaders: 0, | ||
147 | pendingWriters: 0, | ||
148 | attr: 0, | ||
149 | __reserved: [0; 36], | ||
150 | }; | ||
151 | pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 4; | ||
152 | pub const CPU_SETSIZE: ::size_t = 1024; | ||
153 | pub const __CPU_BITS: ::size_t = 64; | ||
154 | |||
155 | pub const UT_LINESIZE: usize = 32; | ||
156 | pub const UT_NAMESIZE: usize = 32; | ||
157 | pub const UT_HOSTSIZE: usize = 256; | ||
158 | |||
159 | extern { | ||
160 | pub fn timegm(tm: *const ::tm) -> ::time64_t; | ||
161 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/android/mod.rs b/third_party/libc/src/unix/notbsd/android/mod.rs new file mode 100644 index 0000000..6c6d7b0 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/android/mod.rs | |||
@@ -0,0 +1,639 @@ | |||
1 | //! Android-specific definitions for linux-like values | ||
2 | |||
3 | pub type c_char = u8; | ||
4 | pub type clock_t = ::c_long; | ||
5 | pub type time_t = ::c_long; | ||
6 | pub type suseconds_t = ::c_long; | ||
7 | pub type wchar_t = u32; | ||
8 | pub type off_t = ::c_long; | ||
9 | pub type blkcnt_t = ::c_ulong; | ||
10 | pub type blksize_t = ::c_ulong; | ||
11 | pub type nlink_t = u32; | ||
12 | pub type useconds_t = u32; | ||
13 | pub type socklen_t = i32; | ||
14 | pub type pthread_t = ::c_long; | ||
15 | pub type pthread_mutexattr_t = ::c_long; | ||
16 | pub type pthread_condattr_t = ::c_long; | ||
17 | pub type sigset_t = ::c_ulong; | ||
18 | pub type time64_t = i64; // N/A on android | ||
19 | pub type fsfilcnt_t = ::c_ulong; | ||
20 | pub type fsblkcnt_t = ::c_ulong; | ||
21 | pub type nfds_t = ::c_uint; | ||
22 | pub type rlim_t = ::c_ulong; | ||
23 | pub type dev_t = ::c_ulong; | ||
24 | pub type ino_t = ::c_ulong; | ||
25 | pub type __CPU_BITTYPE = ::c_ulong; | ||
26 | |||
27 | s! { | ||
28 | pub struct dirent { | ||
29 | pub d_ino: u64, | ||
30 | pub d_off: i64, | ||
31 | pub d_reclen: ::c_ushort, | ||
32 | pub d_type: ::c_uchar, | ||
33 | pub d_name: [::c_char; 256], | ||
34 | } | ||
35 | |||
36 | pub struct dirent64 { | ||
37 | pub d_ino: u64, | ||
38 | pub d_off: i64, | ||
39 | pub d_reclen: ::c_ushort, | ||
40 | pub d_type: ::c_uchar, | ||
41 | pub d_name: [::c_char; 256], | ||
42 | } | ||
43 | |||
44 | pub struct rlimit64 { | ||
45 | pub rlim_cur: u64, | ||
46 | pub rlim_max: u64, | ||
47 | } | ||
48 | |||
49 | pub struct stack_t { | ||
50 | pub ss_sp: *mut ::c_void, | ||
51 | pub ss_flags: ::c_int, | ||
52 | pub ss_size: ::size_t | ||
53 | } | ||
54 | |||
55 | pub struct siginfo_t { | ||
56 | pub si_signo: ::c_int, | ||
57 | pub si_errno: ::c_int, | ||
58 | pub si_code: ::c_int, | ||
59 | pub _pad: [::c_int; 29], | ||
60 | } | ||
61 | |||
62 | pub struct __fsid_t { | ||
63 | __val: [::c_int; 2], | ||
64 | } | ||
65 | |||
66 | pub struct msghdr { | ||
67 | pub msg_name: *mut ::c_void, | ||
68 | pub msg_namelen: ::c_int, | ||
69 | pub msg_iov: *mut ::iovec, | ||
70 | pub msg_iovlen: ::size_t, | ||
71 | pub msg_control: *mut ::c_void, | ||
72 | pub msg_controllen: ::size_t, | ||
73 | pub msg_flags: ::c_int, | ||
74 | } | ||
75 | |||
76 | pub struct termios { | ||
77 | pub c_iflag: ::tcflag_t, | ||
78 | pub c_oflag: ::tcflag_t, | ||
79 | pub c_cflag: ::tcflag_t, | ||
80 | pub c_lflag: ::tcflag_t, | ||
81 | pub c_line: ::cc_t, | ||
82 | pub c_cc: [::cc_t; ::NCCS], | ||
83 | } | ||
84 | |||
85 | pub struct flock { | ||
86 | pub l_type: ::c_short, | ||
87 | pub l_whence: ::c_short, | ||
88 | pub l_start: ::off_t, | ||
89 | pub l_len: ::off_t, | ||
90 | pub l_pid: ::pid_t, | ||
91 | } | ||
92 | |||
93 | pub struct cpu_set_t { | ||
94 | #[cfg(target_pointer_width = "64")] | ||
95 | __bits: [__CPU_BITTYPE; 16], | ||
96 | #[cfg(target_pointer_width = "32")] | ||
97 | __bits: [__CPU_BITTYPE; 1], | ||
98 | } | ||
99 | |||
100 | pub struct sem_t { | ||
101 | count: ::c_uint, | ||
102 | } | ||
103 | |||
104 | pub struct lastlog { | ||
105 | ll_time: ::time_t, | ||
106 | ll_line: [::c_char; UT_LINESIZE], | ||
107 | ll_host: [::c_char; UT_HOSTSIZE], | ||
108 | } | ||
109 | |||
110 | pub struct exit_status { | ||
111 | pub e_termination: ::c_short, | ||
112 | pub e_exit: ::c_short, | ||
113 | } | ||
114 | |||
115 | pub struct utmp { | ||
116 | pub ut_type: ::c_short, | ||
117 | pub ut_pid: ::pid_t, | ||
118 | pub ut_line: [::c_char; UT_LINESIZE], | ||
119 | pub ut_id: [::c_char; 4], | ||
120 | |||
121 | pub ut_user: [::c_char; UT_NAMESIZE], | ||
122 | pub ut_host: [::c_char; UT_HOSTSIZE], | ||
123 | pub ut_exit: exit_status, | ||
124 | pub ut_session: ::c_long, | ||
125 | pub ut_tv: ::timeval, | ||
126 | |||
127 | pub ut_addr_v6: [::int32_t; 4], | ||
128 | unused: [::c_char; 20], | ||
129 | } | ||
130 | } | ||
131 | |||
132 | pub const USER_PROCESS: ::c_short = 7; | ||
133 | |||
134 | pub const BUFSIZ: ::c_uint = 1024; | ||
135 | pub const FILENAME_MAX: ::c_uint = 1024; | ||
136 | pub const FOPEN_MAX: ::c_uint = 20; | ||
137 | pub const L_tmpnam: ::c_uint = 1024; | ||
138 | pub const TMP_MAX: ::c_uint = 308915776; | ||
139 | pub const _PC_LINK_MAX: ::c_int = 1; | ||
140 | pub const _PC_MAX_CANON: ::c_int = 2; | ||
141 | pub const _PC_MAX_INPUT: ::c_int = 3; | ||
142 | pub const _PC_NAME_MAX: ::c_int = 4; | ||
143 | pub const _PC_PATH_MAX: ::c_int = 5; | ||
144 | pub const _PC_PIPE_BUF: ::c_int = 6; | ||
145 | pub const _PC_CHOWN_RESTRICTED: ::c_int = 14; | ||
146 | pub const _PC_NO_TRUNC: ::c_int = 15; | ||
147 | pub const _PC_VDISABLE: ::c_int = 16; | ||
148 | |||
149 | pub const FIONBIO: ::c_int = 0x5421; | ||
150 | |||
151 | pub const _SC_ARG_MAX: ::c_int = 0; | ||
152 | pub const _SC_BC_BASE_MAX: ::c_int = 1; | ||
153 | pub const _SC_BC_DIM_MAX: ::c_int = 2; | ||
154 | pub const _SC_BC_SCALE_MAX: ::c_int = 3; | ||
155 | pub const _SC_BC_STRING_MAX: ::c_int = 4; | ||
156 | pub const _SC_CHILD_MAX: ::c_int = 5; | ||
157 | pub const _SC_CLK_TCK: ::c_int = 6; | ||
158 | pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7; | ||
159 | pub const _SC_EXPR_NEST_MAX: ::c_int = 8; | ||
160 | pub const _SC_LINE_MAX: ::c_int = 9; | ||
161 | pub const _SC_NGROUPS_MAX: ::c_int = 10; | ||
162 | pub const _SC_OPEN_MAX: ::c_int = 11; | ||
163 | pub const _SC_2_C_BIND: ::c_int = 13; | ||
164 | pub const _SC_2_C_DEV: ::c_int = 14; | ||
165 | pub const _SC_2_C_VERSION: ::c_int = 15; | ||
166 | pub const _SC_2_CHAR_TERM: ::c_int = 16; | ||
167 | pub const _SC_2_FORT_DEV: ::c_int = 17; | ||
168 | pub const _SC_2_FORT_RUN: ::c_int = 18; | ||
169 | pub const _SC_2_LOCALEDEF: ::c_int = 19; | ||
170 | pub const _SC_2_SW_DEV: ::c_int = 20; | ||
171 | pub const _SC_2_UPE: ::c_int = 21; | ||
172 | pub const _SC_2_VERSION: ::c_int = 22; | ||
173 | pub const _SC_JOB_CONTROL: ::c_int = 23; | ||
174 | pub const _SC_SAVED_IDS: ::c_int = 24; | ||
175 | pub const _SC_VERSION: ::c_int = 25; | ||
176 | pub const _SC_RE_DUP_MAX: ::c_int = 26; | ||
177 | pub const _SC_STREAM_MAX: ::c_int = 27; | ||
178 | pub const _SC_TZNAME_MAX: ::c_int = 28; | ||
179 | pub const _SC_XOPEN_CRYPT: ::c_int = 29; | ||
180 | pub const _SC_XOPEN_ENH_I18N: ::c_int = 30; | ||
181 | pub const _SC_XOPEN_SHM: ::c_int = 31; | ||
182 | pub const _SC_XOPEN_VERSION: ::c_int = 32; | ||
183 | pub const _SC_XOPEN_XCU_VERSION: ::c_int = 33; | ||
184 | pub const _SC_XOPEN_REALTIME: ::c_int = 34; | ||
185 | pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35; | ||
186 | pub const _SC_XOPEN_LEGACY: ::c_int = 36; | ||
187 | pub const _SC_ATEXIT_MAX: ::c_int = 37; | ||
188 | pub const _SC_IOV_MAX: ::c_int = 38; | ||
189 | pub const _SC_PAGESIZE: ::c_int = 39; | ||
190 | pub const _SC_PAGE_SIZE: ::c_int = 40; | ||
191 | pub const _SC_XOPEN_UNIX: ::c_int = 41; | ||
192 | pub const _SC_MQ_PRIO_MAX: ::c_int = 51; | ||
193 | pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71; | ||
194 | pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72; | ||
195 | pub const _SC_LOGIN_NAME_MAX: ::c_int = 73; | ||
196 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74; | ||
197 | pub const _SC_THREAD_KEYS_MAX: ::c_int = 75; | ||
198 | pub const _SC_THREAD_STACK_MIN: ::c_int = 76; | ||
199 | pub const _SC_THREAD_THREADS_MAX: ::c_int = 77; | ||
200 | pub const _SC_TTY_NAME_MAX: ::c_int = 78; | ||
201 | pub const _SC_THREADS: ::c_int = 79; | ||
202 | pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80; | ||
203 | pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81; | ||
204 | pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82; | ||
205 | pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83; | ||
206 | pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84; | ||
207 | pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85; | ||
208 | pub const _SC_NPROCESSORS_ONLN: ::c_int = 97; | ||
209 | |||
210 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; | ||
211 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; | ||
212 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; | ||
213 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; | ||
214 | |||
215 | pub const FIOCLEX: ::c_int = 0x5451; | ||
216 | |||
217 | pub const SA_ONSTACK: ::c_ulong = 0x08000000; | ||
218 | pub const SA_SIGINFO: ::c_ulong = 0x00000004; | ||
219 | pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002; | ||
220 | |||
221 | pub const SIGCHLD: ::c_int = 17; | ||
222 | pub const SIGBUS: ::c_int = 7; | ||
223 | pub const SIGUSR1: ::c_int = 10; | ||
224 | pub const SIGUSR2: ::c_int = 12; | ||
225 | pub const SIGCONT: ::c_int = 18; | ||
226 | pub const SIGSTOP: ::c_int = 19; | ||
227 | pub const SIGTSTP: ::c_int = 20; | ||
228 | pub const SIGURG: ::c_int = 23; | ||
229 | pub const SIGIO: ::c_int = 29; | ||
230 | pub const SIGSYS: ::c_int = 31; | ||
231 | pub const SIGSTKFLT: ::c_int = 16; | ||
232 | pub const SIGUNUSED: ::c_int = 31; | ||
233 | pub const SIGTTIN: ::c_int = 21; | ||
234 | pub const SIGTTOU: ::c_int = 22; | ||
235 | pub const SIGXCPU: ::c_int = 24; | ||
236 | pub const SIGXFSZ: ::c_int = 25; | ||
237 | pub const SIGVTALRM: ::c_int = 26; | ||
238 | pub const SIGPROF: ::c_int = 27; | ||
239 | pub const SIGWINCH: ::c_int = 28; | ||
240 | pub const SIGPOLL: ::c_int = 29; | ||
241 | pub const SIGPWR: ::c_int = 30; | ||
242 | pub const SIG_SETMASK: ::c_int = 2; | ||
243 | pub const SIG_BLOCK: ::c_int = 0x000000; | ||
244 | pub const SIG_UNBLOCK: ::c_int = 0x01; | ||
245 | |||
246 | pub const RUSAGE_CHILDREN: ::c_int = -1; | ||
247 | |||
248 | pub const LC_PAPER: ::c_int = 7; | ||
249 | pub const LC_NAME: ::c_int = 8; | ||
250 | pub const LC_ADDRESS: ::c_int = 9; | ||
251 | pub const LC_TELEPHONE: ::c_int = 10; | ||
252 | pub const LC_MEASUREMENT: ::c_int = 11; | ||
253 | pub const LC_IDENTIFICATION: ::c_int = 12; | ||
254 | pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); | ||
255 | pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); | ||
256 | pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); | ||
257 | pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); | ||
258 | pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); | ||
259 | pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); | ||
260 | pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK | ||
261 | | ::LC_NUMERIC_MASK | ||
262 | | ::LC_TIME_MASK | ||
263 | | ::LC_COLLATE_MASK | ||
264 | | ::LC_MONETARY_MASK | ||
265 | | ::LC_MESSAGES_MASK | ||
266 | | LC_PAPER_MASK | ||
267 | | LC_NAME_MASK | ||
268 | | LC_ADDRESS_MASK | ||
269 | | LC_TELEPHONE_MASK | ||
270 | | LC_MEASUREMENT_MASK | ||
271 | | LC_IDENTIFICATION_MASK; | ||
272 | |||
273 | pub const MAP_ANON: ::c_int = 0x0020; | ||
274 | pub const MAP_ANONYMOUS: ::c_int = 0x0020; | ||
275 | pub const MAP_GROWSDOWN: ::c_int = 0x0100; | ||
276 | pub const MAP_DENYWRITE: ::c_int = 0x0800; | ||
277 | pub const MAP_EXECUTABLE: ::c_int = 0x01000; | ||
278 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
279 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
280 | pub const MAP_POPULATE: ::c_int = 0x08000; | ||
281 | pub const MAP_NONBLOCK: ::c_int = 0x010000; | ||
282 | pub const MAP_STACK: ::c_int = 0x020000; | ||
283 | |||
284 | pub const EDEADLK: ::c_int = 35; | ||
285 | pub const ENAMETOOLONG: ::c_int = 36; | ||
286 | pub const ENOLCK: ::c_int = 37; | ||
287 | pub const ENOSYS: ::c_int = 38; | ||
288 | pub const ENOTEMPTY: ::c_int = 39; | ||
289 | pub const ELOOP: ::c_int = 40; | ||
290 | pub const ENOMSG: ::c_int = 42; | ||
291 | pub const EIDRM: ::c_int = 43; | ||
292 | pub const ECHRNG: ::c_int = 44; | ||
293 | pub const EL2NSYNC: ::c_int = 45; | ||
294 | pub const EL3HLT: ::c_int = 46; | ||
295 | pub const EL3RST: ::c_int = 47; | ||
296 | pub const ELNRNG: ::c_int = 48; | ||
297 | pub const EUNATCH: ::c_int = 49; | ||
298 | pub const ENOCSI: ::c_int = 50; | ||
299 | pub const EL2HLT: ::c_int = 51; | ||
300 | pub const EBADE: ::c_int = 52; | ||
301 | pub const EBADR: ::c_int = 53; | ||
302 | pub const EXFULL: ::c_int = 54; | ||
303 | pub const ENOANO: ::c_int = 55; | ||
304 | pub const EBADRQC: ::c_int = 56; | ||
305 | pub const EBADSLT: ::c_int = 57; | ||
306 | |||
307 | pub const EMULTIHOP: ::c_int = 72; | ||
308 | pub const EBADMSG: ::c_int = 74; | ||
309 | pub const EOVERFLOW: ::c_int = 75; | ||
310 | pub const ENOTUNIQ: ::c_int = 76; | ||
311 | pub const EBADFD: ::c_int = 77; | ||
312 | pub const EREMCHG: ::c_int = 78; | ||
313 | pub const ELIBACC: ::c_int = 79; | ||
314 | pub const ELIBBAD: ::c_int = 80; | ||
315 | pub const ELIBSCN: ::c_int = 81; | ||
316 | pub const ELIBMAX: ::c_int = 82; | ||
317 | pub const ELIBEXEC: ::c_int = 83; | ||
318 | pub const EILSEQ: ::c_int = 84; | ||
319 | pub const ERESTART: ::c_int = 85; | ||
320 | pub const ESTRPIPE: ::c_int = 86; | ||
321 | pub const EUSERS: ::c_int = 87; | ||
322 | pub const ENOTSOCK: ::c_int = 88; | ||
323 | pub const EDESTADDRREQ: ::c_int = 89; | ||
324 | pub const EMSGSIZE: ::c_int = 90; | ||
325 | pub const EPROTOTYPE: ::c_int = 91; | ||
326 | pub const ENOPROTOOPT: ::c_int = 92; | ||
327 | pub const EPROTONOSUPPORT: ::c_int = 93; | ||
328 | pub const ESOCKTNOSUPPORT: ::c_int = 94; | ||
329 | pub const EOPNOTSUPP: ::c_int = 95; | ||
330 | pub const EPFNOSUPPORT: ::c_int = 96; | ||
331 | pub const EAFNOSUPPORT: ::c_int = 97; | ||
332 | pub const EADDRINUSE: ::c_int = 98; | ||
333 | pub const EADDRNOTAVAIL: ::c_int = 99; | ||
334 | pub const ENETDOWN: ::c_int = 100; | ||
335 | pub const ENETUNREACH: ::c_int = 101; | ||
336 | pub const ENETRESET: ::c_int = 102; | ||
337 | pub const ECONNABORTED: ::c_int = 103; | ||
338 | pub const ECONNRESET: ::c_int = 104; | ||
339 | pub const ENOBUFS: ::c_int = 105; | ||
340 | pub const EISCONN: ::c_int = 106; | ||
341 | pub const ENOTCONN: ::c_int = 107; | ||
342 | pub const ESHUTDOWN: ::c_int = 108; | ||
343 | pub const ETOOMANYREFS: ::c_int = 109; | ||
344 | pub const ETIMEDOUT: ::c_int = 110; | ||
345 | pub const ECONNREFUSED: ::c_int = 111; | ||
346 | pub const EHOSTDOWN: ::c_int = 112; | ||
347 | pub const EHOSTUNREACH: ::c_int = 113; | ||
348 | pub const EALREADY: ::c_int = 114; | ||
349 | pub const EINPROGRESS: ::c_int = 115; | ||
350 | pub const ESTALE: ::c_int = 116; | ||
351 | pub const EUCLEAN: ::c_int = 117; | ||
352 | pub const ENOTNAM: ::c_int = 118; | ||
353 | pub const ENAVAIL: ::c_int = 119; | ||
354 | pub const EISNAM: ::c_int = 120; | ||
355 | pub const EREMOTEIO: ::c_int = 121; | ||
356 | pub const EDQUOT: ::c_int = 122; | ||
357 | pub const ENOMEDIUM: ::c_int = 123; | ||
358 | pub const EMEDIUMTYPE: ::c_int = 124; | ||
359 | pub const ECANCELED: ::c_int = 125; | ||
360 | pub const ENOKEY: ::c_int = 126; | ||
361 | pub const EKEYEXPIRED: ::c_int = 127; | ||
362 | pub const EKEYREVOKED: ::c_int = 128; | ||
363 | pub const EKEYREJECTED: ::c_int = 129; | ||
364 | pub const EOWNERDEAD: ::c_int = 130; | ||
365 | pub const ENOTRECOVERABLE: ::c_int = 131; | ||
366 | |||
367 | pub const SOCK_STREAM: ::c_int = 1; | ||
368 | pub const SOCK_DGRAM: ::c_int = 2; | ||
369 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
370 | |||
371 | pub const SOL_SOCKET: ::c_int = 1; | ||
372 | |||
373 | pub const SO_REUSEADDR: ::c_int = 2; | ||
374 | pub const SO_TYPE: ::c_int = 3; | ||
375 | pub const SO_ERROR: ::c_int = 4; | ||
376 | pub const SO_DONTROUTE: ::c_int = 5; | ||
377 | pub const SO_BROADCAST: ::c_int = 6; | ||
378 | pub const SO_SNDBUF: ::c_int = 7; | ||
379 | pub const SO_RCVBUF: ::c_int = 8; | ||
380 | pub const SO_KEEPALIVE: ::c_int = 9; | ||
381 | pub const SO_OOBINLINE: ::c_int = 10; | ||
382 | pub const SO_LINGER: ::c_int = 13; | ||
383 | pub const SO_REUSEPORT: ::c_int = 15; | ||
384 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
385 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
386 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
387 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
388 | pub const SO_ACCEPTCONN: ::c_int = 30; | ||
389 | |||
390 | pub const O_ACCMODE: ::c_int = 3; | ||
391 | pub const O_APPEND: ::c_int = 1024; | ||
392 | pub const O_CREAT: ::c_int = 64; | ||
393 | pub const O_EXCL: ::c_int = 128; | ||
394 | pub const O_NOCTTY: ::c_int = 256; | ||
395 | pub const O_NONBLOCK: ::c_int = 2048; | ||
396 | pub const O_SYNC: ::c_int = 0x101000; | ||
397 | pub const O_DIRECT: ::c_int = 0x10000; | ||
398 | pub const O_DIRECTORY: ::c_int = 0x4000; | ||
399 | pub const O_NOFOLLOW: ::c_int = 0x8000; | ||
400 | pub const O_ASYNC: ::c_int = 0x2000; | ||
401 | pub const O_NDELAY: ::c_int = 0x800; | ||
402 | |||
403 | pub const NI_MAXHOST: ::size_t = 1025; | ||
404 | |||
405 | pub const NCCS: usize = 19; | ||
406 | pub const TCSBRKP: ::c_int = 0x5425; | ||
407 | pub const TCSANOW: ::c_int = 0; | ||
408 | pub const TCSADRAIN: ::c_int = 0x1; | ||
409 | pub const TCSAFLUSH: ::c_int = 0x2; | ||
410 | pub const IUTF8: ::tcflag_t = 0x00004000; | ||
411 | pub const VEOF: usize = 4; | ||
412 | pub const VEOL: usize = 11; | ||
413 | pub const VEOL2: usize = 16; | ||
414 | pub const VMIN: usize = 6; | ||
415 | pub const IEXTEN: ::tcflag_t = 0x00008000; | ||
416 | pub const TOSTOP: ::tcflag_t = 0x00000100; | ||
417 | pub const FLUSHO: ::tcflag_t = 0x00001000; | ||
418 | |||
419 | pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; | ||
420 | pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; | ||
421 | pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; | ||
422 | pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; | ||
423 | pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; | ||
424 | pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
425 | pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
426 | pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
427 | pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; | ||
428 | pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; | ||
429 | pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; | ||
430 | pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; | ||
431 | pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; | ||
432 | pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; | ||
433 | pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; | ||
434 | pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; | ||
435 | pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; | ||
436 | pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; | ||
437 | pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; | ||
438 | pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; | ||
439 | pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; | ||
440 | pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; | ||
441 | pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; | ||
442 | pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; | ||
443 | pub const TMPFS_MAGIC: ::c_long = 0x01021994; | ||
444 | pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; | ||
445 | |||
446 | pub const MADV_HUGEPAGE: ::c_int = 14; | ||
447 | pub const MADV_NOHUGEPAGE: ::c_int = 15; | ||
448 | pub const MAP_HUGETLB: ::c_int = 0x040000; | ||
449 | |||
450 | pub const PTRACE_TRACEME: ::c_int = 0; | ||
451 | pub const PTRACE_PEEKTEXT: ::c_int = 1; | ||
452 | pub const PTRACE_PEEKDATA: ::c_int = 2; | ||
453 | pub const PTRACE_PEEKUSER: ::c_int = 3; | ||
454 | pub const PTRACE_POKETEXT: ::c_int = 4; | ||
455 | pub const PTRACE_POKEDATA: ::c_int = 5; | ||
456 | pub const PTRACE_POKEUSER: ::c_int = 6; | ||
457 | pub const PTRACE_CONT: ::c_int = 7; | ||
458 | pub const PTRACE_KILL: ::c_int = 8; | ||
459 | pub const PTRACE_SINGLESTEP: ::c_int = 9; | ||
460 | pub const PTRACE_ATTACH: ::c_int = 16; | ||
461 | pub const PTRACE_DETACH: ::c_int = 17; | ||
462 | pub const PTRACE_SYSCALL: ::c_int = 24; | ||
463 | pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; | ||
464 | pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; | ||
465 | pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; | ||
466 | pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; | ||
467 | pub const PTRACE_GETFPREGS: ::c_int = 14; | ||
468 | pub const PTRACE_SETFPREGS: ::c_int = 15; | ||
469 | pub const PTRACE_GETREGS: ::c_int = 12; | ||
470 | pub const PTRACE_SETREGS: ::c_int = 13; | ||
471 | |||
472 | pub const EFD_NONBLOCK: ::c_int = 0x800; | ||
473 | |||
474 | pub const F_GETLK: ::c_int = 5; | ||
475 | pub const F_GETOWN: ::c_int = 9; | ||
476 | pub const F_SETOWN: ::c_int = 8; | ||
477 | pub const F_SETLK: ::c_int = 6; | ||
478 | pub const F_SETLKW: ::c_int = 7; | ||
479 | |||
480 | pub const TCGETS: ::c_int = 0x5401; | ||
481 | pub const TCSETS: ::c_int = 0x5402; | ||
482 | pub const TCSETSW: ::c_int = 0x5403; | ||
483 | pub const TCSETSF: ::c_int = 0x5404; | ||
484 | pub const TCGETA: ::c_int = 0x5405; | ||
485 | pub const TCSETA: ::c_int = 0x5406; | ||
486 | pub const TCSETAW: ::c_int = 0x5407; | ||
487 | pub const TCSETAF: ::c_int = 0x5408; | ||
488 | pub const TCSBRK: ::c_int = 0x5409; | ||
489 | pub const TCXONC: ::c_int = 0x540A; | ||
490 | pub const TCFLSH: ::c_int = 0x540B; | ||
491 | pub const TIOCGSOFTCAR: ::c_int = 0x5419; | ||
492 | pub const TIOCSSOFTCAR: ::c_int = 0x541A; | ||
493 | pub const TIOCINQ: ::c_int = 0x541B; | ||
494 | pub const TIOCLINUX: ::c_int = 0x541C; | ||
495 | pub const TIOCGSERIAL: ::c_int = 0x541E; | ||
496 | pub const TIOCEXCL: ::c_int = 0x540C; | ||
497 | pub const TIOCNXCL: ::c_int = 0x540D; | ||
498 | pub const TIOCSCTTY: ::c_int = 0x540E; | ||
499 | pub const TIOCGPGRP: ::c_int = 0x540F; | ||
500 | pub const TIOCSPGRP: ::c_int = 0x5410; | ||
501 | pub const TIOCOUTQ: ::c_int = 0x5411; | ||
502 | pub const TIOCSTI: ::c_int = 0x5412; | ||
503 | pub const TIOCGWINSZ: ::c_int = 0x5413; | ||
504 | pub const TIOCSWINSZ: ::c_int = 0x5414; | ||
505 | pub const TIOCMGET: ::c_int = 0x5415; | ||
506 | pub const TIOCMBIS: ::c_int = 0x5416; | ||
507 | pub const TIOCMBIC: ::c_int = 0x5417; | ||
508 | pub const TIOCMSET: ::c_int = 0x5418; | ||
509 | pub const FIONREAD: ::c_int = 0x541B; | ||
510 | pub const TIOCCONS: ::c_int = 0x541D; | ||
511 | |||
512 | pub const RTLD_GLOBAL: ::c_int = 0x2; | ||
513 | pub const RTLD_NOLOAD: ::c_int = 0x4; | ||
514 | pub const RTLD_NOW: ::c_int = 0; | ||
515 | pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void; | ||
516 | |||
517 | pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t; | ||
518 | |||
519 | pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; | ||
520 | pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; | ||
521 | pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; | ||
522 | pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; | ||
523 | pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; | ||
524 | |||
525 | pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; | ||
526 | pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; | ||
527 | pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; | ||
528 | pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; | ||
529 | pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; | ||
530 | pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; | ||
531 | pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; | ||
532 | pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; | ||
533 | |||
534 | f! { | ||
535 | pub fn sigemptyset(set: *mut sigset_t) -> ::c_int { | ||
536 | *set = 0; | ||
537 | return 0 | ||
538 | } | ||
539 | pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int { | ||
540 | *set |= signum as sigset_t; | ||
541 | return 0 | ||
542 | } | ||
543 | pub fn sigfillset(set: *mut sigset_t) -> ::c_int { | ||
544 | *set = !0; | ||
545 | return 0 | ||
546 | } | ||
547 | pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int { | ||
548 | *set &= !(signum as sigset_t); | ||
549 | return 0 | ||
550 | } | ||
551 | pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int { | ||
552 | (*set & (signum as sigset_t)) as ::c_int | ||
553 | } | ||
554 | pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t { | ||
555 | (*termios).c_cflag & ::CBAUD | ||
556 | } | ||
557 | pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t { | ||
558 | (*termios).c_cflag & ::CBAUD | ||
559 | } | ||
560 | pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int { | ||
561 | let cbaud = ::CBAUD; | ||
562 | (*termios).c_cflag = ((*termios).c_cflag & !cbaud) | (speed & cbaud); | ||
563 | return 0 | ||
564 | } | ||
565 | pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int { | ||
566 | let cbaud = ::CBAUD; | ||
567 | (*termios).c_cflag = ((*termios).c_cflag & !cbaud) | (speed & cbaud); | ||
568 | return 0 | ||
569 | } | ||
570 | pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int { | ||
571 | ioctl(fd, ::TCGETS, termios) | ||
572 | } | ||
573 | pub fn tcsetattr(fd: ::c_int, | ||
574 | optional_actions: ::c_int, | ||
575 | termios: *const ::termios) -> ::c_int { | ||
576 | ioctl(fd, optional_actions, termios) | ||
577 | } | ||
578 | pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int { | ||
579 | ioctl(fd, ::TCXONC, action as *mut ::c_void) | ||
580 | } | ||
581 | pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int { | ||
582 | ioctl(fd, ::TCFLSH, action as *mut ::c_void) | ||
583 | } | ||
584 | pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int { | ||
585 | ioctl(fd, TCSBRKP, duration as *mut ::c_void) | ||
586 | } | ||
587 | } | ||
588 | |||
589 | extern { | ||
590 | static mut __progname: *mut ::c_char; | ||
591 | } | ||
592 | |||
593 | extern { | ||
594 | pub fn madvise(addr: *const ::c_void, len: ::size_t, advice: ::c_int) | ||
595 | -> ::c_int; | ||
596 | pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; | ||
597 | pub fn readlink(path: *const ::c_char, | ||
598 | buf: *mut ::c_char, | ||
599 | bufsz: ::size_t) | ||
600 | -> ::c_int; | ||
601 | pub fn msync(addr: *const ::c_void, len: ::size_t, | ||
602 | flags: ::c_int) -> ::c_int; | ||
603 | pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) | ||
604 | -> ::c_int; | ||
605 | pub fn sysconf(name: ::c_int) -> ::c_long; | ||
606 | pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, | ||
607 | flags: ::c_int, addr: *const ::sockaddr, | ||
608 | addrlen: *mut ::socklen_t) -> ::ssize_t; | ||
609 | pub fn getnameinfo(sa: *const ::sockaddr, | ||
610 | salen: ::socklen_t, | ||
611 | host: *mut ::c_char, | ||
612 | hostlen: ::size_t, | ||
613 | serv: *mut ::c_char, | ||
614 | sevlen: ::size_t, | ||
615 | flags: ::c_int) -> ::c_int; | ||
616 | pub fn ptrace(request: ::c_int, ...) -> ::c_long; | ||
617 | pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int; | ||
618 | pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; | ||
619 | pub fn __sched_cpualloc(count: ::size_t) -> *mut ::cpu_set_t; | ||
620 | pub fn __sched_cpufree(set: *mut ::cpu_set_t); | ||
621 | pub fn __sched_cpucount(setsize: ::size_t, set: *mut cpu_set_t) -> ::c_int; | ||
622 | pub fn sched_getcpu() -> ::c_int; | ||
623 | |||
624 | pub fn utmpname(name: *const ::c_char) -> ::c_int; | ||
625 | pub fn setutent(); | ||
626 | pub fn getutent() -> *mut utmp; | ||
627 | } | ||
628 | |||
629 | cfg_if! { | ||
630 | if #[cfg(target_pointer_width = "32")] { | ||
631 | mod b32; | ||
632 | pub use self::b32::*; | ||
633 | } else if #[cfg(target_pointer_width = "64")] { | ||
634 | mod b64; | ||
635 | pub use self::b64::*; | ||
636 | } else { | ||
637 | // Unknown target_pointer_width | ||
638 | } | ||
639 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/mips.rs b/third_party/libc/src/unix/notbsd/linux/mips.rs new file mode 100644 index 0000000..c3a1edc --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/mips.rs | |||
@@ -0,0 +1,579 @@ | |||
1 | pub type c_char = i8; | ||
2 | pub type c_long = i32; | ||
3 | pub type c_ulong = u32; | ||
4 | pub type clock_t = i32; | ||
5 | pub type time_t = i32; | ||
6 | pub type suseconds_t = i32; | ||
7 | pub type wchar_t = i32; | ||
8 | pub type off_t = i32; | ||
9 | pub type ino_t = u32; | ||
10 | pub type blkcnt_t = i32; | ||
11 | pub type blksize_t = i32; | ||
12 | pub type nlink_t = u32; | ||
13 | pub type fsblkcnt_t = ::c_ulong; | ||
14 | pub type fsfilcnt_t = ::c_ulong; | ||
15 | pub type rlim_t = c_ulong; | ||
16 | |||
17 | s! { | ||
18 | pub struct stat { | ||
19 | pub st_dev: ::c_ulong, | ||
20 | st_pad1: [::c_long; 3], | ||
21 | pub st_ino: ::ino_t, | ||
22 | pub st_mode: ::mode_t, | ||
23 | pub st_nlink: ::nlink_t, | ||
24 | pub st_uid: ::uid_t, | ||
25 | pub st_gid: ::gid_t, | ||
26 | pub st_rdev: ::c_ulong, | ||
27 | pub st_pad2: [::c_long; 2], | ||
28 | pub st_size: ::off_t, | ||
29 | st_pad3: ::c_long, | ||
30 | pub st_atime: ::time_t, | ||
31 | pub st_atime_nsec: ::c_long, | ||
32 | pub st_mtime: ::time_t, | ||
33 | pub st_mtime_nsec: ::c_long, | ||
34 | pub st_ctime: ::time_t, | ||
35 | pub st_ctime_nsec: ::c_long, | ||
36 | pub st_blksize: ::blksize_t, | ||
37 | pub st_blocks: ::blkcnt_t, | ||
38 | st_pad5: [::c_long; 14], | ||
39 | } | ||
40 | |||
41 | pub struct stat64 { | ||
42 | pub st_dev: ::c_ulong, | ||
43 | st_pad1: [::c_long; 3], | ||
44 | pub st_ino: ::ino64_t, | ||
45 | pub st_mode: ::mode_t, | ||
46 | pub st_nlink: ::nlink_t, | ||
47 | pub st_uid: ::uid_t, | ||
48 | pub st_gid: ::gid_t, | ||
49 | pub st_rdev: ::c_ulong, | ||
50 | st_pad2: [::c_long; 2], | ||
51 | pub st_size: ::off64_t, | ||
52 | pub st_atime: ::time_t, | ||
53 | pub st_atime_nsec: ::c_long, | ||
54 | pub st_mtime: ::time_t, | ||
55 | pub st_mtime_nsec: ::c_long, | ||
56 | pub st_ctime: ::time_t, | ||
57 | pub st_ctime_nsec: ::c_long, | ||
58 | pub st_blksize: ::blksize_t, | ||
59 | st_pad3: ::c_long, | ||
60 | pub st_blocks: ::blkcnt64_t, | ||
61 | st_pad5: [::c_long; 14], | ||
62 | } | ||
63 | |||
64 | pub struct pthread_attr_t { | ||
65 | __size: [u32; 9] | ||
66 | } | ||
67 | |||
68 | pub struct sigaction { | ||
69 | pub sa_flags: ::c_int, | ||
70 | pub sa_sigaction: ::sighandler_t, | ||
71 | pub sa_mask: sigset_t, | ||
72 | _restorer: *mut ::c_void, | ||
73 | _resv: [::c_int; 1], | ||
74 | } | ||
75 | |||
76 | pub struct stack_t { | ||
77 | pub ss_sp: *mut ::c_void, | ||
78 | pub ss_size: ::size_t, | ||
79 | pub ss_flags: ::c_int, | ||
80 | } | ||
81 | |||
82 | pub struct sigset_t { | ||
83 | __val: [::c_ulong; 32], | ||
84 | } | ||
85 | |||
86 | pub struct siginfo_t { | ||
87 | pub si_signo: ::c_int, | ||
88 | pub si_code: ::c_int, | ||
89 | pub si_errno: ::c_int, | ||
90 | pub _pad: [::c_int; 29], | ||
91 | } | ||
92 | |||
93 | pub struct glob64_t { | ||
94 | pub gl_pathc: ::size_t, | ||
95 | pub gl_pathv: *mut *mut ::c_char, | ||
96 | pub gl_offs: ::size_t, | ||
97 | pub gl_flags: ::c_int, | ||
98 | |||
99 | __unused1: *mut ::c_void, | ||
100 | __unused2: *mut ::c_void, | ||
101 | __unused3: *mut ::c_void, | ||
102 | __unused4: *mut ::c_void, | ||
103 | __unused5: *mut ::c_void, | ||
104 | } | ||
105 | |||
106 | pub struct ipc_perm { | ||
107 | pub __key: ::key_t, | ||
108 | pub uid: ::uid_t, | ||
109 | pub gid: ::gid_t, | ||
110 | pub cuid: ::uid_t, | ||
111 | pub cgid: ::gid_t, | ||
112 | pub mode: ::c_uint, | ||
113 | pub __seq: ::c_ushort, | ||
114 | __pad1: ::c_ushort, | ||
115 | __unused1: ::c_ulong, | ||
116 | __unused2: ::c_ulong | ||
117 | } | ||
118 | |||
119 | pub struct shmid_ds { | ||
120 | pub shm_perm: ::ipc_perm, | ||
121 | pub shm_segsz: ::size_t, | ||
122 | pub shm_atime: ::time_t, | ||
123 | pub shm_dtime: ::time_t, | ||
124 | pub shm_ctime: ::time_t, | ||
125 | pub shm_cpid: ::pid_t, | ||
126 | pub shm_lpid: ::pid_t, | ||
127 | pub shm_nattch: ::shmatt_t, | ||
128 | __unused4: ::c_ulong, | ||
129 | __unused5: ::c_ulong | ||
130 | } | ||
131 | |||
132 | pub struct statfs { | ||
133 | pub f_type: ::c_long, | ||
134 | pub f_bsize: ::c_long, | ||
135 | pub f_frsize: ::c_long, | ||
136 | pub f_blocks: ::fsblkcnt_t, | ||
137 | pub f_bfree: ::fsblkcnt_t, | ||
138 | pub f_files: ::fsblkcnt_t, | ||
139 | pub f_ffree: ::fsblkcnt_t, | ||
140 | pub f_bavail: ::fsblkcnt_t, | ||
141 | pub f_fsid: ::fsid_t, | ||
142 | |||
143 | pub f_namelen: ::c_long, | ||
144 | f_spare: [::c_long; 6], | ||
145 | } | ||
146 | |||
147 | pub struct msghdr { | ||
148 | pub msg_name: *mut ::c_void, | ||
149 | pub msg_namelen: ::socklen_t, | ||
150 | pub msg_iov: *mut ::iovec, | ||
151 | pub msg_iovlen: ::size_t, | ||
152 | pub msg_control: *mut ::c_void, | ||
153 | pub msg_controllen: ::size_t, | ||
154 | pub msg_flags: ::c_int, | ||
155 | } | ||
156 | |||
157 | pub struct termios { | ||
158 | pub c_iflag: ::tcflag_t, | ||
159 | pub c_oflag: ::tcflag_t, | ||
160 | pub c_cflag: ::tcflag_t, | ||
161 | pub c_lflag: ::tcflag_t, | ||
162 | pub c_line: ::cc_t, | ||
163 | pub c_cc: [::cc_t; ::NCCS], | ||
164 | } | ||
165 | |||
166 | pub struct flock { | ||
167 | pub l_type: ::c_short, | ||
168 | pub l_whence: ::c_short, | ||
169 | pub l_start: ::off_t, | ||
170 | pub l_len: ::off_t, | ||
171 | pub l_sysid: ::c_long, | ||
172 | pub l_pid: ::pid_t, | ||
173 | pad: [::c_long; 4], | ||
174 | } | ||
175 | |||
176 | pub struct sysinfo { | ||
177 | pub uptime: ::c_long, | ||
178 | pub loads: [::c_ulong; 3], | ||
179 | pub totalram: ::c_ulong, | ||
180 | pub freeram: ::c_ulong, | ||
181 | pub sharedram: ::c_ulong, | ||
182 | pub bufferram: ::c_ulong, | ||
183 | pub totalswap: ::c_ulong, | ||
184 | pub freeswap: ::c_ulong, | ||
185 | pub procs: ::c_ushort, | ||
186 | pub pad: ::c_ushort, | ||
187 | pub totalhigh: ::c_ulong, | ||
188 | pub freehigh: ::c_ulong, | ||
189 | pub mem_unit: ::c_uint, | ||
190 | pub _f: [::c_char; 8], | ||
191 | } | ||
192 | |||
193 | // FIXME this is actually a union | ||
194 | pub struct sem_t { | ||
195 | #[cfg(target_pointer_width = "32")] | ||
196 | __size: [::c_char; 16], | ||
197 | #[cfg(target_pointer_width = "64")] | ||
198 | __size: [::c_char; 32], | ||
199 | __align: [::c_long; 0], | ||
200 | } | ||
201 | } | ||
202 | |||
203 | pub const BUFSIZ: ::c_uint = 8192; | ||
204 | pub const TMP_MAX: ::c_uint = 238328; | ||
205 | pub const FOPEN_MAX: ::c_uint = 16; | ||
206 | pub const POSIX_MADV_DONTNEED: ::c_int = 4; | ||
207 | pub const _SC_2_C_VERSION: ::c_int = 96; | ||
208 | pub const RUSAGE_THREAD: ::c_int = 1; | ||
209 | pub const O_ACCMODE: ::c_int = 3; | ||
210 | pub const O_DIRECT: ::c_int = 0x8000; | ||
211 | pub const O_DIRECTORY: ::c_int = 0x10000; | ||
212 | pub const O_NOFOLLOW: ::c_int = 0x20000; | ||
213 | pub const RUSAGE_CHILDREN: ::c_int = -1; | ||
214 | pub const ST_RELATIME: ::c_ulong = 4096; | ||
215 | pub const NI_MAXHOST: ::socklen_t = 1025; | ||
216 | |||
217 | pub const RLIMIT_NOFILE: ::c_int = 5; | ||
218 | pub const RLIMIT_AS: ::c_int = 6; | ||
219 | pub const RLIMIT_RSS: ::c_int = 7; | ||
220 | pub const RLIMIT_NPROC: ::c_int = 8; | ||
221 | pub const RLIMIT_MEMLOCK: ::c_int = 9; | ||
222 | pub const RLIMIT_NLIMITS: ::c_int = 16; | ||
223 | pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff; | ||
224 | |||
225 | pub const O_APPEND: ::c_int = 8; | ||
226 | pub const O_CREAT: ::c_int = 256; | ||
227 | pub const O_EXCL: ::c_int = 1024; | ||
228 | pub const O_NOCTTY: ::c_int = 2048; | ||
229 | pub const O_NONBLOCK: ::c_int = 128; | ||
230 | pub const O_SYNC: ::c_int = 0x4010; | ||
231 | pub const O_RSYNC: ::c_int = 0x4010; | ||
232 | pub const O_DSYNC: ::c_int = 0x10; | ||
233 | pub const O_FSYNC: ::c_int = 0x4010; | ||
234 | pub const O_ASYNC: ::c_int = 0x1000; | ||
235 | pub const O_NDELAY: ::c_int = 0x80; | ||
236 | |||
237 | pub const SOCK_NONBLOCK: ::c_int = 128; | ||
238 | |||
239 | pub const EDEADLK: ::c_int = 45; | ||
240 | pub const ENAMETOOLONG: ::c_int = 78; | ||
241 | pub const ENOLCK: ::c_int = 46; | ||
242 | pub const ENOSYS: ::c_int = 89; | ||
243 | pub const ENOTEMPTY: ::c_int = 93; | ||
244 | pub const ELOOP: ::c_int = 90; | ||
245 | pub const ENOMSG: ::c_int = 35; | ||
246 | pub const EIDRM: ::c_int = 36; | ||
247 | pub const ECHRNG: ::c_int = 37; | ||
248 | pub const EL2NSYNC: ::c_int = 38; | ||
249 | pub const EL3HLT: ::c_int = 39; | ||
250 | pub const EL3RST: ::c_int = 40; | ||
251 | pub const ELNRNG: ::c_int = 41; | ||
252 | pub const EUNATCH: ::c_int = 42; | ||
253 | pub const ENOCSI: ::c_int = 43; | ||
254 | pub const EL2HLT: ::c_int = 44; | ||
255 | pub const EBADE: ::c_int = 50; | ||
256 | pub const EBADR: ::c_int = 51; | ||
257 | pub const EXFULL: ::c_int = 52; | ||
258 | pub const ENOANO: ::c_int = 53; | ||
259 | pub const EBADRQC: ::c_int = 54; | ||
260 | pub const EBADSLT: ::c_int = 55; | ||
261 | pub const EDEADLOCK: ::c_int = 56; | ||
262 | pub const EMULTIHOP: ::c_int = 74; | ||
263 | pub const EOVERFLOW: ::c_int = 79; | ||
264 | pub const ENOTUNIQ: ::c_int = 80; | ||
265 | pub const EBADFD: ::c_int = 81; | ||
266 | pub const EBADMSG: ::c_int = 77; | ||
267 | pub const EREMCHG: ::c_int = 82; | ||
268 | pub const ELIBACC: ::c_int = 83; | ||
269 | pub const ELIBBAD: ::c_int = 84; | ||
270 | pub const ELIBSCN: ::c_int = 85; | ||
271 | pub const ELIBMAX: ::c_int = 86; | ||
272 | pub const ELIBEXEC: ::c_int = 87; | ||
273 | pub const EILSEQ: ::c_int = 88; | ||
274 | pub const ERESTART: ::c_int = 91; | ||
275 | pub const ESTRPIPE: ::c_int = 92; | ||
276 | pub const EUSERS: ::c_int = 94; | ||
277 | pub const ENOTSOCK: ::c_int = 95; | ||
278 | pub const EDESTADDRREQ: ::c_int = 96; | ||
279 | pub const EMSGSIZE: ::c_int = 97; | ||
280 | pub const EPROTOTYPE: ::c_int = 98; | ||
281 | pub const ENOPROTOOPT: ::c_int = 99; | ||
282 | pub const EPROTONOSUPPORT: ::c_int = 120; | ||
283 | pub const ESOCKTNOSUPPORT: ::c_int = 121; | ||
284 | pub const EOPNOTSUPP: ::c_int = 122; | ||
285 | pub const EPFNOSUPPORT: ::c_int = 123; | ||
286 | pub const EAFNOSUPPORT: ::c_int = 124; | ||
287 | pub const EADDRINUSE: ::c_int = 125; | ||
288 | pub const EADDRNOTAVAIL: ::c_int = 126; | ||
289 | pub const ENETDOWN: ::c_int = 127; | ||
290 | pub const ENETUNREACH: ::c_int = 128; | ||
291 | pub const ENETRESET: ::c_int = 129; | ||
292 | pub const ECONNABORTED: ::c_int = 130; | ||
293 | pub const ECONNRESET: ::c_int = 131; | ||
294 | pub const ENOBUFS: ::c_int = 132; | ||
295 | pub const EISCONN: ::c_int = 133; | ||
296 | pub const ENOTCONN: ::c_int = 134; | ||
297 | pub const ESHUTDOWN: ::c_int = 143; | ||
298 | pub const ETOOMANYREFS: ::c_int = 144; | ||
299 | pub const ETIMEDOUT: ::c_int = 145; | ||
300 | pub const ECONNREFUSED: ::c_int = 146; | ||
301 | pub const EHOSTDOWN: ::c_int = 147; | ||
302 | pub const EHOSTUNREACH: ::c_int = 148; | ||
303 | pub const EALREADY: ::c_int = 149; | ||
304 | pub const EINPROGRESS: ::c_int = 150; | ||
305 | pub const ESTALE: ::c_int = 151; | ||
306 | pub const EUCLEAN: ::c_int = 135; | ||
307 | pub const ENOTNAM: ::c_int = 137; | ||
308 | pub const ENAVAIL: ::c_int = 138; | ||
309 | pub const EISNAM: ::c_int = 139; | ||
310 | pub const EREMOTEIO: ::c_int = 140; | ||
311 | pub const EDQUOT: ::c_int = 1133; | ||
312 | pub const ENOMEDIUM: ::c_int = 159; | ||
313 | pub const EMEDIUMTYPE: ::c_int = 160; | ||
314 | pub const ECANCELED: ::c_int = 158; | ||
315 | pub const ENOKEY: ::c_int = 161; | ||
316 | pub const EKEYEXPIRED: ::c_int = 162; | ||
317 | pub const EKEYREVOKED: ::c_int = 163; | ||
318 | pub const EKEYREJECTED: ::c_int = 164; | ||
319 | pub const EOWNERDEAD: ::c_int = 165; | ||
320 | pub const ENOTRECOVERABLE: ::c_int = 166; | ||
321 | pub const ERFKILL: ::c_int = 167; | ||
322 | |||
323 | pub const LC_PAPER: ::c_int = 7; | ||
324 | pub const LC_NAME: ::c_int = 8; | ||
325 | pub const LC_ADDRESS: ::c_int = 9; | ||
326 | pub const LC_TELEPHONE: ::c_int = 10; | ||
327 | pub const LC_MEASUREMENT: ::c_int = 11; | ||
328 | pub const LC_IDENTIFICATION: ::c_int = 12; | ||
329 | pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); | ||
330 | pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); | ||
331 | pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); | ||
332 | pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); | ||
333 | pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); | ||
334 | pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); | ||
335 | pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK | ||
336 | | ::LC_NUMERIC_MASK | ||
337 | | ::LC_TIME_MASK | ||
338 | | ::LC_COLLATE_MASK | ||
339 | | ::LC_MONETARY_MASK | ||
340 | | ::LC_MESSAGES_MASK | ||
341 | | LC_PAPER_MASK | ||
342 | | LC_NAME_MASK | ||
343 | | LC_ADDRESS_MASK | ||
344 | | LC_TELEPHONE_MASK | ||
345 | | LC_MEASUREMENT_MASK | ||
346 | | LC_IDENTIFICATION_MASK; | ||
347 | |||
348 | pub const MAP_NORESERVE: ::c_int = 0x400; | ||
349 | pub const MAP_ANON: ::c_int = 0x800; | ||
350 | pub const MAP_ANONYMOUS: ::c_int = 0x800; | ||
351 | pub const MAP_GROWSDOWN: ::c_int = 0x1000; | ||
352 | pub const MAP_DENYWRITE: ::c_int = 0x2000; | ||
353 | pub const MAP_EXECUTABLE: ::c_int = 0x4000; | ||
354 | pub const MAP_LOCKED: ::c_int = 0x8000; | ||
355 | pub const MAP_POPULATE: ::c_int = 0x10000; | ||
356 | pub const MAP_NONBLOCK: ::c_int = 0x20000; | ||
357 | pub const MAP_STACK: ::c_int = 0x40000; | ||
358 | |||
359 | pub const SOCK_STREAM: ::c_int = 2; | ||
360 | pub const SOCK_DGRAM: ::c_int = 1; | ||
361 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
362 | |||
363 | pub const SOL_SOCKET: ::c_int = 0xffff; | ||
364 | |||
365 | pub const SO_REUSEADDR: ::c_int = 4; | ||
366 | pub const SO_TYPE: ::c_int = 4104; | ||
367 | pub const SO_ERROR: ::c_int = 4103; | ||
368 | pub const SO_DONTROUTE: ::c_int = 16; | ||
369 | pub const SO_BROADCAST: ::c_int = 32; | ||
370 | pub const SO_SNDBUF: ::c_int = 4097; | ||
371 | pub const SO_RCVBUF: ::c_int = 4098; | ||
372 | pub const SO_KEEPALIVE: ::c_int = 8; | ||
373 | pub const SO_OOBINLINE: ::c_int = 256; | ||
374 | pub const SO_LINGER: ::c_int = 128; | ||
375 | pub const SO_RCVLOWAT: ::c_int = 4100; | ||
376 | pub const SO_SNDLOWAT: ::c_int = 4099; | ||
377 | pub const SO_RCVTIMEO: ::c_int = 4102; | ||
378 | pub const SO_SNDTIMEO: ::c_int = 4101; | ||
379 | pub const SO_ACCEPTCONN: ::c_int = 4105; | ||
380 | |||
381 | pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; | ||
382 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; | ||
383 | pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; | ||
384 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; | ||
385 | |||
386 | pub const FIOCLEX: ::c_ulong = 0x6601; | ||
387 | pub const FIONBIO: ::c_ulong = 0x667e; | ||
388 | |||
389 | pub const SA_ONSTACK: ::c_int = 0x08000000; | ||
390 | pub const SA_SIGINFO: ::c_int = 0x00000008; | ||
391 | pub const SA_NOCLDWAIT: ::c_int = 0x00010000; | ||
392 | |||
393 | pub const SIGCHLD: ::c_int = 18; | ||
394 | pub const SIGBUS: ::c_int = 10; | ||
395 | pub const SIGTTIN: ::c_int = 26; | ||
396 | pub const SIGTTOU: ::c_int = 27; | ||
397 | pub const SIGXCPU: ::c_int = 30; | ||
398 | pub const SIGXFSZ: ::c_int = 31; | ||
399 | pub const SIGVTALRM: ::c_int = 28; | ||
400 | pub const SIGPROF: ::c_int = 29; | ||
401 | pub const SIGWINCH: ::c_int = 20; | ||
402 | pub const SIGUSR1: ::c_int = 16; | ||
403 | pub const SIGUSR2: ::c_int = 17; | ||
404 | pub const SIGCONT: ::c_int = 25; | ||
405 | pub const SIGSTOP: ::c_int = 23; | ||
406 | pub const SIGTSTP: ::c_int = 24; | ||
407 | pub const SIGURG: ::c_int = 21; | ||
408 | pub const SIGIO: ::c_int = 22; | ||
409 | pub const SIGSYS: ::c_int = 12; | ||
410 | pub const SIGPOLL: ::c_int = 22; | ||
411 | pub const SIGPWR: ::c_int = 19; | ||
412 | pub const SIG_SETMASK: ::c_int = 3; | ||
413 | pub const SIG_BLOCK: ::c_int = 0x1; | ||
414 | pub const SIG_UNBLOCK: ::c_int = 0x2; | ||
415 | |||
416 | pub const POLLRDNORM: ::c_short = 0x040; | ||
417 | pub const POLLWRNORM: ::c_short = 0x004; | ||
418 | pub const POLLRDBAND: ::c_short = 0x080; | ||
419 | pub const POLLWRBAND: ::c_short = 0x100; | ||
420 | |||
421 | pub const PTHREAD_STACK_MIN: ::size_t = 131072; | ||
422 | |||
423 | pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; | ||
424 | pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; | ||
425 | pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; | ||
426 | pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; | ||
427 | pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; | ||
428 | pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
429 | pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
430 | pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
431 | pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; | ||
432 | pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; | ||
433 | pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; | ||
434 | pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; | ||
435 | pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; | ||
436 | pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; | ||
437 | pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; | ||
438 | pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; | ||
439 | pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; | ||
440 | pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; | ||
441 | pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; | ||
442 | pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; | ||
443 | pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; | ||
444 | pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; | ||
445 | pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; | ||
446 | pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; | ||
447 | pub const TMPFS_MAGIC: ::c_long = 0x01021994; | ||
448 | pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; | ||
449 | |||
450 | pub const VEOF: usize = 16; | ||
451 | pub const VEOL: usize = 17; | ||
452 | pub const VEOL2: usize = 6; | ||
453 | pub const VMIN: usize = 4; | ||
454 | pub const IEXTEN: ::tcflag_t = 0x00000100; | ||
455 | pub const TOSTOP: ::tcflag_t = 0x00008000; | ||
456 | pub const FLUSHO: ::tcflag_t = 0x00002000; | ||
457 | pub const IUTF8: ::tcflag_t = 0x00004000; | ||
458 | pub const TCSANOW: ::c_int = 0x540e; | ||
459 | pub const TCSADRAIN: ::c_int = 0x540f; | ||
460 | pub const TCSAFLUSH: ::c_int = 0x5410; | ||
461 | |||
462 | pub const CPU_SETSIZE: ::c_int = 0x400; | ||
463 | |||
464 | pub const PTRACE_TRACEME: ::c_uint = 0; | ||
465 | pub const PTRACE_PEEKTEXT: ::c_uint = 1; | ||
466 | pub const PTRACE_PEEKDATA: ::c_uint = 2; | ||
467 | pub const PTRACE_PEEKUSER: ::c_uint = 3; | ||
468 | pub const PTRACE_POKETEXT: ::c_uint = 4; | ||
469 | pub const PTRACE_POKEDATA: ::c_uint = 5; | ||
470 | pub const PTRACE_POKEUSER: ::c_uint = 6; | ||
471 | pub const PTRACE_CONT: ::c_uint = 7; | ||
472 | pub const PTRACE_KILL: ::c_uint = 8; | ||
473 | pub const PTRACE_SINGLESTEP: ::c_uint = 9; | ||
474 | pub const PTRACE_ATTACH: ::c_uint = 16; | ||
475 | pub const PTRACE_DETACH: ::c_uint = 17; | ||
476 | pub const PTRACE_SYSCALL: ::c_uint = 24; | ||
477 | pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; | ||
478 | pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; | ||
479 | pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; | ||
480 | pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; | ||
481 | pub const PTRACE_GETFPREGS: ::c_uint = 14; | ||
482 | pub const PTRACE_SETFPREGS: ::c_uint = 15; | ||
483 | pub const PTRACE_GETFPXREGS: ::c_uint = 18; | ||
484 | pub const PTRACE_SETFPXREGS: ::c_uint = 19; | ||
485 | pub const PTRACE_GETREGS: ::c_uint = 12; | ||
486 | pub const PTRACE_SETREGS: ::c_uint = 13; | ||
487 | |||
488 | pub const MAP_HUGETLB: ::c_int = 0x080000; | ||
489 | |||
490 | pub const EFD_NONBLOCK: ::c_int = 0x80; | ||
491 | |||
492 | pub const F_GETLK: ::c_int = 14; | ||
493 | pub const F_GETOWN: ::c_int = 23; | ||
494 | pub const F_SETOWN: ::c_int = 24; | ||
495 | pub const F_SETLK: ::c_int = 6; | ||
496 | pub const F_SETLKW: ::c_int = 7; | ||
497 | |||
498 | pub const SFD_NONBLOCK: ::c_int = 0x80; | ||
499 | |||
500 | pub const TCGETS: ::c_ulong = 0x540d; | ||
501 | pub const TCSETS: ::c_ulong = 0x540e; | ||
502 | pub const TCSETSW: ::c_ulong = 0x540f; | ||
503 | pub const TCSETSF: ::c_ulong = 0x5410; | ||
504 | pub const TCGETA: ::c_ulong = 0x5401; | ||
505 | pub const TCSETA: ::c_ulong = 0x5402; | ||
506 | pub const TCSETAW: ::c_ulong = 0x5403; | ||
507 | pub const TCSETAF: ::c_ulong = 0x5404; | ||
508 | pub const TCSBRK: ::c_ulong = 0x5405; | ||
509 | pub const TCXONC: ::c_ulong = 0x5406; | ||
510 | pub const TCFLSH: ::c_ulong = 0x5407; | ||
511 | pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; | ||
512 | pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; | ||
513 | pub const TIOCINQ: ::c_ulong = 0x467f; | ||
514 | pub const TIOCLINUX: ::c_ulong = 0x5483; | ||
515 | pub const TIOCGSERIAL: ::c_ulong = 0x5484; | ||
516 | pub const TIOCEXCL: ::c_ulong = 0x740d; | ||
517 | pub const TIOCNXCL: ::c_ulong = 0x740e; | ||
518 | pub const TIOCSCTTY: ::c_ulong = 0x5480; | ||
519 | pub const TIOCGPGRP: ::c_ulong = 0x40047477; | ||
520 | pub const TIOCSPGRP: ::c_ulong = 0x80047476; | ||
521 | pub const TIOCOUTQ: ::c_ulong = 0x7472; | ||
522 | pub const TIOCSTI: ::c_ulong = 0x5472; | ||
523 | pub const TIOCGWINSZ: ::c_ulong = 0x40087468; | ||
524 | pub const TIOCSWINSZ: ::c_ulong = 0x80087467; | ||
525 | pub const TIOCMGET: ::c_ulong = 0x741d; | ||
526 | pub const TIOCMBIS: ::c_ulong = 0x741b; | ||
527 | pub const TIOCMBIC: ::c_ulong = 0x741c; | ||
528 | pub const TIOCMSET: ::c_ulong = 0x741a; | ||
529 | pub const FIONREAD: ::c_ulong = 0x467f; | ||
530 | pub const TIOCCONS: ::c_ulong = 0x80047478; | ||
531 | |||
532 | pub const RTLD_DEEPBIND: ::c_int = 0x10; | ||
533 | pub const RTLD_GLOBAL: ::c_int = 0x4; | ||
534 | pub const RTLD_NOLOAD: ::c_int = 0x8; | ||
535 | |||
536 | pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; | ||
537 | pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; | ||
538 | pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; | ||
539 | pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; | ||
540 | pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; | ||
541 | |||
542 | pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; | ||
543 | pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; | ||
544 | pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; | ||
545 | pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; | ||
546 | pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; | ||
547 | pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; | ||
548 | pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; | ||
549 | pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; | ||
550 | |||
551 | pub const SYS_gettid: ::c_long = 4222; // Valid for O32 | ||
552 | |||
553 | #[link(name = "util")] | ||
554 | extern { | ||
555 | pub fn sysctl(name: *mut ::c_int, | ||
556 | namelen: ::c_int, | ||
557 | oldp: *mut ::c_void, | ||
558 | oldlenp: *mut ::size_t, | ||
559 | newp: *mut ::c_void, | ||
560 | newlen: ::size_t) | ||
561 | -> ::c_int; | ||
562 | pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; | ||
563 | pub fn backtrace(buf: *mut *mut ::c_void, | ||
564 | sz: ::c_int) -> ::c_int; | ||
565 | pub fn glob64(pattern: *const ::c_char, | ||
566 | flags: ::c_int, | ||
567 | errfunc: ::dox::Option<extern fn(epath: *const ::c_char, | ||
568 | errno: ::c_int) | ||
569 | -> ::c_int>, | ||
570 | pglob: *mut glob64_t) -> ::c_int; | ||
571 | pub fn globfree64(pglob: *mut glob64_t); | ||
572 | pub fn ptrace(request: ::c_uint, ...) -> ::c_long; | ||
573 | pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, | ||
574 | cpusetsize: ::size_t, | ||
575 | cpuset: *mut ::cpu_set_t) -> ::c_int; | ||
576 | pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, | ||
577 | cpusetsize: ::size_t, | ||
578 | cpuset: *const ::cpu_set_t) -> ::c_int; | ||
579 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/mod.rs b/third_party/libc/src/unix/notbsd/linux/mod.rs new file mode 100644 index 0000000..a909082 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/mod.rs | |||
@@ -0,0 +1,674 @@ | |||
1 | //! Linux-specific definitions for linux-like values | ||
2 | |||
3 | use dox::mem; | ||
4 | |||
5 | pub type useconds_t = u32; | ||
6 | pub type dev_t = u64; | ||
7 | pub type socklen_t = u32; | ||
8 | pub type pthread_t = c_ulong; | ||
9 | pub type mode_t = u32; | ||
10 | pub type ino64_t = u64; | ||
11 | pub type off64_t = i64; | ||
12 | pub type blkcnt64_t = i64; | ||
13 | pub type rlim64_t = u64; | ||
14 | pub type key_t = ::c_int; | ||
15 | pub type shmatt_t = ::c_ulong; | ||
16 | pub type mqd_t = ::c_int; | ||
17 | pub type nfds_t = ::c_ulong; | ||
18 | pub type nl_item = ::c_int; | ||
19 | |||
20 | pub enum fpos64_t {} // TODO: fill this out with a struct | ||
21 | |||
22 | s! { | ||
23 | pub struct dirent { | ||
24 | pub d_ino: ::ino_t, | ||
25 | pub d_off: ::off_t, | ||
26 | pub d_reclen: ::c_ushort, | ||
27 | pub d_type: ::c_uchar, | ||
28 | pub d_name: [::c_char; 256], | ||
29 | } | ||
30 | |||
31 | pub struct dirent64 { | ||
32 | pub d_ino: ::ino64_t, | ||
33 | pub d_off: ::off64_t, | ||
34 | pub d_reclen: ::c_ushort, | ||
35 | pub d_type: ::c_uchar, | ||
36 | pub d_name: [::c_char; 256], | ||
37 | } | ||
38 | |||
39 | pub struct rlimit64 { | ||
40 | pub rlim_cur: rlim64_t, | ||
41 | pub rlim_max: rlim64_t, | ||
42 | } | ||
43 | |||
44 | pub struct glob_t { | ||
45 | pub gl_pathc: ::size_t, | ||
46 | pub gl_pathv: *mut *mut c_char, | ||
47 | pub gl_offs: ::size_t, | ||
48 | pub gl_flags: ::c_int, | ||
49 | |||
50 | __unused1: *mut ::c_void, | ||
51 | __unused2: *mut ::c_void, | ||
52 | __unused3: *mut ::c_void, | ||
53 | __unused4: *mut ::c_void, | ||
54 | __unused5: *mut ::c_void, | ||
55 | } | ||
56 | |||
57 | pub struct ifaddrs { | ||
58 | pub ifa_next: *mut ifaddrs, | ||
59 | pub ifa_name: *mut c_char, | ||
60 | pub ifa_flags: ::c_uint, | ||
61 | pub ifa_addr: *mut ::sockaddr, | ||
62 | pub ifa_netmask: *mut ::sockaddr, | ||
63 | pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union | ||
64 | pub ifa_data: *mut ::c_void | ||
65 | } | ||
66 | |||
67 | pub struct pthread_mutex_t { | ||
68 | #[cfg(any(target_arch = "mips", target_arch = "mipsel", | ||
69 | target_arch = "arm"))] | ||
70 | __align: [::c_long; 0], | ||
71 | #[cfg(not(any(target_arch = "mips", target_arch = "mipsel", | ||
72 | target_arch = "arm")))] | ||
73 | __align: [::c_longlong; 0], | ||
74 | size: [u8; __SIZEOF_PTHREAD_MUTEX_T], | ||
75 | } | ||
76 | |||
77 | pub struct pthread_rwlock_t { | ||
78 | #[cfg(any(target_arch = "mips", target_arch = "mipsel", | ||
79 | target_arch = "arm"))] | ||
80 | __align: [::c_long; 0], | ||
81 | #[cfg(not(any(target_arch = "mips", target_arch = "mipsel", | ||
82 | target_arch = "arm")))] | ||
83 | __align: [::c_longlong; 0], | ||
84 | size: [u8; __SIZEOF_PTHREAD_RWLOCK_T], | ||
85 | } | ||
86 | |||
87 | pub struct pthread_mutexattr_t { | ||
88 | #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))] | ||
89 | __align: [::c_int; 0], | ||
90 | #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64")))] | ||
91 | __align: [::c_long; 0], | ||
92 | size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T], | ||
93 | } | ||
94 | |||
95 | pub struct pthread_cond_t { | ||
96 | #[cfg(any(target_env = "musl"))] | ||
97 | __align: [*const ::c_void; 0], | ||
98 | #[cfg(not(any(target_env = "musl")))] | ||
99 | __align: [::c_longlong; 0], | ||
100 | size: [u8; __SIZEOF_PTHREAD_COND_T], | ||
101 | } | ||
102 | |||
103 | pub struct pthread_condattr_t { | ||
104 | __align: [::c_int; 0], | ||
105 | size: [u8; __SIZEOF_PTHREAD_CONDATTR_T], | ||
106 | } | ||
107 | |||
108 | pub struct passwd { | ||
109 | pub pw_name: *mut ::c_char, | ||
110 | pub pw_passwd: *mut ::c_char, | ||
111 | pub pw_uid: ::uid_t, | ||
112 | pub pw_gid: ::gid_t, | ||
113 | pub pw_gecos: *mut ::c_char, | ||
114 | pub pw_dir: *mut ::c_char, | ||
115 | pub pw_shell: *mut ::c_char, | ||
116 | } | ||
117 | |||
118 | pub struct statvfs { | ||
119 | pub f_bsize: ::c_ulong, | ||
120 | pub f_frsize: ::c_ulong, | ||
121 | pub f_blocks: ::fsblkcnt_t, | ||
122 | pub f_bfree: ::fsblkcnt_t, | ||
123 | pub f_bavail: ::fsblkcnt_t, | ||
124 | pub f_files: ::fsfilcnt_t, | ||
125 | pub f_ffree: ::fsfilcnt_t, | ||
126 | pub f_favail: ::fsfilcnt_t, | ||
127 | pub f_fsid: ::c_ulong, | ||
128 | #[cfg(target_pointer_width = "32")] | ||
129 | pub __f_unused: ::c_int, | ||
130 | pub f_flag: ::c_ulong, | ||
131 | pub f_namemax: ::c_ulong, | ||
132 | __f_spare: [::c_int; 6], | ||
133 | } | ||
134 | |||
135 | pub struct dqblk { | ||
136 | pub dqb_bhardlimit: ::uint64_t, | ||
137 | pub dqb_bsoftlimit: ::uint64_t, | ||
138 | pub dqb_curspace: ::uint64_t, | ||
139 | pub dqb_ihardlimit: ::uint64_t, | ||
140 | pub dqb_isoftlimit: ::uint64_t, | ||
141 | pub dqb_curinodes: ::uint64_t, | ||
142 | pub dqb_btime: ::uint64_t, | ||
143 | pub dqb_itime: ::uint64_t, | ||
144 | pub dqb_valid: ::uint32_t, | ||
145 | } | ||
146 | |||
147 | pub struct signalfd_siginfo { | ||
148 | pub ssi_signo: ::uint32_t, | ||
149 | pub ssi_errno: ::int32_t, | ||
150 | pub ssi_code: ::int32_t, | ||
151 | pub ssi_pid: ::uint32_t, | ||
152 | pub ssi_uid: ::uint32_t, | ||
153 | pub ssi_fd: ::int32_t, | ||
154 | pub ssi_tid: ::uint32_t, | ||
155 | pub ssi_band: ::uint32_t, | ||
156 | pub ssi_overrun: ::uint32_t, | ||
157 | pub ssi_trapno: ::uint32_t, | ||
158 | pub ssi_status: ::int32_t, | ||
159 | pub ssi_int: ::int32_t, | ||
160 | pub ssi_ptr: ::uint64_t, | ||
161 | pub ssi_utime: ::uint64_t, | ||
162 | pub ssi_stime: ::uint64_t, | ||
163 | pub ssi_addr: ::uint64_t, | ||
164 | _pad: [::uint8_t; 48], | ||
165 | } | ||
166 | |||
167 | pub struct fsid_t { | ||
168 | __val: [::c_int; 2], | ||
169 | } | ||
170 | |||
171 | pub struct mq_attr { | ||
172 | pub mq_flags: ::c_long, | ||
173 | pub mq_maxmsg: ::c_long, | ||
174 | pub mq_msgsize: ::c_long, | ||
175 | pub mq_curmsgs: ::c_long, | ||
176 | pad: [::c_long; 4] | ||
177 | } | ||
178 | |||
179 | pub struct cpu_set_t { | ||
180 | #[cfg(target_pointer_width = "32")] | ||
181 | bits: [u32; 32], | ||
182 | #[cfg(target_pointer_width = "64")] | ||
183 | bits: [u64; 16], | ||
184 | } | ||
185 | |||
186 | pub struct if_nameindex { | ||
187 | pub if_index: ::c_uint, | ||
188 | pub if_name: *mut ::c_char, | ||
189 | } | ||
190 | |||
191 | } | ||
192 | |||
193 | pub const ABDAY_1: ::nl_item = 0x20000; | ||
194 | pub const ABDAY_2: ::nl_item = 0x20001; | ||
195 | pub const ABDAY_3: ::nl_item = 0x20002; | ||
196 | pub const ABDAY_4: ::nl_item = 0x20003; | ||
197 | pub const ABDAY_5: ::nl_item = 0x20004; | ||
198 | pub const ABDAY_6: ::nl_item = 0x20005; | ||
199 | pub const ABDAY_7: ::nl_item = 0x20006; | ||
200 | |||
201 | pub const DAY_1: ::nl_item = 0x20007; | ||
202 | pub const DAY_2: ::nl_item = 0x20008; | ||
203 | pub const DAY_3: ::nl_item = 0x20009; | ||
204 | pub const DAY_4: ::nl_item = 0x2000A; | ||
205 | pub const DAY_5: ::nl_item = 0x2000B; | ||
206 | pub const DAY_6: ::nl_item = 0x2000C; | ||
207 | pub const DAY_7: ::nl_item = 0x2000D; | ||
208 | |||
209 | pub const ABMON_1: ::nl_item = 0x2000E; | ||
210 | pub const ABMON_2: ::nl_item = 0x2000F; | ||
211 | pub const ABMON_3: ::nl_item = 0x20010; | ||
212 | pub const ABMON_4: ::nl_item = 0x20011; | ||
213 | pub const ABMON_5: ::nl_item = 0x20012; | ||
214 | pub const ABMON_6: ::nl_item = 0x20013; | ||
215 | pub const ABMON_7: ::nl_item = 0x20014; | ||
216 | pub const ABMON_8: ::nl_item = 0x20015; | ||
217 | pub const ABMON_9: ::nl_item = 0x20016; | ||
218 | pub const ABMON_10: ::nl_item = 0x20017; | ||
219 | pub const ABMON_11: ::nl_item = 0x20018; | ||
220 | pub const ABMON_12: ::nl_item = 0x20019; | ||
221 | |||
222 | pub const MON_1: ::nl_item = 0x2001A; | ||
223 | pub const MON_2: ::nl_item = 0x2001B; | ||
224 | pub const MON_3: ::nl_item = 0x2001C; | ||
225 | pub const MON_4: ::nl_item = 0x2001D; | ||
226 | pub const MON_5: ::nl_item = 0x2001E; | ||
227 | pub const MON_6: ::nl_item = 0x2001F; | ||
228 | pub const MON_7: ::nl_item = 0x20020; | ||
229 | pub const MON_8: ::nl_item = 0x20021; | ||
230 | pub const MON_9: ::nl_item = 0x20022; | ||
231 | pub const MON_10: ::nl_item = 0x20023; | ||
232 | pub const MON_11: ::nl_item = 0x20024; | ||
233 | pub const MON_12: ::nl_item = 0x20025; | ||
234 | |||
235 | pub const AM_STR: ::nl_item = 0x20026; | ||
236 | pub const PM_STR: ::nl_item = 0x20027; | ||
237 | |||
238 | pub const D_T_FMT: ::nl_item = 0x20028; | ||
239 | pub const D_FMT: ::nl_item = 0x20029; | ||
240 | pub const T_FMT: ::nl_item = 0x2002A; | ||
241 | pub const T_FMT_AMPM: ::nl_item = 0x2002B; | ||
242 | |||
243 | pub const ERA: ::nl_item = 0x2002C; | ||
244 | pub const ERA_D_FMT: ::nl_item = 0x2002E; | ||
245 | pub const ALT_DIGITS: ::nl_item = 0x2002F; | ||
246 | pub const ERA_D_T_FMT: ::nl_item = 0x20030; | ||
247 | pub const ERA_T_FMT: ::nl_item = 0x20031; | ||
248 | |||
249 | pub const CODESET: ::nl_item = 14; | ||
250 | |||
251 | pub const CRNCYSTR: ::nl_item = 0x4000F; | ||
252 | |||
253 | pub const RADIXCHAR: ::nl_item = 0x10000; | ||
254 | pub const THOUSEP: ::nl_item = 0x10001; | ||
255 | |||
256 | pub const YESEXPR: ::nl_item = 0x50000; | ||
257 | pub const NOEXPR: ::nl_item = 0x50001; | ||
258 | pub const YESSTR: ::nl_item = 0x50002; | ||
259 | pub const NOSTR: ::nl_item = 0x50003; | ||
260 | |||
261 | pub const FILENAME_MAX: ::c_uint = 4096; | ||
262 | pub const L_tmpnam: ::c_uint = 20; | ||
263 | pub const _PC_LINK_MAX: ::c_int = 0; | ||
264 | pub const _PC_MAX_CANON: ::c_int = 1; | ||
265 | pub const _PC_MAX_INPUT: ::c_int = 2; | ||
266 | pub const _PC_NAME_MAX: ::c_int = 3; | ||
267 | pub const _PC_PATH_MAX: ::c_int = 4; | ||
268 | pub const _PC_PIPE_BUF: ::c_int = 5; | ||
269 | pub const _PC_CHOWN_RESTRICTED: ::c_int = 6; | ||
270 | pub const _PC_NO_TRUNC: ::c_int = 7; | ||
271 | pub const _PC_VDISABLE: ::c_int = 8; | ||
272 | |||
273 | pub const _SC_ARG_MAX: ::c_int = 0; | ||
274 | pub const _SC_CHILD_MAX: ::c_int = 1; | ||
275 | pub const _SC_CLK_TCK: ::c_int = 2; | ||
276 | pub const _SC_NGROUPS_MAX: ::c_int = 3; | ||
277 | pub const _SC_OPEN_MAX: ::c_int = 4; | ||
278 | pub const _SC_STREAM_MAX: ::c_int = 5; | ||
279 | pub const _SC_TZNAME_MAX: ::c_int = 6; | ||
280 | pub const _SC_JOB_CONTROL: ::c_int = 7; | ||
281 | pub const _SC_SAVED_IDS: ::c_int = 8; | ||
282 | pub const _SC_REALTIME_SIGNALS: ::c_int = 9; | ||
283 | pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10; | ||
284 | pub const _SC_TIMERS: ::c_int = 11; | ||
285 | pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12; | ||
286 | pub const _SC_PRIORITIZED_IO: ::c_int = 13; | ||
287 | pub const _SC_SYNCHRONIZED_IO: ::c_int = 14; | ||
288 | pub const _SC_FSYNC: ::c_int = 15; | ||
289 | pub const _SC_MAPPED_FILES: ::c_int = 16; | ||
290 | pub const _SC_MEMLOCK: ::c_int = 17; | ||
291 | pub const _SC_MEMLOCK_RANGE: ::c_int = 18; | ||
292 | pub const _SC_MEMORY_PROTECTION: ::c_int = 19; | ||
293 | pub const _SC_MESSAGE_PASSING: ::c_int = 20; | ||
294 | pub const _SC_SEMAPHORES: ::c_int = 21; | ||
295 | pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22; | ||
296 | pub const _SC_AIO_LISTIO_MAX: ::c_int = 23; | ||
297 | pub const _SC_AIO_MAX: ::c_int = 24; | ||
298 | pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25; | ||
299 | pub const _SC_DELAYTIMER_MAX: ::c_int = 26; | ||
300 | pub const _SC_MQ_OPEN_MAX: ::c_int = 27; | ||
301 | pub const _SC_MQ_PRIO_MAX: ::c_int = 28; | ||
302 | pub const _SC_VERSION: ::c_int = 29; | ||
303 | pub const _SC_PAGESIZE: ::c_int = 30; | ||
304 | pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; | ||
305 | pub const _SC_RTSIG_MAX: ::c_int = 31; | ||
306 | pub const _SC_SEM_NSEMS_MAX: ::c_int = 32; | ||
307 | pub const _SC_SEM_VALUE_MAX: ::c_int = 33; | ||
308 | pub const _SC_SIGQUEUE_MAX: ::c_int = 34; | ||
309 | pub const _SC_TIMER_MAX: ::c_int = 35; | ||
310 | pub const _SC_BC_BASE_MAX: ::c_int = 36; | ||
311 | pub const _SC_BC_DIM_MAX: ::c_int = 37; | ||
312 | pub const _SC_BC_SCALE_MAX: ::c_int = 38; | ||
313 | pub const _SC_BC_STRING_MAX: ::c_int = 39; | ||
314 | pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40; | ||
315 | pub const _SC_EXPR_NEST_MAX: ::c_int = 42; | ||
316 | pub const _SC_LINE_MAX: ::c_int = 43; | ||
317 | pub const _SC_RE_DUP_MAX: ::c_int = 44; | ||
318 | pub const _SC_2_VERSION: ::c_int = 46; | ||
319 | pub const _SC_2_C_BIND: ::c_int = 47; | ||
320 | pub const _SC_2_C_DEV: ::c_int = 48; | ||
321 | pub const _SC_2_FORT_DEV: ::c_int = 49; | ||
322 | pub const _SC_2_FORT_RUN: ::c_int = 50; | ||
323 | pub const _SC_2_SW_DEV: ::c_int = 51; | ||
324 | pub const _SC_2_LOCALEDEF: ::c_int = 52; | ||
325 | pub const _SC_IOV_MAX: ::c_int = 60; | ||
326 | pub const _SC_THREADS: ::c_int = 67; | ||
327 | pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68; | ||
328 | pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69; | ||
329 | pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70; | ||
330 | pub const _SC_LOGIN_NAME_MAX: ::c_int = 71; | ||
331 | pub const _SC_TTY_NAME_MAX: ::c_int = 72; | ||
332 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73; | ||
333 | pub const _SC_THREAD_KEYS_MAX: ::c_int = 74; | ||
334 | pub const _SC_THREAD_STACK_MIN: ::c_int = 75; | ||
335 | pub const _SC_THREAD_THREADS_MAX: ::c_int = 76; | ||
336 | pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77; | ||
337 | pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78; | ||
338 | pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79; | ||
339 | pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80; | ||
340 | pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81; | ||
341 | pub const _SC_NPROCESSORS_ONLN: ::c_int = 84; | ||
342 | pub const _SC_ATEXIT_MAX: ::c_int = 87; | ||
343 | pub const _SC_XOPEN_VERSION: ::c_int = 89; | ||
344 | pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90; | ||
345 | pub const _SC_XOPEN_UNIX: ::c_int = 91; | ||
346 | pub const _SC_XOPEN_CRYPT: ::c_int = 92; | ||
347 | pub const _SC_XOPEN_ENH_I18N: ::c_int = 93; | ||
348 | pub const _SC_XOPEN_SHM: ::c_int = 94; | ||
349 | pub const _SC_2_CHAR_TERM: ::c_int = 95; | ||
350 | pub const _SC_2_UPE: ::c_int = 97; | ||
351 | pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125; | ||
352 | pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126; | ||
353 | pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128; | ||
354 | pub const _SC_XOPEN_LEGACY: ::c_int = 129; | ||
355 | pub const _SC_XOPEN_REALTIME: ::c_int = 130; | ||
356 | pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131; | ||
357 | pub const _SC_HOST_NAME_MAX: ::c_int = 180; | ||
358 | |||
359 | pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; | ||
360 | pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; | ||
361 | |||
362 | pub const GLOB_ERR: ::c_int = 1 << 0; | ||
363 | pub const GLOB_MARK: ::c_int = 1 << 1; | ||
364 | pub const GLOB_NOSORT: ::c_int = 1 << 2; | ||
365 | pub const GLOB_DOOFFS: ::c_int = 1 << 3; | ||
366 | pub const GLOB_NOCHECK: ::c_int = 1 << 4; | ||
367 | pub const GLOB_APPEND: ::c_int = 1 << 5; | ||
368 | pub const GLOB_NOESCAPE: ::c_int = 1 << 6; | ||
369 | |||
370 | pub const GLOB_NOSPACE: ::c_int = 1; | ||
371 | pub const GLOB_ABORTED: ::c_int = 2; | ||
372 | pub const GLOB_NOMATCH: ::c_int = 3; | ||
373 | |||
374 | pub const POSIX_MADV_NORMAL: ::c_int = 0; | ||
375 | pub const POSIX_MADV_RANDOM: ::c_int = 1; | ||
376 | pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; | ||
377 | pub const POSIX_MADV_WILLNEED: ::c_int = 3; | ||
378 | |||
379 | pub const S_IEXEC: mode_t = 64; | ||
380 | pub const S_IWRITE: mode_t = 128; | ||
381 | pub const S_IREAD: mode_t = 256; | ||
382 | |||
383 | pub const F_LOCK: ::c_int = 1; | ||
384 | pub const F_TEST: ::c_int = 3; | ||
385 | pub const F_TLOCK: ::c_int = 2; | ||
386 | pub const F_ULOCK: ::c_int = 0; | ||
387 | |||
388 | pub const ST_RDONLY: ::c_ulong = 1; | ||
389 | pub const ST_NOSUID: ::c_ulong = 2; | ||
390 | pub const ST_NODEV: ::c_ulong = 4; | ||
391 | pub const ST_NOEXEC: ::c_ulong = 8; | ||
392 | pub const ST_SYNCHRONOUS: ::c_ulong = 16; | ||
393 | pub const ST_MANDLOCK: ::c_ulong = 64; | ||
394 | pub const ST_WRITE: ::c_ulong = 128; | ||
395 | pub const ST_APPEND: ::c_ulong = 256; | ||
396 | pub const ST_IMMUTABLE: ::c_ulong = 512; | ||
397 | pub const ST_NOATIME: ::c_ulong = 1024; | ||
398 | pub const ST_NODIRATIME: ::c_ulong = 2048; | ||
399 | |||
400 | pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; | ||
401 | pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; | ||
402 | pub const RTLD_NODELETE: ::c_int = 0x1000; | ||
403 | pub const RTLD_NOW: ::c_int = 0x2; | ||
404 | |||
405 | pub const TCP_MD5SIG: ::c_int = 14; | ||
406 | |||
407 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { | ||
408 | __align: [], | ||
409 | size: [0; __SIZEOF_PTHREAD_MUTEX_T], | ||
410 | }; | ||
411 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { | ||
412 | __align: [], | ||
413 | size: [0; __SIZEOF_PTHREAD_COND_T], | ||
414 | }; | ||
415 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { | ||
416 | __align: [], | ||
417 | size: [0; __SIZEOF_PTHREAD_RWLOCK_T], | ||
418 | }; | ||
419 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; | ||
420 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; | ||
421 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; | ||
422 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; | ||
423 | pub const __SIZEOF_PTHREAD_COND_T: usize = 48; | ||
424 | |||
425 | pub const SCHED_OTHER: ::c_int = 0; | ||
426 | pub const SCHED_FIFO: ::c_int = 1; | ||
427 | pub const SCHED_RR: ::c_int = 2; | ||
428 | pub const SCHED_BATCH: ::c_int = 3; | ||
429 | pub const SCHED_IDLE: ::c_int = 5; | ||
430 | |||
431 | pub const IPC_CREAT: ::c_int = 0o1000; | ||
432 | pub const IPC_EXCL: ::c_int = 0o2000; | ||
433 | pub const IPC_NOWAIT: ::c_int = 0o4000; | ||
434 | |||
435 | pub const IPC_RMID: ::c_int = 0; | ||
436 | pub const IPC_SET: ::c_int = 1; | ||
437 | pub const IPC_STAT: ::c_int = 2; | ||
438 | pub const IPC_INFO: ::c_int = 3; | ||
439 | |||
440 | pub const SHM_R: ::c_int = 0o400; | ||
441 | pub const SHM_W: ::c_int = 0o200; | ||
442 | |||
443 | pub const SHM_RDONLY: ::c_int = 0o10000; | ||
444 | pub const SHM_RND: ::c_int = 0o20000; | ||
445 | pub const SHM_REMAP: ::c_int = 0o40000; | ||
446 | pub const SHM_EXEC: ::c_int = 0o100000; | ||
447 | |||
448 | pub const SHM_LOCK: ::c_int = 11; | ||
449 | pub const SHM_UNLOCK: ::c_int = 12; | ||
450 | |||
451 | pub const SHM_HUGETLB: ::c_int = 0o4000; | ||
452 | pub const SHM_NORESERVE: ::c_int = 0o10000; | ||
453 | |||
454 | pub const EPOLLRDHUP: ::c_int = 0x2000; | ||
455 | pub const EPOLLONESHOT: ::c_int = 0x40000000; | ||
456 | |||
457 | pub const QFMT_VFS_OLD: ::c_int = 1; | ||
458 | pub const QFMT_VFS_V0: ::c_int = 2; | ||
459 | |||
460 | pub const SFD_CLOEXEC: ::c_int = 0x080000; | ||
461 | |||
462 | pub const EFD_SEMAPHORE: ::c_int = 0x1; | ||
463 | |||
464 | pub const NCCS: usize = 32; | ||
465 | |||
466 | pub const AF_NETLINK: ::c_int = 16; | ||
467 | |||
468 | pub const LOG_NFACILITIES: ::c_int = 24; | ||
469 | |||
470 | pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; | ||
471 | |||
472 | pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32; | ||
473 | pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32; | ||
474 | pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32; | ||
475 | pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32; | ||
476 | pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32; | ||
477 | pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; | ||
478 | pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; | ||
479 | |||
480 | f! { | ||
481 | pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { | ||
482 | for slot in cpuset.bits.iter_mut() { | ||
483 | *slot = 0; | ||
484 | } | ||
485 | } | ||
486 | |||
487 | pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { | ||
488 | let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc | ||
489 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); | ||
490 | cpuset.bits[idx] |= 1 << offset; | ||
491 | () | ||
492 | } | ||
493 | |||
494 | pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { | ||
495 | let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); | ||
496 | let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); | ||
497 | 0 != (cpuset.bits[idx] & (1 << offset)) | ||
498 | } | ||
499 | |||
500 | pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { | ||
501 | set1.bits == set2.bits | ||
502 | } | ||
503 | } | ||
504 | |||
505 | extern { | ||
506 | pub fn setpwent(); | ||
507 | pub fn getpwent() -> *mut passwd; | ||
508 | pub fn shm_open(name: *const c_char, oflag: ::c_int, | ||
509 | mode: mode_t) -> ::c_int; | ||
510 | pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; | ||
511 | pub fn shmat(shmid: ::c_int, | ||
512 | shmaddr: *const ::c_void, | ||
513 | shmflg: ::c_int) -> *mut ::c_void; | ||
514 | pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; | ||
515 | pub fn shmctl(shmid: ::c_int, | ||
516 | cmd: ::c_int, | ||
517 | buf: *mut ::shmid_ds) -> ::c_int; | ||
518 | pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) | ||
519 | -> ::c_int; | ||
520 | pub fn __errno_location() -> *mut ::c_int; | ||
521 | |||
522 | pub fn fopen64(filename: *const c_char, | ||
523 | mode: *const c_char) -> *mut ::FILE; | ||
524 | pub fn freopen64(filename: *const c_char, mode: *const c_char, | ||
525 | file: *mut ::FILE) -> *mut ::FILE; | ||
526 | pub fn tmpfile64() -> *mut ::FILE; | ||
527 | pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; | ||
528 | pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; | ||
529 | pub fn fseeko64(stream: *mut ::FILE, | ||
530 | offset: ::off64_t, | ||
531 | whence: ::c_int) -> ::c_int; | ||
532 | pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; | ||
533 | pub fn fallocate(fd: ::c_int, mode: ::c_int, | ||
534 | offset: ::off_t, len: ::off_t) -> ::c_int; | ||
535 | pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, | ||
536 | len: ::off_t) -> ::c_int; | ||
537 | pub fn readahead(fd: ::c_int, offset: ::off64_t, | ||
538 | count: ::size_t) -> ::ssize_t; | ||
539 | pub fn getxattr(path: *const c_char, name: *const c_char, | ||
540 | value: *mut ::c_void, size: ::size_t) -> ::ssize_t; | ||
541 | pub fn lgetxattr(path: *const c_char, name: *const c_char, | ||
542 | value: *mut ::c_void, size: ::size_t) -> ::ssize_t; | ||
543 | pub fn fgetxattr(filedes: ::c_int, name: *const c_char, | ||
544 | value: *mut ::c_void, size: ::size_t) -> ::ssize_t; | ||
545 | pub fn setxattr(path: *const c_char, name: *const c_char, | ||
546 | value: *const ::c_void, size: ::size_t, | ||
547 | flags: ::c_int) -> ::c_int; | ||
548 | pub fn lsetxattr(path: *const c_char, name: *const c_char, | ||
549 | value: *const ::c_void, size: ::size_t, | ||
550 | flags: ::c_int) -> ::c_int; | ||
551 | pub fn fsetxattr(filedes: ::c_int, name: *const c_char, | ||
552 | value: *const ::c_void, size: ::size_t, | ||
553 | flags: ::c_int) -> ::c_int; | ||
554 | pub fn listxattr(path: *const c_char, list: *mut c_char, | ||
555 | size: ::size_t) -> ::ssize_t; | ||
556 | pub fn llistxattr(path: *const c_char, list: *mut c_char, | ||
557 | size: ::size_t) -> ::ssize_t; | ||
558 | pub fn flistxattr(filedes: ::c_int, list: *mut c_char, | ||
559 | size: ::size_t) -> ::ssize_t; | ||
560 | pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int; | ||
561 | pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int; | ||
562 | pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int; | ||
563 | pub fn signalfd(fd: ::c_int, | ||
564 | mask: *const ::sigset_t, | ||
565 | flags: ::c_int) -> ::c_int; | ||
566 | pub fn pwritev(fd: ::c_int, | ||
567 | iov: *const ::iovec, | ||
568 | iovcnt: ::c_int, | ||
569 | offset: ::off_t) -> ::ssize_t; | ||
570 | pub fn preadv(fd: ::c_int, | ||
571 | iov: *const ::iovec, | ||
572 | iovcnt: ::c_int, | ||
573 | offset: ::off_t) -> ::ssize_t; | ||
574 | pub fn quotactl(cmd: ::c_int, | ||
575 | special: *const ::c_char, | ||
576 | id: ::c_int, | ||
577 | data: *mut ::c_char) -> ::c_int; | ||
578 | pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; | ||
579 | pub fn mq_close(mqd: ::mqd_t) -> ::c_int; | ||
580 | pub fn mq_unlink(name: *const ::c_char) -> ::c_int; | ||
581 | pub fn mq_receive(mqd: ::mqd_t, | ||
582 | msg_ptr: *mut ::c_char, | ||
583 | msg_len: ::size_t, | ||
584 | msq_prio: *mut ::c_uint) -> ::ssize_t; | ||
585 | pub fn mq_send(mqd: ::mqd_t, | ||
586 | msg_ptr: *const ::c_char, | ||
587 | msg_len: ::size_t, | ||
588 | msq_prio: ::c_uint) -> ::c_int; | ||
589 | pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; | ||
590 | pub fn mq_setattr(mqd: ::mqd_t, | ||
591 | newattr: *const ::mq_attr, | ||
592 | oldattr: *mut ::mq_attr) -> ::c_int; | ||
593 | pub fn sched_getaffinity(pid: ::pid_t, | ||
594 | cpusetsize: ::size_t, | ||
595 | cpuset: *mut cpu_set_t) -> ::c_int; | ||
596 | pub fn sched_setaffinity(pid: ::pid_t, | ||
597 | cpusetsize: ::size_t, | ||
598 | cpuset: *const cpu_set_t) -> ::c_int; | ||
599 | pub fn epoll_pwait(epfd: ::c_int, | ||
600 | events: *mut ::epoll_event, | ||
601 | maxevents: ::c_int, | ||
602 | timeout: ::c_int, | ||
603 | sigmask: *const ::sigset_t) -> ::c_int; | ||
604 | pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int; | ||
605 | pub fn unshare(flags: ::c_int) -> ::c_int; | ||
606 | pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; | ||
607 | pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int; | ||
608 | pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; | ||
609 | pub fn mkostemps(template: *mut ::c_char, | ||
610 | suffixlen: ::c_int, | ||
611 | flags: ::c_int) -> ::c_int; | ||
612 | pub fn sigtimedwait(set: *const sigset_t, | ||
613 | info: *mut siginfo_t, | ||
614 | timeout: *const ::timespec) -> ::c_int; | ||
615 | pub fn sigwaitinfo(set: *const sigset_t, | ||
616 | info: *mut siginfo_t) -> ::c_int; | ||
617 | pub fn openpty(amaster: *mut ::c_int, | ||
618 | aslave: *mut ::c_int, | ||
619 | name: *mut ::c_char, | ||
620 | termp: *const termios, | ||
621 | winp: *const ::winsize) -> ::c_int; | ||
622 | pub fn forkpty(amaster: *mut ::c_int, | ||
623 | name: *mut ::c_char, | ||
624 | termp: *const termios, | ||
625 | winp: *const ::winsize) -> ::pid_t; | ||
626 | pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; | ||
627 | pub fn getnameinfo(sa: *const ::sockaddr, | ||
628 | salen: ::socklen_t, | ||
629 | host: *mut ::c_char, | ||
630 | hostlen: ::socklen_t, | ||
631 | serv: *mut ::c_char, | ||
632 | sevlen: ::socklen_t, | ||
633 | flags: ::c_int) -> ::c_int; | ||
634 | pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit, | ||
635 | old_limit: *mut ::rlimit) -> ::c_int; | ||
636 | pub fn prlimit64(pid: ::pid_t, | ||
637 | resource: ::c_int, | ||
638 | new_limit: *const ::rlimit64, | ||
639 | old_limit: *mut ::rlimit64) -> ::c_int; | ||
640 | pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; | ||
641 | pub fn process_vm_readv(pid: ::pid_t, | ||
642 | local_iov: *const ::iovec, | ||
643 | liovcnt: ::c_ulong, | ||
644 | remote_iov: *const ::iovec, | ||
645 | riovcnt: ::c_ulong, | ||
646 | flags: ::c_ulong) -> isize; | ||
647 | pub fn process_vm_writev(pid: ::pid_t, | ||
648 | local_iov: *const ::iovec, | ||
649 | liovcnt: ::c_ulong, | ||
650 | remote_iov: *const ::iovec, | ||
651 | riovcnt: ::c_ulong, | ||
652 | flags: ::c_ulong) -> isize; | ||
653 | pub fn reboot(how_to: ::c_int) -> ::c_int; | ||
654 | |||
655 | // Not available now on Android | ||
656 | pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, | ||
657 | mode: ::mode_t) -> ::c_int; | ||
658 | pub fn if_nameindex() -> *mut if_nameindex; | ||
659 | pub fn if_freenameindex(ptr: *mut if_nameindex); | ||
660 | } | ||
661 | |||
662 | cfg_if! { | ||
663 | if #[cfg(any(target_env = "musl", | ||
664 | target_os = "emscripten"))] { | ||
665 | mod musl; | ||
666 | pub use self::musl::*; | ||
667 | } else if #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] { | ||
668 | mod mips; | ||
669 | pub use self::mips::*; | ||
670 | } else { | ||
671 | mod other; | ||
672 | pub use self::other::*; | ||
673 | } | ||
674 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b32/arm.rs b/third_party/libc/src/unix/notbsd/linux/musl/b32/arm.rs new file mode 100644 index 0000000..5d64861 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b32/arm.rs | |||
@@ -0,0 +1,308 @@ | |||
1 | pub type c_char = u8; | ||
2 | pub type wchar_t = u32; | ||
3 | |||
4 | s! { | ||
5 | pub struct stat { | ||
6 | pub st_dev: ::dev_t, | ||
7 | __st_dev_padding: ::c_int, | ||
8 | __st_ino_truncated: ::c_long, | ||
9 | pub st_mode: ::mode_t, | ||
10 | pub st_nlink: ::nlink_t, | ||
11 | pub st_uid: ::uid_t, | ||
12 | pub st_gid: ::gid_t, | ||
13 | pub st_rdev: ::dev_t, | ||
14 | __st_rdev_padding: ::c_int, | ||
15 | pub st_size: ::off_t, | ||
16 | pub st_blksize: ::blksize_t, | ||
17 | pub st_blocks: ::blkcnt_t, | ||
18 | pub st_atime: ::time_t, | ||
19 | pub st_atime_nsec: ::c_long, | ||
20 | pub st_mtime: ::time_t, | ||
21 | pub st_mtime_nsec: ::c_long, | ||
22 | pub st_ctime: ::time_t, | ||
23 | pub st_ctime_nsec: ::c_long, | ||
24 | pub st_ino: ::ino_t, | ||
25 | } | ||
26 | |||
27 | pub struct stat64 { | ||
28 | pub st_dev: ::dev_t, | ||
29 | __st_dev_padding: ::c_int, | ||
30 | __st_ino_truncated: ::c_long, | ||
31 | pub st_mode: ::mode_t, | ||
32 | pub st_nlink: ::nlink_t, | ||
33 | pub st_uid: ::uid_t, | ||
34 | pub st_gid: ::gid_t, | ||
35 | pub st_rdev: ::dev_t, | ||
36 | __st_rdev_padding: ::c_int, | ||
37 | pub st_size: ::off_t, | ||
38 | pub st_blksize: ::blksize_t, | ||
39 | pub st_blocks: ::blkcnt_t, | ||
40 | pub st_atime: ::time_t, | ||
41 | pub st_atime_nsec: ::c_long, | ||
42 | pub st_mtime: ::time_t, | ||
43 | pub st_mtime_nsec: ::c_long, | ||
44 | pub st_ctime: ::time_t, | ||
45 | pub st_ctime_nsec: ::c_long, | ||
46 | pub st_ino: ::ino_t, | ||
47 | } | ||
48 | |||
49 | pub struct stack_t { | ||
50 | pub ss_sp: *mut ::c_void, | ||
51 | pub ss_flags: ::c_int, | ||
52 | pub ss_size: ::size_t | ||
53 | } | ||
54 | |||
55 | pub struct shmid_ds { | ||
56 | pub shm_perm: ::ipc_perm, | ||
57 | pub shm_segsz: ::size_t, | ||
58 | pub shm_atime: ::time_t, | ||
59 | __unused1: ::c_int, | ||
60 | pub shm_dtime: ::time_t, | ||
61 | __unused2: ::c_int, | ||
62 | pub shm_ctime: ::time_t, | ||
63 | __unused3: ::c_int, | ||
64 | pub shm_cpid: ::pid_t, | ||
65 | pub shm_lpid: ::pid_t, | ||
66 | pub shm_nattch: ::c_ulong, | ||
67 | __pad1: ::c_ulong, | ||
68 | __pad2: ::c_ulong, | ||
69 | } | ||
70 | |||
71 | pub struct statfs { | ||
72 | pub f_type: ::c_ulong, | ||
73 | pub f_bsize: ::c_ulong, | ||
74 | pub f_blocks: ::fsblkcnt_t, | ||
75 | pub f_bfree: ::fsblkcnt_t, | ||
76 | pub f_bavail: ::fsblkcnt_t, | ||
77 | pub f_files: ::fsfilcnt_t, | ||
78 | pub f_ffree: ::fsfilcnt_t, | ||
79 | pub f_fsid: ::fsid_t, | ||
80 | pub f_namelen: ::c_ulong, | ||
81 | pub f_frsize: ::c_ulong, | ||
82 | pub f_flags: ::c_ulong, | ||
83 | pub f_spare: [::c_ulong; 4], | ||
84 | } | ||
85 | } | ||
86 | |||
87 | pub const O_DIRECT: ::c_int = 0x4000; | ||
88 | pub const O_DIRECTORY: ::c_int = 0x10000; | ||
89 | pub const O_NOFOLLOW: ::c_int = 0x20000; | ||
90 | pub const O_ASYNC: ::c_int = 0x2000; | ||
91 | |||
92 | pub const FIOCLEX: ::c_int = 0x5451; | ||
93 | pub const FIONBIO: ::c_int = 0x5421; | ||
94 | |||
95 | pub const RLIMIT_RSS: ::c_int = 5; | ||
96 | pub const RLIMIT_NOFILE: ::c_int = 7; | ||
97 | pub const RLIMIT_AS: ::c_int = 9; | ||
98 | pub const RLIMIT_NPROC: ::c_int = 6; | ||
99 | pub const RLIMIT_MEMLOCK: ::c_int = 8; | ||
100 | |||
101 | pub const O_APPEND: ::c_int = 1024; | ||
102 | pub const O_CREAT: ::c_int = 64; | ||
103 | pub const O_EXCL: ::c_int = 128; | ||
104 | pub const O_NOCTTY: ::c_int = 256; | ||
105 | pub const O_NONBLOCK: ::c_int = 2048; | ||
106 | pub const O_SYNC: ::c_int = 1052672; | ||
107 | pub const O_RSYNC: ::c_int = 1052672; | ||
108 | pub const O_DSYNC: ::c_int = 4096; | ||
109 | |||
110 | pub const SOCK_NONBLOCK: ::c_int = 2048; | ||
111 | |||
112 | pub const MAP_ANON: ::c_int = 0x0020; | ||
113 | pub const MAP_GROWSDOWN: ::c_int = 0x0100; | ||
114 | pub const MAP_DENYWRITE: ::c_int = 0x0800; | ||
115 | pub const MAP_EXECUTABLE: ::c_int = 0x01000; | ||
116 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
117 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
118 | pub const MAP_POPULATE: ::c_int = 0x08000; | ||
119 | pub const MAP_NONBLOCK: ::c_int = 0x010000; | ||
120 | pub const MAP_STACK: ::c_int = 0x020000; | ||
121 | |||
122 | pub const SOCK_STREAM: ::c_int = 1; | ||
123 | pub const SOCK_DGRAM: ::c_int = 2; | ||
124 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
125 | |||
126 | pub const SOL_SOCKET: ::c_int = 1; | ||
127 | |||
128 | pub const EDEADLK: ::c_int = 35; | ||
129 | pub const ENAMETOOLONG: ::c_int = 36; | ||
130 | pub const ENOLCK: ::c_int = 37; | ||
131 | pub const ENOSYS: ::c_int = 38; | ||
132 | pub const ENOTEMPTY: ::c_int = 39; | ||
133 | pub const ELOOP: ::c_int = 40; | ||
134 | pub const ENOMSG: ::c_int = 42; | ||
135 | pub const EIDRM: ::c_int = 43; | ||
136 | pub const ECHRNG: ::c_int = 44; | ||
137 | pub const EL2NSYNC: ::c_int = 45; | ||
138 | pub const EL3HLT: ::c_int = 46; | ||
139 | pub const EL3RST: ::c_int = 47; | ||
140 | pub const ELNRNG: ::c_int = 48; | ||
141 | pub const EUNATCH: ::c_int = 49; | ||
142 | pub const ENOCSI: ::c_int = 50; | ||
143 | pub const EL2HLT: ::c_int = 51; | ||
144 | pub const EBADE: ::c_int = 52; | ||
145 | pub const EBADR: ::c_int = 53; | ||
146 | pub const EXFULL: ::c_int = 54; | ||
147 | pub const ENOANO: ::c_int = 55; | ||
148 | pub const EBADRQC: ::c_int = 56; | ||
149 | pub const EBADSLT: ::c_int = 57; | ||
150 | pub const EDEADLOCK: ::c_int = EDEADLK; | ||
151 | pub const EMULTIHOP: ::c_int = 72; | ||
152 | pub const EBADMSG: ::c_int = 74; | ||
153 | pub const EOVERFLOW: ::c_int = 75; | ||
154 | pub const ENOTUNIQ: ::c_int = 76; | ||
155 | pub const EBADFD: ::c_int = 77; | ||
156 | pub const EREMCHG: ::c_int = 78; | ||
157 | pub const ELIBACC: ::c_int = 79; | ||
158 | pub const ELIBBAD: ::c_int = 80; | ||
159 | pub const ELIBSCN: ::c_int = 81; | ||
160 | pub const ELIBMAX: ::c_int = 82; | ||
161 | pub const ELIBEXEC: ::c_int = 83; | ||
162 | pub const EILSEQ: ::c_int = 84; | ||
163 | pub const ERESTART: ::c_int = 85; | ||
164 | pub const ESTRPIPE: ::c_int = 86; | ||
165 | pub const EUSERS: ::c_int = 87; | ||
166 | pub const ENOTSOCK: ::c_int = 88; | ||
167 | pub const EDESTADDRREQ: ::c_int = 89; | ||
168 | pub const EMSGSIZE: ::c_int = 90; | ||
169 | pub const EPROTOTYPE: ::c_int = 91; | ||
170 | pub const ENOPROTOOPT: ::c_int = 92; | ||
171 | pub const EPROTONOSUPPORT: ::c_int = 93; | ||
172 | pub const ESOCKTNOSUPPORT: ::c_int = 94; | ||
173 | pub const EOPNOTSUPP: ::c_int = 95; | ||
174 | pub const EPFNOSUPPORT: ::c_int = 96; | ||
175 | pub const EAFNOSUPPORT: ::c_int = 97; | ||
176 | pub const EADDRINUSE: ::c_int = 98; | ||
177 | pub const EADDRNOTAVAIL: ::c_int = 99; | ||
178 | pub const ENETDOWN: ::c_int = 100; | ||
179 | pub const ENETUNREACH: ::c_int = 101; | ||
180 | pub const ENETRESET: ::c_int = 102; | ||
181 | pub const ECONNABORTED: ::c_int = 103; | ||
182 | pub const ECONNRESET: ::c_int = 104; | ||
183 | pub const ENOBUFS: ::c_int = 105; | ||
184 | pub const EISCONN: ::c_int = 106; | ||
185 | pub const ENOTCONN: ::c_int = 107; | ||
186 | pub const ESHUTDOWN: ::c_int = 108; | ||
187 | pub const ETOOMANYREFS: ::c_int = 109; | ||
188 | pub const ETIMEDOUT: ::c_int = 110; | ||
189 | pub const ECONNREFUSED: ::c_int = 111; | ||
190 | pub const EHOSTDOWN: ::c_int = 112; | ||
191 | pub const EHOSTUNREACH: ::c_int = 113; | ||
192 | pub const EALREADY: ::c_int = 114; | ||
193 | pub const EINPROGRESS: ::c_int = 115; | ||
194 | pub const ESTALE: ::c_int = 116; | ||
195 | pub const EUCLEAN: ::c_int = 117; | ||
196 | pub const ENOTNAM: ::c_int = 118; | ||
197 | pub const ENAVAIL: ::c_int = 119; | ||
198 | pub const EISNAM: ::c_int = 120; | ||
199 | pub const EREMOTEIO: ::c_int = 121; | ||
200 | pub const EDQUOT: ::c_int = 122; | ||
201 | pub const ENOMEDIUM: ::c_int = 123; | ||
202 | pub const EMEDIUMTYPE: ::c_int = 124; | ||
203 | pub const ECANCELED: ::c_int = 125; | ||
204 | pub const ENOKEY: ::c_int = 126; | ||
205 | pub const EKEYEXPIRED: ::c_int = 127; | ||
206 | pub const EKEYREVOKED: ::c_int = 128; | ||
207 | pub const EKEYREJECTED: ::c_int = 129; | ||
208 | pub const EOWNERDEAD: ::c_int = 130; | ||
209 | pub const ENOTRECOVERABLE: ::c_int = 131; | ||
210 | pub const ERFKILL: ::c_int = 132; | ||
211 | pub const EHWPOISON: ::c_int = 133; | ||
212 | |||
213 | pub const SO_REUSEADDR: ::c_int = 2; | ||
214 | pub const SO_TYPE: ::c_int = 3; | ||
215 | pub const SO_ERROR: ::c_int = 4; | ||
216 | pub const SO_DONTROUTE: ::c_int = 5; | ||
217 | pub const SO_BROADCAST: ::c_int = 6; | ||
218 | pub const SO_SNDBUF: ::c_int = 7; | ||
219 | pub const SO_RCVBUF: ::c_int = 8; | ||
220 | pub const SO_KEEPALIVE: ::c_int = 9; | ||
221 | pub const SO_OOBINLINE: ::c_int = 10; | ||
222 | pub const SO_LINGER: ::c_int = 13; | ||
223 | pub const SO_REUSEPORT: ::c_int = 15; | ||
224 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
225 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
226 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
227 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
228 | pub const SO_ACCEPTCONN: ::c_int = 30; | ||
229 | |||
230 | pub const SA_ONSTACK: ::c_int = 0x08000000; | ||
231 | pub const SA_SIGINFO: ::c_int = 0x00000004; | ||
232 | pub const SA_NOCLDWAIT: ::c_int = 0x00000002; | ||
233 | |||
234 | pub const SIGCHLD: ::c_int = 17; | ||
235 | pub const SIGBUS: ::c_int = 7; | ||
236 | pub const SIGTTIN: ::c_int = 21; | ||
237 | pub const SIGTTOU: ::c_int = 22; | ||
238 | pub const SIGXCPU: ::c_int = 24; | ||
239 | pub const SIGXFSZ: ::c_int = 25; | ||
240 | pub const SIGVTALRM: ::c_int = 26; | ||
241 | pub const SIGPROF: ::c_int = 27; | ||
242 | pub const SIGWINCH: ::c_int = 28; | ||
243 | pub const SIGUSR1: ::c_int = 10; | ||
244 | pub const SIGUSR2: ::c_int = 12; | ||
245 | pub const SIGCONT: ::c_int = 18; | ||
246 | pub const SIGSTOP: ::c_int = 19; | ||
247 | pub const SIGTSTP: ::c_int = 20; | ||
248 | pub const SIGURG: ::c_int = 23; | ||
249 | pub const SIGIO: ::c_int = 29; | ||
250 | pub const SIGSYS: ::c_int = 31; | ||
251 | pub const SIGSTKFLT: ::c_int = 16; | ||
252 | pub const SIGPOLL: ::c_int = 29; | ||
253 | pub const SIGPWR: ::c_int = 30; | ||
254 | pub const SIG_SETMASK: ::c_int = 2; | ||
255 | pub const SIG_BLOCK: ::c_int = 0x000000; | ||
256 | pub const SIG_UNBLOCK: ::c_int = 0x01; | ||
257 | |||
258 | pub const EXTPROC: ::tcflag_t = 0x00010000; | ||
259 | |||
260 | pub const MAP_HUGETLB: ::c_int = 0x040000; | ||
261 | |||
262 | pub const F_GETLK: ::c_int = 12; | ||
263 | pub const F_GETOWN: ::c_int = 9; | ||
264 | pub const F_SETLK: ::c_int = 13; | ||
265 | pub const F_SETLKW: ::c_int = 14; | ||
266 | pub const F_SETOWN: ::c_int = 8; | ||
267 | |||
268 | pub const VEOF: usize = 4; | ||
269 | pub const VEOL: usize = 11; | ||
270 | pub const VEOL2: usize = 16; | ||
271 | pub const VMIN: usize = 6; | ||
272 | pub const IEXTEN: ::tcflag_t = 0x00008000; | ||
273 | pub const TOSTOP: ::tcflag_t = 0x00000100; | ||
274 | pub const FLUSHO: ::tcflag_t = 0x00001000; | ||
275 | |||
276 | pub const TCGETS: ::c_int = 0x5401; | ||
277 | pub const TCSETS: ::c_int = 0x5402; | ||
278 | pub const TCSETSW: ::c_int = 0x5403; | ||
279 | pub const TCSETSF: ::c_int = 0x5404; | ||
280 | pub const TCGETA: ::c_int = 0x5405; | ||
281 | pub const TCSETA: ::c_int = 0x5406; | ||
282 | pub const TCSETAW: ::c_int = 0x5407; | ||
283 | pub const TCSETAF: ::c_int = 0x5408; | ||
284 | pub const TCSBRK: ::c_int = 0x5409; | ||
285 | pub const TCXONC: ::c_int = 0x540A; | ||
286 | pub const TCFLSH: ::c_int = 0x540B; | ||
287 | pub const TIOCGSOFTCAR: ::c_int = 0x5419; | ||
288 | pub const TIOCSSOFTCAR: ::c_int = 0x541A; | ||
289 | pub const TIOCLINUX: ::c_int = 0x541C; | ||
290 | pub const TIOCGSERIAL: ::c_int = 0x541E; | ||
291 | pub const TIOCEXCL: ::c_int = 0x540C; | ||
292 | pub const TIOCNXCL: ::c_int = 0x540D; | ||
293 | pub const TIOCSCTTY: ::c_int = 0x540E; | ||
294 | pub const TIOCGPGRP: ::c_int = 0x540F; | ||
295 | pub const TIOCSPGRP: ::c_int = 0x5410; | ||
296 | pub const TIOCOUTQ: ::c_int = 0x5411; | ||
297 | pub const TIOCSTI: ::c_int = 0x5412; | ||
298 | pub const TIOCGWINSZ: ::c_int = 0x5413; | ||
299 | pub const TIOCSWINSZ: ::c_int = 0x5414; | ||
300 | pub const TIOCMGET: ::c_int = 0x5415; | ||
301 | pub const TIOCMBIS: ::c_int = 0x5416; | ||
302 | pub const TIOCMBIC: ::c_int = 0x5417; | ||
303 | pub const TIOCMSET: ::c_int = 0x5418; | ||
304 | pub const FIONREAD: ::c_int = 0x541B; | ||
305 | pub const TIOCCONS: ::c_int = 0x541D; | ||
306 | |||
307 | pub const SYS_gettid: ::c_long = 224; | ||
308 | pub const SYS_perf_event_open: ::c_long = 364; | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs b/third_party/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs new file mode 100644 index 0000000..93e4ab6 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs | |||
@@ -0,0 +1,307 @@ | |||
1 | pub type c_char = u8; | ||
2 | pub type wchar_t = u32; | ||
3 | |||
4 | s! { | ||
5 | pub struct stat { | ||
6 | pub st_dev: ::dev_t, | ||
7 | __st_dev_padding: ::c_int, | ||
8 | __st_ino_truncated: ::c_long, | ||
9 | pub st_mode: ::mode_t, | ||
10 | pub st_nlink: ::nlink_t, | ||
11 | pub st_uid: ::uid_t, | ||
12 | pub st_gid: ::gid_t, | ||
13 | pub st_rdev: ::dev_t, | ||
14 | __st_rdev_padding: ::c_int, | ||
15 | pub st_size: ::off_t, | ||
16 | pub st_blksize: ::blksize_t, | ||
17 | pub st_blocks: ::blkcnt_t, | ||
18 | pub st_atime: ::time_t, | ||
19 | pub st_atime_nsec: ::c_long, | ||
20 | pub st_mtime: ::time_t, | ||
21 | pub st_mtime_nsec: ::c_long, | ||
22 | pub st_ctime: ::time_t, | ||
23 | pub st_ctime_nsec: ::c_long, | ||
24 | pub st_ino: ::ino_t, | ||
25 | } | ||
26 | |||
27 | pub struct stat64 { | ||
28 | pub st_dev: ::dev_t, | ||
29 | __st_dev_padding: ::c_int, | ||
30 | __st_ino_truncated: ::c_long, | ||
31 | pub st_mode: ::mode_t, | ||
32 | pub st_nlink: ::nlink_t, | ||
33 | pub st_uid: ::uid_t, | ||
34 | pub st_gid: ::gid_t, | ||
35 | pub st_rdev: ::dev_t, | ||
36 | __st_rdev_padding: ::c_int, | ||
37 | pub st_size: ::off_t, | ||
38 | pub st_blksize: ::blksize_t, | ||
39 | pub st_blocks: ::blkcnt_t, | ||
40 | pub st_atime: ::time_t, | ||
41 | pub st_atime_nsec: ::c_long, | ||
42 | pub st_mtime: ::time_t, | ||
43 | pub st_mtime_nsec: ::c_long, | ||
44 | pub st_ctime: ::time_t, | ||
45 | pub st_ctime_nsec: ::c_long, | ||
46 | pub st_ino: ::ino_t, | ||
47 | } | ||
48 | |||
49 | pub struct stack_t { | ||
50 | pub ss_sp: *mut ::c_void, | ||
51 | pub ss_flags: ::c_int, | ||
52 | pub ss_size: ::size_t | ||
53 | } | ||
54 | |||
55 | pub struct shmid_ds { | ||
56 | pub shm_perm: ::ipc_perm, | ||
57 | pub shm_segsz: ::size_t, | ||
58 | pub shm_atime: ::time_t, | ||
59 | __unused1: ::c_int, | ||
60 | pub shm_dtime: ::time_t, | ||
61 | __unused2: ::c_int, | ||
62 | pub shm_ctime: ::time_t, | ||
63 | __unused3: ::c_int, | ||
64 | pub shm_cpid: ::pid_t, | ||
65 | pub shm_lpid: ::pid_t, | ||
66 | pub shm_nattch: ::c_ulong, | ||
67 | __pad1: ::c_ulong, | ||
68 | __pad2: ::c_ulong, | ||
69 | } | ||
70 | |||
71 | pub struct statfs { | ||
72 | pub f_type: ::c_ulong, | ||
73 | pub f_bsize: ::c_ulong, | ||
74 | pub f_blocks: ::fsblkcnt_t, | ||
75 | pub f_bfree: ::fsblkcnt_t, | ||
76 | pub f_bavail: ::fsblkcnt_t, | ||
77 | pub f_files: ::fsfilcnt_t, | ||
78 | pub f_ffree: ::fsfilcnt_t, | ||
79 | pub f_fsid: ::fsid_t, | ||
80 | pub f_namelen: ::c_ulong, | ||
81 | pub f_frsize: ::c_ulong, | ||
82 | pub f_flags: ::c_ulong, | ||
83 | pub f_spare: [::c_ulong; 4], | ||
84 | } | ||
85 | } | ||
86 | |||
87 | pub const O_DIRECT: ::c_int = 0x4000; | ||
88 | pub const O_DIRECTORY: ::c_int = 0x10000; | ||
89 | pub const O_NOFOLLOW: ::c_int = 0x20000; | ||
90 | pub const O_ASYNC: ::c_int = 0x2000; | ||
91 | |||
92 | pub const FIOCLEX: ::c_int = 0x5451; | ||
93 | pub const FIONBIO: ::c_int = 0x5421; | ||
94 | |||
95 | pub const RLIMIT_RSS: ::c_int = 5; | ||
96 | pub const RLIMIT_NOFILE: ::c_int = 7; | ||
97 | pub const RLIMIT_AS: ::c_int = 9; | ||
98 | pub const RLIMIT_NPROC: ::c_int = 6; | ||
99 | pub const RLIMIT_MEMLOCK: ::c_int = 8; | ||
100 | |||
101 | pub const O_APPEND: ::c_int = 1024; | ||
102 | pub const O_CREAT: ::c_int = 64; | ||
103 | pub const O_EXCL: ::c_int = 128; | ||
104 | pub const O_NOCTTY: ::c_int = 256; | ||
105 | pub const O_NONBLOCK: ::c_int = 2048; | ||
106 | pub const O_SYNC: ::c_int = 1052672; | ||
107 | pub const O_RSYNC: ::c_int = 1052672; | ||
108 | pub const O_DSYNC: ::c_int = 4096; | ||
109 | |||
110 | pub const SOCK_NONBLOCK: ::c_int = 2048; | ||
111 | |||
112 | pub const MAP_ANON: ::c_int = 0x0020; | ||
113 | pub const MAP_GROWSDOWN: ::c_int = 0x0100; | ||
114 | pub const MAP_DENYWRITE: ::c_int = 0x0800; | ||
115 | pub const MAP_EXECUTABLE: ::c_int = 0x01000; | ||
116 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
117 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
118 | pub const MAP_POPULATE: ::c_int = 0x08000; | ||
119 | pub const MAP_NONBLOCK: ::c_int = 0x010000; | ||
120 | pub const MAP_STACK: ::c_int = 0x020000; | ||
121 | |||
122 | pub const SOCK_STREAM: ::c_int = 1; | ||
123 | pub const SOCK_DGRAM: ::c_int = 2; | ||
124 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
125 | |||
126 | pub const SOL_SOCKET: ::c_int = 1; | ||
127 | |||
128 | pub const EDEADLK: ::c_int = 35; | ||
129 | pub const ENAMETOOLONG: ::c_int = 36; | ||
130 | pub const ENOLCK: ::c_int = 37; | ||
131 | pub const ENOSYS: ::c_int = 38; | ||
132 | pub const ENOTEMPTY: ::c_int = 39; | ||
133 | pub const ELOOP: ::c_int = 40; | ||
134 | pub const ENOMSG: ::c_int = 42; | ||
135 | pub const EIDRM: ::c_int = 43; | ||
136 | pub const ECHRNG: ::c_int = 44; | ||
137 | pub const EL2NSYNC: ::c_int = 45; | ||
138 | pub const EL3HLT: ::c_int = 46; | ||
139 | pub const EL3RST: ::c_int = 47; | ||
140 | pub const ELNRNG: ::c_int = 48; | ||
141 | pub const EUNATCH: ::c_int = 49; | ||
142 | pub const ENOCSI: ::c_int = 50; | ||
143 | pub const EL2HLT: ::c_int = 51; | ||
144 | pub const EBADE: ::c_int = 52; | ||
145 | pub const EBADR: ::c_int = 53; | ||
146 | pub const EXFULL: ::c_int = 54; | ||
147 | pub const ENOANO: ::c_int = 55; | ||
148 | pub const EBADRQC: ::c_int = 56; | ||
149 | pub const EBADSLT: ::c_int = 57; | ||
150 | pub const EDEADLOCK: ::c_int = EDEADLK; | ||
151 | pub const EMULTIHOP: ::c_int = 72; | ||
152 | pub const EBADMSG: ::c_int = 74; | ||
153 | pub const EOVERFLOW: ::c_int = 75; | ||
154 | pub const ENOTUNIQ: ::c_int = 76; | ||
155 | pub const EBADFD: ::c_int = 77; | ||
156 | pub const EREMCHG: ::c_int = 78; | ||
157 | pub const ELIBACC: ::c_int = 79; | ||
158 | pub const ELIBBAD: ::c_int = 80; | ||
159 | pub const ELIBSCN: ::c_int = 81; | ||
160 | pub const ELIBMAX: ::c_int = 82; | ||
161 | pub const ELIBEXEC: ::c_int = 83; | ||
162 | pub const EILSEQ: ::c_int = 84; | ||
163 | pub const ERESTART: ::c_int = 85; | ||
164 | pub const ESTRPIPE: ::c_int = 86; | ||
165 | pub const EUSERS: ::c_int = 87; | ||
166 | pub const ENOTSOCK: ::c_int = 88; | ||
167 | pub const EDESTADDRREQ: ::c_int = 89; | ||
168 | pub const EMSGSIZE: ::c_int = 90; | ||
169 | pub const EPROTOTYPE: ::c_int = 91; | ||
170 | pub const ENOPROTOOPT: ::c_int = 92; | ||
171 | pub const EPROTONOSUPPORT: ::c_int = 93; | ||
172 | pub const ESOCKTNOSUPPORT: ::c_int = 94; | ||
173 | pub const EOPNOTSUPP: ::c_int = 95; | ||
174 | pub const EPFNOSUPPORT: ::c_int = 96; | ||
175 | pub const EAFNOSUPPORT: ::c_int = 97; | ||
176 | pub const EADDRINUSE: ::c_int = 98; | ||
177 | pub const EADDRNOTAVAIL: ::c_int = 99; | ||
178 | pub const ENETDOWN: ::c_int = 100; | ||
179 | pub const ENETUNREACH: ::c_int = 101; | ||
180 | pub const ENETRESET: ::c_int = 102; | ||
181 | pub const ECONNABORTED: ::c_int = 103; | ||
182 | pub const ECONNRESET: ::c_int = 104; | ||
183 | pub const ENOBUFS: ::c_int = 105; | ||
184 | pub const EISCONN: ::c_int = 106; | ||
185 | pub const ENOTCONN: ::c_int = 107; | ||
186 | pub const ESHUTDOWN: ::c_int = 108; | ||
187 | pub const ETOOMANYREFS: ::c_int = 109; | ||
188 | pub const ETIMEDOUT: ::c_int = 110; | ||
189 | pub const ECONNREFUSED: ::c_int = 111; | ||
190 | pub const EHOSTDOWN: ::c_int = 112; | ||
191 | pub const EHOSTUNREACH: ::c_int = 113; | ||
192 | pub const EALREADY: ::c_int = 114; | ||
193 | pub const EINPROGRESS: ::c_int = 115; | ||
194 | pub const ESTALE: ::c_int = 116; | ||
195 | pub const EUCLEAN: ::c_int = 117; | ||
196 | pub const ENOTNAM: ::c_int = 118; | ||
197 | pub const ENAVAIL: ::c_int = 119; | ||
198 | pub const EISNAM: ::c_int = 120; | ||
199 | pub const EREMOTEIO: ::c_int = 121; | ||
200 | pub const EDQUOT: ::c_int = 122; | ||
201 | pub const ENOMEDIUM: ::c_int = 123; | ||
202 | pub const EMEDIUMTYPE: ::c_int = 124; | ||
203 | pub const ECANCELED: ::c_int = 125; | ||
204 | pub const ENOKEY: ::c_int = 126; | ||
205 | pub const EKEYEXPIRED: ::c_int = 127; | ||
206 | pub const EKEYREVOKED: ::c_int = 128; | ||
207 | pub const EKEYREJECTED: ::c_int = 129; | ||
208 | pub const EOWNERDEAD: ::c_int = 130; | ||
209 | pub const ENOTRECOVERABLE: ::c_int = 131; | ||
210 | pub const ERFKILL: ::c_int = 132; | ||
211 | pub const EHWPOISON: ::c_int = 133; | ||
212 | |||
213 | pub const SO_REUSEADDR: ::c_int = 2; | ||
214 | pub const SO_TYPE: ::c_int = 3; | ||
215 | pub const SO_ERROR: ::c_int = 4; | ||
216 | pub const SO_DONTROUTE: ::c_int = 5; | ||
217 | pub const SO_BROADCAST: ::c_int = 6; | ||
218 | pub const SO_SNDBUF: ::c_int = 7; | ||
219 | pub const SO_RCVBUF: ::c_int = 8; | ||
220 | pub const SO_KEEPALIVE: ::c_int = 9; | ||
221 | pub const SO_OOBINLINE: ::c_int = 10; | ||
222 | pub const SO_LINGER: ::c_int = 13; | ||
223 | pub const SO_REUSEPORT: ::c_int = 15; | ||
224 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
225 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
226 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
227 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
228 | pub const SO_ACCEPTCONN: ::c_int = 30; | ||
229 | |||
230 | pub const SA_ONSTACK: ::c_int = 0x08000000; | ||
231 | pub const SA_SIGINFO: ::c_int = 0x00000004; | ||
232 | pub const SA_NOCLDWAIT: ::c_int = 0x00000002; | ||
233 | |||
234 | pub const SIGCHLD: ::c_int = 17; | ||
235 | pub const SIGBUS: ::c_int = 7; | ||
236 | pub const SIGTTIN: ::c_int = 21; | ||
237 | pub const SIGTTOU: ::c_int = 22; | ||
238 | pub const SIGXCPU: ::c_int = 24; | ||
239 | pub const SIGXFSZ: ::c_int = 25; | ||
240 | pub const SIGVTALRM: ::c_int = 26; | ||
241 | pub const SIGPROF: ::c_int = 27; | ||
242 | pub const SIGWINCH: ::c_int = 28; | ||
243 | pub const SIGUSR1: ::c_int = 10; | ||
244 | pub const SIGUSR2: ::c_int = 12; | ||
245 | pub const SIGCONT: ::c_int = 18; | ||
246 | pub const SIGSTOP: ::c_int = 19; | ||
247 | pub const SIGTSTP: ::c_int = 20; | ||
248 | pub const SIGURG: ::c_int = 23; | ||
249 | pub const SIGIO: ::c_int = 29; | ||
250 | pub const SIGSYS: ::c_int = 31; | ||
251 | pub const SIGSTKFLT: ::c_int = 16; | ||
252 | pub const SIGPOLL: ::c_int = 29; | ||
253 | pub const SIGPWR: ::c_int = 30; | ||
254 | pub const SIG_SETMASK: ::c_int = 2; | ||
255 | pub const SIG_BLOCK: ::c_int = 0x000000; | ||
256 | pub const SIG_UNBLOCK: ::c_int = 0x01; | ||
257 | |||
258 | pub const EXTPROC: ::tcflag_t = 0x00010000; | ||
259 | |||
260 | pub const MAP_HUGETLB: ::c_int = 0x040000; | ||
261 | |||
262 | pub const F_GETLK: ::c_int = 12; | ||
263 | pub const F_GETOWN: ::c_int = 9; | ||
264 | pub const F_SETLK: ::c_int = 13; | ||
265 | pub const F_SETLKW: ::c_int = 14; | ||
266 | pub const F_SETOWN: ::c_int = 8; | ||
267 | |||
268 | pub const VEOF: usize = 4; | ||
269 | pub const VEOL: usize = 11; | ||
270 | pub const VEOL2: usize = 16; | ||
271 | pub const VMIN: usize = 6; | ||
272 | pub const IEXTEN: ::tcflag_t = 0x00008000; | ||
273 | pub const TOSTOP: ::tcflag_t = 0x00000100; | ||
274 | pub const FLUSHO: ::tcflag_t = 0x00001000; | ||
275 | |||
276 | pub const TCGETS: ::c_int = 0x5401; | ||
277 | pub const TCSETS: ::c_int = 0x5402; | ||
278 | pub const TCSETSW: ::c_int = 0x5403; | ||
279 | pub const TCSETSF: ::c_int = 0x5404; | ||
280 | pub const TCGETA: ::c_int = 0x5405; | ||
281 | pub const TCSETA: ::c_int = 0x5406; | ||
282 | pub const TCSETAW: ::c_int = 0x5407; | ||
283 | pub const TCSETAF: ::c_int = 0x5408; | ||
284 | pub const TCSBRK: ::c_int = 0x5409; | ||
285 | pub const TCXONC: ::c_int = 0x540A; | ||
286 | pub const TCFLSH: ::c_int = 0x540B; | ||
287 | pub const TIOCGSOFTCAR: ::c_int = 0x5419; | ||
288 | pub const TIOCSSOFTCAR: ::c_int = 0x541A; | ||
289 | pub const TIOCLINUX: ::c_int = 0x541C; | ||
290 | pub const TIOCGSERIAL: ::c_int = 0x541E; | ||
291 | pub const TIOCEXCL: ::c_int = 0x540C; | ||
292 | pub const TIOCNXCL: ::c_int = 0x540D; | ||
293 | pub const TIOCSCTTY: ::c_int = 0x540E; | ||
294 | pub const TIOCGPGRP: ::c_int = 0x540F; | ||
295 | pub const TIOCSPGRP: ::c_int = 0x5410; | ||
296 | pub const TIOCOUTQ: ::c_int = 0x5411; | ||
297 | pub const TIOCSTI: ::c_int = 0x5412; | ||
298 | pub const TIOCGWINSZ: ::c_int = 0x5413; | ||
299 | pub const TIOCSWINSZ: ::c_int = 0x5414; | ||
300 | pub const TIOCMGET: ::c_int = 0x5415; | ||
301 | pub const TIOCMBIS: ::c_int = 0x5416; | ||
302 | pub const TIOCMBIC: ::c_int = 0x5417; | ||
303 | pub const TIOCMSET: ::c_int = 0x5418; | ||
304 | pub const FIONREAD: ::c_int = 0x541B; | ||
305 | pub const TIOCCONS: ::c_int = 0x541D; | ||
306 | |||
307 | pub const SYS_gettid: ::c_long = 224; // Valid for arm (32-bit) and x86 (32-bit) | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b32/mips.rs b/third_party/libc/src/unix/notbsd/linux/musl/b32/mips.rs new file mode 100644 index 0000000..f52d195 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b32/mips.rs | |||
@@ -0,0 +1,307 @@ | |||
1 | pub type c_char = i8; | ||
2 | pub type wchar_t = ::c_int; | ||
3 | |||
4 | s! { | ||
5 | pub struct stat { | ||
6 | pub st_dev: ::dev_t, | ||
7 | __st_padding1: [::c_long; 2], | ||
8 | pub st_ino: ::ino_t, | ||
9 | pub st_mode: ::mode_t, | ||
10 | pub st_nlink: ::nlink_t, | ||
11 | pub st_uid: ::uid_t, | ||
12 | pub st_gid: ::gid_t, | ||
13 | pub st_rdev: ::dev_t, | ||
14 | __st_padding2: [::c_long; 2], | ||
15 | pub st_size: ::off_t, | ||
16 | pub st_atime: ::time_t, | ||
17 | pub st_atime_nsec: ::c_long, | ||
18 | pub st_mtime: ::time_t, | ||
19 | pub st_mtime_nsec: ::c_long, | ||
20 | pub st_ctime: ::time_t, | ||
21 | pub st_ctime_nsec: ::c_long, | ||
22 | pub st_blksize: ::blksize_t, | ||
23 | __st_padding3: ::c_long, | ||
24 | pub st_blocks: ::blkcnt_t, | ||
25 | __st_padding4: [::c_long; 14], | ||
26 | } | ||
27 | |||
28 | pub struct stat64 { | ||
29 | pub st_dev: ::dev_t, | ||
30 | __st_padding1: [::c_long; 2], | ||
31 | pub st_ino: ::ino64_t, | ||
32 | pub st_mode: ::mode_t, | ||
33 | pub st_nlink: ::nlink_t, | ||
34 | pub st_uid: ::uid_t, | ||
35 | pub st_gid: ::gid_t, | ||
36 | pub st_rdev: ::dev_t, | ||
37 | __st_padding2: [::c_long; 2], | ||
38 | pub st_size: ::off_t, | ||
39 | pub st_atime: ::time_t, | ||
40 | pub st_atime_nsec: ::c_long, | ||
41 | pub st_mtime: ::time_t, | ||
42 | pub st_mtime_nsec: ::c_long, | ||
43 | pub st_ctime: ::time_t, | ||
44 | pub st_ctime_nsec: ::c_long, | ||
45 | pub st_blksize: ::blksize_t, | ||
46 | __st_padding3: ::c_long, | ||
47 | pub st_blocks: ::blkcnt64_t, | ||
48 | __st_padding4: [::c_long; 14], | ||
49 | } | ||
50 | |||
51 | pub struct stack_t { | ||
52 | pub ss_sp: *mut ::c_void, | ||
53 | pub ss_size: ::size_t, | ||
54 | pub ss_flags: ::c_int, | ||
55 | } | ||
56 | |||
57 | pub struct shmid_ds { | ||
58 | pub shm_perm: ::ipc_perm, | ||
59 | pub shm_segsz: ::size_t, | ||
60 | pub shm_atime: ::time_t, | ||
61 | pub shm_dtime: ::time_t, | ||
62 | pub shm_ctime: ::time_t, | ||
63 | pub shm_cpid: ::pid_t, | ||
64 | pub shm_lpid: ::pid_t, | ||
65 | pub shm_nattch: ::c_ulong, | ||
66 | __pad1: ::c_ulong, | ||
67 | __pad2: ::c_ulong, | ||
68 | } | ||
69 | |||
70 | pub struct statfs { | ||
71 | pub f_type: ::c_ulong, | ||
72 | pub f_bsize: ::c_ulong, | ||
73 | pub f_frsize: ::c_ulong, | ||
74 | pub f_blocks: ::fsblkcnt_t, | ||
75 | pub f_bfree: ::fsblkcnt_t, | ||
76 | pub f_files: ::fsfilcnt_t, | ||
77 | pub f_ffree: ::fsfilcnt_t, | ||
78 | pub f_bavail: ::fsblkcnt_t, | ||
79 | pub f_fsid: ::fsid_t, | ||
80 | pub f_namelen: ::c_ulong, | ||
81 | pub f_flags: ::c_ulong, | ||
82 | pub f_spare: [::c_ulong; 5], | ||
83 | } | ||
84 | } | ||
85 | |||
86 | pub const O_DIRECT: ::c_int = 0o100000; | ||
87 | pub const O_DIRECTORY: ::c_int = 0o200000; | ||
88 | pub const O_NOFOLLOW: ::c_int = 0o400000; | ||
89 | pub const O_ASYNC: ::c_int = 0o10000; | ||
90 | |||
91 | pub const FIOCLEX: ::c_int = 0x6601; | ||
92 | pub const FIONBIO: ::c_int = 0x667E; | ||
93 | |||
94 | pub const RLIMIT_RSS: ::c_int = 7; | ||
95 | pub const RLIMIT_NOFILE: ::c_int = 5; | ||
96 | pub const RLIMIT_AS: ::c_int = 6; | ||
97 | pub const RLIMIT_NPROC: ::c_int = 8; | ||
98 | pub const RLIMIT_MEMLOCK: ::c_int = 9; | ||
99 | |||
100 | pub const O_APPEND: ::c_int = 0o010; | ||
101 | pub const O_CREAT: ::c_int = 0o400; | ||
102 | pub const O_EXCL: ::c_int = 0o2000; | ||
103 | pub const O_NOCTTY: ::c_int = 0o4000; | ||
104 | pub const O_NONBLOCK: ::c_int = 0o200; | ||
105 | pub const O_SYNC: ::c_int = 0o40020; | ||
106 | pub const O_RSYNC: ::c_int = 0o40020; | ||
107 | pub const O_DSYNC: ::c_int = 0o020; | ||
108 | |||
109 | pub const SOCK_NONBLOCK: ::c_int = 0o200; | ||
110 | |||
111 | pub const MAP_ANON: ::c_int = 0x800; | ||
112 | pub const MAP_GROWSDOWN: ::c_int = 0x1000; | ||
113 | pub const MAP_DENYWRITE: ::c_int = 0x2000; | ||
114 | pub const MAP_EXECUTABLE: ::c_int = 0x4000; | ||
115 | pub const MAP_LOCKED: ::c_int = 0x8000; | ||
116 | pub const MAP_NORESERVE: ::c_int = 0x0400; | ||
117 | pub const MAP_POPULATE: ::c_int = 0x10000; | ||
118 | pub const MAP_NONBLOCK: ::c_int = 0x20000; | ||
119 | pub const MAP_STACK: ::c_int = 0x40000; | ||
120 | |||
121 | pub const EDEADLK: ::c_int = 45; | ||
122 | pub const ENAMETOOLONG: ::c_int = 78; | ||
123 | pub const ENOLCK: ::c_int = 46; | ||
124 | pub const ENOSYS: ::c_int = 89; | ||
125 | pub const ENOTEMPTY: ::c_int = 93; | ||
126 | pub const ELOOP: ::c_int = 90; | ||
127 | pub const ENOMSG: ::c_int = 35; | ||
128 | pub const EIDRM: ::c_int = 36; | ||
129 | pub const ECHRNG: ::c_int = 37; | ||
130 | pub const EL2NSYNC: ::c_int = 38; | ||
131 | pub const EL3HLT: ::c_int = 39; | ||
132 | pub const EL3RST: ::c_int = 40; | ||
133 | pub const ELNRNG: ::c_int = 41; | ||
134 | pub const EUNATCH: ::c_int = 42; | ||
135 | pub const ENOCSI: ::c_int = 43; | ||
136 | pub const EL2HLT: ::c_int = 44; | ||
137 | pub const EBADE: ::c_int = 50; | ||
138 | pub const EBADR: ::c_int = 51; | ||
139 | pub const EXFULL: ::c_int = 52; | ||
140 | pub const ENOANO: ::c_int = 53; | ||
141 | pub const EBADRQC: ::c_int = 54; | ||
142 | pub const EBADSLT: ::c_int = 55; | ||
143 | pub const EDEADLOCK: ::c_int = 56; | ||
144 | pub const EMULTIHOP: ::c_int = 74; | ||
145 | pub const EOVERFLOW: ::c_int = 79; | ||
146 | pub const ENOTUNIQ: ::c_int = 80; | ||
147 | pub const EBADFD: ::c_int = 81; | ||
148 | pub const EBADMSG: ::c_int = 77; | ||
149 | pub const EREMCHG: ::c_int = 82; | ||
150 | pub const ELIBACC: ::c_int = 83; | ||
151 | pub const ELIBBAD: ::c_int = 84; | ||
152 | pub const ELIBSCN: ::c_int = 85; | ||
153 | pub const ELIBMAX: ::c_int = 86; | ||
154 | pub const ELIBEXEC: ::c_int = 87; | ||
155 | pub const EILSEQ: ::c_int = 88; | ||
156 | pub const ERESTART: ::c_int = 91; | ||
157 | pub const ESTRPIPE: ::c_int = 92; | ||
158 | pub const EUSERS: ::c_int = 94; | ||
159 | pub const ENOTSOCK: ::c_int = 95; | ||
160 | pub const EDESTADDRREQ: ::c_int = 96; | ||
161 | pub const EMSGSIZE: ::c_int = 97; | ||
162 | pub const EPROTOTYPE: ::c_int = 98; | ||
163 | pub const ENOPROTOOPT: ::c_int = 99; | ||
164 | pub const EPROTONOSUPPORT: ::c_int = 120; | ||
165 | pub const ESOCKTNOSUPPORT: ::c_int = 121; | ||
166 | pub const EOPNOTSUPP: ::c_int = 122; | ||
167 | pub const EPFNOSUPPORT: ::c_int = 123; | ||
168 | pub const EAFNOSUPPORT: ::c_int = 124; | ||
169 | pub const EADDRINUSE: ::c_int = 125; | ||
170 | pub const EADDRNOTAVAIL: ::c_int = 126; | ||
171 | pub const ENETDOWN: ::c_int = 127; | ||
172 | pub const ENETUNREACH: ::c_int = 128; | ||
173 | pub const ENETRESET: ::c_int = 129; | ||
174 | pub const ECONNABORTED: ::c_int = 130; | ||
175 | pub const ECONNRESET: ::c_int = 131; | ||
176 | pub const ENOBUFS: ::c_int = 132; | ||
177 | pub const EISCONN: ::c_int = 133; | ||
178 | pub const ENOTCONN: ::c_int = 134; | ||
179 | pub const ESHUTDOWN: ::c_int = 143; | ||
180 | pub const ETOOMANYREFS: ::c_int = 144; | ||
181 | pub const ETIMEDOUT: ::c_int = 145; | ||
182 | pub const ECONNREFUSED: ::c_int = 146; | ||
183 | pub const EHOSTDOWN: ::c_int = 147; | ||
184 | pub const EHOSTUNREACH: ::c_int = 148; | ||
185 | pub const EALREADY: ::c_int = 149; | ||
186 | pub const EINPROGRESS: ::c_int = 150; | ||
187 | pub const ESTALE: ::c_int = 151; | ||
188 | pub const EUCLEAN: ::c_int = 135; | ||
189 | pub const ENOTNAM: ::c_int = 137; | ||
190 | pub const ENAVAIL: ::c_int = 138; | ||
191 | pub const EISNAM: ::c_int = 139; | ||
192 | pub const EREMOTEIO: ::c_int = 140; | ||
193 | pub const EDQUOT: ::c_int = 1133; | ||
194 | pub const ENOMEDIUM: ::c_int = 159; | ||
195 | pub const EMEDIUMTYPE: ::c_int = 160; | ||
196 | pub const ECANCELED: ::c_int = 158; | ||
197 | pub const ENOKEY: ::c_int = 161; | ||
198 | pub const EKEYEXPIRED: ::c_int = 162; | ||
199 | pub const EKEYREVOKED: ::c_int = 163; | ||
200 | pub const EKEYREJECTED: ::c_int = 164; | ||
201 | pub const EOWNERDEAD: ::c_int = 165; | ||
202 | pub const ENOTRECOVERABLE: ::c_int = 166; | ||
203 | pub const EHWPOISON: ::c_int = 168; | ||
204 | pub const ERFKILL: ::c_int = 167; | ||
205 | |||
206 | pub const SOCK_STREAM: ::c_int = 2; | ||
207 | pub const SOCK_DGRAM: ::c_int = 1; | ||
208 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
209 | |||
210 | pub const SOL_SOCKET: ::c_int = 65535; | ||
211 | |||
212 | pub const SO_REUSEADDR: ::c_int = 0x0004; | ||
213 | pub const SO_TYPE: ::c_int = 0x1008; | ||
214 | pub const SO_ERROR: ::c_int = 0x1007; | ||
215 | pub const SO_DONTROUTE: ::c_int = 0x0010; | ||
216 | pub const SO_BROADCAST: ::c_int = 0x0020; | ||
217 | pub const SO_SNDBUF: ::c_int = 0x1001; | ||
218 | pub const SO_RCVBUF: ::c_int = 0x1002; | ||
219 | pub const SO_KEEPALIVE: ::c_int = 0x0008; | ||
220 | pub const SO_OOBINLINE: ::c_int = 0x0100; | ||
221 | pub const SO_LINGER: ::c_int = 0x0080; | ||
222 | pub const SO_REUSEPORT: ::c_int = 0x200; | ||
223 | pub const SO_RCVLOWAT: ::c_int = 0x1004; | ||
224 | pub const SO_SNDLOWAT: ::c_int = 0x1003; | ||
225 | pub const SO_RCVTIMEO: ::c_int = 0x1006; | ||
226 | pub const SO_SNDTIMEO: ::c_int = 0x1005; | ||
227 | pub const SO_ACCEPTCONN: ::c_int = 0x1009; | ||
228 | |||
229 | pub const SA_ONSTACK: ::c_int = 0x08000000; | ||
230 | pub const SA_SIGINFO: ::c_int = 8; | ||
231 | pub const SA_NOCLDWAIT: ::c_int = 0x10000; | ||
232 | |||
233 | pub const SIGCHLD: ::c_int = 18; | ||
234 | pub const SIGBUS: ::c_int = 10; | ||
235 | pub const SIGTTIN: ::c_int = 26; | ||
236 | pub const SIGTTOU: ::c_int = 27; | ||
237 | pub const SIGXCPU: ::c_int = 30; | ||
238 | pub const SIGXFSZ: ::c_int = 31; | ||
239 | pub const SIGVTALRM: ::c_int = 28; | ||
240 | pub const SIGPROF: ::c_int = 29; | ||
241 | pub const SIGWINCH: ::c_int = 20; | ||
242 | pub const SIGUSR1: ::c_int = 16; | ||
243 | pub const SIGUSR2: ::c_int = 17; | ||
244 | pub const SIGCONT: ::c_int = 25; | ||
245 | pub const SIGSTOP: ::c_int = 23; | ||
246 | pub const SIGTSTP: ::c_int = 24; | ||
247 | pub const SIGURG: ::c_int = 21; | ||
248 | pub const SIGIO: ::c_int = 22; | ||
249 | pub const SIGSYS: ::c_int = 12; | ||
250 | pub const SIGSTKFLT: ::c_int = 7; | ||
251 | pub const SIGPOLL: ::c_int = ::SIGIO; | ||
252 | pub const SIGPWR: ::c_int = 19; | ||
253 | pub const SIG_SETMASK: ::c_int = 3; | ||
254 | pub const SIG_BLOCK: ::c_int = 1; | ||
255 | pub const SIG_UNBLOCK: ::c_int = 2; | ||
256 | |||
257 | pub const EXTPROC: ::tcflag_t = 0o200000; | ||
258 | |||
259 | pub const MAP_HUGETLB: ::c_int = 0x80000; | ||
260 | |||
261 | pub const F_GETLK: ::c_int = 33; | ||
262 | pub const F_GETOWN: ::c_int = 23; | ||
263 | pub const F_SETLK: ::c_int = 34; | ||
264 | pub const F_SETLKW: ::c_int = 35; | ||
265 | pub const F_SETOWN: ::c_int = 24; | ||
266 | |||
267 | pub const VEOF: usize = 16; | ||
268 | pub const VEOL: usize = 17; | ||
269 | pub const VEOL2: usize = 6; | ||
270 | pub const VMIN: usize = 4; | ||
271 | pub const IEXTEN: ::tcflag_t = 0o000400; | ||
272 | pub const TOSTOP: ::tcflag_t = 0o100000; | ||
273 | pub const FLUSHO: ::tcflag_t = 0o020000; | ||
274 | |||
275 | pub const TCGETS: ::c_int = 0x540D; | ||
276 | pub const TCSETS: ::c_int = 0x540E; | ||
277 | pub const TCSETSW: ::c_int = 0x540F; | ||
278 | pub const TCSETSF: ::c_int = 0x5410; | ||
279 | pub const TCGETA: ::c_int = 0x5401; | ||
280 | pub const TCSETA: ::c_int = 0x5402; | ||
281 | pub const TCSETAW: ::c_int = 0x5403; | ||
282 | pub const TCSETAF: ::c_int = 0x5404; | ||
283 | pub const TCSBRK: ::c_int = 0x5405; | ||
284 | pub const TCXONC: ::c_int = 0x5406; | ||
285 | pub const TCFLSH: ::c_int = 0x5407; | ||
286 | pub const TIOCGSOFTCAR: ::c_int = 0x5481; | ||
287 | pub const TIOCSSOFTCAR: ::c_int = 0x5482; | ||
288 | pub const TIOCLINUX: ::c_int = 0x5483; | ||
289 | pub const TIOCGSERIAL: ::c_int = 0x5484; | ||
290 | pub const TIOCEXCL: ::c_int = 0x740D; | ||
291 | pub const TIOCNXCL: ::c_int = 0x740E; | ||
292 | pub const TIOCSCTTY: ::c_int = 0x5480; | ||
293 | pub const TIOCGPGRP: ::c_int = 0x40047477; | ||
294 | pub const TIOCSPGRP: ::c_int = 0x80047476; | ||
295 | pub const TIOCOUTQ: ::c_int = 0x7472; | ||
296 | pub const TIOCSTI: ::c_int = 0x5472; | ||
297 | pub const TIOCGWINSZ: ::c_int = 0x40087468; | ||
298 | pub const TIOCSWINSZ: ::c_int = 0x80087467; | ||
299 | pub const TIOCMGET: ::c_int = 0x741D; | ||
300 | pub const TIOCMBIS: ::c_int = 0x741B; | ||
301 | pub const TIOCMBIC: ::c_int = 0x741C; | ||
302 | pub const TIOCMSET: ::c_int = 0x741D; | ||
303 | pub const FIONREAD: ::c_int = 0x467F; | ||
304 | pub const TIOCCONS: ::c_int = 0x80047478; | ||
305 | |||
306 | pub const SYS_gettid: ::c_long = 4222; // Valid for O32 | ||
307 | pub const SYS_perf_event_open: ::c_long = 4333; // Valid for O32 | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b32/mod.rs b/third_party/libc/src/unix/notbsd/linux/musl/b32/mod.rs new file mode 100644 index 0000000..6ae90bd --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b32/mod.rs | |||
@@ -0,0 +1,48 @@ | |||
1 | pub type c_long = i32; | ||
2 | pub type c_ulong = u32; | ||
3 | pub type nlink_t = u32; | ||
4 | |||
5 | s! { | ||
6 | pub struct pthread_attr_t { | ||
7 | __size: [u32; 9] | ||
8 | } | ||
9 | |||
10 | pub struct sigset_t { | ||
11 | __val: [::c_ulong; 32], | ||
12 | } | ||
13 | |||
14 | pub struct msghdr { | ||
15 | pub msg_name: *mut ::c_void, | ||
16 | pub msg_namelen: ::socklen_t, | ||
17 | pub msg_iov: *mut ::iovec, | ||
18 | pub msg_iovlen: ::c_int, | ||
19 | pub msg_control: *mut ::c_void, | ||
20 | pub msg_controllen: ::socklen_t, | ||
21 | pub msg_flags: ::c_int, | ||
22 | } | ||
23 | |||
24 | pub struct sem_t { | ||
25 | __val: [::c_int; 4], | ||
26 | } | ||
27 | } | ||
28 | |||
29 | pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; | ||
30 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; | ||
31 | |||
32 | cfg_if! { | ||
33 | if #[cfg(any(target_arch = "x86"))] { | ||
34 | mod x86; | ||
35 | pub use self::x86::*; | ||
36 | } else if #[cfg(any(target_arch = "mips"))] { | ||
37 | mod mips; | ||
38 | pub use self::mips::*; | ||
39 | } else if #[cfg(any(target_arch = "arm"))] { | ||
40 | mod arm; | ||
41 | pub use self::arm::*; | ||
42 | } else if #[cfg(any(target_arch = "asmjs"))] { | ||
43 | mod asmjs; | ||
44 | pub use self::asmjs::*; | ||
45 | } else { | ||
46 | // Unknown target_arch | ||
47 | } | ||
48 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b32/x86.rs b/third_party/libc/src/unix/notbsd/linux/musl/b32/x86.rs new file mode 100644 index 0000000..9d057de --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b32/x86.rs | |||
@@ -0,0 +1,322 @@ | |||
1 | pub type c_char = i8; | ||
2 | pub type wchar_t = i32; | ||
3 | |||
4 | s! { | ||
5 | pub struct stat { | ||
6 | pub st_dev: ::dev_t, | ||
7 | __st_dev_padding: ::c_int, | ||
8 | __st_ino_truncated: ::c_long, | ||
9 | pub st_mode: ::mode_t, | ||
10 | pub st_nlink: ::nlink_t, | ||
11 | pub st_uid: ::uid_t, | ||
12 | pub st_gid: ::gid_t, | ||
13 | pub st_rdev: ::dev_t, | ||
14 | __st_rdev_padding: ::c_int, | ||
15 | pub st_size: ::off_t, | ||
16 | pub st_blksize: ::blksize_t, | ||
17 | pub st_blocks: ::blkcnt_t, | ||
18 | pub st_atime: ::time_t, | ||
19 | pub st_atime_nsec: ::c_long, | ||
20 | pub st_mtime: ::time_t, | ||
21 | pub st_mtime_nsec: ::c_long, | ||
22 | pub st_ctime: ::time_t, | ||
23 | pub st_ctime_nsec: ::c_long, | ||
24 | pub st_ino: ::ino_t, | ||
25 | } | ||
26 | |||
27 | pub struct stat64 { | ||
28 | pub st_dev: ::dev_t, | ||
29 | __st_dev_padding: ::c_int, | ||
30 | __st_ino_truncated: ::c_long, | ||
31 | pub st_mode: ::mode_t, | ||
32 | pub st_nlink: ::nlink_t, | ||
33 | pub st_uid: ::uid_t, | ||
34 | pub st_gid: ::gid_t, | ||
35 | pub st_rdev: ::dev_t, | ||
36 | __st_rdev_padding: ::c_int, | ||
37 | pub st_size: ::off_t, | ||
38 | pub st_blksize: ::blksize_t, | ||
39 | pub st_blocks: ::blkcnt_t, | ||
40 | pub st_atime: ::time_t, | ||
41 | pub st_atime_nsec: ::c_long, | ||
42 | pub st_mtime: ::time_t, | ||
43 | pub st_mtime_nsec: ::c_long, | ||
44 | pub st_ctime: ::time_t, | ||
45 | pub st_ctime_nsec: ::c_long, | ||
46 | pub st_ino: ::ino_t, | ||
47 | } | ||
48 | |||
49 | pub struct stack_t { | ||
50 | pub ss_sp: *mut ::c_void, | ||
51 | pub ss_flags: ::c_int, | ||
52 | pub ss_size: ::size_t | ||
53 | } | ||
54 | |||
55 | pub struct shmid_ds { | ||
56 | pub shm_perm: ::ipc_perm, | ||
57 | pub shm_segsz: ::size_t, | ||
58 | pub shm_atime: ::time_t, | ||
59 | __unused1: ::c_int, | ||
60 | pub shm_dtime: ::time_t, | ||
61 | __unused2: ::c_int, | ||
62 | pub shm_ctime: ::time_t, | ||
63 | __unused3: ::c_int, | ||
64 | pub shm_cpid: ::pid_t, | ||
65 | pub shm_lpid: ::pid_t, | ||
66 | pub shm_nattch: ::c_ulong, | ||
67 | __pad1: ::c_ulong, | ||
68 | __pad2: ::c_ulong, | ||
69 | } | ||
70 | |||
71 | pub struct statfs { | ||
72 | pub f_type: ::c_ulong, | ||
73 | pub f_bsize: ::c_ulong, | ||
74 | pub f_blocks: ::fsblkcnt_t, | ||
75 | pub f_bfree: ::fsblkcnt_t, | ||
76 | pub f_bavail: ::fsblkcnt_t, | ||
77 | pub f_files: ::fsfilcnt_t, | ||
78 | pub f_ffree: ::fsfilcnt_t, | ||
79 | pub f_fsid: ::fsid_t, | ||
80 | pub f_namelen: ::c_ulong, | ||
81 | pub f_frsize: ::c_ulong, | ||
82 | pub f_flags: ::c_ulong, | ||
83 | pub f_spare: [::c_ulong; 4], | ||
84 | } | ||
85 | |||
86 | pub struct mcontext_t { | ||
87 | __private: [u32; 22] | ||
88 | } | ||
89 | |||
90 | pub struct ucontext_t { | ||
91 | pub uc_flags: ::c_ulong, | ||
92 | pub uc_link: *mut ucontext_t, | ||
93 | pub uc_stack: ::stack_t, | ||
94 | pub uc_mcontext: mcontext_t, | ||
95 | pub uc_sigmask: ::sigset_t, | ||
96 | __private: [u8; 112], | ||
97 | } | ||
98 | } | ||
99 | |||
100 | pub const O_DIRECT: ::c_int = 0x4000; | ||
101 | pub const O_DIRECTORY: ::c_int = 0x10000; | ||
102 | pub const O_NOFOLLOW: ::c_int = 0x20000; | ||
103 | pub const O_ASYNC: ::c_int = 0x2000; | ||
104 | |||
105 | pub const FIOCLEX: ::c_int = 0x5451; | ||
106 | pub const FIONBIO: ::c_int = 0x5421; | ||
107 | |||
108 | pub const RLIMIT_RSS: ::c_int = 5; | ||
109 | pub const RLIMIT_NOFILE: ::c_int = 7; | ||
110 | pub const RLIMIT_AS: ::c_int = 9; | ||
111 | pub const RLIMIT_NPROC: ::c_int = 6; | ||
112 | pub const RLIMIT_MEMLOCK: ::c_int = 8; | ||
113 | |||
114 | pub const O_APPEND: ::c_int = 1024; | ||
115 | pub const O_CREAT: ::c_int = 64; | ||
116 | pub const O_EXCL: ::c_int = 128; | ||
117 | pub const O_NOCTTY: ::c_int = 256; | ||
118 | pub const O_NONBLOCK: ::c_int = 2048; | ||
119 | pub const O_SYNC: ::c_int = 1052672; | ||
120 | pub const O_RSYNC: ::c_int = 1052672; | ||
121 | pub const O_DSYNC: ::c_int = 4096; | ||
122 | |||
123 | pub const SOCK_NONBLOCK: ::c_int = 2048; | ||
124 | |||
125 | pub const MAP_ANON: ::c_int = 0x0020; | ||
126 | pub const MAP_GROWSDOWN: ::c_int = 0x0100; | ||
127 | pub const MAP_DENYWRITE: ::c_int = 0x0800; | ||
128 | pub const MAP_EXECUTABLE: ::c_int = 0x01000; | ||
129 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
130 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
131 | pub const MAP_POPULATE: ::c_int = 0x08000; | ||
132 | pub const MAP_NONBLOCK: ::c_int = 0x010000; | ||
133 | pub const MAP_STACK: ::c_int = 0x020000; | ||
134 | |||
135 | pub const SOCK_STREAM: ::c_int = 1; | ||
136 | pub const SOCK_DGRAM: ::c_int = 2; | ||
137 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
138 | |||
139 | pub const SOL_SOCKET: ::c_int = 1; | ||
140 | |||
141 | pub const EDEADLK: ::c_int = 35; | ||
142 | pub const ENAMETOOLONG: ::c_int = 36; | ||
143 | pub const ENOLCK: ::c_int = 37; | ||
144 | pub const ENOSYS: ::c_int = 38; | ||
145 | pub const ENOTEMPTY: ::c_int = 39; | ||
146 | pub const ELOOP: ::c_int = 40; | ||
147 | pub const ENOMSG: ::c_int = 42; | ||
148 | pub const EIDRM: ::c_int = 43; | ||
149 | pub const ECHRNG: ::c_int = 44; | ||
150 | pub const EL2NSYNC: ::c_int = 45; | ||
151 | pub const EL3HLT: ::c_int = 46; | ||
152 | pub const EL3RST: ::c_int = 47; | ||
153 | pub const ELNRNG: ::c_int = 48; | ||
154 | pub const EUNATCH: ::c_int = 49; | ||
155 | pub const ENOCSI: ::c_int = 50; | ||
156 | pub const EL2HLT: ::c_int = 51; | ||
157 | pub const EBADE: ::c_int = 52; | ||
158 | pub const EBADR: ::c_int = 53; | ||
159 | pub const EXFULL: ::c_int = 54; | ||
160 | pub const ENOANO: ::c_int = 55; | ||
161 | pub const EBADRQC: ::c_int = 56; | ||
162 | pub const EBADSLT: ::c_int = 57; | ||
163 | pub const EDEADLOCK: ::c_int = EDEADLK; | ||
164 | pub const EMULTIHOP: ::c_int = 72; | ||
165 | pub const EBADMSG: ::c_int = 74; | ||
166 | pub const EOVERFLOW: ::c_int = 75; | ||
167 | pub const ENOTUNIQ: ::c_int = 76; | ||
168 | pub const EBADFD: ::c_int = 77; | ||
169 | pub const EREMCHG: ::c_int = 78; | ||
170 | pub const ELIBACC: ::c_int = 79; | ||
171 | pub const ELIBBAD: ::c_int = 80; | ||
172 | pub const ELIBSCN: ::c_int = 81; | ||
173 | pub const ELIBMAX: ::c_int = 82; | ||
174 | pub const ELIBEXEC: ::c_int = 83; | ||
175 | pub const EILSEQ: ::c_int = 84; | ||
176 | pub const ERESTART: ::c_int = 85; | ||
177 | pub const ESTRPIPE: ::c_int = 86; | ||
178 | pub const EUSERS: ::c_int = 87; | ||
179 | pub const ENOTSOCK: ::c_int = 88; | ||
180 | pub const EDESTADDRREQ: ::c_int = 89; | ||
181 | pub const EMSGSIZE: ::c_int = 90; | ||
182 | pub const EPROTOTYPE: ::c_int = 91; | ||
183 | pub const ENOPROTOOPT: ::c_int = 92; | ||
184 | pub const EPROTONOSUPPORT: ::c_int = 93; | ||
185 | pub const ESOCKTNOSUPPORT: ::c_int = 94; | ||
186 | pub const EOPNOTSUPP: ::c_int = 95; | ||
187 | pub const EPFNOSUPPORT: ::c_int = 96; | ||
188 | pub const EAFNOSUPPORT: ::c_int = 97; | ||
189 | pub const EADDRINUSE: ::c_int = 98; | ||
190 | pub const EADDRNOTAVAIL: ::c_int = 99; | ||
191 | pub const ENETDOWN: ::c_int = 100; | ||
192 | pub const ENETUNREACH: ::c_int = 101; | ||
193 | pub const ENETRESET: ::c_int = 102; | ||
194 | pub const ECONNABORTED: ::c_int = 103; | ||
195 | pub const ECONNRESET: ::c_int = 104; | ||
196 | pub const ENOBUFS: ::c_int = 105; | ||
197 | pub const EISCONN: ::c_int = 106; | ||
198 | pub const ENOTCONN: ::c_int = 107; | ||
199 | pub const ESHUTDOWN: ::c_int = 108; | ||
200 | pub const ETOOMANYREFS: ::c_int = 109; | ||
201 | pub const ETIMEDOUT: ::c_int = 110; | ||
202 | pub const ECONNREFUSED: ::c_int = 111; | ||
203 | pub const EHOSTDOWN: ::c_int = 112; | ||
204 | pub const EHOSTUNREACH: ::c_int = 113; | ||
205 | pub const EALREADY: ::c_int = 114; | ||
206 | pub const EINPROGRESS: ::c_int = 115; | ||
207 | pub const ESTALE: ::c_int = 116; | ||
208 | pub const EUCLEAN: ::c_int = 117; | ||
209 | pub const ENOTNAM: ::c_int = 118; | ||
210 | pub const ENAVAIL: ::c_int = 119; | ||
211 | pub const EISNAM: ::c_int = 120; | ||
212 | pub const EREMOTEIO: ::c_int = 121; | ||
213 | pub const EDQUOT: ::c_int = 122; | ||
214 | pub const ENOMEDIUM: ::c_int = 123; | ||
215 | pub const EMEDIUMTYPE: ::c_int = 124; | ||
216 | pub const ECANCELED: ::c_int = 125; | ||
217 | pub const ENOKEY: ::c_int = 126; | ||
218 | pub const EKEYEXPIRED: ::c_int = 127; | ||
219 | pub const EKEYREVOKED: ::c_int = 128; | ||
220 | pub const EKEYREJECTED: ::c_int = 129; | ||
221 | pub const EOWNERDEAD: ::c_int = 130; | ||
222 | pub const ENOTRECOVERABLE: ::c_int = 131; | ||
223 | pub const ERFKILL: ::c_int = 132; | ||
224 | pub const EHWPOISON: ::c_int = 133; | ||
225 | |||
226 | pub const SO_REUSEADDR: ::c_int = 2; | ||
227 | pub const SO_TYPE: ::c_int = 3; | ||
228 | pub const SO_ERROR: ::c_int = 4; | ||
229 | pub const SO_DONTROUTE: ::c_int = 5; | ||
230 | pub const SO_BROADCAST: ::c_int = 6; | ||
231 | pub const SO_SNDBUF: ::c_int = 7; | ||
232 | pub const SO_RCVBUF: ::c_int = 8; | ||
233 | pub const SO_KEEPALIVE: ::c_int = 9; | ||
234 | pub const SO_OOBINLINE: ::c_int = 10; | ||
235 | pub const SO_LINGER: ::c_int = 13; | ||
236 | pub const SO_REUSEPORT: ::c_int = 15; | ||
237 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
238 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
239 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
240 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
241 | pub const SO_ACCEPTCONN: ::c_int = 30; | ||
242 | |||
243 | pub const SA_ONSTACK: ::c_int = 0x08000000; | ||
244 | pub const SA_SIGINFO: ::c_int = 0x00000004; | ||
245 | pub const SA_NOCLDWAIT: ::c_int = 0x00000002; | ||
246 | |||
247 | pub const SIGCHLD: ::c_int = 17; | ||
248 | pub const SIGBUS: ::c_int = 7; | ||
249 | pub const SIGTTIN: ::c_int = 21; | ||
250 | pub const SIGTTOU: ::c_int = 22; | ||
251 | pub const SIGXCPU: ::c_int = 24; | ||
252 | pub const SIGXFSZ: ::c_int = 25; | ||
253 | pub const SIGVTALRM: ::c_int = 26; | ||
254 | pub const SIGPROF: ::c_int = 27; | ||
255 | pub const SIGWINCH: ::c_int = 28; | ||
256 | pub const SIGUSR1: ::c_int = 10; | ||
257 | pub const SIGUSR2: ::c_int = 12; | ||
258 | pub const SIGCONT: ::c_int = 18; | ||
259 | pub const SIGSTOP: ::c_int = 19; | ||
260 | pub const SIGTSTP: ::c_int = 20; | ||
261 | pub const SIGURG: ::c_int = 23; | ||
262 | pub const SIGIO: ::c_int = 29; | ||
263 | pub const SIGSYS: ::c_int = 31; | ||
264 | pub const SIGSTKFLT: ::c_int = 16; | ||
265 | pub const SIGPOLL: ::c_int = 29; | ||
266 | pub const SIGPWR: ::c_int = 30; | ||
267 | pub const SIG_SETMASK: ::c_int = 2; | ||
268 | pub const SIG_BLOCK: ::c_int = 0x000000; | ||
269 | pub const SIG_UNBLOCK: ::c_int = 0x01; | ||
270 | |||
271 | pub const EXTPROC: ::tcflag_t = 0x00010000; | ||
272 | |||
273 | pub const MAP_HUGETLB: ::c_int = 0x040000; | ||
274 | pub const MAP_32BIT: ::c_int = 0x0040; | ||
275 | |||
276 | pub const F_GETLK: ::c_int = 12; | ||
277 | pub const F_GETOWN: ::c_int = 9; | ||
278 | pub const F_SETLK: ::c_int = 13; | ||
279 | pub const F_SETLKW: ::c_int = 14; | ||
280 | pub const F_SETOWN: ::c_int = 8; | ||
281 | |||
282 | pub const VEOF: usize = 4; | ||
283 | pub const VEOL: usize = 11; | ||
284 | pub const VEOL2: usize = 16; | ||
285 | pub const VMIN: usize = 6; | ||
286 | pub const IEXTEN: ::tcflag_t = 0x00008000; | ||
287 | pub const TOSTOP: ::tcflag_t = 0x00000100; | ||
288 | pub const FLUSHO: ::tcflag_t = 0x00001000; | ||
289 | |||
290 | pub const TCGETS: ::c_int = 0x5401; | ||
291 | pub const TCSETS: ::c_int = 0x5402; | ||
292 | pub const TCSETSW: ::c_int = 0x5403; | ||
293 | pub const TCSETSF: ::c_int = 0x5404; | ||
294 | pub const TCGETA: ::c_int = 0x5405; | ||
295 | pub const TCSETA: ::c_int = 0x5406; | ||
296 | pub const TCSETAW: ::c_int = 0x5407; | ||
297 | pub const TCSETAF: ::c_int = 0x5408; | ||
298 | pub const TCSBRK: ::c_int = 0x5409; | ||
299 | pub const TCXONC: ::c_int = 0x540A; | ||
300 | pub const TCFLSH: ::c_int = 0x540B; | ||
301 | pub const TIOCGSOFTCAR: ::c_int = 0x5419; | ||
302 | pub const TIOCSSOFTCAR: ::c_int = 0x541A; | ||
303 | pub const TIOCLINUX: ::c_int = 0x541C; | ||
304 | pub const TIOCGSERIAL: ::c_int = 0x541E; | ||
305 | pub const TIOCEXCL: ::c_int = 0x540C; | ||
306 | pub const TIOCNXCL: ::c_int = 0x540D; | ||
307 | pub const TIOCSCTTY: ::c_int = 0x540E; | ||
308 | pub const TIOCGPGRP: ::c_int = 0x540F; | ||
309 | pub const TIOCSPGRP: ::c_int = 0x5410; | ||
310 | pub const TIOCOUTQ: ::c_int = 0x5411; | ||
311 | pub const TIOCSTI: ::c_int = 0x5412; | ||
312 | pub const TIOCGWINSZ: ::c_int = 0x5413; | ||
313 | pub const TIOCSWINSZ: ::c_int = 0x5414; | ||
314 | pub const TIOCMGET: ::c_int = 0x5415; | ||
315 | pub const TIOCMBIS: ::c_int = 0x5416; | ||
316 | pub const TIOCMBIC: ::c_int = 0x5417; | ||
317 | pub const TIOCMSET: ::c_int = 0x5418; | ||
318 | pub const FIONREAD: ::c_int = 0x541B; | ||
319 | pub const TIOCCONS: ::c_int = 0x541D; | ||
320 | |||
321 | pub const SYS_gettid: ::c_long = 224; | ||
322 | pub const SYS_perf_event_open: ::c_long = 336; | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs b/third_party/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs new file mode 100644 index 0000000..51db30f --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs | |||
@@ -0,0 +1 @@ | |||
pub const SYS_perf_event_open: ::c_long = 241; | |||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b64/mod.rs b/third_party/libc/src/unix/notbsd/linux/musl/b64/mod.rs new file mode 100644 index 0000000..0501c55 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b64/mod.rs | |||
@@ -0,0 +1,346 @@ | |||
1 | pub type c_char = i8; | ||
2 | pub type wchar_t = i32; | ||
3 | pub type c_long = i64; | ||
4 | pub type c_ulong = u64; | ||
5 | pub type nlink_t = u64; | ||
6 | |||
7 | s! { | ||
8 | pub struct stat { | ||
9 | pub st_dev: ::dev_t, | ||
10 | pub st_ino: ::ino_t, | ||
11 | pub st_nlink: ::nlink_t, | ||
12 | pub st_mode: ::mode_t, | ||
13 | pub st_uid: ::uid_t, | ||
14 | pub st_gid: ::gid_t, | ||
15 | __pad0: ::c_int, | ||
16 | pub st_rdev: ::dev_t, | ||
17 | pub st_size: ::off_t, | ||
18 | pub st_blksize: ::blksize_t, | ||
19 | pub st_blocks: ::blkcnt_t, | ||
20 | pub st_atime: ::time_t, | ||
21 | pub st_atime_nsec: ::c_long, | ||
22 | pub st_mtime: ::time_t, | ||
23 | pub st_mtime_nsec: ::c_long, | ||
24 | pub st_ctime: ::time_t, | ||
25 | pub st_ctime_nsec: ::c_long, | ||
26 | __unused: [::c_long; 3], | ||
27 | } | ||
28 | |||
29 | pub struct stat64 { | ||
30 | pub st_dev: ::dev_t, | ||
31 | pub st_ino: ::ino64_t, | ||
32 | pub st_nlink: ::nlink_t, | ||
33 | pub st_mode: ::mode_t, | ||
34 | pub st_uid: ::uid_t, | ||
35 | pub st_gid: ::gid_t, | ||
36 | __pad0: ::c_int, | ||
37 | pub st_rdev: ::dev_t, | ||
38 | pub st_size: ::off_t, | ||
39 | pub st_blksize: ::blksize_t, | ||
40 | pub st_blocks: ::blkcnt64_t, | ||
41 | pub st_atime: ::time_t, | ||
42 | pub st_atime_nsec: ::c_long, | ||
43 | pub st_mtime: ::time_t, | ||
44 | pub st_mtime_nsec: ::c_long, | ||
45 | pub st_ctime: ::time_t, | ||
46 | pub st_ctime_nsec: ::c_long, | ||
47 | __reserved: [::c_long; 3], | ||
48 | } | ||
49 | |||
50 | pub struct stack_t { | ||
51 | pub ss_sp: *mut ::c_void, | ||
52 | pub ss_flags: ::c_int, | ||
53 | pub ss_size: ::size_t | ||
54 | } | ||
55 | |||
56 | pub struct pthread_attr_t { | ||
57 | __size: [u64; 7] | ||
58 | } | ||
59 | |||
60 | pub struct sigset_t { | ||
61 | __val: [::c_ulong; 16], | ||
62 | } | ||
63 | |||
64 | pub struct shmid_ds { | ||
65 | pub shm_perm: ::ipc_perm, | ||
66 | pub shm_segsz: ::size_t, | ||
67 | pub shm_atime: ::time_t, | ||
68 | pub shm_dtime: ::time_t, | ||
69 | pub shm_ctime: ::time_t, | ||
70 | pub shm_cpid: ::pid_t, | ||
71 | pub shm_lpid: ::pid_t, | ||
72 | pub shm_nattch: ::c_ulong, | ||
73 | __pad1: ::c_ulong, | ||
74 | __pad2: ::c_ulong, | ||
75 | } | ||
76 | |||
77 | pub struct statfs { | ||
78 | pub f_type: ::c_ulong, | ||
79 | pub f_bsize: ::c_ulong, | ||
80 | pub f_blocks: ::fsblkcnt_t, | ||
81 | pub f_bfree: ::fsblkcnt_t, | ||
82 | pub f_bavail: ::fsblkcnt_t, | ||
83 | pub f_files: ::fsfilcnt_t, | ||
84 | pub f_ffree: ::fsfilcnt_t, | ||
85 | pub f_fsid: ::fsid_t, | ||
86 | pub f_namelen: ::c_ulong, | ||
87 | pub f_frsize: ::c_ulong, | ||
88 | pub f_flags: ::c_ulong, | ||
89 | pub f_spare: [::c_ulong; 4], | ||
90 | } | ||
91 | |||
92 | pub struct msghdr { | ||
93 | pub msg_name: *mut ::c_void, | ||
94 | pub msg_namelen: ::socklen_t, | ||
95 | pub msg_iov: *mut ::iovec, | ||
96 | pub msg_iovlen: ::c_int, | ||
97 | __pad1: ::c_int, | ||
98 | pub msg_control: *mut ::c_void, | ||
99 | pub msg_controllen: ::socklen_t, | ||
100 | __pad2: ::socklen_t, | ||
101 | pub msg_flags: ::c_int, | ||
102 | } | ||
103 | |||
104 | pub struct sem_t { | ||
105 | __val: [::c_int; 8], | ||
106 | } | ||
107 | } | ||
108 | |||
109 | pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; | ||
110 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; | ||
111 | |||
112 | pub const O_DIRECT: ::c_int = 0x4000; | ||
113 | pub const O_DIRECTORY: ::c_int = 0x10000; | ||
114 | pub const O_NOFOLLOW: ::c_int = 0x20000; | ||
115 | pub const O_ASYNC: ::c_int = 0x2000; | ||
116 | |||
117 | pub const FIOCLEX: ::c_int = 0x5451; | ||
118 | pub const FIONBIO: ::c_int = 0x5421; | ||
119 | |||
120 | pub const RLIMIT_RSS: ::c_int = 5; | ||
121 | pub const RLIMIT_NOFILE: ::c_int = 7; | ||
122 | pub const RLIMIT_AS: ::c_int = 9; | ||
123 | pub const RLIMIT_NPROC: ::c_int = 6; | ||
124 | pub const RLIMIT_MEMLOCK: ::c_int = 8; | ||
125 | |||
126 | pub const O_APPEND: ::c_int = 1024; | ||
127 | pub const O_CREAT: ::c_int = 64; | ||
128 | pub const O_EXCL: ::c_int = 128; | ||
129 | pub const O_NOCTTY: ::c_int = 256; | ||
130 | pub const O_NONBLOCK: ::c_int = 2048; | ||
131 | pub const O_SYNC: ::c_int = 1052672; | ||
132 | pub const O_RSYNC: ::c_int = 1052672; | ||
133 | pub const O_DSYNC: ::c_int = 4096; | ||
134 | |||
135 | pub const SOCK_NONBLOCK: ::c_int = 2048; | ||
136 | |||
137 | pub const MAP_ANON: ::c_int = 0x0020; | ||
138 | pub const MAP_GROWSDOWN: ::c_int = 0x0100; | ||
139 | pub const MAP_DENYWRITE: ::c_int = 0x0800; | ||
140 | pub const MAP_EXECUTABLE: ::c_int = 0x01000; | ||
141 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
142 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
143 | pub const MAP_POPULATE: ::c_int = 0x08000; | ||
144 | pub const MAP_NONBLOCK: ::c_int = 0x010000; | ||
145 | pub const MAP_STACK: ::c_int = 0x020000; | ||
146 | pub const MAP_32BIT: ::c_int = 0x0040; | ||
147 | |||
148 | pub const SOCK_STREAM: ::c_int = 1; | ||
149 | pub const SOCK_DGRAM: ::c_int = 2; | ||
150 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
151 | |||
152 | pub const SOL_SOCKET: ::c_int = 1; | ||
153 | |||
154 | pub const EDEADLK: ::c_int = 35; | ||
155 | pub const ENAMETOOLONG: ::c_int = 36; | ||
156 | pub const ENOLCK: ::c_int = 37; | ||
157 | pub const ENOSYS: ::c_int = 38; | ||
158 | pub const ENOTEMPTY: ::c_int = 39; | ||
159 | pub const ELOOP: ::c_int = 40; | ||
160 | pub const ENOMSG: ::c_int = 42; | ||
161 | pub const EIDRM: ::c_int = 43; | ||
162 | pub const ECHRNG: ::c_int = 44; | ||
163 | pub const EL2NSYNC: ::c_int = 45; | ||
164 | pub const EL3HLT: ::c_int = 46; | ||
165 | pub const EL3RST: ::c_int = 47; | ||
166 | pub const ELNRNG: ::c_int = 48; | ||
167 | pub const EUNATCH: ::c_int = 49; | ||
168 | pub const ENOCSI: ::c_int = 50; | ||
169 | pub const EL2HLT: ::c_int = 51; | ||
170 | pub const EBADE: ::c_int = 52; | ||
171 | pub const EBADR: ::c_int = 53; | ||
172 | pub const EXFULL: ::c_int = 54; | ||
173 | pub const ENOANO: ::c_int = 55; | ||
174 | pub const EBADRQC: ::c_int = 56; | ||
175 | pub const EBADSLT: ::c_int = 57; | ||
176 | pub const EDEADLOCK: ::c_int = EDEADLK; | ||
177 | pub const EMULTIHOP: ::c_int = 72; | ||
178 | pub const EBADMSG: ::c_int = 74; | ||
179 | pub const EOVERFLOW: ::c_int = 75; | ||
180 | pub const ENOTUNIQ: ::c_int = 76; | ||
181 | pub const EBADFD: ::c_int = 77; | ||
182 | pub const EREMCHG: ::c_int = 78; | ||
183 | pub const ELIBACC: ::c_int = 79; | ||
184 | pub const ELIBBAD: ::c_int = 80; | ||
185 | pub const ELIBSCN: ::c_int = 81; | ||
186 | pub const ELIBMAX: ::c_int = 82; | ||
187 | pub const ELIBEXEC: ::c_int = 83; | ||
188 | pub const EILSEQ: ::c_int = 84; | ||
189 | pub const ERESTART: ::c_int = 85; | ||
190 | pub const ESTRPIPE: ::c_int = 86; | ||
191 | pub const EUSERS: ::c_int = 87; | ||
192 | pub const ENOTSOCK: ::c_int = 88; | ||
193 | pub const EDESTADDRREQ: ::c_int = 89; | ||
194 | pub const EMSGSIZE: ::c_int = 90; | ||
195 | pub const EPROTOTYPE: ::c_int = 91; | ||
196 | pub const ENOPROTOOPT: ::c_int = 92; | ||
197 | pub const EPROTONOSUPPORT: ::c_int = 93; | ||
198 | pub const ESOCKTNOSUPPORT: ::c_int = 94; | ||
199 | pub const EOPNOTSUPP: ::c_int = 95; | ||
200 | pub const EPFNOSUPPORT: ::c_int = 96; | ||
201 | pub const EAFNOSUPPORT: ::c_int = 97; | ||
202 | pub const EADDRINUSE: ::c_int = 98; | ||
203 | pub const EADDRNOTAVAIL: ::c_int = 99; | ||
204 | pub const ENETDOWN: ::c_int = 100; | ||
205 | pub const ENETUNREACH: ::c_int = 101; | ||
206 | pub const ENETRESET: ::c_int = 102; | ||
207 | pub const ECONNABORTED: ::c_int = 103; | ||
208 | pub const ECONNRESET: ::c_int = 104; | ||
209 | pub const ENOBUFS: ::c_int = 105; | ||
210 | pub const EISCONN: ::c_int = 106; | ||
211 | pub const ENOTCONN: ::c_int = 107; | ||
212 | pub const ESHUTDOWN: ::c_int = 108; | ||
213 | pub const ETOOMANYREFS: ::c_int = 109; | ||
214 | pub const ETIMEDOUT: ::c_int = 110; | ||
215 | pub const ECONNREFUSED: ::c_int = 111; | ||
216 | pub const EHOSTDOWN: ::c_int = 112; | ||
217 | pub const EHOSTUNREACH: ::c_int = 113; | ||
218 | pub const EALREADY: ::c_int = 114; | ||
219 | pub const EINPROGRESS: ::c_int = 115; | ||
220 | pub const ESTALE: ::c_int = 116; | ||
221 | pub const EUCLEAN: ::c_int = 117; | ||
222 | pub const ENOTNAM: ::c_int = 118; | ||
223 | pub const ENAVAIL: ::c_int = 119; | ||
224 | pub const EISNAM: ::c_int = 120; | ||
225 | pub const EREMOTEIO: ::c_int = 121; | ||
226 | pub const EDQUOT: ::c_int = 122; | ||
227 | pub const ENOMEDIUM: ::c_int = 123; | ||
228 | pub const EMEDIUMTYPE: ::c_int = 124; | ||
229 | pub const ECANCELED: ::c_int = 125; | ||
230 | pub const ENOKEY: ::c_int = 126; | ||
231 | pub const EKEYEXPIRED: ::c_int = 127; | ||
232 | pub const EKEYREVOKED: ::c_int = 128; | ||
233 | pub const EKEYREJECTED: ::c_int = 129; | ||
234 | pub const EOWNERDEAD: ::c_int = 130; | ||
235 | pub const ENOTRECOVERABLE: ::c_int = 131; | ||
236 | pub const ERFKILL: ::c_int = 132; | ||
237 | pub const EHWPOISON: ::c_int = 133; | ||
238 | |||
239 | pub const SO_REUSEADDR: ::c_int = 2; | ||
240 | pub const SO_TYPE: ::c_int = 3; | ||
241 | pub const SO_ERROR: ::c_int = 4; | ||
242 | pub const SO_DONTROUTE: ::c_int = 5; | ||
243 | pub const SO_BROADCAST: ::c_int = 6; | ||
244 | pub const SO_SNDBUF: ::c_int = 7; | ||
245 | pub const SO_RCVBUF: ::c_int = 8; | ||
246 | pub const SO_KEEPALIVE: ::c_int = 9; | ||
247 | pub const SO_OOBINLINE: ::c_int = 10; | ||
248 | pub const SO_LINGER: ::c_int = 13; | ||
249 | pub const SO_REUSEPORT: ::c_int = 15; | ||
250 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
251 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
252 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
253 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
254 | pub const SO_ACCEPTCONN: ::c_int = 30; | ||
255 | |||
256 | pub const SA_ONSTACK: ::c_int = 0x08000000; | ||
257 | pub const SA_SIGINFO: ::c_int = 0x00000004; | ||
258 | pub const SA_NOCLDWAIT: ::c_int = 0x00000002; | ||
259 | |||
260 | pub const SIGCHLD: ::c_int = 17; | ||
261 | pub const SIGBUS: ::c_int = 7; | ||
262 | pub const SIGTTIN: ::c_int = 21; | ||
263 | pub const SIGTTOU: ::c_int = 22; | ||
264 | pub const SIGXCPU: ::c_int = 24; | ||
265 | pub const SIGXFSZ: ::c_int = 25; | ||
266 | pub const SIGVTALRM: ::c_int = 26; | ||
267 | pub const SIGPROF: ::c_int = 27; | ||
268 | pub const SIGWINCH: ::c_int = 28; | ||
269 | pub const SIGUSR1: ::c_int = 10; | ||
270 | pub const SIGUSR2: ::c_int = 12; | ||
271 | pub const SIGCONT: ::c_int = 18; | ||
272 | pub const SIGSTOP: ::c_int = 19; | ||
273 | pub const SIGTSTP: ::c_int = 20; | ||
274 | pub const SIGURG: ::c_int = 23; | ||
275 | pub const SIGIO: ::c_int = 29; | ||
276 | pub const SIGSYS: ::c_int = 31; | ||
277 | pub const SIGSTKFLT: ::c_int = 16; | ||
278 | pub const SIGPOLL: ::c_int = 29; | ||
279 | pub const SIGPWR: ::c_int = 30; | ||
280 | pub const SIG_SETMASK: ::c_int = 2; | ||
281 | pub const SIG_BLOCK: ::c_int = 0x000000; | ||
282 | pub const SIG_UNBLOCK: ::c_int = 0x01; | ||
283 | |||
284 | pub const EXTPROC: ::tcflag_t = 0x00010000; | ||
285 | |||
286 | pub const MAP_HUGETLB: ::c_int = 0x040000; | ||
287 | |||
288 | pub const F_GETLK: ::c_int = 5; | ||
289 | pub const F_GETOWN: ::c_int = 9; | ||
290 | pub const F_SETLK: ::c_int = 6; | ||
291 | pub const F_SETLKW: ::c_int = 7; | ||
292 | pub const F_SETOWN: ::c_int = 8; | ||
293 | |||
294 | pub const VEOF: usize = 4; | ||
295 | pub const VEOL: usize = 11; | ||
296 | pub const VEOL2: usize = 16; | ||
297 | pub const VMIN: usize = 6; | ||
298 | pub const IEXTEN: ::tcflag_t = 0x00008000; | ||
299 | pub const TOSTOP: ::tcflag_t = 0x00000100; | ||
300 | pub const FLUSHO: ::tcflag_t = 0x00001000; | ||
301 | |||
302 | pub const TCGETS: ::c_int = 0x5401; | ||
303 | pub const TCSETS: ::c_int = 0x5402; | ||
304 | pub const TCSETSW: ::c_int = 0x5403; | ||
305 | pub const TCSETSF: ::c_int = 0x5404; | ||
306 | pub const TCGETA: ::c_int = 0x5405; | ||
307 | pub const TCSETA: ::c_int = 0x5406; | ||
308 | pub const TCSETAW: ::c_int = 0x5407; | ||
309 | pub const TCSETAF: ::c_int = 0x5408; | ||
310 | pub const TCSBRK: ::c_int = 0x5409; | ||
311 | pub const TCXONC: ::c_int = 0x540A; | ||
312 | pub const TCFLSH: ::c_int = 0x540B; | ||
313 | pub const TIOCGSOFTCAR: ::c_int = 0x5419; | ||
314 | pub const TIOCSSOFTCAR: ::c_int = 0x541A; | ||
315 | pub const TIOCLINUX: ::c_int = 0x541C; | ||
316 | pub const TIOCGSERIAL: ::c_int = 0x541E; | ||
317 | pub const TIOCEXCL: ::c_int = 0x540C; | ||
318 | pub const TIOCNXCL: ::c_int = 0x540D; | ||
319 | pub const TIOCSCTTY: ::c_int = 0x540E; | ||
320 | pub const TIOCGPGRP: ::c_int = 0x540F; | ||
321 | pub const TIOCSPGRP: ::c_int = 0x5410; | ||
322 | pub const TIOCOUTQ: ::c_int = 0x5411; | ||
323 | pub const TIOCSTI: ::c_int = 0x5412; | ||
324 | pub const TIOCGWINSZ: ::c_int = 0x5413; | ||
325 | pub const TIOCSWINSZ: ::c_int = 0x5414; | ||
326 | pub const TIOCMGET: ::c_int = 0x5415; | ||
327 | pub const TIOCMBIS: ::c_int = 0x5416; | ||
328 | pub const TIOCMBIC: ::c_int = 0x5417; | ||
329 | pub const TIOCMSET: ::c_int = 0x5418; | ||
330 | pub const FIONREAD: ::c_int = 0x541B; | ||
331 | pub const TIOCCONS: ::c_int = 0x541D; | ||
332 | |||
333 | cfg_if! { | ||
334 | if #[cfg(target_arch = "aarch64")] { | ||
335 | mod aarch64; | ||
336 | pub use self::aarch64::*; | ||
337 | } else if #[cfg(any(target_arch = "powerpc64"))] { | ||
338 | mod powerpc64; | ||
339 | pub use self::powerpc64::*; | ||
340 | } else if #[cfg(any(target_arch = "x86_64"))] { | ||
341 | mod x86_64; | ||
342 | pub use self::x86_64::*; | ||
343 | } else { | ||
344 | // Unknown target_arch | ||
345 | } | ||
346 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs b/third_party/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs new file mode 100644 index 0000000..bb81863 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs | |||
@@ -0,0 +1 @@ | |||
pub const SYS_perf_event_open: ::c_long = 319; | |||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs b/third_party/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs new file mode 100644 index 0000000..02324da --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs | |||
@@ -0,0 +1,18 @@ | |||
1 | s! { | ||
2 | pub struct mcontext_t { | ||
3 | __private: [u64; 32], | ||
4 | } | ||
5 | |||
6 | pub struct ucontext_t { | ||
7 | pub uc_flags: ::c_ulong, | ||
8 | pub uc_link: *mut ucontext_t, | ||
9 | pub uc_stack: ::stack_t, | ||
10 | pub uc_mcontext: mcontext_t, | ||
11 | pub uc_sigmask: ::sigset_t, | ||
12 | __private: [u8; 512], | ||
13 | } | ||
14 | } | ||
15 | |||
16 | pub const SYS_gettid: ::c_long = 186; | ||
17 | |||
18 | pub const SYS_perf_event_open: ::c_long = 298; | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/musl/mod.rs b/third_party/libc/src/unix/notbsd/linux/musl/mod.rs new file mode 100644 index 0000000..7a0d4c4 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/musl/mod.rs | |||
@@ -0,0 +1,207 @@ | |||
1 | pub type clock_t = c_long; | ||
2 | pub type time_t = c_long; | ||
3 | pub type suseconds_t = c_long; | ||
4 | pub type ino_t = u64; | ||
5 | pub type off_t = i64; | ||
6 | pub type blkcnt_t = i64; | ||
7 | |||
8 | pub type blksize_t = c_long; | ||
9 | pub type fsblkcnt_t = ::c_ulonglong; | ||
10 | pub type fsfilcnt_t = ::c_ulonglong; | ||
11 | pub type rlim_t = ::c_ulonglong; | ||
12 | |||
13 | s! { | ||
14 | pub struct sigaction { | ||
15 | pub sa_sigaction: ::sighandler_t, | ||
16 | pub sa_mask: ::sigset_t, | ||
17 | pub sa_flags: ::c_int, | ||
18 | _restorer: *mut ::c_void, | ||
19 | } | ||
20 | |||
21 | pub struct siginfo_t { | ||
22 | pub si_signo: ::c_int, | ||
23 | pub si_errno: ::c_int, | ||
24 | pub si_code: ::c_int, | ||
25 | pub _pad: [::c_int; 29], | ||
26 | _align: [usize; 0], | ||
27 | } | ||
28 | |||
29 | pub struct ipc_perm { | ||
30 | pub __ipc_perm_key: ::key_t, | ||
31 | pub uid: ::uid_t, | ||
32 | pub gid: ::gid_t, | ||
33 | pub cuid: ::uid_t, | ||
34 | pub cgid: ::gid_t, | ||
35 | pub mode: ::mode_t, | ||
36 | pub __seq: ::c_int, | ||
37 | __unused1: ::c_long, | ||
38 | __unused2: ::c_long | ||
39 | } | ||
40 | |||
41 | pub struct termios { | ||
42 | pub c_iflag: ::tcflag_t, | ||
43 | pub c_oflag: ::tcflag_t, | ||
44 | pub c_cflag: ::tcflag_t, | ||
45 | pub c_lflag: ::tcflag_t, | ||
46 | pub c_line: ::cc_t, | ||
47 | pub c_cc: [::cc_t; ::NCCS], | ||
48 | pub __c_ispeed: ::speed_t, | ||
49 | pub __c_ospeed: ::speed_t, | ||
50 | } | ||
51 | |||
52 | pub struct flock { | ||
53 | pub l_type: ::c_short, | ||
54 | pub l_whence: ::c_short, | ||
55 | pub l_start: ::off_t, | ||
56 | pub l_len: ::off_t, | ||
57 | pub l_pid: ::pid_t, | ||
58 | } | ||
59 | |||
60 | pub struct sysinfo { | ||
61 | pub uptime: ::c_ulong, | ||
62 | pub loads: [::c_ulong; 3], | ||
63 | pub totalram: ::c_ulong, | ||
64 | pub freeram: ::c_ulong, | ||
65 | pub sharedram: ::c_ulong, | ||
66 | pub bufferram: ::c_ulong, | ||
67 | pub totalswap: ::c_ulong, | ||
68 | pub freeswap: ::c_ulong, | ||
69 | pub procs: ::c_ushort, | ||
70 | pub pad: ::c_ushort, | ||
71 | pub totalhigh: ::c_ulong, | ||
72 | pub freehigh: ::c_ulong, | ||
73 | pub mem_unit: ::c_uint, | ||
74 | pub __reserved: [::c_char; 256], | ||
75 | } | ||
76 | } | ||
77 | |||
78 | pub const BUFSIZ: ::c_uint = 1024; | ||
79 | pub const TMP_MAX: ::c_uint = 10000; | ||
80 | pub const FOPEN_MAX: ::c_uint = 1000; | ||
81 | pub const POSIX_MADV_DONTNEED: ::c_int = 0; | ||
82 | pub const O_ACCMODE: ::c_int = 0o10000003; | ||
83 | pub const O_NDELAY: ::c_int = O_NONBLOCK; | ||
84 | pub const RUSAGE_CHILDREN: ::c_int = 1; | ||
85 | pub const NI_MAXHOST: ::socklen_t = 255; | ||
86 | pub const PTHREAD_STACK_MIN: ::size_t = 2048; | ||
87 | |||
88 | pub const RLIM_INFINITY: ::rlim_t = !0; | ||
89 | pub const RLIMIT_RTTIME: ::c_int = 15; | ||
90 | pub const RLIMIT_NLIMITS: ::c_int = 16; | ||
91 | |||
92 | pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; | ||
93 | |||
94 | pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; | ||
95 | pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; | ||
96 | pub const TCP_THIN_DUPACK: ::c_int = 17; | ||
97 | pub const TCP_USER_TIMEOUT: ::c_int = 18; | ||
98 | pub const TCP_REPAIR: ::c_int = 19; | ||
99 | pub const TCP_REPAIR_QUEUE: ::c_int = 20; | ||
100 | pub const TCP_QUEUE_SEQ: ::c_int = 21; | ||
101 | pub const TCP_REPAIR_OPTIONS: ::c_int = 22; | ||
102 | pub const TCP_FASTOPEN: ::c_int = 23; | ||
103 | pub const TCP_TIMESTAMP: ::c_int = 24; | ||
104 | |||
105 | pub const SIGUNUSED: ::c_int = ::SIGSYS; | ||
106 | |||
107 | pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; | ||
108 | pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; | ||
109 | |||
110 | pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; | ||
111 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; | ||
112 | |||
113 | pub const CPU_SETSIZE: ::c_int = 128; | ||
114 | |||
115 | pub const QFMT_VFS_V1: ::c_int = 4; | ||
116 | |||
117 | pub const PTRACE_TRACEME: ::c_int = 0; | ||
118 | pub const PTRACE_PEEKTEXT: ::c_int = 1; | ||
119 | pub const PTRACE_PEEKDATA: ::c_int = 2; | ||
120 | pub const PTRACE_PEEKUSER: ::c_int = 3; | ||
121 | pub const PTRACE_POKETEXT: ::c_int = 4; | ||
122 | pub const PTRACE_POKEDATA: ::c_int = 5; | ||
123 | pub const PTRACE_POKEUSER: ::c_int = 6; | ||
124 | pub const PTRACE_CONT: ::c_int = 7; | ||
125 | pub const PTRACE_KILL: ::c_int = 8; | ||
126 | pub const PTRACE_SINGLESTEP: ::c_int = 9; | ||
127 | pub const PTRACE_ATTACH: ::c_int = 16; | ||
128 | pub const PTRACE_DETACH: ::c_int = 17; | ||
129 | pub const PTRACE_SYSCALL: ::c_int = 24; | ||
130 | pub const PTRACE_SETOPTIONS: ::c_int = 0x4200; | ||
131 | pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201; | ||
132 | pub const PTRACE_GETSIGINFO: ::c_int = 0x4202; | ||
133 | pub const PTRACE_SETSIGINFO: ::c_int = 0x4203; | ||
134 | pub const PTRACE_GETREGSET: ::c_int = 0x4204; | ||
135 | pub const PTRACE_SETREGSET: ::c_int = 0x4205; | ||
136 | pub const PTRACE_SEIZE: ::c_int = 0x4206; | ||
137 | pub const PTRACE_INTERRUPT: ::c_int = 0x4207; | ||
138 | pub const PTRACE_LISTEN: ::c_int = 0x4208; | ||
139 | pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; | ||
140 | |||
141 | pub const PTRACE_O_EXITKILL: ::c_int = 1048576; | ||
142 | pub const PTRACE_O_TRACECLONE: ::c_int = 8; | ||
143 | pub const PTRACE_O_TRACEEXEC: ::c_int = 16; | ||
144 | pub const PTRACE_O_TRACEEXIT: ::c_int = 64; | ||
145 | pub const PTRACE_O_TRACEFORK: ::c_int = 2; | ||
146 | pub const PTRACE_O_TRACESYSGOOD: ::c_int = 1; | ||
147 | pub const PTRACE_O_TRACEVFORK: ::c_int = 4; | ||
148 | pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 32; | ||
149 | pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 2097152; | ||
150 | |||
151 | pub const MADV_DODUMP: ::c_int = 17; | ||
152 | pub const MADV_DONTDUMP: ::c_int = 16; | ||
153 | |||
154 | pub const EPOLLWAKEUP: ::c_int = 0x20000000; | ||
155 | |||
156 | pub const POLLRDNORM: ::c_short = 0x040; | ||
157 | pub const POLLWRNORM: ::c_short = 0x100; | ||
158 | pub const POLLRDBAND: ::c_short = 0x080; | ||
159 | pub const POLLWRBAND: ::c_short = 0x200; | ||
160 | |||
161 | pub const MADV_HUGEPAGE: ::c_int = 14; | ||
162 | pub const MADV_NOHUGEPAGE: ::c_int = 15; | ||
163 | |||
164 | pub const PTRACE_GETFPREGS: ::c_uint = 14; | ||
165 | pub const PTRACE_SETFPREGS: ::c_uint = 15; | ||
166 | pub const PTRACE_GETFPXREGS: ::c_uint = 18; | ||
167 | pub const PTRACE_SETFPXREGS: ::c_uint = 19; | ||
168 | pub const PTRACE_GETREGS: ::c_uint = 12; | ||
169 | pub const PTRACE_SETREGS: ::c_uint = 13; | ||
170 | |||
171 | pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK; | ||
172 | |||
173 | pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK; | ||
174 | |||
175 | pub const TCSANOW: ::c_int = 0; | ||
176 | pub const TCSADRAIN: ::c_int = 1; | ||
177 | pub const TCSAFLUSH: ::c_int = 2; | ||
178 | |||
179 | pub const TIOCINQ: ::c_int = ::FIONREAD; | ||
180 | |||
181 | pub const RTLD_GLOBAL: ::c_int = 0x100; | ||
182 | pub const RTLD_NOLOAD: ::c_int = 0x4; | ||
183 | |||
184 | // TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux | ||
185 | // kernel 3.10). See also notbsd/mod.rs | ||
186 | pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; | ||
187 | pub const CLOCK_TAI: ::clockid_t = 11; | ||
188 | |||
189 | extern { | ||
190 | pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; | ||
191 | pub fn ptrace(request: ::c_int, ...) -> ::c_long; | ||
192 | pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; | ||
193 | pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; | ||
194 | } | ||
195 | |||
196 | cfg_if! { | ||
197 | if #[cfg(any(target_arch = "x86_64"))] { | ||
198 | mod b64; | ||
199 | pub use self::b64::*; | ||
200 | } else if #[cfg(any(target_arch = "x86", | ||
201 | target_arch = "mips", | ||
202 | target_arch = "arm", | ||
203 | target_arch = "asmjs"))] { | ||
204 | mod b32; | ||
205 | pub use self::b32::*; | ||
206 | } else { } | ||
207 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/b32/arm.rs b/third_party/libc/src/unix/notbsd/linux/other/b32/arm.rs new file mode 100644 index 0000000..7de4b8b --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/b32/arm.rs | |||
@@ -0,0 +1,23 @@ | |||
1 | pub type c_char = u8; | ||
2 | pub type wchar_t = u32; | ||
3 | |||
4 | pub const O_DIRECT: ::c_int = 0x10000; | ||
5 | pub const O_DIRECTORY: ::c_int = 0x4000; | ||
6 | pub const O_NOFOLLOW: ::c_int = 0x8000; | ||
7 | |||
8 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
9 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
10 | |||
11 | pub const EDEADLOCK: ::c_int = 35; | ||
12 | |||
13 | pub const SO_PEERCRED: ::c_int = 17; | ||
14 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
15 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
16 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
17 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
18 | |||
19 | pub const FIOCLEX: ::c_ulong = 0x5451; | ||
20 | pub const FIONBIO: ::c_ulong = 0x5421; | ||
21 | |||
22 | pub const SYS_gettid: ::c_long = 224; | ||
23 | pub const SYS_perf_event_open: ::c_long = 364; | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/b32/mod.rs b/third_party/libc/src/unix/notbsd/linux/other/b32/mod.rs new file mode 100644 index 0000000..ba48d63 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/b32/mod.rs | |||
@@ -0,0 +1,113 @@ | |||
1 | //! 32-bit specific definitions for linux-like values | ||
2 | |||
3 | pub type c_long = i32; | ||
4 | pub type c_ulong = u32; | ||
5 | pub type clock_t = i32; | ||
6 | pub type time_t = i32; | ||
7 | pub type suseconds_t = i32; | ||
8 | pub type ino_t = u32; | ||
9 | pub type off_t = i32; | ||
10 | pub type blkcnt_t = i32; | ||
11 | pub type __fsword_t = i32; | ||
12 | |||
13 | pub type blksize_t = i32; | ||
14 | pub type nlink_t = u32; | ||
15 | |||
16 | s! { | ||
17 | pub struct stat { | ||
18 | pub st_dev: ::dev_t, | ||
19 | __pad1: ::c_short, | ||
20 | pub st_ino: ::ino_t, | ||
21 | pub st_mode: ::mode_t, | ||
22 | pub st_nlink: ::nlink_t, | ||
23 | pub st_uid: ::uid_t, | ||
24 | pub st_gid: ::gid_t, | ||
25 | pub st_rdev: ::dev_t, | ||
26 | __pad2: ::c_short, | ||
27 | pub st_size: ::off_t, | ||
28 | pub st_blksize: ::blksize_t, | ||
29 | pub st_blocks: ::blkcnt_t, | ||
30 | pub st_atime: ::time_t, | ||
31 | pub st_atime_nsec: ::c_long, | ||
32 | pub st_mtime: ::time_t, | ||
33 | pub st_mtime_nsec: ::c_long, | ||
34 | pub st_ctime: ::time_t, | ||
35 | pub st_ctime_nsec: ::c_long, | ||
36 | __unused4: ::c_long, | ||
37 | __unused5: ::c_long, | ||
38 | } | ||
39 | |||
40 | pub struct stat64 { | ||
41 | pub st_dev: ::dev_t, | ||
42 | __pad1: ::c_uint, | ||
43 | __st_ino: ::ino_t, | ||
44 | pub st_mode: ::mode_t, | ||
45 | pub st_nlink: ::nlink_t, | ||
46 | pub st_uid: ::uid_t, | ||
47 | pub st_gid: ::gid_t, | ||
48 | pub st_rdev: ::dev_t, | ||
49 | __pad2: ::c_uint, | ||
50 | pub st_size: ::off64_t, | ||
51 | pub st_blksize: ::blksize_t, | ||
52 | pub st_blocks: ::blkcnt64_t, | ||
53 | pub st_atime: ::time_t, | ||
54 | pub st_atime_nsec: ::c_long, | ||
55 | pub st_mtime: ::time_t, | ||
56 | pub st_mtime_nsec: ::c_long, | ||
57 | pub st_ctime: ::time_t, | ||
58 | pub st_ctime_nsec: ::c_long, | ||
59 | pub st_ino: ::ino64_t, | ||
60 | } | ||
61 | |||
62 | pub struct pthread_attr_t { | ||
63 | __size: [u32; 9] | ||
64 | } | ||
65 | |||
66 | pub struct sigset_t { | ||
67 | __val: [::c_ulong; 32], | ||
68 | } | ||
69 | |||
70 | pub struct sysinfo { | ||
71 | pub uptime: ::c_long, | ||
72 | pub loads: [::c_ulong; 3], | ||
73 | pub totalram: ::c_ulong, | ||
74 | pub freeram: ::c_ulong, | ||
75 | pub sharedram: ::c_ulong, | ||
76 | pub bufferram: ::c_ulong, | ||
77 | pub totalswap: ::c_ulong, | ||
78 | pub freeswap: ::c_ulong, | ||
79 | pub procs: ::c_ushort, | ||
80 | pub pad: ::c_ushort, | ||
81 | pub totalhigh: ::c_ulong, | ||
82 | pub freehigh: ::c_ulong, | ||
83 | pub mem_unit: ::c_uint, | ||
84 | pub _f: [::c_char; 8], | ||
85 | } | ||
86 | } | ||
87 | |||
88 | pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; | ||
89 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; | ||
90 | pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; | ||
91 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; | ||
92 | |||
93 | pub const PTRACE_GETFPREGS: ::c_uint = 14; | ||
94 | pub const PTRACE_SETFPREGS: ::c_uint = 15; | ||
95 | pub const PTRACE_GETFPXREGS: ::c_uint = 18; | ||
96 | pub const PTRACE_SETFPXREGS: ::c_uint = 19; | ||
97 | pub const PTRACE_GETREGS: ::c_uint = 12; | ||
98 | pub const PTRACE_SETREGS: ::c_uint = 13; | ||
99 | |||
100 | cfg_if! { | ||
101 | if #[cfg(target_arch = "x86")] { | ||
102 | mod x86; | ||
103 | pub use self::x86::*; | ||
104 | } else if #[cfg(target_arch = "arm")] { | ||
105 | mod arm; | ||
106 | pub use self::arm::*; | ||
107 | } else if #[cfg(target_arch = "powerpc")] { | ||
108 | mod powerpc; | ||
109 | pub use self::powerpc::*; | ||
110 | } else { | ||
111 | // Unknown target_arch | ||
112 | } | ||
113 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/b32/powerpc.rs b/third_party/libc/src/unix/notbsd/linux/other/b32/powerpc.rs new file mode 100644 index 0000000..2334c1f --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/b32/powerpc.rs | |||
@@ -0,0 +1,23 @@ | |||
1 | pub type c_char = u8; | ||
2 | pub type wchar_t = i32; | ||
3 | |||
4 | pub const O_DIRECT: ::c_int = 0x20000; | ||
5 | pub const O_DIRECTORY: ::c_int = 0x4000; | ||
6 | pub const O_NOFOLLOW: ::c_int = 0x8000; | ||
7 | |||
8 | pub const MAP_LOCKED: ::c_int = 0x00080; | ||
9 | pub const MAP_NORESERVE: ::c_int = 0x00040; | ||
10 | |||
11 | pub const EDEADLOCK: ::c_int = 58; | ||
12 | |||
13 | pub const SO_PEERCRED: ::c_int = 21; | ||
14 | pub const SO_RCVLOWAT: ::c_int = 16; | ||
15 | pub const SO_SNDLOWAT: ::c_int = 17; | ||
16 | pub const SO_RCVTIMEO: ::c_int = 18; | ||
17 | pub const SO_SNDTIMEO: ::c_int = 19; | ||
18 | |||
19 | pub const FIOCLEX: ::c_ulong = 0x20006601; | ||
20 | pub const FIONBIO: ::c_ulong = 0x8004667e; | ||
21 | |||
22 | pub const SYS_gettid: ::c_long = 207; | ||
23 | pub const SYS_perf_event_open: ::c_long = 319; | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/b32/x86.rs b/third_party/libc/src/unix/notbsd/linux/other/b32/x86.rs new file mode 100644 index 0000000..e6d78de --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/b32/x86.rs | |||
@@ -0,0 +1,70 @@ | |||
1 | pub type c_char = i8; | ||
2 | pub type wchar_t = i32; | ||
3 | pub type greg_t = i32; | ||
4 | |||
5 | s! { | ||
6 | pub struct _libc_fpreg { | ||
7 | pub significand: [u16; 4], | ||
8 | pub exponent: u16, | ||
9 | } | ||
10 | |||
11 | pub struct _libc_fpstate { | ||
12 | pub cw: ::c_ulong, | ||
13 | pub sw: ::c_ulong, | ||
14 | pub tag: ::c_ulong, | ||
15 | pub ipoff: ::c_ulong, | ||
16 | pub cssel: ::c_ulong, | ||
17 | pub dataoff: ::c_ulong, | ||
18 | pub datasel: ::c_ulong, | ||
19 | pub _st: [_libc_fpreg; 8], | ||
20 | pub status: ::c_ulong, | ||
21 | } | ||
22 | |||
23 | pub struct mcontext_t { | ||
24 | pub gregs: [greg_t; 19], | ||
25 | pub fpregs: *mut _libc_fpstate, | ||
26 | pub oldmask: ::c_ulong, | ||
27 | pub cr2: ::c_ulong, | ||
28 | } | ||
29 | |||
30 | pub struct ucontext_t { | ||
31 | pub uc_flags: ::c_ulong, | ||
32 | pub uc_link: *mut ucontext_t, | ||
33 | pub uc_stack: ::stack_t, | ||
34 | pub uc_mcontext: mcontext_t, | ||
35 | pub uc_sigmask: ::sigset_t, | ||
36 | __private: [u8; 112], | ||
37 | } | ||
38 | } | ||
39 | |||
40 | pub const O_DIRECT: ::c_int = 0x4000; | ||
41 | pub const O_DIRECTORY: ::c_int = 0x10000; | ||
42 | pub const O_NOFOLLOW: ::c_int = 0x20000; | ||
43 | |||
44 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
45 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
46 | pub const MAP_32BIT: ::c_int = 0x0040; | ||
47 | |||
48 | pub const EDEADLOCK: ::c_int = 35; | ||
49 | |||
50 | pub const SO_PEERCRED: ::c_int = 17; | ||
51 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
52 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
53 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
54 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
55 | |||
56 | pub const FIOCLEX: ::c_ulong = 0x5451; | ||
57 | pub const FIONBIO: ::c_ulong = 0x5421; | ||
58 | |||
59 | pub const SYS_gettid: ::c_long = 224; | ||
60 | pub const SYS_perf_event_open: ::c_long = 336; | ||
61 | |||
62 | extern { | ||
63 | pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; | ||
64 | pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; | ||
65 | pub fn makecontext(ucp: *mut ucontext_t, | ||
66 | func: extern fn (), | ||
67 | argc: ::c_int, ...); | ||
68 | pub fn swapcontext(uocp: *mut ucontext_t, | ||
69 | ucp: *const ucontext_t) -> ::c_int; | ||
70 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/b64/aarch64.rs b/third_party/libc/src/unix/notbsd/linux/other/b64/aarch64.rs new file mode 100644 index 0000000..e977868 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/b64/aarch64.rs | |||
@@ -0,0 +1,81 @@ | |||
1 | //! AArch64-specific definitions for 64-bit linux-like values | ||
2 | |||
3 | pub type c_char = u8; | ||
4 | pub type wchar_t = u32; | ||
5 | pub type nlink_t = u32; | ||
6 | pub type blksize_t = i32; | ||
7 | |||
8 | s! { | ||
9 | pub struct stat { | ||
10 | pub st_dev: ::dev_t, | ||
11 | pub st_ino: ::ino_t, | ||
12 | pub st_mode: ::mode_t, | ||
13 | pub st_nlink: ::nlink_t, | ||
14 | pub st_uid: ::uid_t, | ||
15 | pub st_gid: ::gid_t, | ||
16 | pub st_rdev: ::dev_t, | ||
17 | __pad1: ::dev_t, | ||
18 | pub st_size: ::off_t, | ||
19 | pub st_blksize: ::blksize_t, | ||
20 | __pad2: ::c_int, | ||
21 | pub st_blocks: ::blkcnt_t, | ||
22 | pub st_atime: ::time_t, | ||
23 | pub st_atime_nsec: ::c_long, | ||
24 | pub st_mtime: ::time_t, | ||
25 | pub st_mtime_nsec: ::c_long, | ||
26 | pub st_ctime: ::time_t, | ||
27 | pub st_ctime_nsec: ::c_long, | ||
28 | __unused: [::c_int; 2], | ||
29 | } | ||
30 | |||
31 | pub struct stat64 { | ||
32 | pub st_dev: ::dev_t, | ||
33 | pub st_ino: ::ino_t, | ||
34 | pub st_mode: ::mode_t, | ||
35 | pub st_nlink: ::nlink_t, | ||
36 | pub st_uid: ::uid_t, | ||
37 | pub st_gid: ::gid_t, | ||
38 | pub st_rdev: ::dev_t, | ||
39 | __pad1: ::dev_t, | ||
40 | pub st_size: ::off64_t, | ||
41 | pub st_blksize: ::blksize_t, | ||
42 | __pad2: ::c_int, | ||
43 | pub st_blocks: ::blkcnt64_t, | ||
44 | pub st_atime: ::time_t, | ||
45 | pub st_atime_nsec: ::c_long, | ||
46 | pub st_mtime: ::time_t, | ||
47 | pub st_mtime_nsec: ::c_long, | ||
48 | pub st_ctime: ::time_t, | ||
49 | pub st_ctime_nsec: ::c_long, | ||
50 | __unused: [::c_int; 2], | ||
51 | } | ||
52 | |||
53 | pub struct pthread_attr_t { | ||
54 | __size: [u64; 8] | ||
55 | } | ||
56 | } | ||
57 | |||
58 | pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 8; | ||
59 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48; | ||
60 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8; | ||
61 | |||
62 | pub const O_DIRECT: ::c_int = 0x10000; | ||
63 | pub const O_DIRECTORY: ::c_int = 0x4000; | ||
64 | pub const O_NOFOLLOW: ::c_int = 0x8000; | ||
65 | |||
66 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
67 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
68 | |||
69 | pub const EDEADLOCK: ::c_int = 35; | ||
70 | |||
71 | pub const SO_PEERCRED: ::c_int = 17; | ||
72 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
73 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
74 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
75 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
76 | |||
77 | pub const FIOCLEX: ::c_ulong = 0x5451; | ||
78 | pub const FIONBIO: ::c_ulong = 0x5421; | ||
79 | |||
80 | pub const SYS_gettid: ::c_long = 178; | ||
81 | pub const SYS_perf_event_open: ::c_long = 241; | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/b64/mod.rs b/third_party/libc/src/unix/notbsd/linux/other/b64/mod.rs new file mode 100644 index 0000000..ccf9988 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/b64/mod.rs | |||
@@ -0,0 +1,51 @@ | |||
1 | //! 64-bit specific definitions for linux-like values | ||
2 | |||
3 | pub type c_long = i64; | ||
4 | pub type c_ulong = u64; | ||
5 | pub type clock_t = i64; | ||
6 | pub type time_t = i64; | ||
7 | pub type suseconds_t = i64; | ||
8 | pub type ino_t = u64; | ||
9 | pub type off_t = i64; | ||
10 | pub type blkcnt_t = i64; | ||
11 | pub type __fsword_t = ::c_long; | ||
12 | |||
13 | s! { | ||
14 | pub struct sigset_t { | ||
15 | __val: [::c_ulong; 16], | ||
16 | } | ||
17 | |||
18 | pub struct sysinfo { | ||
19 | pub uptime: ::c_long, | ||
20 | pub loads: [::c_ulong; 3], | ||
21 | pub totalram: ::c_ulong, | ||
22 | pub freeram: ::c_ulong, | ||
23 | pub sharedram: ::c_ulong, | ||
24 | pub bufferram: ::c_ulong, | ||
25 | pub totalswap: ::c_ulong, | ||
26 | pub freeswap: ::c_ulong, | ||
27 | pub procs: ::c_ushort, | ||
28 | pub pad: ::c_ushort, | ||
29 | pub totalhigh: ::c_ulong, | ||
30 | pub freehigh: ::c_ulong, | ||
31 | pub mem_unit: ::c_uint, | ||
32 | pub _f: [::c_char; 0], | ||
33 | } | ||
34 | } | ||
35 | |||
36 | pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; | ||
37 | |||
38 | cfg_if! { | ||
39 | if #[cfg(target_arch = "aarch64")] { | ||
40 | mod aarch64; | ||
41 | pub use self::aarch64::*; | ||
42 | } else if #[cfg(any(target_arch = "powerpc64"))] { | ||
43 | mod powerpc64; | ||
44 | pub use self::powerpc64::*; | ||
45 | } else if #[cfg(any(target_arch = "x86_64"))] { | ||
46 | mod x86_64; | ||
47 | pub use self::x86_64::*; | ||
48 | } else { | ||
49 | // Unknown target_arch | ||
50 | } | ||
51 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs b/third_party/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs new file mode 100644 index 0000000..fca4204 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs | |||
@@ -0,0 +1,79 @@ | |||
1 | //! PowerPC64-specific definitions for 64-bit linux-like values | ||
2 | |||
3 | pub type c_char = u8; | ||
4 | pub type wchar_t = i32; | ||
5 | pub type nlink_t = u64; | ||
6 | pub type blksize_t = i64; | ||
7 | |||
8 | s! { | ||
9 | pub struct stat { | ||
10 | pub st_dev: ::dev_t, | ||
11 | pub st_ino: ::ino_t, | ||
12 | pub st_nlink: ::nlink_t, | ||
13 | pub st_mode: ::mode_t, | ||
14 | pub st_uid: ::uid_t, | ||
15 | pub st_gid: ::gid_t, | ||
16 | __pad0: ::c_int, | ||
17 | pub st_rdev: ::dev_t, | ||
18 | pub st_size: ::off_t, | ||
19 | pub st_blksize: ::blksize_t, | ||
20 | pub st_blocks: ::blkcnt_t, | ||
21 | pub st_atime: ::time_t, | ||
22 | pub st_atime_nsec: ::c_long, | ||
23 | pub st_mtime: ::time_t, | ||
24 | pub st_mtime_nsec: ::c_long, | ||
25 | pub st_ctime: ::time_t, | ||
26 | pub st_ctime_nsec: ::c_long, | ||
27 | __unused: [::c_long; 3], | ||
28 | } | ||
29 | |||
30 | pub struct stat64 { | ||
31 | pub st_dev: ::dev_t, | ||
32 | pub st_ino: ::ino64_t, | ||
33 | pub st_nlink: ::nlink_t, | ||
34 | pub st_mode: ::mode_t, | ||
35 | pub st_uid: ::uid_t, | ||
36 | pub st_gid: ::gid_t, | ||
37 | __pad0: ::c_int, | ||
38 | pub st_rdev: ::dev_t, | ||
39 | pub st_size: ::off64_t, | ||
40 | pub st_blksize: ::blksize_t, | ||
41 | pub st_blocks: ::blkcnt64_t, | ||
42 | pub st_atime: ::time_t, | ||
43 | pub st_atime_nsec: ::c_long, | ||
44 | pub st_mtime: ::time_t, | ||
45 | pub st_mtime_nsec: ::c_long, | ||
46 | pub st_ctime: ::time_t, | ||
47 | pub st_ctime_nsec: ::c_long, | ||
48 | __reserved: [::c_long; 3], | ||
49 | } | ||
50 | |||
51 | pub struct pthread_attr_t { | ||
52 | __size: [u64; 7] | ||
53 | } | ||
54 | } | ||
55 | |||
56 | pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; | ||
57 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; | ||
58 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; | ||
59 | |||
60 | pub const O_DIRECTORY: ::c_int = 0x4000; | ||
61 | pub const O_NOFOLLOW: ::c_int = 0x8000; | ||
62 | pub const O_DIRECT: ::c_int = 0x20000; | ||
63 | |||
64 | pub const MAP_LOCKED: ::c_int = 0x00080; | ||
65 | pub const MAP_NORESERVE: ::c_int = 0x00040; | ||
66 | |||
67 | pub const EDEADLOCK: ::c_int = 58; | ||
68 | |||
69 | pub const SO_PEERCRED: ::c_int = 21; | ||
70 | pub const SO_RCVLOWAT: ::c_int = 16; | ||
71 | pub const SO_SNDLOWAT: ::c_int = 17; | ||
72 | pub const SO_RCVTIMEO: ::c_int = 18; | ||
73 | pub const SO_SNDTIMEO: ::c_int = 19; | ||
74 | |||
75 | pub const FIOCLEX: ::c_ulong = 0x20006601; | ||
76 | pub const FIONBIO: ::c_ulong = 0x8004667e; | ||
77 | |||
78 | pub const SYS_gettid: ::c_long = 207; | ||
79 | pub const SYS_perf_event_open: ::c_long = 319; | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/b64/x86_64.rs b/third_party/libc/src/unix/notbsd/linux/other/b64/x86_64.rs new file mode 100644 index 0000000..052df2e --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/b64/x86_64.rs | |||
@@ -0,0 +1,137 @@ | |||
1 | //! x86_64-specific definitions for 64-bit linux-like values | ||
2 | |||
3 | pub type c_char = i8; | ||
4 | pub type wchar_t = i32; | ||
5 | pub type nlink_t = u64; | ||
6 | pub type blksize_t = i64; | ||
7 | pub type greg_t = i64; | ||
8 | |||
9 | s! { | ||
10 | pub struct stat { | ||
11 | pub st_dev: ::dev_t, | ||
12 | pub st_ino: ::ino_t, | ||
13 | pub st_nlink: ::nlink_t, | ||
14 | pub st_mode: ::mode_t, | ||
15 | pub st_uid: ::uid_t, | ||
16 | pub st_gid: ::gid_t, | ||
17 | __pad0: ::c_int, | ||
18 | pub st_rdev: ::dev_t, | ||
19 | pub st_size: ::off_t, | ||
20 | pub st_blksize: ::blksize_t, | ||
21 | pub st_blocks: ::blkcnt_t, | ||
22 | pub st_atime: ::time_t, | ||
23 | pub st_atime_nsec: ::c_long, | ||
24 | pub st_mtime: ::time_t, | ||
25 | pub st_mtime_nsec: ::c_long, | ||
26 | pub st_ctime: ::time_t, | ||
27 | pub st_ctime_nsec: ::c_long, | ||
28 | __unused: [::c_long; 3], | ||
29 | } | ||
30 | |||
31 | pub struct stat64 { | ||
32 | pub st_dev: ::dev_t, | ||
33 | pub st_ino: ::ino64_t, | ||
34 | pub st_nlink: ::nlink_t, | ||
35 | pub st_mode: ::mode_t, | ||
36 | pub st_uid: ::uid_t, | ||
37 | pub st_gid: ::gid_t, | ||
38 | __pad0: ::c_int, | ||
39 | pub st_rdev: ::dev_t, | ||
40 | pub st_size: ::off_t, | ||
41 | pub st_blksize: ::blksize_t, | ||
42 | pub st_blocks: ::blkcnt64_t, | ||
43 | pub st_atime: ::time_t, | ||
44 | pub st_atime_nsec: ::c_long, | ||
45 | pub st_mtime: ::time_t, | ||
46 | pub st_mtime_nsec: ::c_long, | ||
47 | pub st_ctime: ::time_t, | ||
48 | pub st_ctime_nsec: ::c_long, | ||
49 | __reserved: [::c_long; 3], | ||
50 | } | ||
51 | |||
52 | pub struct pthread_attr_t { | ||
53 | __size: [u64; 7] | ||
54 | } | ||
55 | |||
56 | pub struct _libc_fpxreg { | ||
57 | pub significand: [u16; 4], | ||
58 | pub exponent: u16, | ||
59 | __private: [u16; 3], | ||
60 | } | ||
61 | |||
62 | pub struct _libc_xmmreg { | ||
63 | pub element: [u32; 4], | ||
64 | } | ||
65 | |||
66 | pub struct _libc_fpstate { | ||
67 | pub cwd: u16, | ||
68 | pub swd: u16, | ||
69 | pub ftw: u16, | ||
70 | pub fop: u16, | ||
71 | pub rip: u64, | ||
72 | pub rdp: u64, | ||
73 | pub mxcsr: u32, | ||
74 | pub mxcr_mask: u32, | ||
75 | pub _st: [_libc_fpxreg; 8], | ||
76 | pub _xmm: [_libc_xmmreg; 16], | ||
77 | __private: [u64; 12], | ||
78 | } | ||
79 | |||
80 | pub struct mcontext_t { | ||
81 | pub gregs: [greg_t; 23], | ||
82 | pub fpregs: *mut _libc_fpstate, | ||
83 | __private: [u64; 8], | ||
84 | } | ||
85 | |||
86 | pub struct ucontext_t { | ||
87 | pub uc_flags: ::c_ulong, | ||
88 | pub uc_link: *mut ucontext_t, | ||
89 | pub uc_stack: ::stack_t, | ||
90 | pub uc_mcontext: mcontext_t, | ||
91 | pub uc_sigmask: ::sigset_t, | ||
92 | __private: [u8; 512], | ||
93 | } | ||
94 | } | ||
95 | |||
96 | pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; | ||
97 | pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; | ||
98 | pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; | ||
99 | |||
100 | pub const O_DIRECT: ::c_int = 0x4000; | ||
101 | pub const O_DIRECTORY: ::c_int = 0x10000; | ||
102 | pub const O_NOFOLLOW: ::c_int = 0x20000; | ||
103 | |||
104 | pub const MAP_LOCKED: ::c_int = 0x02000; | ||
105 | pub const MAP_NORESERVE: ::c_int = 0x04000; | ||
106 | pub const MAP_32BIT: ::c_int = 0x0040; | ||
107 | |||
108 | pub const EDEADLOCK: ::c_int = 35; | ||
109 | |||
110 | pub const SO_PEERCRED: ::c_int = 17; | ||
111 | pub const SO_RCVLOWAT: ::c_int = 18; | ||
112 | pub const SO_SNDLOWAT: ::c_int = 19; | ||
113 | pub const SO_RCVTIMEO: ::c_int = 20; | ||
114 | pub const SO_SNDTIMEO: ::c_int = 21; | ||
115 | |||
116 | pub const FIOCLEX: ::c_ulong = 0x5451; | ||
117 | pub const FIONBIO: ::c_ulong = 0x5421; | ||
118 | |||
119 | pub const PTRACE_GETFPREGS: ::c_uint = 14; | ||
120 | pub const PTRACE_SETFPREGS: ::c_uint = 15; | ||
121 | pub const PTRACE_GETFPXREGS: ::c_uint = 18; | ||
122 | pub const PTRACE_SETFPXREGS: ::c_uint = 19; | ||
123 | pub const PTRACE_GETREGS: ::c_uint = 12; | ||
124 | pub const PTRACE_SETREGS: ::c_uint = 13; | ||
125 | |||
126 | pub const SYS_gettid: ::c_long = 186; | ||
127 | pub const SYS_perf_event_open: ::c_long = 298; | ||
128 | |||
129 | extern { | ||
130 | pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; | ||
131 | pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; | ||
132 | pub fn makecontext(ucp: *mut ucontext_t, | ||
133 | func: extern fn (), | ||
134 | argc: ::c_int, ...); | ||
135 | pub fn swapcontext(uocp: *mut ucontext_t, | ||
136 | ucp: *const ucontext_t) -> ::c_int; | ||
137 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/linux/other/mod.rs b/third_party/libc/src/unix/notbsd/linux/other/mod.rs new file mode 100644 index 0000000..76b06a1 --- /dev/null +++ b/third_party/libc/src/unix/notbsd/linux/other/mod.rs | |||
@@ -0,0 +1,616 @@ | |||
1 | pub type fsblkcnt_t = ::c_ulong; | ||
2 | pub type fsfilcnt_t = ::c_ulong; | ||
3 | pub type rlim_t = c_ulong; | ||
4 | pub type __priority_which_t = ::c_uint; | ||
5 | |||
6 | s! { | ||
7 | pub struct __exit_status { | ||
8 | pub e_termination: ::c_short, | ||
9 | pub e_exit: ::c_short, | ||
10 | } | ||
11 | |||
12 | pub struct __timeval { | ||
13 | pub tv_sec: ::int32_t, | ||
14 | pub tv_usec: ::int32_t, | ||
15 | } | ||
16 | |||
17 | pub struct utmpx { | ||
18 | pub ut_type: ::c_short, | ||
19 | pub ut_pid: ::pid_t, | ||
20 | pub ut_line: [::c_char; __UT_LINESIZE], | ||
21 | pub ut_id: [::c_char; 4], | ||
22 | |||
23 | pub ut_user: [::c_char; __UT_NAMESIZE], | ||
24 | pub ut_host: [::c_char; __UT_HOSTSIZE], | ||
25 | pub ut_exit: __exit_status, | ||
26 | |||
27 | #[cfg(any(target_arch = "aarch64", target_pointer_width = "32"))] | ||
28 | pub ut_session: ::c_long, | ||
29 | #[cfg(any(target_arch = "aarch64", target_pointer_width = "32"))] | ||
30 | pub ut_tv: ::timeval, | ||
31 | |||
32 | #[cfg(not(any(target_arch = "aarch64", target_pointer_width = "32")))] | ||
33 | pub ut_session: ::int32_t, | ||
34 | #[cfg(not(any(target_arch = "aarch64", target_pointer_width = "32")))] | ||
35 | pub ut_tv: __timeval, | ||
36 | |||
37 | pub ut_addr_v6: [::int32_t; 4], | ||
38 | __glibc_reserved: [::c_char; 20], | ||
39 | } | ||
40 | |||
41 | pub struct sigaction { | ||
42 | pub sa_sigaction: ::sighandler_t, | ||
43 | pub sa_mask: ::sigset_t, | ||
44 | pub sa_flags: ::c_int, | ||
45 | _restorer: *mut ::c_void, | ||
46 | } | ||
47 | |||
48 | pub struct stack_t { | ||
49 | pub ss_sp: *mut ::c_void, | ||
50 | pub ss_flags: ::c_int, | ||
51 | pub ss_size: ::size_t | ||
52 | } | ||
53 | |||
54 | pub struct siginfo_t { | ||
55 | pub si_signo: ::c_int, | ||
56 | pub si_errno: ::c_int, | ||
57 | pub si_code: ::c_int, | ||
58 | pub _pad: [::c_int; 29], | ||
59 | _align: [usize; 0], | ||
60 | } | ||
61 | |||
62 | pub struct glob64_t { | ||
63 | pub gl_pathc: ::size_t, | ||
64 | pub gl_pathv: *mut *mut ::c_char, | ||
65 | pub gl_offs: ::size_t, | ||
66 | pub gl_flags: ::c_int, | ||
67 | |||
68 | __unused1: *mut ::c_void, | ||
69 | __unused2: *mut ::c_void, | ||
70 | __unused3: *mut ::c_void, | ||
71 | __unused4: *mut ::c_void, | ||
72 | __unused5: *mut ::c_void, | ||
73 | } | ||
74 | |||
75 | pub struct ucred { | ||
76 | pub pid: ::pid_t, | ||
77 | pub uid: ::uid_t, | ||
78 | pub gid: ::gid_t, | ||
79 | } | ||
80 | |||
81 | pub struct statfs { | ||
82 | pub f_type: __fsword_t, | ||
83 | pub f_bsize: __fsword_t, | ||
84 | pub f_blocks: ::fsblkcnt_t, | ||
85 | pub f_bfree: ::fsblkcnt_t, | ||
86 | pub f_bavail: ::fsblkcnt_t, | ||
87 | |||
88 | pub f_files: ::fsfilcnt_t, | ||
89 | pub f_ffree: ::fsfilcnt_t, | ||
90 | pub f_fsid: ::fsid_t, | ||
91 | |||
92 | pub f_namelen: __fsword_t, | ||
93 | pub f_frsize: __fsword_t, | ||
94 | f_spare: [__fsword_t; 5], | ||
95 | } | ||
96 | |||
97 | pub struct msghdr { | ||
98 | pub msg_name: *mut ::c_void, | ||
99 | pub msg_namelen: ::socklen_t, | ||
100 | pub msg_iov: *mut ::iovec, | ||
101 | pub msg_iovlen: ::size_t, | ||
102 | pub msg_control: *mut ::c_void, | ||
103 | pub msg_controllen: ::size_t, | ||
104 | pub msg_flags: ::c_int, | ||
105 | } | ||
106 | |||
107 | pub struct termios { | ||
108 | pub c_iflag: ::tcflag_t, | ||
109 | pub c_oflag: ::tcflag_t, | ||
110 | pub c_cflag: ::tcflag_t, | ||
111 | pub c_lflag: ::tcflag_t, | ||
112 | pub c_line: ::cc_t, | ||
113 | pub c_cc: [::cc_t; ::NCCS], | ||
114 | pub c_ispeed: ::speed_t, | ||
115 | pub c_ospeed: ::speed_t, | ||
116 | } | ||
117 | |||
118 | pub struct flock { | ||
119 | pub l_type: ::c_short, | ||
120 | pub l_whence: ::c_short, | ||
121 | pub l_start: ::off_t, | ||
122 | pub l_len: ::off_t, | ||
123 | pub l_pid: ::pid_t, | ||
124 | } | ||
125 | |||
126 | pub struct ipc_perm { | ||
127 | pub __key: ::key_t, | ||
128 | pub uid: ::uid_t, | ||
129 | pub gid: ::gid_t, | ||
130 | pub cuid: ::uid_t, | ||
131 | pub cgid: ::gid_t, | ||
132 | pub mode: ::c_ushort, | ||
133 | __pad1: ::c_ushort, | ||
134 | pub __seq: ::c_ushort, | ||
135 | __pad2: ::c_ushort, | ||
136 | __unused1: ::c_ulong, | ||
137 | __unused2: ::c_ulong | ||
138 | } | ||
139 | |||
140 | pub struct shmid_ds { | ||
141 | pub shm_perm: ::ipc_perm, | ||
142 | pub shm_segsz: ::size_t, | ||
143 | pub shm_atime: ::time_t, | ||
144 | #[cfg(target_pointer_width = "32")] | ||
145 | __unused1: ::c_ulong, | ||
146 | pub shm_dtime: ::time_t, | ||
147 | #[cfg(target_pointer_width = "32")] | ||
148 | __unused2: ::c_ulong, | ||
149 | pub shm_ctime: ::time_t, | ||
150 | #[cfg(target_pointer_width = "32")] | ||
151 | __unused3: ::c_ulong, | ||
152 | pub shm_cpid: ::pid_t, | ||
153 | pub shm_lpid: ::pid_t, | ||
154 | pub shm_nattch: ::shmatt_t, | ||
155 | __unused4: ::c_ulong, | ||
156 | __unused5: ::c_ulong | ||
157 | } | ||
158 | |||
159 | // FIXME this is actually a union | ||
160 | pub struct sem_t { | ||
161 | #[cfg(target_pointer_width = "32")] | ||
162 | __size: [::c_char; 16], | ||
163 | #[cfg(target_pointer_width = "64")] | ||
164 | __size: [::c_char; 32], | ||
165 | __align: [::c_long; 0], | ||
166 | } | ||
167 | } | ||
168 | |||
169 | pub const __UT_LINESIZE: usize = 32; | ||
170 | pub const __UT_NAMESIZE: usize = 32; | ||
171 | pub const __UT_HOSTSIZE: usize = 256; | ||
172 | pub const EMPTY: ::c_short = 0; | ||
173 | pub const RUN_LVL: ::c_short = 1; | ||
174 | pub const BOOT_TIME: ::c_short = 2; | ||
175 | pub const NEW_TIME: ::c_short = 3; | ||
176 | pub const OLD_TIME: ::c_short = 4; | ||
177 | pub const INIT_PROCESS: ::c_short = 5; | ||
178 | pub const LOGIN_PROCESS: ::c_short = 6; | ||
179 | pub const USER_PROCESS: ::c_short = 7; | ||
180 | pub const DEAD_PROCESS: ::c_short = 8; | ||
181 | pub const ACCOUNTING: ::c_short = 9; | ||
182 | |||
183 | pub const RLIMIT_RSS: ::c_int = 5; | ||
184 | pub const RLIMIT_NOFILE: ::c_int = 7; | ||
185 | pub const RLIMIT_AS: ::c_int = 9; | ||
186 | pub const RLIMIT_NPROC: ::c_int = 6; | ||
187 | pub const RLIMIT_MEMLOCK: ::c_int = 8; | ||
188 | pub const RLIM_INFINITY: ::rlim_t = !0; | ||
189 | pub const RLIMIT_RTTIME: ::c_int = 15; | ||
190 | pub const RLIMIT_NLIMITS: ::c_int = 16; | ||
191 | |||
192 | pub const O_APPEND: ::c_int = 1024; | ||
193 | pub const O_CREAT: ::c_int = 64; | ||
194 | pub const O_EXCL: ::c_int = 128; | ||
195 | pub const O_NOCTTY: ::c_int = 256; | ||
196 | pub const O_NONBLOCK: ::c_int = 2048; | ||
197 | pub const O_SYNC: ::c_int = 1052672; | ||
198 | pub const O_RSYNC: ::c_int = 1052672; | ||
199 | pub const O_DSYNC: ::c_int = 4096; | ||
200 | pub const O_FSYNC: ::c_int = 0x101000; | ||
201 | |||
202 | pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; | ||
203 | |||
204 | pub const LC_PAPER: ::c_int = 7; | ||
205 | pub const LC_NAME: ::c_int = 8; | ||
206 | pub const LC_ADDRESS: ::c_int = 9; | ||
207 | pub const LC_TELEPHONE: ::c_int = 10; | ||
208 | pub const LC_MEASUREMENT: ::c_int = 11; | ||
209 | pub const LC_IDENTIFICATION: ::c_int = 12; | ||
210 | pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); | ||
211 | pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); | ||
212 | pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); | ||
213 | pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); | ||
214 | pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); | ||
215 | pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); | ||
216 | pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK | ||
217 | | ::LC_NUMERIC_MASK | ||
218 | | ::LC_TIME_MASK | ||
219 | | ::LC_COLLATE_MASK | ||
220 | | ::LC_MONETARY_MASK | ||
221 | | ::LC_MESSAGES_MASK | ||
222 | | LC_PAPER_MASK | ||
223 | | LC_NAME_MASK | ||
224 | | LC_ADDRESS_MASK | ||
225 | | LC_TELEPHONE_MASK | ||
226 | | LC_MEASUREMENT_MASK | ||
227 | | LC_IDENTIFICATION_MASK; | ||
228 | |||
229 | pub const MAP_ANON: ::c_int = 0x0020; | ||
230 | pub const MAP_ANONYMOUS: ::c_int = 0x0020; | ||
231 | pub const MAP_GROWSDOWN: ::c_int = 0x0100; | ||
232 | pub const MAP_DENYWRITE: ::c_int = 0x0800; | ||
233 | pub const MAP_EXECUTABLE: ::c_int = 0x01000; | ||
234 | pub const MAP_POPULATE: ::c_int = 0x08000; | ||
235 | pub const MAP_NONBLOCK: ::c_int = 0x010000; | ||
236 | pub const MAP_STACK: ::c_int = 0x020000; | ||
237 | |||
238 | pub const EDEADLK: ::c_int = 35; | ||
239 | pub const ENAMETOOLONG: ::c_int = 36; | ||
240 | pub const ENOLCK: ::c_int = 37; | ||
241 | pub const ENOSYS: ::c_int = 38; | ||
242 | pub const ENOTEMPTY: ::c_int = 39; | ||
243 | pub const ELOOP: ::c_int = 40; | ||
244 | pub const ENOMSG: ::c_int = 42; | ||
245 | pub const EIDRM: ::c_int = 43; | ||
246 | pub const ECHRNG: ::c_int = 44; | ||
247 | pub const EL2NSYNC: ::c_int = 45; | ||
248 | pub const EL3HLT: ::c_int = 46; | ||
249 | pub const EL3RST: ::c_int = 47; | ||
250 | pub const ELNRNG: ::c_int = 48; | ||
251 | pub const EUNATCH: ::c_int = 49; | ||
252 | pub const ENOCSI: ::c_int = 50; | ||
253 | pub const EL2HLT: ::c_int = 51; | ||
254 | pub const EBADE: ::c_int = 52; | ||
255 | pub const EBADR: ::c_int = 53; | ||
256 | pub const EXFULL: ::c_int = 54; | ||
257 | pub const ENOANO: ::c_int = 55; | ||
258 | pub const EBADRQC: ::c_int = 56; | ||
259 | pub const EBADSLT: ::c_int = 57; | ||
260 | pub const EMULTIHOP: ::c_int = 72; | ||
261 | pub const EOVERFLOW: ::c_int = 75; | ||
262 | pub const ENOTUNIQ: ::c_int = 76; | ||
263 | pub const EBADFD: ::c_int = 77; | ||
264 | pub const EBADMSG: ::c_int = 74; | ||
265 | pub const EREMCHG: ::c_int = 78; | ||
266 | pub const ELIBACC: ::c_int = 79; | ||
267 | pub const ELIBBAD: ::c_int = 80; | ||
268 | pub const ELIBSCN: ::c_int = 81; | ||
269 | pub const ELIBMAX: ::c_int = 82; | ||
270 | pub const ELIBEXEC: ::c_int = 83; | ||
271 | pub const EILSEQ: ::c_int = 84; | ||
272 | pub const ERESTART: ::c_int = 85; | ||
273 | pub const ESTRPIPE: ::c_int = 86; | ||
274 | pub const EUSERS: ::c_int = 87; | ||
275 | pub const ENOTSOCK: ::c_int = 88; | ||
276 | pub const EDESTADDRREQ: ::c_int = 89; | ||
277 | pub const EMSGSIZE: ::c_int = 90; | ||
278 | pub const EPROTOTYPE: ::c_int = 91; | ||
279 | pub const ENOPROTOOPT: ::c_int = 92; | ||
280 | pub const EPROTONOSUPPORT: ::c_int = 93; | ||
281 | pub const ESOCKTNOSUPPORT: ::c_int = 94; | ||
282 | pub const EOPNOTSUPP: ::c_int = 95; | ||
283 | pub const EPFNOSUPPORT: ::c_int = 96; | ||
284 | pub const EAFNOSUPPORT: ::c_int = 97; | ||
285 | pub const EADDRINUSE: ::c_int = 98; | ||
286 | pub const EADDRNOTAVAIL: ::c_int = 99; | ||
287 | pub const ENETDOWN: ::c_int = 100; | ||
288 | pub const ENETUNREACH: ::c_int = 101; | ||
289 | pub const ENETRESET: ::c_int = 102; | ||
290 | pub const ECONNABORTED: ::c_int = 103; | ||
291 | pub const ECONNRESET: ::c_int = 104; | ||
292 | pub const ENOBUFS: ::c_int = 105; | ||
293 | pub const EISCONN: ::c_int = 106; | ||
294 | pub const ENOTCONN: ::c_int = 107; | ||
295 | pub const ESHUTDOWN: ::c_int = 108; | ||
296 | pub const ETOOMANYREFS: ::c_int = 109; | ||
297 | pub const ETIMEDOUT: ::c_int = 110; | ||
298 | pub const ECONNREFUSED: ::c_int = 111; | ||
299 | pub const EHOSTDOWN: ::c_int = 112; | ||
300 | pub const EHOSTUNREACH: ::c_int = 113; | ||
301 | pub const EALREADY: ::c_int = 114; | ||
302 | pub const EINPROGRESS: ::c_int = 115; | ||
303 | pub const ESTALE: ::c_int = 116; | ||
304 | pub const EUCLEAN: ::c_int = 117; | ||
305 | pub const ENOTNAM: ::c_int = 118; | ||
306 | pub const ENAVAIL: ::c_int = 119; | ||
307 | pub const EISNAM: ::c_int = 120; | ||
308 | pub const EREMOTEIO: ::c_int = 121; | ||
309 | pub const EDQUOT: ::c_int = 122; | ||
310 | pub const ENOMEDIUM: ::c_int = 123; | ||
311 | pub const EMEDIUMTYPE: ::c_int = 124; | ||
312 | pub const ECANCELED: ::c_int = 125; | ||
313 | pub const ENOKEY: ::c_int = 126; | ||
314 | pub const EKEYEXPIRED: ::c_int = 127; | ||
315 | pub const EKEYREVOKED: ::c_int = 128; | ||
316 | pub const EKEYREJECTED: ::c_int = 129; | ||
317 | pub const EOWNERDEAD: ::c_int = 130; | ||
318 | pub const ENOTRECOVERABLE: ::c_int = 131; | ||
319 | pub const EHWPOISON: ::c_int = 133; | ||
320 | pub const ERFKILL: ::c_int = 132; | ||
321 | |||
322 | pub const SOCK_STREAM: ::c_int = 1; | ||
323 | pub const SOCK_DGRAM: ::c_int = 2; | ||
324 | pub const SOCK_SEQPACKET: ::c_int = 5; | ||
325 | |||
326 | pub const SOL_SOCKET: ::c_int = 1; | ||
327 | |||
328 | pub const SO_REUSEADDR: ::c_int = 2; | ||
329 | pub const SO_TYPE: ::c_int = 3; | ||
330 | pub const SO_ERROR: ::c_int = 4; | ||
331 | pub const SO_DONTROUTE: ::c_int = 5; | ||
332 | pub const SO_BROADCAST: ::c_int = 6; | ||
333 | pub const SO_SNDBUF: ::c_int = 7; | ||
334 | pub const SO_RCVBUF: ::c_int = 8; | ||
335 | pub const SO_KEEPALIVE: ::c_int = 9; | ||
336 | pub const SO_OOBINLINE: ::c_int = 10; | ||
337 | pub const SO_LINGER: ::c_int = 13; | ||
338 | pub const SO_REUSEPORT: ::c_int = 15; | ||
339 | pub const SO_ACCEPTCONN: ::c_int = 30; | ||
340 | |||
341 | pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; | ||
342 | pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; | ||
343 | pub const TCP_THIN_DUPACK: ::c_int = 17; | ||
344 | pub const TCP_USER_TIMEOUT: ::c_int = 18; | ||
345 | pub const TCP_REPAIR: ::c_int = 19; | ||
346 | pub const TCP_REPAIR_QUEUE: ::c_int = 20; | ||
347 | pub const TCP_QUEUE_SEQ: ::c_int = 21; | ||
348 | pub const TCP_REPAIR_OPTIONS: ::c_int = 22; | ||
349 | pub const TCP_FASTOPEN: ::c_int = 23; | ||
350 | pub const TCP_TIMESTAMP: ::c_int = 24; | ||
351 | |||
352 | pub const SA_ONSTACK: ::c_int = 0x08000000; | ||
353 | pub const SA_SIGINFO: ::c_int = 0x00000004; | ||
354 | pub const SA_NOCLDWAIT: ::c_int = 0x00000002; | ||
355 | |||
356 | pub const SIGCHLD: ::c_int = 17; | ||
357 | pub const SIGBUS: ::c_int = 7; | ||
358 | pub const SIGUSR1: ::c_int = 10; | ||
359 | pub const SIGUSR2: ::c_int = 12; | ||
360 | pub const SIGCONT: ::c_int = 18; | ||
361 | pub const SIGSTOP: ::c_int = 19; | ||
362 | pub const SIGTSTP: ::c_int = 20; | ||
363 | pub const SIGURG: ::c_int = 23; | ||
364 | pub const SIGIO: ::c_int = 29; | ||
365 | pub const SIGSYS: ::c_int = 31; | ||
366 | pub const SIGSTKFLT: ::c_int = 16; | ||
367 | pub const SIGUNUSED: ::c_int = 31; | ||
368 | pub const SIGTTIN: ::c_int = 21; | ||
369 | pub const SIGTTOU: ::c_int = 22; | ||
370 | pub const SIGXCPU: ::c_int = 24; | ||
371 | pub const SIGXFSZ: ::c_int = 25; | ||
372 | pub const SIGVTALRM: ::c_int = 26; | ||
373 | pub const SIGPROF: ::c_int = 27; | ||
374 | pub const SIGWINCH: ::c_int = 28; | ||
375 | pub const SIGPOLL: ::c_int = 29; | ||
376 | pub const SIGPWR: ::c_int = 30; | ||
377 | pub const SIG_SETMASK: ::c_int = 2; | ||
378 | pub const SIG_BLOCK: ::c_int = 0x000000; | ||
379 | pub const SIG_UNBLOCK: ::c_int = 0x01; | ||
380 | |||
381 | pub const POLLRDNORM: ::c_short = 0x040; | ||
382 | pub const POLLWRNORM: ::c_short = 0x100; | ||
383 | pub const POLLRDBAND: ::c_short = 0x080; | ||
384 | pub const POLLWRBAND: ::c_short = 0x200; | ||
385 | |||
386 | pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01; | ||
387 | pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02; | ||
388 | |||
389 | pub const BUFSIZ: ::c_uint = 8192; | ||
390 | pub const TMP_MAX: ::c_uint = 238328; | ||
391 | pub const FOPEN_MAX: ::c_uint = 16; | ||
392 | pub const POSIX_MADV_DONTNEED: ::c_int = 4; | ||
393 | pub const _SC_2_C_VERSION: ::c_int = 96; | ||
394 | pub const RUSAGE_THREAD: ::c_int = 1; | ||
395 | pub const O_ACCMODE: ::c_int = 3; | ||
396 | pub const O_ASYNC: ::c_int = 0x2000; | ||
397 | pub const O_NDELAY: ::c_int = 0x800; | ||
398 | pub const RUSAGE_CHILDREN: ::c_int = -1; | ||
399 | pub const ST_RELATIME: ::c_ulong = 4096; | ||
400 | pub const NI_MAXHOST: ::socklen_t = 1025; | ||
401 | |||
402 | pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; | ||
403 | pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; | ||
404 | pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; | ||
405 | pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; | ||
406 | pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; | ||
407 | pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
408 | pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
409 | pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; | ||
410 | pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; | ||
411 | pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; | ||
412 | pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; | ||
413 | pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; | ||
414 | pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; | ||
415 | pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; | ||
416 | pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; | ||
417 | pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; | ||
418 | pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; | ||
419 | pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; | ||
420 | pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; | ||
421 | pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; | ||
422 | pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; | ||
423 | pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; | ||
424 | pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; | ||
425 | pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; | ||
426 | pub const TMPFS_MAGIC: ::c_long = 0x01021994; | ||
427 | pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; | ||
428 | |||
429 | pub const VEOF: usize = 4; | ||
430 | pub const VEOL: usize = 11; | ||
431 | pub const VEOL2: usize = 16; | ||
432 | pub const VMIN: usize = 6; | ||
433 | pub const IEXTEN: ::tcflag_t = 0x00008000; | ||
434 | pub const TOSTOP: ::tcflag_t = 0x00000100; | ||
435 | pub const FLUSHO: ::tcflag_t = 0x00001000; | ||
436 | pub const IUTF8: ::tcflag_t = 0x00004000; | ||
437 | |||
438 | pub const CPU_SETSIZE: ::c_int = 0x400; | ||
439 | |||
440 | pub const EXTPROC: ::tcflag_t = 0x00010000; | ||
441 | |||
442 | pub const QFMT_VFS_V1: ::c_int = 4; | ||
443 | |||
444 | pub const PTRACE_TRACEME: ::c_uint = 0; | ||
445 | pub const PTRACE_PEEKTEXT: ::c_uint = 1; | ||
446 | pub const PTRACE_PEEKDATA: ::c_uint = 2; | ||
447 | pub const PTRACE_PEEKUSER: ::c_uint = 3; | ||
448 | pub const PTRACE_POKETEXT: ::c_uint = 4; | ||
449 | pub const PTRACE_POKEDATA: ::c_uint = 5; | ||
450 | pub const PTRACE_POKEUSER: ::c_uint = 6; | ||
451 | pub const PTRACE_CONT: ::c_uint = 7; | ||
452 | pub const PTRACE_KILL: ::c_uint = 8; | ||
453 | pub const PTRACE_SINGLESTEP: ::c_uint = 9; | ||
454 | pub const PTRACE_ATTACH: ::c_uint = 16; | ||
455 | pub const PTRACE_DETACH: ::c_uint = 17; | ||
456 | pub const PTRACE_SYSCALL: ::c_uint = 24; | ||
457 | pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; | ||
458 | pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; | ||
459 | pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; | ||
460 | pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; | ||
461 | pub const PTRACE_GETREGSET: ::c_uint = 0x4204; | ||
462 | pub const PTRACE_SETREGSET: ::c_uint = 0x4205; | ||
463 | pub const PTRACE_SEIZE: ::c_uint = 0x4206; | ||
464 | pub const PTRACE_INTERRUPT: ::c_uint = 0x4207; | ||
465 | pub const PTRACE_LISTEN: ::c_uint = 0x4208; | ||
466 | pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209; | ||
467 | |||
468 | pub const MADV_DODUMP: ::c_int = 17; | ||
469 | pub const MADV_DONTDUMP: ::c_int = 16; | ||
470 | |||
471 | pub const EPOLLWAKEUP: ::c_int = 0x20000000; | ||
472 | |||
473 | pub const MADV_HUGEPAGE: ::c_int = 14; | ||
474 | pub const MADV_NOHUGEPAGE: ::c_int = 15; | ||
475 | pub const MAP_HUGETLB: ::c_int = 0x040000; | ||
476 | |||
477 | pub const EFD_NONBLOCK: ::c_int = 0x800; | ||
478 | |||
479 | pub const F_GETLK: ::c_int = 5; | ||
480 | pub const F_GETOWN: ::c_int = 9; | ||
481 | pub const F_SETOWN: ::c_int = 8; | ||
482 | pub const F_SETLK: ::c_int = 6; | ||
483 | pub const F_SETLKW: ::c_int = 7; | ||
484 | |||
485 | pub const SEEK_DATA: ::c_int = 3; | ||
486 | pub const SEEK_HOLE: ::c_int = 4; | ||
487 | |||
488 | pub const SFD_NONBLOCK: ::c_int = 0x0800; | ||
489 | |||
490 | pub const TCSANOW: ::c_int = 0; | ||
491 | pub const TCSADRAIN: ::c_int = 1; | ||
492 | pub const TCSAFLUSH: ::c_int = 2; | ||
493 | |||
494 | pub const TCGETS: ::c_ulong = 0x5401; | ||
495 | pub const TCSETS: ::c_ulong = 0x5402; | ||
496 | pub const TCSETSW: ::c_ulong = 0x5403; | ||
497 | pub const TCSETSF: ::c_ulong = 0x5404; | ||
498 | pub const TCGETA: ::c_ulong = 0x5405; | ||
499 | pub const TCSETA: ::c_ulong = 0x5406; | ||
500 | pub const TCSETAW: ::c_ulong = 0x5407; | ||
501 | pub const TCSETAF: ::c_ulong = 0x5408; | ||
502 | pub const TCSBRK: ::c_ulong = 0x5409; | ||
503 | pub const TCXONC: ::c_ulong = 0x540A; | ||
504 | pub const TCFLSH: ::c_ulong = 0x540B; | ||
505 | pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; | ||
506 | pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; | ||
507 | pub const TIOCINQ: ::c_ulong = 0x541B; | ||
508 | pub const TIOCLINUX: ::c_ulong = 0x541C; | ||
509 | pub const TIOCGSERIAL: ::c_ulong = 0x541E; | ||
510 | pub const TIOCEXCL: ::c_ulong = 0x540C; | ||
511 | pub const TIOCNXCL: ::c_ulong = 0x540D; | ||
512 | pub const TIOCSCTTY: ::c_ulong = 0x540E; | ||
513 | pub const TIOCGPGRP: ::c_ulong = 0x540F; | ||
514 | pub const TIOCSPGRP: ::c_ulong = 0x5410; | ||
515 | pub const TIOCOUTQ: ::c_ulong = 0x5411; | ||
516 | pub const TIOCSTI: ::c_ulong = 0x5412; | ||
517 | pub const TIOCGWINSZ: ::c_ulong = 0x5413; | ||
518 | pub const TIOCSWINSZ: ::c_ulong = 0x5414; | ||
519 | pub const TIOCMGET: ::c_ulong = 0x5415; | ||
520 | pub const TIOCMBIS: ::c_ulong = 0x5416; | ||
521 | pub const TIOCMBIC: ::c_ulong = 0x5417; | ||
522 | pub const TIOCMSET: ::c_ulong = 0x5418; | ||
523 | pub const FIONREAD: ::c_ulong = 0x541B; | ||
524 | pub const TIOCCONS: ::c_ulong = 0x541D; | ||
525 | |||
526 | pub const RTLD_DEEPBIND: ::c_int = 0x8; | ||
527 | pub const RTLD_GLOBAL: ::c_int = 0x100; | ||
528 | pub const RTLD_NOLOAD: ::c_int = 0x4; | ||
529 | |||
530 | pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; | ||
531 | pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; | ||
532 | pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; | ||
533 | pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; | ||
534 | pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; | ||
535 | |||
536 | pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; | ||
537 | pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; | ||
538 | pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; | ||
539 | pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; | ||
540 | pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; | ||
541 | pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; | ||
542 | pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; | ||
543 | pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; | ||
544 | |||
545 | cfg_if! { | ||
546 | if #[cfg(any(target_arch = "arm", target_arch = "x86", | ||
547 | target_arch = "x86_64"))] { | ||
548 | pub const PTHREAD_STACK_MIN: ::size_t = 16384; | ||
549 | } else { | ||
550 | pub const PTHREAD_STACK_MIN: ::size_t = 131072; | ||
551 | } | ||
552 | } | ||
553 | |||
554 | extern { | ||
555 | pub fn utmpxname(file: *const ::c_char) -> ::c_int; | ||
556 | pub fn getutxent() -> *mut utmpx; | ||
557 | pub fn getutxid(ut: *const utmpx) -> *mut utmpx; | ||
558 | pub fn getutxline(ut: *const utmpx) -> *mut utmpx; | ||
559 | pub fn pututxline(ut: *const utmpx) -> *mut utmpx; | ||
560 | pub fn setutxent(); | ||
561 | pub fn endutxent(); | ||
562 | } | ||
563 | |||
564 | #[link(name = "util")] | ||
565 | extern { | ||
566 | pub fn sysctl(name: *mut ::c_int, | ||
567 | namelen: ::c_int, | ||
568 | oldp: *mut ::c_void, | ||
569 | oldlenp: *mut ::size_t, | ||
570 | newp: *mut ::c_void, | ||
571 | newlen: ::size_t) | ||
572 | -> ::c_int; | ||
573 | pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; | ||
574 | pub fn backtrace(buf: *mut *mut ::c_void, | ||
575 | sz: ::c_int) -> ::c_int; | ||
576 | pub fn glob64(pattern: *const ::c_char, | ||
577 | flags: ::c_int, | ||
578 | errfunc: ::dox::Option<extern fn(epath: *const ::c_char, | ||
579 | errno: ::c_int) | ||
580 | -> ::c_int>, | ||
581 | pglob: *mut glob64_t) -> ::c_int; | ||
582 | pub fn globfree64(pglob: *mut glob64_t); | ||
583 | pub fn ptrace(request: ::c_uint, ...) -> ::c_long; | ||
584 | pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, | ||
585 | cpusetsize: ::size_t, | ||
586 | cpuset: *mut ::cpu_set_t) -> ::c_int; | ||
587 | pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, | ||
588 | cpusetsize: ::size_t, | ||
589 | cpuset: *const ::cpu_set_t) -> ::c_int; | ||
590 | pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; | ||
591 | pub fn setpriority(which: ::__priority_which_t, who: ::id_t, | ||
592 | prio: ::c_int) -> ::c_int; | ||
593 | pub fn pthread_getaffinity_np(thread: ::pthread_t, | ||
594 | cpusetsize: ::size_t, | ||
595 | cpuset: *mut ::cpu_set_t) -> ::c_int; | ||
596 | pub fn pthread_setaffinity_np(thread: ::pthread_t, | ||
597 | cpusetsize: ::size_t, | ||
598 | cpuset: *const ::cpu_set_t) -> ::c_int; | ||
599 | pub fn sched_getcpu() -> ::c_int; | ||
600 | } | ||
601 | |||
602 | cfg_if! { | ||
603 | if #[cfg(any(target_arch = "x86", | ||
604 | target_arch = "arm", | ||
605 | target_arch = "powerpc"))] { | ||
606 | mod b32; | ||
607 | pub use self::b32::*; | ||
608 | } else if #[cfg(any(target_arch = "x86_64", | ||
609 | target_arch = "aarch64", | ||
610 | target_arch = "powerpc64"))] { | ||
611 | mod b64; | ||
612 | pub use self::b64::*; | ||
613 | } else { | ||
614 | // Unknown target_arch | ||
615 | } | ||
616 | } | ||
diff --git a/third_party/libc/src/unix/notbsd/mod.rs b/third_party/libc/src/unix/notbsd/mod.rs new file mode 100644 index 0000000..a9b061f --- /dev/null +++ b/third_party/libc/src/unix/notbsd/mod.rs | |||
@@ -0,0 +1,882 @@ | |||
1 | use dox::mem; | ||
2 | |||
3 | pub type sa_family_t = u16; | ||
4 | pub type pthread_key_t = ::c_uint; | ||
5 | pub type speed_t = ::c_uint; | ||
6 | pub type tcflag_t = ::c_uint; | ||
7 | pub type loff_t = ::c_longlong; | ||
8 | pub type clockid_t = ::c_int; | ||
9 | pub type id_t = ::c_uint; | ||
10 | |||
11 | pub enum timezone {} | ||
12 | |||
13 | s! { | ||
14 | pub struct sockaddr { | ||
15 | pub sa_family: sa_family_t, | ||
16 | pub sa_data: [::c_char; 14], | ||
17 | } | ||
18 | |||
19 | pub struct sockaddr_in { | ||
20 | pub sin_family: sa_family_t, | ||
21 | pub sin_port: ::in_port_t, | ||
22 | pub sin_addr: ::in_addr, | ||
23 | pub sin_zero: [u8; 8], | ||
24 | } | ||
25 | |||
26 | pub struct sockaddr_in6 { | ||
27 | pub sin6_family: sa_family_t, | ||
28 | pub sin6_port: ::in_port_t, | ||
29 | pub sin6_flowinfo: u32, | ||
30 | pub sin6_addr: ::in6_addr, | ||
31 | pub sin6_scope_id: u32, | ||
32 | } | ||
33 | |||
34 | pub struct sockaddr_un { | ||
35 | pub sun_family: sa_family_t, | ||
36 | pub sun_path: [::c_char; 108] | ||
37 | } | ||
38 | |||
39 | pub struct sockaddr_storage { | ||
40 | pub ss_family: sa_family_t, | ||
41 | __ss_align: ::size_t, | ||
42 | #[cfg(target_pointer_width = "32")] | ||
43 | __ss_pad2: [u8; 128 - 2 * 4], | ||
44 | #[cfg(target_pointer_width = "64")] | ||
45 | __ss_pad2: [u8; 128 - 2 * 8], | ||
46 | } | ||
47 | |||
48 | pub struct addrinfo { | ||
49 | pub ai_flags: ::c_int, | ||
50 | pub ai_family: ::c_int, | ||
51 | pub ai_socktype: ::c_int, | ||
52 | pub ai_protocol: ::c_int, | ||
53 | pub ai_addrlen: socklen_t, | ||
54 | |||
55 | #[cfg(any(target_os = "linux", target_os = "emscripten"))] | ||
56 | pub ai_addr: *mut ::sockaddr, | ||
57 | |||
58 | pub ai_canonname: *mut c_char, | ||
59 | |||
60 | #[cfg(target_os = "android")] | ||
61 | pub ai_addr: *mut ::sockaddr, | ||
62 | |||
63 | pub ai_next: *mut addrinfo, | ||
64 | } | ||
65 | |||
66 | pub struct sockaddr_nl { | ||
67 | pub nl_family: ::sa_family_t, | ||
68 | nl_pad: ::c_ushort, | ||
69 | pub nl_pid: u32, | ||
70 | pub nl_groups: u32 | ||
71 | } | ||
72 | |||
73 | pub struct sockaddr_ll { | ||
74 | pub sll_family: ::c_ushort, | ||
75 | pub sll_protocol: ::c_ushort, | ||
76 | pub sll_ifindex: ::c_int, | ||
77 | pub sll_hatype: ::c_ushort, | ||
78 | pub sll_pkttype: ::c_uchar, | ||
79 | pub sll_halen: ::c_uchar, | ||
80 | pub sll_addr: [::c_uchar; 8] | ||
81 | } | ||
82 | |||
83 | pub struct fd_set { | ||
84 | fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], | ||
85 | } | ||
86 | |||
87 | pub struct tm { | ||
88 | pub tm_sec: ::c_int, | ||
89 | pub tm_min: ::c_int, | ||
90 | pub tm_hour: ::c_int, | ||
91 | pub tm_mday: ::c_int, | ||
92 | pub tm_mon: ::c_int, | ||
93 | pub tm_year: ::c_int, | ||
94 | pub tm_wday: ::c_int, | ||
95 | pub tm_yday: ::c_int, | ||
96 | pub tm_isdst: ::c_int, | ||
97 | pub tm_gmtoff: ::c_long, | ||
98 | pub tm_zone: *const ::c_char, | ||
99 | } | ||
100 | |||
101 | pub struct sched_param { | ||
102 | pub sched_priority: ::c_int, | ||
103 | #[cfg(any(target_env = "musl"))] | ||
104 | pub sched_ss_low_priority: ::c_int, | ||
105 | #[cfg(any(target_env = "musl"))] | ||
106 | pub sched_ss_repl_period: ::timespec, | ||
107 | #[cfg(any(target_env = "musl"))] | ||
108 | pub sched_ss_init_budget: ::timespec, | ||
109 | #[cfg(any(target_env = "musl"))] | ||
110 | pub sched_ss_max_repl: ::c_int, | ||
111 | } | ||
112 | |||
113 | pub struct Dl_info { | ||
114 | pub dli_fname: *const ::c_char, | ||
115 | pub dli_fbase: *mut ::c_void, | ||
116 | pub dli_sname: *const ::c_char, | ||
117 | pub dli_saddr: *mut ::c_void, | ||
118 | } | ||
119 | |||
120 | #[cfg_attr(any(all(target_arch = "x86", not(target_env = "musl")), | ||
121 | target_arch = "x86_64"), | ||
122 | repr(packed))] | ||
123 | pub struct epoll_event { | ||
124 | pub events: ::uint32_t, | ||
125 | pub u64: ::uint64_t, | ||
126 | } | ||
127 | |||
128 | pub struct utsname { | ||
129 | pub sysname: [::c_char; 65], | ||
130 | pub nodename: [::c_char; 65], | ||
131 | pub release: [::c_char; 65], | ||
132 | pub version: [::c_char; 65], | ||
133 | pub machine: [::c_char; 65], | ||
134 | pub domainname: [::c_char; 65] | ||
135 | } | ||
136 | |||
137 | pub struct lconv { | ||
138 | pub decimal_point: *mut ::c_char, | ||
139 | pub thousands_sep: *mut ::c_char, | ||
140 | pub grouping: *mut ::c_char, | ||
141 | pub int_curr_symbol: *mut ::c_char, | ||
142 | pub currency_symbol: *mut ::c_char, | ||
143 | pub mon_decimal_point: *mut ::c_char, | ||
144 | pub mon_thousands_sep: *mut ::c_char, | ||
145 | pub mon_grouping: *mut ::c_char, | ||
146 | pub positive_sign: *mut ::c_char, | ||
147 | pub negative_sign: *mut ::c_char, | ||
148 | pub int_frac_digits: ::c_char, | ||
149 | pub frac_digits: ::c_char, | ||
150 | pub p_cs_precedes: ::c_char, | ||
151 | pub p_sep_by_space: ::c_char, | ||
152 | pub n_cs_precedes: ::c_char, | ||
153 | pub n_sep_by_space: ::c_char, | ||
154 | pub p_sign_posn: ::c_char, | ||
155 | pub n_sign_posn: ::c_char, | ||
156 | pub int_p_cs_precedes: ::c_char, | ||
157 | pub int_p_sep_by_space: ::c_char, | ||
158 | pub int_n_cs_precedes: ::c_char, | ||
159 | pub int_n_sep_by_space: ::c_char, | ||
160 | pub int_p_sign_posn: ::c_char, | ||
161 | pub int_n_sign_posn: ::c_char, | ||
162 | } | ||
163 | } | ||
164 | |||
165 | // intentionally not public, only used for fd_set | ||
166 | cfg_if! { | ||
167 | if #[cfg(target_pointer_width = "32")] { | ||
168 | const ULONG_SIZE: usize = 32; | ||
169 | } else if #[cfg(target_pointer_width = "64")] { | ||
170 | const ULONG_SIZE: usize = 64; | ||
171 | } else { | ||
172 | // Unknown target_pointer_width | ||
173 | } | ||
174 | } | ||
175 | |||
176 | pub const EXIT_FAILURE: ::c_int = 1; | ||
177 | pub const EXIT_SUCCESS: ::c_int = 0; | ||
178 | pub const RAND_MAX: ::c_int = 2147483647; | ||
179 | pub const EOF: ::c_int = -1; | ||
180 | pub const SEEK_SET: ::c_int = 0; | ||
181 | pub const SEEK_CUR: ::c_int = 1; | ||
182 | pub const SEEK_END: ::c_int = 2; | ||
183 | pub const _IOFBF: ::c_int = 0; | ||
184 | pub const _IONBF: ::c_int = 2; | ||
185 | pub const _IOLBF: ::c_int = 1; | ||
186 | |||
187 | pub const F_DUPFD: ::c_int = 0; | ||
188 | pub const F_GETFD: ::c_int = 1; | ||
189 | pub const F_SETFD: ::c_int = 2; | ||
190 | pub const F_GETFL: ::c_int = 3; | ||
191 | pub const F_SETFL: ::c_int = 4; | ||
192 | |||
193 | // Linux-specific fcntls | ||
194 | pub const F_SETLEASE: ::c_int = 1024; | ||
195 | pub const F_GETLEASE: ::c_int = 1025; | ||
196 | pub const F_NOTIFY: ::c_int = 1026; | ||
197 | pub const F_DUPFD_CLOEXEC: ::c_int = 1030; | ||
198 | pub const F_SETPIPE_SZ: ::c_int = 1031; | ||
199 | pub const F_GETPIPE_SZ: ::c_int = 1032; | ||
200 | |||
201 | // TODO(#235): Include file sealing fcntls once we have a way to verify them. | ||
202 | |||
203 | pub const SIGTRAP: ::c_int = 5; | ||
204 | |||
205 | pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; | ||
206 | pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; | ||
207 | |||
208 | pub const CLOCK_REALTIME: clockid_t = 0; | ||
209 | pub const CLOCK_MONOTONIC: clockid_t = 1; | ||
210 | pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; | ||
211 | pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; | ||
212 | pub const CLOCK_MONOTONIC_RAW: clockid_t = 4; | ||
213 | pub const CLOCK_REALTIME_COARSE: clockid_t = 5; | ||
214 | pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6; | ||
215 | pub const CLOCK_BOOTTIME: clockid_t = 7; | ||
216 | pub const CLOCK_REALTIME_ALARM: clockid_t = 8; | ||
217 | pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9; | ||
218 | // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep | ||
219 | // 2014.) See also musl/mod.rs | ||
220 | // pub const CLOCK_SGI_CYCLE: clockid_t = 10; | ||
221 | // pub const CLOCK_TAI: clockid_t = 11; | ||
222 | pub const TIMER_ABSTIME: ::c_int = 1; | ||
223 | |||
224 | pub const RLIMIT_CPU: ::c_int = 0; | ||
225 | pub const RLIMIT_FSIZE: ::c_int = 1; | ||
226 | pub const RLIMIT_DATA: ::c_int = 2; | ||
227 | pub const RLIMIT_STACK: ::c_int = 3; | ||
228 | pub const RLIMIT_CORE: ::c_int = 4; | ||
229 | pub const RLIMIT_LOCKS: ::c_int = 10; | ||
230 | pub const RLIMIT_SIGPENDING: ::c_int = 11; | ||
231 | pub const RLIMIT_MSGQUEUE: ::c_int = 12; | ||
232 | pub const RLIMIT_NICE: ::c_int = 13; | ||
233 | pub const RLIMIT_RTPRIO: ::c_int = 14; | ||
234 | |||
235 | pub const RUSAGE_SELF: ::c_int = 0; | ||
236 | |||
237 | pub const O_RDONLY: ::c_int = 0; | ||
238 | pub const O_WRONLY: ::c_int = 1; | ||
239 | pub const O_RDWR: ::c_int = 2; | ||
240 | pub const O_TRUNC: ::c_int = 512; | ||
241 | pub const O_CLOEXEC: ::c_int = 0x80000; | ||
242 | |||
243 | pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; | ||
244 | |||
245 | pub const S_IFIFO: ::mode_t = 4096; | ||
246 | pub const S_IFCHR: ::mode_t = 8192; | ||
247 | pub const S_IFBLK: ::mode_t = 24576; | ||
248 | pub const S_IFDIR: ::mode_t = 16384; | ||
249 | pub const S_IFREG: ::mode_t = 32768; | ||
250 | pub const S_IFLNK: ::mode_t = 40960; | ||
251 | pub const S_IFSOCK: ::mode_t = 49152; | ||
252 | pub const S_IFMT: ::mode_t = 61440; | ||
253 | pub const S_IRWXU: ::mode_t = 448; | ||
254 | pub const S_IXUSR: ::mode_t = 64; | ||
255 | pub const S_IWUSR: ::mode_t = 128; | ||
256 | pub const S_IRUSR: ::mode_t = 256; | ||
257 | pub const S_IRWXG: ::mode_t = 56; | ||
258 | pub const S_IXGRP: ::mode_t = 8; | ||
259 | pub const S_IWGRP: ::mode_t = 16; | ||
260 | pub const S_IRGRP: ::mode_t = 32; | ||
261 | pub const S_IRWXO: ::mode_t = 7; | ||
262 | pub const S_IXOTH: ::mode_t = 1; | ||
263 | pub const S_IWOTH: ::mode_t = 2; | ||
264 | pub const S_IROTH: ::mode_t = 4; | ||
265 | pub const F_OK: ::c_int = 0; | ||
266 | pub const R_OK: ::c_int = 4; | ||
267 | pub const W_OK: ::c_int = 2; | ||
268 | pub const X_OK: ::c_int = 1; | ||
269 | pub const STDIN_FILENO: ::c_int = 0; | ||
270 | pub const STDOUT_FILENO: ::c_int = 1; | ||
271 | pub const STDERR_FILENO: ::c_int = 2; | ||
272 | pub const SIGHUP: ::c_int = 1; | ||
273 | pub const SIGINT: ::c_int = 2; | ||
274 | pub const SIGQUIT: ::c_int = 3; | ||
275 | pub const SIGILL: ::c_int = 4; | ||
276 | pub const SIGABRT: ::c_int = 6; | ||
277 | pub const SIGFPE: ::c_int = 8; | ||
278 | pub const SIGKILL: ::c_int = 9; | ||
279 | pub const SIGSEGV: ::c_int = 11; | ||
280 | pub const SIGPIPE: ::c_int = 13; | ||
281 | pub const SIGALRM: ::c_int = 14; | ||
282 | pub const SIGTERM: ::c_int = 15; | ||
283 | |||
284 | pub const PROT_NONE: ::c_int = 0; | ||
285 | pub const PROT_READ: ::c_int = 1; | ||
286 | pub const PROT_WRITE: ::c_int = 2; | ||
287 | pub const PROT_EXEC: ::c_int = 4; | ||
288 | |||
289 | pub const LC_CTYPE: ::c_int = 0; | ||
290 | pub const LC_NUMERIC: ::c_int = 1; | ||
291 | pub const LC_TIME: ::c_int = 2; | ||
292 | pub const LC_COLLATE: ::c_int = 3; | ||
293 | pub const LC_MONETARY: ::c_int = 4; | ||
294 | pub const LC_MESSAGES: ::c_int = 5; | ||
295 | pub const LC_ALL: ::c_int = 6; | ||
296 | pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE); | ||
297 | pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC); | ||
298 | pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME); | ||
299 | pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE); | ||
300 | pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY); | ||
301 | pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES); | ||
302 | // LC_ALL_MASK defined per platform | ||
303 | |||
304 | pub const MAP_FILE: ::c_int = 0x0000; | ||
305 | pub const MAP_SHARED: ::c_int = 0x0001; | ||
306 | pub const MAP_PRIVATE: ::c_int = 0x0002; | ||
307 | pub const MAP_FIXED: ::c_int = 0x0010; | ||
308 | |||
309 | pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; | ||
310 | |||
311 | pub const MCL_CURRENT: ::c_int = 0x0001; | ||
312 | pub const MCL_FUTURE: ::c_int = 0x0002; | ||
313 | |||
314 | // MS_ flags for msync(2) | ||
315 | pub const MS_ASYNC: ::c_int = 0x0001; | ||
316 | pub const MS_INVALIDATE: ::c_int = 0x0002; | ||
317 | pub const MS_SYNC: ::c_int = 0x0004; | ||
318 | |||
319 | // MS_ flags for mount(2) | ||
320 | pub const MS_RDONLY: ::c_ulong = 0x01; | ||
321 | pub const MS_NOSUID: ::c_ulong = 0x02; | ||
322 | pub const MS_NODEV: ::c_ulong = 0x04; | ||
323 | pub const MS_NOEXEC: ::c_ulong = 0x08; | ||
324 | pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; | ||
325 | pub const MS_REMOUNT: ::c_ulong = 0x20; | ||
326 | pub const MS_MANDLOCK: ::c_ulong = 0x40; | ||
327 | pub const MS_DIRSYNC: ::c_ulong = 0x80; | ||
328 | pub const MS_NOATIME: ::c_ulong = 0x0400; | ||
329 | pub const MS_NODIRATIME: ::c_ulong = 0x0800; | ||
330 | pub const MS_BIND: ::c_ulong = 0x1000; | ||
331 | pub const MS_MOVE: ::c_ulong = 0x2000; | ||
332 | pub const MS_REC: ::c_ulong = 0x4000; | ||
333 | pub const MS_SILENT: ::c_ulong = 0x8000; | ||
334 | pub const MS_POSIXACL: ::c_ulong = 0x010000; | ||
335 | pub const MS_UNBINDABLE: ::c_ulong = 0x020000; | ||
336 | pub const MS_PRIVATE: ::c_ulong = 0x040000; | ||
337 | pub const MS_SLAVE: ::c_ulong = 0x080000; | ||
338 | pub const MS_SHARED: ::c_ulong = 0x100000; | ||
339 | pub const MS_RELATIME: ::c_ulong = 0x200000; | ||
340 | pub const MS_KERNMOUNT: ::c_ulong = 0x400000; | ||
341 | pub const MS_I_VERSION: ::c_ulong = 0x800000; | ||
342 | pub const MS_STRICTATIME: ::c_ulong = 0x1000000; | ||
343 | pub const MS_ACTIVE: ::c_ulong = 0x40000000; | ||
344 | pub const MS_NOUSER: ::c_ulong = 0x80000000; | ||
345 | pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; | ||
346 | pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; | ||
347 | pub const MS_RMT_MASK: ::c_ulong = 0x800051; | ||
348 | |||
349 | pub const EPERM: ::c_int = 1; | ||
350 | pub const ENOENT: ::c_int = 2; | ||
351 | pub const ESRCH: ::c_int = 3; | ||
352 | pub const EINTR: ::c_int = 4; | ||
353 | pub const EIO: ::c_int = 5; | ||
354 | pub const ENXIO: ::c_int = 6; | ||
355 | pub const E2BIG: ::c_int = 7; | ||
356 | pub const ENOEXEC: ::c_int = 8; | ||
357 | pub const EBADF: ::c_int = 9; | ||
358 | pub const ECHILD: ::c_int = 10; | ||
359 | pub const EAGAIN: ::c_int = 11; | ||
360 | pub const ENOMEM: ::c_int = 12; | ||
361 | pub const EACCES: ::c_int = 13; | ||
362 | pub const EFAULT: ::c_int = 14; | ||
363 | pub const ENOTBLK: ::c_int = 15; | ||
364 | pub const EBUSY: ::c_int = 16; | ||
365 | pub const EEXIST: ::c_int = 17; | ||
366 | pub const EXDEV: ::c_int = 18; | ||
367 | pub const ENODEV: ::c_int = 19; | ||
368 | pub const ENOTDIR: ::c_int = 20; | ||
369 | pub const EISDIR: ::c_int = 21; | ||
370 | pub const EINVAL: ::c_int = 22; | ||
371 | pub const ENFILE: ::c_int = 23; | ||
372 | pub const EMFILE: ::c_int = 24; | ||
373 | pub const ENOTTY: ::c_int = 25; | ||
374 | pub const ETXTBSY: ::c_int = 26; | ||
375 | pub const EFBIG: ::c_int = 27; | ||
376 | pub const ENOSPC: ::c_int = 28; | ||
377 | pub const ESPIPE: ::c_int = 29; | ||
378 | pub const EROFS: ::c_int = 30; | ||
379 | pub const EMLINK: ::c_int = 31; | ||
380 | pub const EPIPE: ::c_int = 32; | ||
381 | pub const EDOM: ::c_int = 33; | ||
382 | pub const ERANGE: ::c_int = 34; | ||
383 | pub const EWOULDBLOCK: ::c_int = EAGAIN; | ||
384 | |||
385 | pub const EBFONT: ::c_int = 59; | ||
386 | pub const ENOSTR: ::c_int = 60; | ||
387 | pub const ENODATA: ::c_int = 61; | ||
388 | pub const ETIME: ::c_int = 62; | ||
389 | pub const ENOSR: ::c_int = 63; | ||
390 | pub const ENONET: ::c_int = 64; | ||
391 | pub const ENOPKG: ::c_int = 65; | ||
392 | pub const EREMOTE: ::c_int = 66; | ||
393 | pub const ENOLINK: ::c_int = 67; | ||
394 | pub const EADV: ::c_int = 68; | ||
395 | pub const ESRMNT: ::c_int = 69; | ||
396 | pub const ECOMM: ::c_int = 70; | ||
397 | pub const EPROTO: ::c_int = 71; | ||
398 | pub const EDOTDOT: ::c_int = 73; | ||
399 | |||
400 | pub const AF_PACKET: ::c_int = 17; | ||
401 | pub const IPPROTO_RAW: ::c_int = 255; | ||
402 | |||
403 | pub const PROT_GROWSDOWN: ::c_int = 0x1000000; | ||
404 | pub const PROT_GROWSUP: ::c_int = 0x2000000; | ||
405 | |||
406 | pub const MAP_TYPE: ::c_int = 0x000f; | ||
407 | |||
408 | pub const MADV_NORMAL: ::c_int = 0; | ||
409 | pub const MADV_RANDOM: ::c_int = 1; | ||
410 | pub const MADV_SEQUENTIAL: ::c_int = 2; | ||
411 | pub const MADV_WILLNEED: ::c_int = 3; | ||
412 | pub const MADV_DONTNEED: ::c_int = 4; | ||
413 | pub const MADV_REMOVE: ::c_int = 9; | ||
414 | pub const MADV_DONTFORK: ::c_int = 10; | ||
415 | pub const MADV_DOFORK: ::c_int = 11; | ||
416 | pub const MADV_MERGEABLE: ::c_int = 12; | ||
417 | pub const MADV_UNMERGEABLE: ::c_int = 13; | ||
418 | pub const MADV_HWPOISON: ::c_int = 100; | ||
419 | |||
420 | pub const IFF_LOOPBACK: ::c_int = 0x8; | ||
421 | |||
422 | pub const AF_UNIX: ::c_int = 1; | ||
423 | pub const AF_INET: ::c_int = 2; | ||
424 | pub const AF_INET6: ::c_int = 10; | ||
425 | pub const SOCK_RAW: ::c_int = 3; | ||
426 | pub const IPPROTO_TCP: ::c_int = 6; | ||
427 | pub const IPPROTO_IP: ::c_int = 0; | ||
428 | pub const IPPROTO_IPV6: ::c_int = 41; | ||
429 | pub const IP_MULTICAST_TTL: ::c_int = 33; | ||
430 | pub const IP_MULTICAST_LOOP: ::c_int = 34; | ||
431 | pub const IP_TTL: ::c_int = 2; | ||
432 | pub const IP_HDRINCL: ::c_int = 3; | ||
433 | pub const IP_ADD_MEMBERSHIP: ::c_int = 35; | ||
434 | pub const IP_DROP_MEMBERSHIP: ::c_int = 36; | ||
435 | pub const IP_TRANSPARENT: ::c_int = 19; | ||
436 | pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; | ||
437 | pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; | ||
438 | |||
439 | pub const TCP_NODELAY: ::c_int = 1; | ||
440 | pub const TCP_MAXSEG: ::c_int = 2; | ||
441 | pub const TCP_CORK: ::c_int = 3; | ||
442 | pub const TCP_KEEPIDLE: ::c_int = 4; | ||
443 | pub const TCP_KEEPINTVL: ::c_int = 5; | ||
444 | pub const TCP_KEEPCNT: ::c_int = 6; | ||
445 | pub const TCP_SYNCNT: ::c_int = 7; | ||
446 | pub const TCP_LINGER2: ::c_int = 8; | ||
447 | pub const TCP_DEFER_ACCEPT: ::c_int = 9; | ||
448 | pub const TCP_WINDOW_CLAMP: ::c_int = 10; | ||
449 | pub const TCP_INFO: ::c_int = 11; | ||
450 | pub const TCP_QUICKACK: ::c_int = 12; | ||
451 | pub const TCP_CONGESTION: ::c_int = 13; | ||
452 | |||
453 | pub const IPV6_MULTICAST_LOOP: ::c_int = 19; | ||
454 | pub const IPV6_V6ONLY: ::c_int = 26; | ||
455 | |||
456 | pub const SO_DEBUG: ::c_int = 1; | ||
457 | |||
458 | pub const SHUT_RD: ::c_int = 0; | ||
459 | pub const SHUT_WR: ::c_int = 1; | ||
460 | pub const SHUT_RDWR: ::c_int = 2; | ||
461 | |||
462 | pub const LOCK_SH: ::c_int = 1; | ||
463 | pub const LOCK_EX: ::c_int = 2; | ||
464 | pub const LOCK_NB: ::c_int = 4; | ||
465 | pub const LOCK_UN: ::c_int = 8; | ||
466 | |||
467 | pub const SIGSTKSZ: ::size_t = 8192; | ||
468 | |||
469 | pub const SA_NODEFER: ::c_int = 0x40000000; | ||
470 | pub const SA_RESETHAND: ::c_int = 0x80000000; | ||
471 | pub const SA_RESTART: ::c_int = 0x10000000; | ||
472 | pub const SA_NOCLDSTOP: ::c_int = 0x00000001; | ||
473 | |||
474 | pub const SS_ONSTACK: ::c_int = 1; | ||
475 | pub const SS_DISABLE: ::c_int = 2; | ||
476 | |||
477 | pub const PATH_MAX: ::c_int = 4096; | ||
478 | |||
479 | pub const FD_SETSIZE: usize = 1024; | ||
480 | |||
481 | pub const EPOLLIN: ::c_int = 0x1; | ||
482 | pub const EPOLLPRI: ::c_int = 0x2; | ||
483 | pub const EPOLLOUT: ::c_int = 0x4; | ||
484 | pub const EPOLLRDNORM: ::c_int = 0x40; | ||
485 | pub const EPOLLRDBAND: ::c_int = 0x80; | ||
486 | pub const EPOLLWRNORM: ::c_int = 0x100; | ||
487 | pub const EPOLLWRBAND: ::c_int = 0x200; | ||
488 | pub const EPOLLMSG: ::c_int = 0x400; | ||
489 | pub const EPOLLERR: ::c_int = 0x8; | ||
490 | pub const EPOLLHUP: ::c_int = 0x10; | ||
491 | pub const EPOLLET: ::c_int = 0x80000000; | ||
492 | |||
493 | pub const EPOLL_CTL_ADD: ::c_int = 1; | ||
494 | pub const EPOLL_CTL_MOD: ::c_int = 3; | ||
495 | pub const EPOLL_CTL_DEL: ::c_int = 2; | ||
496 | |||
497 | pub const EPOLL_CLOEXEC: ::c_int = 0x80000; | ||
498 | |||
499 | pub const MNT_DETACH: ::c_int = 0x2; | ||
500 | pub const MNT_EXPIRE: ::c_int = 0x4; | ||
501 | |||
502 | pub const Q_GETFMT: ::c_int = 0x800004; | ||
503 | pub const Q_GETINFO: ::c_int = 0x800005; | ||
504 | pub const Q_SETINFO: ::c_int = 0x800006; | ||
505 | pub const QIF_BLIMITS: ::uint32_t = 1; | ||
506 | pub const QIF_SPACE: ::uint32_t = 2; | ||
507 | pub const QIF_ILIMITS: ::uint32_t = 4; | ||
508 | pub const QIF_INODES: ::uint32_t = 8; | ||
509 | pub const QIF_BTIME: ::uint32_t = 16; | ||
510 | pub const QIF_ITIME: ::uint32_t = 32; | ||
511 | pub const QIF_LIMITS: ::uint32_t = 5; | ||
512 | pub const QIF_USAGE: ::uint32_t = 10; | ||
513 | pub const QIF_TIMES: ::uint32_t = 48; | ||
514 | pub const QIF_ALL: ::uint32_t = 63; | ||
515 | |||
516 | pub const CBAUD: ::tcflag_t = 0o0010017; | ||
517 | |||
518 | pub const EFD_CLOEXEC: ::c_int = 0x80000; | ||
519 | |||
520 | pub const MNT_FORCE: ::c_int = 0x1; | ||
521 | |||
522 | pub const Q_SYNC: ::c_int = 0x800001; | ||
523 | pub const Q_QUOTAON: ::c_int = 0x800002; | ||
524 | pub const Q_QUOTAOFF: ::c_int = 0x800003; | ||
525 | pub const Q_GETQUOTA: ::c_int = 0x800007; | ||
526 | pub const Q_SETQUOTA: ::c_int = 0x800008; | ||
527 | |||
528 | pub const TCIOFF: ::c_int = 2; | ||
529 | pub const TCION: ::c_int = 3; | ||
530 | pub const TCOOFF: ::c_int = 0; | ||
531 | pub const TCOON: ::c_int = 1; | ||
532 | pub const TCIFLUSH: ::c_int = 0; | ||
533 | pub const TCOFLUSH: ::c_int = 1; | ||
534 | pub const TCIOFLUSH: ::c_int = 2; | ||
535 | pub const NL0: ::c_int = 0x00000000; | ||
536 | pub const NL1: ::c_int = 0x00000100; | ||
537 | pub const TAB0: ::c_int = 0x00000000; | ||
538 | pub const TAB1: ::c_int = 0x00000800; | ||
539 | pub const TAB2: ::c_int = 0x00001000; | ||
540 | pub const TAB3: ::c_int = 0x00001800; | ||
541 | pub const CR0: ::c_int = 0x00000000; | ||
542 | pub const CR1: ::c_int = 0x00000200; | ||
543 | pub const CR2: ::c_int = 0x00000400; | ||
544 | pub const CR3: ::c_int = 0x00000600; | ||
545 | pub const FF0: ::c_int = 0x00000000; | ||
546 | pub const FF1: ::c_int = 0x00008000; | ||
547 | pub const BS0: ::c_int = 0x00000000; | ||
548 | pub const BS1: ::c_int = 0x00002000; | ||
549 | pub const VT0: ::c_int = 0x00000000; | ||
550 | pub const VT1: ::c_int = 0x00004000; | ||
551 | pub const VERASE: usize = 2; | ||
552 | pub const VWERASE: usize = 14; | ||
553 | pub const VKILL: usize = 3; | ||
554 | pub const VREPRINT: usize = 12; | ||
555 | pub const VINTR: usize = 0; | ||
556 | pub const VQUIT: usize = 1; | ||
557 | pub const VSUSP: usize = 10; | ||
558 | pub const VSTART: usize = 8; | ||
559 | pub const VSTOP: usize = 9; | ||
560 | pub const VLNEXT: usize = 15; | ||
561 | pub const VDISCARD: usize = 13; | ||
562 | pub const VTIME: usize = 5; | ||
563 | pub const IGNBRK: ::tcflag_t = 0x00000001; | ||
564 | pub const BRKINT: ::tcflag_t = 0x00000002; | ||
565 | pub const IGNPAR: ::tcflag_t = 0x00000004; | ||
566 | pub const PARMRK: ::tcflag_t = 0x00000008; | ||
567 | pub const INPCK: ::tcflag_t = 0x00000010; | ||
568 | pub const ISTRIP: ::tcflag_t = 0x00000020; | ||
569 | pub const INLCR: ::tcflag_t = 0x00000040; | ||
570 | pub const IGNCR: ::tcflag_t = 0x00000080; | ||
571 | pub const ICRNL: ::tcflag_t = 0x00000100; | ||
572 | pub const IXON: ::tcflag_t = 0x00000400; | ||
573 | pub const IXOFF: ::tcflag_t = 0x00001000; | ||
574 | pub const IXANY: ::tcflag_t = 0x00000800; | ||
575 | pub const IMAXBEL: ::tcflag_t = 0x00002000; | ||
576 | pub const OPOST: ::tcflag_t = 0x1; | ||
577 | pub const ONLCR: ::tcflag_t = 0x4; | ||
578 | pub const CSIZE: ::tcflag_t = 0x00000030; | ||
579 | pub const CS5: ::tcflag_t = 0x00000000; | ||
580 | pub const CS6: ::tcflag_t = 0x00000010; | ||
581 | pub const CS7: ::tcflag_t = 0x00000020; | ||
582 | pub const CS8: ::tcflag_t = 0x00000030; | ||
583 | pub const CSTOPB: ::tcflag_t = 0x00000040; | ||
584 | pub const CREAD: ::tcflag_t = 0x00000080; | ||
585 | pub const PARENB: ::tcflag_t = 0x00000100; | ||
586 | pub const PARODD: ::tcflag_t = 0x00000200; | ||
587 | pub const HUPCL: ::tcflag_t = 0x00000400; | ||
588 | pub const CLOCAL: ::tcflag_t = 0x00000800; | ||
589 | pub const CRTSCTS: ::tcflag_t = 0x80000000; | ||
590 | pub const ECHOKE: ::tcflag_t = 0x00000800; | ||
591 | pub const ECHOE: ::tcflag_t = 0x00000010; | ||
592 | pub const ECHOK: ::tcflag_t = 0x00000020; | ||
593 | pub const ECHO: ::tcflag_t = 0x00000008; | ||
594 | pub const ECHONL: ::tcflag_t = 0x00000040; | ||
595 | pub const ECHOPRT: ::tcflag_t = 0x00000400; | ||
596 | pub const ECHOCTL: ::tcflag_t = 0x00000200; | ||
597 | pub const ISIG: ::tcflag_t = 0x00000001; | ||
598 | pub const ICANON: ::tcflag_t = 0x00000002; | ||
599 | pub const PENDIN: ::tcflag_t = 0x00004000; | ||
600 | pub const NOFLSH: ::tcflag_t = 0x00000080; | ||
601 | |||
602 | pub const CLONE_VM: ::c_int = 0x100; | ||
603 | pub const CLONE_FS: ::c_int = 0x200; | ||
604 | pub const CLONE_FILES: ::c_int = 0x400; | ||
605 | pub const CLONE_SIGHAND: ::c_int = 0x800; | ||
606 | pub const CLONE_PTRACE: ::c_int = 0x2000; | ||
607 | pub const CLONE_VFORK: ::c_int = 0x4000; | ||
608 | pub const CLONE_PARENT: ::c_int = 0x8000; | ||
609 | pub const CLONE_THREAD: ::c_int = 0x10000; | ||
610 | pub const CLONE_NEWNS: ::c_int = 0x20000; | ||
611 | pub const CLONE_SYSVSEM: ::c_int = 0x40000; | ||
612 | pub const CLONE_SETTLS: ::c_int = 0x80000; | ||
613 | pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; | ||
614 | pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; | ||
615 | pub const CLONE_DETACHED: ::c_int = 0x400000; | ||
616 | pub const CLONE_UNTRACED: ::c_int = 0x800000; | ||
617 | pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; | ||
618 | pub const CLONE_NEWUTS: ::c_int = 0x04000000; | ||
619 | pub const CLONE_NEWIPC: ::c_int = 0x08000000; | ||
620 | pub const CLONE_NEWUSER: ::c_int = 0x10000000; | ||
621 | pub const CLONE_NEWPID: ::c_int = 0x20000000; | ||
622 | pub const CLONE_NEWNET: ::c_int = 0x40000000; | ||
623 | pub const CLONE_IO: ::c_int = 0x80000000; | ||
624 | |||
625 | pub const WNOHANG: ::c_int = 0x00000001; | ||
626 | pub const WUNTRACED: ::c_int = 0x00000002; | ||
627 | pub const WSTOPPED: ::c_int = WUNTRACED; | ||
628 | pub const WEXITED: ::c_int = 0x00000004; | ||
629 | pub const WCONTINUED: ::c_int = 0x00000008; | ||
630 | pub const WNOWAIT: ::c_int = 0x01000000; | ||
631 | |||
632 | pub const __WNOTHREAD: ::c_int = 0x20000000; | ||
633 | pub const __WALL: ::c_int = 0x40000000; | ||
634 | pub const __WCLONE: ::c_int = 0x80000000; | ||
635 | |||
636 | pub const SPLICE_F_MOVE: ::c_uint = 0x01; | ||
637 | pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; | ||
638 | pub const SPLICE_F_MORE: ::c_uint = 0x04; | ||
639 | pub const SPLICE_F_GIFT: ::c_uint = 0x08; | ||
640 | |||
641 | pub const RTLD_LOCAL: ::c_int = 0; | ||
642 | |||
643 | pub const POSIX_FADV_NORMAL: ::c_int = 0; | ||
644 | pub const POSIX_FADV_RANDOM: ::c_int = 1; | ||
645 | pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; | ||
646 | pub const POSIX_FADV_WILLNEED: ::c_int = 3; | ||
647 | pub const POSIX_FADV_DONTNEED: ::c_int = 4; | ||
648 | pub const POSIX_FADV_NOREUSE: ::c_int = 5; | ||
649 | |||
650 | pub const AT_FDCWD: ::c_int = -100; | ||
651 | pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; | ||
652 | |||
653 | pub const LOG_CRON: ::c_int = 9 << 3; | ||
654 | pub const LOG_AUTHPRIV: ::c_int = 10 << 3; | ||
655 | pub const LOG_FTP: ::c_int = 11 << 3; | ||
656 | pub const LOG_PERROR: ::c_int = 0x20; | ||
657 | |||
658 | pub const PIPE_BUF: usize = 4096; | ||
659 | |||
660 | pub const SI_LOAD_SHIFT: ::c_uint = 16; | ||
661 | |||
662 | f! { | ||
663 | pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { | ||
664 | let fd = fd as usize; | ||
665 | let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; | ||
666 | (*set).fds_bits[fd / size] &= !(1 << (fd % size)); | ||
667 | return | ||
668 | } | ||
669 | |||
670 | pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { | ||
671 | let fd = fd as usize; | ||
672 | let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; | ||
673 | return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 | ||
674 | } | ||
675 | |||
676 | pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { | ||
677 | let fd = fd as usize; | ||
678 | let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; | ||
679 | (*set).fds_bits[fd / size] |= 1 << (fd % size); | ||
680 | return | ||
681 | } | ||
682 | |||
683 | pub fn FD_ZERO(set: *mut fd_set) -> () { | ||
684 | for slot in (*set).fds_bits.iter_mut() { | ||
685 | *slot = 0; | ||
686 | } | ||
687 | } | ||
688 | |||
689 | pub fn WIFSTOPPED(status: ::c_int) -> bool { | ||
690 | (status & 0xff) == 0x7f | ||
691 | } | ||
692 | |||
693 | pub fn WSTOPSIG(status: ::c_int) -> ::c_int { | ||
694 | (status >> 8) & 0xff | ||
695 | } | ||
696 | |||
697 | pub fn WIFSIGNALED(status: ::c_int) -> bool { | ||
698 | (status & 0x7f) + 1 >= 2 | ||
699 | } | ||
700 | |||
701 | pub fn WTERMSIG(status: ::c_int) -> ::c_int { | ||
702 | status & 0x7f | ||
703 | } | ||
704 | |||
705 | pub fn WIFEXITED(status: ::c_int) -> bool { | ||
706 | (status & 0x7f) == 0 | ||
707 | } | ||
708 | |||
709 | pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { | ||
710 | (status >> 8) & 0xff | ||
711 | } | ||
712 | |||
713 | pub fn WCOREDUMP(status: ::c_int) -> bool { | ||
714 | (status & 0x80) != 0 | ||
715 | } | ||
716 | } | ||
717 | |||
718 | extern { | ||
719 | pub fn getpwnam_r(name: *const ::c_char, | ||
720 | pwd: *mut passwd, | ||
721 | buf: *mut ::c_char, | ||
722 | buflen: ::size_t, | ||
723 | result: *mut *mut passwd) -> ::c_int; | ||
724 | pub fn getpwuid_r(uid: ::uid_t, | ||
725 | pwd: *mut passwd, | ||
726 | buf: *mut ::c_char, | ||
727 | buflen: ::size_t, | ||
728 | result: *mut *mut passwd) -> ::c_int; | ||
729 | pub fn fdatasync(fd: ::c_int) -> ::c_int; | ||
730 | pub fn mincore(addr: *mut ::c_void, len: ::size_t, | ||
731 | vec: *mut ::c_uchar) -> ::c_int; | ||
732 | pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
733 | pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
734 | pub fn clock_nanosleep(clk_id: clockid_t, | ||
735 | flags: ::c_int, | ||
736 | rqtp: *const ::timespec, | ||
737 | rmtp: *mut ::timespec) -> ::c_int; | ||
738 | pub fn prctl(option: ::c_int, ...) -> ::c_int; | ||
739 | pub fn pthread_getattr_np(native: ::pthread_t, | ||
740 | attr: *mut ::pthread_attr_t) -> ::c_int; | ||
741 | pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, | ||
742 | guardsize: *mut ::size_t) -> ::c_int; | ||
743 | pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, | ||
744 | stackaddr: *mut *mut ::c_void, | ||
745 | stacksize: *mut ::size_t) -> ::c_int; | ||
746 | pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; | ||
747 | pub fn setgroups(ngroups: ::size_t, | ||
748 | ptr: *const ::gid_t) -> ::c_int; | ||
749 | pub fn sched_setscheduler(pid: ::pid_t, | ||
750 | policy: ::c_int, | ||
751 | param: *const sched_param) -> ::c_int; | ||
752 | pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; | ||
753 | pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int; | ||
754 | pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; | ||
755 | pub fn epoll_create(size: ::c_int) -> ::c_int; | ||
756 | pub fn epoll_create1(flags: ::c_int) -> ::c_int; | ||
757 | pub fn epoll_ctl(epfd: ::c_int, | ||
758 | op: ::c_int, | ||
759 | fd: ::c_int, | ||
760 | event: *mut epoll_event) -> ::c_int; | ||
761 | pub fn epoll_wait(epfd: ::c_int, | ||
762 | events: *mut epoll_event, | ||
763 | maxevents: ::c_int, | ||
764 | timeout: ::c_int) -> ::c_int; | ||
765 | pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; | ||
766 | pub fn mount(src: *const ::c_char, | ||
767 | target: *const ::c_char, | ||
768 | fstype: *const ::c_char, | ||
769 | flags: ::c_ulong, | ||
770 | data: *const ::c_void) -> ::c_int; | ||
771 | pub fn umount(target: *const ::c_char) -> ::c_int; | ||
772 | pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int; | ||
773 | pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int, | ||
774 | child_stack: *mut ::c_void, | ||
775 | flags: ::c_int, | ||
776 | arg: *mut ::c_void, ...) -> ::c_int; | ||
777 | pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; | ||
778 | pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; | ||
779 | pub fn memrchr(cx: *const ::c_void, | ||
780 | c: ::c_int, | ||
781 | n: ::size_t) -> *mut ::c_void; | ||
782 | pub fn syscall(num: ::c_long, ...) -> ::c_long; | ||
783 | pub fn sendfile(out_fd: ::c_int, | ||
784 | in_fd: ::c_int, | ||
785 | offset: *mut off_t, | ||
786 | count: ::size_t) -> ::ssize_t; | ||
787 | pub fn splice(fd_in: ::c_int, | ||
788 | off_in: *mut ::loff_t, | ||
789 | fd_out: ::c_int, | ||
790 | off_out: *mut ::loff_t, | ||
791 | len: ::size_t, | ||
792 | flags: ::c_uint) -> ::ssize_t; | ||
793 | pub fn tee(fd_in: ::c_int, | ||
794 | fd_out: ::c_int, | ||
795 | len: ::size_t, | ||
796 | flags: ::c_uint) -> ::ssize_t; | ||
797 | pub fn vmsplice(fd: ::c_int, | ||
798 | iov: *const ::iovec, | ||
799 | nr_segs: ::size_t, | ||
800 | flags: ::c_uint) -> ::ssize_t; | ||
801 | |||
802 | pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, | ||
803 | advise: ::c_int) -> ::c_int; | ||
804 | pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; | ||
805 | pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, | ||
806 | times: *const ::timespec, flag: ::c_int) -> ::c_int; | ||
807 | pub fn duplocale(base: ::locale_t) -> ::locale_t; | ||
808 | pub fn freelocale(loc: ::locale_t); | ||
809 | pub fn newlocale(mask: ::c_int, | ||
810 | locale: *const ::c_char, | ||
811 | base: ::locale_t) -> ::locale_t; | ||
812 | pub fn uselocale(loc: ::locale_t) -> ::locale_t; | ||
813 | pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; | ||
814 | pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int; | ||
815 | pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int; | ||
816 | pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int; | ||
817 | pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t; | ||
818 | pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int; | ||
819 | pub fn mmap64(addr: *mut ::c_void, | ||
820 | len: ::size_t, | ||
821 | prot: ::c_int, | ||
822 | flags: ::c_int, | ||
823 | fd: ::c_int, | ||
824 | offset: off64_t) | ||
825 | -> *mut ::c_void; | ||
826 | pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; | ||
827 | pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, | ||
828 | offset: off64_t) -> ::ssize_t; | ||
829 | pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t, | ||
830 | offset: off64_t) -> ::ssize_t; | ||
831 | pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64, | ||
832 | result: *mut *mut ::dirent64) -> ::c_int; | ||
833 | pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int; | ||
834 | pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; | ||
835 | pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; | ||
836 | pub fn sysinfo (info: *mut ::sysinfo) -> ::c_int; | ||
837 | |||
838 | pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, | ||
839 | flags: ::c_int, ...) -> ::c_int; | ||
840 | pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, | ||
841 | mode: ::c_int, flags: ::c_int) -> ::c_int; | ||
842 | pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
843 | mode: ::mode_t, flags: ::c_int) -> ::c_int; | ||
844 | pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char, | ||
845 | owner: ::uid_t, group: ::gid_t, | ||
846 | flags: ::c_int) -> ::c_int; | ||
847 | pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, | ||
848 | buf: *mut stat, flags: ::c_int) -> ::c_int; | ||
849 | pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
850 | newdirfd: ::c_int, newpath: *const ::c_char, | ||
851 | flags: ::c_int) -> ::c_int; | ||
852 | pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, | ||
853 | mode: ::mode_t) -> ::c_int; | ||
854 | pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
855 | mode: ::mode_t, dev: dev_t) -> ::c_int; | ||
856 | pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
857 | buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t; | ||
858 | pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
859 | newdirfd: ::c_int, newpath: *const ::c_char) | ||
860 | -> ::c_int; | ||
861 | pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int, | ||
862 | linkpath: *const ::c_char) -> ::c_int; | ||
863 | pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
864 | flags: ::c_int) -> ::c_int; | ||
865 | pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, | ||
866 | clock_id: *mut clockid_t) -> ::c_int; | ||
867 | pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, | ||
868 | clock_id: clockid_t) -> ::c_int; | ||
869 | } | ||
870 | |||
871 | cfg_if! { | ||
872 | if #[cfg(any(target_os = "linux", | ||
873 | target_os = "emscripten"))] { | ||
874 | mod linux; | ||
875 | pub use self::linux::*; | ||
876 | } else if #[cfg(target_os = "android")] { | ||
877 | mod android; | ||
878 | pub use self::android::*; | ||
879 | } else { | ||
880 | // Unknown target_os | ||
881 | } | ||
882 | } | ||
diff --git a/third_party/libc/src/unix/solaris/mod.rs b/third_party/libc/src/unix/solaris/mod.rs new file mode 100644 index 0000000..ca8c670 --- /dev/null +++ b/third_party/libc/src/unix/solaris/mod.rs | |||
@@ -0,0 +1,1036 @@ | |||
1 | pub type c_char = i8; | ||
2 | pub type c_long = i64; | ||
3 | pub type c_ulong = u64; | ||
4 | pub type clockid_t = ::c_int; | ||
5 | |||
6 | pub type blkcnt_t = i64; | ||
7 | pub type clock_t = i64; | ||
8 | pub type daddr_t = i64; | ||
9 | pub type dev_t = u64; | ||
10 | pub type fsblkcnt_t = u64; | ||
11 | pub type fsfilcnt_t = u64; | ||
12 | pub type ino_t = i64; | ||
13 | pub type key_t = i32; | ||
14 | pub type major_t = u32; | ||
15 | pub type minor_t = u32; | ||
16 | pub type mode_t = u32; | ||
17 | pub type nlink_t = u32; | ||
18 | pub type rlim_t = u64; | ||
19 | pub type speed_t = u32; | ||
20 | pub type tcflag_t = u32; | ||
21 | pub type time_t = i64; | ||
22 | pub type wchar_t = i32; | ||
23 | pub type nfds_t = ::c_ulong; | ||
24 | |||
25 | pub type suseconds_t = ::c_long; | ||
26 | pub type off_t = i64; | ||
27 | pub type useconds_t = ::c_uint; | ||
28 | pub type socklen_t = u32; | ||
29 | pub type sa_family_t = u8; | ||
30 | pub type pthread_t = ::uintptr_t; | ||
31 | pub type pthread_key_t = ::c_uint; | ||
32 | pub type blksize_t = u32; | ||
33 | pub type fflags_t = u32; | ||
34 | pub type nl_item = ::c_int; | ||
35 | |||
36 | pub enum timezone {} | ||
37 | |||
38 | s! { | ||
39 | pub struct sockaddr { | ||
40 | pub sa_family: sa_family_t, | ||
41 | pub sa_data: [::c_char; 14], | ||
42 | } | ||
43 | |||
44 | pub struct sockaddr_in { | ||
45 | pub sin_family: sa_family_t, | ||
46 | pub sin_port: ::in_port_t, | ||
47 | pub sin_addr: ::in_addr, | ||
48 | pub sin_zero: [::c_char; 8] | ||
49 | } | ||
50 | |||
51 | pub struct sockaddr_in6 { | ||
52 | pub sin6_family: sa_family_t, | ||
53 | pub sin6_port: ::in_port_t, | ||
54 | pub sin6_flowinfo: u32, | ||
55 | pub sin6_addr: ::in6_addr, | ||
56 | pub sin6_scope_id: u32, | ||
57 | pub __sin6_src_id: u32 | ||
58 | } | ||
59 | |||
60 | pub struct sockaddr_un { | ||
61 | pub sun_family: sa_family_t, | ||
62 | pub sun_path: [c_char; 108] | ||
63 | } | ||
64 | |||
65 | pub struct passwd { | ||
66 | pub pw_name: *mut ::c_char, | ||
67 | pub pw_passwd: *mut ::c_char, | ||
68 | pub pw_uid: ::uid_t, | ||
69 | pub pw_gid: ::gid_t, | ||
70 | pub pw_age: *mut ::c_char, | ||
71 | pub pw_comment: *mut ::c_char, | ||
72 | pub pw_gecos: *mut ::c_char, | ||
73 | pub pw_dir: *mut ::c_char, | ||
74 | pub pw_shell: *mut ::c_char | ||
75 | } | ||
76 | |||
77 | pub struct ifaddrs { | ||
78 | pub ifa_next: *mut ifaddrs, | ||
79 | pub ifa_name: *mut ::c_char, | ||
80 | pub ifa_flags: ::c_ulong, | ||
81 | pub ifa_addr: *mut ::sockaddr, | ||
82 | pub ifa_netmask: *mut ::sockaddr, | ||
83 | pub ifa_dstaddr: *mut ::sockaddr, | ||
84 | pub ifa_data: *mut ::c_void | ||
85 | } | ||
86 | |||
87 | pub struct tm { | ||
88 | pub tm_sec: ::c_int, | ||
89 | pub tm_min: ::c_int, | ||
90 | pub tm_hour: ::c_int, | ||
91 | pub tm_mday: ::c_int, | ||
92 | pub tm_mon: ::c_int, | ||
93 | pub tm_year: ::c_int, | ||
94 | pub tm_wday: ::c_int, | ||
95 | pub tm_yday: ::c_int, | ||
96 | pub tm_isdst: ::c_int | ||
97 | } | ||
98 | |||
99 | pub struct utsname { | ||
100 | pub sysname: [::c_char; 257], | ||
101 | pub nodename: [::c_char; 257], | ||
102 | pub release: [::c_char; 257], | ||
103 | pub version: [::c_char; 257], | ||
104 | pub machine: [::c_char; 257], | ||
105 | } | ||
106 | |||
107 | pub struct msghdr { | ||
108 | pub msg_name: *mut ::c_void, | ||
109 | pub msg_namelen: ::socklen_t, | ||
110 | pub msg_iov: *mut ::iovec, | ||
111 | pub msg_iovlen: ::c_int, | ||
112 | pub msg_control: *mut ::c_void, | ||
113 | pub msg_controllen: ::socklen_t, | ||
114 | pub msg_flags: ::c_int, | ||
115 | } | ||
116 | |||
117 | pub struct fd_set { | ||
118 | fds_bits: [i32; FD_SETSIZE / 32], | ||
119 | } | ||
120 | |||
121 | pub struct pthread_attr_t { | ||
122 | __pthread_attrp: *mut ::c_void | ||
123 | } | ||
124 | |||
125 | pub struct pthread_mutex_t { | ||
126 | __pthread_mutex_flag1: u16, | ||
127 | __pthread_mutex_flag2: u8, | ||
128 | __pthread_mutex_ceiling: u8, | ||
129 | __pthread_mutex_type: u16, | ||
130 | __pthread_mutex_magic: u16, | ||
131 | __pthread_mutex_lock: u64, | ||
132 | __pthread_mutex_data: u64 | ||
133 | } | ||
134 | |||
135 | pub struct pthread_mutexattr_t { | ||
136 | __pthread_mutexattrp: *mut ::c_void | ||
137 | } | ||
138 | |||
139 | pub struct pthread_cond_t { | ||
140 | __pthread_cond_flag: [u8; 4], | ||
141 | __pthread_cond_type: u16, | ||
142 | __pthread_cond_magic: u16, | ||
143 | __pthread_cond_data: u64 | ||
144 | } | ||
145 | |||
146 | pub struct pthread_condattr_t { | ||
147 | __pthread_condattrp: *mut ::c_void, | ||
148 | } | ||
149 | |||
150 | pub struct pthread_rwlock_t { | ||
151 | __pthread_rwlock_readers: i32, | ||
152 | __pthread_rwlock_type: u16, | ||
153 | __pthread_rwlock_magic: u16, | ||
154 | __pthread_rwlock_mutex: ::pthread_mutex_t, | ||
155 | __pthread_rwlock_readercv: ::pthread_cond_t, | ||
156 | __pthread_rwlock_writercv: ::pthread_cond_t | ||
157 | } | ||
158 | |||
159 | pub struct dirent { | ||
160 | pub d_ino: ::ino_t, | ||
161 | pub d_off: ::off_t, | ||
162 | pub d_reclen: u16, | ||
163 | pub d_name: [::c_char; 1] | ||
164 | } | ||
165 | |||
166 | pub struct glob_t { | ||
167 | pub gl_pathc: ::size_t, | ||
168 | pub gl_pathv: *mut *mut ::c_char, | ||
169 | pub gl_offs: ::size_t, | ||
170 | __unused1: *mut ::c_void, | ||
171 | __unused2: ::c_int, | ||
172 | __unused3: ::c_int, | ||
173 | __unused4: ::c_int, | ||
174 | __unused5: *mut ::c_void, | ||
175 | __unused6: *mut ::c_void, | ||
176 | __unused7: *mut ::c_void, | ||
177 | __unused8: *mut ::c_void, | ||
178 | __unused9: *mut ::c_void, | ||
179 | __unused10: *mut ::c_void, | ||
180 | } | ||
181 | |||
182 | pub struct sockaddr_storage { | ||
183 | pub ss_family: ::sa_family_t, | ||
184 | __ss_pad1: [u8; 6], | ||
185 | __ss_align: i64, | ||
186 | __ss_pad2: [u8; 240], | ||
187 | } | ||
188 | |||
189 | pub struct addrinfo { | ||
190 | pub ai_flags: ::c_int, | ||
191 | pub ai_family: ::c_int, | ||
192 | pub ai_socktype: ::c_int, | ||
193 | pub ai_protocol: ::c_int, | ||
194 | pub ai_addrlen: ::socklen_t, | ||
195 | pub ai_canonname: *mut ::c_char, | ||
196 | pub ai_addr: *mut ::sockaddr, | ||
197 | pub ai_next: *mut addrinfo, | ||
198 | } | ||
199 | |||
200 | pub struct sigset_t { | ||
201 | bits: [u32; 4], | ||
202 | } | ||
203 | |||
204 | pub struct siginfo_t { | ||
205 | pub si_signo: ::c_int, | ||
206 | pub si_code: ::c_int, | ||
207 | pub si_errno: ::c_int, | ||
208 | pub si_pad: ::c_int, | ||
209 | pub si_addr: *mut ::c_void, | ||
210 | __pad: [u8; 232], | ||
211 | } | ||
212 | |||
213 | pub struct sigaction { | ||
214 | pub sa_flags: ::c_int, | ||
215 | pub sa_sigaction: ::sighandler_t, | ||
216 | pub sa_mask: sigset_t, | ||
217 | } | ||
218 | |||
219 | pub struct stack_t { | ||
220 | pub ss_sp: *mut ::c_void, | ||
221 | pub ss_size: ::size_t, | ||
222 | pub ss_flags: ::c_int, | ||
223 | } | ||
224 | |||
225 | pub struct statvfs { | ||
226 | pub f_bsize: ::c_ulong, | ||
227 | pub f_frsize: ::c_ulong, | ||
228 | pub f_blocks: ::fsblkcnt_t, | ||
229 | pub f_bfree: ::fsblkcnt_t, | ||
230 | pub f_bavail: ::fsblkcnt_t, | ||
231 | pub f_files: ::fsfilcnt_t, | ||
232 | pub f_ffree: ::fsfilcnt_t, | ||
233 | pub f_favail: ::fsfilcnt_t, | ||
234 | pub f_fsid: ::c_ulong, | ||
235 | pub f_basetype: [::c_char; 16], | ||
236 | pub f_flag: ::c_ulong, | ||
237 | pub f_namemax: ::c_ulong, | ||
238 | pub f_fstr: [::c_char; 32] | ||
239 | } | ||
240 | |||
241 | pub struct sched_param { | ||
242 | pub sched_priority: ::c_int, | ||
243 | sched_pad: [::c_int; 8] | ||
244 | } | ||
245 | |||
246 | pub struct Dl_info { | ||
247 | pub dli_fname: *const ::c_char, | ||
248 | pub dli_fbase: *mut ::c_void, | ||
249 | pub dli_sname: *const ::c_char, | ||
250 | pub dli_saddr: *mut ::c_void, | ||
251 | } | ||
252 | |||
253 | pub struct stat { | ||
254 | pub st_dev: ::dev_t, | ||
255 | pub st_ino: ::ino_t, | ||
256 | pub st_mode: ::mode_t, | ||
257 | pub st_nlink: ::nlink_t, | ||
258 | pub st_uid: ::uid_t, | ||
259 | pub st_gid: ::gid_t, | ||
260 | pub st_rdev: ::dev_t, | ||
261 | pub st_size: ::off_t, | ||
262 | pub st_atime: ::time_t, | ||
263 | pub st_atime_nsec: ::c_long, | ||
264 | pub st_mtime: ::time_t, | ||
265 | pub st_mtime_nsec: ::c_long, | ||
266 | pub st_ctime: ::time_t, | ||
267 | pub st_ctime_nsec: ::c_long, | ||
268 | pub st_blksize: ::blksize_t, | ||
269 | pub st_blocks: ::blkcnt_t, | ||
270 | __unused: [::c_char; 16] | ||
271 | } | ||
272 | |||
273 | pub struct termios { | ||
274 | pub c_iflag: ::tcflag_t, | ||
275 | pub c_oflag: ::tcflag_t, | ||
276 | pub c_cflag: ::tcflag_t, | ||
277 | pub c_lflag: ::tcflag_t, | ||
278 | pub c_cc: [::cc_t; ::NCCS] | ||
279 | } | ||
280 | |||
281 | pub struct lconv { | ||
282 | pub decimal_point: *mut ::c_char, | ||
283 | pub thousands_sep: *mut ::c_char, | ||
284 | pub grouping: *mut ::c_char, | ||
285 | pub int_curr_symbol: *mut ::c_char, | ||
286 | pub currency_symbol: *mut ::c_char, | ||
287 | pub mon_decimal_point: *mut ::c_char, | ||
288 | pub mon_thousands_sep: *mut ::c_char, | ||
289 | pub mon_grouping: *mut ::c_char, | ||
290 | pub positive_sign: *mut ::c_char, | ||
291 | pub negative_sign: *mut ::c_char, | ||
292 | pub int_frac_digits: ::c_char, | ||
293 | pub frac_digits: ::c_char, | ||
294 | pub p_cs_precedes: ::c_char, | ||
295 | pub p_sep_by_space: ::c_char, | ||
296 | pub n_cs_precedes: ::c_char, | ||
297 | pub n_sep_by_space: ::c_char, | ||
298 | pub p_sign_posn: ::c_char, | ||
299 | pub n_sign_posn: ::c_char, | ||
300 | pub int_p_cs_precedes: ::c_char, | ||
301 | pub int_p_sep_by_space: ::c_char, | ||
302 | pub int_n_cs_precedes: ::c_char, | ||
303 | pub int_n_sep_by_space: ::c_char, | ||
304 | pub int_p_sign_posn: ::c_char, | ||
305 | pub int_n_sign_posn: ::c_char, | ||
306 | } | ||
307 | |||
308 | pub struct sem_t { | ||
309 | pub sem_count: u32, | ||
310 | pub sem_type: u16, | ||
311 | pub sem_magic: u16, | ||
312 | pub sem_pad1: [u64; 3], | ||
313 | pub sem_pad2: [u64; 2] | ||
314 | } | ||
315 | |||
316 | pub struct flock { | ||
317 | pub l_type: ::c_short, | ||
318 | pub l_whence: ::c_short, | ||
319 | pub l_start: ::off_t, | ||
320 | pub l_len: ::off_t, | ||
321 | pub l_sysid: ::c_int, | ||
322 | pub l_pid: ::pid_t, | ||
323 | pub l_pad: [::c_long; 4] | ||
324 | } | ||
325 | |||
326 | pub struct if_nameindex { | ||
327 | pub if_index: ::c_uint, | ||
328 | pub if_name: *mut ::c_char, | ||
329 | } | ||
330 | } | ||
331 | |||
332 | pub const LC_CTYPE: ::c_int = 0; | ||
333 | pub const LC_NUMERIC: ::c_int = 1; | ||
334 | pub const LC_TIME: ::c_int = 2; | ||
335 | pub const LC_COLLATE: ::c_int = 3; | ||
336 | pub const LC_MONETARY: ::c_int = 4; | ||
337 | pub const LC_MESSAGES: ::c_int = 5; | ||
338 | pub const LC_ALL: ::c_int = 6; | ||
339 | pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE); | ||
340 | pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC); | ||
341 | pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME); | ||
342 | pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE); | ||
343 | pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY); | ||
344 | pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES); | ||
345 | pub const LC_ALL_MASK: ::c_int = LC_CTYPE_MASK | ||
346 | | LC_NUMERIC_MASK | ||
347 | | LC_TIME_MASK | ||
348 | | LC_COLLATE_MASK | ||
349 | | LC_MONETARY_MASK | ||
350 | | LC_MESSAGES_MASK; | ||
351 | |||
352 | pub const DAY_1: ::nl_item = 1; | ||
353 | pub const DAY_2: ::nl_item = 2; | ||
354 | pub const DAY_3: ::nl_item = 3; | ||
355 | pub const DAY_4: ::nl_item = 4; | ||
356 | pub const DAY_5: ::nl_item = 5; | ||
357 | pub const DAY_6: ::nl_item = 6; | ||
358 | pub const DAY_7: ::nl_item = 7; | ||
359 | |||
360 | pub const ABDAY_1: ::nl_item = 8; | ||
361 | pub const ABDAY_2: ::nl_item = 9; | ||
362 | pub const ABDAY_3: ::nl_item = 10; | ||
363 | pub const ABDAY_4: ::nl_item = 11; | ||
364 | pub const ABDAY_5: ::nl_item = 12; | ||
365 | pub const ABDAY_6: ::nl_item = 13; | ||
366 | pub const ABDAY_7: ::nl_item = 14; | ||
367 | |||
368 | pub const MON_1: ::nl_item = 15; | ||
369 | pub const MON_2: ::nl_item = 16; | ||
370 | pub const MON_3: ::nl_item = 17; | ||
371 | pub const MON_4: ::nl_item = 18; | ||
372 | pub const MON_5: ::nl_item = 19; | ||
373 | pub const MON_6: ::nl_item = 20; | ||
374 | pub const MON_7: ::nl_item = 21; | ||
375 | pub const MON_8: ::nl_item = 22; | ||
376 | pub const MON_9: ::nl_item = 23; | ||
377 | pub const MON_10: ::nl_item = 24; | ||
378 | pub const MON_11: ::nl_item = 25; | ||
379 | pub const MON_12: ::nl_item = 26; | ||
380 | |||
381 | pub const ABMON_1: ::nl_item = 27; | ||
382 | pub const ABMON_2: ::nl_item = 28; | ||
383 | pub const ABMON_3: ::nl_item = 29; | ||
384 | pub const ABMON_4: ::nl_item = 30; | ||
385 | pub const ABMON_5: ::nl_item = 31; | ||
386 | pub const ABMON_6: ::nl_item = 32; | ||
387 | pub const ABMON_7: ::nl_item = 33; | ||
388 | pub const ABMON_8: ::nl_item = 34; | ||
389 | pub const ABMON_9: ::nl_item = 35; | ||
390 | pub const ABMON_10: ::nl_item = 36; | ||
391 | pub const ABMON_11: ::nl_item = 37; | ||
392 | pub const ABMON_12: ::nl_item = 38; | ||
393 | |||
394 | pub const RADIXCHAR: ::nl_item = 39; | ||
395 | pub const THOUSEP: ::nl_item = 40; | ||
396 | pub const YESSTR: ::nl_item = 41; | ||
397 | pub const NOSTR: ::nl_item = 42; | ||
398 | pub const CRNCYSTR: ::nl_item = 43; | ||
399 | |||
400 | pub const D_T_FMT: ::nl_item = 44; | ||
401 | pub const D_FMT: ::nl_item = 45; | ||
402 | pub const T_FMT: ::nl_item = 46; | ||
403 | pub const AM_STR: ::nl_item = 47; | ||
404 | pub const PM_STR: ::nl_item = 48; | ||
405 | |||
406 | pub const CODESET: ::nl_item = 49; | ||
407 | pub const T_FMT_AMPM: ::nl_item = 50; | ||
408 | pub const ERA: ::nl_item = 51; | ||
409 | pub const ERA_D_FMT: ::nl_item = 52; | ||
410 | pub const ERA_D_T_FMT: ::nl_item = 53; | ||
411 | pub const ERA_T_FMT: ::nl_item = 54; | ||
412 | pub const ALT_DIGITS: ::nl_item = 55; | ||
413 | pub const YESEXPR: ::nl_item = 56; | ||
414 | pub const NOEXPR: ::nl_item = 57; | ||
415 | pub const _DATE_FMT: ::nl_item = 58; | ||
416 | pub const MAXSTRMSG: ::nl_item = 58; | ||
417 | |||
418 | pub const PATH_MAX: ::c_int = 1024; | ||
419 | |||
420 | pub const SA_ONSTACK: ::c_int = 0x00000001; | ||
421 | pub const SA_RESETHAND: ::c_int = 0x00000002; | ||
422 | pub const SA_RESTART: ::c_int = 0x00000004; | ||
423 | pub const SA_SIGINFO: ::c_int = 0x00000008; | ||
424 | pub const SA_NODEFER: ::c_int = 0x00000010; | ||
425 | pub const SA_NOCLDWAIT: ::c_int = 0x00010000; | ||
426 | pub const SA_NOCLDSTOP: ::c_int = 0x00020000; | ||
427 | |||
428 | pub const SS_ONSTACK: ::c_int = 1; | ||
429 | pub const SS_DISABLE: ::c_int = 2; | ||
430 | |||
431 | pub const FIONBIO: ::c_int = 0x8004667e; | ||
432 | |||
433 | pub const SIGCHLD: ::c_int = 18; | ||
434 | pub const SIGBUS: ::c_int = 10; | ||
435 | pub const SIG_BLOCK: ::c_int = 1; | ||
436 | pub const SIG_UNBLOCK: ::c_int = 2; | ||
437 | pub const SIG_SETMASK: ::c_int = 3; | ||
438 | |||
439 | pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8; | ||
440 | pub const IPV6_V6ONLY: ::c_int = 0x27; | ||
441 | |||
442 | pub const FD_SETSIZE: usize = 1024; | ||
443 | |||
444 | pub const ST_RDONLY: ::c_ulong = 1; | ||
445 | pub const ST_NOSUID: ::c_ulong = 2; | ||
446 | |||
447 | pub const NI_MAXHOST: ::socklen_t = 1025; | ||
448 | |||
449 | pub const EXIT_FAILURE: ::c_int = 1; | ||
450 | pub const EXIT_SUCCESS: ::c_int = 0; | ||
451 | pub const RAND_MAX: ::c_int = 32767; | ||
452 | pub const EOF: ::c_int = -1; | ||
453 | pub const SEEK_SET: ::c_int = 0; | ||
454 | pub const SEEK_CUR: ::c_int = 1; | ||
455 | pub const SEEK_END: ::c_int = 2; | ||
456 | pub const _IOFBF: ::c_int = 0; | ||
457 | pub const _IONBF: ::c_int = 4; | ||
458 | pub const _IOLBF: ::c_int = 64; | ||
459 | pub const BUFSIZ: ::c_uint = 1024; | ||
460 | pub const FOPEN_MAX: ::c_uint = 20; | ||
461 | pub const FILENAME_MAX: ::c_uint = 1024; | ||
462 | pub const L_tmpnam: ::c_uint = 25; | ||
463 | pub const TMP_MAX: ::c_uint = 17576; | ||
464 | |||
465 | pub const O_RDONLY: ::c_int = 0; | ||
466 | pub const O_WRONLY: ::c_int = 1; | ||
467 | pub const O_RDWR: ::c_int = 2; | ||
468 | pub const O_APPEND: ::c_int = 8; | ||
469 | pub const O_CREAT: ::c_int = 256; | ||
470 | pub const O_EXCL: ::c_int = 1024; | ||
471 | pub const O_NOCTTY: ::c_int = 2048; | ||
472 | pub const O_TRUNC: ::c_int = 512; | ||
473 | pub const O_CLOEXEC: ::c_int = 0x800000; | ||
474 | pub const O_ACCMODE: ::c_int = 0x600003; | ||
475 | pub const S_IFIFO: mode_t = 4096; | ||
476 | pub const S_IFCHR: mode_t = 8192; | ||
477 | pub const S_IFBLK: mode_t = 24576; | ||
478 | pub const S_IFDIR: mode_t = 16384; | ||
479 | pub const S_IFREG: mode_t = 32768; | ||
480 | pub const S_IFLNK: mode_t = 40960; | ||
481 | pub const S_IFSOCK: mode_t = 49152; | ||
482 | pub const S_IFMT: mode_t = 61440; | ||
483 | pub const S_IEXEC: mode_t = 64; | ||
484 | pub const S_IWRITE: mode_t = 128; | ||
485 | pub const S_IREAD: mode_t = 256; | ||
486 | pub const S_IRWXU: mode_t = 448; | ||
487 | pub const S_IXUSR: mode_t = 64; | ||
488 | pub const S_IWUSR: mode_t = 128; | ||
489 | pub const S_IRUSR: mode_t = 256; | ||
490 | pub const S_IRWXG: mode_t = 56; | ||
491 | pub const S_IXGRP: mode_t = 8; | ||
492 | pub const S_IWGRP: mode_t = 16; | ||
493 | pub const S_IRGRP: mode_t = 32; | ||
494 | pub const S_IRWXO: mode_t = 7; | ||
495 | pub const S_IXOTH: mode_t = 1; | ||
496 | pub const S_IWOTH: mode_t = 2; | ||
497 | pub const S_IROTH: mode_t = 4; | ||
498 | pub const F_OK: ::c_int = 0; | ||
499 | pub const R_OK: ::c_int = 4; | ||
500 | pub const W_OK: ::c_int = 2; | ||
501 | pub const X_OK: ::c_int = 1; | ||
502 | pub const STDIN_FILENO: ::c_int = 0; | ||
503 | pub const STDOUT_FILENO: ::c_int = 1; | ||
504 | pub const STDERR_FILENO: ::c_int = 2; | ||
505 | pub const F_LOCK: ::c_int = 1; | ||
506 | pub const F_TEST: ::c_int = 3; | ||
507 | pub const F_TLOCK: ::c_int = 2; | ||
508 | pub const F_ULOCK: ::c_int = 0; | ||
509 | pub const F_DUPFD_CLOEXEC: ::c_int = 37; | ||
510 | pub const F_SETLK: ::c_int = 6; | ||
511 | pub const F_SETLKW: ::c_int = 7; | ||
512 | pub const F_GETLK: ::c_int = 14; | ||
513 | pub const SIGHUP: ::c_int = 1; | ||
514 | pub const SIGINT: ::c_int = 2; | ||
515 | pub const SIGQUIT: ::c_int = 3; | ||
516 | pub const SIGILL: ::c_int = 4; | ||
517 | pub const SIGABRT: ::c_int = 6; | ||
518 | pub const SIGEMT: ::c_int = 7; | ||
519 | pub const SIGFPE: ::c_int = 8; | ||
520 | pub const SIGKILL: ::c_int = 9; | ||
521 | pub const SIGSEGV: ::c_int = 11; | ||
522 | pub const SIGSYS: ::c_int = 12; | ||
523 | pub const SIGPIPE: ::c_int = 13; | ||
524 | pub const SIGALRM: ::c_int = 14; | ||
525 | pub const SIGTERM: ::c_int = 15; | ||
526 | pub const SIGUSR1: ::c_int = 16; | ||
527 | pub const SIGUSR2: ::c_int = 17; | ||
528 | pub const SIGPWR: ::c_int = 19; | ||
529 | pub const SIGWINCH: ::c_int = 20; | ||
530 | pub const SIGURG: ::c_int = 21; | ||
531 | pub const SIGPOLL: ::c_int = 22; | ||
532 | pub const SIGIO: ::c_int = SIGPOLL; | ||
533 | pub const SIGSTOP: ::c_int = 23; | ||
534 | pub const SIGTSTP: ::c_int = 24; | ||
535 | pub const SIGCONT: ::c_int = 25; | ||
536 | pub const SIGTTIN: ::c_int = 26; | ||
537 | pub const SIGTTOU: ::c_int = 27; | ||
538 | pub const SIGVTALRM: ::c_int = 28; | ||
539 | pub const SIGPROF: ::c_int = 29; | ||
540 | pub const SIGXCPU: ::c_int = 30; | ||
541 | pub const SIGXFSZ: ::c_int = 31; | ||
542 | |||
543 | pub const WNOHANG: ::c_int = 0x40; | ||
544 | |||
545 | pub const PROT_NONE: ::c_int = 0; | ||
546 | pub const PROT_READ: ::c_int = 1; | ||
547 | pub const PROT_WRITE: ::c_int = 2; | ||
548 | pub const PROT_EXEC: ::c_int = 4; | ||
549 | |||
550 | pub const MAP_SHARED: ::c_int = 0x0001; | ||
551 | pub const MAP_PRIVATE: ::c_int = 0x0002; | ||
552 | pub const MAP_FIXED: ::c_int = 0x0010; | ||
553 | pub const MAP_NORESERVE: ::c_int = 0x40; | ||
554 | pub const MAP_ANON: ::c_int = 0x0100; | ||
555 | pub const MAP_RENAME: ::c_int = 0x20; | ||
556 | pub const MAP_ALIGN: ::c_int = 0x200; | ||
557 | pub const MAP_TEXT: ::c_int = 0x400; | ||
558 | pub const MAP_INITDATA: ::c_int = 0x800; | ||
559 | pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; | ||
560 | |||
561 | pub const MCL_CURRENT: ::c_int = 0x0001; | ||
562 | pub const MCL_FUTURE: ::c_int = 0x0002; | ||
563 | |||
564 | pub const MS_SYNC: ::c_int = 0x0004; | ||
565 | pub const MS_ASYNC: ::c_int = 0x0001; | ||
566 | pub const MS_INVALIDATE: ::c_int = 0x0002; | ||
567 | pub const MS_INVALCURPROC: ::c_int = 0x0008; | ||
568 | |||
569 | pub const EPERM: ::c_int = 1; | ||
570 | pub const ENOENT: ::c_int = 2; | ||
571 | pub const ESRCH: ::c_int = 3; | ||
572 | pub const EINTR: ::c_int = 4; | ||
573 | pub const EIO: ::c_int = 5; | ||
574 | pub const ENXIO: ::c_int = 6; | ||
575 | pub const E2BIG: ::c_int = 7; | ||
576 | pub const ENOEXEC: ::c_int = 8; | ||
577 | pub const EBADF: ::c_int = 9; | ||
578 | pub const ECHILD: ::c_int = 10; | ||
579 | pub const EDEADLK: ::c_int = 45; | ||
580 | pub const ENOMEM: ::c_int = 12; | ||
581 | pub const EACCES: ::c_int = 13; | ||
582 | pub const EFAULT: ::c_int = 14; | ||
583 | pub const ENOTBLK: ::c_int = 15; | ||
584 | pub const EBUSY: ::c_int = 16; | ||
585 | pub const EEXIST: ::c_int = 17; | ||
586 | pub const EXDEV: ::c_int = 18; | ||
587 | pub const ENODEV: ::c_int = 19; | ||
588 | pub const ENOTDIR: ::c_int = 20; | ||
589 | pub const EISDIR: ::c_int = 21; | ||
590 | pub const EINVAL: ::c_int = 22; | ||
591 | pub const ENFILE: ::c_int = 23; | ||
592 | pub const EMFILE: ::c_int = 24; | ||
593 | pub const ENOTTY: ::c_int = 25; | ||
594 | pub const ETXTBSY: ::c_int = 26; | ||
595 | pub const EFBIG: ::c_int = 27; | ||
596 | pub const ENOSPC: ::c_int = 28; | ||
597 | pub const ESPIPE: ::c_int = 29; | ||
598 | pub const EROFS: ::c_int = 30; | ||
599 | pub const EMLINK: ::c_int = 31; | ||
600 | pub const EPIPE: ::c_int = 32; | ||
601 | pub const EDOM: ::c_int = 33; | ||
602 | pub const ERANGE: ::c_int = 34; | ||
603 | pub const EAGAIN: ::c_int = 11; | ||
604 | pub const EWOULDBLOCK: ::c_int = 11; | ||
605 | pub const EINPROGRESS: ::c_int = 150; | ||
606 | pub const EALREADY: ::c_int = 149; | ||
607 | pub const ENOTSOCK: ::c_int = 95; | ||
608 | pub const EDESTADDRREQ: ::c_int = 96; | ||
609 | pub const EMSGSIZE: ::c_int = 97; | ||
610 | pub const EPROTOTYPE: ::c_int = 98; | ||
611 | pub const ENOPROTOOPT: ::c_int = 99; | ||
612 | pub const EPROTONOSUPPORT: ::c_int = 120; | ||
613 | pub const ESOCKTNOSUPPORT: ::c_int = 121; | ||
614 | pub const EOPNOTSUPP: ::c_int = 122; | ||
615 | pub const EPFNOSUPPORT: ::c_int = 123; | ||
616 | pub const EAFNOSUPPORT: ::c_int = 124; | ||
617 | pub const EADDRINUSE: ::c_int = 125; | ||
618 | pub const EADDRNOTAVAIL: ::c_int = 126; | ||
619 | pub const ENETDOWN: ::c_int = 127; | ||
620 | pub const ENETUNREACH: ::c_int = 128; | ||
621 | pub const ENETRESET: ::c_int = 129; | ||
622 | pub const ECONNABORTED: ::c_int = 130; | ||
623 | pub const ECONNRESET: ::c_int = 131; | ||
624 | pub const ENOBUFS: ::c_int = 132; | ||
625 | pub const EISCONN: ::c_int = 133; | ||
626 | pub const ENOTCONN: ::c_int = 134; | ||
627 | pub const ESHUTDOWN: ::c_int = 143; | ||
628 | pub const ETOOMANYREFS: ::c_int = 144; | ||
629 | pub const ETIMEDOUT: ::c_int = 145; | ||
630 | pub const ECONNREFUSED: ::c_int = 146; | ||
631 | pub const ELOOP: ::c_int = 90; | ||
632 | pub const ENAMETOOLONG: ::c_int = 78; | ||
633 | pub const EHOSTDOWN: ::c_int = 147; | ||
634 | pub const EHOSTUNREACH: ::c_int = 148; | ||
635 | pub const ENOTEMPTY: ::c_int = 93; | ||
636 | pub const EUSERS: ::c_int = 94; | ||
637 | pub const EDQUOT: ::c_int = 49; | ||
638 | pub const ESTALE: ::c_int = 151; | ||
639 | pub const EREMOTE: ::c_int = 66; | ||
640 | pub const ENOLCK: ::c_int = 46; | ||
641 | pub const ENOSYS: ::c_int = 89; | ||
642 | pub const EIDRM: ::c_int = 36; | ||
643 | pub const ENOMSG: ::c_int = 35; | ||
644 | pub const EOVERFLOW: ::c_int = 79; | ||
645 | pub const ECANCELED: ::c_int = 47; | ||
646 | pub const EILSEQ: ::c_int = 88; | ||
647 | pub const EBADMSG: ::c_int = 77; | ||
648 | pub const EMULTIHOP: ::c_int = 74; | ||
649 | pub const ENOLINK: ::c_int = 67; | ||
650 | pub const EPROTO: ::c_int = 71; | ||
651 | |||
652 | pub const F_DUPFD: ::c_int = 0; | ||
653 | pub const F_GETFD: ::c_int = 1; | ||
654 | pub const F_SETFD: ::c_int = 2; | ||
655 | pub const F_GETFL: ::c_int = 3; | ||
656 | pub const F_SETFL: ::c_int = 4; | ||
657 | |||
658 | pub const SIGTRAP: ::c_int = 5; | ||
659 | |||
660 | pub const GLOB_APPEND : ::c_int = 32; | ||
661 | pub const GLOB_DOOFFS : ::c_int = 16; | ||
662 | pub const GLOB_ERR : ::c_int = 1; | ||
663 | pub const GLOB_MARK : ::c_int = 2; | ||
664 | pub const GLOB_NOCHECK : ::c_int = 8; | ||
665 | pub const GLOB_NOSORT : ::c_int = 4; | ||
666 | pub const GLOB_NOESCAPE: ::c_int = 64; | ||
667 | |||
668 | pub const GLOB_NOSPACE : ::c_int = -2; | ||
669 | pub const GLOB_ABORTED : ::c_int = -1; | ||
670 | pub const GLOB_NOMATCH : ::c_int = -3; | ||
671 | |||
672 | pub const POSIX_MADV_NORMAL: ::c_int = 0; | ||
673 | pub const POSIX_MADV_RANDOM: ::c_int = 1; | ||
674 | pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; | ||
675 | pub const POSIX_MADV_WILLNEED: ::c_int = 3; | ||
676 | pub const POSIX_MADV_DONTNEED: ::c_int = 4; | ||
677 | |||
678 | pub const _SC_IOV_MAX: ::c_int = 77; | ||
679 | pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 569; | ||
680 | pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 570; | ||
681 | pub const _SC_LOGIN_NAME_MAX: ::c_int = 571; | ||
682 | pub const _SC_MQ_PRIO_MAX: ::c_int = 30; | ||
683 | pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 577; | ||
684 | pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 578; | ||
685 | pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 568; | ||
686 | pub const _SC_THREAD_KEYS_MAX: ::c_int = 572; | ||
687 | pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 580; | ||
688 | pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 581; | ||
689 | pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 579; | ||
690 | pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 582; | ||
691 | pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 583; | ||
692 | pub const _SC_THREAD_STACK_MIN: ::c_int = 573; | ||
693 | pub const _SC_THREAD_THREADS_MAX: ::c_int = 574; | ||
694 | pub const _SC_THREADS: ::c_int = 576; | ||
695 | pub const _SC_TTY_NAME_MAX: ::c_int = 575; | ||
696 | pub const _SC_ATEXIT_MAX: ::c_int = 76; | ||
697 | pub const _SC_XOPEN_CRYPT: ::c_int = 62; | ||
698 | pub const _SC_XOPEN_ENH_I18N: ::c_int = 63; | ||
699 | pub const _SC_XOPEN_LEGACY: ::c_int = 717; | ||
700 | pub const _SC_XOPEN_REALTIME: ::c_int = 718; | ||
701 | pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 719; | ||
702 | pub const _SC_XOPEN_SHM: ::c_int = 64; | ||
703 | pub const _SC_XOPEN_UNIX: ::c_int = 78; | ||
704 | pub const _SC_XOPEN_VERSION: ::c_int = 12; | ||
705 | pub const _SC_XOPEN_XCU_VERSION: ::c_int = 67; | ||
706 | |||
707 | pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; | ||
708 | pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x40; | ||
709 | pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; | ||
710 | pub const PTHREAD_PROCESS_PRIVATE: u16 = 0; | ||
711 | pub const PTHREAD_STACK_MIN: ::size_t = 4096; | ||
712 | |||
713 | pub const SIGSTKSZ: ::size_t = 8192; | ||
714 | |||
715 | // https://illumos.org/man/3c/clock_gettime | ||
716 | // https://github.com/illumos/illumos-gate/ | ||
717 | // blob/HEAD/usr/src/lib/libc/amd64/sys/__clock_gettime.s | ||
718 | // clock_gettime(3c) doesn't seem to accept anything other than CLOCK_REALTIME | ||
719 | // or __CLOCK_REALTIME0 | ||
720 | // | ||
721 | // https://github.com/illumos/illumos-gate/ | ||
722 | // blob/HEAD/usr/src/uts/common/sys/time_impl.h | ||
723 | // Confusing! CLOCK_HIGHRES==CLOCK_MONOTONIC==4 | ||
724 | // __CLOCK_REALTIME0==0 is an obsoleted version of CLOCK_REALTIME==3 | ||
725 | pub const CLOCK_REALTIME: clockid_t = 3; | ||
726 | pub const CLOCK_MONOTONIC: clockid_t = 4; | ||
727 | pub const TIMER_RELTIME: ::c_int = 0; | ||
728 | pub const TIMER_ABSTIME: ::c_int = 1; | ||
729 | |||
730 | pub const RLIMIT_CPU: ::c_int = 0; | ||
731 | pub const RLIMIT_FSIZE: ::c_int = 1; | ||
732 | pub const RLIMIT_DATA: ::c_int = 2; | ||
733 | pub const RLIMIT_STACK: ::c_int = 3; | ||
734 | pub const RLIMIT_CORE: ::c_int = 4; | ||
735 | pub const RLIMIT_NOFILE: ::c_int = 5; | ||
736 | pub const RLIMIT_VMEM: ::c_int = 6; | ||
737 | pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM; | ||
738 | |||
739 | pub const RLIM_NLIMITS: rlim_t = 7; | ||
740 | pub const RLIM_INFINITY: rlim_t = 0x7fffffff; | ||
741 | |||
742 | pub const RUSAGE_SELF: ::c_int = 0; | ||
743 | pub const RUSAGE_CHILDREN: ::c_int = -1; | ||
744 | |||
745 | pub const MADV_NORMAL: ::c_int = 0; | ||
746 | pub const MADV_RANDOM: ::c_int = 1; | ||
747 | pub const MADV_SEQUENTIAL: ::c_int = 2; | ||
748 | pub const MADV_WILLNEED: ::c_int = 3; | ||
749 | pub const MADV_DONTNEED: ::c_int = 4; | ||
750 | pub const MADV_FREE: ::c_int = 5; | ||
751 | |||
752 | pub const AF_INET: ::c_int = 2; | ||
753 | pub const AF_INET6: ::c_int = 26; | ||
754 | pub const AF_UNIX: ::c_int = 1; | ||
755 | pub const SOCK_DGRAM: ::c_int = 1; | ||
756 | pub const SOCK_STREAM: ::c_int = 2; | ||
757 | pub const SOCK_RAW: ::c_int = 4; | ||
758 | pub const SOCK_RDM: ::c_int = 5; | ||
759 | pub const SOCK_SEQPACKET: ::c_int = 6; | ||
760 | pub const IPPROTO_TCP: ::c_int = 6; | ||
761 | pub const IPPROTO_IP: ::c_int = 0; | ||
762 | pub const IPPROTO_IPV6: ::c_int = 41; | ||
763 | pub const IP_MULTICAST_TTL: ::c_int = 17; | ||
764 | pub const IP_MULTICAST_LOOP: ::c_int = 18; | ||
765 | pub const IP_TTL: ::c_int = 4; | ||
766 | pub const IP_HDRINCL: ::c_int = 2; | ||
767 | pub const IP_ADD_MEMBERSHIP: ::c_int = 19; | ||
768 | pub const IP_DROP_MEMBERSHIP: ::c_int = 20; | ||
769 | pub const IPV6_JOIN_GROUP: ::c_int = 9; | ||
770 | pub const IPV6_LEAVE_GROUP: ::c_int = 10; | ||
771 | |||
772 | pub const TCP_NODELAY: ::c_int = 1; | ||
773 | pub const TCP_KEEPIDLE: ::c_int = 34; | ||
774 | pub const SOL_SOCKET: ::c_int = 0xffff; | ||
775 | pub const SO_DEBUG: ::c_int = 0x01; | ||
776 | pub const SO_ACCEPTCONN: ::c_int = 0x0002; | ||
777 | pub const SO_REUSEADDR: ::c_int = 0x0004; | ||
778 | pub const SO_KEEPALIVE: ::c_int = 0x0008; | ||
779 | pub const SO_DONTROUTE: ::c_int = 0x0010; | ||
780 | pub const SO_BROADCAST: ::c_int = 0x0020; | ||
781 | pub const SO_USELOOPBACK: ::c_int = 0x0040; | ||
782 | pub const SO_LINGER: ::c_int = 0x0080; | ||
783 | pub const SO_OOBINLINE: ::c_int = 0x0100; | ||
784 | pub const SO_SNDBUF: ::c_int = 0x1001; | ||
785 | pub const SO_RCVBUF: ::c_int = 0x1002; | ||
786 | pub const SO_SNDLOWAT: ::c_int = 0x1003; | ||
787 | pub const SO_RCVLOWAT: ::c_int = 0x1004; | ||
788 | pub const SO_SNDTIMEO: ::c_int = 0x1005; | ||
789 | pub const SO_RCVTIMEO: ::c_int = 0x1006; | ||
790 | pub const SO_ERROR: ::c_int = 0x1007; | ||
791 | pub const SO_TYPE: ::c_int = 0x1008; | ||
792 | |||
793 | pub const IFF_LOOPBACK: ::c_int = 0x8; | ||
794 | |||
795 | pub const SHUT_RD: ::c_int = 0; | ||
796 | pub const SHUT_WR: ::c_int = 1; | ||
797 | pub const SHUT_RDWR: ::c_int = 2; | ||
798 | |||
799 | pub const LOCK_SH: ::c_int = 1; | ||
800 | pub const LOCK_EX: ::c_int = 2; | ||
801 | pub const LOCK_NB: ::c_int = 4; | ||
802 | pub const LOCK_UN: ::c_int = 8; | ||
803 | |||
804 | pub const O_SYNC: ::c_int = 16; | ||
805 | pub const O_NONBLOCK: ::c_int = 128; | ||
806 | |||
807 | pub const IPPROTO_RAW: ::c_int = 255; | ||
808 | |||
809 | pub const _SC_ARG_MAX: ::c_int = 1; | ||
810 | pub const _SC_CHILD_MAX: ::c_int = 2; | ||
811 | pub const _SC_CLK_TCK: ::c_int = 3; | ||
812 | pub const _SC_NGROUPS_MAX: ::c_int = 4; | ||
813 | pub const _SC_OPEN_MAX: ::c_int = 5; | ||
814 | pub const _SC_JOB_CONTROL: ::c_int = 6; | ||
815 | pub const _SC_SAVED_IDS: ::c_int = 7; | ||
816 | pub const _SC_VERSION: ::c_int = 8; | ||
817 | pub const _SC_PAGESIZE: ::c_int = 11; | ||
818 | pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; | ||
819 | pub const _SC_NPROCESSORS_ONLN: ::c_int = 15; | ||
820 | pub const _SC_STREAM_MAX: ::c_int = 16; | ||
821 | pub const _SC_TZNAME_MAX: ::c_int = 17; | ||
822 | pub const _SC_AIO_LISTIO_MAX: ::c_int = 18; | ||
823 | pub const _SC_AIO_MAX: ::c_int = 19; | ||
824 | pub const _SC_BC_BASE_MAX: ::c_int = 54; | ||
825 | pub const _SC_BC_DIM_MAX: ::c_int = 55; | ||
826 | pub const _SC_BC_SCALE_MAX: ::c_int = 56; | ||
827 | pub const _SC_BC_STRING_MAX: ::c_int = 57; | ||
828 | pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 58; | ||
829 | pub const _SC_EXPR_NEST_MAX: ::c_int = 59; | ||
830 | pub const _SC_LINE_MAX: ::c_int = 60; | ||
831 | pub const _SC_RE_DUP_MAX: ::c_int = 61; | ||
832 | pub const _SC_2_VERSION: ::c_int = 53; | ||
833 | pub const _SC_2_C_BIND: ::c_int = 45; | ||
834 | pub const _SC_2_C_DEV: ::c_int = 46; | ||
835 | pub const _SC_2_CHAR_TERM: ::c_int = 66; | ||
836 | pub const _SC_2_FORT_DEV: ::c_int = 48; | ||
837 | pub const _SC_2_FORT_RUN: ::c_int = 49; | ||
838 | pub const _SC_2_LOCALEDEF: ::c_int = 50; | ||
839 | pub const _SC_2_SW_DEV: ::c_int = 51; | ||
840 | pub const _SC_2_UPE: ::c_int = 52; | ||
841 | pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21; | ||
842 | pub const _SC_MAPPED_FILES: ::c_int = 24; | ||
843 | pub const _SC_MEMLOCK: ::c_int = 25; | ||
844 | pub const _SC_MEMLOCK_RANGE: ::c_int = 26; | ||
845 | pub const _SC_MEMORY_PROTECTION: ::c_int = 27; | ||
846 | pub const _SC_MESSAGE_PASSING: ::c_int = 28; | ||
847 | pub const _SC_PRIORITIZED_IO: ::c_int = 31; | ||
848 | pub const _SC_PRIORITY_SCHEDULING: ::c_int = 32; | ||
849 | pub const _SC_REALTIME_SIGNALS: ::c_int = 33; | ||
850 | pub const _SC_SEMAPHORES: ::c_int = 35; | ||
851 | pub const _SC_FSYNC: ::c_int = 23; | ||
852 | pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 38; | ||
853 | pub const _SC_SYNCHRONIZED_IO: ::c_int = 42; | ||
854 | pub const _SC_TIMERS: ::c_int = 43; | ||
855 | pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 20; | ||
856 | pub const _SC_DELAYTIMER_MAX: ::c_int = 22; | ||
857 | pub const _SC_MQ_OPEN_MAX: ::c_int = 29; | ||
858 | pub const _SC_RTSIG_MAX: ::c_int = 34; | ||
859 | pub const _SC_SEM_NSEMS_MAX: ::c_int = 36; | ||
860 | pub const _SC_SEM_VALUE_MAX: ::c_int = 37; | ||
861 | pub const _SC_SIGQUEUE_MAX: ::c_int = 39; | ||
862 | pub const _SC_TIMER_MAX: ::c_int = 44; | ||
863 | |||
864 | pub const _MUTEX_MAGIC: u16 = 0x4d58; // MX | ||
865 | pub const _COND_MAGIC: u16 = 0x4356; // CV | ||
866 | pub const _RWL_MAGIC: u16 = 0x5257; // RW | ||
867 | |||
868 | pub const NCCS: usize = 19; | ||
869 | |||
870 | pub const LOG_CRON: ::c_int = 15 << 3; | ||
871 | |||
872 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { | ||
873 | __pthread_mutex_flag1: 0, | ||
874 | __pthread_mutex_flag2: 0, | ||
875 | __pthread_mutex_ceiling: 0, | ||
876 | __pthread_mutex_type: PTHREAD_PROCESS_PRIVATE, | ||
877 | __pthread_mutex_magic: _MUTEX_MAGIC, | ||
878 | __pthread_mutex_lock: 0, | ||
879 | __pthread_mutex_data: 0 | ||
880 | }; | ||
881 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { | ||
882 | __pthread_cond_flag: [0; 4], | ||
883 | __pthread_cond_type: PTHREAD_PROCESS_PRIVATE, | ||
884 | __pthread_cond_magic: _COND_MAGIC, | ||
885 | __pthread_cond_data: 0 | ||
886 | }; | ||
887 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { | ||
888 | __pthread_rwlock_readers: 0, | ||
889 | __pthread_rwlock_type: PTHREAD_PROCESS_PRIVATE, | ||
890 | __pthread_rwlock_magic: _RWL_MAGIC, | ||
891 | __pthread_rwlock_mutex: PTHREAD_MUTEX_INITIALIZER, | ||
892 | __pthread_rwlock_readercv: PTHREAD_COND_INITIALIZER, | ||
893 | __pthread_rwlock_writercv: PTHREAD_COND_INITIALIZER | ||
894 | }; | ||
895 | pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; | ||
896 | pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; | ||
897 | pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 4; | ||
898 | pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; | ||
899 | |||
900 | pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void; | ||
901 | pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void; | ||
902 | pub const RTLD_SELF: *mut ::c_void = -3isize as *mut ::c_void; | ||
903 | pub const RTLD_PROBE: *mut ::c_void = -4isize as *mut ::c_void; | ||
904 | |||
905 | pub const RTLD_NOW: ::c_int = 0x2; | ||
906 | pub const RTLD_NOLOAD: ::c_int = 0x4; | ||
907 | pub const RTLD_GLOBAL: ::c_int = 0x100; | ||
908 | pub const RTLD_LOCAL: ::c_int = 0x0; | ||
909 | pub const RTLD_PARENT: ::c_int = 0x200; | ||
910 | pub const RTLD_GROUP: ::c_int = 0x400; | ||
911 | pub const RTLD_WORLD: ::c_int = 0x800; | ||
912 | pub const RTLD_NODELETE: ::c_int = 0x1000; | ||
913 | pub const RTLD_FIRST: ::c_int = 0x2000; | ||
914 | pub const RTLD_CONFGEN: ::c_int = 0x10000; | ||
915 | |||
916 | f! { | ||
917 | pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { | ||
918 | let fd = fd as usize; | ||
919 | (*set).fds_bits[fd / 32] &= !(1 << (fd % 32)); | ||
920 | return | ||
921 | } | ||
922 | |||
923 | pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { | ||
924 | let fd = fd as usize; | ||
925 | return ((*set).fds_bits[fd / 32] & (1 << (fd % 32))) != 0 | ||
926 | } | ||
927 | |||
928 | pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { | ||
929 | let fd = fd as usize; | ||
930 | (*set).fds_bits[fd / 32] |= 1 << (fd % 32); | ||
931 | return | ||
932 | } | ||
933 | |||
934 | pub fn FD_ZERO(set: *mut fd_set) -> () { | ||
935 | for slot in (*set).fds_bits.iter_mut() { | ||
936 | *slot = 0; | ||
937 | } | ||
938 | } | ||
939 | |||
940 | pub fn WIFEXITED(status: ::c_int) -> bool { | ||
941 | (status & 0xFF) == 0 | ||
942 | } | ||
943 | |||
944 | pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { | ||
945 | (status >> 8) & 0xFF | ||
946 | } | ||
947 | |||
948 | pub fn WTERMSIG(status: ::c_int) -> ::c_int { | ||
949 | status & 0x7F | ||
950 | } | ||
951 | } | ||
952 | |||
953 | extern { | ||
954 | pub fn stack_getbounds(sp: *mut ::stack_t) -> ::c_int; | ||
955 | pub fn mincore(addr: *const ::c_void, len: ::size_t, | ||
956 | vec: *mut c_char) -> ::c_int; | ||
957 | pub fn setgroups(ngroups: ::c_int, | ||
958 | ptr: *const ::gid_t) -> ::c_int; | ||
959 | pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int; | ||
960 | pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) | ||
961 | -> ::c_int; | ||
962 | pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
963 | pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int; | ||
964 | pub fn clock_nanosleep(clk_id: clockid_t, | ||
965 | flags: ::c_int, | ||
966 | rqtp: *const ::timespec, | ||
967 | rmtp: *mut ::timespec) -> ::c_int; | ||
968 | pub fn getnameinfo(sa: *const ::sockaddr, | ||
969 | salen: ::socklen_t, | ||
970 | host: *mut ::c_char, | ||
971 | hostlen: ::socklen_t, | ||
972 | serv: *mut ::c_char, | ||
973 | sevlen: ::socklen_t, | ||
974 | flags: ::c_int) -> ::c_int; | ||
975 | pub fn getpwnam_r(name: *const ::c_char, | ||
976 | pwd: *mut passwd, | ||
977 | buf: *mut ::c_char, | ||
978 | buflen: ::c_int) -> *const passwd; | ||
979 | pub fn getpwuid_r(uid: ::uid_t, | ||
980 | pwd: *mut passwd, | ||
981 | buf: *mut ::c_char, | ||
982 | buflen: ::c_int) -> *const passwd; | ||
983 | pub fn setpwent(); | ||
984 | pub fn getpwent() -> *mut passwd; | ||
985 | pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent; | ||
986 | pub fn fdatasync(fd: ::c_int) -> ::c_int; | ||
987 | pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; | ||
988 | pub fn duplocale(base: ::locale_t) -> ::locale_t; | ||
989 | pub fn freelocale(loc: ::locale_t); | ||
990 | pub fn newlocale(mask: ::c_int, | ||
991 | locale: *const ::c_char, | ||
992 | base: ::locale_t) -> ::locale_t; | ||
993 | pub fn uselocale(loc: ::locale_t) -> ::locale_t; | ||
994 | pub fn getprogname() -> *const ::c_char; | ||
995 | pub fn setprogname(name: *const ::c_char); | ||
996 | pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; | ||
997 | pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int; | ||
998 | pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; | ||
999 | |||
1000 | pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1001 | flags: ::c_int, ...) -> ::c_int; | ||
1002 | pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1003 | mode: ::c_int, flags: ::c_int) -> ::c_int; | ||
1004 | pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1005 | mode: ::mode_t, flags: ::c_int) -> ::c_int; | ||
1006 | pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1007 | owner: ::uid_t, group: ::gid_t, | ||
1008 | flags: ::c_int) -> ::c_int; | ||
1009 | pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1010 | buf: *mut stat, flags: ::c_int) -> ::c_int; | ||
1011 | pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
1012 | newdirfd: ::c_int, newpath: *const ::c_char, | ||
1013 | flags: ::c_int) -> ::c_int; | ||
1014 | pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1015 | mode: ::mode_t) -> ::c_int; | ||
1016 | pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1017 | mode: ::mode_t, dev: dev_t) -> ::c_int; | ||
1018 | pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1019 | buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t; | ||
1020 | pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char, | ||
1021 | newdirfd: ::c_int, newpath: *const ::c_char) | ||
1022 | -> ::c_int; | ||
1023 | pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int, | ||
1024 | linkpath: *const ::c_char) -> ::c_int; | ||
1025 | pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1026 | flags: ::c_int) -> ::c_int; | ||
1027 | pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, | ||
1028 | mode: ::mode_t) -> ::c_int; | ||
1029 | pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; | ||
1030 | pub fn if_nameindex() -> *mut if_nameindex; | ||
1031 | pub fn if_freenameindex(ptr: *mut if_nameindex); | ||
1032 | pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, | ||
1033 | clock_id: *mut clockid_t) -> ::c_int; | ||
1034 | pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, | ||
1035 | clock_id: clockid_t) -> ::c_int; | ||
1036 | } | ||
diff --git a/third_party/libc/src/windows.rs b/third_party/libc/src/windows.rs new file mode 100644 index 0000000..5ba8b33 --- /dev/null +++ b/third_party/libc/src/windows.rs | |||
@@ -0,0 +1,193 @@ | |||
1 | //! Windows CRT definitions | ||
2 | |||
3 | pub type c_char = i8; | ||
4 | pub type c_long = i32; | ||
5 | pub type c_ulong = u32; | ||
6 | pub type wchar_t = u16; | ||
7 | |||
8 | pub type clock_t = i32; | ||
9 | |||
10 | cfg_if! { | ||
11 | if #[cfg(all(target_arch = "x86", target_env = "gnu"))] { | ||
12 | pub type time_t = i32; | ||
13 | } else { | ||
14 | pub type time_t = i64; | ||
15 | } | ||
16 | } | ||
17 | |||
18 | pub type off_t = i32; | ||
19 | pub type dev_t = u32; | ||
20 | pub type ino_t = u16; | ||
21 | pub enum timezone {} | ||
22 | pub type time64_t = i64; | ||
23 | |||
24 | s! { | ||
25 | // note this is the struct called stat64 in Windows. Not stat, nor stati64. | ||
26 | pub struct stat { | ||
27 | pub st_dev: dev_t, | ||
28 | pub st_ino: ino_t, | ||
29 | pub st_mode: u16, | ||
30 | pub st_nlink: ::c_short, | ||
31 | pub st_uid: ::c_short, | ||
32 | pub st_gid: ::c_short, | ||
33 | pub st_rdev: dev_t, | ||
34 | pub st_size: i64, | ||
35 | pub st_atime: time64_t, | ||
36 | pub st_mtime: time64_t, | ||
37 | pub st_ctime: time64_t, | ||
38 | } | ||
39 | |||
40 | // note that this is called utimbuf64 in Windows | ||
41 | pub struct utimbuf { | ||
42 | pub actime: time64_t, | ||
43 | pub modtime: time64_t, | ||
44 | } | ||
45 | |||
46 | pub struct timeval { | ||
47 | pub tv_sec: c_long, | ||
48 | pub tv_usec: c_long, | ||
49 | } | ||
50 | |||
51 | pub struct timespec { | ||
52 | pub tv_sec: time_t, | ||
53 | pub tv_nsec: c_long, | ||
54 | } | ||
55 | } | ||
56 | |||
57 | pub const EXIT_FAILURE: ::c_int = 1; | ||
58 | pub const EXIT_SUCCESS: ::c_int = 0; | ||
59 | pub const RAND_MAX: ::c_int = 32767; | ||
60 | pub const EOF: ::c_int = -1; | ||
61 | pub const SEEK_SET: ::c_int = 0; | ||
62 | pub const SEEK_CUR: ::c_int = 1; | ||
63 | pub const SEEK_END: ::c_int = 2; | ||
64 | pub const _IOFBF: ::c_int = 0; | ||
65 | pub const _IONBF: ::c_int = 4; | ||
66 | pub const _IOLBF: ::c_int = 64; | ||
67 | pub const BUFSIZ: ::c_uint = 512; | ||
68 | pub const FOPEN_MAX: ::c_uint = 20; | ||
69 | pub const FILENAME_MAX: ::c_uint = 260; | ||
70 | |||
71 | cfg_if! { | ||
72 | if #[cfg(all(target_env = "gnu"))] { | ||
73 | pub const L_tmpnam: ::c_uint = 14; | ||
74 | pub const TMP_MAX: ::c_uint = 0x7fff; | ||
75 | } else if #[cfg(all(target_env = "msvc"))] { | ||
76 | pub const L_tmpnam: ::c_uint = 260; | ||
77 | pub const TMP_MAX: ::c_uint = 0x7fff_ffff; | ||
78 | } else { | ||
79 | // Unknown target_env | ||
80 | } | ||
81 | } | ||
82 | |||
83 | pub const O_RDONLY: ::c_int = 0; | ||
84 | pub const O_WRONLY: ::c_int = 1; | ||
85 | pub const O_RDWR: ::c_int = 2; | ||
86 | pub const O_APPEND: ::c_int = 8; | ||
87 | pub const O_CREAT: ::c_int = 256; | ||
88 | pub const O_EXCL: ::c_int = 1024; | ||
89 | pub const O_TEXT: ::c_int = 16384; | ||
90 | pub const O_BINARY: ::c_int = 32768; | ||
91 | pub const O_NOINHERIT: ::c_int = 128; | ||
92 | pub const O_TRUNC: ::c_int = 512; | ||
93 | pub const S_IFCHR: ::c_int = 8192; | ||
94 | pub const S_IFDIR: ::c_int = 16384; | ||
95 | pub const S_IFREG: ::c_int = 32768; | ||
96 | pub const S_IFMT: ::c_int = 61440; | ||
97 | pub const S_IEXEC: ::c_int = 64; | ||
98 | pub const S_IWRITE: ::c_int = 128; | ||
99 | pub const S_IREAD: ::c_int = 256; | ||
100 | |||
101 | pub const LC_ALL: ::c_int = 0; | ||
102 | pub const LC_COLLATE: ::c_int = 1; | ||
103 | pub const LC_CTYPE: ::c_int = 2; | ||
104 | pub const LC_MONETARY: ::c_int = 3; | ||
105 | pub const LC_NUMERIC: ::c_int = 4; | ||
106 | pub const LC_TIME: ::c_int = 5; | ||
107 | |||
108 | #[cfg(target_env = "msvc")] // " if " -- appease style checker | ||
109 | #[link(name = "msvcrt")] | ||
110 | extern {} | ||
111 | |||
112 | extern { | ||
113 | #[link_name = "_chmod"] | ||
114 | pub fn chmod(path: *const c_char, mode: ::c_int) -> ::c_int; | ||
115 | #[link_name = "_wchmod"] | ||
116 | pub fn wchmod(path: *const wchar_t, mode: ::c_int) -> ::c_int; | ||
117 | #[link_name = "_mkdir"] | ||
118 | pub fn mkdir(path: *const c_char) -> ::c_int; | ||
119 | #[link_name = "_wrmdir"] | ||
120 | pub fn wrmdir(path: *const wchar_t) -> ::c_int; | ||
121 | #[link_name = "_fstat64"] | ||
122 | pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; | ||
123 | #[link_name = "_stat64"] | ||
124 | pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; | ||
125 | #[link_name = "_wstat64"] | ||
126 | pub fn wstat(path: *const wchar_t, buf: *mut stat) -> ::c_int; | ||
127 | #[link_name = "_wutime64"] | ||
128 | pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> ::c_int; | ||
129 | #[link_name = "_popen"] | ||
130 | pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; | ||
131 | #[link_name = "_pclose"] | ||
132 | pub fn pclose(stream: *mut ::FILE) -> ::c_int; | ||
133 | #[link_name = "_fdopen"] | ||
134 | pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; | ||
135 | #[link_name = "_fileno"] | ||
136 | pub fn fileno(stream: *mut ::FILE) -> ::c_int; | ||
137 | #[link_name = "_open"] | ||
138 | pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; | ||
139 | #[link_name = "_wopen"] | ||
140 | pub fn wopen(path: *const wchar_t, oflag: ::c_int, ...) -> ::c_int; | ||
141 | #[link_name = "_creat"] | ||
142 | pub fn creat(path: *const c_char, mode: ::c_int) -> ::c_int; | ||
143 | #[link_name = "_access"] | ||
144 | pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; | ||
145 | #[link_name = "_chdir"] | ||
146 | pub fn chdir(dir: *const c_char) -> ::c_int; | ||
147 | #[link_name = "_close"] | ||
148 | pub fn close(fd: ::c_int) -> ::c_int; | ||
149 | #[link_name = "_dup"] | ||
150 | pub fn dup(fd: ::c_int) -> ::c_int; | ||
151 | #[link_name = "_dup2"] | ||
152 | pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; | ||
153 | #[link_name = "_execv"] | ||
154 | pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::intptr_t; | ||
155 | #[link_name = "_execve"] | ||
156 | pub fn execve(prog: *const c_char, argv: *const *const c_char, | ||
157 | envp: *const *const c_char) -> ::c_int; | ||
158 | #[link_name = "_execvp"] | ||
159 | pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; | ||
160 | #[link_name = "_execvpe"] | ||
161 | pub fn execvpe(c: *const c_char, argv: *const *const c_char, | ||
162 | envp: *const *const c_char) -> ::c_int; | ||
163 | #[link_name = "_getcwd"] | ||
164 | pub fn getcwd(buf: *mut c_char, size: ::c_int) -> *mut c_char; | ||
165 | #[link_name = "_getpid"] | ||
166 | pub fn getpid() -> ::c_int; | ||
167 | #[link_name = "_isatty"] | ||
168 | pub fn isatty(fd: ::c_int) -> ::c_int; | ||
169 | #[link_name = "_lseek"] | ||
170 | pub fn lseek(fd: ::c_int, offset: c_long, origin: ::c_int) -> c_long; | ||
171 | #[link_name = "_pipe"] | ||
172 | pub fn pipe(fds: *mut ::c_int, | ||
173 | psize: ::c_uint, | ||
174 | textmode: ::c_int) -> ::c_int; | ||
175 | #[link_name = "_read"] | ||
176 | pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::c_uint) -> ::c_int; | ||
177 | #[link_name = "_rmdir"] | ||
178 | pub fn rmdir(path: *const c_char) -> ::c_int; | ||
179 | #[link_name = "_unlink"] | ||
180 | pub fn unlink(c: *const c_char) -> ::c_int; | ||
181 | #[link_name = "_write"] | ||
182 | pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::c_uint) -> ::c_int; | ||
183 | #[link_name = "_commit"] | ||
184 | pub fn commit(fd: ::c_int) -> ::c_int; | ||
185 | #[link_name = "_get_osfhandle"] | ||
186 | pub fn get_osfhandle(fd: ::c_int) -> ::intptr_t; | ||
187 | #[link_name = "_open_osfhandle"] | ||
188 | pub fn open_osfhandle(osfhandle: ::intptr_t, flags: ::c_int) -> ::c_int; | ||
189 | pub fn setlocale(category: ::c_int, locale: *const c_char) -> *mut c_char; | ||
190 | #[link_name = "_wsetlocale"] | ||
191 | pub fn wsetlocale(category: ::c_int, | ||
192 | locale: *const wchar_t) -> *mut wchar_t; | ||
193 | } | ||