summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2016-08-14 12:45:07 +0200
committerlurchi <lurchi@strangeplace.net>2016-08-14 12:45:07 +0200
commit17321bfb3c7ef6a05073f9656460c00547e89ed8 (patch)
tree8ad93f2c49e3ff968f8f6c3f5255677d52fb581e
parent0372b4a9b8c788ace44a52430d29f4e3ece1c119 (diff)
downloadsecushare-17321bfb3c7ef6a05073f9656460c00547e89ed8.tar.gz
secushare-17321bfb3c7ef6a05073f9656460c00547e89ed8.zip
add libc subtree
-rw-r--r--third_party/libc/.gitignore3
-rw-r--r--third_party/libc/.travis.yml107
-rw-r--r--third_party/libc/Cargo.toml18
-rw-r--r--third_party/libc/LICENSE-APACHE201
-rw-r--r--third_party/libc/LICENSE-MIT25
-rw-r--r--third_party/libc/README.md135
-rw-r--r--third_party/libc/appveyor.yml21
-rw-r--r--third_party/libc/ci/README.md203
-rw-r--r--third_party/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile7
-rw-r--r--third_party/libc/ci/docker/arm-linux-androideabi/Dockerfile4
-rw-r--r--third_party/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile7
-rw-r--r--third_party/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile5
-rw-r--r--third_party/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile13
-rw-r--r--third_party/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile6
-rw-r--r--third_party/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile13
-rw-r--r--third_party/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile5
-rw-r--r--third_party/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile13
-rw-r--r--third_party/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile7
-rw-r--r--third_party/libc/ci/dox.sh33
-rw-r--r--third_party/libc/ci/landing-page-footer.html3
-rw-r--r--third_party/libc/ci/landing-page-head.html7
-rw-r--r--third_party/libc/ci/run-docker.sh25
-rw-r--r--third_party/libc/ci/run-qemu.sh35
-rwxr-xr-xthird_party/libc/ci/run.sh135
-rw-r--r--third_party/libc/ci/style.rs204
-rw-r--r--third_party/libc/libc-test/Cargo.lock92
-rw-r--r--third_party/libc/libc-test/Cargo.toml11
-rw-r--r--third_party/libc/libc-test/build-generated.rs16
-rw-r--r--third_party/libc/libc-test/build.rs467
-rw-r--r--third_party/libc/libc-test/generate-files/Cargo.lock108
-rw-r--r--third_party/libc/libc-test/generate-files/Cargo.toml16
-rw-r--r--third_party/libc/libc-test/run-generated-Cargo.toml19
-rw-r--r--third_party/libc/libc-test/src/main-generated.rs9
-rw-r--r--third_party/libc/libc-test/src/main.rs6
-rw-r--r--third_party/libc/src/dox.rs134
-rw-r--r--third_party/libc/src/lib.rs272
-rw-r--r--third_party/libc/src/macros.rs108
-rw-r--r--third_party/libc/src/unix/bsd/apple/b32.rs19
-rw-r--r--third_party/libc/src/unix/bsd/apple/b64.rs19
-rw-r--r--third_party/libc/src/unix/bsd/apple/mod.rs1464
-rw-r--r--third_party/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs251
-rw-r--r--third_party/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs251
-rw-r--r--third_party/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs31
-rw-r--r--third_party/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs30
-rw-r--r--third_party/libc/src/unix/bsd/freebsdlike/mod.rs859
-rw-r--r--third_party/libc/src/unix/bsd/mod.rs393
-rw-r--r--third_party/libc/src/unix/bsd/openbsdlike/bitrig.rs435
-rw-r--r--third_party/libc/src/unix/bsd/openbsdlike/mod.rs545
-rw-r--r--third_party/libc/src/unix/bsd/openbsdlike/netbsd.rs586
-rw-r--r--third_party/libc/src/unix/bsd/openbsdlike/openbsd.rs409
-rw-r--r--third_party/libc/src/unix/mod.rs851
-rw-r--r--third_party/libc/src/unix/notbsd/android/b32.rs151
-rw-r--r--third_party/libc/src/unix/notbsd/android/b64.rs161
-rw-r--r--third_party/libc/src/unix/notbsd/android/mod.rs639
-rw-r--r--third_party/libc/src/unix/notbsd/linux/mips.rs579
-rw-r--r--third_party/libc/src/unix/notbsd/linux/mod.rs674
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b32/arm.rs308
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs307
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b32/mips.rs307
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b32/mod.rs48
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b32/x86.rs322
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs1
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b64/mod.rs346
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs1
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs18
-rw-r--r--third_party/libc/src/unix/notbsd/linux/musl/mod.rs207
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/b32/arm.rs23
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/b32/mod.rs113
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/b32/powerpc.rs23
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/b32/x86.rs70
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/b64/aarch64.rs81
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/b64/mod.rs51
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs79
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/b64/x86_64.rs137
-rw-r--r--third_party/libc/src/unix/notbsd/linux/other/mod.rs616
-rw-r--r--third_party/libc/src/unix/notbsd/mod.rs882
-rw-r--r--third_party/libc/src/unix/solaris/mod.rs1036
-rw-r--r--third_party/libc/src/windows.rs193
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 @@
1target
2Cargo.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 @@
1language: rust
2sudo: required
3dist: trusty
4services:
5 - docker
6install:
7 - curl https://static.rust-lang.org/rustup.sh |
8 sh -s -- --add-target=$TARGET --disable-sudo -y --prefix=`rustc --print sysroot`
9script:
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
20osx_image: xcode7.3
21env:
22 global:
23 secure: eIDEoQdTyglcsTD13zSGotAX2HDhRSXIaaTnVZTThqLSrySOc3/6KY3qmOc2Msf7XaBqfFy9QA+alk7OwfePp253eiy1Kced67ffjjFOytEcRT7FlQiYpcYQD6WNHZEj62/bJBO4LTM9sGtWNCTJVEDKW0WM8mUK7qNuC+honPM=
24matrix:
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
104notifications:
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
3name = "libc"
4version = "0.2.15"
5authors = ["The Rust Project Developers"]
6license = "MIT/Apache-2.0"
7readme = "README.md"
8repository = "https://github.com/rust-lang/libc"
9homepage = "https://github.com/rust-lang/libc"
10documentation = "http://doc.rust-lang.org/libc"
11description = """
12A library for types and bindings to native C functions often found in libc or
13other common platform libraries.
14"""
15
16[features]
17default = ["use_std"]
18use_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
5TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
71. 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
662. 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
733. 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
894. 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
1305. 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
1386. 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
1437. 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
1538. 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
1659. 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
176END OF TERMS AND CONDITIONS
177
178APPENDIX: 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
189Copyright [yyyy] [name of copyright owner]
190
191Licensed under the Apache License, Version 2.0 (the "License");
192you may not use this file except in compliance with the License.
193You may obtain a copy of the License at
194
195 http://www.apache.org/licenses/LICENSE-2.0
196
197Unless required by applicable law or agreed to in writing, software
198distributed under the License is distributed on an "AS IS" BASIS,
199WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200See the License for the specific language governing permissions and
201limitations 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 @@
1Copyright (c) 2014 The Rust Project Developers
2
3Permission is hereby granted, free of charge, to any
4person obtaining a copy of this software and associated
5documentation files (the "Software"), to deal in the
6Software without restriction, including without
7limitation the rights to use, copy, modify, merge,
8publish, distribute, sublicense, and/or sell copies of
9the Software, and to permit persons to whom the Software
10is furnished to do so, subject to the following
11conditions:
12
13The above copyright notice and this permission notice
14shall be included in all copies or substantial portions
15of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS 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 @@
1libc
2====
3
4A Rust library with native bindings to the types and functions commonly found on
5various 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
14First, add the following to your `Cargo.toml`:
15
16```toml
17[dependencies]
18libc = "0.2"
19```
20
21Next, add this to your crate root:
22
23```rust
24extern crate libc;
25```
26
27Currently libc by default links to the standard library, but if you would
28instead like to use libc in a `#![no_std]` situation or crate you can request
29this via:
30
31```toml
32[dependencies]
33libc = { version = "0.2", default-features = false }
34```
35
36## What is libc?
37
38The primary purpose of this crate is to provide all of the definitions necessary
39to easily interoperate with C code (or "C-like" code) on each of the platforms
40that Rust supports. This includes type definitions (e.g. `c_int`), constants
41(e.g. `EINVAL`) as well as function headers (e.g. `malloc`).
42
43This crate does not strive to have any form of compatibility across platforms,
44but rather it is simply a straight binding to the system libraries on the
45platform in question.
46
47## Public API
48
49This crate exports all underlying platform types, functions, and constants under
50the crate root, so all items are accessible as `libc::foo`. The types and values
51of all the exported APIs match the platform that libc is compiled for.
52
53More 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
60Want to use an API which currently isn't bound in `libc`? It's quite easy to add
61one!
62
63The 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
65to all platforms in the future. As a result, the crate is organized
66hierarchically based on platform. Each module has a number of `#[cfg]`'d
67children, but only one is ever actually compiled. Each module then reexports all
68the contents of its children.
69
70This means that for each platform that libc supports, the path from a
71leaf module to the root will contain all bindings for the platform in question.
72Consequently, this indicates where an API should be added! Adding an API at a
73particular level in the hierarchy means that it is supported on all the child
74platforms of that level. For example, when adding a Unix API it should be added
75to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to
76`src/unix/notbsd/linux/mod.rs`.
77
78If you're not 100% sure at what level of the hierarchy an API should be added
79at, fear not! This crate has CI support which tests any binding against all
80platforms supported, so you'll see failures if an API is added at the wrong
81level or has different signatures across platforms.
82
83With that in mind, the steps for adding a new API are:
84
851. Determine where in the module hierarchy your API should be added.
862. Add the API.
873. Send a PR to this repo.
884. Wait for CI to pass, fixing errors.
895. Wait for a merge!
90
91### Test before you commit
92
93We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc):
94
951. [`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.
982. Style checker
99 - `rustc ci/style.rs && ./style src`
100
101## Platforms and Documentation
102
103The following platforms are currently tested and have documentation available:
104
105Tested:
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
130The 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 @@
1environment:
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
9install:
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
17build: false
18
19test_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 @@
1The goal of the libc crate is to have CI running everywhere to have the
2strongest guarantees about the definitions that this library contains, and as a
3result the CI is pretty complicated and also pretty large! Hopefully this can
4serve as a guide through the sea of scripts in this directory and elsewhere in
5this project.
6
7# Files
8
9First 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
35Currently this repository leverages a combination of Travis CI and AppVeyor for
36running 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
50The Windows triples are all pretty standard, they just set up their environment
51then run tests, no need for downloading any extra target libs (we just download
52the right installer). The Intel Linux/OSX builds are similar in that we just
53download the right target libs and run tests. Note that the Intel Linux/OSX
54builds are run on stable/beta/nightly, but are the only ones that do so.
55
56The 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
76Lots of the architectures tested here use QEMU in the tests, so it's worth going
77over all the crazy capabilities QEMU has and the various flavors in which we use
78it!
79
80First up, QEMU has userspace emulation where it doesn't boot a full kernel, it
81just runs a binary from another architecture (using the `qemu-<arch>` wrappers).
82We provide it the runtime path for the dynamically loaded system libraries,
83however. This strategy is used for all Linux architectures that aren't intel.
84Note that one downside of this QEMU system is that threads are barely
85implemented, so we're careful to not spawn many threads.
86
87For the rumprun target the only output is a kernel image, so we just use that
88plus the `rumpbake` command to create a full kernel image which is then run from
89within QEMU.
90
91Finally, the fun part, the BSDs. Quite a few hoops are jumped through to get CI
92working 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
102With all that in mind, the way BSD is tested looks like:
103
1041. Download a pre-prepared image for the OS being tested.
1052. 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.
1083. 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.
1114. 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.
1135. Look for whether the tests passed in the serial console output of the kernel.
114
115There's some pretty specific instructions for setting up each image (detailed
116below), but the main gist of this is that we must avoid a vanilla `cargo run`
117inside of the `libc-test` directory (which is what it's intended for) because
118that would compile `syntex_syntax`, a large library, with userspace emulation.
119This invariably times out on Travis, so we can't do that.
120
121Once all those hoops are jumped through, however, we can be happy that we're
122testing almost everything!
123
124Below are some details of how to set up the initial OS images which are
125downloaded. Each image must be enabled have input/output over the serial
126console, log in automatically at the serial console, detect if a second drive in
127QEMU 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
129about above), and then shut down.
130
131### QEMU setup - FreeBSD
132
1331. Download CD installer (most minimal is fine)
1342. `qemu-img create -f qcow2 foo.qcow2 2G`
1353. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user`
1364. run installer
1375. `echo 'console="comconsole"' >> /boot/loader.conf`
1386. `echo 'autoboot_delay="0"' >> /boot/loader.conf`
1397. look at /etc/ttys, see what getty argument is for ttyu0
1408. 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
144necessary)
145
146Once that's done, arrange for this script to run at login:
147
148```
149#!/bin/sh
150
151sudo kldload ext2fs
152[ -e /dev/vtbd1 ] || exit 0
153sudo mount -t ext2fs /dev/vtbd1 /mnt
154sh /mnt/run.sh /mnt
155sudo poweroff
156```
157
158Helpful 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
1671. Download CD installer
1682. `qemu-img create -f qcow2 foo.qcow2 2G`
1693. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user`
1704. run installer
1715. `echo 'set tty com0' >> /etc/boot.conf`
1726. `echo 'boot' >> /etc/boot.conf`
1737. Modify /etc/ttys, change the `tty00` at the end from 'unknown off' to
174 'vt220 on secure'
1758. Modify same line in /etc/ttys to have `"/root/foo.sh"` as the shell
1769. Add this script to `/root/foo.sh`
177
178```
179#!/bin/sh
180exec 1>/dev/tty00
181exec 2>&1
182
183if mount -t ext2fs /dev/sd1c /mnt; then
184 sh /mnt/run.sh /mnt
185 shutdown -ph now
186fi
187
188# limited shell...
189exec /bin/sh < /dev/tty00
190```
191
19210. `chmod +x /root/foo.sh`
193
194Helpful links:
195
196* https://en.wikibooks.org/wiki/QEMU/Images
197* http://www.openbsd.org/faq/faq7.html#SerCon
198
199# Questions?
200
201Hopefully that's at least somewhat of an introduction to everything going on
202here, 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 @@
1FROM ubuntu:14.04
2RUN apt-get update
3RUN apt-get install -y --no-install-recommends \
4 gcc libc6-dev ca-certificates \
5 gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
6ENV 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 @@
1FROM alexcrichton/rust-slave-android:2015-11-22
2ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
3 PATH=$PATH:/rust/bin
4ENTRYPOINT ["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 @@
1FROM ubuntu:16.04
2RUN apt-get update
3RUN apt-get install -y --no-install-recommends \
4 gcc libc6-dev ca-certificates \
5 gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user
6ENV 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 @@
1FROM ubuntu:16.04
2RUN apt-get update
3RUN apt-get install -y --no-install-recommends \
4 gcc-multilib libc6-dev ca-certificates
5ENV 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 @@
1FROM ubuntu:15.10
2
3RUN apt-get update
4RUN apt-get install -y --no-install-recommends \
5 software-properties-common gcc libc6-dev qemu-user
6RUN add-apt-repository ppa:angelsl/mips-cross
7RUN apt-get update
8RUN apt-get install -y --no-install-recommends \
9 gcc-5-mips-linux-gnu libc6-dev-mips-cross
10
11ENV 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 @@
1FROM mato/rumprun-toolchain-hw-x86_64
2USER root
3RUN apt-get update
4RUN apt-get install -y --no-install-recommends \
5 qemu
6ENV 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 @@
1FROM alexcrichton/rust-slave-linux-cross:2016-04-15
2USER root
3
4RUN apt-get update
5RUN apt-get install -y --no-install-recommends \
6 qemu qemu-kvm kmod cpu-checker
7
8ENTRYPOINT ["sh"]
9
10ENV 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 @@
1FROM ubuntu:16.04
2RUN apt-get update
3RUN apt-get install -y --no-install-recommends \
4 gcc libc6-dev ca-certificates
5ENV 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 @@
1FROM ubuntu:16.04
2
3RUN apt-get update
4RUN apt-get install -y --no-install-recommends \
5 gcc make libc6-dev git curl ca-certificates
6RUN 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
13ENV 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 @@
1FROM ubuntu:16.04
2
3RUN apt-get update
4RUN apt-get install -y --no-install-recommends \
5 gcc libc6-dev qemu qemu-kvm curl ca-certificates kmod cpu-checker
6ENV 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
7set -e
8
9TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'`
10
11rm -rf target/doc
12mkdir -p target/doc
13
14cp ci/landing-page-head.html target/doc/index.html
15
16for 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
24done
25
26cat 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!
29if [ "$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
33fi
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
4set -ex
5
6run() {
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
19if [ -z "$1" ]; then
20 for d in `ls ci/docker/`; do
21 run $d
22 done
23else
24 run $1
25fi
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
11set -ex
12
13ROOT=$1
14cp -r $ROOT/libc /tmp/libc
15cd /tmp/libc
16
17TARGET=$(cat $ROOT/TARGET)
18export CARGO_TARGET_DIR=/tmp
19
20case $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 ;;
33esac
34
35exec 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
6set -ex
7
8TARGET=$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.
16if [ "$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
90fi
91
92case "$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 ;;
101esac
102
103case "$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 ;;
135esac
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
36use std::env;
37use std::fs;
38use std::io::prelude::*;
39use std::path::Path;
40
41macro_rules! t {
42 ($e:expr) => (match $e {
43 Ok(e) => e,
44 Err(e) => panic!("{} failed with {}", stringify!($e), e),
45 })
46}
47
48fn 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
61fn 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
87struct Errors {
88 errs: bool,
89}
90
91#[derive(Clone, Copy, PartialEq)]
92enum State {
93 Start,
94 Imports,
95 Typedefs,
96 Structs,
97 Constants,
98 FunctionDefinitions,
99 Functions,
100 Modules,
101}
102
103fn 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
184impl 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
199impl 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]
2name = "libc-test"
3version = "0.1.0"
4dependencies = [
5 "ctest 0.1.0 (git+https://github.com/alexcrichton/ctest)",
6 "libc 0.2.15",
7]
8
9[[package]]
10name = "bitflags"
11version = "0.3.3"
12source = "registry+https://github.com/rust-lang/crates.io-index"
13
14[[package]]
15name = "ctest"
16version = "0.1.0"
17source = "git+https://github.com/alexcrichton/ctest#a6becb6d7fd23d9863cba86eac31d1ffc4082734"
18dependencies = [
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]]
24name = "gcc"
25version = "0.3.28"
26source = "registry+https://github.com/rust-lang/crates.io-index"
27
28[[package]]
29name = "kernel32-sys"
30version = "0.2.2"
31source = "registry+https://github.com/rust-lang/crates.io-index"
32dependencies = [
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]]
38name = "libc"
39version = "0.1.12"
40source = "registry+https://github.com/rust-lang/crates.io-index"
41
42[[package]]
43name = "libc"
44version = "0.2.15"
45
46[[package]]
47name = "log"
48version = "0.3.6"
49source = "registry+https://github.com/rust-lang/crates.io-index"
50
51[[package]]
52name = "rustc-serialize"
53version = "0.3.19"
54source = "registry+https://github.com/rust-lang/crates.io-index"
55
56[[package]]
57name = "syntex_syntax"
58version = "0.19.1"
59source = "registry+https://github.com/rust-lang/crates.io-index"
60dependencies = [
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]]
70name = "term"
71version = "0.2.14"
72source = "registry+https://github.com/rust-lang/crates.io-index"
73dependencies = [
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]]
79name = "unicode-xid"
80version = "0.0.3"
81source = "registry+https://github.com/rust-lang/crates.io-index"
82
83[[package]]
84name = "winapi"
85version = "0.2.6"
86source = "registry+https://github.com/rust-lang/crates.io-index"
87
88[[package]]
89name = "winapi-build"
90version = "0.1.1"
91source = "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]
2name = "libc-test"
3version = "0.1.0"
4authors = ["Alex Crichton <alex@alexcrichton.com>"]
5build = "build.rs"
6
7[dependencies]
8libc = { path = ".." }
9
10[build-dependencies]
11ctest = { 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
5extern crate gcc;
6
7fn 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
3extern crate ctest;
4
5use std::env;
6
7fn 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]
2name = "generate-files"
3version = "0.1.0"
4dependencies = [
5 "ctest 0.1.0 (git+https://github.com/alexcrichton/ctest)",
6]
7
8[[package]]
9name = "advapi32-sys"
10version = "0.1.2"
11source = "registry+https://github.com/rust-lang/crates.io-index"
12dependencies = [
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]]
18name = "bitflags"
19version = "0.3.3"
20source = "registry+https://github.com/rust-lang/crates.io-index"
21
22[[package]]
23name = "ctest"
24version = "0.1.0"
25source = "git+https://github.com/alexcrichton/ctest#a6becb6d7fd23d9863cba86eac31d1ffc4082734"
26dependencies = [
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]]
32name = "gcc"
33version = "0.3.21"
34source = "registry+https://github.com/rust-lang/crates.io-index"
35dependencies = [
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]]
41name = "kernel32-sys"
42version = "0.2.1"
43source = "registry+https://github.com/rust-lang/crates.io-index"
44dependencies = [
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]]
50name = "libc"
51version = "0.1.12"
52source = "registry+https://github.com/rust-lang/crates.io-index"
53
54[[package]]
55name = "libc"
56version = "0.2.5"
57source = "registry+https://github.com/rust-lang/crates.io-index"
58
59[[package]]
60name = "log"
61version = "0.3.5"
62source = "registry+https://github.com/rust-lang/crates.io-index"
63dependencies = [
64 "libc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
65]
66
67[[package]]
68name = "rustc-serialize"
69version = "0.3.16"
70source = "registry+https://github.com/rust-lang/crates.io-index"
71
72[[package]]
73name = "syntex_syntax"
74version = "0.19.1"
75source = "registry+https://github.com/rust-lang/crates.io-index"
76dependencies = [
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]]
86name = "term"
87version = "0.2.14"
88source = "registry+https://github.com/rust-lang/crates.io-index"
89dependencies = [
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]]
95name = "unicode-xid"
96version = "0.0.3"
97source = "registry+https://github.com/rust-lang/crates.io-index"
98
99[[package]]
100name = "winapi"
101version = "0.2.6"
102source = "registry+https://github.com/rust-lang/crates.io-index"
103
104[[package]]
105name = "winapi-build"
106version = "0.1.1"
107source = "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]
7name = "generate-files"
8version = "0.1.0"
9authors = ["Alex Crichton <alex@alexcrichton.com>"]
10
11[[bin]]
12name = "generate-files"
13path = "../build.rs"
14
15[dependencies]
16ctest = { 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]
6name = "libc-test"
7version = "0.1.0"
8authors = ["Alex Crichton <alex@alexcrichton.com>"]
9build = "build-generated.rs"
10
11[dependencies]
12libc = { path = ".." }
13
14[[bin]]
15name = "libc-test"
16path = "src/main-generated.rs"
17
18[build-dependencies]
19gcc = "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)]
5extern crate libc;
6
7use libc::*;
8
9include!("../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)]
2extern crate libc;
3
4use libc::*;
5
6include!(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 @@
1pub use self::imp::*;
2
3#[cfg(not(dox))]
4mod 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)]
12mod 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"))]
88extern crate std as core;
89
90#[macro_use] mod macros;
91mod 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)]
97pub 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
105pub type int8_t = i8;
106pub type int16_t = i16;
107pub type int32_t = i32;
108pub type int64_t = i64;
109pub type uint8_t = u8;
110pub type uint16_t = u16;
111pub type uint32_t = u32;
112pub type uint64_t = u64;
113
114pub type c_schar = i8;
115pub type c_uchar = u8;
116pub type c_short = i16;
117pub type c_ushort = u16;
118pub type c_int = i32;
119pub type c_uint = u32;
120pub type c_float = f32;
121pub type c_double = f64;
122pub type c_longlong = i64;
123pub type c_ulonglong = u64;
124pub type intmax_t = i64;
125pub type uintmax_t = u64;
126
127pub type size_t = usize;
128pub type ptrdiff_t = isize;
129pub type intptr_t = isize;
130pub type uintptr_t = usize;
131pub type ssize_t = isize;
132
133pub enum FILE {}
134pub enum fpos_t {} // TODO: fill this out with a struct
135
136extern {
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"))]
254extern {
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
262cfg_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.
9macro_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
23macro_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
31macro_rules! __cfg_if_apply {
32 ($m:meta, $($it:item)*) => {
33 $(#[$m] $it)*
34 }
35}
36
37macro_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
51macro_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
69macro_rules! __item {
70 ($i:item) => ($i)
71}
72
73#[cfg(test)]
74mod 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
3pub type c_long = i32;
4pub type c_ulong = u32;
5
6s! {
7 pub struct pthread_attr_t {
8 __sig: c_long,
9 __opaque: [::c_char; 36]
10 }
11}
12
13pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
14pub const __PTHREAD_COND_SIZE__: usize = 24;
15pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
16pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
17
18pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
19pub 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
3pub type c_long = i64;
4pub type c_ulong = u64;
5
6s! {
7 pub struct pthread_attr_t {
8 __sig: c_long,
9 __opaque: [::c_char; 56]
10 }
11}
12
13pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
14pub const __PTHREAD_COND_SIZE__: usize = 40;
15pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
16pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
17
18pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
19pub 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
5pub type clock_t = c_ulong;
6pub type time_t = c_long;
7pub type suseconds_t = i32;
8pub type dev_t = i32;
9pub type ino_t = u64;
10pub type mode_t = u16;
11pub type nlink_t = u16;
12pub type blksize_t = i32;
13pub type rlim_t = u64;
14pub type mach_timebase_info_data_t = mach_timebase_info;
15pub type pthread_key_t = c_ulong;
16pub type sigset_t = u32;
17pub type fsblkcnt_t = ::c_uint;
18pub type fsfilcnt_t = ::c_uint;
19pub type speed_t = ::c_ulong;
20pub type tcflag_t = ::c_ulong;
21pub type nl_item = ::c_int;
22pub type id_t = ::c_uint;
23pub type sem_t = ::c_int;
24
25pub enum timezone {}
26
27s! {
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
308pub const _UTX_USERSIZE: usize = 256;
309pub const _UTX_LINESIZE: usize = 32;
310pub const _UTX_IDSIZE: usize = 4;
311pub const _UTX_HOSTSIZE: usize = 256;
312
313pub const EMPTY: ::c_short = 0;
314pub const RUN_LVL: ::c_short = 1;
315pub const BOOT_TIME: ::c_short = 2;
316pub const OLD_TIME: ::c_short = 3;
317pub const NEW_TIME: ::c_short = 4;
318pub const INIT_PROCESS: ::c_short = 5;
319pub const LOGIN_PROCESS: ::c_short = 6;
320pub const USER_PROCESS: ::c_short = 7;
321pub const DEAD_PROCESS: ::c_short = 8;
322pub const ACCOUNTING: ::c_short = 9;
323pub const SIGNATURE: ::c_short = 10;
324pub const SHUTDOWN_TIME: ::c_short = 11;
325
326pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
327pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
328pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
329pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
330pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
331pub const LC_TIME_MASK: ::c_int = (1 << 5);
332pub 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
339pub const CODESET: ::nl_item = 0;
340pub const D_T_FMT: ::nl_item = 1;
341pub const D_FMT: ::nl_item = 2;
342pub const T_FMT: ::nl_item = 3;
343pub const T_FMT_AMPM: ::nl_item = 4;
344pub const AM_STR: ::nl_item = 5;
345pub const PM_STR: ::nl_item = 6;
346
347pub const DAY_1: ::nl_item = 7;
348pub const DAY_2: ::nl_item = 8;
349pub const DAY_3: ::nl_item = 9;
350pub const DAY_4: ::nl_item = 10;
351pub const DAY_5: ::nl_item = 11;
352pub const DAY_6: ::nl_item = 12;
353pub const DAY_7: ::nl_item = 13;
354
355pub const ABDAY_1: ::nl_item = 14;
356pub const ABDAY_2: ::nl_item = 15;
357pub const ABDAY_3: ::nl_item = 16;
358pub const ABDAY_4: ::nl_item = 17;
359pub const ABDAY_5: ::nl_item = 18;
360pub const ABDAY_6: ::nl_item = 19;
361pub const ABDAY_7: ::nl_item = 20;
362
363pub const MON_1: ::nl_item = 21;
364pub const MON_2: ::nl_item = 22;
365pub const MON_3: ::nl_item = 23;
366pub const MON_4: ::nl_item = 24;
367pub const MON_5: ::nl_item = 25;
368pub const MON_6: ::nl_item = 26;
369pub const MON_7: ::nl_item = 27;
370pub const MON_8: ::nl_item = 28;
371pub const MON_9: ::nl_item = 29;
372pub const MON_10: ::nl_item = 30;
373pub const MON_11: ::nl_item = 31;
374pub const MON_12: ::nl_item = 32;
375
376pub const ABMON_1: ::nl_item = 33;
377pub const ABMON_2: ::nl_item = 34;
378pub const ABMON_3: ::nl_item = 35;
379pub const ABMON_4: ::nl_item = 36;
380pub const ABMON_5: ::nl_item = 37;
381pub const ABMON_6: ::nl_item = 38;
382pub const ABMON_7: ::nl_item = 39;
383pub const ABMON_8: ::nl_item = 40;
384pub const ABMON_9: ::nl_item = 41;
385pub const ABMON_10: ::nl_item = 42;
386pub const ABMON_11: ::nl_item = 43;
387pub const ABMON_12: ::nl_item = 44;
388
389pub const ERA: ::nl_item = 45;
390pub const ERA_D_FMT: ::nl_item = 46;
391pub const ERA_D_T_FMT: ::nl_item = 47;
392pub const ERA_T_FMT: ::nl_item = 48;
393pub const ALT_DIGITS: ::nl_item = 49;
394
395pub const RADIXCHAR: ::nl_item = 50;
396pub const THOUSEP: ::nl_item = 51;
397
398pub const YESEXPR: ::nl_item = 52;
399pub const NOEXPR: ::nl_item = 53;
400
401pub const YESSTR: ::nl_item = 54;
402pub const NOSTR: ::nl_item = 55;
403
404pub const CRNCYSTR: ::nl_item = 56;
405
406pub const D_MD_ORDER: ::nl_item = 57;
407
408pub const EXIT_FAILURE: ::c_int = 1;
409pub const EXIT_SUCCESS: ::c_int = 0;
410pub const RAND_MAX: ::c_int = 2147483647;
411pub const EOF: ::c_int = -1;
412pub const SEEK_SET: ::c_int = 0;
413pub const SEEK_CUR: ::c_int = 1;
414pub const SEEK_END: ::c_int = 2;
415pub const _IOFBF: ::c_int = 0;
416pub const _IONBF: ::c_int = 2;
417pub const _IOLBF: ::c_int = 1;
418pub const BUFSIZ: ::c_uint = 1024;
419pub const FOPEN_MAX: ::c_uint = 20;
420pub const FILENAME_MAX: ::c_uint = 1024;
421pub const L_tmpnam: ::c_uint = 1024;
422pub const TMP_MAX: ::c_uint = 308915776;
423pub const _PC_LINK_MAX: ::c_int = 1;
424pub const _PC_MAX_CANON: ::c_int = 2;
425pub const _PC_MAX_INPUT: ::c_int = 3;
426pub const _PC_NAME_MAX: ::c_int = 4;
427pub const _PC_PATH_MAX: ::c_int = 5;
428pub const _PC_PIPE_BUF: ::c_int = 6;
429pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
430pub const _PC_NO_TRUNC: ::c_int = 8;
431pub const _PC_VDISABLE: ::c_int = 9;
432pub const O_RDONLY: ::c_int = 0;
433pub const O_WRONLY: ::c_int = 1;
434pub const O_RDWR: ::c_int = 2;
435pub const O_APPEND: ::c_int = 8;
436pub const O_CREAT: ::c_int = 512;
437pub const O_EXCL: ::c_int = 2048;
438pub const O_NOCTTY: ::c_int = 131072;
439pub const O_TRUNC: ::c_int = 1024;
440pub const O_CLOEXEC: ::c_int = 0x1000000;
441pub const O_DIRECTORY: ::c_int = 0x100000;
442pub const S_IFIFO: mode_t = 4096;
443pub const S_IFCHR: mode_t = 8192;
444pub const S_IFBLK: mode_t = 24576;
445pub const S_IFDIR: mode_t = 16384;
446pub const S_IFREG: mode_t = 32768;
447pub const S_IFLNK: mode_t = 40960;
448pub const S_IFSOCK: mode_t = 49152;
449pub const S_IFMT: mode_t = 61440;
450pub const S_IEXEC: mode_t = 64;
451pub const S_IWRITE: mode_t = 128;
452pub const S_IREAD: mode_t = 256;
453pub const S_IRWXU: mode_t = 448;
454pub const S_IXUSR: mode_t = 64;
455pub const S_IWUSR: mode_t = 128;
456pub const S_IRUSR: mode_t = 256;
457pub const S_IRWXG: mode_t = 56;
458pub const S_IXGRP: mode_t = 8;
459pub const S_IWGRP: mode_t = 16;
460pub const S_IRGRP: mode_t = 32;
461pub const S_IRWXO: mode_t = 7;
462pub const S_IXOTH: mode_t = 1;
463pub const S_IWOTH: mode_t = 2;
464pub const S_IROTH: mode_t = 4;
465pub const F_OK: ::c_int = 0;
466pub const R_OK: ::c_int = 4;
467pub const W_OK: ::c_int = 2;
468pub const X_OK: ::c_int = 1;
469pub const STDIN_FILENO: ::c_int = 0;
470pub const STDOUT_FILENO: ::c_int = 1;
471pub const STDERR_FILENO: ::c_int = 2;
472pub const F_LOCK: ::c_int = 1;
473pub const F_TEST: ::c_int = 3;
474pub const F_TLOCK: ::c_int = 2;
475pub const F_ULOCK: ::c_int = 0;
476pub const F_GETLK: ::c_int = 7;
477pub const F_SETLK: ::c_int = 8;
478pub const F_SETLKW: ::c_int = 9;
479pub const SIGHUP: ::c_int = 1;
480pub const SIGINT: ::c_int = 2;
481pub const SIGQUIT: ::c_int = 3;
482pub const SIGILL: ::c_int = 4;
483pub const SIGABRT: ::c_int = 6;
484pub const SIGEMT: ::c_int = 7;
485pub const SIGFPE: ::c_int = 8;
486pub const SIGKILL: ::c_int = 9;
487pub const SIGSEGV: ::c_int = 11;
488pub const SIGPIPE: ::c_int = 13;
489pub const SIGALRM: ::c_int = 14;
490pub const SIGTERM: ::c_int = 15;
491
492pub const PROT_NONE: ::c_int = 0;
493pub const PROT_READ: ::c_int = 1;
494pub const PROT_WRITE: ::c_int = 2;
495pub const PROT_EXEC: ::c_int = 4;
496
497pub const MAP_FILE: ::c_int = 0x0000;
498pub const MAP_SHARED: ::c_int = 0x0001;
499pub const MAP_PRIVATE: ::c_int = 0x0002;
500pub const MAP_FIXED: ::c_int = 0x0010;
501pub const MAP_ANON: ::c_int = 0x1000;
502
503pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
504
505pub const MCL_CURRENT: ::c_int = 0x0001;
506pub const MCL_FUTURE: ::c_int = 0x0002;
507
508pub const MS_ASYNC: ::c_int = 0x0001;
509pub const MS_INVALIDATE: ::c_int = 0x0002;
510pub const MS_SYNC: ::c_int = 0x0010;
511
512pub const MS_KILLPAGES: ::c_int = 0x0004;
513pub const MS_DEACTIVATE: ::c_int = 0x0008;
514
515pub const EPERM: ::c_int = 1;
516pub const ENOENT: ::c_int = 2;
517pub const ESRCH: ::c_int = 3;
518pub const EINTR: ::c_int = 4;
519pub const EIO: ::c_int = 5;
520pub const ENXIO: ::c_int = 6;
521pub const E2BIG: ::c_int = 7;
522pub const ENOEXEC: ::c_int = 8;
523pub const EBADF: ::c_int = 9;
524pub const ECHILD: ::c_int = 10;
525pub const EDEADLK: ::c_int = 11;
526pub const ENOMEM: ::c_int = 12;
527pub const EACCES: ::c_int = 13;
528pub const EFAULT: ::c_int = 14;
529pub const ENOTBLK: ::c_int = 15;
530pub const EBUSY: ::c_int = 16;
531pub const EEXIST: ::c_int = 17;
532pub const EXDEV: ::c_int = 18;
533pub const ENODEV: ::c_int = 19;
534pub const ENOTDIR: ::c_int = 20;
535pub const EISDIR: ::c_int = 21;
536pub const EINVAL: ::c_int = 22;
537pub const ENFILE: ::c_int = 23;
538pub const EMFILE: ::c_int = 24;
539pub const ENOTTY: ::c_int = 25;
540pub const ETXTBSY: ::c_int = 26;
541pub const EFBIG: ::c_int = 27;
542pub const ENOSPC: ::c_int = 28;
543pub const ESPIPE: ::c_int = 29;
544pub const EROFS: ::c_int = 30;
545pub const EMLINK: ::c_int = 31;
546pub const EPIPE: ::c_int = 32;
547pub const EDOM: ::c_int = 33;
548pub const ERANGE: ::c_int = 34;
549pub const EAGAIN: ::c_int = 35;
550pub const EWOULDBLOCK: ::c_int = EAGAIN;
551pub const EINPROGRESS: ::c_int = 36;
552pub const EALREADY: ::c_int = 37;
553pub const ENOTSOCK: ::c_int = 38;
554pub const EDESTADDRREQ: ::c_int = 39;
555pub const EMSGSIZE: ::c_int = 40;
556pub const EPROTOTYPE: ::c_int = 41;
557pub const ENOPROTOOPT: ::c_int = 42;
558pub const EPROTONOSUPPORT: ::c_int = 43;
559pub const ESOCKTNOSUPPORT: ::c_int = 44;
560pub const ENOTSUP: ::c_int = 45;
561pub const EPFNOSUPPORT: ::c_int = 46;
562pub const EAFNOSUPPORT: ::c_int = 47;
563pub const EADDRINUSE: ::c_int = 48;
564pub const EADDRNOTAVAIL: ::c_int = 49;
565pub const ENETDOWN: ::c_int = 50;
566pub const ENETUNREACH: ::c_int = 51;
567pub const ENETRESET: ::c_int = 52;
568pub const ECONNABORTED: ::c_int = 53;
569pub const ECONNRESET: ::c_int = 54;
570pub const ENOBUFS: ::c_int = 55;
571pub const EISCONN: ::c_int = 56;
572pub const ENOTCONN: ::c_int = 57;
573pub const ESHUTDOWN: ::c_int = 58;
574pub const ETOOMANYREFS: ::c_int = 59;
575pub const ETIMEDOUT: ::c_int = 60;
576pub const ECONNREFUSED: ::c_int = 61;
577pub const ELOOP: ::c_int = 62;
578pub const ENAMETOOLONG: ::c_int = 63;
579pub const EHOSTDOWN: ::c_int = 64;
580pub const EHOSTUNREACH: ::c_int = 65;
581pub const ENOTEMPTY: ::c_int = 66;
582pub const EPROCLIM: ::c_int = 67;
583pub const EUSERS: ::c_int = 68;
584pub const EDQUOT: ::c_int = 69;
585pub const ESTALE: ::c_int = 70;
586pub const EREMOTE: ::c_int = 71;
587pub const EBADRPC: ::c_int = 72;
588pub const ERPCMISMATCH: ::c_int = 73;
589pub const EPROGUNAVAIL: ::c_int = 74;
590pub const EPROGMISMATCH: ::c_int = 75;
591pub const EPROCUNAVAIL: ::c_int = 76;
592pub const ENOLCK: ::c_int = 77;
593pub const ENOSYS: ::c_int = 78;
594pub const EFTYPE: ::c_int = 79;
595pub const EAUTH: ::c_int = 80;
596pub const ENEEDAUTH: ::c_int = 81;
597pub const EPWROFF: ::c_int = 82;
598pub const EDEVERR: ::c_int = 83;
599pub const EOVERFLOW: ::c_int = 84;
600pub const EBADEXEC: ::c_int = 85;
601pub const EBADARCH: ::c_int = 86;
602pub const ESHLIBVERS: ::c_int = 87;
603pub const EBADMACHO: ::c_int = 88;
604pub const ECANCELED: ::c_int = 89;
605pub const EIDRM: ::c_int = 90;
606pub const ENOMSG: ::c_int = 91;
607pub const EILSEQ: ::c_int = 92;
608pub const ENOATTR: ::c_int = 93;
609pub const EBADMSG: ::c_int = 94;
610pub const EMULTIHOP: ::c_int = 95;
611pub const ENODATA: ::c_int = 96;
612pub const ENOLINK: ::c_int = 97;
613pub const ENOSR: ::c_int = 98;
614pub const ENOSTR: ::c_int = 99;
615pub const EPROTO: ::c_int = 100;
616pub const ETIME: ::c_int = 101;
617pub const EOPNOTSUPP: ::c_int = 102;
618pub const ENOPOLICY: ::c_int = 103;
619pub const ENOTRECOVERABLE: ::c_int = 104;
620pub const EOWNERDEAD: ::c_int = 105;
621pub const EQFULL: ::c_int = 106;
622pub const ELAST: ::c_int = 106;
623
624pub const F_DUPFD: ::c_int = 0;
625pub const F_DUPFD_CLOEXEC: ::c_int = 67;
626pub const F_GETFD: ::c_int = 1;
627pub const F_SETFD: ::c_int = 2;
628pub const F_GETFL: ::c_int = 3;
629pub const F_SETFL: ::c_int = 4;
630pub const F_PREALLOCATE: ::c_int = 42;
631pub const F_RDADVISE: ::c_int = 44;
632pub const F_RDAHEAD: ::c_int = 45;
633pub const F_NOCACHE: ::c_int = 48;
634pub const F_GETPATH: ::c_int = 50;
635pub const F_FULLFSYNC: ::c_int = 51;
636pub const F_FREEZE_FS: ::c_int = 53;
637pub const F_THAW_FS: ::c_int = 54;
638pub const F_GLOBAL_NOCACHE: ::c_int = 55;
639pub const F_NODIRECT: ::c_int = 62;
640
641pub const F_ALLOCATECONTIG: ::c_uint = 0x02;
642pub const F_ALLOCATEALL: ::c_uint = 0x04;
643
644pub const F_PEOFPOSMODE: ::c_int = 3;
645pub const F_VOLPOSMODE: ::c_int = 4;
646
647pub const O_ACCMODE: ::c_int = 3;
648
649pub const TIOCMODG: ::c_ulong = 0x40047403;
650pub const TIOCMODS: ::c_ulong = 0x80047404;
651pub const TIOCM_LE: ::c_int = 0x1;
652pub const TIOCM_DTR: ::c_int = 0x2;
653pub const TIOCM_RTS: ::c_int = 0x4;
654pub const TIOCM_ST: ::c_int = 0x8;
655pub const TIOCM_SR: ::c_int = 0x10;
656pub const TIOCM_CTS: ::c_int = 0x20;
657pub const TIOCM_CAR: ::c_int = 0x40;
658pub const TIOCM_CD: ::c_int = 0x40;
659pub const TIOCM_RNG: ::c_int = 0x80;
660pub const TIOCM_RI: ::c_int = 0x80;
661pub const TIOCM_DSR: ::c_int = 0x100;
662pub const TIOCEXCL: ::c_int = 0x2000740d;
663pub const TIOCNXCL: ::c_int = 0x2000740e;
664pub const TIOCFLUSH: ::c_ulong = 0x80047410;
665pub const TIOCGETD: ::c_ulong = 0x4004741a;
666pub const TIOCSETD: ::c_ulong = 0x8004741b;
667pub const TIOCIXON: ::c_uint = 0x20007481;
668pub const TIOCIXOFF: ::c_uint = 0x20007480;
669pub const TIOCSBRK: ::c_uint = 0x2000747b;
670pub const TIOCCBRK: ::c_uint = 0x2000747a;
671pub const TIOCSDTR: ::c_uint = 0x20007479;
672pub const TIOCCDTR: ::c_uint = 0x20007478;
673pub const TIOCGPGRP: ::c_ulong = 0x40047477;
674pub const TIOCSPGRP: ::c_ulong = 0x80047476;
675pub const TIOCOUTQ: ::c_ulong = 0x40047473;
676pub const TIOCSTI: ::c_ulong = 0x80017472;
677pub const TIOCNOTTY: ::c_uint = 0x20007471;
678pub const TIOCPKT: ::c_ulong = 0x80047470;
679pub const TIOCPKT_DATA: ::c_int = 0x0;
680pub const TIOCPKT_FLUSHREAD: ::c_int = 0x1;
681pub const TIOCPKT_FLUSHWRITE: ::c_int = 0x2;
682pub const TIOCPKT_STOP: ::c_int = 0x4;
683pub const TIOCPKT_START: ::c_int = 0x8;
684pub const TIOCPKT_NOSTOP: ::c_int = 0x10;
685pub const TIOCPKT_DOSTOP: ::c_int = 0x20;
686pub const TIOCPKT_IOCTL: ::c_int = 0x40;
687pub const TIOCSTOP: ::c_uint = 0x2000746f;
688pub const TIOCSTART: ::c_uint = 0x2000746e;
689pub const TIOCMSET: ::c_ulong = 0x8004746d;
690pub const TIOCMBIS: ::c_ulong = 0x8004746c;
691pub const TIOCMBIC: ::c_ulong = 0x8004746b;
692pub const TIOCMGET: ::c_ulong = 0x4004746a;
693pub const TIOCREMOTE: ::c_ulong = 0x80047469;
694pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
695pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
696pub const TIOCUCNTL: ::c_ulong = 0x80047466;
697pub const TIOCSTAT: ::c_uint = 0x20007465;
698pub const TIOCSCONS: ::c_uint = 0x20007463;
699pub const TIOCCONS: ::c_ulong = 0x80047462;
700pub const TIOCSCTTY: ::c_uint = 0x20007461;
701pub const TIOCEXT: ::c_ulong = 0x80047460;
702pub const TIOCSIG: ::c_uint = 0x2000745f;
703pub const TIOCDRAIN: ::c_uint = 0x2000745e;
704pub const TIOCMSDTRWAIT: ::c_ulong = 0x8004745b;
705pub const TIOCMGDTRWAIT: ::c_ulong = 0x4004745a;
706pub const TIOCSDRAINWAIT: ::c_ulong = 0x80047457;
707pub const TIOCGDRAINWAIT: ::c_ulong = 0x40047456;
708pub const TIOCDSIMICROCODE: ::c_uint = 0x20007455;
709pub const TIOCPTYGRANT: ::c_uint = 0x20007454;
710pub const TIOCPTYGNAME: ::c_uint = 0x40807453;
711pub const TIOCPTYUNLK: ::c_uint = 0x20007452;
712
713pub const SIGTRAP: ::c_int = 5;
714
715pub const GLOB_APPEND : ::c_int = 0x0001;
716pub const GLOB_DOOFFS : ::c_int = 0x0002;
717pub const GLOB_ERR : ::c_int = 0x0004;
718pub const GLOB_MARK : ::c_int = 0x0008;
719pub const GLOB_NOCHECK : ::c_int = 0x0010;
720pub const GLOB_NOSORT : ::c_int = 0x0020;
721pub const GLOB_NOESCAPE: ::c_int = 0x2000;
722
723pub const GLOB_NOSPACE : ::c_int = -1;
724pub const GLOB_ABORTED : ::c_int = -2;
725pub const GLOB_NOMATCH : ::c_int = -3;
726
727pub const POSIX_MADV_NORMAL: ::c_int = 0;
728pub const POSIX_MADV_RANDOM: ::c_int = 1;
729pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
730pub const POSIX_MADV_WILLNEED: ::c_int = 3;
731pub const POSIX_MADV_DONTNEED: ::c_int = 4;
732
733pub const _SC_IOV_MAX: ::c_int = 56;
734pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
735pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
736pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
737pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
738pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
739pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
740pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
741pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
742pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
743pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
744pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
745pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
746pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
747pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
748pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
749pub const _SC_THREADS: ::c_int = 96;
750pub const _SC_TTY_NAME_MAX: ::c_int = 101;
751pub const _SC_ATEXIT_MAX: ::c_int = 107;
752pub const _SC_XOPEN_CRYPT: ::c_int = 108;
753pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
754pub const _SC_XOPEN_LEGACY: ::c_int = 110;
755pub const _SC_XOPEN_REALTIME: ::c_int = 111;
756pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
757pub const _SC_XOPEN_SHM: ::c_int = 113;
758pub const _SC_XOPEN_UNIX: ::c_int = 115;
759pub const _SC_XOPEN_VERSION: ::c_int = 116;
760pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;
761
762pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
763pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
764pub const PTHREAD_STACK_MIN: ::size_t = 8192;
765
766pub const RLIMIT_CPU: ::c_int = 0;
767pub const RLIMIT_FSIZE: ::c_int = 1;
768pub const RLIMIT_DATA: ::c_int = 2;
769pub const RLIMIT_STACK: ::c_int = 3;
770pub const RLIMIT_CORE: ::c_int = 4;
771pub const RLIMIT_AS: ::c_int = 5;
772pub const RLIMIT_RSS: ::c_int = RLIMIT_AS;
773pub const RLIMIT_MEMLOCK: ::c_int = 6;
774pub const RLIMIT_NPROC: ::c_int = 7;
775pub const RLIMIT_NOFILE: ::c_int = 8;
776pub const RLIM_NLIMITS: ::c_int = 9;
777pub const _RLIMIT_POSIX_FLAG: ::c_int = 0x1000;
778
779pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
780
781pub const RUSAGE_SELF: ::c_int = 0;
782pub const RUSAGE_CHILDREN: ::c_int = -1;
783
784pub const MADV_NORMAL: ::c_int = 0;
785pub const MADV_RANDOM: ::c_int = 1;
786pub const MADV_SEQUENTIAL: ::c_int = 2;
787pub const MADV_WILLNEED: ::c_int = 3;
788pub const MADV_DONTNEED: ::c_int = 4;
789pub const MADV_FREE: ::c_int = 5;
790pub const MADV_ZERO_WIRED_PAGES: ::c_int = 6;
791pub const MADV_FREE_REUSABLE: ::c_int = 7;
792pub const MADV_FREE_REUSE: ::c_int = 8;
793pub const MADV_CAN_REUSE: ::c_int = 9;
794
795pub const MINCORE_INCORE: ::c_int = 0x1;
796pub const MINCORE_REFERENCED: ::c_int = 0x2;
797pub const MINCORE_MODIFIED: ::c_int = 0x4;
798pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8;
799pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10;
800
801pub const AF_UNIX: ::c_int = 1;
802pub const AF_INET: ::c_int = 2;
803pub const AF_INET6: ::c_int = 30;
804pub const SOCK_STREAM: ::c_int = 1;
805pub const SOCK_DGRAM: ::c_int = 2;
806pub const SOCK_RAW: ::c_int = 3;
807pub const SOCK_SEQPACKET: ::c_int = 5;
808pub const IPPROTO_TCP: ::c_int = 6;
809pub const IPPROTO_IP: ::c_int = 0;
810pub const IPPROTO_IPV6: ::c_int = 41;
811pub const IP_MULTICAST_TTL: ::c_int = 10;
812pub const IP_MULTICAST_LOOP: ::c_int = 11;
813pub const IP_TTL: ::c_int = 4;
814pub const IP_HDRINCL: ::c_int = 2;
815pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
816pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
817pub const IPV6_JOIN_GROUP: ::c_int = 12;
818pub const IPV6_LEAVE_GROUP: ::c_int = 13;
819
820pub const TCP_NODELAY: ::c_int = 0x01;
821pub const TCP_KEEPALIVE: ::c_int = 0x10;
822pub const SOL_SOCKET: ::c_int = 0xffff;
823
824pub const SO_DEBUG: ::c_int = 0x01;
825pub const SO_ACCEPTCONN: ::c_int = 0x0002;
826pub const SO_REUSEADDR: ::c_int = 0x0004;
827pub const SO_KEEPALIVE: ::c_int = 0x0008;
828pub const SO_DONTROUTE: ::c_int = 0x0010;
829pub const SO_BROADCAST: ::c_int = 0x0020;
830pub const SO_USELOOPBACK: ::c_int = 0x0040;
831pub const SO_LINGER: ::c_int = 0x0080;
832pub const SO_OOBINLINE: ::c_int = 0x0100;
833pub const SO_REUSEPORT: ::c_int = 0x0200;
834pub const SO_SNDBUF: ::c_int = 0x1001;
835pub const SO_RCVBUF: ::c_int = 0x1002;
836pub const SO_SNDLOWAT: ::c_int = 0x1003;
837pub const SO_RCVLOWAT: ::c_int = 0x1004;
838pub const SO_SNDTIMEO: ::c_int = 0x1005;
839pub const SO_RCVTIMEO: ::c_int = 0x1006;
840pub const SO_ERROR: ::c_int = 0x1007;
841pub const SO_TYPE: ::c_int = 0x1008;
842
843pub const IFF_LOOPBACK: ::c_int = 0x8;
844
845pub const SHUT_RD: ::c_int = 0;
846pub const SHUT_WR: ::c_int = 1;
847pub const SHUT_RDWR: ::c_int = 2;
848
849pub const LOCK_SH: ::c_int = 1;
850pub const LOCK_EX: ::c_int = 2;
851pub const LOCK_NB: ::c_int = 4;
852pub const LOCK_UN: ::c_int = 8;
853
854pub const O_DSYNC: ::c_int = 4194304;
855pub const O_SYNC: ::c_int = 128;
856pub const O_NONBLOCK: ::c_int = 4;
857
858pub const MAP_COPY: ::c_int = 0x0002;
859pub const MAP_RENAME: ::c_int = 0x0020;
860pub const MAP_NORESERVE: ::c_int = 0x0040;
861pub const MAP_NOEXTEND: ::c_int = 0x0100;
862pub const MAP_HASSEMAPHORE: ::c_int = 0x0200;
863pub const MAP_NOCACHE: ::c_int = 0x0400;
864pub const MAP_JIT: ::c_int = 0x0800;
865
866pub const IPPROTO_RAW: ::c_int = 255;
867
868pub const SO_NREAD: ::c_int = 0x1020;
869pub const SO_NKE: ::c_int = 0x1021;
870pub const SO_NOSIGPIPE: ::c_int = 0x1022;
871pub const SO_NOADDRERR: ::c_int = 0x1023;
872pub const SO_NWRITE: ::c_int = 0x1024;
873pub const SO_DONTTRUNC: ::c_int = 0x2000;
874pub const SO_WANTMORE: ::c_int = 0x4000;
875pub const SO_WANTOOBFLAG: ::c_int = 0x8000;
876
877pub const _SC_ARG_MAX: ::c_int = 1;
878pub const _SC_CHILD_MAX: ::c_int = 2;
879pub const _SC_CLK_TCK: ::c_int = 3;
880pub const _SC_NGROUPS_MAX: ::c_int = 4;
881pub const _SC_OPEN_MAX: ::c_int = 5;
882pub const _SC_JOB_CONTROL: ::c_int = 6;
883pub const _SC_SAVED_IDS: ::c_int = 7;
884pub const _SC_VERSION: ::c_int = 8;
885pub const _SC_BC_BASE_MAX: ::c_int = 9;
886pub const _SC_BC_DIM_MAX: ::c_int = 10;
887pub const _SC_BC_SCALE_MAX: ::c_int = 11;
888pub const _SC_BC_STRING_MAX: ::c_int = 12;
889pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13;
890pub const _SC_EXPR_NEST_MAX: ::c_int = 14;
891pub const _SC_LINE_MAX: ::c_int = 15;
892pub const _SC_RE_DUP_MAX: ::c_int = 16;
893pub const _SC_2_VERSION: ::c_int = 17;
894pub const _SC_2_C_BIND: ::c_int = 18;
895pub const _SC_2_C_DEV: ::c_int = 19;
896pub const _SC_2_CHAR_TERM: ::c_int = 20;
897pub const _SC_2_FORT_DEV: ::c_int = 21;
898pub const _SC_2_FORT_RUN: ::c_int = 22;
899pub const _SC_2_LOCALEDEF: ::c_int = 23;
900pub const _SC_2_SW_DEV: ::c_int = 24;
901pub const _SC_2_UPE: ::c_int = 25;
902pub const _SC_STREAM_MAX: ::c_int = 26;
903pub const _SC_TZNAME_MAX: ::c_int = 27;
904pub const _SC_ASYNCHRONOUS_IO: ::c_int = 28;
905pub const _SC_PAGESIZE: ::c_int = 29;
906pub const _SC_MEMLOCK: ::c_int = 30;
907pub const _SC_MEMLOCK_RANGE: ::c_int = 31;
908pub const _SC_MEMORY_PROTECTION: ::c_int = 32;
909pub const _SC_MESSAGE_PASSING: ::c_int = 33;
910pub const _SC_PRIORITIZED_IO: ::c_int = 34;
911pub const _SC_PRIORITY_SCHEDULING: ::c_int = 35;
912pub const _SC_REALTIME_SIGNALS: ::c_int = 36;
913pub const _SC_SEMAPHORES: ::c_int = 37;
914pub const _SC_FSYNC: ::c_int = 38;
915pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 39;
916pub const _SC_SYNCHRONIZED_IO: ::c_int = 40;
917pub const _SC_TIMERS: ::c_int = 41;
918pub const _SC_AIO_LISTIO_MAX: ::c_int = 42;
919pub const _SC_AIO_MAX: ::c_int = 43;
920pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44;
921pub const _SC_DELAYTIMER_MAX: ::c_int = 45;
922pub const _SC_MQ_OPEN_MAX: ::c_int = 46;
923pub const _SC_MAPPED_FILES: ::c_int = 47;
924pub const _SC_RTSIG_MAX: ::c_int = 48;
925pub const _SC_SEM_NSEMS_MAX: ::c_int = 49;
926pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
927pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
928pub const _SC_TIMER_MAX: ::c_int = 52;
929pub const _SC_NPROCESSORS_CONF: ::c_int = 57;
930pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
931pub const _SC_2_PBS: ::c_int = 59;
932pub const _SC_2_PBS_ACCOUNTING: ::c_int = 60;
933pub const _SC_2_PBS_CHECKPOINT: ::c_int = 61;
934pub const _SC_2_PBS_LOCATE: ::c_int = 62;
935pub const _SC_2_PBS_MESSAGE: ::c_int = 63;
936pub const _SC_2_PBS_TRACK: ::c_int = 64;
937pub const _SC_ADVISORY_INFO: ::c_int = 65;
938pub const _SC_BARRIERS: ::c_int = 66;
939pub const _SC_CLOCK_SELECTION: ::c_int = 67;
940pub const _SC_CPUTIME: ::c_int = 68;
941pub const _SC_FILE_LOCKING: ::c_int = 69;
942pub const _SC_HOST_NAME_MAX: ::c_int = 72;
943pub const _SC_MONOTONIC_CLOCK: ::c_int = 74;
944pub const _SC_READER_WRITER_LOCKS: ::c_int = 76;
945pub const _SC_REGEXP: ::c_int = 77;
946pub const _SC_SHELL: ::c_int = 78;
947pub const _SC_SPAWN: ::c_int = 79;
948pub const _SC_SPIN_LOCKS: ::c_int = 80;
949pub const _SC_SPORADIC_SERVER: ::c_int = 81;
950pub const _SC_THREAD_CPUTIME: ::c_int = 84;
951pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 92;
952pub const _SC_TIMEOUTS: ::c_int = 95;
953pub const _SC_TRACE: ::c_int = 97;
954pub const _SC_TRACE_EVENT_FILTER: ::c_int = 98;
955pub const _SC_TRACE_INHERIT: ::c_int = 99;
956pub const _SC_TRACE_LOG: ::c_int = 100;
957pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 102;
958pub const _SC_V6_ILP32_OFF32: ::c_int = 103;
959pub const _SC_V6_ILP32_OFFBIG: ::c_int = 104;
960pub const _SC_V6_LP64_OFF64: ::c_int = 105;
961pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 106;
962pub const _SC_IPV6: ::c_int = 118;
963pub const _SC_RAW_SOCKETS: ::c_int = 119;
964pub const _SC_SYMLOOP_MAX: ::c_int = 120;
965pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
966pub const _SC_XOPEN_STREAMS: ::c_int = 114;
967pub const _SC_XBS5_ILP32_OFF32: ::c_int = 122;
968pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 123;
969pub const _SC_XBS5_LP64_OFF64: ::c_int = 124;
970pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 125;
971pub const _SC_SS_REPL_MAX: ::c_int = 126;
972pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 127;
973pub const _SC_TRACE_NAME_MAX: ::c_int = 128;
974pub const _SC_TRACE_SYS_MAX: ::c_int = 129;
975pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 130;
976pub const _SC_PASS_MAX: ::c_int = 131;
977
978pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
979pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
980pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
981pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
982pub const _PTHREAD_MUTEX_SIG_init: ::c_long = 0x32AAABA7;
983pub const _PTHREAD_COND_SIG_init: ::c_long = 0x3CB0B1BB;
984pub const _PTHREAD_RWLOCK_SIG_init: ::c_long = 0x2DA8B3B4;
985pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
986 __sig: _PTHREAD_MUTEX_SIG_init,
987 __opaque: [0; __PTHREAD_MUTEX_SIZE__],
988};
989pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
990 __sig: _PTHREAD_COND_SIG_init,
991 __opaque: [0; __PTHREAD_COND_SIZE__],
992};
993pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
994 __sig: _PTHREAD_RWLOCK_SIG_init,
995 __opaque: [0; __PTHREAD_RWLOCK_SIZE__],
996};
997
998pub const SIGSTKSZ: ::size_t = 131072;
999
1000pub const FD_SETSIZE: usize = 1024;
1001
1002pub const ST_NOSUID: ::c_ulong = 2;
1003
1004pub const EVFILT_AIO: ::int16_t = 0xfffd;
1005pub const EVFILT_PROC: ::int16_t = 0xfffb;
1006pub const EVFILT_READ: ::int16_t = 0xffff;
1007pub const EVFILT_SIGNAL: ::int16_t = 0xfffa;
1008pub const EVFILT_SYSCOUNT: ::int16_t = 0xe;
1009pub const EVFILT_TIMER: ::int16_t = 0xfff9;
1010pub const EVFILT_VNODE: ::int16_t = 0xfffc;
1011pub const EVFILT_WRITE: ::int16_t = 0xfffe;
1012pub const EVFILT_FS: ::int16_t = 0xfff7;
1013pub const EVFILT_MACHPORT: ::int16_t = 0xfff8;
1014pub const EVFILT_USER: ::int16_t = 0xfff6;
1015pub const EVFILT_VM: ::int16_t = 0xfff4;
1016
1017pub const EV_DISPATCH: ::uint16_t = 0x80;
1018pub const EV_FLAG0: ::uint16_t = 0x1000;
1019pub const EV_OOBAND: ::uint16_t = 0x2000;
1020pub const EV_POLL: ::uint16_t = 0x1000;
1021pub const EV_RECEIPT: ::uint16_t = 0x40;
1022
1023pub const NOTE_ABSOLUTE: ::uint32_t = 0x8;
1024pub const NOTE_EXITSTATUS: ::uint32_t = 0x04000000;
1025pub const NOTE_EXIT_REPARENTED: ::uint32_t = 0x00080000;
1026pub const NOTE_FFAND: ::uint32_t = 0x40000000;
1027pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
1028pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
1029pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
1030pub const NOTE_FFNOP: ::uint32_t = 0x0;
1031pub const NOTE_FFOR: ::uint32_t = 0x80000000;
1032pub const NOTE_NONE: ::uint32_t = 0x80;
1033pub const NOTE_NSECONDS: ::uint32_t = 0x4;
1034pub const NOTE_REAP: ::uint32_t = 0x10000000;
1035pub const NOTE_SECONDS: ::uint32_t = 0x1;
1036pub const NOTE_SIGNAL: ::uint32_t = 0x8000000;
1037pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
1038pub const NOTE_USECONDS: ::uint32_t = 0x2;
1039pub const NOTE_VM_ERROR: ::uint32_t = 0x10000000;
1040pub const NOTE_VM_PRESSURE: ::uint32_t = 0x80000000;
1041pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: ::uint32_t = 0x20000000;
1042pub const NOTE_VM_PRESSURE_TERMINATE: ::uint32_t = 0x40000000;
1043pub const NOTE_PCTRLMASK: ::uint32_t = 0xfff00000;
1044
1045pub const NL0: ::c_int = 0x00000000;
1046pub const NL1: ::c_int = 0x00000100;
1047pub const TAB0: ::c_int = 0x00000000;
1048pub const TAB1: ::c_int = 0x00000400;
1049pub const TAB2: ::c_int = 0x00000800;
1050pub const CR0: ::c_int = 0x00000000;
1051pub const CR1: ::c_int = 0x00001000;
1052pub const CR2: ::c_int = 0x00002000;
1053pub const CR3: ::c_int = 0x00003000;
1054pub const FF0: ::c_int = 0x00000000;
1055pub const FF1: ::c_int = 0x00004000;
1056pub const BS0: ::c_int = 0x00000000;
1057pub const BS1: ::c_int = 0x00008000;
1058pub const TAB3: ::c_int = 0x00000004;
1059pub const VT0: ::c_int = 0x00000000;
1060pub const VT1: ::c_int = 0x00010000;
1061pub const IUTF8: ::tcflag_t = 0x00004000;
1062pub const CRTSCTS: ::tcflag_t = 0x00030000;
1063
1064pub const NI_MAXHOST: ::socklen_t = 1025;
1065
1066pub const Q_GETQUOTA: ::c_int = 0x300;
1067pub const Q_SETQUOTA: ::c_int = 0x400;
1068
1069pub const RTLD_LOCAL: ::c_int = 0x4;
1070pub const RTLD_FIRST: ::c_int = 0x100;
1071pub const RTLD_NODELETE: ::c_int = 0x80;
1072pub const RTLD_NOLOAD: ::c_int = 0x10;
1073pub const RTLD_GLOBAL: ::c_int = 0x8;
1074
1075pub const _WSTOPPED: ::c_int = 0o177;
1076
1077pub const LOG_NETINFO: ::c_int = 12 << 3;
1078pub const LOG_REMOTEAUTH: ::c_int = 13 << 3;
1079pub const LOG_INSTALL: ::c_int = 14 << 3;
1080pub const LOG_RAS: ::c_int = 15 << 3;
1081pub const LOG_LAUNCHD: ::c_int = 24 << 3;
1082pub const LOG_NFACILITIES: ::c_int = 25;
1083
1084pub const CTLTYPE: ::c_int = 0xf;
1085pub const CTLTYPE_NODE: ::c_int = 1;
1086pub const CTLTYPE_INT: ::c_int = 2;
1087pub const CTLTYPE_STRING: ::c_int = 3;
1088pub const CTLTYPE_QUAD: ::c_int = 4;
1089pub const CTLTYPE_OPAQUE: ::c_int = 5;
1090pub const CTLTYPE_STRUCT: ::c_int = CTLTYPE_OPAQUE;
1091pub const CTLFLAG_RD: ::c_int = 0x80000000;
1092pub const CTLFLAG_WR: ::c_int = 0x40000000;
1093pub const CTLFLAG_RW: ::c_int = CTLFLAG_RD | CTLFLAG_WR;
1094pub const CTLFLAG_NOLOCK: ::c_int = 0x20000000;
1095pub const CTLFLAG_ANYBODY: ::c_int = 0x10000000;
1096pub const CTLFLAG_SECURE: ::c_int = 0x08000000;
1097pub const CTLFLAG_MASKED: ::c_int = 0x04000000;
1098pub const CTLFLAG_NOAUTO: ::c_int = 0x02000000;
1099pub const CTLFLAG_KERN: ::c_int = 0x01000000;
1100pub const CTLFLAG_LOCKED: ::c_int = 0x00800000;
1101pub const CTLFLAG_OID2: ::c_int = 0x00400000;
1102pub const CTL_UNSPEC: ::c_int = 0;
1103pub const CTL_KERN: ::c_int = 1;
1104pub const CTL_VM: ::c_int = 2;
1105pub const CTL_VFS: ::c_int = 3;
1106pub const CTL_NET: ::c_int = 4;
1107pub const CTL_DEBUG: ::c_int = 5;
1108pub const CTL_HW: ::c_int = 6;
1109pub const CTL_MACHDEP: ::c_int = 7;
1110pub const CTL_USER: ::c_int = 8;
1111pub const CTL_MAXID: ::c_int = 9;
1112pub const KERN_OSTYPE: ::c_int = 1;
1113pub const KERN_OSRELEASE: ::c_int = 2;
1114pub const KERN_OSREV: ::c_int = 3;
1115pub const KERN_VERSION: ::c_int = 4;
1116pub const KERN_MAXVNODES: ::c_int = 5;
1117pub const KERN_MAXPROC: ::c_int = 6;
1118pub const KERN_MAXFILES: ::c_int = 7;
1119pub const KERN_ARGMAX: ::c_int = 8;
1120pub const KERN_SECURELVL: ::c_int = 9;
1121pub const KERN_HOSTNAME: ::c_int = 10;
1122pub const KERN_HOSTID: ::c_int = 11;
1123pub const KERN_CLOCKRATE: ::c_int = 12;
1124pub const KERN_VNODE: ::c_int = 13;
1125pub const KERN_PROC: ::c_int = 14;
1126pub const KERN_FILE: ::c_int = 15;
1127pub const KERN_PROF: ::c_int = 16;
1128pub const KERN_POSIX1: ::c_int = 17;
1129pub const KERN_NGROUPS: ::c_int = 18;
1130pub const KERN_JOB_CONTROL: ::c_int = 19;
1131pub const KERN_SAVED_IDS: ::c_int = 20;
1132pub const KERN_BOOTTIME: ::c_int = 21;
1133pub const KERN_NISDOMAINNAME: ::c_int = 22;
1134pub const KERN_DOMAINNAME: ::c_int = KERN_NISDOMAINNAME;
1135pub const KERN_MAXPARTITIONS: ::c_int = 23;
1136pub const KERN_KDEBUG: ::c_int = 24;
1137pub const KERN_UPDATEINTERVAL: ::c_int = 25;
1138pub const KERN_OSRELDATE: ::c_int = 26;
1139pub const KERN_NTP_PLL: ::c_int = 27;
1140pub const KERN_BOOTFILE: ::c_int = 28;
1141pub const KERN_MAXFILESPERPROC: ::c_int = 29;
1142pub const KERN_MAXPROCPERUID: ::c_int = 30;
1143pub const KERN_DUMPDEV: ::c_int = 31;
1144pub const KERN_IPC: ::c_int = 32;
1145pub const KERN_DUMMY: ::c_int = 33;
1146pub const KERN_PS_STRINGS: ::c_int = 34;
1147pub const KERN_USRSTACK32: ::c_int = 35;
1148pub const KERN_LOGSIGEXIT: ::c_int = 36;
1149pub const KERN_SYMFILE: ::c_int = 37;
1150pub const KERN_PROCARGS: ::c_int = 38;
1151pub const KERN_NETBOOT: ::c_int = 40;
1152pub const KERN_SYSV: ::c_int = 42;
1153pub const KERN_AFFINITY: ::c_int = 43;
1154pub const KERN_TRANSLATE: ::c_int = 44;
1155pub const KERN_CLASSIC: ::c_int = KERN_TRANSLATE;
1156pub const KERN_EXEC: ::c_int = 45;
1157pub const KERN_CLASSICHANDLER: ::c_int = KERN_EXEC;
1158pub const KERN_AIOMAX: ::c_int = 46;
1159pub const KERN_AIOPROCMAX: ::c_int = 47;
1160pub const KERN_AIOTHREADS: ::c_int = 48;
1161pub const KERN_COREFILE: ::c_int = 50;
1162pub const KERN_COREDUMP: ::c_int = 51;
1163pub const KERN_SUGID_COREDUMP: ::c_int = 52;
1164pub const KERN_PROCDELAYTERM: ::c_int = 53;
1165pub const KERN_SHREG_PRIVATIZABLE: ::c_int = 54;
1166pub const KERN_LOW_PRI_WINDOW: ::c_int = 56;
1167pub const KERN_LOW_PRI_DELAY: ::c_int = 57;
1168pub const KERN_POSIX: ::c_int = 58;
1169pub const KERN_USRSTACK64: ::c_int = 59;
1170pub const KERN_NX_PROTECTION: ::c_int = 60;
1171pub const KERN_TFP: ::c_int = 61;
1172pub const KERN_PROCNAME: ::c_int = 62;
1173pub const KERN_THALTSTACK: ::c_int = 63;
1174pub const KERN_SPECULATIVE_READS: ::c_int = 64;
1175pub const KERN_OSVERSION: ::c_int = 65;
1176pub const KERN_SAFEBOOT: ::c_int = 66;
1177pub const KERN_RAGEVNODE: ::c_int = 68;
1178pub const KERN_TTY: ::c_int = 69;
1179pub const KERN_CHECKOPENEVT: ::c_int = 70;
1180pub const KERN_THREADNAME: ::c_int = 71;
1181pub const KERN_MAXID: ::c_int = 72;
1182pub const KERN_RAGE_PROC: ::c_int = 1;
1183pub const KERN_RAGE_THREAD: ::c_int = 2;
1184pub const KERN_UNRAGE_PROC: ::c_int = 3;
1185pub const KERN_UNRAGE_THREAD: ::c_int = 4;
1186pub const KERN_OPENEVT_PROC: ::c_int = 1;
1187pub const KERN_UNOPENEVT_PROC: ::c_int = 2;
1188pub const KERN_TFP_POLICY: ::c_int = 1;
1189pub const KERN_TFP_POLICY_DENY: ::c_int = 0;
1190pub const KERN_TFP_POLICY_DEFAULT: ::c_int = 2;
1191pub const KERN_KDEFLAGS: ::c_int = 1;
1192pub const KERN_KDDFLAGS: ::c_int = 2;
1193pub const KERN_KDENABLE: ::c_int = 3;
1194pub const KERN_KDSETBUF: ::c_int = 4;
1195pub const KERN_KDGETBUF: ::c_int = 5;
1196pub const KERN_KDSETUP: ::c_int = 6;
1197pub const KERN_KDREMOVE: ::c_int = 7;
1198pub const KERN_KDSETREG: ::c_int = 8;
1199pub const KERN_KDGETREG: ::c_int = 9;
1200pub const KERN_KDREADTR: ::c_int = 10;
1201pub const KERN_KDPIDTR: ::c_int = 11;
1202pub const KERN_KDTHRMAP: ::c_int = 12;
1203pub const KERN_KDPIDEX: ::c_int = 14;
1204pub const KERN_KDSETRTCDEC: ::c_int = 15;
1205pub const KERN_KDGETENTROPY: ::c_int = 16;
1206pub const KERN_KDWRITETR: ::c_int = 17;
1207pub const KERN_KDWRITEMAP: ::c_int = 18;
1208pub const KERN_KDENABLE_BG_TRACE: ::c_int = 19;
1209pub const KERN_KDDISABLE_BG_TRACE: ::c_int = 20;
1210pub const KERN_KDREADCURTHRMAP: ::c_int = 21;
1211pub const KERN_KDSET_TYPEFILTER: ::c_int = 22;
1212pub const KERN_KDBUFWAIT: ::c_int = 23;
1213pub const KERN_KDCPUMAP: ::c_int = 24;
1214pub const KERN_PROC_ALL: ::c_int = 0;
1215pub const KERN_PROC_PID: ::c_int = 1;
1216pub const KERN_PROC_PGRP: ::c_int = 2;
1217pub const KERN_PROC_SESSION: ::c_int = 3;
1218pub const KERN_PROC_TTY: ::c_int = 4;
1219pub const KERN_PROC_UID: ::c_int = 5;
1220pub const KERN_PROC_RUID: ::c_int = 6;
1221pub const KERN_PROC_LCID: ::c_int = 7;
1222pub const KIPC_MAXSOCKBUF: ::c_int = 1;
1223pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
1224pub const KIPC_SOMAXCONN: ::c_int = 3;
1225pub const KIPC_MAX_LINKHDR: ::c_int = 4;
1226pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
1227pub const KIPC_MAX_HDR: ::c_int = 6;
1228pub const KIPC_MAX_DATALEN: ::c_int = 7;
1229pub const KIPC_MBSTAT: ::c_int = 8;
1230pub const KIPC_NMBCLUSTERS: ::c_int = 9;
1231pub const KIPC_SOQLIMITCOMPAT: ::c_int = 10;
1232pub const VM_METER: ::c_int = 1;
1233pub const VM_LOADAVG: ::c_int = 2;
1234pub const VM_MACHFACTOR: ::c_int = 4;
1235pub const VM_SWAPUSAGE: ::c_int = 5;
1236pub const VM_MAXID: ::c_int = 6;
1237pub const HW_MACHINE: ::c_int = 1;
1238pub const HW_MODEL: ::c_int = 2;
1239pub const HW_NCPU: ::c_int = 3;
1240pub const HW_BYTEORDER: ::c_int = 4;
1241pub const HW_PHYSMEM: ::c_int = 5;
1242pub const HW_USERMEM: ::c_int = 6;
1243pub const HW_PAGESIZE: ::c_int = 7;
1244pub const HW_DISKNAMES: ::c_int = 8;
1245pub const HW_DISKSTATS: ::c_int = 9;
1246pub const HW_EPOCH: ::c_int = 10;
1247pub const HW_FLOATINGPT: ::c_int = 11;
1248pub const HW_MACHINE_ARCH: ::c_int = 12;
1249pub const HW_VECTORUNIT: ::c_int = 13;
1250pub const HW_BUS_FREQ: ::c_int = 14;
1251pub const HW_CPU_FREQ: ::c_int = 15;
1252pub const HW_CACHELINE: ::c_int = 16;
1253pub const HW_L1ICACHESIZE: ::c_int = 17;
1254pub const HW_L1DCACHESIZE: ::c_int = 18;
1255pub const HW_L2SETTINGS: ::c_int = 19;
1256pub const HW_L2CACHESIZE: ::c_int = 20;
1257pub const HW_L3SETTINGS: ::c_int = 21;
1258pub const HW_L3CACHESIZE: ::c_int = 22;
1259pub const HW_TB_FREQ: ::c_int = 23;
1260pub const HW_MEMSIZE: ::c_int = 24;
1261pub const HW_AVAILCPU: ::c_int = 25;
1262pub const HW_MAXID: ::c_int = 26;
1263pub const USER_CS_PATH: ::c_int = 1;
1264pub const USER_BC_BASE_MAX: ::c_int = 2;
1265pub const USER_BC_DIM_MAX: ::c_int = 3;
1266pub const USER_BC_SCALE_MAX: ::c_int = 4;
1267pub const USER_BC_STRING_MAX: ::c_int = 5;
1268pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
1269pub const USER_EXPR_NEST_MAX: ::c_int = 7;
1270pub const USER_LINE_MAX: ::c_int = 8;
1271pub const USER_RE_DUP_MAX: ::c_int = 9;
1272pub const USER_POSIX2_VERSION: ::c_int = 10;
1273pub const USER_POSIX2_C_BIND: ::c_int = 11;
1274pub const USER_POSIX2_C_DEV: ::c_int = 12;
1275pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
1276pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
1277pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
1278pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
1279pub const USER_POSIX2_SW_DEV: ::c_int = 17;
1280pub const USER_POSIX2_UPE: ::c_int = 18;
1281pub const USER_STREAM_MAX: ::c_int = 19;
1282pub const USER_TZNAME_MAX: ::c_int = 20;
1283pub const USER_MAXID: ::c_int = 21;
1284pub const CTL_DEBUG_NAME: ::c_int = 0;
1285pub const CTL_DEBUG_VALUE: ::c_int = 1;
1286pub const CTL_DEBUG_MAXID: ::c_int = 20;
1287
1288pub const POLLRDNORM: ::c_short = 0x040;
1289pub const POLLWRNORM: ::c_short = 0x004;
1290pub const POLLRDBAND: ::c_short = 0x080;
1291pub const POLLWRBAND: ::c_short = 0x100;
1292
1293pub const PRIO_DARWIN_THREAD: ::c_int = 3;
1294pub const PRIO_DARWIN_PROCESS: ::c_int = 4;
1295pub const PRIO_DARWIN_BG: ::c_int = 0x1000;
1296pub const PRIO_DARWIN_NONUI: ::c_int = 0x1001;
1297
1298pub const SEM_FAILED: *mut sem_t = -1isize as *mut ::sem_t;
1299
1300f! {
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
1322extern {
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
1454cfg_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 @@
1pub type clock_t = u64;
2pub type ino_t = u64;
3pub type nlink_t = u32;
4pub type blksize_t = i64;
5pub type clockid_t = ::c_ulong;
6
7pub type c_long = i64;
8pub type c_ulong = u64;
9pub type time_t = i64;
10pub type suseconds_t = i64;
11
12pub type uuid_t = ::uuid;
13
14pub type fsblkcnt_t = u64;
15pub type fsfilcnt_t = u64;
16
17s! {
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
84pub const RAND_MAX: ::c_int = 0x7fff_ffff;
85pub const PTHREAD_STACK_MIN: ::size_t = 1024;
86pub const SIGSTKSZ: ::size_t = 40960;
87pub const MADV_INVAL: ::c_int = 10;
88pub const O_CLOEXEC: ::c_int = 0x00020000;
89pub const F_GETLK: ::c_int = 7;
90pub const F_SETLK: ::c_int = 8;
91pub const F_SETLKW: ::c_int = 9;
92pub const ELAST: ::c_int = 99;
93pub const RLIMIT_POSIXLOCKS: ::c_int = 11;
94pub const RLIM_NLIMITS: ::rlim_t = 12;
95
96pub const Q_GETQUOTA: ::c_int = 0x300;
97pub const Q_SETQUOTA: ::c_int = 0x400;
98
99pub const CLOCK_REALTIME: clockid_t = 0;
100pub const CLOCK_VIRTUAL: clockid_t = 1;
101pub const CLOCK_PROF: clockid_t = 2;
102pub const CLOCK_MONOTONIC: clockid_t = 4;
103pub const CLOCK_UPTIME: clockid_t = 5;
104pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
105pub const CLOCK_UPTIME_FAST: clockid_t = 8;
106pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
107pub const CLOCK_REALTIME_FAST: clockid_t = 10;
108pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
109pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
110pub const CLOCK_SECOND: clockid_t = 13;
111pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
112pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
113
114pub const CTL_UNSPEC: ::c_int = 0;
115pub const CTL_KERN: ::c_int = 1;
116pub const CTL_VM: ::c_int = 2;
117pub const CTL_VFS: ::c_int = 3;
118pub const CTL_NET: ::c_int = 4;
119pub const CTL_DEBUG: ::c_int = 5;
120pub const CTL_HW: ::c_int = 6;
121pub const CTL_MACHDEP: ::c_int = 7;
122pub const CTL_USER: ::c_int = 8;
123pub const CTL_P1003_1B: ::c_int = 9;
124pub const CTL_LWKT: ::c_int = 10;
125pub const CTL_MAXID: ::c_int = 11;
126pub const KERN_OSTYPE: ::c_int = 1;
127pub const KERN_OSRELEASE: ::c_int = 2;
128pub const KERN_OSREV: ::c_int = 3;
129pub const KERN_VERSION: ::c_int = 4;
130pub const KERN_MAXVNODES: ::c_int = 5;
131pub const KERN_MAXPROC: ::c_int = 6;
132pub const KERN_MAXFILES: ::c_int = 7;
133pub const KERN_ARGMAX: ::c_int = 8;
134pub const KERN_SECURELVL: ::c_int = 9;
135pub const KERN_HOSTNAME: ::c_int = 10;
136pub const KERN_HOSTID: ::c_int = 11;
137pub const KERN_CLOCKRATE: ::c_int = 12;
138pub const KERN_VNODE: ::c_int = 13;
139pub const KERN_PROC: ::c_int = 14;
140pub const KERN_FILE: ::c_int = 15;
141pub const KERN_PROF: ::c_int = 16;
142pub const KERN_POSIX1: ::c_int = 17;
143pub const KERN_NGROUPS: ::c_int = 18;
144pub const KERN_JOB_CONTROL: ::c_int = 19;
145pub const KERN_SAVED_IDS: ::c_int = 20;
146pub const KERN_BOOTTIME: ::c_int = 21;
147pub const KERN_NISDOMAINNAME: ::c_int = 22;
148pub const KERN_UPDATEINTERVAL: ::c_int = 23;
149pub const KERN_OSRELDATE: ::c_int = 24;
150pub const KERN_NTP_PLL: ::c_int = 25;
151pub const KERN_BOOTFILE: ::c_int = 26;
152pub const KERN_MAXFILESPERPROC: ::c_int = 27;
153pub const KERN_MAXPROCPERUID: ::c_int = 28;
154pub const KERN_DUMPDEV: ::c_int = 29;
155pub const KERN_IPC: ::c_int = 30;
156pub const KERN_DUMMY: ::c_int = 31;
157pub const KERN_PS_STRINGS: ::c_int = 32;
158pub const KERN_USRSTACK: ::c_int = 33;
159pub const KERN_LOGSIGEXIT: ::c_int = 34;
160pub const KERN_IOV_MAX: ::c_int = 35;
161pub const KERN_MAXPOSIXLOCKSPERUID: ::c_int = 36;
162pub const KERN_MAXID: ::c_int = 37;
163pub const KERN_PROC_ALL: ::c_int = 0;
164pub const KERN_PROC_PID: ::c_int = 1;
165pub const KERN_PROC_PGRP: ::c_int = 2;
166pub const KERN_PROC_SESSION: ::c_int = 3;
167pub const KERN_PROC_TTY: ::c_int = 4;
168pub const KERN_PROC_UID: ::c_int = 5;
169pub const KERN_PROC_RUID: ::c_int = 6;
170pub const KERN_PROC_ARGS: ::c_int = 7;
171pub const KERN_PROC_CWD: ::c_int = 8;
172pub const KERN_PROC_PATHNAME: ::c_int = 9;
173pub const KERN_PROC_FLAGMASK: ::c_int = 0x10;
174pub const KERN_PROC_FLAG_LWP: ::c_int = 0x10;
175pub const KIPC_MAXSOCKBUF: ::c_int = 1;
176pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
177pub const KIPC_SOMAXCONN: ::c_int = 3;
178pub const KIPC_MAX_LINKHDR: ::c_int = 4;
179pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
180pub const KIPC_MAX_HDR: ::c_int = 6;
181pub const KIPC_MAX_DATALEN: ::c_int = 7;
182pub const KIPC_MBSTAT: ::c_int = 8;
183pub const KIPC_NMBCLUSTERS: ::c_int = 9;
184pub const HW_MACHINE: ::c_int = 1;
185pub const HW_MODEL: ::c_int = 2;
186pub const HW_NCPU: ::c_int = 3;
187pub const HW_BYTEORDER: ::c_int = 4;
188pub const HW_PHYSMEM: ::c_int = 5;
189pub const HW_USERMEM: ::c_int = 6;
190pub const HW_PAGESIZE: ::c_int = 7;
191pub const HW_DISKNAMES: ::c_int = 8;
192pub const HW_DISKSTATS: ::c_int = 9;
193pub const HW_FLOATINGPT: ::c_int = 10;
194pub const HW_MACHINE_ARCH: ::c_int = 11;
195pub const HW_MACHINE_PLATFORM: ::c_int = 12;
196pub const HW_SENSORS: ::c_int = 13;
197pub const HW_MAXID: ::c_int = 14;
198pub const USER_CS_PATH: ::c_int = 1;
199pub const USER_BC_BASE_MAX: ::c_int = 2;
200pub const USER_BC_DIM_MAX: ::c_int = 3;
201pub const USER_BC_SCALE_MAX: ::c_int = 4;
202pub const USER_BC_STRING_MAX: ::c_int = 5;
203pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
204pub const USER_EXPR_NEST_MAX: ::c_int = 7;
205pub const USER_LINE_MAX: ::c_int = 8;
206pub const USER_RE_DUP_MAX: ::c_int = 9;
207pub const USER_POSIX2_VERSION: ::c_int = 10;
208pub const USER_POSIX2_C_BIND: ::c_int = 11;
209pub const USER_POSIX2_C_DEV: ::c_int = 12;
210pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
211pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
212pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
213pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
214pub const USER_POSIX2_SW_DEV: ::c_int = 17;
215pub const USER_POSIX2_UPE: ::c_int = 18;
216pub const USER_STREAM_MAX: ::c_int = 19;
217pub const USER_TZNAME_MAX: ::c_int = 20;
218pub const USER_MAXID: ::c_int = 21;
219pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
220pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
221pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
222pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4;
223pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5;
224pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6;
225pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7;
226pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8;
227pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9;
228pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10;
229pub const CTL_P1003_1B_FSYNC: ::c_int = 11;
230pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12;
231pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13;
232pub const CTL_P1003_1B_TIMERS: ::c_int = 14;
233pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15;
234pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16;
235pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17;
236pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18;
237pub const CTL_P1003_1B_UNUSED1: ::c_int = 19;
238pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20;
239pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21;
240pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
241pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
242pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
243pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
244pub const CTL_P1003_1B_MAXID: ::c_int = 26;
245
246extern {
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 @@
1pub type fflags_t = u32;
2pub type clock_t = i32;
3pub type ino_t = u32;
4pub type nlink_t = u16;
5pub type blksize_t = u32;
6pub type clockid_t = ::c_int;
7
8pub type fsblkcnt_t = ::uint64_t;
9pub type fsfilcnt_t = ::uint64_t;
10
11s! {
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
35pub const RAND_MAX: ::c_int = 0x7fff_fffd;
36pub const PTHREAD_STACK_MIN: ::size_t = 2048;
37pub const SIGSTKSZ: ::size_t = 34816;
38pub const SF_NODISKIO: ::c_int = 0x00000001;
39pub const SF_MNOWAIT: ::c_int = 0x00000002;
40pub const SF_SYNC: ::c_int = 0x00000004;
41pub const O_CLOEXEC: ::c_int = 0x00100000;
42pub const F_GETLK: ::c_int = 11;
43pub const F_SETLK: ::c_int = 12;
44pub const F_SETLKW: ::c_int = 13;
45pub const ELAST: ::c_int = 96;
46pub const RLIMIT_NPTS: ::c_int = 11;
47pub const RLIMIT_SWAP: ::c_int = 12;
48pub const RLIM_NLIMITS: ::rlim_t = 13;
49
50pub const Q_GETQUOTA: ::c_int = 0x700;
51pub const Q_SETQUOTA: ::c_int = 0x800;
52
53pub const POSIX_FADV_NORMAL: ::c_int = 0;
54pub const POSIX_FADV_RANDOM: ::c_int = 1;
55pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
56pub const POSIX_FADV_WILLNEED: ::c_int = 3;
57pub const POSIX_FADV_DONTNEED: ::c_int = 4;
58pub const POSIX_FADV_NOREUSE: ::c_int = 5;
59
60pub const MADV_PROTECT: ::c_int = 10;
61pub const RUSAGE_THREAD: ::c_int = 1;
62
63pub const CLOCK_REALTIME: clockid_t = 0;
64pub const CLOCK_VIRTUAL: clockid_t = 1;
65pub const CLOCK_PROF: clockid_t = 2;
66pub const CLOCK_MONOTONIC: clockid_t = 4;
67pub const CLOCK_UPTIME: clockid_t = 5;
68pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
69pub const CLOCK_UPTIME_FAST: clockid_t = 8;
70pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
71pub const CLOCK_REALTIME_FAST: clockid_t = 10;
72pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
73pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
74pub const CLOCK_SECOND: clockid_t = 13;
75pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
76pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
77
78pub const CTL_UNSPEC: ::c_int = 0;
79pub const CTL_KERN: ::c_int = 1;
80pub const CTL_VM: ::c_int = 2;
81pub const CTL_VFS: ::c_int = 3;
82pub const CTL_NET: ::c_int = 4;
83pub const CTL_DEBUG: ::c_int = 5;
84pub const CTL_HW: ::c_int = 6;
85pub const CTL_MACHDEP: ::c_int = 7;
86pub const CTL_USER: ::c_int = 8;
87pub const CTL_P1003_1B: ::c_int = 9;
88pub const CTL_MAXID: ::c_int = 10;
89pub const KERN_OSTYPE: ::c_int = 1;
90pub const KERN_OSRELEASE: ::c_int = 2;
91pub const KERN_OSREV: ::c_int = 3;
92pub const KERN_VERSION: ::c_int = 4;
93pub const KERN_MAXVNODES: ::c_int = 5;
94pub const KERN_MAXPROC: ::c_int = 6;
95pub const KERN_MAXFILES: ::c_int = 7;
96pub const KERN_ARGMAX: ::c_int = 8;
97pub const KERN_SECURELVL: ::c_int = 9;
98pub const KERN_HOSTNAME: ::c_int = 10;
99pub const KERN_HOSTID: ::c_int = 11;
100pub const KERN_CLOCKRATE: ::c_int = 12;
101pub const KERN_VNODE: ::c_int = 13;
102pub const KERN_PROC: ::c_int = 14;
103pub const KERN_FILE: ::c_int = 15;
104pub const KERN_PROF: ::c_int = 16;
105pub const KERN_POSIX1: ::c_int = 17;
106pub const KERN_NGROUPS: ::c_int = 18;
107pub const KERN_JOB_CONTROL: ::c_int = 19;
108pub const KERN_SAVED_IDS: ::c_int = 20;
109pub const KERN_BOOTTIME: ::c_int = 21;
110pub const KERN_NISDOMAINNAME: ::c_int = 22;
111pub const KERN_UPDATEINTERVAL: ::c_int = 23;
112pub const KERN_OSRELDATE: ::c_int = 24;
113pub const KERN_NTP_PLL: ::c_int = 25;
114pub const KERN_BOOTFILE: ::c_int = 26;
115pub const KERN_MAXFILESPERPROC: ::c_int = 27;
116pub const KERN_MAXPROCPERUID: ::c_int = 28;
117pub const KERN_DUMPDEV: ::c_int = 29;
118pub const KERN_IPC: ::c_int = 30;
119pub const KERN_DUMMY: ::c_int = 31;
120pub const KERN_PS_STRINGS: ::c_int = 32;
121pub const KERN_USRSTACK: ::c_int = 33;
122pub const KERN_LOGSIGEXIT: ::c_int = 34;
123pub const KERN_IOV_MAX: ::c_int = 35;
124pub const KERN_HOSTUUID: ::c_int = 36;
125pub const KERN_ARND: ::c_int = 37;
126pub const KERN_MAXID: ::c_int = 38;
127pub const KERN_PROC_ALL: ::c_int = 0;
128pub const KERN_PROC_PID: ::c_int = 1;
129pub const KERN_PROC_PGRP: ::c_int = 2;
130pub const KERN_PROC_SESSION: ::c_int = 3;
131pub const KERN_PROC_TTY: ::c_int = 4;
132pub const KERN_PROC_UID: ::c_int = 5;
133pub const KERN_PROC_RUID: ::c_int = 6;
134pub const KERN_PROC_ARGS: ::c_int = 7;
135pub const KERN_PROC_PROC: ::c_int = 8;
136pub const KERN_PROC_SV_NAME: ::c_int = 9;
137pub const KERN_PROC_RGID: ::c_int = 10;
138pub const KERN_PROC_GID: ::c_int = 11;
139pub const KERN_PROC_PATHNAME: ::c_int = 12;
140pub const KERN_PROC_OVMMAP: ::c_int = 13;
141pub const KERN_PROC_OFILEDESC: ::c_int = 14;
142pub const KERN_PROC_KSTACK: ::c_int = 15;
143pub const KERN_PROC_INC_THREAD: ::c_int = 0x10;
144pub const KERN_PROC_VMMAP: ::c_int = 32;
145pub const KERN_PROC_FILEDESC: ::c_int = 33;
146pub const KERN_PROC_GROUPS: ::c_int = 34;
147pub const KERN_PROC_ENV: ::c_int = 35;
148pub const KERN_PROC_AUXV: ::c_int = 36;
149pub const KERN_PROC_RLIMIT: ::c_int = 37;
150pub const KERN_PROC_PS_STRINGS: ::c_int = 38;
151pub const KERN_PROC_UMASK: ::c_int = 39;
152pub const KERN_PROC_OSREL: ::c_int = 40;
153pub const KERN_PROC_SIGTRAMP: ::c_int = 41;
154pub const KIPC_MAXSOCKBUF: ::c_int = 1;
155pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
156pub const KIPC_SOMAXCONN: ::c_int = 3;
157pub const KIPC_MAX_LINKHDR: ::c_int = 4;
158pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
159pub const KIPC_MAX_HDR: ::c_int = 6;
160pub const KIPC_MAX_DATALEN: ::c_int = 7;
161pub const HW_MACHINE: ::c_int = 1;
162pub const HW_MODEL: ::c_int = 2;
163pub const HW_NCPU: ::c_int = 3;
164pub const HW_BYTEORDER: ::c_int = 4;
165pub const HW_PHYSMEM: ::c_int = 5;
166pub const HW_USERMEM: ::c_int = 6;
167pub const HW_PAGESIZE: ::c_int = 7;
168pub const HW_DISKNAMES: ::c_int = 8;
169pub const HW_DISKSTATS: ::c_int = 9;
170pub const HW_FLOATINGPT: ::c_int = 10;
171pub const HW_MACHINE_ARCH: ::c_int = 11;
172pub const HW_REALMEM: ::c_int = 12;
173pub const HW_MAXID: ::c_int = 13;
174pub const USER_CS_PATH: ::c_int = 1;
175pub const USER_BC_BASE_MAX: ::c_int = 2;
176pub const USER_BC_DIM_MAX: ::c_int = 3;
177pub const USER_BC_SCALE_MAX: ::c_int = 4;
178pub const USER_BC_STRING_MAX: ::c_int = 5;
179pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
180pub const USER_EXPR_NEST_MAX: ::c_int = 7;
181pub const USER_LINE_MAX: ::c_int = 8;
182pub const USER_RE_DUP_MAX: ::c_int = 9;
183pub const USER_POSIX2_VERSION: ::c_int = 10;
184pub const USER_POSIX2_C_BIND: ::c_int = 11;
185pub const USER_POSIX2_C_DEV: ::c_int = 12;
186pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
187pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
188pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
189pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
190pub const USER_POSIX2_SW_DEV: ::c_int = 17;
191pub const USER_POSIX2_UPE: ::c_int = 18;
192pub const USER_STREAM_MAX: ::c_int = 19;
193pub const USER_TZNAME_MAX: ::c_int = 20;
194pub const USER_MAXID: ::c_int = 21;
195pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
196pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
197pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
198pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4;
199pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5;
200pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6;
201pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7;
202pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8;
203pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9;
204pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10;
205pub const CTL_P1003_1B_FSYNC: ::c_int = 11;
206pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12;
207pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13;
208pub const CTL_P1003_1B_TIMERS: ::c_int = 14;
209pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15;
210pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16;
211pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17;
212pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18;
213pub const CTL_P1003_1B_MQ_OPEN_MAX: ::c_int = 19;
214pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20;
215pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21;
216pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
217pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
218pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
219pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
220pub const CTL_P1003_1B_MAXID: ::c_int = 26;
221
222extern {
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
241cfg_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 @@
1pub type c_long = i32;
2pub type c_ulong = u32;
3pub type time_t = i32;
4pub type suseconds_t = i32;
5
6s! {
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 @@
1pub type c_long = i64;
2pub type c_ulong = u64;
3pub type time_t = i64;
4pub type suseconds_t = i64;
5
6s! {
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 @@
1pub type dev_t = u32;
2pub type mode_t = u16;
3pub type pthread_attr_t = *mut ::c_void;
4pub type rlim_t = i64;
5pub type pthread_mutex_t = *mut ::c_void;
6pub type pthread_mutexattr_t = *mut ::c_void;
7pub type pthread_cond_t = *mut ::c_void;
8pub type pthread_condattr_t = *mut ::c_void;
9pub type pthread_rwlock_t = *mut ::c_void;
10pub type pthread_key_t = ::c_int;
11pub type tcflag_t = ::c_uint;
12pub type speed_t = ::c_uint;
13pub type nl_item = ::c_int;
14pub type id_t = i64;
15pub type sem_t = _sem;
16
17pub enum timezone {}
18
19s! {
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
172pub const EMPTY: ::c_short = 0;
173pub const BOOT_TIME: ::c_short = 1;
174pub const OLD_TIME: ::c_short = 2;
175pub const NEW_TIME: ::c_short = 3;
176pub const USER_PROCESS: ::c_short = 4;
177pub const INIT_PROCESS: ::c_short = 5;
178pub const LOGIN_PROCESS: ::c_short = 6;
179pub const DEAD_PROCESS: ::c_short = 7;
180pub const SHUTDOWN_TIME: ::c_short = 8;
181
182pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
183pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
184pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
185pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
186pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
187pub const LC_TIME_MASK: ::c_int = (1 << 5);
188pub 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
195pub const CODESET: ::nl_item = 0;
196pub const D_T_FMT: ::nl_item = 1;
197pub const D_FMT: ::nl_item = 2;
198pub const T_FMT: ::nl_item = 3;
199pub const T_FMT_AMPM: ::nl_item = 4;
200pub const AM_STR: ::nl_item = 5;
201pub const PM_STR: ::nl_item = 6;
202
203pub const DAY_1: ::nl_item = 7;
204pub const DAY_2: ::nl_item = 8;
205pub const DAY_3: ::nl_item = 9;
206pub const DAY_4: ::nl_item = 10;
207pub const DAY_5: ::nl_item = 11;
208pub const DAY_6: ::nl_item = 12;
209pub const DAY_7: ::nl_item = 13;
210
211pub const ABDAY_1: ::nl_item = 14;
212pub const ABDAY_2: ::nl_item = 15;
213pub const ABDAY_3: ::nl_item = 16;
214pub const ABDAY_4: ::nl_item = 17;
215pub const ABDAY_5: ::nl_item = 18;
216pub const ABDAY_6: ::nl_item = 19;
217pub const ABDAY_7: ::nl_item = 20;
218
219pub const MON_1: ::nl_item = 21;
220pub const MON_2: ::nl_item = 22;
221pub const MON_3: ::nl_item = 23;
222pub const MON_4: ::nl_item = 24;
223pub const MON_5: ::nl_item = 25;
224pub const MON_6: ::nl_item = 26;
225pub const MON_7: ::nl_item = 27;
226pub const MON_8: ::nl_item = 28;
227pub const MON_9: ::nl_item = 29;
228pub const MON_10: ::nl_item = 30;
229pub const MON_11: ::nl_item = 31;
230pub const MON_12: ::nl_item = 32;
231
232pub const ABMON_1: ::nl_item = 33;
233pub const ABMON_2: ::nl_item = 34;
234pub const ABMON_3: ::nl_item = 35;
235pub const ABMON_4: ::nl_item = 36;
236pub const ABMON_5: ::nl_item = 37;
237pub const ABMON_6: ::nl_item = 38;
238pub const ABMON_7: ::nl_item = 39;
239pub const ABMON_8: ::nl_item = 40;
240pub const ABMON_9: ::nl_item = 41;
241pub const ABMON_10: ::nl_item = 42;
242pub const ABMON_11: ::nl_item = 43;
243pub const ABMON_12: ::nl_item = 44;
244
245pub const ERA: ::nl_item = 45;
246pub const ERA_D_FMT: ::nl_item = 46;
247pub const ERA_D_T_FMT: ::nl_item = 47;
248pub const ERA_T_FMT: ::nl_item = 48;
249pub const ALT_DIGITS: ::nl_item = 49;
250
251pub const RADIXCHAR: ::nl_item = 50;
252pub const THOUSEP: ::nl_item = 51;
253
254pub const YESEXPR: ::nl_item = 52;
255pub const NOEXPR: ::nl_item = 53;
256
257pub const YESSTR: ::nl_item = 54;
258pub const NOSTR: ::nl_item = 55;
259
260pub const CRNCYSTR: ::nl_item = 56;
261
262pub const D_MD_ORDER: ::nl_item = 57;
263
264pub const ALTMON_1: ::nl_item = 58;
265pub const ALTMON_2: ::nl_item = 59;
266pub const ALTMON_3: ::nl_item = 60;
267pub const ALTMON_4: ::nl_item = 61;
268pub const ALTMON_5: ::nl_item = 62;
269pub const ALTMON_6: ::nl_item = 63;
270pub const ALTMON_7: ::nl_item = 64;
271pub const ALTMON_8: ::nl_item = 65;
272pub const ALTMON_9: ::nl_item = 66;
273pub const ALTMON_10: ::nl_item = 67;
274pub const ALTMON_11: ::nl_item = 68;
275pub const ALTMON_12: ::nl_item = 69;
276
277pub const EXIT_FAILURE: ::c_int = 1;
278pub const EXIT_SUCCESS: ::c_int = 0;
279pub const EOF: ::c_int = -1;
280pub const SEEK_SET: ::c_int = 0;
281pub const SEEK_CUR: ::c_int = 1;
282pub const SEEK_END: ::c_int = 2;
283pub const _IOFBF: ::c_int = 0;
284pub const _IONBF: ::c_int = 2;
285pub const _IOLBF: ::c_int = 1;
286pub const BUFSIZ: ::c_uint = 1024;
287pub const FOPEN_MAX: ::c_uint = 20;
288pub const FILENAME_MAX: ::c_uint = 1024;
289pub const L_tmpnam: ::c_uint = 1024;
290pub const TMP_MAX: ::c_uint = 308915776;
291
292pub const O_RDONLY: ::c_int = 0;
293pub const O_WRONLY: ::c_int = 1;
294pub const O_RDWR: ::c_int = 2;
295pub const O_ACCMODE: ::c_int = 3;
296pub const O_APPEND: ::c_int = 8;
297pub const O_CREAT: ::c_int = 512;
298pub const O_EXCL: ::c_int = 2048;
299pub const O_NOCTTY: ::c_int = 32768;
300pub const O_TRUNC: ::c_int = 1024;
301pub const S_IFIFO: mode_t = 4096;
302pub const S_IFCHR: mode_t = 8192;
303pub const S_IFBLK: mode_t = 24576;
304pub const S_IFDIR: mode_t = 16384;
305pub const S_IFREG: mode_t = 32768;
306pub const S_IFLNK: mode_t = 40960;
307pub const S_IFSOCK: mode_t = 49152;
308pub const S_IFMT: mode_t = 61440;
309pub const S_IEXEC: mode_t = 64;
310pub const S_IWRITE: mode_t = 128;
311pub const S_IREAD: mode_t = 256;
312pub const S_IRWXU: mode_t = 448;
313pub const S_IXUSR: mode_t = 64;
314pub const S_IWUSR: mode_t = 128;
315pub const S_IRUSR: mode_t = 256;
316pub const S_IRWXG: mode_t = 56;
317pub const S_IXGRP: mode_t = 8;
318pub const S_IWGRP: mode_t = 16;
319pub const S_IRGRP: mode_t = 32;
320pub const S_IRWXO: mode_t = 7;
321pub const S_IXOTH: mode_t = 1;
322pub const S_IWOTH: mode_t = 2;
323pub const S_IROTH: mode_t = 4;
324pub const F_OK: ::c_int = 0;
325pub const R_OK: ::c_int = 4;
326pub const W_OK: ::c_int = 2;
327pub const X_OK: ::c_int = 1;
328pub const STDIN_FILENO: ::c_int = 0;
329pub const STDOUT_FILENO: ::c_int = 1;
330pub const STDERR_FILENO: ::c_int = 2;
331pub const F_LOCK: ::c_int = 1;
332pub const F_TEST: ::c_int = 3;
333pub const F_TLOCK: ::c_int = 2;
334pub const F_ULOCK: ::c_int = 0;
335pub const F_DUPFD_CLOEXEC: ::c_int = 17;
336pub const SIGHUP: ::c_int = 1;
337pub const SIGINT: ::c_int = 2;
338pub const SIGQUIT: ::c_int = 3;
339pub const SIGILL: ::c_int = 4;
340pub const SIGABRT: ::c_int = 6;
341pub const SIGEMT: ::c_int = 7;
342pub const SIGFPE: ::c_int = 8;
343pub const SIGKILL: ::c_int = 9;
344pub const SIGSEGV: ::c_int = 11;
345pub const SIGPIPE: ::c_int = 13;
346pub const SIGALRM: ::c_int = 14;
347pub const SIGTERM: ::c_int = 15;
348
349pub const PROT_NONE: ::c_int = 0;
350pub const PROT_READ: ::c_int = 1;
351pub const PROT_WRITE: ::c_int = 2;
352pub const PROT_EXEC: ::c_int = 4;
353
354pub const MAP_FILE: ::c_int = 0x0000;
355pub const MAP_SHARED: ::c_int = 0x0001;
356pub const MAP_PRIVATE: ::c_int = 0x0002;
357pub const MAP_FIXED: ::c_int = 0x0010;
358pub const MAP_ANON: ::c_int = 0x1000;
359
360pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
361
362pub const MCL_CURRENT: ::c_int = 0x0001;
363pub const MCL_FUTURE: ::c_int = 0x0002;
364
365pub const MS_SYNC: ::c_int = 0x0000;
366pub const MS_ASYNC: ::c_int = 0x0001;
367pub const MS_INVALIDATE: ::c_int = 0x0002;
368
369pub const EPERM: ::c_int = 1;
370pub const ENOENT: ::c_int = 2;
371pub const ESRCH: ::c_int = 3;
372pub const EINTR: ::c_int = 4;
373pub const EIO: ::c_int = 5;
374pub const ENXIO: ::c_int = 6;
375pub const E2BIG: ::c_int = 7;
376pub const ENOEXEC: ::c_int = 8;
377pub const EBADF: ::c_int = 9;
378pub const ECHILD: ::c_int = 10;
379pub const EDEADLK: ::c_int = 11;
380pub const ENOMEM: ::c_int = 12;
381pub const EACCES: ::c_int = 13;
382pub const EFAULT: ::c_int = 14;
383pub const ENOTBLK: ::c_int = 15;
384pub const EBUSY: ::c_int = 16;
385pub const EEXIST: ::c_int = 17;
386pub const EXDEV: ::c_int = 18;
387pub const ENODEV: ::c_int = 19;
388pub const ENOTDIR: ::c_int = 20;
389pub const EISDIR: ::c_int = 21;
390pub const EINVAL: ::c_int = 22;
391pub const ENFILE: ::c_int = 23;
392pub const EMFILE: ::c_int = 24;
393pub const ENOTTY: ::c_int = 25;
394pub const ETXTBSY: ::c_int = 26;
395pub const EFBIG: ::c_int = 27;
396pub const ENOSPC: ::c_int = 28;
397pub const ESPIPE: ::c_int = 29;
398pub const EROFS: ::c_int = 30;
399pub const EMLINK: ::c_int = 31;
400pub const EPIPE: ::c_int = 32;
401pub const EDOM: ::c_int = 33;
402pub const ERANGE: ::c_int = 34;
403pub const EAGAIN: ::c_int = 35;
404pub const EWOULDBLOCK: ::c_int = 35;
405pub const EINPROGRESS: ::c_int = 36;
406pub const EALREADY: ::c_int = 37;
407pub const ENOTSOCK: ::c_int = 38;
408pub const EDESTADDRREQ: ::c_int = 39;
409pub const EMSGSIZE: ::c_int = 40;
410pub const EPROTOTYPE: ::c_int = 41;
411pub const ENOPROTOOPT: ::c_int = 42;
412pub const EPROTONOSUPPORT: ::c_int = 43;
413pub const ESOCKTNOSUPPORT: ::c_int = 44;
414pub const EOPNOTSUPP: ::c_int = 45;
415pub const EPFNOSUPPORT: ::c_int = 46;
416pub const EAFNOSUPPORT: ::c_int = 47;
417pub const EADDRINUSE: ::c_int = 48;
418pub const EADDRNOTAVAIL: ::c_int = 49;
419pub const ENETDOWN: ::c_int = 50;
420pub const ENETUNREACH: ::c_int = 51;
421pub const ENETRESET: ::c_int = 52;
422pub const ECONNABORTED: ::c_int = 53;
423pub const ECONNRESET: ::c_int = 54;
424pub const ENOBUFS: ::c_int = 55;
425pub const EISCONN: ::c_int = 56;
426pub const ENOTCONN: ::c_int = 57;
427pub const ESHUTDOWN: ::c_int = 58;
428pub const ETOOMANYREFS: ::c_int = 59;
429pub const ETIMEDOUT: ::c_int = 60;
430pub const ECONNREFUSED: ::c_int = 61;
431pub const ELOOP: ::c_int = 62;
432pub const ENAMETOOLONG: ::c_int = 63;
433pub const EHOSTDOWN: ::c_int = 64;
434pub const EHOSTUNREACH: ::c_int = 65;
435pub const ENOTEMPTY: ::c_int = 66;
436pub const EPROCLIM: ::c_int = 67;
437pub const EUSERS: ::c_int = 68;
438pub const EDQUOT: ::c_int = 69;
439pub const ESTALE: ::c_int = 70;
440pub const EREMOTE: ::c_int = 71;
441pub const EBADRPC: ::c_int = 72;
442pub const ERPCMISMATCH: ::c_int = 73;
443pub const EPROGUNAVAIL: ::c_int = 74;
444pub const EPROGMISMATCH: ::c_int = 75;
445pub const EPROCUNAVAIL: ::c_int = 76;
446pub const ENOLCK: ::c_int = 77;
447pub const ENOSYS: ::c_int = 78;
448pub const EFTYPE: ::c_int = 79;
449pub const EAUTH: ::c_int = 80;
450pub const ENEEDAUTH: ::c_int = 81;
451pub const EIDRM: ::c_int = 82;
452pub const ENOMSG: ::c_int = 83;
453pub const EOVERFLOW: ::c_int = 84;
454pub const ECANCELED: ::c_int = 85;
455pub const EILSEQ: ::c_int = 86;
456pub const ENOATTR: ::c_int = 87;
457pub const EDOOFUS: ::c_int = 88;
458pub const EBADMSG: ::c_int = 89;
459pub const EMULTIHOP: ::c_int = 90;
460pub const ENOLINK: ::c_int = 91;
461pub const EPROTO: ::c_int = 92;
462
463pub const F_DUPFD: ::c_int = 0;
464pub const F_GETFD: ::c_int = 1;
465pub const F_SETFD: ::c_int = 2;
466pub const F_GETFL: ::c_int = 3;
467pub const F_SETFL: ::c_int = 4;
468
469pub const SIGTRAP: ::c_int = 5;
470
471pub const GLOB_APPEND : ::c_int = 0x0001;
472pub const GLOB_DOOFFS : ::c_int = 0x0002;
473pub const GLOB_ERR : ::c_int = 0x0004;
474pub const GLOB_MARK : ::c_int = 0x0008;
475pub const GLOB_NOCHECK : ::c_int = 0x0010;
476pub const GLOB_NOSORT : ::c_int = 0x0020;
477pub const GLOB_NOESCAPE: ::c_int = 0x2000;
478
479pub const GLOB_NOSPACE : ::c_int = -1;
480pub const GLOB_ABORTED : ::c_int = -2;
481pub const GLOB_NOMATCH : ::c_int = -3;
482
483pub const POSIX_MADV_NORMAL: ::c_int = 0;
484pub const POSIX_MADV_RANDOM: ::c_int = 1;
485pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
486pub const POSIX_MADV_WILLNEED: ::c_int = 3;
487pub const POSIX_MADV_DONTNEED: ::c_int = 4;
488
489pub const _SC_IOV_MAX: ::c_int = 56;
490pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
491pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
492pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
493pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
494pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
495pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
496pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
497pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
498pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
499pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
500pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
501pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
502pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
503pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
504pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
505pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
506pub const _SC_THREADS: ::c_int = 96;
507pub const _SC_TTY_NAME_MAX: ::c_int = 101;
508pub const _SC_ATEXIT_MAX: ::c_int = 107;
509pub const _SC_XOPEN_CRYPT: ::c_int = 108;
510pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
511pub const _SC_XOPEN_LEGACY: ::c_int = 110;
512pub const _SC_XOPEN_REALTIME: ::c_int = 111;
513pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
514pub const _SC_XOPEN_SHM: ::c_int = 113;
515pub const _SC_XOPEN_UNIX: ::c_int = 115;
516pub const _SC_XOPEN_VERSION: ::c_int = 116;
517pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117;
518
519pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
520pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
521
522pub const RLIMIT_CPU: ::c_int = 0;
523pub const RLIMIT_FSIZE: ::c_int = 1;
524pub const RLIMIT_DATA: ::c_int = 2;
525pub const RLIMIT_STACK: ::c_int = 3;
526pub const RLIMIT_CORE: ::c_int = 4;
527pub const RLIMIT_RSS: ::c_int = 5;
528pub const RLIMIT_MEMLOCK: ::c_int = 6;
529pub const RLIMIT_NPROC: ::c_int = 7;
530pub const RLIMIT_NOFILE: ::c_int = 8;
531pub const RLIMIT_SBSIZE: ::c_int = 9;
532pub const RLIMIT_VMEM: ::c_int = 10;
533pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM;
534pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
535
536pub const RUSAGE_SELF: ::c_int = 0;
537pub const RUSAGE_CHILDREN: ::c_int = -1;
538
539pub const MADV_NORMAL: ::c_int = 0;
540pub const MADV_RANDOM: ::c_int = 1;
541pub const MADV_SEQUENTIAL: ::c_int = 2;
542pub const MADV_WILLNEED: ::c_int = 3;
543pub const MADV_DONTNEED: ::c_int = 4;
544pub const MADV_FREE: ::c_int = 5;
545pub const MADV_NOSYNC: ::c_int = 6;
546pub const MADV_AUTOSYNC: ::c_int = 7;
547pub const MADV_NOCORE: ::c_int = 8;
548pub const MADV_CORE: ::c_int = 9;
549
550pub const MINCORE_INCORE: ::c_int = 0x1;
551pub const MINCORE_REFERENCED: ::c_int = 0x2;
552pub const MINCORE_MODIFIED: ::c_int = 0x4;
553pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8;
554pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10;
555pub const MINCORE_SUPER: ::c_int = 0x20;
556
557pub const AF_INET: ::c_int = 2;
558pub const AF_INET6: ::c_int = 28;
559pub const AF_UNIX: ::c_int = 1;
560pub const SOCK_STREAM: ::c_int = 1;
561pub const SOCK_DGRAM: ::c_int = 2;
562pub const SOCK_RAW: ::c_int = 3;
563pub const SOCK_SEQPACKET: ::c_int = 5;
564pub const IPPROTO_TCP: ::c_int = 6;
565pub const IPPROTO_IP: ::c_int = 0;
566pub const IPPROTO_IPV6: ::c_int = 41;
567pub const IP_MULTICAST_TTL: ::c_int = 10;
568pub const IP_MULTICAST_LOOP: ::c_int = 11;
569pub const IP_TTL: ::c_int = 4;
570pub const IP_HDRINCL: ::c_int = 2;
571pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
572pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
573pub const IPV6_JOIN_GROUP: ::c_int = 12;
574pub const IPV6_LEAVE_GROUP: ::c_int = 13;
575
576pub const TCP_NODELAY: ::c_int = 1;
577pub const TCP_KEEPIDLE: ::c_int = 256;
578pub const SOL_SOCKET: ::c_int = 0xffff;
579pub const SO_DEBUG: ::c_int = 0x01;
580pub const SO_ACCEPTCONN: ::c_int = 0x0002;
581pub const SO_REUSEADDR: ::c_int = 0x0004;
582pub const SO_KEEPALIVE: ::c_int = 0x0008;
583pub const SO_DONTROUTE: ::c_int = 0x0010;
584pub const SO_BROADCAST: ::c_int = 0x0020;
585pub const SO_USELOOPBACK: ::c_int = 0x0040;
586pub const SO_LINGER: ::c_int = 0x0080;
587pub const SO_OOBINLINE: ::c_int = 0x0100;
588pub const SO_REUSEPORT: ::c_int = 0x0200;
589pub const SO_SNDBUF: ::c_int = 0x1001;
590pub const SO_RCVBUF: ::c_int = 0x1002;
591pub const SO_SNDLOWAT: ::c_int = 0x1003;
592pub const SO_RCVLOWAT: ::c_int = 0x1004;
593pub const SO_SNDTIMEO: ::c_int = 0x1005;
594pub const SO_RCVTIMEO: ::c_int = 0x1006;
595pub const SO_ERROR: ::c_int = 0x1007;
596pub const SO_TYPE: ::c_int = 0x1008;
597
598pub const IFF_LOOPBACK: ::c_int = 0x8;
599
600pub const SHUT_RD: ::c_int = 0;
601pub const SHUT_WR: ::c_int = 1;
602pub const SHUT_RDWR: ::c_int = 2;
603
604pub const LOCK_SH: ::c_int = 1;
605pub const LOCK_EX: ::c_int = 2;
606pub const LOCK_NB: ::c_int = 4;
607pub const LOCK_UN: ::c_int = 8;
608
609pub const O_SYNC: ::c_int = 128;
610pub const O_NONBLOCK: ::c_int = 4;
611
612pub const MAP_COPY: ::c_int = 0x0002;
613pub const MAP_RENAME: ::c_int = 0x0020;
614pub const MAP_NORESERVE: ::c_int = 0x0040;
615pub const MAP_HASSEMAPHORE: ::c_int = 0x0200;
616pub const MAP_STACK: ::c_int = 0x0400;
617pub const MAP_NOSYNC: ::c_int = 0x0800;
618pub const MAP_NOCORE: ::c_int = 0x020000;
619
620pub const IPPROTO_RAW: ::c_int = 255;
621
622pub const _SC_ARG_MAX: ::c_int = 1;
623pub const _SC_CHILD_MAX: ::c_int = 2;
624pub const _SC_CLK_TCK: ::c_int = 3;
625pub const _SC_NGROUPS_MAX: ::c_int = 4;
626pub const _SC_OPEN_MAX: ::c_int = 5;
627pub const _SC_JOB_CONTROL: ::c_int = 6;
628pub const _SC_SAVED_IDS: ::c_int = 7;
629pub const _SC_VERSION: ::c_int = 8;
630pub const _SC_BC_BASE_MAX: ::c_int = 9;
631pub const _SC_BC_DIM_MAX: ::c_int = 10;
632pub const _SC_BC_SCALE_MAX: ::c_int = 11;
633pub const _SC_BC_STRING_MAX: ::c_int = 12;
634pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13;
635pub const _SC_EXPR_NEST_MAX: ::c_int = 14;
636pub const _SC_LINE_MAX: ::c_int = 15;
637pub const _SC_RE_DUP_MAX: ::c_int = 16;
638pub const _SC_2_VERSION: ::c_int = 17;
639pub const _SC_2_C_BIND: ::c_int = 18;
640pub const _SC_2_C_DEV: ::c_int = 19;
641pub const _SC_2_CHAR_TERM: ::c_int = 20;
642pub const _SC_2_FORT_DEV: ::c_int = 21;
643pub const _SC_2_FORT_RUN: ::c_int = 22;
644pub const _SC_2_LOCALEDEF: ::c_int = 23;
645pub const _SC_2_SW_DEV: ::c_int = 24;
646pub const _SC_2_UPE: ::c_int = 25;
647pub const _SC_STREAM_MAX: ::c_int = 26;
648pub const _SC_TZNAME_MAX: ::c_int = 27;
649pub const _SC_ASYNCHRONOUS_IO: ::c_int = 28;
650pub const _SC_MAPPED_FILES: ::c_int = 29;
651pub const _SC_MEMLOCK: ::c_int = 30;
652pub const _SC_MEMLOCK_RANGE: ::c_int = 31;
653pub const _SC_MEMORY_PROTECTION: ::c_int = 32;
654pub const _SC_MESSAGE_PASSING: ::c_int = 33;
655pub const _SC_PRIORITIZED_IO: ::c_int = 34;
656pub const _SC_PRIORITY_SCHEDULING: ::c_int = 35;
657pub const _SC_REALTIME_SIGNALS: ::c_int = 36;
658pub const _SC_SEMAPHORES: ::c_int = 37;
659pub const _SC_FSYNC: ::c_int = 38;
660pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 39;
661pub const _SC_SYNCHRONIZED_IO: ::c_int = 40;
662pub const _SC_TIMERS: ::c_int = 41;
663pub const _SC_AIO_LISTIO_MAX: ::c_int = 42;
664pub const _SC_AIO_MAX: ::c_int = 43;
665pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44;
666pub const _SC_DELAYTIMER_MAX: ::c_int = 45;
667pub const _SC_MQ_OPEN_MAX: ::c_int = 46;
668pub const _SC_PAGESIZE: ::c_int = 47;
669pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
670pub const _SC_RTSIG_MAX: ::c_int = 48;
671pub const _SC_SEM_NSEMS_MAX: ::c_int = 49;
672pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
673pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
674pub const _SC_TIMER_MAX: ::c_int = 52;
675pub const _SC_HOST_NAME_MAX: ::c_int = 72;
676
677pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
678pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
679pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
680pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
681pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
682pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
683pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
684pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_ERRORCHECK;
685
686pub const SCHED_FIFO: ::c_int = 1;
687pub const SCHED_OTHER: ::c_int = 2;
688pub const SCHED_RR: ::c_int = 3;
689
690pub const FD_SETSIZE: usize = 1024;
691
692pub const ST_NOSUID: ::c_ulong = 2;
693
694pub const NI_MAXHOST: ::size_t = 1025;
695
696pub const RTLD_LOCAL: ::c_int = 0;
697pub const RTLD_NODELETE: ::c_int = 0x1000;
698pub const RTLD_NOLOAD: ::c_int = 0x2000;
699pub const RTLD_GLOBAL: ::c_int = 0x100;
700
701pub const LOG_NTP: ::c_int = 12 << 3;
702pub const LOG_SECURITY: ::c_int = 13 << 3;
703pub const LOG_CONSOLE: ::c_int = 14 << 3;
704pub const LOG_NFACILITIES: ::c_int = 24;
705
706pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
707pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
708
709pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
710
711f! {
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
725extern {
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")]
737extern {
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
849cfg_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 @@
1use dox::mem;
2
3pub type c_char = i8;
4pub type wchar_t = i32;
5pub type off_t = i64;
6pub type useconds_t = u32;
7pub type blkcnt_t = i64;
8pub type socklen_t = u32;
9pub type sa_family_t = u8;
10pub type pthread_t = ::uintptr_t;
11pub type nfds_t = ::c_uint;
12
13s! {
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
130pub const LC_ALL: ::c_int = 0;
131pub const LC_COLLATE: ::c_int = 1;
132pub const LC_CTYPE: ::c_int = 2;
133pub const LC_MONETARY: ::c_int = 3;
134pub const LC_NUMERIC: ::c_int = 4;
135pub const LC_TIME: ::c_int = 5;
136pub const LC_MESSAGES: ::c_int = 6;
137
138pub const FIOCLEX: ::c_ulong = 0x20006601;
139pub const FIONBIO: ::c_ulong = 0x8004667e;
140
141pub const PATH_MAX: ::c_int = 1024;
142
143pub const SA_ONSTACK: ::c_int = 0x0001;
144pub const SA_SIGINFO: ::c_int = 0x0040;
145pub const SA_RESTART: ::c_int = 0x0002;
146pub const SA_RESETHAND: ::c_int = 0x0004;
147pub const SA_NOCLDSTOP: ::c_int = 0x0008;
148pub const SA_NODEFER: ::c_int = 0x0010;
149pub const SA_NOCLDWAIT: ::c_int = 0x0020;
150
151pub const SS_ONSTACK: ::c_int = 1;
152pub const SS_DISABLE: ::c_int = 4;
153
154pub const SIGCHLD: ::c_int = 20;
155pub const SIGBUS: ::c_int = 10;
156pub const SIGUSR1: ::c_int = 30;
157pub const SIGUSR2: ::c_int = 31;
158pub const SIGCONT: ::c_int = 19;
159pub const SIGSTOP: ::c_int = 17;
160pub const SIGTSTP: ::c_int = 18;
161pub const SIGURG: ::c_int = 16;
162pub const SIGIO: ::c_int = 23;
163pub const SIGSYS: ::c_int = 12;
164pub const SIGTTIN: ::c_int = 21;
165pub const SIGTTOU: ::c_int = 22;
166pub const SIGXCPU: ::c_int = 24;
167pub const SIGXFSZ: ::c_int = 25;
168pub const SIGVTALRM: ::c_int = 26;
169pub const SIGPROF: ::c_int = 27;
170pub const SIGWINCH: ::c_int = 28;
171pub const SIGINFO: ::c_int = 29;
172
173pub const SIG_SETMASK: ::c_int = 3;
174pub const SIG_BLOCK: ::c_int = 0x1;
175pub const SIG_UNBLOCK: ::c_int = 0x2;
176
177pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
178pub const IPV6_V6ONLY: ::c_int = 27;
179
180pub const ST_RDONLY: ::c_ulong = 1;
181
182pub const EV_ADD: ::uint16_t = 0x1;
183pub const EV_CLEAR: ::uint16_t = 0x20;
184pub const EV_DELETE: ::uint16_t = 0x2;
185pub const EV_DISABLE: ::uint16_t = 0x8;
186pub const EV_ENABLE: ::uint16_t = 0x4;
187pub const EV_EOF: ::uint16_t = 0x8000;
188pub const EV_ERROR: ::uint16_t = 0x4000;
189pub const EV_FLAG1: ::uint16_t = 0x2000;
190pub const EV_ONESHOT: ::uint16_t = 0x10;
191pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
192
193pub const NOTE_ATTRIB: ::uint32_t = 0x8;
194pub const NOTE_CHILD: ::uint32_t = 0x4;
195pub const NOTE_DELETE: ::uint32_t = 0x1;
196pub const NOTE_EXEC: ::uint32_t = 0x20000000;
197pub const NOTE_EXIT: ::uint32_t = 0x80000000;
198pub const NOTE_EXTEND: ::uint32_t = 0x4;
199pub const NOTE_FORK: ::uint32_t = 0x40000000;
200pub const NOTE_LINK: ::uint32_t = 0x10;
201pub const NOTE_LOWAT: ::uint32_t = 0x1;
202pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
203pub const NOTE_RENAME: ::uint32_t = 0x20;
204pub const NOTE_REVOKE: ::uint32_t = 0x40;
205pub const NOTE_TRACK: ::uint32_t = 0x1;
206pub const NOTE_TRACKERR: ::uint32_t = 0x2;
207pub const NOTE_WRITE: ::uint32_t = 0x2;
208
209pub const NCCS: usize = 20;
210
211pub const O_ASYNC: ::c_int = 0x40;
212pub const O_FSYNC: ::c_int = 0x80;
213pub const O_NDELAY: ::c_int = 0x4;
214pub const O_NOFOLLOW: ::c_int = 0x100;
215
216pub const F_GETOWN: ::c_int = 5;
217pub const F_SETOWN: ::c_int = 6;
218
219pub const MNT_FORCE: ::c_int = 0x80000;
220
221pub const Q_SYNC: ::c_int = 0x600;
222pub const Q_QUOTAON: ::c_int = 0x100;
223pub const Q_QUOTAOFF: ::c_int = 0x200;
224
225pub const TCIOFF: ::c_int = 3;
226pub const TCION: ::c_int = 4;
227pub const TCOOFF: ::c_int = 1;
228pub const TCOON: ::c_int = 2;
229pub const TCIFLUSH: ::c_int = 1;
230pub const TCOFLUSH: ::c_int = 2;
231pub const TCIOFLUSH: ::c_int = 3;
232pub const TCSANOW: ::c_int = 0;
233pub const TCSADRAIN: ::c_int = 1;
234pub const TCSAFLUSH: ::c_int = 2;
235pub const VEOF: usize = 0;
236pub const VEOL: usize = 1;
237pub const VEOL2: usize = 2;
238pub const VERASE: usize = 3;
239pub const VWERASE: usize = 4;
240pub const VKILL: usize = 5;
241pub const VREPRINT: usize = 6;
242pub const VINTR: usize = 8;
243pub const VQUIT: usize = 9;
244pub const VSUSP: usize = 10;
245pub const VSTART: usize = 12;
246pub const VSTOP: usize = 13;
247pub const VLNEXT: usize = 14;
248pub const VDISCARD: usize = 15;
249pub const VMIN: usize = 16;
250pub const VTIME: usize = 17;
251pub const IGNBRK: ::tcflag_t = 0x00000001;
252pub const BRKINT: ::tcflag_t = 0x00000002;
253pub const IGNPAR: ::tcflag_t = 0x00000004;
254pub const PARMRK: ::tcflag_t = 0x00000008;
255pub const INPCK: ::tcflag_t = 0x00000010;
256pub const ISTRIP: ::tcflag_t = 0x00000020;
257pub const INLCR: ::tcflag_t = 0x00000040;
258pub const IGNCR: ::tcflag_t = 0x00000080;
259pub const ICRNL: ::tcflag_t = 0x00000100;
260pub const IXON: ::tcflag_t = 0x00000200;
261pub const IXOFF: ::tcflag_t = 0x00000400;
262pub const IXANY: ::tcflag_t = 0x00000800;
263pub const IMAXBEL: ::tcflag_t = 0x00002000;
264pub const OPOST: ::tcflag_t = 0x1;
265pub const ONLCR: ::tcflag_t = 0x2;
266pub const CSIZE: ::tcflag_t = 0x00000300;
267pub const CS5: ::tcflag_t = 0x00000000;
268pub const CS6: ::tcflag_t = 0x00000100;
269pub const CS7: ::tcflag_t = 0x00000200;
270pub const CS8: ::tcflag_t = 0x00000300;
271pub const CSTOPB: ::tcflag_t = 0x00000400;
272pub const CREAD: ::tcflag_t = 0x00000800;
273pub const PARENB: ::tcflag_t = 0x00001000;
274pub const PARODD: ::tcflag_t = 0x00002000;
275pub const HUPCL: ::tcflag_t = 0x00004000;
276pub const CLOCAL: ::tcflag_t = 0x00008000;
277pub const ECHOKE: ::tcflag_t = 0x00000001;
278pub const ECHOE: ::tcflag_t = 0x00000002;
279pub const ECHOK: ::tcflag_t = 0x00000004;
280pub const ECHO: ::tcflag_t = 0x00000008;
281pub const ECHONL: ::tcflag_t = 0x00000010;
282pub const ECHOPRT: ::tcflag_t = 0x00000020;
283pub const ECHOCTL: ::tcflag_t = 0x00000040;
284pub const ISIG: ::tcflag_t = 0x00000080;
285pub const ICANON: ::tcflag_t = 0x00000100;
286pub const IEXTEN: ::tcflag_t = 0x00000400;
287pub const EXTPROC: ::tcflag_t = 0x00000800;
288pub const TOSTOP: ::tcflag_t = 0x00400000;
289pub const FLUSHO: ::tcflag_t = 0x00800000;
290pub const PENDIN: ::tcflag_t = 0x20000000;
291pub const NOFLSH: ::tcflag_t = 0x80000000;
292
293pub const WNOHANG: ::c_int = 0x00000001;
294pub const WUNTRACED: ::c_int = 0x00000002;
295
296pub const RTLD_NOW: ::c_int = 0x2;
297pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
298
299pub const LOG_CRON: ::c_int = 9 << 3;
300pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
301pub const LOG_FTP: ::c_int = 11 << 3;
302pub const LOG_PERROR: ::c_int = 0x20;
303
304pub const PIPE_BUF: usize = 512;
305
306f! {
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
350extern {
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
379cfg_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 @@
1pub type clock_t = i64;
2pub type suseconds_t = i64;
3pub type dev_t = i32;
4pub type sigset_t = ::c_uint;
5pub type blksize_t = ::uint32_t;
6pub type fsblkcnt_t = ::c_uint;
7pub type fsfilcnt_t = ::c_uint;
8pub type pthread_attr_t = *mut ::c_void;
9pub type pthread_mutex_t = *mut ::c_void;
10pub type pthread_mutexattr_t = *mut ::c_void;
11pub type pthread_cond_t = *mut ::c_void;
12pub type pthread_condattr_t = *mut ::c_void;
13pub type pthread_rwlock_t = *mut ::c_void;
14
15s! {
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
139pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
140pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
141pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
142pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
143pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
144pub const LC_TIME_MASK: ::c_int = (1 << 5);
145pub 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
152pub const ERA: ::nl_item = 52;
153pub const ERA_D_FMT: ::nl_item = 53;
154pub const ERA_D_T_FMT: ::nl_item = 54;
155pub const ERA_T_FMT: ::nl_item = 55;
156pub const ALT_DIGITS: ::nl_item = 56;
157
158pub const D_MD_ORDER: ::nl_item = 57;
159
160pub const ALTMON_1: ::nl_item = 58;
161pub const ALTMON_2: ::nl_item = 59;
162pub const ALTMON_3: ::nl_item = 60;
163pub const ALTMON_4: ::nl_item = 61;
164pub const ALTMON_5: ::nl_item = 62;
165pub const ALTMON_6: ::nl_item = 63;
166pub const ALTMON_7: ::nl_item = 64;
167pub const ALTMON_8: ::nl_item = 65;
168pub const ALTMON_9: ::nl_item = 66;
169pub const ALTMON_10: ::nl_item = 67;
170pub const ALTMON_11: ::nl_item = 68;
171pub const ALTMON_12: ::nl_item = 69;
172
173pub const O_CLOEXEC: ::c_int = 0x10000;
174
175pub const MS_SYNC : ::c_int = 0x0002;
176pub const MS_INVALIDATE : ::c_int = 0x0004;
177
178pub const PTHREAD_STACK_MIN : ::size_t = 2048;
179
180pub const ENOATTR : ::c_int = 83;
181pub const EILSEQ : ::c_int = 84;
182pub const EOVERFLOW : ::c_int = 87;
183pub const ECANCELED : ::c_int = 88;
184pub const EIDRM : ::c_int = 89;
185pub const ENOMSG : ::c_int = 90;
186pub const ENOTSUP : ::c_int = 91;
187pub const ELAST : ::c_int = 91;
188
189pub const F_DUPFD_CLOEXEC : ::c_int = 10;
190
191pub const RLIM_NLIMITS: ::c_int = 9;
192
193pub const SO_SNDTIMEO: ::c_int = 0x1005;
194pub const SO_RCVTIMEO: ::c_int = 0x1006;
195
196pub const O_DSYNC : ::c_int = 128;
197
198pub const MAP_RENAME : ::c_int = 0x0000;
199pub const MAP_NORESERVE : ::c_int = 0x0000;
200pub const MAP_HASSEMAPHORE : ::c_int = 0x0000;
201
202pub const EIPSEC : ::c_int = 82;
203pub const ENOMEDIUM : ::c_int = 85;
204pub const EMEDIUMTYPE : ::c_int = 86;
205
206pub const RUSAGE_THREAD: ::c_int = 1;
207
208pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12;
209pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13;
210
211pub const MAP_COPY : ::c_int = 0x0002;
212pub const MAP_NOEXTEND : ::c_int = 0x0000;
213
214pub const _SC_IOV_MAX : ::c_int = 51;
215pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
216pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
217pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
218pub const _SC_MQ_PRIO_MAX : ::c_int = 59;
219pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
220pub const _SC_THREADS : ::c_int = 91;
221pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77;
222pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78;
223pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80;
224pub const _SC_THREAD_KEYS_MAX : ::c_int = 81;
225pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82;
226pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83;
227pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84;
228pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85;
229pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
230pub const _SC_THREAD_STACK_MIN : ::c_int = 89;
231pub const _SC_THREAD_THREADS_MAX : ::c_int = 90;
232pub const _SC_TTY_NAME_MAX : ::c_int = 107;
233pub const _SC_ATEXIT_MAX : ::c_int = 46;
234pub const _SC_CLK_TCK : ::c_int = 3;
235pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
236pub const _SC_AIO_MAX : ::c_int = 43;
237pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
238pub const _SC_MAPPED_FILES : ::c_int = 53;
239pub const _SC_MEMLOCK : ::c_int = 54;
240pub const _SC_MEMLOCK_RANGE : ::c_int = 55;
241pub const _SC_MEMORY_PROTECTION : ::c_int = 56;
242pub const _SC_MESSAGE_PASSING : ::c_int = 57;
243pub const _SC_MQ_OPEN_MAX : ::c_int = 58;
244pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61;
245pub const _SC_SEMAPHORES : ::c_int = 67;
246pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
247pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
248pub const _SC_TIMERS : ::c_int = 94;
249pub const _SC_XOPEN_CRYPT : ::c_int = 117;
250pub const _SC_XOPEN_ENH_I18N : ::c_int = 118;
251pub const _SC_XOPEN_LEGACY : ::c_int = 119;
252pub const _SC_XOPEN_REALTIME : ::c_int = 120;
253pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121;
254pub const _SC_XOPEN_UNIX : ::c_int = 123;
255pub const _SC_XOPEN_VERSION : ::c_int = 125;
256pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
257pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
258pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
259pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
260pub const _SC_PRIORITIZED_IO : ::c_int = 60;
261pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
262pub const _SC_RTSIG_MAX : ::c_int = 66;
263pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
264pub const _SC_TIMER_MAX : ::c_int = 93;
265pub const _SC_HOST_NAME_MAX: ::c_int = 33;
266
267pub const FD_SETSIZE: usize = 1024;
268
269pub const ST_NOSUID: ::c_ulong = 2;
270
271pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
272pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
273pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
274
275pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
276pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
277pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
278pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4;
279pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP;
280
281pub const TMP_MAX : ::c_uint = 0x7fffffff;
282
283pub const NI_MAXHOST: ::size_t = 256;
284
285pub const CTL_MAXNAME: ::c_int = 12;
286pub const CTLTYPE_NODE: ::c_int = 1;
287pub const CTLTYPE_INT: ::c_int = 2;
288pub const CTLTYPE_STRING: ::c_int = 3;
289pub const CTLTYPE_QUAD: ::c_int = 4;
290pub const CTLTYPE_STRUCT: ::c_int = 5;
291pub const CTL_UNSPEC: ::c_int = 0;
292pub const CTL_KERN: ::c_int = 1;
293pub const CTL_VM: ::c_int = 2;
294pub const CTL_FS: ::c_int = 3;
295pub const CTL_NET: ::c_int = 4;
296pub const CTL_DEBUG: ::c_int = 5;
297pub const CTL_HW: ::c_int = 6;
298pub const CTL_MACHDEP: ::c_int = 7;
299pub const CTL_DDB: ::c_int = 9;
300pub const CTL_VFS: ::c_int = 10;
301pub const CTL_MAXID: ::c_int = 11;
302pub const KERN_OSTYPE: ::c_int = 1;
303pub const KERN_OSRELEASE: ::c_int = 2;
304pub const KERN_OSREV: ::c_int = 3;
305pub const KERN_VERSION: ::c_int = 4;
306pub const KERN_MAXVNODES: ::c_int = 5;
307pub const KERN_MAXPROC: ::c_int = 6;
308pub const KERN_MAXFILES: ::c_int = 7;
309pub const KERN_ARGMAX: ::c_int = 8;
310pub const KERN_SECURELVL: ::c_int = 9;
311pub const KERN_HOSTNAME: ::c_int = 10;
312pub const KERN_HOSTID: ::c_int = 11;
313pub const KERN_CLOCKRATE: ::c_int = 12;
314pub const KERN_PROF: ::c_int = 16;
315pub const KERN_POSIX1: ::c_int = 17;
316pub const KERN_NGROUPS: ::c_int = 18;
317pub const KERN_JOB_CONTROL: ::c_int = 19;
318pub const KERN_SAVED_IDS: ::c_int = 20;
319pub const KERN_BOOTTIME: ::c_int = 21;
320pub const KERN_DOMAINNAME: ::c_int = 22;
321pub const KERN_MAXPARTITIONS: ::c_int = 23;
322pub const KERN_RAWPARTITION: ::c_int = 24;
323pub const KERN_MAXTHREAD: ::c_int = 25;
324pub const KERN_NTHREADS: ::c_int = 26;
325pub const KERN_OSVERSION: ::c_int = 27;
326pub const KERN_SOMAXCONN: ::c_int = 28;
327pub const KERN_SOMINCONN: ::c_int = 29;
328pub const KERN_USERMOUNT: ::c_int = 30;
329pub const KERN_RND: ::c_int = 31;
330pub const KERN_NOSUIDCOREDUMP: ::c_int = 32;
331pub const KERN_FSYNC: ::c_int = 33;
332pub const KERN_SYSVMSG: ::c_int = 34;
333pub const KERN_SYSVSEM: ::c_int = 35;
334pub const KERN_SYSVSHM: ::c_int = 36;
335pub const KERN_ARND: ::c_int = 37;
336pub const KERN_MSGBUFSIZE: ::c_int = 38;
337pub const KERN_MALLOCSTATS: ::c_int = 39;
338pub const KERN_CPTIME: ::c_int = 40;
339pub const KERN_NCHSTATS: ::c_int = 41;
340pub const KERN_FORKSTAT: ::c_int = 42;
341pub const KERN_NSELCOLL: ::c_int = 43;
342pub const KERN_TTY: ::c_int = 44;
343pub const KERN_CCPU: ::c_int = 45;
344pub const KERN_FSCALE: ::c_int = 46;
345pub const KERN_NPROCS: ::c_int = 47;
346pub const KERN_MSGBUF: ::c_int = 48;
347pub const KERN_POOL: ::c_int = 49;
348pub const KERN_STACKGAPRANDOM: ::c_int = 50;
349pub const KERN_SYSVIPC_INFO: ::c_int = 51;
350pub const KERN_SPLASSERT: ::c_int = 54;
351pub const KERN_PROC_ARGS: ::c_int = 55;
352pub const KERN_NFILES: ::c_int = 56;
353pub const KERN_TTYCOUNT: ::c_int = 57;
354pub const KERN_NUMVNODES: ::c_int = 58;
355pub const KERN_MBSTAT: ::c_int = 59;
356pub const KERN_SEMINFO: ::c_int = 61;
357pub const KERN_SHMINFO: ::c_int = 62;
358pub const KERN_INTRCNT: ::c_int = 63;
359pub const KERN_WATCHDOG: ::c_int = 64;
360pub const KERN_PROC: ::c_int = 66;
361pub const KERN_MAXCLUSTERS: ::c_int = 67;
362pub const KERN_EVCOUNT: ::c_int = 68;
363pub const KERN_TIMECOUNTER: ::c_int = 69;
364pub const KERN_MAXLOCKSPERUID: ::c_int = 70;
365pub const KERN_CPTIME2: ::c_int = 71;
366pub const KERN_CACHEPCT: ::c_int = 72;
367pub const KERN_FILE: ::c_int = 73;
368pub const KERN_CONSDEV: ::c_int = 75;
369pub const KERN_NETLIVELOCKS: ::c_int = 76;
370pub const KERN_POOL_DEBUG: ::c_int = 77;
371pub const KERN_PROC_CWD: ::c_int = 78;
372pub const KERN_PROC_NOBROADCASTKILL: ::c_int = 79;
373pub const KERN_PROC_VMMAP: ::c_int = 80;
374pub const KERN_GLOBAL_PTRACE: ::c_int = 81;
375pub const KERN_CONSBUFSIZE: ::c_int = 82;
376pub const KERN_CONSBUF: ::c_int = 83;
377pub const KERN_MAXID: ::c_int = 84;
378pub const KERN_PROC_ALL: ::c_int = 0;
379pub const KERN_PROC_PID: ::c_int = 1;
380pub const KERN_PROC_PGRP: ::c_int = 2;
381pub const KERN_PROC_SESSION: ::c_int = 3;
382pub const KERN_PROC_TTY: ::c_int = 4;
383pub const KERN_PROC_UID: ::c_int = 5;
384pub const KERN_PROC_RUID: ::c_int = 6;
385pub const KERN_PROC_KTHREAD: ::c_int = 7;
386pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000;
387pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1;
388pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2;
389pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3;
390pub const KERN_PROC_ARGV: ::c_int = 1;
391pub const KERN_PROC_NARGV: ::c_int = 2;
392pub const KERN_PROC_ENV: ::c_int = 3;
393pub const KERN_PROC_NENV: ::c_int = 4;
394pub const KI_NGROUPS: ::c_int = 16;
395pub const KI_MAXCOMLEN: ::c_int = 24;
396pub const KI_WMESGLEN: ::c_int = 8;
397pub const KI_MAXLOGNAME: ::c_int = 32;
398pub const KI_EMULNAMELEN: ::c_int = 8;
399
400extern {
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 @@
1pub type c_long = i64;
2pub type c_ulong = u64;
3pub type time_t = i64;
4pub type mode_t = u32;
5pub type nlink_t = ::uint32_t;
6pub type ino_t = ::uint64_t;
7pub type pthread_key_t = ::c_int;
8pub type rlim_t = u64;
9pub type speed_t = ::c_uint;
10pub type tcflag_t = ::c_uint;
11pub type nl_item = c_long;
12pub type clockid_t = ::c_int;
13pub type id_t = ::uint32_t;
14pub type sem_t = *mut sem;
15
16pub enum timezone {}
17pub enum sem {}
18
19s! {
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
59pub const D_T_FMT: ::nl_item = 0;
60pub const D_FMT: ::nl_item = 1;
61pub const T_FMT: ::nl_item = 2;
62pub const T_FMT_AMPM: ::nl_item = 3;
63pub const AM_STR: ::nl_item = 4;
64pub const PM_STR: ::nl_item = 5;
65
66pub const DAY_1: ::nl_item = 6;
67pub const DAY_2: ::nl_item = 7;
68pub const DAY_3: ::nl_item = 8;
69pub const DAY_4: ::nl_item = 9;
70pub const DAY_5: ::nl_item = 10;
71pub const DAY_6: ::nl_item = 11;
72pub const DAY_7: ::nl_item = 12;
73
74pub const ABDAY_1: ::nl_item = 13;
75pub const ABDAY_2: ::nl_item = 14;
76pub const ABDAY_3: ::nl_item = 15;
77pub const ABDAY_4: ::nl_item = 16;
78pub const ABDAY_5: ::nl_item = 17;
79pub const ABDAY_6: ::nl_item = 18;
80pub const ABDAY_7: ::nl_item = 19;
81
82pub const MON_1: ::nl_item = 20;
83pub const MON_2: ::nl_item = 21;
84pub const MON_3: ::nl_item = 22;
85pub const MON_4: ::nl_item = 23;
86pub const MON_5: ::nl_item = 24;
87pub const MON_6: ::nl_item = 25;
88pub const MON_7: ::nl_item = 26;
89pub const MON_8: ::nl_item = 27;
90pub const MON_9: ::nl_item = 28;
91pub const MON_10: ::nl_item = 29;
92pub const MON_11: ::nl_item = 30;
93pub const MON_12: ::nl_item = 31;
94
95pub const ABMON_1: ::nl_item = 32;
96pub const ABMON_2: ::nl_item = 33;
97pub const ABMON_3: ::nl_item = 34;
98pub const ABMON_4: ::nl_item = 35;
99pub const ABMON_5: ::nl_item = 36;
100pub const ABMON_6: ::nl_item = 37;
101pub const ABMON_7: ::nl_item = 38;
102pub const ABMON_8: ::nl_item = 39;
103pub const ABMON_9: ::nl_item = 40;
104pub const ABMON_10: ::nl_item = 41;
105pub const ABMON_11: ::nl_item = 42;
106pub const ABMON_12: ::nl_item = 43;
107
108pub const RADIXCHAR: ::nl_item = 44;
109pub const THOUSEP: ::nl_item = 45;
110pub const YESSTR: ::nl_item = 46;
111pub const YESEXPR: ::nl_item = 47;
112pub const NOSTR: ::nl_item = 48;
113pub const NOEXPR: ::nl_item = 49;
114pub const CRNCYSTR: ::nl_item = 50;
115
116pub const CODESET: ::nl_item = 51;
117
118pub const EXIT_FAILURE : ::c_int = 1;
119pub const EXIT_SUCCESS : ::c_int = 0;
120pub const RAND_MAX : ::c_int = 2147483647;
121pub const EOF : ::c_int = -1;
122pub const SEEK_SET : ::c_int = 0;
123pub const SEEK_CUR : ::c_int = 1;
124pub const SEEK_END : ::c_int = 2;
125pub const _IOFBF : ::c_int = 0;
126pub const _IONBF : ::c_int = 2;
127pub const _IOLBF : ::c_int = 1;
128pub const BUFSIZ : ::c_uint = 1024;
129pub const FOPEN_MAX : ::c_uint = 20;
130pub const FILENAME_MAX : ::c_uint = 1024;
131pub const L_tmpnam : ::c_uint = 1024;
132pub const O_RDONLY : ::c_int = 0;
133pub const O_WRONLY : ::c_int = 1;
134pub const O_RDWR : ::c_int = 2;
135pub const O_ACCMODE : ::c_int = 3;
136pub const O_APPEND : ::c_int = 8;
137pub const O_CREAT : ::c_int = 512;
138pub const O_EXCL : ::c_int = 2048;
139pub const O_NOCTTY : ::c_int = 32768;
140pub const O_TRUNC : ::c_int = 1024;
141pub const O_SYNC : ::c_int = 128;
142pub const S_IFIFO : mode_t = 4096;
143pub const S_IFCHR : mode_t = 8192;
144pub const S_IFBLK : mode_t = 24576;
145pub const S_IFDIR : mode_t = 16384;
146pub const S_IFREG : mode_t = 32768;
147pub const S_IFLNK : mode_t = 40960;
148pub const S_IFSOCK : mode_t = 49152;
149pub const S_IFMT : mode_t = 61440;
150pub const S_IEXEC : mode_t = 64;
151pub const S_IWRITE : mode_t = 128;
152pub const S_IREAD : mode_t = 256;
153pub const S_IRWXU : mode_t = 448;
154pub const S_IXUSR : mode_t = 64;
155pub const S_IWUSR : mode_t = 128;
156pub const S_IRUSR : mode_t = 256;
157pub const S_IRWXG : mode_t = 56;
158pub const S_IXGRP : mode_t = 8;
159pub const S_IWGRP : mode_t = 16;
160pub const S_IRGRP : mode_t = 32;
161pub const S_IRWXO : mode_t = 7;
162pub const S_IXOTH : mode_t = 1;
163pub const S_IWOTH : mode_t = 2;
164pub const S_IROTH : mode_t = 4;
165pub const F_OK : ::c_int = 0;
166pub const R_OK : ::c_int = 4;
167pub const W_OK : ::c_int = 2;
168pub const X_OK : ::c_int = 1;
169pub const STDIN_FILENO : ::c_int = 0;
170pub const STDOUT_FILENO : ::c_int = 1;
171pub const STDERR_FILENO : ::c_int = 2;
172pub const F_LOCK : ::c_int = 1;
173pub const F_TEST : ::c_int = 3;
174pub const F_TLOCK : ::c_int = 2;
175pub const F_ULOCK : ::c_int = 0;
176pub const F_GETLK: ::c_int = 7;
177pub const F_SETLK: ::c_int = 8;
178pub const F_SETLKW: ::c_int = 9;
179pub const SIGHUP : ::c_int = 1;
180pub const SIGINT : ::c_int = 2;
181pub const SIGQUIT : ::c_int = 3;
182pub const SIGILL : ::c_int = 4;
183pub const SIGABRT : ::c_int = 6;
184pub const SIGEMT: ::c_int = 7;
185pub const SIGFPE : ::c_int = 8;
186pub const SIGKILL : ::c_int = 9;
187pub const SIGSEGV : ::c_int = 11;
188pub const SIGPIPE : ::c_int = 13;
189pub const SIGALRM : ::c_int = 14;
190pub const SIGTERM : ::c_int = 15;
191pub const SIGSTKSZ : ::size_t = 40960;
192
193pub const PROT_NONE : ::c_int = 0;
194pub const PROT_READ : ::c_int = 1;
195pub const PROT_WRITE : ::c_int = 2;
196pub const PROT_EXEC : ::c_int = 4;
197
198pub const MAP_FILE : ::c_int = 0x0000;
199pub const MAP_SHARED : ::c_int = 0x0001;
200pub const MAP_PRIVATE : ::c_int = 0x0002;
201pub const MAP_FIXED : ::c_int = 0x0010;
202pub const MAP_ANON : ::c_int = 0x1000;
203
204pub const MAP_FAILED : *mut ::c_void = !0 as *mut ::c_void;
205
206pub const MCL_CURRENT : ::c_int = 0x0001;
207pub const MCL_FUTURE : ::c_int = 0x0002;
208
209pub const MS_ASYNC : ::c_int = 0x0001;
210
211pub const EPERM : ::c_int = 1;
212pub const ENOENT : ::c_int = 2;
213pub const ESRCH : ::c_int = 3;
214pub const EINTR : ::c_int = 4;
215pub const EIO : ::c_int = 5;
216pub const ENXIO : ::c_int = 6;
217pub const E2BIG : ::c_int = 7;
218pub const ENOEXEC : ::c_int = 8;
219pub const EBADF : ::c_int = 9;
220pub const ECHILD : ::c_int = 10;
221pub const EDEADLK : ::c_int = 11;
222pub const ENOMEM : ::c_int = 12;
223pub const EACCES : ::c_int = 13;
224pub const EFAULT : ::c_int = 14;
225pub const ENOTBLK : ::c_int = 15;
226pub const EBUSY : ::c_int = 16;
227pub const EEXIST : ::c_int = 17;
228pub const EXDEV : ::c_int = 18;
229pub const ENODEV : ::c_int = 19;
230pub const ENOTDIR : ::c_int = 20;
231pub const EISDIR : ::c_int = 21;
232pub const EINVAL : ::c_int = 22;
233pub const ENFILE : ::c_int = 23;
234pub const EMFILE : ::c_int = 24;
235pub const ENOTTY : ::c_int = 25;
236pub const ETXTBSY : ::c_int = 26;
237pub const EFBIG : ::c_int = 27;
238pub const ENOSPC : ::c_int = 28;
239pub const ESPIPE : ::c_int = 29;
240pub const EROFS : ::c_int = 30;
241pub const EMLINK : ::c_int = 31;
242pub const EPIPE : ::c_int = 32;
243pub const EDOM : ::c_int = 33;
244pub const ERANGE : ::c_int = 34;
245pub const EAGAIN : ::c_int = 35;
246pub const EWOULDBLOCK : ::c_int = 35;
247pub const EINPROGRESS : ::c_int = 36;
248pub const EALREADY : ::c_int = 37;
249pub const ENOTSOCK : ::c_int = 38;
250pub const EDESTADDRREQ : ::c_int = 39;
251pub const EMSGSIZE : ::c_int = 40;
252pub const EPROTOTYPE : ::c_int = 41;
253pub const ENOPROTOOPT : ::c_int = 42;
254pub const EPROTONOSUPPORT : ::c_int = 43;
255pub const ESOCKTNOSUPPORT : ::c_int = 44;
256pub const EOPNOTSUPP : ::c_int = 45;
257pub const EPFNOSUPPORT : ::c_int = 46;
258pub const EAFNOSUPPORT : ::c_int = 47;
259pub const EADDRINUSE : ::c_int = 48;
260pub const EADDRNOTAVAIL : ::c_int = 49;
261pub const ENETDOWN : ::c_int = 50;
262pub const ENETUNREACH : ::c_int = 51;
263pub const ENETRESET : ::c_int = 52;
264pub const ECONNABORTED : ::c_int = 53;
265pub const ECONNRESET : ::c_int = 54;
266pub const ENOBUFS : ::c_int = 55;
267pub const EISCONN : ::c_int = 56;
268pub const ENOTCONN : ::c_int = 57;
269pub const ESHUTDOWN : ::c_int = 58;
270pub const ETOOMANYREFS : ::c_int = 59;
271pub const ETIMEDOUT : ::c_int = 60;
272pub const ECONNREFUSED : ::c_int = 61;
273pub const ELOOP : ::c_int = 62;
274pub const ENAMETOOLONG : ::c_int = 63;
275pub const EHOSTDOWN : ::c_int = 64;
276pub const EHOSTUNREACH : ::c_int = 65;
277pub const ENOTEMPTY : ::c_int = 66;
278pub const EPROCLIM : ::c_int = 67;
279pub const EUSERS : ::c_int = 68;
280pub const EDQUOT : ::c_int = 69;
281pub const ESTALE : ::c_int = 70;
282pub const EREMOTE : ::c_int = 71;
283pub const EBADRPC : ::c_int = 72;
284pub const ERPCMISMATCH : ::c_int = 73;
285pub const EPROGUNAVAIL : ::c_int = 74;
286pub const EPROGMISMATCH : ::c_int = 75;
287pub const EPROCUNAVAIL : ::c_int = 76;
288pub const ENOLCK : ::c_int = 77;
289pub const ENOSYS : ::c_int = 78;
290pub const EFTYPE : ::c_int = 79;
291pub const EAUTH : ::c_int = 80;
292pub const ENEEDAUTH : ::c_int = 81;
293
294pub const F_DUPFD : ::c_int = 0;
295pub const F_GETFD : ::c_int = 1;
296pub const F_SETFD : ::c_int = 2;
297pub const F_GETFL : ::c_int = 3;
298pub const F_SETFL : ::c_int = 4;
299
300pub const SIGTRAP : ::c_int = 5;
301
302pub const GLOB_APPEND : ::c_int = 0x0001;
303pub const GLOB_DOOFFS : ::c_int = 0x0002;
304pub const GLOB_ERR : ::c_int = 0x0004;
305pub const GLOB_MARK : ::c_int = 0x0008;
306pub const GLOB_NOCHECK : ::c_int = 0x0010;
307pub const GLOB_NOSORT : ::c_int = 0x0020;
308pub const GLOB_NOESCAPE : ::c_int = 0x1000;
309
310pub const GLOB_NOSPACE : ::c_int = -1;
311pub const GLOB_ABORTED : ::c_int = -2;
312pub const GLOB_NOMATCH : ::c_int = -3;
313pub const GLOB_NOSYS : ::c_int = -4;
314
315pub const POSIX_MADV_NORMAL : ::c_int = 0;
316pub const POSIX_MADV_RANDOM : ::c_int = 1;
317pub const POSIX_MADV_SEQUENTIAL : ::c_int = 2;
318pub const POSIX_MADV_WILLNEED : ::c_int = 3;
319pub const POSIX_MADV_DONTNEED : ::c_int = 4;
320
321pub const _SC_XOPEN_SHM : ::c_int = 30;
322
323pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0;
324pub 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
334pub const CLOCK_REALTIME: clockid_t = 0;
335pub const CLOCK_MONOTONIC: clockid_t = 3;
336
337pub const RLIMIT_CPU: ::c_int = 0;
338pub const RLIMIT_FSIZE: ::c_int = 1;
339pub const RLIMIT_DATA: ::c_int = 2;
340pub const RLIMIT_STACK: ::c_int = 3;
341pub const RLIMIT_CORE: ::c_int = 4;
342pub const RLIMIT_RSS: ::c_int = 5;
343pub const RLIMIT_MEMLOCK: ::c_int = 6;
344pub const RLIMIT_NPROC: ::c_int = 7;
345pub const RLIMIT_NOFILE: ::c_int = 8;
346
347pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
348pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
349pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
350
351pub const RUSAGE_SELF: ::c_int = 0;
352pub const RUSAGE_CHILDREN: ::c_int = -1;
353
354pub const MADV_NORMAL : ::c_int = 0;
355pub const MADV_RANDOM : ::c_int = 1;
356pub const MADV_SEQUENTIAL : ::c_int = 2;
357pub const MADV_WILLNEED : ::c_int = 3;
358pub const MADV_DONTNEED : ::c_int = 4;
359pub const MADV_FREE : ::c_int = 6;
360
361pub const AF_UNIX: ::c_int = 1;
362pub const AF_INET: ::c_int = 2;
363pub const AF_INET6: ::c_int = 24;
364pub const SOCK_STREAM: ::c_int = 1;
365pub const SOCK_DGRAM: ::c_int = 2;
366pub const SOCK_RAW: ::c_int = 3;
367pub const SOCK_SEQPACKET: ::c_int = 5;
368pub const IPPROTO_TCP: ::c_int = 6;
369pub const IPPROTO_IP: ::c_int = 0;
370pub const IPPROTO_IPV6: ::c_int = 41;
371pub const IP_MULTICAST_TTL: ::c_int = 10;
372pub const IP_MULTICAST_LOOP: ::c_int = 11;
373pub const IP_TTL: ::c_int = 4;
374pub const IP_HDRINCL: ::c_int = 2;
375pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
376pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
377
378pub const TCP_NODELAY: ::c_int = 0x01;
379pub const SOL_SOCKET: ::c_int = 0xffff;
380pub const SO_DEBUG: ::c_int = 0x01;
381pub const SO_ACCEPTCONN: ::c_int = 0x0002;
382pub const SO_REUSEADDR: ::c_int = 0x0004;
383pub const SO_KEEPALIVE: ::c_int = 0x0008;
384pub const SO_DONTROUTE: ::c_int = 0x0010;
385pub const SO_BROADCAST: ::c_int = 0x0020;
386pub const SO_USELOOPBACK: ::c_int = 0x0040;
387pub const SO_LINGER: ::c_int = 0x0080;
388pub const SO_OOBINLINE: ::c_int = 0x0100;
389pub const SO_REUSEPORT: ::c_int = 0x0200;
390pub const SO_SNDBUF: ::c_int = 0x1001;
391pub const SO_RCVBUF: ::c_int = 0x1002;
392pub const SO_SNDLOWAT: ::c_int = 0x1003;
393pub const SO_RCVLOWAT: ::c_int = 0x1004;
394pub const SO_ERROR: ::c_int = 0x1007;
395pub const SO_TYPE: ::c_int = 0x1008;
396
397pub const IFF_LOOPBACK: ::c_int = 0x8;
398
399pub const SHUT_RD: ::c_int = 0;
400pub const SHUT_WR: ::c_int = 1;
401pub const SHUT_RDWR: ::c_int = 2;
402
403pub const LOCK_SH: ::c_int = 1;
404pub const LOCK_EX: ::c_int = 2;
405pub const LOCK_NB: ::c_int = 4;
406pub const LOCK_UN: ::c_int = 8;
407
408pub const O_NONBLOCK : ::c_int = 4;
409
410pub const IPPROTO_RAW : ::c_int = 255;
411
412pub const _SC_ARG_MAX : ::c_int = 1;
413pub const _SC_CHILD_MAX : ::c_int = 2;
414pub const _SC_NGROUPS_MAX : ::c_int = 4;
415pub const _SC_OPEN_MAX : ::c_int = 5;
416pub const _SC_JOB_CONTROL : ::c_int = 6;
417pub const _SC_SAVED_IDS : ::c_int = 7;
418pub const _SC_VERSION : ::c_int = 8;
419pub const _SC_BC_BASE_MAX : ::c_int = 9;
420pub const _SC_BC_DIM_MAX : ::c_int = 10;
421pub const _SC_BC_SCALE_MAX : ::c_int = 11;
422pub const _SC_BC_STRING_MAX : ::c_int = 12;
423pub const _SC_COLL_WEIGHTS_MAX : ::c_int = 13;
424pub const _SC_EXPR_NEST_MAX : ::c_int = 14;
425pub const _SC_LINE_MAX : ::c_int = 15;
426pub const _SC_RE_DUP_MAX : ::c_int = 16;
427pub const _SC_2_VERSION : ::c_int = 17;
428pub const _SC_2_C_BIND : ::c_int = 18;
429pub const _SC_2_C_DEV : ::c_int = 19;
430pub const _SC_2_CHAR_TERM : ::c_int = 20;
431pub const _SC_2_FORT_DEV : ::c_int = 21;
432pub const _SC_2_FORT_RUN : ::c_int = 22;
433pub const _SC_2_LOCALEDEF : ::c_int = 23;
434pub const _SC_2_SW_DEV : ::c_int = 24;
435pub const _SC_2_UPE : ::c_int = 25;
436pub const _SC_STREAM_MAX : ::c_int = 26;
437pub const _SC_TZNAME_MAX : ::c_int = 27;
438pub const _SC_PAGESIZE : ::c_int = 28;
439pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
440pub const _SC_FSYNC : ::c_int = 29;
441
442pub const Q_GETQUOTA: ::c_int = 0x300;
443pub const Q_SETQUOTA: ::c_int = 0x400;
444
445pub const RTLD_GLOBAL: ::c_int = 0x100;
446
447pub const LOG_NFACILITIES: ::c_int = 24;
448
449pub const HW_NCPU: ::c_int = 3;
450
451pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
452
453f! {
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")]
468extern {
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
532cfg_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 @@
1pub type clock_t = ::c_uint;
2pub type suseconds_t = ::c_int;
3pub type dev_t = u64;
4pub type blksize_t = ::int32_t;
5pub type fsblkcnt_t = ::uint64_t;
6pub type fsfilcnt_t = ::uint64_t;
7
8s! {
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
227pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE);
228pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE);
229pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY);
230pub const LC_NUMERIC_MASK: ::c_int = (1 << ::LC_NUMERIC);
231pub const LC_TIME_MASK: ::c_int = (1 << ::LC_TIME);
232pub const LC_MESSAGES_MASK: ::c_int = (1 << ::LC_MESSAGES);
233pub const LC_ALL_MASK: ::c_int = !0;
234
235pub const ERA: ::nl_item = 52;
236pub const ERA_D_FMT: ::nl_item = 53;
237pub const ERA_D_T_FMT: ::nl_item = 54;
238pub const ERA_T_FMT: ::nl_item = 55;
239pub const ALT_DIGITS: ::nl_item = 56;
240
241pub const O_CLOEXEC: ::c_int = 0x400000;
242pub const O_ALT_IO: ::c_int = 0x40000;
243pub const O_NOSIGPIPE: ::c_int = 0x1000000;
244pub const O_SEARCH: ::c_int = 0x800000;
245pub const O_EXLOCK: ::c_int = 0x20;
246pub const O_SHLOCK: ::c_int = 0x10;
247pub const O_DIRECTORY: ::c_int = 0x200000;
248
249pub const MS_SYNC : ::c_int = 0x4;
250pub const MS_INVALIDATE : ::c_int = 0x2;
251
252pub const RLIM_NLIMITS: ::c_int = 12;
253
254pub const ENOATTR : ::c_int = 93;
255pub const EILSEQ : ::c_int = 85;
256pub const EOVERFLOW : ::c_int = 84;
257pub const ECANCELED : ::c_int = 87;
258pub const EIDRM : ::c_int = 82;
259pub const ENOMSG : ::c_int = 83;
260pub const ENOTSUP : ::c_int = 86;
261pub const ELAST : ::c_int = 96;
262
263pub const F_DUPFD_CLOEXEC : ::c_int = 12;
264pub const F_CLOSEM: ::c_int = 10;
265pub const F_GETNOSIGPIPE: ::c_int = 13;
266pub const F_SETNOSIGPIPE: ::c_int = 14;
267pub const F_MAXFD: ::c_int = 11;
268
269pub const IPV6_JOIN_GROUP: ::c_int = 12;
270pub const IPV6_LEAVE_GROUP: ::c_int = 13;
271
272pub const SO_SNDTIMEO: ::c_int = 0x100b;
273pub const SO_RCVTIMEO: ::c_int = 0x100c;
274
275pub const O_DSYNC : ::c_int = 0x10000;
276
277pub const MAP_RENAME : ::c_int = 0x20;
278pub const MAP_NORESERVE : ::c_int = 0x40;
279pub const MAP_HASSEMAPHORE : ::c_int = 0x200;
280pub const MAP_WIRED: ::c_int = 0x800;
281
282pub const _SC_IOV_MAX : ::c_int = 32;
283pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47;
284pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 48;
285pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
286pub const _SC_MQ_PRIO_MAX : ::c_int = 55;
287pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002;
288pub const _SC_THREADS : ::c_int = 41;
289pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
290pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
291pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 57;
292pub const _SC_THREAD_KEYS_MAX : ::c_int = 58;
293pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 64;
294pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 65;
295pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
296pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 66;
297pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 67;
298pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
299pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
300pub const _SC_TTY_NAME_MAX : ::c_int = 68;
301pub const _SC_ATEXIT_MAX : ::c_int = 40;
302pub const _SC_CLK_TCK : ::c_int = 39;
303pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
304pub const _SC_AIO_MAX : ::c_int = 52;
305pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
306pub const _SC_MAPPED_FILES : ::c_int = 33;
307pub const _SC_MEMLOCK : ::c_int = 34;
308pub const _SC_MEMLOCK_RANGE : ::c_int = 35;
309pub const _SC_MEMORY_PROTECTION : ::c_int = 36;
310pub const _SC_MESSAGE_PASSING : ::c_int = 53;
311pub const _SC_MQ_OPEN_MAX : ::c_int = 54;
312pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56;
313pub const _SC_SEMAPHORES : ::c_int = 42;
314pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87;
315pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
316pub const _SC_TIMERS : ::c_int = 44;
317pub const _SC_HOST_NAME_MAX : ::c_int = 69;
318
319pub const FD_SETSIZE: usize = 0x100;
320
321pub const ST_NOSUID: ::c_ulong = 8;
322
323pub 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};
334pub 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};
342pub 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};
353pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
354pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
355pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
356pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
357
358pub const EVFILT_AIO: ::int16_t = 2;
359pub const EVFILT_PROC: ::int16_t = 4;
360pub const EVFILT_READ: ::int16_t = 0;
361pub const EVFILT_SIGNAL: ::int16_t = 5;
362pub const EVFILT_SYSCOUNT: ::int16_t = 7;
363pub const EVFILT_TIMER: ::int16_t = 6;
364pub const EVFILT_VNODE: ::int16_t = 3;
365pub const EVFILT_WRITE: ::int16_t = 1;
366
367pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
368
369pub const CRTSCTS: ::tcflag_t = 0x00010000;
370
371pub const TMP_MAX : ::c_uint = 308915776;
372
373pub const NI_MAXHOST: ::socklen_t = 1025;
374
375pub const RTLD_NOLOAD: ::c_int = 0x2000;
376pub const RTLD_LOCAL: ::c_int = 0x200;
377
378pub const CTL_MAXNAME: ::c_int = 12;
379pub const SYSCTL_NAMELEN: ::c_int = 32;
380pub const SYSCTL_DEFSIZE: ::c_int = 8;
381pub const CTLTYPE_NODE: ::c_int = 1;
382pub const CTLTYPE_INT: ::c_int = 2;
383pub const CTLTYPE_STRING: ::c_int = 3;
384pub const CTLTYPE_QUAD: ::c_int = 4;
385pub const CTLTYPE_STRUCT: ::c_int = 5;
386pub const CTLTYPE_BOOL: ::c_int = 6;
387pub const CTLFLAG_READONLY: ::c_int = 0x00000000;
388pub const CTLFLAG_READWRITE: ::c_int = 0x00000070;
389pub const CTLFLAG_ANYWRITE: ::c_int = 0x00000080;
390pub const CTLFLAG_PRIVATE: ::c_int = 0x00000100;
391pub const CTLFLAG_PERMANENT: ::c_int = 0x00000200;
392pub const CTLFLAG_OWNDATA: ::c_int = 0x00000400;
393pub const CTLFLAG_IMMEDIATE: ::c_int = 0x00000800;
394pub const CTLFLAG_HEX: ::c_int = 0x00001000;
395pub const CTLFLAG_ROOT: ::c_int = 0x00002000;
396pub const CTLFLAG_ANYNUMBER: ::c_int = 0x00004000;
397pub const CTLFLAG_HIDDEN: ::c_int = 0x00008000;
398pub const CTLFLAG_ALIAS: ::c_int = 0x00010000;
399pub const CTLFLAG_MMAP: ::c_int = 0x00020000;
400pub const CTLFLAG_OWNDESC: ::c_int = 0x00040000;
401pub const CTLFLAG_UNSIGNED: ::c_int = 0x00080000;
402pub const SYSCTL_VERS_MASK: ::c_int = 0xff000000;
403pub const SYSCTL_VERS_0: ::c_int = 0x00000000;
404pub const SYSCTL_VERS_1: ::c_int = 0x01000000;
405pub const SYSCTL_VERSION: ::c_int = SYSCTL_VERS_1;
406pub const CTL_EOL: ::c_int = -1;
407pub const CTL_QUERY: ::c_int = -2;
408pub const CTL_CREATE: ::c_int = -3;
409pub const CTL_CREATESYM: ::c_int = -4;
410pub const CTL_DESTROY: ::c_int = -5;
411pub const CTL_MMAP: ::c_int = -6;
412pub const CTL_DESCRIBE: ::c_int = -7;
413pub const CTL_UNSPEC: ::c_int = 0;
414pub const CTL_KERN: ::c_int = 1;
415pub const CTL_VM: ::c_int = 2;
416pub const CTL_VFS: ::c_int = 3;
417pub const CTL_NET: ::c_int = 4;
418pub const CTL_DEBUG: ::c_int = 5;
419pub const CTL_HW: ::c_int = 6;
420pub const CTL_MACHDEP: ::c_int = 7;
421pub const CTL_USER: ::c_int = 8;
422pub const CTL_DDB: ::c_int = 9;
423pub const CTL_PROC: ::c_int = 10;
424pub const CTL_VENDOR: ::c_int = 11;
425pub const CTL_EMUL: ::c_int = 12;
426pub const CTL_SECURITY: ::c_int = 13;
427pub const CTL_MAXID: ::c_int = 14;
428pub const KERN_OSTYPE: ::c_int = 1;
429pub const KERN_OSRELEASE: ::c_int = 2;
430pub const KERN_OSREV: ::c_int = 3;
431pub const KERN_VERSION: ::c_int = 4;
432pub const KERN_MAXVNODES: ::c_int = 5;
433pub const KERN_MAXPROC: ::c_int = 6;
434pub const KERN_MAXFILES: ::c_int = 7;
435pub const KERN_ARGMAX: ::c_int = 8;
436pub const KERN_SECURELVL: ::c_int = 9;
437pub const KERN_HOSTNAME: ::c_int = 10;
438pub const KERN_HOSTID: ::c_int = 11;
439pub const KERN_CLOCKRATE: ::c_int = 12;
440pub const KERN_VNODE: ::c_int = 13;
441pub const KERN_PROC: ::c_int = 14;
442pub const KERN_FILE: ::c_int = 15;
443pub const KERN_PROF: ::c_int = 16;
444pub const KERN_POSIX1: ::c_int = 17;
445pub const KERN_NGROUPS: ::c_int = 18;
446pub const KERN_JOB_CONTROL: ::c_int = 19;
447pub const KERN_SAVED_IDS: ::c_int = 20;
448pub const KERN_OBOOTTIME: ::c_int = 21;
449pub const KERN_DOMAINNAME: ::c_int = 22;
450pub const KERN_MAXPARTITIONS: ::c_int = 23;
451pub const KERN_RAWPARTITION: ::c_int = 24;
452pub const KERN_NTPTIME: ::c_int = 25;
453pub const KERN_TIMEX: ::c_int = 26;
454pub const KERN_AUTONICETIME: ::c_int = 27;
455pub const KERN_AUTONICEVAL: ::c_int = 28;
456pub const KERN_RTC_OFFSET: ::c_int = 29;
457pub const KERN_ROOT_DEVICE: ::c_int = 30;
458pub const KERN_MSGBUFSIZE: ::c_int = 31;
459pub const KERN_FSYNC: ::c_int = 32;
460pub const KERN_OLDSYSVMSG: ::c_int = 33;
461pub const KERN_OLDSYSVSEM: ::c_int = 34;
462pub const KERN_OLDSYSVSHM: ::c_int = 35;
463pub const KERN_OLDSHORTCORENAME: ::c_int = 36;
464pub const KERN_SYNCHRONIZED_IO: ::c_int = 37;
465pub const KERN_IOV_MAX: ::c_int = 38;
466pub const KERN_MBUF: ::c_int = 39;
467pub const KERN_MAPPED_FILES: ::c_int = 40;
468pub const KERN_MEMLOCK: ::c_int = 41;
469pub const KERN_MEMLOCK_RANGE: ::c_int = 42;
470pub const KERN_MEMORY_PROTECTION: ::c_int = 43;
471pub const KERN_LOGIN_NAME_MAX: ::c_int = 44;
472pub const KERN_DEFCORENAME: ::c_int = 45;
473pub const KERN_LOGSIGEXIT: ::c_int = 46;
474pub const KERN_PROC2: ::c_int = 47;
475pub const KERN_PROC_ARGS: ::c_int = 48;
476pub const KERN_FSCALE: ::c_int = 49;
477pub const KERN_CCPU: ::c_int = 50;
478pub const KERN_CP_TIME: ::c_int = 51;
479pub const KERN_OLDSYSVIPC_INFO: ::c_int = 52;
480pub const KERN_MSGBUF: ::c_int = 53;
481pub const KERN_CONSDEV: ::c_int = 54;
482pub const KERN_MAXPTYS: ::c_int = 55;
483pub const KERN_PIPE: ::c_int = 56;
484pub const KERN_MAXPHYS: ::c_int = 57;
485pub const KERN_SBMAX: ::c_int = 58;
486pub const KERN_TKSTAT: ::c_int = 59;
487pub const KERN_MONOTONIC_CLOCK: ::c_int = 60;
488pub const KERN_URND: ::c_int = 61;
489pub const KERN_LABELSECTOR: ::c_int = 62;
490pub const KERN_LABELOFFSET: ::c_int = 63;
491pub const KERN_LWP: ::c_int = 64;
492pub const KERN_FORKFSLEEP: ::c_int = 65;
493pub const KERN_POSIX_THREADS: ::c_int = 66;
494pub const KERN_POSIX_SEMAPHORES: ::c_int = 67;
495pub const KERN_POSIX_BARRIERS: ::c_int = 68;
496pub const KERN_POSIX_TIMERS: ::c_int = 69;
497pub const KERN_POSIX_SPIN_LOCKS: ::c_int = 70;
498pub const KERN_POSIX_READER_WRITER_LOCKS: ::c_int = 71;
499pub const KERN_DUMP_ON_PANIC: ::c_int = 72;
500pub const KERN_SOMAXKVA: ::c_int = 73;
501pub const KERN_ROOT_PARTITION: ::c_int = 74;
502pub const KERN_DRIVERS: ::c_int = 75;
503pub const KERN_BUF: ::c_int = 76;
504pub const KERN_FILE2: ::c_int = 77;
505pub const KERN_VERIEXEC: ::c_int = 78;
506pub const KERN_CP_ID: ::c_int = 79;
507pub const KERN_HARDCLOCK_TICKS: ::c_int = 80;
508pub const KERN_ARND: ::c_int = 81;
509pub const KERN_SYSVIPC: ::c_int = 82;
510pub const KERN_BOOTTIME: ::c_int = 83;
511pub const KERN_EVCNT: ::c_int = 84;
512pub const KERN_MAXID: ::c_int = 85;
513pub const KERN_PROC_ALL: ::c_int = 0;
514pub const KERN_PROC_PID: ::c_int = 1;
515pub const KERN_PROC_PGRP: ::c_int = 2;
516pub const KERN_PROC_SESSION: ::c_int = 3;
517pub const KERN_PROC_TTY: ::c_int = 4;
518pub const KERN_PROC_UID: ::c_int = 5;
519pub const KERN_PROC_RUID: ::c_int = 6;
520pub const KERN_PROC_GID: ::c_int = 7;
521pub const KERN_PROC_RGID: ::c_int = 8;
522
523extern {
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 @@
1pub type clock_t = i64;
2pub type suseconds_t = i64;
3pub type dev_t = i32;
4pub type sigset_t = ::c_uint;
5pub type blksize_t = ::int32_t;
6pub type fsblkcnt_t = ::uint64_t;
7pub type fsfilcnt_t = ::uint64_t;
8pub type pthread_attr_t = *mut ::c_void;
9pub type pthread_mutex_t = *mut ::c_void;
10pub type pthread_mutexattr_t = *mut ::c_void;
11pub type pthread_cond_t = *mut ::c_void;
12pub type pthread_condattr_t = *mut ::c_void;
13pub type pthread_rwlock_t = *mut ::c_void;
14
15s! {
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
155pub const UT_NAMESIZE: usize = 32;
156pub const UT_LINESIZE: usize = 8;
157pub const UT_HOSTSIZE: usize = 256;
158
159pub const O_CLOEXEC: ::c_int = 0x10000;
160
161pub const MS_SYNC : ::c_int = 0x0002;
162pub const MS_INVALIDATE : ::c_int = 0x0004;
163
164pub const PTHREAD_STACK_MIN : ::size_t = 2048;
165
166pub const ENOATTR : ::c_int = 83;
167pub const EILSEQ : ::c_int = 84;
168pub const EOVERFLOW : ::c_int = 87;
169pub const ECANCELED : ::c_int = 88;
170pub const EIDRM : ::c_int = 89;
171pub const ENOMSG : ::c_int = 90;
172pub const ENOTSUP : ::c_int = 91;
173pub const ELAST : ::c_int = 91;
174
175pub const F_DUPFD_CLOEXEC : ::c_int = 10;
176
177pub const RLIM_NLIMITS: ::c_int = 9;
178
179pub const SO_SNDTIMEO: ::c_int = 0x1005;
180pub const SO_RCVTIMEO: ::c_int = 0x1006;
181
182pub const IPV6_JOIN_GROUP: ::c_int = 12;
183pub const IPV6_LEAVE_GROUP: ::c_int = 13;
184
185pub const O_DSYNC : ::c_int = 128;
186
187pub const MAP_RENAME : ::c_int = 0x0000;
188pub const MAP_NORESERVE : ::c_int = 0x0000;
189pub const MAP_HASSEMAPHORE : ::c_int = 0x0000;
190
191pub const EIPSEC : ::c_int = 82;
192pub const ENOMEDIUM : ::c_int = 85;
193pub const EMEDIUMTYPE : ::c_int = 86;
194
195pub const RUSAGE_THREAD: ::c_int = 1;
196
197pub const MAP_COPY : ::c_int = 0x0002;
198pub const MAP_NOEXTEND : ::c_int = 0x0000;
199
200pub const _SC_CLK_TCK : ::c_int = 3;
201pub const _SC_IOV_MAX : ::c_int = 51;
202pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
203pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
204pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
205pub const _SC_MQ_PRIO_MAX : ::c_int = 59;
206pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
207pub const _SC_THREADS : ::c_int = 91;
208pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77;
209pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78;
210pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80;
211pub const _SC_THREAD_KEYS_MAX : ::c_int = 81;
212pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82;
213pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83;
214pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84;
215pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85;
216pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
217pub const _SC_THREAD_STACK_MIN : ::c_int = 89;
218pub const _SC_THREAD_THREADS_MAX : ::c_int = 90;
219pub const _SC_TTY_NAME_MAX : ::c_int = 107;
220pub const _SC_ATEXIT_MAX : ::c_int = 46;
221pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
222pub const _SC_AIO_MAX : ::c_int = 43;
223pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
224pub const _SC_MAPPED_FILES : ::c_int = 53;
225pub const _SC_MEMLOCK : ::c_int = 54;
226pub const _SC_MEMLOCK_RANGE : ::c_int = 55;
227pub const _SC_MEMORY_PROTECTION : ::c_int = 56;
228pub const _SC_MESSAGE_PASSING : ::c_int = 57;
229pub const _SC_MQ_OPEN_MAX : ::c_int = 58;
230pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61;
231pub const _SC_SEMAPHORES : ::c_int = 67;
232pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
233pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
234pub const _SC_TIMERS : ::c_int = 94;
235pub const _SC_XOPEN_CRYPT : ::c_int = 117;
236pub const _SC_XOPEN_ENH_I18N : ::c_int = 118;
237pub const _SC_XOPEN_LEGACY : ::c_int = 119;
238pub const _SC_XOPEN_REALTIME : ::c_int = 120;
239pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121;
240pub const _SC_XOPEN_UNIX : ::c_int = 123;
241pub const _SC_XOPEN_VERSION : ::c_int = 125;
242pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
243pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
244pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
245pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
246pub const _SC_PRIORITIZED_IO : ::c_int = 60;
247pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
248pub const _SC_RTSIG_MAX : ::c_int = 66;
249pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
250pub const _SC_TIMER_MAX : ::c_int = 93;
251pub const _SC_HOST_NAME_MAX : ::c_int = 33;
252
253pub const FD_SETSIZE: usize = 1024;
254
255pub const ST_NOSUID: ::c_ulong = 2;
256
257pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
258pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
259pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
260
261pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
262pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
263pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
264pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4;
265pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP;
266
267pub const TMP_MAX : ::c_uint = 0x7fffffff;
268
269pub const NI_MAXHOST: ::size_t = 256;
270
271pub const RTLD_LOCAL: ::c_int = 0;
272pub const CTL_MAXNAME: ::c_int = 12;
273pub const CTLTYPE_NODE: ::c_int = 1;
274pub const CTLTYPE_INT: ::c_int = 2;
275pub const CTLTYPE_STRING: ::c_int = 3;
276pub const CTLTYPE_QUAD: ::c_int = 4;
277pub const CTLTYPE_STRUCT: ::c_int = 5;
278pub const CTL_UNSPEC: ::c_int = 0;
279pub const CTL_KERN: ::c_int = 1;
280pub const CTL_VM: ::c_int = 2;
281pub const CTL_FS: ::c_int = 3;
282pub const CTL_NET: ::c_int = 4;
283pub const CTL_DEBUG: ::c_int = 5;
284pub const CTL_HW: ::c_int = 6;
285pub const CTL_MACHDEP: ::c_int = 7;
286pub const CTL_DDB: ::c_int = 9;
287pub const CTL_VFS: ::c_int = 10;
288pub const CTL_MAXID: ::c_int = 11;
289pub const KERN_OSTYPE: ::c_int = 1;
290pub const KERN_OSRELEASE: ::c_int = 2;
291pub const KERN_OSREV: ::c_int = 3;
292pub const KERN_VERSION: ::c_int = 4;
293pub const KERN_MAXVNODES: ::c_int = 5;
294pub const KERN_MAXPROC: ::c_int = 6;
295pub const KERN_MAXFILES: ::c_int = 7;
296pub const KERN_ARGMAX: ::c_int = 8;
297pub const KERN_SECURELVL: ::c_int = 9;
298pub const KERN_HOSTNAME: ::c_int = 10;
299pub const KERN_HOSTID: ::c_int = 11;
300pub const KERN_CLOCKRATE: ::c_int = 12;
301pub const KERN_PROF: ::c_int = 16;
302pub const KERN_POSIX1: ::c_int = 17;
303pub const KERN_NGROUPS: ::c_int = 18;
304pub const KERN_JOB_CONTROL: ::c_int = 19;
305pub const KERN_SAVED_IDS: ::c_int = 20;
306pub const KERN_BOOTTIME: ::c_int = 21;
307pub const KERN_DOMAINNAME: ::c_int = 22;
308pub const KERN_MAXPARTITIONS: ::c_int = 23;
309pub const KERN_RAWPARTITION: ::c_int = 24;
310pub const KERN_MAXTHREAD: ::c_int = 25;
311pub const KERN_NTHREADS: ::c_int = 26;
312pub const KERN_OSVERSION: ::c_int = 27;
313pub const KERN_SOMAXCONN: ::c_int = 28;
314pub const KERN_SOMINCONN: ::c_int = 29;
315pub const KERN_USERMOUNT: ::c_int = 30;
316pub const KERN_RND: ::c_int = 31;
317pub const KERN_NOSUIDCOREDUMP: ::c_int = 32;
318pub const KERN_FSYNC: ::c_int = 33;
319pub const KERN_SYSVMSG: ::c_int = 34;
320pub const KERN_SYSVSEM: ::c_int = 35;
321pub const KERN_SYSVSHM: ::c_int = 36;
322pub const KERN_ARND: ::c_int = 37;
323pub const KERN_MSGBUFSIZE: ::c_int = 38;
324pub const KERN_MALLOCSTATS: ::c_int = 39;
325pub const KERN_CPTIME: ::c_int = 40;
326pub const KERN_NCHSTATS: ::c_int = 41;
327pub const KERN_FORKSTAT: ::c_int = 42;
328pub const KERN_NSELCOLL: ::c_int = 43;
329pub const KERN_TTY: ::c_int = 44;
330pub const KERN_CCPU: ::c_int = 45;
331pub const KERN_FSCALE: ::c_int = 46;
332pub const KERN_NPROCS: ::c_int = 47;
333pub const KERN_MSGBUF: ::c_int = 48;
334pub const KERN_POOL: ::c_int = 49;
335pub const KERN_STACKGAPRANDOM: ::c_int = 50;
336pub const KERN_SYSVIPC_INFO: ::c_int = 51;
337pub const KERN_SPLASSERT: ::c_int = 54;
338pub const KERN_PROC_ARGS: ::c_int = 55;
339pub const KERN_NFILES: ::c_int = 56;
340pub const KERN_TTYCOUNT: ::c_int = 57;
341pub const KERN_NUMVNODES: ::c_int = 58;
342pub const KERN_MBSTAT: ::c_int = 59;
343pub const KERN_SEMINFO: ::c_int = 61;
344pub const KERN_SHMINFO: ::c_int = 62;
345pub const KERN_INTRCNT: ::c_int = 63;
346pub const KERN_WATCHDOG: ::c_int = 64;
347pub const KERN_PROC: ::c_int = 66;
348pub const KERN_MAXCLUSTERS: ::c_int = 67;
349pub const KERN_EVCOUNT: ::c_int = 68;
350pub const KERN_TIMECOUNTER: ::c_int = 69;
351pub const KERN_MAXLOCKSPERUID: ::c_int = 70;
352pub const KERN_CPTIME2: ::c_int = 71;
353pub const KERN_CACHEPCT: ::c_int = 72;
354pub const KERN_FILE: ::c_int = 73;
355pub const KERN_CONSDEV: ::c_int = 75;
356pub const KERN_NETLIVELOCKS: ::c_int = 76;
357pub const KERN_POOL_DEBUG: ::c_int = 77;
358pub const KERN_PROC_CWD: ::c_int = 78;
359pub const KERN_PROC_NOBROADCASTKILL: ::c_int = 79;
360pub const KERN_PROC_VMMAP: ::c_int = 80;
361pub const KERN_GLOBAL_PTRACE: ::c_int = 81;
362pub const KERN_CONSBUFSIZE: ::c_int = 82;
363pub const KERN_CONSBUF: ::c_int = 83;
364pub const KERN_MAXID: ::c_int = 84;
365pub const KERN_PROC_ALL: ::c_int = 0;
366pub const KERN_PROC_PID: ::c_int = 1;
367pub const KERN_PROC_PGRP: ::c_int = 2;
368pub const KERN_PROC_SESSION: ::c_int = 3;
369pub const KERN_PROC_TTY: ::c_int = 4;
370pub const KERN_PROC_UID: ::c_int = 5;
371pub const KERN_PROC_RUID: ::c_int = 6;
372pub const KERN_PROC_KTHREAD: ::c_int = 7;
373pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000;
374pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1;
375pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2;
376pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3;
377pub const KERN_PROC_ARGV: ::c_int = 1;
378pub const KERN_PROC_NARGV: ::c_int = 2;
379pub const KERN_PROC_ENV: ::c_int = 3;
380pub const KERN_PROC_NENV: ::c_int = 4;
381pub const KI_NGROUPS: ::c_int = 16;
382pub const KI_MAXCOMLEN: ::c_int = 24;
383pub const KI_WMESGLEN: ::c_int = 8;
384pub const KI_MAXLOGNAME: ::c_int = 32;
385pub const KI_EMULNAMELEN: ::c_int = 8;
386
387extern {
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
6use dox::Option;
7
8pub type pid_t = i32;
9pub type uid_t = u32;
10pub type gid_t = u32;
11pub type in_addr_t = u32;
12pub type in_port_t = u16;
13pub type sighandler_t = ::size_t;
14pub type cc_t = ::c_uchar;
15
16pub enum DIR {}
17pub enum locale_t {}
18
19s! {
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
124pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
125pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
126pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
127
128pub const DT_FIFO: u8 = 1;
129pub const DT_CHR: u8 = 2;
130pub const DT_DIR: u8 = 4;
131pub const DT_BLK: u8 = 6;
132pub const DT_REG: u8 = 8;
133pub const DT_LNK: u8 = 10;
134pub const DT_SOCK: u8 = 12;
135
136pub const FD_CLOEXEC: ::c_int = 0x1;
137
138pub const USRQUOTA: ::c_int = 0;
139pub const GRPQUOTA: ::c_int = 1;
140
141pub const SIGIOT: ::c_int = 6;
142
143pub const S_ISUID: ::c_int = 0x800;
144pub const S_ISGID: ::c_int = 0x400;
145pub const S_ISVTX: ::c_int = 0x200;
146
147pub const POLLIN: ::c_short = 0x1;
148pub const POLLPRI: ::c_short = 0x2;
149pub const POLLOUT: ::c_short = 0x4;
150pub const POLLERR: ::c_short = 0x8;
151pub const POLLHUP: ::c_short = 0x10;
152pub const POLLNVAL: ::c_short = 0x20;
153
154pub const IF_NAMESIZE: ::size_t = 16;
155
156pub const RTLD_LAZY: ::c_int = 0x1;
157
158pub const LOG_EMERG: ::c_int = 0;
159pub const LOG_ALERT: ::c_int = 1;
160pub const LOG_CRIT: ::c_int = 2;
161pub const LOG_ERR: ::c_int = 3;
162pub const LOG_WARNING: ::c_int = 4;
163pub const LOG_NOTICE: ::c_int = 5;
164pub const LOG_INFO: ::c_int = 6;
165pub const LOG_DEBUG: ::c_int = 7;
166
167pub const LOG_KERN: ::c_int = 0;
168pub const LOG_USER: ::c_int = 1 << 3;
169pub const LOG_MAIL: ::c_int = 2 << 3;
170pub const LOG_DAEMON: ::c_int = 3 << 3;
171pub const LOG_AUTH: ::c_int = 4 << 3;
172pub const LOG_SYSLOG: ::c_int = 5 << 3;
173pub const LOG_LPR: ::c_int = 6 << 3;
174pub const LOG_NEWS: ::c_int = 7 << 3;
175pub const LOG_UUCP: ::c_int = 8 << 3;
176pub const LOG_LOCAL0: ::c_int = 16 << 3;
177pub const LOG_LOCAL1: ::c_int = 17 << 3;
178pub const LOG_LOCAL2: ::c_int = 18 << 3;
179pub const LOG_LOCAL3: ::c_int = 19 << 3;
180pub const LOG_LOCAL4: ::c_int = 20 << 3;
181pub const LOG_LOCAL5: ::c_int = 21 << 3;
182pub const LOG_LOCAL6: ::c_int = 22 << 3;
183pub const LOG_LOCAL7: ::c_int = 23 << 3;
184
185pub const LOG_PID: ::c_int = 0x01;
186pub const LOG_CONS: ::c_int = 0x02;
187pub const LOG_ODELAY: ::c_int = 0x04;
188pub const LOG_NDELAY: ::c_int = 0x08;
189pub const LOG_NOWAIT: ::c_int = 0x10;
190
191pub const LOG_PRIMASK: ::c_int = 7;
192pub const LOG_FACMASK: ::c_int = 0x3f8;
193
194pub const PRIO_PROCESS: ::c_int = 0;
195pub const PRIO_PGRP: ::c_int = 1;
196pub const PRIO_USER: ::c_int = 2;
197
198pub const PRIO_MIN: ::c_int = -20;
199pub const PRIO_MAX: ::c_int = 20;
200
201cfg_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
235extern {
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
722extern {
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
830cfg_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 @@
1pub type c_long = i32;
2pub type c_ulong = u32;
3pub type mode_t = u16;
4pub type off64_t = ::c_longlong;
5
6s! {
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
124pub const SYS_gettid: ::c_long = 224;
125pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
126 value: 0,
127};
128pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
129 value: 0,
130};
131pub 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};
141pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2;
142pub const CPU_SETSIZE: ::size_t = 32;
143pub const __CPU_BITS: ::size_t = 32;
144
145pub const UT_LINESIZE: usize = 8;
146pub const UT_NAMESIZE: usize = 8;
147pub const UT_HOSTSIZE: usize = 16;
148
149extern {
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
3pub type c_long = i64;
4pub type c_ulong = u64;
5pub type mode_t = u32;
6pub type off64_t = i64;
7
8s! {
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
134pub const SYS_gettid: ::c_long = 178;
135pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
136 value: 0,
137 __reserved: [0; 36],
138};
139pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
140 value: 0,
141 __reserved: [0; 44],
142};
143pub 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};
151pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 4;
152pub const CPU_SETSIZE: ::size_t = 1024;
153pub const __CPU_BITS: ::size_t = 64;
154
155pub const UT_LINESIZE: usize = 32;
156pub const UT_NAMESIZE: usize = 32;
157pub const UT_HOSTSIZE: usize = 256;
158
159extern {
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
3pub type c_char = u8;
4pub type clock_t = ::c_long;
5pub type time_t = ::c_long;
6pub type suseconds_t = ::c_long;
7pub type wchar_t = u32;
8pub type off_t = ::c_long;
9pub type blkcnt_t = ::c_ulong;
10pub type blksize_t = ::c_ulong;
11pub type nlink_t = u32;
12pub type useconds_t = u32;
13pub type socklen_t = i32;
14pub type pthread_t = ::c_long;
15pub type pthread_mutexattr_t = ::c_long;
16pub type pthread_condattr_t = ::c_long;
17pub type sigset_t = ::c_ulong;
18pub type time64_t = i64; // N/A on android
19pub type fsfilcnt_t = ::c_ulong;
20pub type fsblkcnt_t = ::c_ulong;
21pub type nfds_t = ::c_uint;
22pub type rlim_t = ::c_ulong;
23pub type dev_t = ::c_ulong;
24pub type ino_t = ::c_ulong;
25pub type __CPU_BITTYPE = ::c_ulong;
26
27s! {
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
132pub const USER_PROCESS: ::c_short = 7;
133
134pub const BUFSIZ: ::c_uint = 1024;
135pub const FILENAME_MAX: ::c_uint = 1024;
136pub const FOPEN_MAX: ::c_uint = 20;
137pub const L_tmpnam: ::c_uint = 1024;
138pub const TMP_MAX: ::c_uint = 308915776;
139pub const _PC_LINK_MAX: ::c_int = 1;
140pub const _PC_MAX_CANON: ::c_int = 2;
141pub const _PC_MAX_INPUT: ::c_int = 3;
142pub const _PC_NAME_MAX: ::c_int = 4;
143pub const _PC_PATH_MAX: ::c_int = 5;
144pub const _PC_PIPE_BUF: ::c_int = 6;
145pub const _PC_CHOWN_RESTRICTED: ::c_int = 14;
146pub const _PC_NO_TRUNC: ::c_int = 15;
147pub const _PC_VDISABLE: ::c_int = 16;
148
149pub const FIONBIO: ::c_int = 0x5421;
150
151pub const _SC_ARG_MAX: ::c_int = 0;
152pub const _SC_BC_BASE_MAX: ::c_int = 1;
153pub const _SC_BC_DIM_MAX: ::c_int = 2;
154pub const _SC_BC_SCALE_MAX: ::c_int = 3;
155pub const _SC_BC_STRING_MAX: ::c_int = 4;
156pub const _SC_CHILD_MAX: ::c_int = 5;
157pub const _SC_CLK_TCK: ::c_int = 6;
158pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7;
159pub const _SC_EXPR_NEST_MAX: ::c_int = 8;
160pub const _SC_LINE_MAX: ::c_int = 9;
161pub const _SC_NGROUPS_MAX: ::c_int = 10;
162pub const _SC_OPEN_MAX: ::c_int = 11;
163pub const _SC_2_C_BIND: ::c_int = 13;
164pub const _SC_2_C_DEV: ::c_int = 14;
165pub const _SC_2_C_VERSION: ::c_int = 15;
166pub const _SC_2_CHAR_TERM: ::c_int = 16;
167pub const _SC_2_FORT_DEV: ::c_int = 17;
168pub const _SC_2_FORT_RUN: ::c_int = 18;
169pub const _SC_2_LOCALEDEF: ::c_int = 19;
170pub const _SC_2_SW_DEV: ::c_int = 20;
171pub const _SC_2_UPE: ::c_int = 21;
172pub const _SC_2_VERSION: ::c_int = 22;
173pub const _SC_JOB_CONTROL: ::c_int = 23;
174pub const _SC_SAVED_IDS: ::c_int = 24;
175pub const _SC_VERSION: ::c_int = 25;
176pub const _SC_RE_DUP_MAX: ::c_int = 26;
177pub const _SC_STREAM_MAX: ::c_int = 27;
178pub const _SC_TZNAME_MAX: ::c_int = 28;
179pub const _SC_XOPEN_CRYPT: ::c_int = 29;
180pub const _SC_XOPEN_ENH_I18N: ::c_int = 30;
181pub const _SC_XOPEN_SHM: ::c_int = 31;
182pub const _SC_XOPEN_VERSION: ::c_int = 32;
183pub const _SC_XOPEN_XCU_VERSION: ::c_int = 33;
184pub const _SC_XOPEN_REALTIME: ::c_int = 34;
185pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35;
186pub const _SC_XOPEN_LEGACY: ::c_int = 36;
187pub const _SC_ATEXIT_MAX: ::c_int = 37;
188pub const _SC_IOV_MAX: ::c_int = 38;
189pub const _SC_PAGESIZE: ::c_int = 39;
190pub const _SC_PAGE_SIZE: ::c_int = 40;
191pub const _SC_XOPEN_UNIX: ::c_int = 41;
192pub const _SC_MQ_PRIO_MAX: ::c_int = 51;
193pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71;
194pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72;
195pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
196pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74;
197pub const _SC_THREAD_KEYS_MAX: ::c_int = 75;
198pub const _SC_THREAD_STACK_MIN: ::c_int = 76;
199pub const _SC_THREAD_THREADS_MAX: ::c_int = 77;
200pub const _SC_TTY_NAME_MAX: ::c_int = 78;
201pub const _SC_THREADS: ::c_int = 79;
202pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80;
203pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81;
204pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82;
205pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83;
206pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84;
207pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85;
208pub const _SC_NPROCESSORS_ONLN: ::c_int = 97;
209
210pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
211pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
212pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
213pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
214
215pub const FIOCLEX: ::c_int = 0x5451;
216
217pub const SA_ONSTACK: ::c_ulong = 0x08000000;
218pub const SA_SIGINFO: ::c_ulong = 0x00000004;
219pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002;
220
221pub const SIGCHLD: ::c_int = 17;
222pub const SIGBUS: ::c_int = 7;
223pub const SIGUSR1: ::c_int = 10;
224pub const SIGUSR2: ::c_int = 12;
225pub const SIGCONT: ::c_int = 18;
226pub const SIGSTOP: ::c_int = 19;
227pub const SIGTSTP: ::c_int = 20;
228pub const SIGURG: ::c_int = 23;
229pub const SIGIO: ::c_int = 29;
230pub const SIGSYS: ::c_int = 31;
231pub const SIGSTKFLT: ::c_int = 16;
232pub const SIGUNUSED: ::c_int = 31;
233pub const SIGTTIN: ::c_int = 21;
234pub const SIGTTOU: ::c_int = 22;
235pub const SIGXCPU: ::c_int = 24;
236pub const SIGXFSZ: ::c_int = 25;
237pub const SIGVTALRM: ::c_int = 26;
238pub const SIGPROF: ::c_int = 27;
239pub const SIGWINCH: ::c_int = 28;
240pub const SIGPOLL: ::c_int = 29;
241pub const SIGPWR: ::c_int = 30;
242pub const SIG_SETMASK: ::c_int = 2;
243pub const SIG_BLOCK: ::c_int = 0x000000;
244pub const SIG_UNBLOCK: ::c_int = 0x01;
245
246pub const RUSAGE_CHILDREN: ::c_int = -1;
247
248pub const LC_PAPER: ::c_int = 7;
249pub const LC_NAME: ::c_int = 8;
250pub const LC_ADDRESS: ::c_int = 9;
251pub const LC_TELEPHONE: ::c_int = 10;
252pub const LC_MEASUREMENT: ::c_int = 11;
253pub const LC_IDENTIFICATION: ::c_int = 12;
254pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER);
255pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
256pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
257pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
258pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
259pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
260pub 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
273pub const MAP_ANON: ::c_int = 0x0020;
274pub const MAP_ANONYMOUS: ::c_int = 0x0020;
275pub const MAP_GROWSDOWN: ::c_int = 0x0100;
276pub const MAP_DENYWRITE: ::c_int = 0x0800;
277pub const MAP_EXECUTABLE: ::c_int = 0x01000;
278pub const MAP_LOCKED: ::c_int = 0x02000;
279pub const MAP_NORESERVE: ::c_int = 0x04000;
280pub const MAP_POPULATE: ::c_int = 0x08000;
281pub const MAP_NONBLOCK: ::c_int = 0x010000;
282pub const MAP_STACK: ::c_int = 0x020000;
283
284pub const EDEADLK: ::c_int = 35;
285pub const ENAMETOOLONG: ::c_int = 36;
286pub const ENOLCK: ::c_int = 37;
287pub const ENOSYS: ::c_int = 38;
288pub const ENOTEMPTY: ::c_int = 39;
289pub const ELOOP: ::c_int = 40;
290pub const ENOMSG: ::c_int = 42;
291pub const EIDRM: ::c_int = 43;
292pub const ECHRNG: ::c_int = 44;
293pub const EL2NSYNC: ::c_int = 45;
294pub const EL3HLT: ::c_int = 46;
295pub const EL3RST: ::c_int = 47;
296pub const ELNRNG: ::c_int = 48;
297pub const EUNATCH: ::c_int = 49;
298pub const ENOCSI: ::c_int = 50;
299pub const EL2HLT: ::c_int = 51;
300pub const EBADE: ::c_int = 52;
301pub const EBADR: ::c_int = 53;
302pub const EXFULL: ::c_int = 54;
303pub const ENOANO: ::c_int = 55;
304pub const EBADRQC: ::c_int = 56;
305pub const EBADSLT: ::c_int = 57;
306
307pub const EMULTIHOP: ::c_int = 72;
308pub const EBADMSG: ::c_int = 74;
309pub const EOVERFLOW: ::c_int = 75;
310pub const ENOTUNIQ: ::c_int = 76;
311pub const EBADFD: ::c_int = 77;
312pub const EREMCHG: ::c_int = 78;
313pub const ELIBACC: ::c_int = 79;
314pub const ELIBBAD: ::c_int = 80;
315pub const ELIBSCN: ::c_int = 81;
316pub const ELIBMAX: ::c_int = 82;
317pub const ELIBEXEC: ::c_int = 83;
318pub const EILSEQ: ::c_int = 84;
319pub const ERESTART: ::c_int = 85;
320pub const ESTRPIPE: ::c_int = 86;
321pub const EUSERS: ::c_int = 87;
322pub const ENOTSOCK: ::c_int = 88;
323pub const EDESTADDRREQ: ::c_int = 89;
324pub const EMSGSIZE: ::c_int = 90;
325pub const EPROTOTYPE: ::c_int = 91;
326pub const ENOPROTOOPT: ::c_int = 92;
327pub const EPROTONOSUPPORT: ::c_int = 93;
328pub const ESOCKTNOSUPPORT: ::c_int = 94;
329pub const EOPNOTSUPP: ::c_int = 95;
330pub const EPFNOSUPPORT: ::c_int = 96;
331pub const EAFNOSUPPORT: ::c_int = 97;
332pub const EADDRINUSE: ::c_int = 98;
333pub const EADDRNOTAVAIL: ::c_int = 99;
334pub const ENETDOWN: ::c_int = 100;
335pub const ENETUNREACH: ::c_int = 101;
336pub const ENETRESET: ::c_int = 102;
337pub const ECONNABORTED: ::c_int = 103;
338pub const ECONNRESET: ::c_int = 104;
339pub const ENOBUFS: ::c_int = 105;
340pub const EISCONN: ::c_int = 106;
341pub const ENOTCONN: ::c_int = 107;
342pub const ESHUTDOWN: ::c_int = 108;
343pub const ETOOMANYREFS: ::c_int = 109;
344pub const ETIMEDOUT: ::c_int = 110;
345pub const ECONNREFUSED: ::c_int = 111;
346pub const EHOSTDOWN: ::c_int = 112;
347pub const EHOSTUNREACH: ::c_int = 113;
348pub const EALREADY: ::c_int = 114;
349pub const EINPROGRESS: ::c_int = 115;
350pub const ESTALE: ::c_int = 116;
351pub const EUCLEAN: ::c_int = 117;
352pub const ENOTNAM: ::c_int = 118;
353pub const ENAVAIL: ::c_int = 119;
354pub const EISNAM: ::c_int = 120;
355pub const EREMOTEIO: ::c_int = 121;
356pub const EDQUOT: ::c_int = 122;
357pub const ENOMEDIUM: ::c_int = 123;
358pub const EMEDIUMTYPE: ::c_int = 124;
359pub const ECANCELED: ::c_int = 125;
360pub const ENOKEY: ::c_int = 126;
361pub const EKEYEXPIRED: ::c_int = 127;
362pub const EKEYREVOKED: ::c_int = 128;
363pub const EKEYREJECTED: ::c_int = 129;
364pub const EOWNERDEAD: ::c_int = 130;
365pub const ENOTRECOVERABLE: ::c_int = 131;
366
367pub const SOCK_STREAM: ::c_int = 1;
368pub const SOCK_DGRAM: ::c_int = 2;
369pub const SOCK_SEQPACKET: ::c_int = 5;
370
371pub const SOL_SOCKET: ::c_int = 1;
372
373pub const SO_REUSEADDR: ::c_int = 2;
374pub const SO_TYPE: ::c_int = 3;
375pub const SO_ERROR: ::c_int = 4;
376pub const SO_DONTROUTE: ::c_int = 5;
377pub const SO_BROADCAST: ::c_int = 6;
378pub const SO_SNDBUF: ::c_int = 7;
379pub const SO_RCVBUF: ::c_int = 8;
380pub const SO_KEEPALIVE: ::c_int = 9;
381pub const SO_OOBINLINE: ::c_int = 10;
382pub const SO_LINGER: ::c_int = 13;
383pub const SO_REUSEPORT: ::c_int = 15;
384pub const SO_RCVLOWAT: ::c_int = 18;
385pub const SO_SNDLOWAT: ::c_int = 19;
386pub const SO_RCVTIMEO: ::c_int = 20;
387pub const SO_SNDTIMEO: ::c_int = 21;
388pub const SO_ACCEPTCONN: ::c_int = 30;
389
390pub const O_ACCMODE: ::c_int = 3;
391pub const O_APPEND: ::c_int = 1024;
392pub const O_CREAT: ::c_int = 64;
393pub const O_EXCL: ::c_int = 128;
394pub const O_NOCTTY: ::c_int = 256;
395pub const O_NONBLOCK: ::c_int = 2048;
396pub const O_SYNC: ::c_int = 0x101000;
397pub const O_DIRECT: ::c_int = 0x10000;
398pub const O_DIRECTORY: ::c_int = 0x4000;
399pub const O_NOFOLLOW: ::c_int = 0x8000;
400pub const O_ASYNC: ::c_int = 0x2000;
401pub const O_NDELAY: ::c_int = 0x800;
402
403pub const NI_MAXHOST: ::size_t = 1025;
404
405pub const NCCS: usize = 19;
406pub const TCSBRKP: ::c_int = 0x5425;
407pub const TCSANOW: ::c_int = 0;
408pub const TCSADRAIN: ::c_int = 0x1;
409pub const TCSAFLUSH: ::c_int = 0x2;
410pub const IUTF8: ::tcflag_t = 0x00004000;
411pub const VEOF: usize = 4;
412pub const VEOL: usize = 11;
413pub const VEOL2: usize = 16;
414pub const VMIN: usize = 6;
415pub const IEXTEN: ::tcflag_t = 0x00008000;
416pub const TOSTOP: ::tcflag_t = 0x00000100;
417pub const FLUSHO: ::tcflag_t = 0x00001000;
418
419pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
420pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
421pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
422pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
423pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
424pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
425pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
426pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
427pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
428pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
429pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
430pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
431pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
432pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
433pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
434pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
435pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
436pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
437pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
438pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
439pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
440pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
441pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
442pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
443pub const TMPFS_MAGIC: ::c_long = 0x01021994;
444pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
445
446pub const MADV_HUGEPAGE: ::c_int = 14;
447pub const MADV_NOHUGEPAGE: ::c_int = 15;
448pub const MAP_HUGETLB: ::c_int = 0x040000;
449
450pub const PTRACE_TRACEME: ::c_int = 0;
451pub const PTRACE_PEEKTEXT: ::c_int = 1;
452pub const PTRACE_PEEKDATA: ::c_int = 2;
453pub const PTRACE_PEEKUSER: ::c_int = 3;
454pub const PTRACE_POKETEXT: ::c_int = 4;
455pub const PTRACE_POKEDATA: ::c_int = 5;
456pub const PTRACE_POKEUSER: ::c_int = 6;
457pub const PTRACE_CONT: ::c_int = 7;
458pub const PTRACE_KILL: ::c_int = 8;
459pub const PTRACE_SINGLESTEP: ::c_int = 9;
460pub const PTRACE_ATTACH: ::c_int = 16;
461pub const PTRACE_DETACH: ::c_int = 17;
462pub const PTRACE_SYSCALL: ::c_int = 24;
463pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
464pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
465pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
466pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
467pub const PTRACE_GETFPREGS: ::c_int = 14;
468pub const PTRACE_SETFPREGS: ::c_int = 15;
469pub const PTRACE_GETREGS: ::c_int = 12;
470pub const PTRACE_SETREGS: ::c_int = 13;
471
472pub const EFD_NONBLOCK: ::c_int = 0x800;
473
474pub const F_GETLK: ::c_int = 5;
475pub const F_GETOWN: ::c_int = 9;
476pub const F_SETOWN: ::c_int = 8;
477pub const F_SETLK: ::c_int = 6;
478pub const F_SETLKW: ::c_int = 7;
479
480pub const TCGETS: ::c_int = 0x5401;
481pub const TCSETS: ::c_int = 0x5402;
482pub const TCSETSW: ::c_int = 0x5403;
483pub const TCSETSF: ::c_int = 0x5404;
484pub const TCGETA: ::c_int = 0x5405;
485pub const TCSETA: ::c_int = 0x5406;
486pub const TCSETAW: ::c_int = 0x5407;
487pub const TCSETAF: ::c_int = 0x5408;
488pub const TCSBRK: ::c_int = 0x5409;
489pub const TCXONC: ::c_int = 0x540A;
490pub const TCFLSH: ::c_int = 0x540B;
491pub const TIOCGSOFTCAR: ::c_int = 0x5419;
492pub const TIOCSSOFTCAR: ::c_int = 0x541A;
493pub const TIOCINQ: ::c_int = 0x541B;
494pub const TIOCLINUX: ::c_int = 0x541C;
495pub const TIOCGSERIAL: ::c_int = 0x541E;
496pub const TIOCEXCL: ::c_int = 0x540C;
497pub const TIOCNXCL: ::c_int = 0x540D;
498pub const TIOCSCTTY: ::c_int = 0x540E;
499pub const TIOCGPGRP: ::c_int = 0x540F;
500pub const TIOCSPGRP: ::c_int = 0x5410;
501pub const TIOCOUTQ: ::c_int = 0x5411;
502pub const TIOCSTI: ::c_int = 0x5412;
503pub const TIOCGWINSZ: ::c_int = 0x5413;
504pub const TIOCSWINSZ: ::c_int = 0x5414;
505pub const TIOCMGET: ::c_int = 0x5415;
506pub const TIOCMBIS: ::c_int = 0x5416;
507pub const TIOCMBIC: ::c_int = 0x5417;
508pub const TIOCMSET: ::c_int = 0x5418;
509pub const FIONREAD: ::c_int = 0x541B;
510pub const TIOCCONS: ::c_int = 0x541D;
511
512pub const RTLD_GLOBAL: ::c_int = 0x2;
513pub const RTLD_NOLOAD: ::c_int = 0x4;
514pub const RTLD_NOW: ::c_int = 0;
515pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void;
516
517pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
518
519pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
520pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
521pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
522pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
523pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
524
525pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
526pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
527pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
528pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
529pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
530pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
531pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
532pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
533
534f! {
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
589extern {
590 static mut __progname: *mut ::c_char;
591}
592
593extern {
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
629cfg_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 @@
1pub type c_char = i8;
2pub type c_long = i32;
3pub type c_ulong = u32;
4pub type clock_t = i32;
5pub type time_t = i32;
6pub type suseconds_t = i32;
7pub type wchar_t = i32;
8pub type off_t = i32;
9pub type ino_t = u32;
10pub type blkcnt_t = i32;
11pub type blksize_t = i32;
12pub type nlink_t = u32;
13pub type fsblkcnt_t = ::c_ulong;
14pub type fsfilcnt_t = ::c_ulong;
15pub type rlim_t = c_ulong;
16
17s! {
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
203pub const BUFSIZ: ::c_uint = 8192;
204pub const TMP_MAX: ::c_uint = 238328;
205pub const FOPEN_MAX: ::c_uint = 16;
206pub const POSIX_MADV_DONTNEED: ::c_int = 4;
207pub const _SC_2_C_VERSION: ::c_int = 96;
208pub const RUSAGE_THREAD: ::c_int = 1;
209pub const O_ACCMODE: ::c_int = 3;
210pub const O_DIRECT: ::c_int = 0x8000;
211pub const O_DIRECTORY: ::c_int = 0x10000;
212pub const O_NOFOLLOW: ::c_int = 0x20000;
213pub const RUSAGE_CHILDREN: ::c_int = -1;
214pub const ST_RELATIME: ::c_ulong = 4096;
215pub const NI_MAXHOST: ::socklen_t = 1025;
216
217pub const RLIMIT_NOFILE: ::c_int = 5;
218pub const RLIMIT_AS: ::c_int = 6;
219pub const RLIMIT_RSS: ::c_int = 7;
220pub const RLIMIT_NPROC: ::c_int = 8;
221pub const RLIMIT_MEMLOCK: ::c_int = 9;
222pub const RLIMIT_NLIMITS: ::c_int = 16;
223pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
224
225pub const O_APPEND: ::c_int = 8;
226pub const O_CREAT: ::c_int = 256;
227pub const O_EXCL: ::c_int = 1024;
228pub const O_NOCTTY: ::c_int = 2048;
229pub const O_NONBLOCK: ::c_int = 128;
230pub const O_SYNC: ::c_int = 0x4010;
231pub const O_RSYNC: ::c_int = 0x4010;
232pub const O_DSYNC: ::c_int = 0x10;
233pub const O_FSYNC: ::c_int = 0x4010;
234pub const O_ASYNC: ::c_int = 0x1000;
235pub const O_NDELAY: ::c_int = 0x80;
236
237pub const SOCK_NONBLOCK: ::c_int = 128;
238
239pub const EDEADLK: ::c_int = 45;
240pub const ENAMETOOLONG: ::c_int = 78;
241pub const ENOLCK: ::c_int = 46;
242pub const ENOSYS: ::c_int = 89;
243pub const ENOTEMPTY: ::c_int = 93;
244pub const ELOOP: ::c_int = 90;
245pub const ENOMSG: ::c_int = 35;
246pub const EIDRM: ::c_int = 36;
247pub const ECHRNG: ::c_int = 37;
248pub const EL2NSYNC: ::c_int = 38;
249pub const EL3HLT: ::c_int = 39;
250pub const EL3RST: ::c_int = 40;
251pub const ELNRNG: ::c_int = 41;
252pub const EUNATCH: ::c_int = 42;
253pub const ENOCSI: ::c_int = 43;
254pub const EL2HLT: ::c_int = 44;
255pub const EBADE: ::c_int = 50;
256pub const EBADR: ::c_int = 51;
257pub const EXFULL: ::c_int = 52;
258pub const ENOANO: ::c_int = 53;
259pub const EBADRQC: ::c_int = 54;
260pub const EBADSLT: ::c_int = 55;
261pub const EDEADLOCK: ::c_int = 56;
262pub const EMULTIHOP: ::c_int = 74;
263pub const EOVERFLOW: ::c_int = 79;
264pub const ENOTUNIQ: ::c_int = 80;
265pub const EBADFD: ::c_int = 81;
266pub const EBADMSG: ::c_int = 77;
267pub const EREMCHG: ::c_int = 82;
268pub const ELIBACC: ::c_int = 83;
269pub const ELIBBAD: ::c_int = 84;
270pub const ELIBSCN: ::c_int = 85;
271pub const ELIBMAX: ::c_int = 86;
272pub const ELIBEXEC: ::c_int = 87;
273pub const EILSEQ: ::c_int = 88;
274pub const ERESTART: ::c_int = 91;
275pub const ESTRPIPE: ::c_int = 92;
276pub const EUSERS: ::c_int = 94;
277pub const ENOTSOCK: ::c_int = 95;
278pub const EDESTADDRREQ: ::c_int = 96;
279pub const EMSGSIZE: ::c_int = 97;
280pub const EPROTOTYPE: ::c_int = 98;
281pub const ENOPROTOOPT: ::c_int = 99;
282pub const EPROTONOSUPPORT: ::c_int = 120;
283pub const ESOCKTNOSUPPORT: ::c_int = 121;
284pub const EOPNOTSUPP: ::c_int = 122;
285pub const EPFNOSUPPORT: ::c_int = 123;
286pub const EAFNOSUPPORT: ::c_int = 124;
287pub const EADDRINUSE: ::c_int = 125;
288pub const EADDRNOTAVAIL: ::c_int = 126;
289pub const ENETDOWN: ::c_int = 127;
290pub const ENETUNREACH: ::c_int = 128;
291pub const ENETRESET: ::c_int = 129;
292pub const ECONNABORTED: ::c_int = 130;
293pub const ECONNRESET: ::c_int = 131;
294pub const ENOBUFS: ::c_int = 132;
295pub const EISCONN: ::c_int = 133;
296pub const ENOTCONN: ::c_int = 134;
297pub const ESHUTDOWN: ::c_int = 143;
298pub const ETOOMANYREFS: ::c_int = 144;
299pub const ETIMEDOUT: ::c_int = 145;
300pub const ECONNREFUSED: ::c_int = 146;
301pub const EHOSTDOWN: ::c_int = 147;
302pub const EHOSTUNREACH: ::c_int = 148;
303pub const EALREADY: ::c_int = 149;
304pub const EINPROGRESS: ::c_int = 150;
305pub const ESTALE: ::c_int = 151;
306pub const EUCLEAN: ::c_int = 135;
307pub const ENOTNAM: ::c_int = 137;
308pub const ENAVAIL: ::c_int = 138;
309pub const EISNAM: ::c_int = 139;
310pub const EREMOTEIO: ::c_int = 140;
311pub const EDQUOT: ::c_int = 1133;
312pub const ENOMEDIUM: ::c_int = 159;
313pub const EMEDIUMTYPE: ::c_int = 160;
314pub const ECANCELED: ::c_int = 158;
315pub const ENOKEY: ::c_int = 161;
316pub const EKEYEXPIRED: ::c_int = 162;
317pub const EKEYREVOKED: ::c_int = 163;
318pub const EKEYREJECTED: ::c_int = 164;
319pub const EOWNERDEAD: ::c_int = 165;
320pub const ENOTRECOVERABLE: ::c_int = 166;
321pub const ERFKILL: ::c_int = 167;
322
323pub const LC_PAPER: ::c_int = 7;
324pub const LC_NAME: ::c_int = 8;
325pub const LC_ADDRESS: ::c_int = 9;
326pub const LC_TELEPHONE: ::c_int = 10;
327pub const LC_MEASUREMENT: ::c_int = 11;
328pub const LC_IDENTIFICATION: ::c_int = 12;
329pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER);
330pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
331pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
332pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
333pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
334pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
335pub 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
348pub const MAP_NORESERVE: ::c_int = 0x400;
349pub const MAP_ANON: ::c_int = 0x800;
350pub const MAP_ANONYMOUS: ::c_int = 0x800;
351pub const MAP_GROWSDOWN: ::c_int = 0x1000;
352pub const MAP_DENYWRITE: ::c_int = 0x2000;
353pub const MAP_EXECUTABLE: ::c_int = 0x4000;
354pub const MAP_LOCKED: ::c_int = 0x8000;
355pub const MAP_POPULATE: ::c_int = 0x10000;
356pub const MAP_NONBLOCK: ::c_int = 0x20000;
357pub const MAP_STACK: ::c_int = 0x40000;
358
359pub const SOCK_STREAM: ::c_int = 2;
360pub const SOCK_DGRAM: ::c_int = 1;
361pub const SOCK_SEQPACKET: ::c_int = 5;
362
363pub const SOL_SOCKET: ::c_int = 0xffff;
364
365pub const SO_REUSEADDR: ::c_int = 4;
366pub const SO_TYPE: ::c_int = 4104;
367pub const SO_ERROR: ::c_int = 4103;
368pub const SO_DONTROUTE: ::c_int = 16;
369pub const SO_BROADCAST: ::c_int = 32;
370pub const SO_SNDBUF: ::c_int = 4097;
371pub const SO_RCVBUF: ::c_int = 4098;
372pub const SO_KEEPALIVE: ::c_int = 8;
373pub const SO_OOBINLINE: ::c_int = 256;
374pub const SO_LINGER: ::c_int = 128;
375pub const SO_RCVLOWAT: ::c_int = 4100;
376pub const SO_SNDLOWAT: ::c_int = 4099;
377pub const SO_RCVTIMEO: ::c_int = 4102;
378pub const SO_SNDTIMEO: ::c_int = 4101;
379pub const SO_ACCEPTCONN: ::c_int = 4105;
380
381pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
382pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
383pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
384pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
385
386pub const FIOCLEX: ::c_ulong = 0x6601;
387pub const FIONBIO: ::c_ulong = 0x667e;
388
389pub const SA_ONSTACK: ::c_int = 0x08000000;
390pub const SA_SIGINFO: ::c_int = 0x00000008;
391pub const SA_NOCLDWAIT: ::c_int = 0x00010000;
392
393pub const SIGCHLD: ::c_int = 18;
394pub const SIGBUS: ::c_int = 10;
395pub const SIGTTIN: ::c_int = 26;
396pub const SIGTTOU: ::c_int = 27;
397pub const SIGXCPU: ::c_int = 30;
398pub const SIGXFSZ: ::c_int = 31;
399pub const SIGVTALRM: ::c_int = 28;
400pub const SIGPROF: ::c_int = 29;
401pub const SIGWINCH: ::c_int = 20;
402pub const SIGUSR1: ::c_int = 16;
403pub const SIGUSR2: ::c_int = 17;
404pub const SIGCONT: ::c_int = 25;
405pub const SIGSTOP: ::c_int = 23;
406pub const SIGTSTP: ::c_int = 24;
407pub const SIGURG: ::c_int = 21;
408pub const SIGIO: ::c_int = 22;
409pub const SIGSYS: ::c_int = 12;
410pub const SIGPOLL: ::c_int = 22;
411pub const SIGPWR: ::c_int = 19;
412pub const SIG_SETMASK: ::c_int = 3;
413pub const SIG_BLOCK: ::c_int = 0x1;
414pub const SIG_UNBLOCK: ::c_int = 0x2;
415
416pub const POLLRDNORM: ::c_short = 0x040;
417pub const POLLWRNORM: ::c_short = 0x004;
418pub const POLLRDBAND: ::c_short = 0x080;
419pub const POLLWRBAND: ::c_short = 0x100;
420
421pub const PTHREAD_STACK_MIN: ::size_t = 131072;
422
423pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
424pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
425pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
426pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
427pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
428pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
429pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
430pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
431pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
432pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
433pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
434pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
435pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
436pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
437pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
438pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
439pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
440pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
441pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
442pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
443pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
444pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
445pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
446pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
447pub const TMPFS_MAGIC: ::c_long = 0x01021994;
448pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
449
450pub const VEOF: usize = 16;
451pub const VEOL: usize = 17;
452pub const VEOL2: usize = 6;
453pub const VMIN: usize = 4;
454pub const IEXTEN: ::tcflag_t = 0x00000100;
455pub const TOSTOP: ::tcflag_t = 0x00008000;
456pub const FLUSHO: ::tcflag_t = 0x00002000;
457pub const IUTF8: ::tcflag_t = 0x00004000;
458pub const TCSANOW: ::c_int = 0x540e;
459pub const TCSADRAIN: ::c_int = 0x540f;
460pub const TCSAFLUSH: ::c_int = 0x5410;
461
462pub const CPU_SETSIZE: ::c_int = 0x400;
463
464pub const PTRACE_TRACEME: ::c_uint = 0;
465pub const PTRACE_PEEKTEXT: ::c_uint = 1;
466pub const PTRACE_PEEKDATA: ::c_uint = 2;
467pub const PTRACE_PEEKUSER: ::c_uint = 3;
468pub const PTRACE_POKETEXT: ::c_uint = 4;
469pub const PTRACE_POKEDATA: ::c_uint = 5;
470pub const PTRACE_POKEUSER: ::c_uint = 6;
471pub const PTRACE_CONT: ::c_uint = 7;
472pub const PTRACE_KILL: ::c_uint = 8;
473pub const PTRACE_SINGLESTEP: ::c_uint = 9;
474pub const PTRACE_ATTACH: ::c_uint = 16;
475pub const PTRACE_DETACH: ::c_uint = 17;
476pub const PTRACE_SYSCALL: ::c_uint = 24;
477pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
478pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
479pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
480pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
481pub const PTRACE_GETFPREGS: ::c_uint = 14;
482pub const PTRACE_SETFPREGS: ::c_uint = 15;
483pub const PTRACE_GETFPXREGS: ::c_uint = 18;
484pub const PTRACE_SETFPXREGS: ::c_uint = 19;
485pub const PTRACE_GETREGS: ::c_uint = 12;
486pub const PTRACE_SETREGS: ::c_uint = 13;
487
488pub const MAP_HUGETLB: ::c_int = 0x080000;
489
490pub const EFD_NONBLOCK: ::c_int = 0x80;
491
492pub const F_GETLK: ::c_int = 14;
493pub const F_GETOWN: ::c_int = 23;
494pub const F_SETOWN: ::c_int = 24;
495pub const F_SETLK: ::c_int = 6;
496pub const F_SETLKW: ::c_int = 7;
497
498pub const SFD_NONBLOCK: ::c_int = 0x80;
499
500pub const TCGETS: ::c_ulong = 0x540d;
501pub const TCSETS: ::c_ulong = 0x540e;
502pub const TCSETSW: ::c_ulong = 0x540f;
503pub const TCSETSF: ::c_ulong = 0x5410;
504pub const TCGETA: ::c_ulong = 0x5401;
505pub const TCSETA: ::c_ulong = 0x5402;
506pub const TCSETAW: ::c_ulong = 0x5403;
507pub const TCSETAF: ::c_ulong = 0x5404;
508pub const TCSBRK: ::c_ulong = 0x5405;
509pub const TCXONC: ::c_ulong = 0x5406;
510pub const TCFLSH: ::c_ulong = 0x5407;
511pub const TIOCGSOFTCAR: ::c_ulong = 0x5481;
512pub const TIOCSSOFTCAR: ::c_ulong = 0x5482;
513pub const TIOCINQ: ::c_ulong = 0x467f;
514pub const TIOCLINUX: ::c_ulong = 0x5483;
515pub const TIOCGSERIAL: ::c_ulong = 0x5484;
516pub const TIOCEXCL: ::c_ulong = 0x740d;
517pub const TIOCNXCL: ::c_ulong = 0x740e;
518pub const TIOCSCTTY: ::c_ulong = 0x5480;
519pub const TIOCGPGRP: ::c_ulong = 0x40047477;
520pub const TIOCSPGRP: ::c_ulong = 0x80047476;
521pub const TIOCOUTQ: ::c_ulong = 0x7472;
522pub const TIOCSTI: ::c_ulong = 0x5472;
523pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
524pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
525pub const TIOCMGET: ::c_ulong = 0x741d;
526pub const TIOCMBIS: ::c_ulong = 0x741b;
527pub const TIOCMBIC: ::c_ulong = 0x741c;
528pub const TIOCMSET: ::c_ulong = 0x741a;
529pub const FIONREAD: ::c_ulong = 0x467f;
530pub const TIOCCONS: ::c_ulong = 0x80047478;
531
532pub const RTLD_DEEPBIND: ::c_int = 0x10;
533pub const RTLD_GLOBAL: ::c_int = 0x4;
534pub const RTLD_NOLOAD: ::c_int = 0x8;
535
536pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
537pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
538pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
539pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
540pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
541
542pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
543pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
544pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
545pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
546pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
547pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
548pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
549pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
550
551pub const SYS_gettid: ::c_long = 4222; // Valid for O32
552
553#[link(name = "util")]
554extern {
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
3use dox::mem;
4
5pub type useconds_t = u32;
6pub type dev_t = u64;
7pub type socklen_t = u32;
8pub type pthread_t = c_ulong;
9pub type mode_t = u32;
10pub type ino64_t = u64;
11pub type off64_t = i64;
12pub type blkcnt64_t = i64;
13pub type rlim64_t = u64;
14pub type key_t = ::c_int;
15pub type shmatt_t = ::c_ulong;
16pub type mqd_t = ::c_int;
17pub type nfds_t = ::c_ulong;
18pub type nl_item = ::c_int;
19
20pub enum fpos64_t {} // TODO: fill this out with a struct
21
22s! {
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
193pub const ABDAY_1: ::nl_item = 0x20000;
194pub const ABDAY_2: ::nl_item = 0x20001;
195pub const ABDAY_3: ::nl_item = 0x20002;
196pub const ABDAY_4: ::nl_item = 0x20003;
197pub const ABDAY_5: ::nl_item = 0x20004;
198pub const ABDAY_6: ::nl_item = 0x20005;
199pub const ABDAY_7: ::nl_item = 0x20006;
200
201pub const DAY_1: ::nl_item = 0x20007;
202pub const DAY_2: ::nl_item = 0x20008;
203pub const DAY_3: ::nl_item = 0x20009;
204pub const DAY_4: ::nl_item = 0x2000A;
205pub const DAY_5: ::nl_item = 0x2000B;
206pub const DAY_6: ::nl_item = 0x2000C;
207pub const DAY_7: ::nl_item = 0x2000D;
208
209pub const ABMON_1: ::nl_item = 0x2000E;
210pub const ABMON_2: ::nl_item = 0x2000F;
211pub const ABMON_3: ::nl_item = 0x20010;
212pub const ABMON_4: ::nl_item = 0x20011;
213pub const ABMON_5: ::nl_item = 0x20012;
214pub const ABMON_6: ::nl_item = 0x20013;
215pub const ABMON_7: ::nl_item = 0x20014;
216pub const ABMON_8: ::nl_item = 0x20015;
217pub const ABMON_9: ::nl_item = 0x20016;
218pub const ABMON_10: ::nl_item = 0x20017;
219pub const ABMON_11: ::nl_item = 0x20018;
220pub const ABMON_12: ::nl_item = 0x20019;
221
222pub const MON_1: ::nl_item = 0x2001A;
223pub const MON_2: ::nl_item = 0x2001B;
224pub const MON_3: ::nl_item = 0x2001C;
225pub const MON_4: ::nl_item = 0x2001D;
226pub const MON_5: ::nl_item = 0x2001E;
227pub const MON_6: ::nl_item = 0x2001F;
228pub const MON_7: ::nl_item = 0x20020;
229pub const MON_8: ::nl_item = 0x20021;
230pub const MON_9: ::nl_item = 0x20022;
231pub const MON_10: ::nl_item = 0x20023;
232pub const MON_11: ::nl_item = 0x20024;
233pub const MON_12: ::nl_item = 0x20025;
234
235pub const AM_STR: ::nl_item = 0x20026;
236pub const PM_STR: ::nl_item = 0x20027;
237
238pub const D_T_FMT: ::nl_item = 0x20028;
239pub const D_FMT: ::nl_item = 0x20029;
240pub const T_FMT: ::nl_item = 0x2002A;
241pub const T_FMT_AMPM: ::nl_item = 0x2002B;
242
243pub const ERA: ::nl_item = 0x2002C;
244pub const ERA_D_FMT: ::nl_item = 0x2002E;
245pub const ALT_DIGITS: ::nl_item = 0x2002F;
246pub const ERA_D_T_FMT: ::nl_item = 0x20030;
247pub const ERA_T_FMT: ::nl_item = 0x20031;
248
249pub const CODESET: ::nl_item = 14;
250
251pub const CRNCYSTR: ::nl_item = 0x4000F;
252
253pub const RADIXCHAR: ::nl_item = 0x10000;
254pub const THOUSEP: ::nl_item = 0x10001;
255
256pub const YESEXPR: ::nl_item = 0x50000;
257pub const NOEXPR: ::nl_item = 0x50001;
258pub const YESSTR: ::nl_item = 0x50002;
259pub const NOSTR: ::nl_item = 0x50003;
260
261pub const FILENAME_MAX: ::c_uint = 4096;
262pub const L_tmpnam: ::c_uint = 20;
263pub const _PC_LINK_MAX: ::c_int = 0;
264pub const _PC_MAX_CANON: ::c_int = 1;
265pub const _PC_MAX_INPUT: ::c_int = 2;
266pub const _PC_NAME_MAX: ::c_int = 3;
267pub const _PC_PATH_MAX: ::c_int = 4;
268pub const _PC_PIPE_BUF: ::c_int = 5;
269pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
270pub const _PC_NO_TRUNC: ::c_int = 7;
271pub const _PC_VDISABLE: ::c_int = 8;
272
273pub const _SC_ARG_MAX: ::c_int = 0;
274pub const _SC_CHILD_MAX: ::c_int = 1;
275pub const _SC_CLK_TCK: ::c_int = 2;
276pub const _SC_NGROUPS_MAX: ::c_int = 3;
277pub const _SC_OPEN_MAX: ::c_int = 4;
278pub const _SC_STREAM_MAX: ::c_int = 5;
279pub const _SC_TZNAME_MAX: ::c_int = 6;
280pub const _SC_JOB_CONTROL: ::c_int = 7;
281pub const _SC_SAVED_IDS: ::c_int = 8;
282pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
283pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
284pub const _SC_TIMERS: ::c_int = 11;
285pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
286pub const _SC_PRIORITIZED_IO: ::c_int = 13;
287pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
288pub const _SC_FSYNC: ::c_int = 15;
289pub const _SC_MAPPED_FILES: ::c_int = 16;
290pub const _SC_MEMLOCK: ::c_int = 17;
291pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
292pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
293pub const _SC_MESSAGE_PASSING: ::c_int = 20;
294pub const _SC_SEMAPHORES: ::c_int = 21;
295pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
296pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
297pub const _SC_AIO_MAX: ::c_int = 24;
298pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
299pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
300pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
301pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
302pub const _SC_VERSION: ::c_int = 29;
303pub const _SC_PAGESIZE: ::c_int = 30;
304pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
305pub const _SC_RTSIG_MAX: ::c_int = 31;
306pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
307pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
308pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
309pub const _SC_TIMER_MAX: ::c_int = 35;
310pub const _SC_BC_BASE_MAX: ::c_int = 36;
311pub const _SC_BC_DIM_MAX: ::c_int = 37;
312pub const _SC_BC_SCALE_MAX: ::c_int = 38;
313pub const _SC_BC_STRING_MAX: ::c_int = 39;
314pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
315pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
316pub const _SC_LINE_MAX: ::c_int = 43;
317pub const _SC_RE_DUP_MAX: ::c_int = 44;
318pub const _SC_2_VERSION: ::c_int = 46;
319pub const _SC_2_C_BIND: ::c_int = 47;
320pub const _SC_2_C_DEV: ::c_int = 48;
321pub const _SC_2_FORT_DEV: ::c_int = 49;
322pub const _SC_2_FORT_RUN: ::c_int = 50;
323pub const _SC_2_SW_DEV: ::c_int = 51;
324pub const _SC_2_LOCALEDEF: ::c_int = 52;
325pub const _SC_IOV_MAX: ::c_int = 60;
326pub const _SC_THREADS: ::c_int = 67;
327pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
328pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
329pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
330pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
331pub const _SC_TTY_NAME_MAX: ::c_int = 72;
332pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
333pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
334pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
335pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
336pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
337pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
338pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
339pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
340pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
341pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
342pub const _SC_ATEXIT_MAX: ::c_int = 87;
343pub const _SC_XOPEN_VERSION: ::c_int = 89;
344pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
345pub const _SC_XOPEN_UNIX: ::c_int = 91;
346pub const _SC_XOPEN_CRYPT: ::c_int = 92;
347pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
348pub const _SC_XOPEN_SHM: ::c_int = 94;
349pub const _SC_2_CHAR_TERM: ::c_int = 95;
350pub const _SC_2_UPE: ::c_int = 97;
351pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
352pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
353pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
354pub const _SC_XOPEN_LEGACY: ::c_int = 129;
355pub const _SC_XOPEN_REALTIME: ::c_int = 130;
356pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
357pub const _SC_HOST_NAME_MAX: ::c_int = 180;
358
359pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
360pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
361
362pub const GLOB_ERR: ::c_int = 1 << 0;
363pub const GLOB_MARK: ::c_int = 1 << 1;
364pub const GLOB_NOSORT: ::c_int = 1 << 2;
365pub const GLOB_DOOFFS: ::c_int = 1 << 3;
366pub const GLOB_NOCHECK: ::c_int = 1 << 4;
367pub const GLOB_APPEND: ::c_int = 1 << 5;
368pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
369
370pub const GLOB_NOSPACE: ::c_int = 1;
371pub const GLOB_ABORTED: ::c_int = 2;
372pub const GLOB_NOMATCH: ::c_int = 3;
373
374pub const POSIX_MADV_NORMAL: ::c_int = 0;
375pub const POSIX_MADV_RANDOM: ::c_int = 1;
376pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
377pub const POSIX_MADV_WILLNEED: ::c_int = 3;
378
379pub const S_IEXEC: mode_t = 64;
380pub const S_IWRITE: mode_t = 128;
381pub const S_IREAD: mode_t = 256;
382
383pub const F_LOCK: ::c_int = 1;
384pub const F_TEST: ::c_int = 3;
385pub const F_TLOCK: ::c_int = 2;
386pub const F_ULOCK: ::c_int = 0;
387
388pub const ST_RDONLY: ::c_ulong = 1;
389pub const ST_NOSUID: ::c_ulong = 2;
390pub const ST_NODEV: ::c_ulong = 4;
391pub const ST_NOEXEC: ::c_ulong = 8;
392pub const ST_SYNCHRONOUS: ::c_ulong = 16;
393pub const ST_MANDLOCK: ::c_ulong = 64;
394pub const ST_WRITE: ::c_ulong = 128;
395pub const ST_APPEND: ::c_ulong = 256;
396pub const ST_IMMUTABLE: ::c_ulong = 512;
397pub const ST_NOATIME: ::c_ulong = 1024;
398pub const ST_NODIRATIME: ::c_ulong = 2048;
399
400pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
401pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
402pub const RTLD_NODELETE: ::c_int = 0x1000;
403pub const RTLD_NOW: ::c_int = 0x2;
404
405pub const TCP_MD5SIG: ::c_int = 14;
406
407pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
408 __align: [],
409 size: [0; __SIZEOF_PTHREAD_MUTEX_T],
410};
411pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
412 __align: [],
413 size: [0; __SIZEOF_PTHREAD_COND_T],
414};
415pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
416 __align: [],
417 size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
418};
419pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
420pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
421pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
422pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
423pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
424
425pub const SCHED_OTHER: ::c_int = 0;
426pub const SCHED_FIFO: ::c_int = 1;
427pub const SCHED_RR: ::c_int = 2;
428pub const SCHED_BATCH: ::c_int = 3;
429pub const SCHED_IDLE: ::c_int = 5;
430
431pub const IPC_CREAT: ::c_int = 0o1000;
432pub const IPC_EXCL: ::c_int = 0o2000;
433pub const IPC_NOWAIT: ::c_int = 0o4000;
434
435pub const IPC_RMID: ::c_int = 0;
436pub const IPC_SET: ::c_int = 1;
437pub const IPC_STAT: ::c_int = 2;
438pub const IPC_INFO: ::c_int = 3;
439
440pub const SHM_R: ::c_int = 0o400;
441pub const SHM_W: ::c_int = 0o200;
442
443pub const SHM_RDONLY: ::c_int = 0o10000;
444pub const SHM_RND: ::c_int = 0o20000;
445pub const SHM_REMAP: ::c_int = 0o40000;
446pub const SHM_EXEC: ::c_int = 0o100000;
447
448pub const SHM_LOCK: ::c_int = 11;
449pub const SHM_UNLOCK: ::c_int = 12;
450
451pub const SHM_HUGETLB: ::c_int = 0o4000;
452pub const SHM_NORESERVE: ::c_int = 0o10000;
453
454pub const EPOLLRDHUP: ::c_int = 0x2000;
455pub const EPOLLONESHOT: ::c_int = 0x40000000;
456
457pub const QFMT_VFS_OLD: ::c_int = 1;
458pub const QFMT_VFS_V0: ::c_int = 2;
459
460pub const SFD_CLOEXEC: ::c_int = 0x080000;
461
462pub const EFD_SEMAPHORE: ::c_int = 0x1;
463
464pub const NCCS: usize = 32;
465
466pub const AF_NETLINK: ::c_int = 16;
467
468pub const LOG_NFACILITIES: ::c_int = 24;
469
470pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
471
472pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
473pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
474pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
475pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
476pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
477pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
478pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
479
480f! {
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
505extern {
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
662cfg_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 @@
1pub type c_char = u8;
2pub type wchar_t = u32;
3
4s! {
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
87pub const O_DIRECT: ::c_int = 0x4000;
88pub const O_DIRECTORY: ::c_int = 0x10000;
89pub const O_NOFOLLOW: ::c_int = 0x20000;
90pub const O_ASYNC: ::c_int = 0x2000;
91
92pub const FIOCLEX: ::c_int = 0x5451;
93pub const FIONBIO: ::c_int = 0x5421;
94
95pub const RLIMIT_RSS: ::c_int = 5;
96pub const RLIMIT_NOFILE: ::c_int = 7;
97pub const RLIMIT_AS: ::c_int = 9;
98pub const RLIMIT_NPROC: ::c_int = 6;
99pub const RLIMIT_MEMLOCK: ::c_int = 8;
100
101pub const O_APPEND: ::c_int = 1024;
102pub const O_CREAT: ::c_int = 64;
103pub const O_EXCL: ::c_int = 128;
104pub const O_NOCTTY: ::c_int = 256;
105pub const O_NONBLOCK: ::c_int = 2048;
106pub const O_SYNC: ::c_int = 1052672;
107pub const O_RSYNC: ::c_int = 1052672;
108pub const O_DSYNC: ::c_int = 4096;
109
110pub const SOCK_NONBLOCK: ::c_int = 2048;
111
112pub const MAP_ANON: ::c_int = 0x0020;
113pub const MAP_GROWSDOWN: ::c_int = 0x0100;
114pub const MAP_DENYWRITE: ::c_int = 0x0800;
115pub const MAP_EXECUTABLE: ::c_int = 0x01000;
116pub const MAP_LOCKED: ::c_int = 0x02000;
117pub const MAP_NORESERVE: ::c_int = 0x04000;
118pub const MAP_POPULATE: ::c_int = 0x08000;
119pub const MAP_NONBLOCK: ::c_int = 0x010000;
120pub const MAP_STACK: ::c_int = 0x020000;
121
122pub const SOCK_STREAM: ::c_int = 1;
123pub const SOCK_DGRAM: ::c_int = 2;
124pub const SOCK_SEQPACKET: ::c_int = 5;
125
126pub const SOL_SOCKET: ::c_int = 1;
127
128pub const EDEADLK: ::c_int = 35;
129pub const ENAMETOOLONG: ::c_int = 36;
130pub const ENOLCK: ::c_int = 37;
131pub const ENOSYS: ::c_int = 38;
132pub const ENOTEMPTY: ::c_int = 39;
133pub const ELOOP: ::c_int = 40;
134pub const ENOMSG: ::c_int = 42;
135pub const EIDRM: ::c_int = 43;
136pub const ECHRNG: ::c_int = 44;
137pub const EL2NSYNC: ::c_int = 45;
138pub const EL3HLT: ::c_int = 46;
139pub const EL3RST: ::c_int = 47;
140pub const ELNRNG: ::c_int = 48;
141pub const EUNATCH: ::c_int = 49;
142pub const ENOCSI: ::c_int = 50;
143pub const EL2HLT: ::c_int = 51;
144pub const EBADE: ::c_int = 52;
145pub const EBADR: ::c_int = 53;
146pub const EXFULL: ::c_int = 54;
147pub const ENOANO: ::c_int = 55;
148pub const EBADRQC: ::c_int = 56;
149pub const EBADSLT: ::c_int = 57;
150pub const EDEADLOCK: ::c_int = EDEADLK;
151pub const EMULTIHOP: ::c_int = 72;
152pub const EBADMSG: ::c_int = 74;
153pub const EOVERFLOW: ::c_int = 75;
154pub const ENOTUNIQ: ::c_int = 76;
155pub const EBADFD: ::c_int = 77;
156pub const EREMCHG: ::c_int = 78;
157pub const ELIBACC: ::c_int = 79;
158pub const ELIBBAD: ::c_int = 80;
159pub const ELIBSCN: ::c_int = 81;
160pub const ELIBMAX: ::c_int = 82;
161pub const ELIBEXEC: ::c_int = 83;
162pub const EILSEQ: ::c_int = 84;
163pub const ERESTART: ::c_int = 85;
164pub const ESTRPIPE: ::c_int = 86;
165pub const EUSERS: ::c_int = 87;
166pub const ENOTSOCK: ::c_int = 88;
167pub const EDESTADDRREQ: ::c_int = 89;
168pub const EMSGSIZE: ::c_int = 90;
169pub const EPROTOTYPE: ::c_int = 91;
170pub const ENOPROTOOPT: ::c_int = 92;
171pub const EPROTONOSUPPORT: ::c_int = 93;
172pub const ESOCKTNOSUPPORT: ::c_int = 94;
173pub const EOPNOTSUPP: ::c_int = 95;
174pub const EPFNOSUPPORT: ::c_int = 96;
175pub const EAFNOSUPPORT: ::c_int = 97;
176pub const EADDRINUSE: ::c_int = 98;
177pub const EADDRNOTAVAIL: ::c_int = 99;
178pub const ENETDOWN: ::c_int = 100;
179pub const ENETUNREACH: ::c_int = 101;
180pub const ENETRESET: ::c_int = 102;
181pub const ECONNABORTED: ::c_int = 103;
182pub const ECONNRESET: ::c_int = 104;
183pub const ENOBUFS: ::c_int = 105;
184pub const EISCONN: ::c_int = 106;
185pub const ENOTCONN: ::c_int = 107;
186pub const ESHUTDOWN: ::c_int = 108;
187pub const ETOOMANYREFS: ::c_int = 109;
188pub const ETIMEDOUT: ::c_int = 110;
189pub const ECONNREFUSED: ::c_int = 111;
190pub const EHOSTDOWN: ::c_int = 112;
191pub const EHOSTUNREACH: ::c_int = 113;
192pub const EALREADY: ::c_int = 114;
193pub const EINPROGRESS: ::c_int = 115;
194pub const ESTALE: ::c_int = 116;
195pub const EUCLEAN: ::c_int = 117;
196pub const ENOTNAM: ::c_int = 118;
197pub const ENAVAIL: ::c_int = 119;
198pub const EISNAM: ::c_int = 120;
199pub const EREMOTEIO: ::c_int = 121;
200pub const EDQUOT: ::c_int = 122;
201pub const ENOMEDIUM: ::c_int = 123;
202pub const EMEDIUMTYPE: ::c_int = 124;
203pub const ECANCELED: ::c_int = 125;
204pub const ENOKEY: ::c_int = 126;
205pub const EKEYEXPIRED: ::c_int = 127;
206pub const EKEYREVOKED: ::c_int = 128;
207pub const EKEYREJECTED: ::c_int = 129;
208pub const EOWNERDEAD: ::c_int = 130;
209pub const ENOTRECOVERABLE: ::c_int = 131;
210pub const ERFKILL: ::c_int = 132;
211pub const EHWPOISON: ::c_int = 133;
212
213pub const SO_REUSEADDR: ::c_int = 2;
214pub const SO_TYPE: ::c_int = 3;
215pub const SO_ERROR: ::c_int = 4;
216pub const SO_DONTROUTE: ::c_int = 5;
217pub const SO_BROADCAST: ::c_int = 6;
218pub const SO_SNDBUF: ::c_int = 7;
219pub const SO_RCVBUF: ::c_int = 8;
220pub const SO_KEEPALIVE: ::c_int = 9;
221pub const SO_OOBINLINE: ::c_int = 10;
222pub const SO_LINGER: ::c_int = 13;
223pub const SO_REUSEPORT: ::c_int = 15;
224pub const SO_RCVLOWAT: ::c_int = 18;
225pub const SO_SNDLOWAT: ::c_int = 19;
226pub const SO_RCVTIMEO: ::c_int = 20;
227pub const SO_SNDTIMEO: ::c_int = 21;
228pub const SO_ACCEPTCONN: ::c_int = 30;
229
230pub const SA_ONSTACK: ::c_int = 0x08000000;
231pub const SA_SIGINFO: ::c_int = 0x00000004;
232pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
233
234pub const SIGCHLD: ::c_int = 17;
235pub const SIGBUS: ::c_int = 7;
236pub const SIGTTIN: ::c_int = 21;
237pub const SIGTTOU: ::c_int = 22;
238pub const SIGXCPU: ::c_int = 24;
239pub const SIGXFSZ: ::c_int = 25;
240pub const SIGVTALRM: ::c_int = 26;
241pub const SIGPROF: ::c_int = 27;
242pub const SIGWINCH: ::c_int = 28;
243pub const SIGUSR1: ::c_int = 10;
244pub const SIGUSR2: ::c_int = 12;
245pub const SIGCONT: ::c_int = 18;
246pub const SIGSTOP: ::c_int = 19;
247pub const SIGTSTP: ::c_int = 20;
248pub const SIGURG: ::c_int = 23;
249pub const SIGIO: ::c_int = 29;
250pub const SIGSYS: ::c_int = 31;
251pub const SIGSTKFLT: ::c_int = 16;
252pub const SIGPOLL: ::c_int = 29;
253pub const SIGPWR: ::c_int = 30;
254pub const SIG_SETMASK: ::c_int = 2;
255pub const SIG_BLOCK: ::c_int = 0x000000;
256pub const SIG_UNBLOCK: ::c_int = 0x01;
257
258pub const EXTPROC: ::tcflag_t = 0x00010000;
259
260pub const MAP_HUGETLB: ::c_int = 0x040000;
261
262pub const F_GETLK: ::c_int = 12;
263pub const F_GETOWN: ::c_int = 9;
264pub const F_SETLK: ::c_int = 13;
265pub const F_SETLKW: ::c_int = 14;
266pub const F_SETOWN: ::c_int = 8;
267
268pub const VEOF: usize = 4;
269pub const VEOL: usize = 11;
270pub const VEOL2: usize = 16;
271pub const VMIN: usize = 6;
272pub const IEXTEN: ::tcflag_t = 0x00008000;
273pub const TOSTOP: ::tcflag_t = 0x00000100;
274pub const FLUSHO: ::tcflag_t = 0x00001000;
275
276pub const TCGETS: ::c_int = 0x5401;
277pub const TCSETS: ::c_int = 0x5402;
278pub const TCSETSW: ::c_int = 0x5403;
279pub const TCSETSF: ::c_int = 0x5404;
280pub const TCGETA: ::c_int = 0x5405;
281pub const TCSETA: ::c_int = 0x5406;
282pub const TCSETAW: ::c_int = 0x5407;
283pub const TCSETAF: ::c_int = 0x5408;
284pub const TCSBRK: ::c_int = 0x5409;
285pub const TCXONC: ::c_int = 0x540A;
286pub const TCFLSH: ::c_int = 0x540B;
287pub const TIOCGSOFTCAR: ::c_int = 0x5419;
288pub const TIOCSSOFTCAR: ::c_int = 0x541A;
289pub const TIOCLINUX: ::c_int = 0x541C;
290pub const TIOCGSERIAL: ::c_int = 0x541E;
291pub const TIOCEXCL: ::c_int = 0x540C;
292pub const TIOCNXCL: ::c_int = 0x540D;
293pub const TIOCSCTTY: ::c_int = 0x540E;
294pub const TIOCGPGRP: ::c_int = 0x540F;
295pub const TIOCSPGRP: ::c_int = 0x5410;
296pub const TIOCOUTQ: ::c_int = 0x5411;
297pub const TIOCSTI: ::c_int = 0x5412;
298pub const TIOCGWINSZ: ::c_int = 0x5413;
299pub const TIOCSWINSZ: ::c_int = 0x5414;
300pub const TIOCMGET: ::c_int = 0x5415;
301pub const TIOCMBIS: ::c_int = 0x5416;
302pub const TIOCMBIC: ::c_int = 0x5417;
303pub const TIOCMSET: ::c_int = 0x5418;
304pub const FIONREAD: ::c_int = 0x541B;
305pub const TIOCCONS: ::c_int = 0x541D;
306
307pub const SYS_gettid: ::c_long = 224;
308pub 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 @@
1pub type c_char = u8;
2pub type wchar_t = u32;
3
4s! {
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
87pub const O_DIRECT: ::c_int = 0x4000;
88pub const O_DIRECTORY: ::c_int = 0x10000;
89pub const O_NOFOLLOW: ::c_int = 0x20000;
90pub const O_ASYNC: ::c_int = 0x2000;
91
92pub const FIOCLEX: ::c_int = 0x5451;
93pub const FIONBIO: ::c_int = 0x5421;
94
95pub const RLIMIT_RSS: ::c_int = 5;
96pub const RLIMIT_NOFILE: ::c_int = 7;
97pub const RLIMIT_AS: ::c_int = 9;
98pub const RLIMIT_NPROC: ::c_int = 6;
99pub const RLIMIT_MEMLOCK: ::c_int = 8;
100
101pub const O_APPEND: ::c_int = 1024;
102pub const O_CREAT: ::c_int = 64;
103pub const O_EXCL: ::c_int = 128;
104pub const O_NOCTTY: ::c_int = 256;
105pub const O_NONBLOCK: ::c_int = 2048;
106pub const O_SYNC: ::c_int = 1052672;
107pub const O_RSYNC: ::c_int = 1052672;
108pub const O_DSYNC: ::c_int = 4096;
109
110pub const SOCK_NONBLOCK: ::c_int = 2048;
111
112pub const MAP_ANON: ::c_int = 0x0020;
113pub const MAP_GROWSDOWN: ::c_int = 0x0100;
114pub const MAP_DENYWRITE: ::c_int = 0x0800;
115pub const MAP_EXECUTABLE: ::c_int = 0x01000;
116pub const MAP_LOCKED: ::c_int = 0x02000;
117pub const MAP_NORESERVE: ::c_int = 0x04000;
118pub const MAP_POPULATE: ::c_int = 0x08000;
119pub const MAP_NONBLOCK: ::c_int = 0x010000;
120pub const MAP_STACK: ::c_int = 0x020000;
121
122pub const SOCK_STREAM: ::c_int = 1;
123pub const SOCK_DGRAM: ::c_int = 2;
124pub const SOCK_SEQPACKET: ::c_int = 5;
125
126pub const SOL_SOCKET: ::c_int = 1;
127
128pub const EDEADLK: ::c_int = 35;
129pub const ENAMETOOLONG: ::c_int = 36;
130pub const ENOLCK: ::c_int = 37;
131pub const ENOSYS: ::c_int = 38;
132pub const ENOTEMPTY: ::c_int = 39;
133pub const ELOOP: ::c_int = 40;
134pub const ENOMSG: ::c_int = 42;
135pub const EIDRM: ::c_int = 43;
136pub const ECHRNG: ::c_int = 44;
137pub const EL2NSYNC: ::c_int = 45;
138pub const EL3HLT: ::c_int = 46;
139pub const EL3RST: ::c_int = 47;
140pub const ELNRNG: ::c_int = 48;
141pub const EUNATCH: ::c_int = 49;
142pub const ENOCSI: ::c_int = 50;
143pub const EL2HLT: ::c_int = 51;
144pub const EBADE: ::c_int = 52;
145pub const EBADR: ::c_int = 53;
146pub const EXFULL: ::c_int = 54;
147pub const ENOANO: ::c_int = 55;
148pub const EBADRQC: ::c_int = 56;
149pub const EBADSLT: ::c_int = 57;
150pub const EDEADLOCK: ::c_int = EDEADLK;
151pub const EMULTIHOP: ::c_int = 72;
152pub const EBADMSG: ::c_int = 74;
153pub const EOVERFLOW: ::c_int = 75;
154pub const ENOTUNIQ: ::c_int = 76;
155pub const EBADFD: ::c_int = 77;
156pub const EREMCHG: ::c_int = 78;
157pub const ELIBACC: ::c_int = 79;
158pub const ELIBBAD: ::c_int = 80;
159pub const ELIBSCN: ::c_int = 81;
160pub const ELIBMAX: ::c_int = 82;
161pub const ELIBEXEC: ::c_int = 83;
162pub const EILSEQ: ::c_int = 84;
163pub const ERESTART: ::c_int = 85;
164pub const ESTRPIPE: ::c_int = 86;
165pub const EUSERS: ::c_int = 87;
166pub const ENOTSOCK: ::c_int = 88;
167pub const EDESTADDRREQ: ::c_int = 89;
168pub const EMSGSIZE: ::c_int = 90;
169pub const EPROTOTYPE: ::c_int = 91;
170pub const ENOPROTOOPT: ::c_int = 92;
171pub const EPROTONOSUPPORT: ::c_int = 93;
172pub const ESOCKTNOSUPPORT: ::c_int = 94;
173pub const EOPNOTSUPP: ::c_int = 95;
174pub const EPFNOSUPPORT: ::c_int = 96;
175pub const EAFNOSUPPORT: ::c_int = 97;
176pub const EADDRINUSE: ::c_int = 98;
177pub const EADDRNOTAVAIL: ::c_int = 99;
178pub const ENETDOWN: ::c_int = 100;
179pub const ENETUNREACH: ::c_int = 101;
180pub const ENETRESET: ::c_int = 102;
181pub const ECONNABORTED: ::c_int = 103;
182pub const ECONNRESET: ::c_int = 104;
183pub const ENOBUFS: ::c_int = 105;
184pub const EISCONN: ::c_int = 106;
185pub const ENOTCONN: ::c_int = 107;
186pub const ESHUTDOWN: ::c_int = 108;
187pub const ETOOMANYREFS: ::c_int = 109;
188pub const ETIMEDOUT: ::c_int = 110;
189pub const ECONNREFUSED: ::c_int = 111;
190pub const EHOSTDOWN: ::c_int = 112;
191pub const EHOSTUNREACH: ::c_int = 113;
192pub const EALREADY: ::c_int = 114;
193pub const EINPROGRESS: ::c_int = 115;
194pub const ESTALE: ::c_int = 116;
195pub const EUCLEAN: ::c_int = 117;
196pub const ENOTNAM: ::c_int = 118;
197pub const ENAVAIL: ::c_int = 119;
198pub const EISNAM: ::c_int = 120;
199pub const EREMOTEIO: ::c_int = 121;
200pub const EDQUOT: ::c_int = 122;
201pub const ENOMEDIUM: ::c_int = 123;
202pub const EMEDIUMTYPE: ::c_int = 124;
203pub const ECANCELED: ::c_int = 125;
204pub const ENOKEY: ::c_int = 126;
205pub const EKEYEXPIRED: ::c_int = 127;
206pub const EKEYREVOKED: ::c_int = 128;
207pub const EKEYREJECTED: ::c_int = 129;
208pub const EOWNERDEAD: ::c_int = 130;
209pub const ENOTRECOVERABLE: ::c_int = 131;
210pub const ERFKILL: ::c_int = 132;
211pub const EHWPOISON: ::c_int = 133;
212
213pub const SO_REUSEADDR: ::c_int = 2;
214pub const SO_TYPE: ::c_int = 3;
215pub const SO_ERROR: ::c_int = 4;
216pub const SO_DONTROUTE: ::c_int = 5;
217pub const SO_BROADCAST: ::c_int = 6;
218pub const SO_SNDBUF: ::c_int = 7;
219pub const SO_RCVBUF: ::c_int = 8;
220pub const SO_KEEPALIVE: ::c_int = 9;
221pub const SO_OOBINLINE: ::c_int = 10;
222pub const SO_LINGER: ::c_int = 13;
223pub const SO_REUSEPORT: ::c_int = 15;
224pub const SO_RCVLOWAT: ::c_int = 18;
225pub const SO_SNDLOWAT: ::c_int = 19;
226pub const SO_RCVTIMEO: ::c_int = 20;
227pub const SO_SNDTIMEO: ::c_int = 21;
228pub const SO_ACCEPTCONN: ::c_int = 30;
229
230pub const SA_ONSTACK: ::c_int = 0x08000000;
231pub const SA_SIGINFO: ::c_int = 0x00000004;
232pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
233
234pub const SIGCHLD: ::c_int = 17;
235pub const SIGBUS: ::c_int = 7;
236pub const SIGTTIN: ::c_int = 21;
237pub const SIGTTOU: ::c_int = 22;
238pub const SIGXCPU: ::c_int = 24;
239pub const SIGXFSZ: ::c_int = 25;
240pub const SIGVTALRM: ::c_int = 26;
241pub const SIGPROF: ::c_int = 27;
242pub const SIGWINCH: ::c_int = 28;
243pub const SIGUSR1: ::c_int = 10;
244pub const SIGUSR2: ::c_int = 12;
245pub const SIGCONT: ::c_int = 18;
246pub const SIGSTOP: ::c_int = 19;
247pub const SIGTSTP: ::c_int = 20;
248pub const SIGURG: ::c_int = 23;
249pub const SIGIO: ::c_int = 29;
250pub const SIGSYS: ::c_int = 31;
251pub const SIGSTKFLT: ::c_int = 16;
252pub const SIGPOLL: ::c_int = 29;
253pub const SIGPWR: ::c_int = 30;
254pub const SIG_SETMASK: ::c_int = 2;
255pub const SIG_BLOCK: ::c_int = 0x000000;
256pub const SIG_UNBLOCK: ::c_int = 0x01;
257
258pub const EXTPROC: ::tcflag_t = 0x00010000;
259
260pub const MAP_HUGETLB: ::c_int = 0x040000;
261
262pub const F_GETLK: ::c_int = 12;
263pub const F_GETOWN: ::c_int = 9;
264pub const F_SETLK: ::c_int = 13;
265pub const F_SETLKW: ::c_int = 14;
266pub const F_SETOWN: ::c_int = 8;
267
268pub const VEOF: usize = 4;
269pub const VEOL: usize = 11;
270pub const VEOL2: usize = 16;
271pub const VMIN: usize = 6;
272pub const IEXTEN: ::tcflag_t = 0x00008000;
273pub const TOSTOP: ::tcflag_t = 0x00000100;
274pub const FLUSHO: ::tcflag_t = 0x00001000;
275
276pub const TCGETS: ::c_int = 0x5401;
277pub const TCSETS: ::c_int = 0x5402;
278pub const TCSETSW: ::c_int = 0x5403;
279pub const TCSETSF: ::c_int = 0x5404;
280pub const TCGETA: ::c_int = 0x5405;
281pub const TCSETA: ::c_int = 0x5406;
282pub const TCSETAW: ::c_int = 0x5407;
283pub const TCSETAF: ::c_int = 0x5408;
284pub const TCSBRK: ::c_int = 0x5409;
285pub const TCXONC: ::c_int = 0x540A;
286pub const TCFLSH: ::c_int = 0x540B;
287pub const TIOCGSOFTCAR: ::c_int = 0x5419;
288pub const TIOCSSOFTCAR: ::c_int = 0x541A;
289pub const TIOCLINUX: ::c_int = 0x541C;
290pub const TIOCGSERIAL: ::c_int = 0x541E;
291pub const TIOCEXCL: ::c_int = 0x540C;
292pub const TIOCNXCL: ::c_int = 0x540D;
293pub const TIOCSCTTY: ::c_int = 0x540E;
294pub const TIOCGPGRP: ::c_int = 0x540F;
295pub const TIOCSPGRP: ::c_int = 0x5410;
296pub const TIOCOUTQ: ::c_int = 0x5411;
297pub const TIOCSTI: ::c_int = 0x5412;
298pub const TIOCGWINSZ: ::c_int = 0x5413;
299pub const TIOCSWINSZ: ::c_int = 0x5414;
300pub const TIOCMGET: ::c_int = 0x5415;
301pub const TIOCMBIS: ::c_int = 0x5416;
302pub const TIOCMBIC: ::c_int = 0x5417;
303pub const TIOCMSET: ::c_int = 0x5418;
304pub const FIONREAD: ::c_int = 0x541B;
305pub const TIOCCONS: ::c_int = 0x541D;
306
307pub 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 @@
1pub type c_char = i8;
2pub type wchar_t = ::c_int;
3
4s! {
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
86pub const O_DIRECT: ::c_int = 0o100000;
87pub const O_DIRECTORY: ::c_int = 0o200000;
88pub const O_NOFOLLOW: ::c_int = 0o400000;
89pub const O_ASYNC: ::c_int = 0o10000;
90
91pub const FIOCLEX: ::c_int = 0x6601;
92pub const FIONBIO: ::c_int = 0x667E;
93
94pub const RLIMIT_RSS: ::c_int = 7;
95pub const RLIMIT_NOFILE: ::c_int = 5;
96pub const RLIMIT_AS: ::c_int = 6;
97pub const RLIMIT_NPROC: ::c_int = 8;
98pub const RLIMIT_MEMLOCK: ::c_int = 9;
99
100pub const O_APPEND: ::c_int = 0o010;
101pub const O_CREAT: ::c_int = 0o400;
102pub const O_EXCL: ::c_int = 0o2000;
103pub const O_NOCTTY: ::c_int = 0o4000;
104pub const O_NONBLOCK: ::c_int = 0o200;
105pub const O_SYNC: ::c_int = 0o40020;
106pub const O_RSYNC: ::c_int = 0o40020;
107pub const O_DSYNC: ::c_int = 0o020;
108
109pub const SOCK_NONBLOCK: ::c_int = 0o200;
110
111pub const MAP_ANON: ::c_int = 0x800;
112pub const MAP_GROWSDOWN: ::c_int = 0x1000;
113pub const MAP_DENYWRITE: ::c_int = 0x2000;
114pub const MAP_EXECUTABLE: ::c_int = 0x4000;
115pub const MAP_LOCKED: ::c_int = 0x8000;
116pub const MAP_NORESERVE: ::c_int = 0x0400;
117pub const MAP_POPULATE: ::c_int = 0x10000;
118pub const MAP_NONBLOCK: ::c_int = 0x20000;
119pub const MAP_STACK: ::c_int = 0x40000;
120
121pub const EDEADLK: ::c_int = 45;
122pub const ENAMETOOLONG: ::c_int = 78;
123pub const ENOLCK: ::c_int = 46;
124pub const ENOSYS: ::c_int = 89;
125pub const ENOTEMPTY: ::c_int = 93;
126pub const ELOOP: ::c_int = 90;
127pub const ENOMSG: ::c_int = 35;
128pub const EIDRM: ::c_int = 36;
129pub const ECHRNG: ::c_int = 37;
130pub const EL2NSYNC: ::c_int = 38;
131pub const EL3HLT: ::c_int = 39;
132pub const EL3RST: ::c_int = 40;
133pub const ELNRNG: ::c_int = 41;
134pub const EUNATCH: ::c_int = 42;
135pub const ENOCSI: ::c_int = 43;
136pub const EL2HLT: ::c_int = 44;
137pub const EBADE: ::c_int = 50;
138pub const EBADR: ::c_int = 51;
139pub const EXFULL: ::c_int = 52;
140pub const ENOANO: ::c_int = 53;
141pub const EBADRQC: ::c_int = 54;
142pub const EBADSLT: ::c_int = 55;
143pub const EDEADLOCK: ::c_int = 56;
144pub const EMULTIHOP: ::c_int = 74;
145pub const EOVERFLOW: ::c_int = 79;
146pub const ENOTUNIQ: ::c_int = 80;
147pub const EBADFD: ::c_int = 81;
148pub const EBADMSG: ::c_int = 77;
149pub const EREMCHG: ::c_int = 82;
150pub const ELIBACC: ::c_int = 83;
151pub const ELIBBAD: ::c_int = 84;
152pub const ELIBSCN: ::c_int = 85;
153pub const ELIBMAX: ::c_int = 86;
154pub const ELIBEXEC: ::c_int = 87;
155pub const EILSEQ: ::c_int = 88;
156pub const ERESTART: ::c_int = 91;
157pub const ESTRPIPE: ::c_int = 92;
158pub const EUSERS: ::c_int = 94;
159pub const ENOTSOCK: ::c_int = 95;
160pub const EDESTADDRREQ: ::c_int = 96;
161pub const EMSGSIZE: ::c_int = 97;
162pub const EPROTOTYPE: ::c_int = 98;
163pub const ENOPROTOOPT: ::c_int = 99;
164pub const EPROTONOSUPPORT: ::c_int = 120;
165pub const ESOCKTNOSUPPORT: ::c_int = 121;
166pub const EOPNOTSUPP: ::c_int = 122;
167pub const EPFNOSUPPORT: ::c_int = 123;
168pub const EAFNOSUPPORT: ::c_int = 124;
169pub const EADDRINUSE: ::c_int = 125;
170pub const EADDRNOTAVAIL: ::c_int = 126;
171pub const ENETDOWN: ::c_int = 127;
172pub const ENETUNREACH: ::c_int = 128;
173pub const ENETRESET: ::c_int = 129;
174pub const ECONNABORTED: ::c_int = 130;
175pub const ECONNRESET: ::c_int = 131;
176pub const ENOBUFS: ::c_int = 132;
177pub const EISCONN: ::c_int = 133;
178pub const ENOTCONN: ::c_int = 134;
179pub const ESHUTDOWN: ::c_int = 143;
180pub const ETOOMANYREFS: ::c_int = 144;
181pub const ETIMEDOUT: ::c_int = 145;
182pub const ECONNREFUSED: ::c_int = 146;
183pub const EHOSTDOWN: ::c_int = 147;
184pub const EHOSTUNREACH: ::c_int = 148;
185pub const EALREADY: ::c_int = 149;
186pub const EINPROGRESS: ::c_int = 150;
187pub const ESTALE: ::c_int = 151;
188pub const EUCLEAN: ::c_int = 135;
189pub const ENOTNAM: ::c_int = 137;
190pub const ENAVAIL: ::c_int = 138;
191pub const EISNAM: ::c_int = 139;
192pub const EREMOTEIO: ::c_int = 140;
193pub const EDQUOT: ::c_int = 1133;
194pub const ENOMEDIUM: ::c_int = 159;
195pub const EMEDIUMTYPE: ::c_int = 160;
196pub const ECANCELED: ::c_int = 158;
197pub const ENOKEY: ::c_int = 161;
198pub const EKEYEXPIRED: ::c_int = 162;
199pub const EKEYREVOKED: ::c_int = 163;
200pub const EKEYREJECTED: ::c_int = 164;
201pub const EOWNERDEAD: ::c_int = 165;
202pub const ENOTRECOVERABLE: ::c_int = 166;
203pub const EHWPOISON: ::c_int = 168;
204pub const ERFKILL: ::c_int = 167;
205
206pub const SOCK_STREAM: ::c_int = 2;
207pub const SOCK_DGRAM: ::c_int = 1;
208pub const SOCK_SEQPACKET: ::c_int = 5;
209
210pub const SOL_SOCKET: ::c_int = 65535;
211
212pub const SO_REUSEADDR: ::c_int = 0x0004;
213pub const SO_TYPE: ::c_int = 0x1008;
214pub const SO_ERROR: ::c_int = 0x1007;
215pub const SO_DONTROUTE: ::c_int = 0x0010;
216pub const SO_BROADCAST: ::c_int = 0x0020;
217pub const SO_SNDBUF: ::c_int = 0x1001;
218pub const SO_RCVBUF: ::c_int = 0x1002;
219pub const SO_KEEPALIVE: ::c_int = 0x0008;
220pub const SO_OOBINLINE: ::c_int = 0x0100;
221pub const SO_LINGER: ::c_int = 0x0080;
222pub const SO_REUSEPORT: ::c_int = 0x200;
223pub const SO_RCVLOWAT: ::c_int = 0x1004;
224pub const SO_SNDLOWAT: ::c_int = 0x1003;
225pub const SO_RCVTIMEO: ::c_int = 0x1006;
226pub const SO_SNDTIMEO: ::c_int = 0x1005;
227pub const SO_ACCEPTCONN: ::c_int = 0x1009;
228
229pub const SA_ONSTACK: ::c_int = 0x08000000;
230pub const SA_SIGINFO: ::c_int = 8;
231pub const SA_NOCLDWAIT: ::c_int = 0x10000;
232
233pub const SIGCHLD: ::c_int = 18;
234pub const SIGBUS: ::c_int = 10;
235pub const SIGTTIN: ::c_int = 26;
236pub const SIGTTOU: ::c_int = 27;
237pub const SIGXCPU: ::c_int = 30;
238pub const SIGXFSZ: ::c_int = 31;
239pub const SIGVTALRM: ::c_int = 28;
240pub const SIGPROF: ::c_int = 29;
241pub const SIGWINCH: ::c_int = 20;
242pub const SIGUSR1: ::c_int = 16;
243pub const SIGUSR2: ::c_int = 17;
244pub const SIGCONT: ::c_int = 25;
245pub const SIGSTOP: ::c_int = 23;
246pub const SIGTSTP: ::c_int = 24;
247pub const SIGURG: ::c_int = 21;
248pub const SIGIO: ::c_int = 22;
249pub const SIGSYS: ::c_int = 12;
250pub const SIGSTKFLT: ::c_int = 7;
251pub const SIGPOLL: ::c_int = ::SIGIO;
252pub const SIGPWR: ::c_int = 19;
253pub const SIG_SETMASK: ::c_int = 3;
254pub const SIG_BLOCK: ::c_int = 1;
255pub const SIG_UNBLOCK: ::c_int = 2;
256
257pub const EXTPROC: ::tcflag_t = 0o200000;
258
259pub const MAP_HUGETLB: ::c_int = 0x80000;
260
261pub const F_GETLK: ::c_int = 33;
262pub const F_GETOWN: ::c_int = 23;
263pub const F_SETLK: ::c_int = 34;
264pub const F_SETLKW: ::c_int = 35;
265pub const F_SETOWN: ::c_int = 24;
266
267pub const VEOF: usize = 16;
268pub const VEOL: usize = 17;
269pub const VEOL2: usize = 6;
270pub const VMIN: usize = 4;
271pub const IEXTEN: ::tcflag_t = 0o000400;
272pub const TOSTOP: ::tcflag_t = 0o100000;
273pub const FLUSHO: ::tcflag_t = 0o020000;
274
275pub const TCGETS: ::c_int = 0x540D;
276pub const TCSETS: ::c_int = 0x540E;
277pub const TCSETSW: ::c_int = 0x540F;
278pub const TCSETSF: ::c_int = 0x5410;
279pub const TCGETA: ::c_int = 0x5401;
280pub const TCSETA: ::c_int = 0x5402;
281pub const TCSETAW: ::c_int = 0x5403;
282pub const TCSETAF: ::c_int = 0x5404;
283pub const TCSBRK: ::c_int = 0x5405;
284pub const TCXONC: ::c_int = 0x5406;
285pub const TCFLSH: ::c_int = 0x5407;
286pub const TIOCGSOFTCAR: ::c_int = 0x5481;
287pub const TIOCSSOFTCAR: ::c_int = 0x5482;
288pub const TIOCLINUX: ::c_int = 0x5483;
289pub const TIOCGSERIAL: ::c_int = 0x5484;
290pub const TIOCEXCL: ::c_int = 0x740D;
291pub const TIOCNXCL: ::c_int = 0x740E;
292pub const TIOCSCTTY: ::c_int = 0x5480;
293pub const TIOCGPGRP: ::c_int = 0x40047477;
294pub const TIOCSPGRP: ::c_int = 0x80047476;
295pub const TIOCOUTQ: ::c_int = 0x7472;
296pub const TIOCSTI: ::c_int = 0x5472;
297pub const TIOCGWINSZ: ::c_int = 0x40087468;
298pub const TIOCSWINSZ: ::c_int = 0x80087467;
299pub const TIOCMGET: ::c_int = 0x741D;
300pub const TIOCMBIS: ::c_int = 0x741B;
301pub const TIOCMBIC: ::c_int = 0x741C;
302pub const TIOCMSET: ::c_int = 0x741D;
303pub const FIONREAD: ::c_int = 0x467F;
304pub const TIOCCONS: ::c_int = 0x80047478;
305
306pub const SYS_gettid: ::c_long = 4222; // Valid for O32
307pub 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 @@
1pub type c_long = i32;
2pub type c_ulong = u32;
3pub type nlink_t = u32;
4
5s! {
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
29pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
30pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
31
32cfg_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 @@
1pub type c_char = i8;
2pub type wchar_t = i32;
3
4s! {
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
100pub const O_DIRECT: ::c_int = 0x4000;
101pub const O_DIRECTORY: ::c_int = 0x10000;
102pub const O_NOFOLLOW: ::c_int = 0x20000;
103pub const O_ASYNC: ::c_int = 0x2000;
104
105pub const FIOCLEX: ::c_int = 0x5451;
106pub const FIONBIO: ::c_int = 0x5421;
107
108pub const RLIMIT_RSS: ::c_int = 5;
109pub const RLIMIT_NOFILE: ::c_int = 7;
110pub const RLIMIT_AS: ::c_int = 9;
111pub const RLIMIT_NPROC: ::c_int = 6;
112pub const RLIMIT_MEMLOCK: ::c_int = 8;
113
114pub const O_APPEND: ::c_int = 1024;
115pub const O_CREAT: ::c_int = 64;
116pub const O_EXCL: ::c_int = 128;
117pub const O_NOCTTY: ::c_int = 256;
118pub const O_NONBLOCK: ::c_int = 2048;
119pub const O_SYNC: ::c_int = 1052672;
120pub const O_RSYNC: ::c_int = 1052672;
121pub const O_DSYNC: ::c_int = 4096;
122
123pub const SOCK_NONBLOCK: ::c_int = 2048;
124
125pub const MAP_ANON: ::c_int = 0x0020;
126pub const MAP_GROWSDOWN: ::c_int = 0x0100;
127pub const MAP_DENYWRITE: ::c_int = 0x0800;
128pub const MAP_EXECUTABLE: ::c_int = 0x01000;
129pub const MAP_LOCKED: ::c_int = 0x02000;
130pub const MAP_NORESERVE: ::c_int = 0x04000;
131pub const MAP_POPULATE: ::c_int = 0x08000;
132pub const MAP_NONBLOCK: ::c_int = 0x010000;
133pub const MAP_STACK: ::c_int = 0x020000;
134
135pub const SOCK_STREAM: ::c_int = 1;
136pub const SOCK_DGRAM: ::c_int = 2;
137pub const SOCK_SEQPACKET: ::c_int = 5;
138
139pub const SOL_SOCKET: ::c_int = 1;
140
141pub const EDEADLK: ::c_int = 35;
142pub const ENAMETOOLONG: ::c_int = 36;
143pub const ENOLCK: ::c_int = 37;
144pub const ENOSYS: ::c_int = 38;
145pub const ENOTEMPTY: ::c_int = 39;
146pub const ELOOP: ::c_int = 40;
147pub const ENOMSG: ::c_int = 42;
148pub const EIDRM: ::c_int = 43;
149pub const ECHRNG: ::c_int = 44;
150pub const EL2NSYNC: ::c_int = 45;
151pub const EL3HLT: ::c_int = 46;
152pub const EL3RST: ::c_int = 47;
153pub const ELNRNG: ::c_int = 48;
154pub const EUNATCH: ::c_int = 49;
155pub const ENOCSI: ::c_int = 50;
156pub const EL2HLT: ::c_int = 51;
157pub const EBADE: ::c_int = 52;
158pub const EBADR: ::c_int = 53;
159pub const EXFULL: ::c_int = 54;
160pub const ENOANO: ::c_int = 55;
161pub const EBADRQC: ::c_int = 56;
162pub const EBADSLT: ::c_int = 57;
163pub const EDEADLOCK: ::c_int = EDEADLK;
164pub const EMULTIHOP: ::c_int = 72;
165pub const EBADMSG: ::c_int = 74;
166pub const EOVERFLOW: ::c_int = 75;
167pub const ENOTUNIQ: ::c_int = 76;
168pub const EBADFD: ::c_int = 77;
169pub const EREMCHG: ::c_int = 78;
170pub const ELIBACC: ::c_int = 79;
171pub const ELIBBAD: ::c_int = 80;
172pub const ELIBSCN: ::c_int = 81;
173pub const ELIBMAX: ::c_int = 82;
174pub const ELIBEXEC: ::c_int = 83;
175pub const EILSEQ: ::c_int = 84;
176pub const ERESTART: ::c_int = 85;
177pub const ESTRPIPE: ::c_int = 86;
178pub const EUSERS: ::c_int = 87;
179pub const ENOTSOCK: ::c_int = 88;
180pub const EDESTADDRREQ: ::c_int = 89;
181pub const EMSGSIZE: ::c_int = 90;
182pub const EPROTOTYPE: ::c_int = 91;
183pub const ENOPROTOOPT: ::c_int = 92;
184pub const EPROTONOSUPPORT: ::c_int = 93;
185pub const ESOCKTNOSUPPORT: ::c_int = 94;
186pub const EOPNOTSUPP: ::c_int = 95;
187pub const EPFNOSUPPORT: ::c_int = 96;
188pub const EAFNOSUPPORT: ::c_int = 97;
189pub const EADDRINUSE: ::c_int = 98;
190pub const EADDRNOTAVAIL: ::c_int = 99;
191pub const ENETDOWN: ::c_int = 100;
192pub const ENETUNREACH: ::c_int = 101;
193pub const ENETRESET: ::c_int = 102;
194pub const ECONNABORTED: ::c_int = 103;
195pub const ECONNRESET: ::c_int = 104;
196pub const ENOBUFS: ::c_int = 105;
197pub const EISCONN: ::c_int = 106;
198pub const ENOTCONN: ::c_int = 107;
199pub const ESHUTDOWN: ::c_int = 108;
200pub const ETOOMANYREFS: ::c_int = 109;
201pub const ETIMEDOUT: ::c_int = 110;
202pub const ECONNREFUSED: ::c_int = 111;
203pub const EHOSTDOWN: ::c_int = 112;
204pub const EHOSTUNREACH: ::c_int = 113;
205pub const EALREADY: ::c_int = 114;
206pub const EINPROGRESS: ::c_int = 115;
207pub const ESTALE: ::c_int = 116;
208pub const EUCLEAN: ::c_int = 117;
209pub const ENOTNAM: ::c_int = 118;
210pub const ENAVAIL: ::c_int = 119;
211pub const EISNAM: ::c_int = 120;
212pub const EREMOTEIO: ::c_int = 121;
213pub const EDQUOT: ::c_int = 122;
214pub const ENOMEDIUM: ::c_int = 123;
215pub const EMEDIUMTYPE: ::c_int = 124;
216pub const ECANCELED: ::c_int = 125;
217pub const ENOKEY: ::c_int = 126;
218pub const EKEYEXPIRED: ::c_int = 127;
219pub const EKEYREVOKED: ::c_int = 128;
220pub const EKEYREJECTED: ::c_int = 129;
221pub const EOWNERDEAD: ::c_int = 130;
222pub const ENOTRECOVERABLE: ::c_int = 131;
223pub const ERFKILL: ::c_int = 132;
224pub const EHWPOISON: ::c_int = 133;
225
226pub const SO_REUSEADDR: ::c_int = 2;
227pub const SO_TYPE: ::c_int = 3;
228pub const SO_ERROR: ::c_int = 4;
229pub const SO_DONTROUTE: ::c_int = 5;
230pub const SO_BROADCAST: ::c_int = 6;
231pub const SO_SNDBUF: ::c_int = 7;
232pub const SO_RCVBUF: ::c_int = 8;
233pub const SO_KEEPALIVE: ::c_int = 9;
234pub const SO_OOBINLINE: ::c_int = 10;
235pub const SO_LINGER: ::c_int = 13;
236pub const SO_REUSEPORT: ::c_int = 15;
237pub const SO_RCVLOWAT: ::c_int = 18;
238pub const SO_SNDLOWAT: ::c_int = 19;
239pub const SO_RCVTIMEO: ::c_int = 20;
240pub const SO_SNDTIMEO: ::c_int = 21;
241pub const SO_ACCEPTCONN: ::c_int = 30;
242
243pub const SA_ONSTACK: ::c_int = 0x08000000;
244pub const SA_SIGINFO: ::c_int = 0x00000004;
245pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
246
247pub const SIGCHLD: ::c_int = 17;
248pub const SIGBUS: ::c_int = 7;
249pub const SIGTTIN: ::c_int = 21;
250pub const SIGTTOU: ::c_int = 22;
251pub const SIGXCPU: ::c_int = 24;
252pub const SIGXFSZ: ::c_int = 25;
253pub const SIGVTALRM: ::c_int = 26;
254pub const SIGPROF: ::c_int = 27;
255pub const SIGWINCH: ::c_int = 28;
256pub const SIGUSR1: ::c_int = 10;
257pub const SIGUSR2: ::c_int = 12;
258pub const SIGCONT: ::c_int = 18;
259pub const SIGSTOP: ::c_int = 19;
260pub const SIGTSTP: ::c_int = 20;
261pub const SIGURG: ::c_int = 23;
262pub const SIGIO: ::c_int = 29;
263pub const SIGSYS: ::c_int = 31;
264pub const SIGSTKFLT: ::c_int = 16;
265pub const SIGPOLL: ::c_int = 29;
266pub const SIGPWR: ::c_int = 30;
267pub const SIG_SETMASK: ::c_int = 2;
268pub const SIG_BLOCK: ::c_int = 0x000000;
269pub const SIG_UNBLOCK: ::c_int = 0x01;
270
271pub const EXTPROC: ::tcflag_t = 0x00010000;
272
273pub const MAP_HUGETLB: ::c_int = 0x040000;
274pub const MAP_32BIT: ::c_int = 0x0040;
275
276pub const F_GETLK: ::c_int = 12;
277pub const F_GETOWN: ::c_int = 9;
278pub const F_SETLK: ::c_int = 13;
279pub const F_SETLKW: ::c_int = 14;
280pub const F_SETOWN: ::c_int = 8;
281
282pub const VEOF: usize = 4;
283pub const VEOL: usize = 11;
284pub const VEOL2: usize = 16;
285pub const VMIN: usize = 6;
286pub const IEXTEN: ::tcflag_t = 0x00008000;
287pub const TOSTOP: ::tcflag_t = 0x00000100;
288pub const FLUSHO: ::tcflag_t = 0x00001000;
289
290pub const TCGETS: ::c_int = 0x5401;
291pub const TCSETS: ::c_int = 0x5402;
292pub const TCSETSW: ::c_int = 0x5403;
293pub const TCSETSF: ::c_int = 0x5404;
294pub const TCGETA: ::c_int = 0x5405;
295pub const TCSETA: ::c_int = 0x5406;
296pub const TCSETAW: ::c_int = 0x5407;
297pub const TCSETAF: ::c_int = 0x5408;
298pub const TCSBRK: ::c_int = 0x5409;
299pub const TCXONC: ::c_int = 0x540A;
300pub const TCFLSH: ::c_int = 0x540B;
301pub const TIOCGSOFTCAR: ::c_int = 0x5419;
302pub const TIOCSSOFTCAR: ::c_int = 0x541A;
303pub const TIOCLINUX: ::c_int = 0x541C;
304pub const TIOCGSERIAL: ::c_int = 0x541E;
305pub const TIOCEXCL: ::c_int = 0x540C;
306pub const TIOCNXCL: ::c_int = 0x540D;
307pub const TIOCSCTTY: ::c_int = 0x540E;
308pub const TIOCGPGRP: ::c_int = 0x540F;
309pub const TIOCSPGRP: ::c_int = 0x5410;
310pub const TIOCOUTQ: ::c_int = 0x5411;
311pub const TIOCSTI: ::c_int = 0x5412;
312pub const TIOCGWINSZ: ::c_int = 0x5413;
313pub const TIOCSWINSZ: ::c_int = 0x5414;
314pub const TIOCMGET: ::c_int = 0x5415;
315pub const TIOCMBIS: ::c_int = 0x5416;
316pub const TIOCMBIC: ::c_int = 0x5417;
317pub const TIOCMSET: ::c_int = 0x5418;
318pub const FIONREAD: ::c_int = 0x541B;
319pub const TIOCCONS: ::c_int = 0x541D;
320
321pub const SYS_gettid: ::c_long = 224;
322pub 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 @@
1pub type c_char = i8;
2pub type wchar_t = i32;
3pub type c_long = i64;
4pub type c_ulong = u64;
5pub type nlink_t = u64;
6
7s! {
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
109pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
110pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
111
112pub const O_DIRECT: ::c_int = 0x4000;
113pub const O_DIRECTORY: ::c_int = 0x10000;
114pub const O_NOFOLLOW: ::c_int = 0x20000;
115pub const O_ASYNC: ::c_int = 0x2000;
116
117pub const FIOCLEX: ::c_int = 0x5451;
118pub const FIONBIO: ::c_int = 0x5421;
119
120pub const RLIMIT_RSS: ::c_int = 5;
121pub const RLIMIT_NOFILE: ::c_int = 7;
122pub const RLIMIT_AS: ::c_int = 9;
123pub const RLIMIT_NPROC: ::c_int = 6;
124pub const RLIMIT_MEMLOCK: ::c_int = 8;
125
126pub const O_APPEND: ::c_int = 1024;
127pub const O_CREAT: ::c_int = 64;
128pub const O_EXCL: ::c_int = 128;
129pub const O_NOCTTY: ::c_int = 256;
130pub const O_NONBLOCK: ::c_int = 2048;
131pub const O_SYNC: ::c_int = 1052672;
132pub const O_RSYNC: ::c_int = 1052672;
133pub const O_DSYNC: ::c_int = 4096;
134
135pub const SOCK_NONBLOCK: ::c_int = 2048;
136
137pub const MAP_ANON: ::c_int = 0x0020;
138pub const MAP_GROWSDOWN: ::c_int = 0x0100;
139pub const MAP_DENYWRITE: ::c_int = 0x0800;
140pub const MAP_EXECUTABLE: ::c_int = 0x01000;
141pub const MAP_LOCKED: ::c_int = 0x02000;
142pub const MAP_NORESERVE: ::c_int = 0x04000;
143pub const MAP_POPULATE: ::c_int = 0x08000;
144pub const MAP_NONBLOCK: ::c_int = 0x010000;
145pub const MAP_STACK: ::c_int = 0x020000;
146pub const MAP_32BIT: ::c_int = 0x0040;
147
148pub const SOCK_STREAM: ::c_int = 1;
149pub const SOCK_DGRAM: ::c_int = 2;
150pub const SOCK_SEQPACKET: ::c_int = 5;
151
152pub const SOL_SOCKET: ::c_int = 1;
153
154pub const EDEADLK: ::c_int = 35;
155pub const ENAMETOOLONG: ::c_int = 36;
156pub const ENOLCK: ::c_int = 37;
157pub const ENOSYS: ::c_int = 38;
158pub const ENOTEMPTY: ::c_int = 39;
159pub const ELOOP: ::c_int = 40;
160pub const ENOMSG: ::c_int = 42;
161pub const EIDRM: ::c_int = 43;
162pub const ECHRNG: ::c_int = 44;
163pub const EL2NSYNC: ::c_int = 45;
164pub const EL3HLT: ::c_int = 46;
165pub const EL3RST: ::c_int = 47;
166pub const ELNRNG: ::c_int = 48;
167pub const EUNATCH: ::c_int = 49;
168pub const ENOCSI: ::c_int = 50;
169pub const EL2HLT: ::c_int = 51;
170pub const EBADE: ::c_int = 52;
171pub const EBADR: ::c_int = 53;
172pub const EXFULL: ::c_int = 54;
173pub const ENOANO: ::c_int = 55;
174pub const EBADRQC: ::c_int = 56;
175pub const EBADSLT: ::c_int = 57;
176pub const EDEADLOCK: ::c_int = EDEADLK;
177pub const EMULTIHOP: ::c_int = 72;
178pub const EBADMSG: ::c_int = 74;
179pub const EOVERFLOW: ::c_int = 75;
180pub const ENOTUNIQ: ::c_int = 76;
181pub const EBADFD: ::c_int = 77;
182pub const EREMCHG: ::c_int = 78;
183pub const ELIBACC: ::c_int = 79;
184pub const ELIBBAD: ::c_int = 80;
185pub const ELIBSCN: ::c_int = 81;
186pub const ELIBMAX: ::c_int = 82;
187pub const ELIBEXEC: ::c_int = 83;
188pub const EILSEQ: ::c_int = 84;
189pub const ERESTART: ::c_int = 85;
190pub const ESTRPIPE: ::c_int = 86;
191pub const EUSERS: ::c_int = 87;
192pub const ENOTSOCK: ::c_int = 88;
193pub const EDESTADDRREQ: ::c_int = 89;
194pub const EMSGSIZE: ::c_int = 90;
195pub const EPROTOTYPE: ::c_int = 91;
196pub const ENOPROTOOPT: ::c_int = 92;
197pub const EPROTONOSUPPORT: ::c_int = 93;
198pub const ESOCKTNOSUPPORT: ::c_int = 94;
199pub const EOPNOTSUPP: ::c_int = 95;
200pub const EPFNOSUPPORT: ::c_int = 96;
201pub const EAFNOSUPPORT: ::c_int = 97;
202pub const EADDRINUSE: ::c_int = 98;
203pub const EADDRNOTAVAIL: ::c_int = 99;
204pub const ENETDOWN: ::c_int = 100;
205pub const ENETUNREACH: ::c_int = 101;
206pub const ENETRESET: ::c_int = 102;
207pub const ECONNABORTED: ::c_int = 103;
208pub const ECONNRESET: ::c_int = 104;
209pub const ENOBUFS: ::c_int = 105;
210pub const EISCONN: ::c_int = 106;
211pub const ENOTCONN: ::c_int = 107;
212pub const ESHUTDOWN: ::c_int = 108;
213pub const ETOOMANYREFS: ::c_int = 109;
214pub const ETIMEDOUT: ::c_int = 110;
215pub const ECONNREFUSED: ::c_int = 111;
216pub const EHOSTDOWN: ::c_int = 112;
217pub const EHOSTUNREACH: ::c_int = 113;
218pub const EALREADY: ::c_int = 114;
219pub const EINPROGRESS: ::c_int = 115;
220pub const ESTALE: ::c_int = 116;
221pub const EUCLEAN: ::c_int = 117;
222pub const ENOTNAM: ::c_int = 118;
223pub const ENAVAIL: ::c_int = 119;
224pub const EISNAM: ::c_int = 120;
225pub const EREMOTEIO: ::c_int = 121;
226pub const EDQUOT: ::c_int = 122;
227pub const ENOMEDIUM: ::c_int = 123;
228pub const EMEDIUMTYPE: ::c_int = 124;
229pub const ECANCELED: ::c_int = 125;
230pub const ENOKEY: ::c_int = 126;
231pub const EKEYEXPIRED: ::c_int = 127;
232pub const EKEYREVOKED: ::c_int = 128;
233pub const EKEYREJECTED: ::c_int = 129;
234pub const EOWNERDEAD: ::c_int = 130;
235pub const ENOTRECOVERABLE: ::c_int = 131;
236pub const ERFKILL: ::c_int = 132;
237pub const EHWPOISON: ::c_int = 133;
238
239pub const SO_REUSEADDR: ::c_int = 2;
240pub const SO_TYPE: ::c_int = 3;
241pub const SO_ERROR: ::c_int = 4;
242pub const SO_DONTROUTE: ::c_int = 5;
243pub const SO_BROADCAST: ::c_int = 6;
244pub const SO_SNDBUF: ::c_int = 7;
245pub const SO_RCVBUF: ::c_int = 8;
246pub const SO_KEEPALIVE: ::c_int = 9;
247pub const SO_OOBINLINE: ::c_int = 10;
248pub const SO_LINGER: ::c_int = 13;
249pub const SO_REUSEPORT: ::c_int = 15;
250pub const SO_RCVLOWAT: ::c_int = 18;
251pub const SO_SNDLOWAT: ::c_int = 19;
252pub const SO_RCVTIMEO: ::c_int = 20;
253pub const SO_SNDTIMEO: ::c_int = 21;
254pub const SO_ACCEPTCONN: ::c_int = 30;
255
256pub const SA_ONSTACK: ::c_int = 0x08000000;
257pub const SA_SIGINFO: ::c_int = 0x00000004;
258pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
259
260pub const SIGCHLD: ::c_int = 17;
261pub const SIGBUS: ::c_int = 7;
262pub const SIGTTIN: ::c_int = 21;
263pub const SIGTTOU: ::c_int = 22;
264pub const SIGXCPU: ::c_int = 24;
265pub const SIGXFSZ: ::c_int = 25;
266pub const SIGVTALRM: ::c_int = 26;
267pub const SIGPROF: ::c_int = 27;
268pub const SIGWINCH: ::c_int = 28;
269pub const SIGUSR1: ::c_int = 10;
270pub const SIGUSR2: ::c_int = 12;
271pub const SIGCONT: ::c_int = 18;
272pub const SIGSTOP: ::c_int = 19;
273pub const SIGTSTP: ::c_int = 20;
274pub const SIGURG: ::c_int = 23;
275pub const SIGIO: ::c_int = 29;
276pub const SIGSYS: ::c_int = 31;
277pub const SIGSTKFLT: ::c_int = 16;
278pub const SIGPOLL: ::c_int = 29;
279pub const SIGPWR: ::c_int = 30;
280pub const SIG_SETMASK: ::c_int = 2;
281pub const SIG_BLOCK: ::c_int = 0x000000;
282pub const SIG_UNBLOCK: ::c_int = 0x01;
283
284pub const EXTPROC: ::tcflag_t = 0x00010000;
285
286pub const MAP_HUGETLB: ::c_int = 0x040000;
287
288pub const F_GETLK: ::c_int = 5;
289pub const F_GETOWN: ::c_int = 9;
290pub const F_SETLK: ::c_int = 6;
291pub const F_SETLKW: ::c_int = 7;
292pub const F_SETOWN: ::c_int = 8;
293
294pub const VEOF: usize = 4;
295pub const VEOL: usize = 11;
296pub const VEOL2: usize = 16;
297pub const VMIN: usize = 6;
298pub const IEXTEN: ::tcflag_t = 0x00008000;
299pub const TOSTOP: ::tcflag_t = 0x00000100;
300pub const FLUSHO: ::tcflag_t = 0x00001000;
301
302pub const TCGETS: ::c_int = 0x5401;
303pub const TCSETS: ::c_int = 0x5402;
304pub const TCSETSW: ::c_int = 0x5403;
305pub const TCSETSF: ::c_int = 0x5404;
306pub const TCGETA: ::c_int = 0x5405;
307pub const TCSETA: ::c_int = 0x5406;
308pub const TCSETAW: ::c_int = 0x5407;
309pub const TCSETAF: ::c_int = 0x5408;
310pub const TCSBRK: ::c_int = 0x5409;
311pub const TCXONC: ::c_int = 0x540A;
312pub const TCFLSH: ::c_int = 0x540B;
313pub const TIOCGSOFTCAR: ::c_int = 0x5419;
314pub const TIOCSSOFTCAR: ::c_int = 0x541A;
315pub const TIOCLINUX: ::c_int = 0x541C;
316pub const TIOCGSERIAL: ::c_int = 0x541E;
317pub const TIOCEXCL: ::c_int = 0x540C;
318pub const TIOCNXCL: ::c_int = 0x540D;
319pub const TIOCSCTTY: ::c_int = 0x540E;
320pub const TIOCGPGRP: ::c_int = 0x540F;
321pub const TIOCSPGRP: ::c_int = 0x5410;
322pub const TIOCOUTQ: ::c_int = 0x5411;
323pub const TIOCSTI: ::c_int = 0x5412;
324pub const TIOCGWINSZ: ::c_int = 0x5413;
325pub const TIOCSWINSZ: ::c_int = 0x5414;
326pub const TIOCMGET: ::c_int = 0x5415;
327pub const TIOCMBIS: ::c_int = 0x5416;
328pub const TIOCMBIC: ::c_int = 0x5417;
329pub const TIOCMSET: ::c_int = 0x5418;
330pub const FIONREAD: ::c_int = 0x541B;
331pub const TIOCCONS: ::c_int = 0x541D;
332
333cfg_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 @@
1s! {
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
16pub const SYS_gettid: ::c_long = 186;
17
18pub 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 @@
1pub type clock_t = c_long;
2pub type time_t = c_long;
3pub type suseconds_t = c_long;
4pub type ino_t = u64;
5pub type off_t = i64;
6pub type blkcnt_t = i64;
7
8pub type blksize_t = c_long;
9pub type fsblkcnt_t = ::c_ulonglong;
10pub type fsfilcnt_t = ::c_ulonglong;
11pub type rlim_t = ::c_ulonglong;
12
13s! {
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
78pub const BUFSIZ: ::c_uint = 1024;
79pub const TMP_MAX: ::c_uint = 10000;
80pub const FOPEN_MAX: ::c_uint = 1000;
81pub const POSIX_MADV_DONTNEED: ::c_int = 0;
82pub const O_ACCMODE: ::c_int = 0o10000003;
83pub const O_NDELAY: ::c_int = O_NONBLOCK;
84pub const RUSAGE_CHILDREN: ::c_int = 1;
85pub const NI_MAXHOST: ::socklen_t = 255;
86pub const PTHREAD_STACK_MIN: ::size_t = 2048;
87
88pub const RLIM_INFINITY: ::rlim_t = !0;
89pub const RLIMIT_RTTIME: ::c_int = 15;
90pub const RLIMIT_NLIMITS: ::c_int = 16;
91
92pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
93
94pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
95pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
96pub const TCP_THIN_DUPACK: ::c_int = 17;
97pub const TCP_USER_TIMEOUT: ::c_int = 18;
98pub const TCP_REPAIR: ::c_int = 19;
99pub const TCP_REPAIR_QUEUE: ::c_int = 20;
100pub const TCP_QUEUE_SEQ: ::c_int = 21;
101pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
102pub const TCP_FASTOPEN: ::c_int = 23;
103pub const TCP_TIMESTAMP: ::c_int = 24;
104
105pub const SIGUNUSED: ::c_int = ::SIGSYS;
106
107pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
108pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
109
110pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
111pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
112
113pub const CPU_SETSIZE: ::c_int = 128;
114
115pub const QFMT_VFS_V1: ::c_int = 4;
116
117pub const PTRACE_TRACEME: ::c_int = 0;
118pub const PTRACE_PEEKTEXT: ::c_int = 1;
119pub const PTRACE_PEEKDATA: ::c_int = 2;
120pub const PTRACE_PEEKUSER: ::c_int = 3;
121pub const PTRACE_POKETEXT: ::c_int = 4;
122pub const PTRACE_POKEDATA: ::c_int = 5;
123pub const PTRACE_POKEUSER: ::c_int = 6;
124pub const PTRACE_CONT: ::c_int = 7;
125pub const PTRACE_KILL: ::c_int = 8;
126pub const PTRACE_SINGLESTEP: ::c_int = 9;
127pub const PTRACE_ATTACH: ::c_int = 16;
128pub const PTRACE_DETACH: ::c_int = 17;
129pub const PTRACE_SYSCALL: ::c_int = 24;
130pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
131pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
132pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
133pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
134pub const PTRACE_GETREGSET: ::c_int = 0x4204;
135pub const PTRACE_SETREGSET: ::c_int = 0x4205;
136pub const PTRACE_SEIZE: ::c_int = 0x4206;
137pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
138pub const PTRACE_LISTEN: ::c_int = 0x4208;
139pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
140
141pub const PTRACE_O_EXITKILL: ::c_int = 1048576;
142pub const PTRACE_O_TRACECLONE: ::c_int = 8;
143pub const PTRACE_O_TRACEEXEC: ::c_int = 16;
144pub const PTRACE_O_TRACEEXIT: ::c_int = 64;
145pub const PTRACE_O_TRACEFORK: ::c_int = 2;
146pub const PTRACE_O_TRACESYSGOOD: ::c_int = 1;
147pub const PTRACE_O_TRACEVFORK: ::c_int = 4;
148pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 32;
149pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 2097152;
150
151pub const MADV_DODUMP: ::c_int = 17;
152pub const MADV_DONTDUMP: ::c_int = 16;
153
154pub const EPOLLWAKEUP: ::c_int = 0x20000000;
155
156pub const POLLRDNORM: ::c_short = 0x040;
157pub const POLLWRNORM: ::c_short = 0x100;
158pub const POLLRDBAND: ::c_short = 0x080;
159pub const POLLWRBAND: ::c_short = 0x200;
160
161pub const MADV_HUGEPAGE: ::c_int = 14;
162pub const MADV_NOHUGEPAGE: ::c_int = 15;
163
164pub const PTRACE_GETFPREGS: ::c_uint = 14;
165pub const PTRACE_SETFPREGS: ::c_uint = 15;
166pub const PTRACE_GETFPXREGS: ::c_uint = 18;
167pub const PTRACE_SETFPXREGS: ::c_uint = 19;
168pub const PTRACE_GETREGS: ::c_uint = 12;
169pub const PTRACE_SETREGS: ::c_uint = 13;
170
171pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
172
173pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
174
175pub const TCSANOW: ::c_int = 0;
176pub const TCSADRAIN: ::c_int = 1;
177pub const TCSAFLUSH: ::c_int = 2;
178
179pub const TIOCINQ: ::c_int = ::FIONREAD;
180
181pub const RTLD_GLOBAL: ::c_int = 0x100;
182pub 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
186pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
187pub const CLOCK_TAI: ::clockid_t = 11;
188
189extern {
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
196cfg_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 @@
1pub type c_char = u8;
2pub type wchar_t = u32;
3
4pub const O_DIRECT: ::c_int = 0x10000;
5pub const O_DIRECTORY: ::c_int = 0x4000;
6pub const O_NOFOLLOW: ::c_int = 0x8000;
7
8pub const MAP_LOCKED: ::c_int = 0x02000;
9pub const MAP_NORESERVE: ::c_int = 0x04000;
10
11pub const EDEADLOCK: ::c_int = 35;
12
13pub const SO_PEERCRED: ::c_int = 17;
14pub const SO_RCVLOWAT: ::c_int = 18;
15pub const SO_SNDLOWAT: ::c_int = 19;
16pub const SO_RCVTIMEO: ::c_int = 20;
17pub const SO_SNDTIMEO: ::c_int = 21;
18
19pub const FIOCLEX: ::c_ulong = 0x5451;
20pub const FIONBIO: ::c_ulong = 0x5421;
21
22pub const SYS_gettid: ::c_long = 224;
23pub 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
3pub type c_long = i32;
4pub type c_ulong = u32;
5pub type clock_t = i32;
6pub type time_t = i32;
7pub type suseconds_t = i32;
8pub type ino_t = u32;
9pub type off_t = i32;
10pub type blkcnt_t = i32;
11pub type __fsword_t = i32;
12
13pub type blksize_t = i32;
14pub type nlink_t = u32;
15
16s! {
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
88pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
89pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
90pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
91pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
92
93pub const PTRACE_GETFPREGS: ::c_uint = 14;
94pub const PTRACE_SETFPREGS: ::c_uint = 15;
95pub const PTRACE_GETFPXREGS: ::c_uint = 18;
96pub const PTRACE_SETFPXREGS: ::c_uint = 19;
97pub const PTRACE_GETREGS: ::c_uint = 12;
98pub const PTRACE_SETREGS: ::c_uint = 13;
99
100cfg_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 @@
1pub type c_char = u8;
2pub type wchar_t = i32;
3
4pub const O_DIRECT: ::c_int = 0x20000;
5pub const O_DIRECTORY: ::c_int = 0x4000;
6pub const O_NOFOLLOW: ::c_int = 0x8000;
7
8pub const MAP_LOCKED: ::c_int = 0x00080;
9pub const MAP_NORESERVE: ::c_int = 0x00040;
10
11pub const EDEADLOCK: ::c_int = 58;
12
13pub const SO_PEERCRED: ::c_int = 21;
14pub const SO_RCVLOWAT: ::c_int = 16;
15pub const SO_SNDLOWAT: ::c_int = 17;
16pub const SO_RCVTIMEO: ::c_int = 18;
17pub const SO_SNDTIMEO: ::c_int = 19;
18
19pub const FIOCLEX: ::c_ulong = 0x20006601;
20pub const FIONBIO: ::c_ulong = 0x8004667e;
21
22pub const SYS_gettid: ::c_long = 207;
23pub 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 @@
1pub type c_char = i8;
2pub type wchar_t = i32;
3pub type greg_t = i32;
4
5s! {
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
40pub const O_DIRECT: ::c_int = 0x4000;
41pub const O_DIRECTORY: ::c_int = 0x10000;
42pub const O_NOFOLLOW: ::c_int = 0x20000;
43
44pub const MAP_LOCKED: ::c_int = 0x02000;
45pub const MAP_NORESERVE: ::c_int = 0x04000;
46pub const MAP_32BIT: ::c_int = 0x0040;
47
48pub const EDEADLOCK: ::c_int = 35;
49
50pub const SO_PEERCRED: ::c_int = 17;
51pub const SO_RCVLOWAT: ::c_int = 18;
52pub const SO_SNDLOWAT: ::c_int = 19;
53pub const SO_RCVTIMEO: ::c_int = 20;
54pub const SO_SNDTIMEO: ::c_int = 21;
55
56pub const FIOCLEX: ::c_ulong = 0x5451;
57pub const FIONBIO: ::c_ulong = 0x5421;
58
59pub const SYS_gettid: ::c_long = 224;
60pub const SYS_perf_event_open: ::c_long = 336;
61
62extern {
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
3pub type c_char = u8;
4pub type wchar_t = u32;
5pub type nlink_t = u32;
6pub type blksize_t = i32;
7
8s! {
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
58pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 8;
59pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48;
60pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8;
61
62pub const O_DIRECT: ::c_int = 0x10000;
63pub const O_DIRECTORY: ::c_int = 0x4000;
64pub const O_NOFOLLOW: ::c_int = 0x8000;
65
66pub const MAP_LOCKED: ::c_int = 0x02000;
67pub const MAP_NORESERVE: ::c_int = 0x04000;
68
69pub const EDEADLOCK: ::c_int = 35;
70
71pub const SO_PEERCRED: ::c_int = 17;
72pub const SO_RCVLOWAT: ::c_int = 18;
73pub const SO_SNDLOWAT: ::c_int = 19;
74pub const SO_RCVTIMEO: ::c_int = 20;
75pub const SO_SNDTIMEO: ::c_int = 21;
76
77pub const FIOCLEX: ::c_ulong = 0x5451;
78pub const FIONBIO: ::c_ulong = 0x5421;
79
80pub const SYS_gettid: ::c_long = 178;
81pub 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
3pub type c_long = i64;
4pub type c_ulong = u64;
5pub type clock_t = i64;
6pub type time_t = i64;
7pub type suseconds_t = i64;
8pub type ino_t = u64;
9pub type off_t = i64;
10pub type blkcnt_t = i64;
11pub type __fsword_t = ::c_long;
12
13s! {
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
36pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
37
38cfg_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
3pub type c_char = u8;
4pub type wchar_t = i32;
5pub type nlink_t = u64;
6pub type blksize_t = i64;
7
8s! {
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
56pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
57pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
58pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
59
60pub const O_DIRECTORY: ::c_int = 0x4000;
61pub const O_NOFOLLOW: ::c_int = 0x8000;
62pub const O_DIRECT: ::c_int = 0x20000;
63
64pub const MAP_LOCKED: ::c_int = 0x00080;
65pub const MAP_NORESERVE: ::c_int = 0x00040;
66
67pub const EDEADLOCK: ::c_int = 58;
68
69pub const SO_PEERCRED: ::c_int = 21;
70pub const SO_RCVLOWAT: ::c_int = 16;
71pub const SO_SNDLOWAT: ::c_int = 17;
72pub const SO_RCVTIMEO: ::c_int = 18;
73pub const SO_SNDTIMEO: ::c_int = 19;
74
75pub const FIOCLEX: ::c_ulong = 0x20006601;
76pub const FIONBIO: ::c_ulong = 0x8004667e;
77
78pub const SYS_gettid: ::c_long = 207;
79pub 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
3pub type c_char = i8;
4pub type wchar_t = i32;
5pub type nlink_t = u64;
6pub type blksize_t = i64;
7pub type greg_t = i64;
8
9s! {
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
96pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
97pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
98pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
99
100pub const O_DIRECT: ::c_int = 0x4000;
101pub const O_DIRECTORY: ::c_int = 0x10000;
102pub const O_NOFOLLOW: ::c_int = 0x20000;
103
104pub const MAP_LOCKED: ::c_int = 0x02000;
105pub const MAP_NORESERVE: ::c_int = 0x04000;
106pub const MAP_32BIT: ::c_int = 0x0040;
107
108pub const EDEADLOCK: ::c_int = 35;
109
110pub const SO_PEERCRED: ::c_int = 17;
111pub const SO_RCVLOWAT: ::c_int = 18;
112pub const SO_SNDLOWAT: ::c_int = 19;
113pub const SO_RCVTIMEO: ::c_int = 20;
114pub const SO_SNDTIMEO: ::c_int = 21;
115
116pub const FIOCLEX: ::c_ulong = 0x5451;
117pub const FIONBIO: ::c_ulong = 0x5421;
118
119pub const PTRACE_GETFPREGS: ::c_uint = 14;
120pub const PTRACE_SETFPREGS: ::c_uint = 15;
121pub const PTRACE_GETFPXREGS: ::c_uint = 18;
122pub const PTRACE_SETFPXREGS: ::c_uint = 19;
123pub const PTRACE_GETREGS: ::c_uint = 12;
124pub const PTRACE_SETREGS: ::c_uint = 13;
125
126pub const SYS_gettid: ::c_long = 186;
127pub const SYS_perf_event_open: ::c_long = 298;
128
129extern {
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 @@
1pub type fsblkcnt_t = ::c_ulong;
2pub type fsfilcnt_t = ::c_ulong;
3pub type rlim_t = c_ulong;
4pub type __priority_which_t = ::c_uint;
5
6s! {
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
169pub const __UT_LINESIZE: usize = 32;
170pub const __UT_NAMESIZE: usize = 32;
171pub const __UT_HOSTSIZE: usize = 256;
172pub const EMPTY: ::c_short = 0;
173pub const RUN_LVL: ::c_short = 1;
174pub const BOOT_TIME: ::c_short = 2;
175pub const NEW_TIME: ::c_short = 3;
176pub const OLD_TIME: ::c_short = 4;
177pub const INIT_PROCESS: ::c_short = 5;
178pub const LOGIN_PROCESS: ::c_short = 6;
179pub const USER_PROCESS: ::c_short = 7;
180pub const DEAD_PROCESS: ::c_short = 8;
181pub const ACCOUNTING: ::c_short = 9;
182
183pub const RLIMIT_RSS: ::c_int = 5;
184pub const RLIMIT_NOFILE: ::c_int = 7;
185pub const RLIMIT_AS: ::c_int = 9;
186pub const RLIMIT_NPROC: ::c_int = 6;
187pub const RLIMIT_MEMLOCK: ::c_int = 8;
188pub const RLIM_INFINITY: ::rlim_t = !0;
189pub const RLIMIT_RTTIME: ::c_int = 15;
190pub const RLIMIT_NLIMITS: ::c_int = 16;
191
192pub const O_APPEND: ::c_int = 1024;
193pub const O_CREAT: ::c_int = 64;
194pub const O_EXCL: ::c_int = 128;
195pub const O_NOCTTY: ::c_int = 256;
196pub const O_NONBLOCK: ::c_int = 2048;
197pub const O_SYNC: ::c_int = 1052672;
198pub const O_RSYNC: ::c_int = 1052672;
199pub const O_DSYNC: ::c_int = 4096;
200pub const O_FSYNC: ::c_int = 0x101000;
201
202pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
203
204pub const LC_PAPER: ::c_int = 7;
205pub const LC_NAME: ::c_int = 8;
206pub const LC_ADDRESS: ::c_int = 9;
207pub const LC_TELEPHONE: ::c_int = 10;
208pub const LC_MEASUREMENT: ::c_int = 11;
209pub const LC_IDENTIFICATION: ::c_int = 12;
210pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER);
211pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
212pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
213pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
214pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
215pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
216pub 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
229pub const MAP_ANON: ::c_int = 0x0020;
230pub const MAP_ANONYMOUS: ::c_int = 0x0020;
231pub const MAP_GROWSDOWN: ::c_int = 0x0100;
232pub const MAP_DENYWRITE: ::c_int = 0x0800;
233pub const MAP_EXECUTABLE: ::c_int = 0x01000;
234pub const MAP_POPULATE: ::c_int = 0x08000;
235pub const MAP_NONBLOCK: ::c_int = 0x010000;
236pub const MAP_STACK: ::c_int = 0x020000;
237
238pub const EDEADLK: ::c_int = 35;
239pub const ENAMETOOLONG: ::c_int = 36;
240pub const ENOLCK: ::c_int = 37;
241pub const ENOSYS: ::c_int = 38;
242pub const ENOTEMPTY: ::c_int = 39;
243pub const ELOOP: ::c_int = 40;
244pub const ENOMSG: ::c_int = 42;
245pub const EIDRM: ::c_int = 43;
246pub const ECHRNG: ::c_int = 44;
247pub const EL2NSYNC: ::c_int = 45;
248pub const EL3HLT: ::c_int = 46;
249pub const EL3RST: ::c_int = 47;
250pub const ELNRNG: ::c_int = 48;
251pub const EUNATCH: ::c_int = 49;
252pub const ENOCSI: ::c_int = 50;
253pub const EL2HLT: ::c_int = 51;
254pub const EBADE: ::c_int = 52;
255pub const EBADR: ::c_int = 53;
256pub const EXFULL: ::c_int = 54;
257pub const ENOANO: ::c_int = 55;
258pub const EBADRQC: ::c_int = 56;
259pub const EBADSLT: ::c_int = 57;
260pub const EMULTIHOP: ::c_int = 72;
261pub const EOVERFLOW: ::c_int = 75;
262pub const ENOTUNIQ: ::c_int = 76;
263pub const EBADFD: ::c_int = 77;
264pub const EBADMSG: ::c_int = 74;
265pub const EREMCHG: ::c_int = 78;
266pub const ELIBACC: ::c_int = 79;
267pub const ELIBBAD: ::c_int = 80;
268pub const ELIBSCN: ::c_int = 81;
269pub const ELIBMAX: ::c_int = 82;
270pub const ELIBEXEC: ::c_int = 83;
271pub const EILSEQ: ::c_int = 84;
272pub const ERESTART: ::c_int = 85;
273pub const ESTRPIPE: ::c_int = 86;
274pub const EUSERS: ::c_int = 87;
275pub const ENOTSOCK: ::c_int = 88;
276pub const EDESTADDRREQ: ::c_int = 89;
277pub const EMSGSIZE: ::c_int = 90;
278pub const EPROTOTYPE: ::c_int = 91;
279pub const ENOPROTOOPT: ::c_int = 92;
280pub const EPROTONOSUPPORT: ::c_int = 93;
281pub const ESOCKTNOSUPPORT: ::c_int = 94;
282pub const EOPNOTSUPP: ::c_int = 95;
283pub const EPFNOSUPPORT: ::c_int = 96;
284pub const EAFNOSUPPORT: ::c_int = 97;
285pub const EADDRINUSE: ::c_int = 98;
286pub const EADDRNOTAVAIL: ::c_int = 99;
287pub const ENETDOWN: ::c_int = 100;
288pub const ENETUNREACH: ::c_int = 101;
289pub const ENETRESET: ::c_int = 102;
290pub const ECONNABORTED: ::c_int = 103;
291pub const ECONNRESET: ::c_int = 104;
292pub const ENOBUFS: ::c_int = 105;
293pub const EISCONN: ::c_int = 106;
294pub const ENOTCONN: ::c_int = 107;
295pub const ESHUTDOWN: ::c_int = 108;
296pub const ETOOMANYREFS: ::c_int = 109;
297pub const ETIMEDOUT: ::c_int = 110;
298pub const ECONNREFUSED: ::c_int = 111;
299pub const EHOSTDOWN: ::c_int = 112;
300pub const EHOSTUNREACH: ::c_int = 113;
301pub const EALREADY: ::c_int = 114;
302pub const EINPROGRESS: ::c_int = 115;
303pub const ESTALE: ::c_int = 116;
304pub const EUCLEAN: ::c_int = 117;
305pub const ENOTNAM: ::c_int = 118;
306pub const ENAVAIL: ::c_int = 119;
307pub const EISNAM: ::c_int = 120;
308pub const EREMOTEIO: ::c_int = 121;
309pub const EDQUOT: ::c_int = 122;
310pub const ENOMEDIUM: ::c_int = 123;
311pub const EMEDIUMTYPE: ::c_int = 124;
312pub const ECANCELED: ::c_int = 125;
313pub const ENOKEY: ::c_int = 126;
314pub const EKEYEXPIRED: ::c_int = 127;
315pub const EKEYREVOKED: ::c_int = 128;
316pub const EKEYREJECTED: ::c_int = 129;
317pub const EOWNERDEAD: ::c_int = 130;
318pub const ENOTRECOVERABLE: ::c_int = 131;
319pub const EHWPOISON: ::c_int = 133;
320pub const ERFKILL: ::c_int = 132;
321
322pub const SOCK_STREAM: ::c_int = 1;
323pub const SOCK_DGRAM: ::c_int = 2;
324pub const SOCK_SEQPACKET: ::c_int = 5;
325
326pub const SOL_SOCKET: ::c_int = 1;
327
328pub const SO_REUSEADDR: ::c_int = 2;
329pub const SO_TYPE: ::c_int = 3;
330pub const SO_ERROR: ::c_int = 4;
331pub const SO_DONTROUTE: ::c_int = 5;
332pub const SO_BROADCAST: ::c_int = 6;
333pub const SO_SNDBUF: ::c_int = 7;
334pub const SO_RCVBUF: ::c_int = 8;
335pub const SO_KEEPALIVE: ::c_int = 9;
336pub const SO_OOBINLINE: ::c_int = 10;
337pub const SO_LINGER: ::c_int = 13;
338pub const SO_REUSEPORT: ::c_int = 15;
339pub const SO_ACCEPTCONN: ::c_int = 30;
340
341pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
342pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
343pub const TCP_THIN_DUPACK: ::c_int = 17;
344pub const TCP_USER_TIMEOUT: ::c_int = 18;
345pub const TCP_REPAIR: ::c_int = 19;
346pub const TCP_REPAIR_QUEUE: ::c_int = 20;
347pub const TCP_QUEUE_SEQ: ::c_int = 21;
348pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
349pub const TCP_FASTOPEN: ::c_int = 23;
350pub const TCP_TIMESTAMP: ::c_int = 24;
351
352pub const SA_ONSTACK: ::c_int = 0x08000000;
353pub const SA_SIGINFO: ::c_int = 0x00000004;
354pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
355
356pub const SIGCHLD: ::c_int = 17;
357pub const SIGBUS: ::c_int = 7;
358pub const SIGUSR1: ::c_int = 10;
359pub const SIGUSR2: ::c_int = 12;
360pub const SIGCONT: ::c_int = 18;
361pub const SIGSTOP: ::c_int = 19;
362pub const SIGTSTP: ::c_int = 20;
363pub const SIGURG: ::c_int = 23;
364pub const SIGIO: ::c_int = 29;
365pub const SIGSYS: ::c_int = 31;
366pub const SIGSTKFLT: ::c_int = 16;
367pub const SIGUNUSED: ::c_int = 31;
368pub const SIGTTIN: ::c_int = 21;
369pub const SIGTTOU: ::c_int = 22;
370pub const SIGXCPU: ::c_int = 24;
371pub const SIGXFSZ: ::c_int = 25;
372pub const SIGVTALRM: ::c_int = 26;
373pub const SIGPROF: ::c_int = 27;
374pub const SIGWINCH: ::c_int = 28;
375pub const SIGPOLL: ::c_int = 29;
376pub const SIGPWR: ::c_int = 30;
377pub const SIG_SETMASK: ::c_int = 2;
378pub const SIG_BLOCK: ::c_int = 0x000000;
379pub const SIG_UNBLOCK: ::c_int = 0x01;
380
381pub const POLLRDNORM: ::c_short = 0x040;
382pub const POLLWRNORM: ::c_short = 0x100;
383pub const POLLRDBAND: ::c_short = 0x080;
384pub const POLLWRBAND: ::c_short = 0x200;
385
386pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
387pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
388
389pub const BUFSIZ: ::c_uint = 8192;
390pub const TMP_MAX: ::c_uint = 238328;
391pub const FOPEN_MAX: ::c_uint = 16;
392pub const POSIX_MADV_DONTNEED: ::c_int = 4;
393pub const _SC_2_C_VERSION: ::c_int = 96;
394pub const RUSAGE_THREAD: ::c_int = 1;
395pub const O_ACCMODE: ::c_int = 3;
396pub const O_ASYNC: ::c_int = 0x2000;
397pub const O_NDELAY: ::c_int = 0x800;
398pub const RUSAGE_CHILDREN: ::c_int = -1;
399pub const ST_RELATIME: ::c_ulong = 4096;
400pub const NI_MAXHOST: ::socklen_t = 1025;
401
402pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
403pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
404pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
405pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
406pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
407pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
408pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
409pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
410pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
411pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
412pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
413pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
414pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
415pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
416pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
417pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
418pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
419pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
420pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
421pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
422pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
423pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
424pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
425pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
426pub const TMPFS_MAGIC: ::c_long = 0x01021994;
427pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
428
429pub const VEOF: usize = 4;
430pub const VEOL: usize = 11;
431pub const VEOL2: usize = 16;
432pub const VMIN: usize = 6;
433pub const IEXTEN: ::tcflag_t = 0x00008000;
434pub const TOSTOP: ::tcflag_t = 0x00000100;
435pub const FLUSHO: ::tcflag_t = 0x00001000;
436pub const IUTF8: ::tcflag_t = 0x00004000;
437
438pub const CPU_SETSIZE: ::c_int = 0x400;
439
440pub const EXTPROC: ::tcflag_t = 0x00010000;
441
442pub const QFMT_VFS_V1: ::c_int = 4;
443
444pub const PTRACE_TRACEME: ::c_uint = 0;
445pub const PTRACE_PEEKTEXT: ::c_uint = 1;
446pub const PTRACE_PEEKDATA: ::c_uint = 2;
447pub const PTRACE_PEEKUSER: ::c_uint = 3;
448pub const PTRACE_POKETEXT: ::c_uint = 4;
449pub const PTRACE_POKEDATA: ::c_uint = 5;
450pub const PTRACE_POKEUSER: ::c_uint = 6;
451pub const PTRACE_CONT: ::c_uint = 7;
452pub const PTRACE_KILL: ::c_uint = 8;
453pub const PTRACE_SINGLESTEP: ::c_uint = 9;
454pub const PTRACE_ATTACH: ::c_uint = 16;
455pub const PTRACE_DETACH: ::c_uint = 17;
456pub const PTRACE_SYSCALL: ::c_uint = 24;
457pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
458pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
459pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
460pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
461pub const PTRACE_GETREGSET: ::c_uint = 0x4204;
462pub const PTRACE_SETREGSET: ::c_uint = 0x4205;
463pub const PTRACE_SEIZE: ::c_uint = 0x4206;
464pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
465pub const PTRACE_LISTEN: ::c_uint = 0x4208;
466pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
467
468pub const MADV_DODUMP: ::c_int = 17;
469pub const MADV_DONTDUMP: ::c_int = 16;
470
471pub const EPOLLWAKEUP: ::c_int = 0x20000000;
472
473pub const MADV_HUGEPAGE: ::c_int = 14;
474pub const MADV_NOHUGEPAGE: ::c_int = 15;
475pub const MAP_HUGETLB: ::c_int = 0x040000;
476
477pub const EFD_NONBLOCK: ::c_int = 0x800;
478
479pub const F_GETLK: ::c_int = 5;
480pub const F_GETOWN: ::c_int = 9;
481pub const F_SETOWN: ::c_int = 8;
482pub const F_SETLK: ::c_int = 6;
483pub const F_SETLKW: ::c_int = 7;
484
485pub const SEEK_DATA: ::c_int = 3;
486pub const SEEK_HOLE: ::c_int = 4;
487
488pub const SFD_NONBLOCK: ::c_int = 0x0800;
489
490pub const TCSANOW: ::c_int = 0;
491pub const TCSADRAIN: ::c_int = 1;
492pub const TCSAFLUSH: ::c_int = 2;
493
494pub const TCGETS: ::c_ulong = 0x5401;
495pub const TCSETS: ::c_ulong = 0x5402;
496pub const TCSETSW: ::c_ulong = 0x5403;
497pub const TCSETSF: ::c_ulong = 0x5404;
498pub const TCGETA: ::c_ulong = 0x5405;
499pub const TCSETA: ::c_ulong = 0x5406;
500pub const TCSETAW: ::c_ulong = 0x5407;
501pub const TCSETAF: ::c_ulong = 0x5408;
502pub const TCSBRK: ::c_ulong = 0x5409;
503pub const TCXONC: ::c_ulong = 0x540A;
504pub const TCFLSH: ::c_ulong = 0x540B;
505pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
506pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
507pub const TIOCINQ: ::c_ulong = 0x541B;
508pub const TIOCLINUX: ::c_ulong = 0x541C;
509pub const TIOCGSERIAL: ::c_ulong = 0x541E;
510pub const TIOCEXCL: ::c_ulong = 0x540C;
511pub const TIOCNXCL: ::c_ulong = 0x540D;
512pub const TIOCSCTTY: ::c_ulong = 0x540E;
513pub const TIOCGPGRP: ::c_ulong = 0x540F;
514pub const TIOCSPGRP: ::c_ulong = 0x5410;
515pub const TIOCOUTQ: ::c_ulong = 0x5411;
516pub const TIOCSTI: ::c_ulong = 0x5412;
517pub const TIOCGWINSZ: ::c_ulong = 0x5413;
518pub const TIOCSWINSZ: ::c_ulong = 0x5414;
519pub const TIOCMGET: ::c_ulong = 0x5415;
520pub const TIOCMBIS: ::c_ulong = 0x5416;
521pub const TIOCMBIC: ::c_ulong = 0x5417;
522pub const TIOCMSET: ::c_ulong = 0x5418;
523pub const FIONREAD: ::c_ulong = 0x541B;
524pub const TIOCCONS: ::c_ulong = 0x541D;
525
526pub const RTLD_DEEPBIND: ::c_int = 0x8;
527pub const RTLD_GLOBAL: ::c_int = 0x100;
528pub const RTLD_NOLOAD: ::c_int = 0x4;
529
530pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
531pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
532pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
533pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
534pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
535
536pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
537pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
538pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
539pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
540pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
541pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
542pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
543pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
544
545cfg_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
554extern {
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")]
565extern {
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
602cfg_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 @@
1use dox::mem;
2
3pub type sa_family_t = u16;
4pub type pthread_key_t = ::c_uint;
5pub type speed_t = ::c_uint;
6pub type tcflag_t = ::c_uint;
7pub type loff_t = ::c_longlong;
8pub type clockid_t = ::c_int;
9pub type id_t = ::c_uint;
10
11pub enum timezone {}
12
13s! {
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
166cfg_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
176pub const EXIT_FAILURE: ::c_int = 1;
177pub const EXIT_SUCCESS: ::c_int = 0;
178pub const RAND_MAX: ::c_int = 2147483647;
179pub const EOF: ::c_int = -1;
180pub const SEEK_SET: ::c_int = 0;
181pub const SEEK_CUR: ::c_int = 1;
182pub const SEEK_END: ::c_int = 2;
183pub const _IOFBF: ::c_int = 0;
184pub const _IONBF: ::c_int = 2;
185pub const _IOLBF: ::c_int = 1;
186
187pub const F_DUPFD: ::c_int = 0;
188pub const F_GETFD: ::c_int = 1;
189pub const F_SETFD: ::c_int = 2;
190pub const F_GETFL: ::c_int = 3;
191pub const F_SETFL: ::c_int = 4;
192
193// Linux-specific fcntls
194pub const F_SETLEASE: ::c_int = 1024;
195pub const F_GETLEASE: ::c_int = 1025;
196pub const F_NOTIFY: ::c_int = 1026;
197pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
198pub const F_SETPIPE_SZ: ::c_int = 1031;
199pub const F_GETPIPE_SZ: ::c_int = 1032;
200
201// TODO(#235): Include file sealing fcntls once we have a way to verify them.
202
203pub const SIGTRAP: ::c_int = 5;
204
205pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
206pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
207
208pub const CLOCK_REALTIME: clockid_t = 0;
209pub const CLOCK_MONOTONIC: clockid_t = 1;
210pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
211pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
212pub const CLOCK_MONOTONIC_RAW: clockid_t = 4;
213pub const CLOCK_REALTIME_COARSE: clockid_t = 5;
214pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
215pub const CLOCK_BOOTTIME: clockid_t = 7;
216pub const CLOCK_REALTIME_ALARM: clockid_t = 8;
217pub 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;
222pub const TIMER_ABSTIME: ::c_int = 1;
223
224pub const RLIMIT_CPU: ::c_int = 0;
225pub const RLIMIT_FSIZE: ::c_int = 1;
226pub const RLIMIT_DATA: ::c_int = 2;
227pub const RLIMIT_STACK: ::c_int = 3;
228pub const RLIMIT_CORE: ::c_int = 4;
229pub const RLIMIT_LOCKS: ::c_int = 10;
230pub const RLIMIT_SIGPENDING: ::c_int = 11;
231pub const RLIMIT_MSGQUEUE: ::c_int = 12;
232pub const RLIMIT_NICE: ::c_int = 13;
233pub const RLIMIT_RTPRIO: ::c_int = 14;
234
235pub const RUSAGE_SELF: ::c_int = 0;
236
237pub const O_RDONLY: ::c_int = 0;
238pub const O_WRONLY: ::c_int = 1;
239pub const O_RDWR: ::c_int = 2;
240pub const O_TRUNC: ::c_int = 512;
241pub const O_CLOEXEC: ::c_int = 0x80000;
242
243pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
244
245pub const S_IFIFO: ::mode_t = 4096;
246pub const S_IFCHR: ::mode_t = 8192;
247pub const S_IFBLK: ::mode_t = 24576;
248pub const S_IFDIR: ::mode_t = 16384;
249pub const S_IFREG: ::mode_t = 32768;
250pub const S_IFLNK: ::mode_t = 40960;
251pub const S_IFSOCK: ::mode_t = 49152;
252pub const S_IFMT: ::mode_t = 61440;
253pub const S_IRWXU: ::mode_t = 448;
254pub const S_IXUSR: ::mode_t = 64;
255pub const S_IWUSR: ::mode_t = 128;
256pub const S_IRUSR: ::mode_t = 256;
257pub const S_IRWXG: ::mode_t = 56;
258pub const S_IXGRP: ::mode_t = 8;
259pub const S_IWGRP: ::mode_t = 16;
260pub const S_IRGRP: ::mode_t = 32;
261pub const S_IRWXO: ::mode_t = 7;
262pub const S_IXOTH: ::mode_t = 1;
263pub const S_IWOTH: ::mode_t = 2;
264pub const S_IROTH: ::mode_t = 4;
265pub const F_OK: ::c_int = 0;
266pub const R_OK: ::c_int = 4;
267pub const W_OK: ::c_int = 2;
268pub const X_OK: ::c_int = 1;
269pub const STDIN_FILENO: ::c_int = 0;
270pub const STDOUT_FILENO: ::c_int = 1;
271pub const STDERR_FILENO: ::c_int = 2;
272pub const SIGHUP: ::c_int = 1;
273pub const SIGINT: ::c_int = 2;
274pub const SIGQUIT: ::c_int = 3;
275pub const SIGILL: ::c_int = 4;
276pub const SIGABRT: ::c_int = 6;
277pub const SIGFPE: ::c_int = 8;
278pub const SIGKILL: ::c_int = 9;
279pub const SIGSEGV: ::c_int = 11;
280pub const SIGPIPE: ::c_int = 13;
281pub const SIGALRM: ::c_int = 14;
282pub const SIGTERM: ::c_int = 15;
283
284pub const PROT_NONE: ::c_int = 0;
285pub const PROT_READ: ::c_int = 1;
286pub const PROT_WRITE: ::c_int = 2;
287pub const PROT_EXEC: ::c_int = 4;
288
289pub const LC_CTYPE: ::c_int = 0;
290pub const LC_NUMERIC: ::c_int = 1;
291pub const LC_TIME: ::c_int = 2;
292pub const LC_COLLATE: ::c_int = 3;
293pub const LC_MONETARY: ::c_int = 4;
294pub const LC_MESSAGES: ::c_int = 5;
295pub const LC_ALL: ::c_int = 6;
296pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
297pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
298pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
299pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
300pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
301pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
302// LC_ALL_MASK defined per platform
303
304pub const MAP_FILE: ::c_int = 0x0000;
305pub const MAP_SHARED: ::c_int = 0x0001;
306pub const MAP_PRIVATE: ::c_int = 0x0002;
307pub const MAP_FIXED: ::c_int = 0x0010;
308
309pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
310
311pub const MCL_CURRENT: ::c_int = 0x0001;
312pub const MCL_FUTURE: ::c_int = 0x0002;
313
314// MS_ flags for msync(2)
315pub const MS_ASYNC: ::c_int = 0x0001;
316pub const MS_INVALIDATE: ::c_int = 0x0002;
317pub const MS_SYNC: ::c_int = 0x0004;
318
319// MS_ flags for mount(2)
320pub const MS_RDONLY: ::c_ulong = 0x01;
321pub const MS_NOSUID: ::c_ulong = 0x02;
322pub const MS_NODEV: ::c_ulong = 0x04;
323pub const MS_NOEXEC: ::c_ulong = 0x08;
324pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
325pub const MS_REMOUNT: ::c_ulong = 0x20;
326pub const MS_MANDLOCK: ::c_ulong = 0x40;
327pub const MS_DIRSYNC: ::c_ulong = 0x80;
328pub const MS_NOATIME: ::c_ulong = 0x0400;
329pub const MS_NODIRATIME: ::c_ulong = 0x0800;
330pub const MS_BIND: ::c_ulong = 0x1000;
331pub const MS_MOVE: ::c_ulong = 0x2000;
332pub const MS_REC: ::c_ulong = 0x4000;
333pub const MS_SILENT: ::c_ulong = 0x8000;
334pub const MS_POSIXACL: ::c_ulong = 0x010000;
335pub const MS_UNBINDABLE: ::c_ulong = 0x020000;
336pub const MS_PRIVATE: ::c_ulong = 0x040000;
337pub const MS_SLAVE: ::c_ulong = 0x080000;
338pub const MS_SHARED: ::c_ulong = 0x100000;
339pub const MS_RELATIME: ::c_ulong = 0x200000;
340pub const MS_KERNMOUNT: ::c_ulong = 0x400000;
341pub const MS_I_VERSION: ::c_ulong = 0x800000;
342pub const MS_STRICTATIME: ::c_ulong = 0x1000000;
343pub const MS_ACTIVE: ::c_ulong = 0x40000000;
344pub const MS_NOUSER: ::c_ulong = 0x80000000;
345pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
346pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
347pub const MS_RMT_MASK: ::c_ulong = 0x800051;
348
349pub const EPERM: ::c_int = 1;
350pub const ENOENT: ::c_int = 2;
351pub const ESRCH: ::c_int = 3;
352pub const EINTR: ::c_int = 4;
353pub const EIO: ::c_int = 5;
354pub const ENXIO: ::c_int = 6;
355pub const E2BIG: ::c_int = 7;
356pub const ENOEXEC: ::c_int = 8;
357pub const EBADF: ::c_int = 9;
358pub const ECHILD: ::c_int = 10;
359pub const EAGAIN: ::c_int = 11;
360pub const ENOMEM: ::c_int = 12;
361pub const EACCES: ::c_int = 13;
362pub const EFAULT: ::c_int = 14;
363pub const ENOTBLK: ::c_int = 15;
364pub const EBUSY: ::c_int = 16;
365pub const EEXIST: ::c_int = 17;
366pub const EXDEV: ::c_int = 18;
367pub const ENODEV: ::c_int = 19;
368pub const ENOTDIR: ::c_int = 20;
369pub const EISDIR: ::c_int = 21;
370pub const EINVAL: ::c_int = 22;
371pub const ENFILE: ::c_int = 23;
372pub const EMFILE: ::c_int = 24;
373pub const ENOTTY: ::c_int = 25;
374pub const ETXTBSY: ::c_int = 26;
375pub const EFBIG: ::c_int = 27;
376pub const ENOSPC: ::c_int = 28;
377pub const ESPIPE: ::c_int = 29;
378pub const EROFS: ::c_int = 30;
379pub const EMLINK: ::c_int = 31;
380pub const EPIPE: ::c_int = 32;
381pub const EDOM: ::c_int = 33;
382pub const ERANGE: ::c_int = 34;
383pub const EWOULDBLOCK: ::c_int = EAGAIN;
384
385pub const EBFONT: ::c_int = 59;
386pub const ENOSTR: ::c_int = 60;
387pub const ENODATA: ::c_int = 61;
388pub const ETIME: ::c_int = 62;
389pub const ENOSR: ::c_int = 63;
390pub const ENONET: ::c_int = 64;
391pub const ENOPKG: ::c_int = 65;
392pub const EREMOTE: ::c_int = 66;
393pub const ENOLINK: ::c_int = 67;
394pub const EADV: ::c_int = 68;
395pub const ESRMNT: ::c_int = 69;
396pub const ECOMM: ::c_int = 70;
397pub const EPROTO: ::c_int = 71;
398pub const EDOTDOT: ::c_int = 73;
399
400pub const AF_PACKET: ::c_int = 17;
401pub const IPPROTO_RAW: ::c_int = 255;
402
403pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
404pub const PROT_GROWSUP: ::c_int = 0x2000000;
405
406pub const MAP_TYPE: ::c_int = 0x000f;
407
408pub const MADV_NORMAL: ::c_int = 0;
409pub const MADV_RANDOM: ::c_int = 1;
410pub const MADV_SEQUENTIAL: ::c_int = 2;
411pub const MADV_WILLNEED: ::c_int = 3;
412pub const MADV_DONTNEED: ::c_int = 4;
413pub const MADV_REMOVE: ::c_int = 9;
414pub const MADV_DONTFORK: ::c_int = 10;
415pub const MADV_DOFORK: ::c_int = 11;
416pub const MADV_MERGEABLE: ::c_int = 12;
417pub const MADV_UNMERGEABLE: ::c_int = 13;
418pub const MADV_HWPOISON: ::c_int = 100;
419
420pub const IFF_LOOPBACK: ::c_int = 0x8;
421
422pub const AF_UNIX: ::c_int = 1;
423pub const AF_INET: ::c_int = 2;
424pub const AF_INET6: ::c_int = 10;
425pub const SOCK_RAW: ::c_int = 3;
426pub const IPPROTO_TCP: ::c_int = 6;
427pub const IPPROTO_IP: ::c_int = 0;
428pub const IPPROTO_IPV6: ::c_int = 41;
429pub const IP_MULTICAST_TTL: ::c_int = 33;
430pub const IP_MULTICAST_LOOP: ::c_int = 34;
431pub const IP_TTL: ::c_int = 2;
432pub const IP_HDRINCL: ::c_int = 3;
433pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
434pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
435pub const IP_TRANSPARENT: ::c_int = 19;
436pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
437pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
438
439pub const TCP_NODELAY: ::c_int = 1;
440pub const TCP_MAXSEG: ::c_int = 2;
441pub const TCP_CORK: ::c_int = 3;
442pub const TCP_KEEPIDLE: ::c_int = 4;
443pub const TCP_KEEPINTVL: ::c_int = 5;
444pub const TCP_KEEPCNT: ::c_int = 6;
445pub const TCP_SYNCNT: ::c_int = 7;
446pub const TCP_LINGER2: ::c_int = 8;
447pub const TCP_DEFER_ACCEPT: ::c_int = 9;
448pub const TCP_WINDOW_CLAMP: ::c_int = 10;
449pub const TCP_INFO: ::c_int = 11;
450pub const TCP_QUICKACK: ::c_int = 12;
451pub const TCP_CONGESTION: ::c_int = 13;
452
453pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
454pub const IPV6_V6ONLY: ::c_int = 26;
455
456pub const SO_DEBUG: ::c_int = 1;
457
458pub const SHUT_RD: ::c_int = 0;
459pub const SHUT_WR: ::c_int = 1;
460pub const SHUT_RDWR: ::c_int = 2;
461
462pub const LOCK_SH: ::c_int = 1;
463pub const LOCK_EX: ::c_int = 2;
464pub const LOCK_NB: ::c_int = 4;
465pub const LOCK_UN: ::c_int = 8;
466
467pub const SIGSTKSZ: ::size_t = 8192;
468
469pub const SA_NODEFER: ::c_int = 0x40000000;
470pub const SA_RESETHAND: ::c_int = 0x80000000;
471pub const SA_RESTART: ::c_int = 0x10000000;
472pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
473
474pub const SS_ONSTACK: ::c_int = 1;
475pub const SS_DISABLE: ::c_int = 2;
476
477pub const PATH_MAX: ::c_int = 4096;
478
479pub const FD_SETSIZE: usize = 1024;
480
481pub const EPOLLIN: ::c_int = 0x1;
482pub const EPOLLPRI: ::c_int = 0x2;
483pub const EPOLLOUT: ::c_int = 0x4;
484pub const EPOLLRDNORM: ::c_int = 0x40;
485pub const EPOLLRDBAND: ::c_int = 0x80;
486pub const EPOLLWRNORM: ::c_int = 0x100;
487pub const EPOLLWRBAND: ::c_int = 0x200;
488pub const EPOLLMSG: ::c_int = 0x400;
489pub const EPOLLERR: ::c_int = 0x8;
490pub const EPOLLHUP: ::c_int = 0x10;
491pub const EPOLLET: ::c_int = 0x80000000;
492
493pub const EPOLL_CTL_ADD: ::c_int = 1;
494pub const EPOLL_CTL_MOD: ::c_int = 3;
495pub const EPOLL_CTL_DEL: ::c_int = 2;
496
497pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
498
499pub const MNT_DETACH: ::c_int = 0x2;
500pub const MNT_EXPIRE: ::c_int = 0x4;
501
502pub const Q_GETFMT: ::c_int = 0x800004;
503pub const Q_GETINFO: ::c_int = 0x800005;
504pub const Q_SETINFO: ::c_int = 0x800006;
505pub const QIF_BLIMITS: ::uint32_t = 1;
506pub const QIF_SPACE: ::uint32_t = 2;
507pub const QIF_ILIMITS: ::uint32_t = 4;
508pub const QIF_INODES: ::uint32_t = 8;
509pub const QIF_BTIME: ::uint32_t = 16;
510pub const QIF_ITIME: ::uint32_t = 32;
511pub const QIF_LIMITS: ::uint32_t = 5;
512pub const QIF_USAGE: ::uint32_t = 10;
513pub const QIF_TIMES: ::uint32_t = 48;
514pub const QIF_ALL: ::uint32_t = 63;
515
516pub const CBAUD: ::tcflag_t = 0o0010017;
517
518pub const EFD_CLOEXEC: ::c_int = 0x80000;
519
520pub const MNT_FORCE: ::c_int = 0x1;
521
522pub const Q_SYNC: ::c_int = 0x800001;
523pub const Q_QUOTAON: ::c_int = 0x800002;
524pub const Q_QUOTAOFF: ::c_int = 0x800003;
525pub const Q_GETQUOTA: ::c_int = 0x800007;
526pub const Q_SETQUOTA: ::c_int = 0x800008;
527
528pub const TCIOFF: ::c_int = 2;
529pub const TCION: ::c_int = 3;
530pub const TCOOFF: ::c_int = 0;
531pub const TCOON: ::c_int = 1;
532pub const TCIFLUSH: ::c_int = 0;
533pub const TCOFLUSH: ::c_int = 1;
534pub const TCIOFLUSH: ::c_int = 2;
535pub const NL0: ::c_int = 0x00000000;
536pub const NL1: ::c_int = 0x00000100;
537pub const TAB0: ::c_int = 0x00000000;
538pub const TAB1: ::c_int = 0x00000800;
539pub const TAB2: ::c_int = 0x00001000;
540pub const TAB3: ::c_int = 0x00001800;
541pub const CR0: ::c_int = 0x00000000;
542pub const CR1: ::c_int = 0x00000200;
543pub const CR2: ::c_int = 0x00000400;
544pub const CR3: ::c_int = 0x00000600;
545pub const FF0: ::c_int = 0x00000000;
546pub const FF1: ::c_int = 0x00008000;
547pub const BS0: ::c_int = 0x00000000;
548pub const BS1: ::c_int = 0x00002000;
549pub const VT0: ::c_int = 0x00000000;
550pub const VT1: ::c_int = 0x00004000;
551pub const VERASE: usize = 2;
552pub const VWERASE: usize = 14;
553pub const VKILL: usize = 3;
554pub const VREPRINT: usize = 12;
555pub const VINTR: usize = 0;
556pub const VQUIT: usize = 1;
557pub const VSUSP: usize = 10;
558pub const VSTART: usize = 8;
559pub const VSTOP: usize = 9;
560pub const VLNEXT: usize = 15;
561pub const VDISCARD: usize = 13;
562pub const VTIME: usize = 5;
563pub const IGNBRK: ::tcflag_t = 0x00000001;
564pub const BRKINT: ::tcflag_t = 0x00000002;
565pub const IGNPAR: ::tcflag_t = 0x00000004;
566pub const PARMRK: ::tcflag_t = 0x00000008;
567pub const INPCK: ::tcflag_t = 0x00000010;
568pub const ISTRIP: ::tcflag_t = 0x00000020;
569pub const INLCR: ::tcflag_t = 0x00000040;
570pub const IGNCR: ::tcflag_t = 0x00000080;
571pub const ICRNL: ::tcflag_t = 0x00000100;
572pub const IXON: ::tcflag_t = 0x00000400;
573pub const IXOFF: ::tcflag_t = 0x00001000;
574pub const IXANY: ::tcflag_t = 0x00000800;
575pub const IMAXBEL: ::tcflag_t = 0x00002000;
576pub const OPOST: ::tcflag_t = 0x1;
577pub const ONLCR: ::tcflag_t = 0x4;
578pub const CSIZE: ::tcflag_t = 0x00000030;
579pub const CS5: ::tcflag_t = 0x00000000;
580pub const CS6: ::tcflag_t = 0x00000010;
581pub const CS7: ::tcflag_t = 0x00000020;
582pub const CS8: ::tcflag_t = 0x00000030;
583pub const CSTOPB: ::tcflag_t = 0x00000040;
584pub const CREAD: ::tcflag_t = 0x00000080;
585pub const PARENB: ::tcflag_t = 0x00000100;
586pub const PARODD: ::tcflag_t = 0x00000200;
587pub const HUPCL: ::tcflag_t = 0x00000400;
588pub const CLOCAL: ::tcflag_t = 0x00000800;
589pub const CRTSCTS: ::tcflag_t = 0x80000000;
590pub const ECHOKE: ::tcflag_t = 0x00000800;
591pub const ECHOE: ::tcflag_t = 0x00000010;
592pub const ECHOK: ::tcflag_t = 0x00000020;
593pub const ECHO: ::tcflag_t = 0x00000008;
594pub const ECHONL: ::tcflag_t = 0x00000040;
595pub const ECHOPRT: ::tcflag_t = 0x00000400;
596pub const ECHOCTL: ::tcflag_t = 0x00000200;
597pub const ISIG: ::tcflag_t = 0x00000001;
598pub const ICANON: ::tcflag_t = 0x00000002;
599pub const PENDIN: ::tcflag_t = 0x00004000;
600pub const NOFLSH: ::tcflag_t = 0x00000080;
601
602pub const CLONE_VM: ::c_int = 0x100;
603pub const CLONE_FS: ::c_int = 0x200;
604pub const CLONE_FILES: ::c_int = 0x400;
605pub const CLONE_SIGHAND: ::c_int = 0x800;
606pub const CLONE_PTRACE: ::c_int = 0x2000;
607pub const CLONE_VFORK: ::c_int = 0x4000;
608pub const CLONE_PARENT: ::c_int = 0x8000;
609pub const CLONE_THREAD: ::c_int = 0x10000;
610pub const CLONE_NEWNS: ::c_int = 0x20000;
611pub const CLONE_SYSVSEM: ::c_int = 0x40000;
612pub const CLONE_SETTLS: ::c_int = 0x80000;
613pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
614pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
615pub const CLONE_DETACHED: ::c_int = 0x400000;
616pub const CLONE_UNTRACED: ::c_int = 0x800000;
617pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
618pub const CLONE_NEWUTS: ::c_int = 0x04000000;
619pub const CLONE_NEWIPC: ::c_int = 0x08000000;
620pub const CLONE_NEWUSER: ::c_int = 0x10000000;
621pub const CLONE_NEWPID: ::c_int = 0x20000000;
622pub const CLONE_NEWNET: ::c_int = 0x40000000;
623pub const CLONE_IO: ::c_int = 0x80000000;
624
625pub const WNOHANG: ::c_int = 0x00000001;
626pub const WUNTRACED: ::c_int = 0x00000002;
627pub const WSTOPPED: ::c_int = WUNTRACED;
628pub const WEXITED: ::c_int = 0x00000004;
629pub const WCONTINUED: ::c_int = 0x00000008;
630pub const WNOWAIT: ::c_int = 0x01000000;
631
632pub const __WNOTHREAD: ::c_int = 0x20000000;
633pub const __WALL: ::c_int = 0x40000000;
634pub const __WCLONE: ::c_int = 0x80000000;
635
636pub const SPLICE_F_MOVE: ::c_uint = 0x01;
637pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
638pub const SPLICE_F_MORE: ::c_uint = 0x04;
639pub const SPLICE_F_GIFT: ::c_uint = 0x08;
640
641pub const RTLD_LOCAL: ::c_int = 0;
642
643pub const POSIX_FADV_NORMAL: ::c_int = 0;
644pub const POSIX_FADV_RANDOM: ::c_int = 1;
645pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
646pub const POSIX_FADV_WILLNEED: ::c_int = 3;
647pub const POSIX_FADV_DONTNEED: ::c_int = 4;
648pub const POSIX_FADV_NOREUSE: ::c_int = 5;
649
650pub const AT_FDCWD: ::c_int = -100;
651pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
652
653pub const LOG_CRON: ::c_int = 9 << 3;
654pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
655pub const LOG_FTP: ::c_int = 11 << 3;
656pub const LOG_PERROR: ::c_int = 0x20;
657
658pub const PIPE_BUF: usize = 4096;
659
660pub const SI_LOAD_SHIFT: ::c_uint = 16;
661
662f! {
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
718extern {
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
871cfg_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 @@
1pub type c_char = i8;
2pub type c_long = i64;
3pub type c_ulong = u64;
4pub type clockid_t = ::c_int;
5
6pub type blkcnt_t = i64;
7pub type clock_t = i64;
8pub type daddr_t = i64;
9pub type dev_t = u64;
10pub type fsblkcnt_t = u64;
11pub type fsfilcnt_t = u64;
12pub type ino_t = i64;
13pub type key_t = i32;
14pub type major_t = u32;
15pub type minor_t = u32;
16pub type mode_t = u32;
17pub type nlink_t = u32;
18pub type rlim_t = u64;
19pub type speed_t = u32;
20pub type tcflag_t = u32;
21pub type time_t = i64;
22pub type wchar_t = i32;
23pub type nfds_t = ::c_ulong;
24
25pub type suseconds_t = ::c_long;
26pub type off_t = i64;
27pub type useconds_t = ::c_uint;
28pub type socklen_t = u32;
29pub type sa_family_t = u8;
30pub type pthread_t = ::uintptr_t;
31pub type pthread_key_t = ::c_uint;
32pub type blksize_t = u32;
33pub type fflags_t = u32;
34pub type nl_item = ::c_int;
35
36pub enum timezone {}
37
38s! {
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
332pub const LC_CTYPE: ::c_int = 0;
333pub const LC_NUMERIC: ::c_int = 1;
334pub const LC_TIME: ::c_int = 2;
335pub const LC_COLLATE: ::c_int = 3;
336pub const LC_MONETARY: ::c_int = 4;
337pub const LC_MESSAGES: ::c_int = 5;
338pub const LC_ALL: ::c_int = 6;
339pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
340pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
341pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
342pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
343pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
344pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
345pub 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
352pub const DAY_1: ::nl_item = 1;
353pub const DAY_2: ::nl_item = 2;
354pub const DAY_3: ::nl_item = 3;
355pub const DAY_4: ::nl_item = 4;
356pub const DAY_5: ::nl_item = 5;
357pub const DAY_6: ::nl_item = 6;
358pub const DAY_7: ::nl_item = 7;
359
360pub const ABDAY_1: ::nl_item = 8;
361pub const ABDAY_2: ::nl_item = 9;
362pub const ABDAY_3: ::nl_item = 10;
363pub const ABDAY_4: ::nl_item = 11;
364pub const ABDAY_5: ::nl_item = 12;
365pub const ABDAY_6: ::nl_item = 13;
366pub const ABDAY_7: ::nl_item = 14;
367
368pub const MON_1: ::nl_item = 15;
369pub const MON_2: ::nl_item = 16;
370pub const MON_3: ::nl_item = 17;
371pub const MON_4: ::nl_item = 18;
372pub const MON_5: ::nl_item = 19;
373pub const MON_6: ::nl_item = 20;
374pub const MON_7: ::nl_item = 21;
375pub const MON_8: ::nl_item = 22;
376pub const MON_9: ::nl_item = 23;
377pub const MON_10: ::nl_item = 24;
378pub const MON_11: ::nl_item = 25;
379pub const MON_12: ::nl_item = 26;
380
381pub const ABMON_1: ::nl_item = 27;
382pub const ABMON_2: ::nl_item = 28;
383pub const ABMON_3: ::nl_item = 29;
384pub const ABMON_4: ::nl_item = 30;
385pub const ABMON_5: ::nl_item = 31;
386pub const ABMON_6: ::nl_item = 32;
387pub const ABMON_7: ::nl_item = 33;
388pub const ABMON_8: ::nl_item = 34;
389pub const ABMON_9: ::nl_item = 35;
390pub const ABMON_10: ::nl_item = 36;
391pub const ABMON_11: ::nl_item = 37;
392pub const ABMON_12: ::nl_item = 38;
393
394pub const RADIXCHAR: ::nl_item = 39;
395pub const THOUSEP: ::nl_item = 40;
396pub const YESSTR: ::nl_item = 41;
397pub const NOSTR: ::nl_item = 42;
398pub const CRNCYSTR: ::nl_item = 43;
399
400pub const D_T_FMT: ::nl_item = 44;
401pub const D_FMT: ::nl_item = 45;
402pub const T_FMT: ::nl_item = 46;
403pub const AM_STR: ::nl_item = 47;
404pub const PM_STR: ::nl_item = 48;
405
406pub const CODESET: ::nl_item = 49;
407pub const T_FMT_AMPM: ::nl_item = 50;
408pub const ERA: ::nl_item = 51;
409pub const ERA_D_FMT: ::nl_item = 52;
410pub const ERA_D_T_FMT: ::nl_item = 53;
411pub const ERA_T_FMT: ::nl_item = 54;
412pub const ALT_DIGITS: ::nl_item = 55;
413pub const YESEXPR: ::nl_item = 56;
414pub const NOEXPR: ::nl_item = 57;
415pub const _DATE_FMT: ::nl_item = 58;
416pub const MAXSTRMSG: ::nl_item = 58;
417
418pub const PATH_MAX: ::c_int = 1024;
419
420pub const SA_ONSTACK: ::c_int = 0x00000001;
421pub const SA_RESETHAND: ::c_int = 0x00000002;
422pub const SA_RESTART: ::c_int = 0x00000004;
423pub const SA_SIGINFO: ::c_int = 0x00000008;
424pub const SA_NODEFER: ::c_int = 0x00000010;
425pub const SA_NOCLDWAIT: ::c_int = 0x00010000;
426pub const SA_NOCLDSTOP: ::c_int = 0x00020000;
427
428pub const SS_ONSTACK: ::c_int = 1;
429pub const SS_DISABLE: ::c_int = 2;
430
431pub const FIONBIO: ::c_int = 0x8004667e;
432
433pub const SIGCHLD: ::c_int = 18;
434pub const SIGBUS: ::c_int = 10;
435pub const SIG_BLOCK: ::c_int = 1;
436pub const SIG_UNBLOCK: ::c_int = 2;
437pub const SIG_SETMASK: ::c_int = 3;
438
439pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8;
440pub const IPV6_V6ONLY: ::c_int = 0x27;
441
442pub const FD_SETSIZE: usize = 1024;
443
444pub const ST_RDONLY: ::c_ulong = 1;
445pub const ST_NOSUID: ::c_ulong = 2;
446
447pub const NI_MAXHOST: ::socklen_t = 1025;
448
449pub const EXIT_FAILURE: ::c_int = 1;
450pub const EXIT_SUCCESS: ::c_int = 0;
451pub const RAND_MAX: ::c_int = 32767;
452pub const EOF: ::c_int = -1;
453pub const SEEK_SET: ::c_int = 0;
454pub const SEEK_CUR: ::c_int = 1;
455pub const SEEK_END: ::c_int = 2;
456pub const _IOFBF: ::c_int = 0;
457pub const _IONBF: ::c_int = 4;
458pub const _IOLBF: ::c_int = 64;
459pub const BUFSIZ: ::c_uint = 1024;
460pub const FOPEN_MAX: ::c_uint = 20;
461pub const FILENAME_MAX: ::c_uint = 1024;
462pub const L_tmpnam: ::c_uint = 25;
463pub const TMP_MAX: ::c_uint = 17576;
464
465pub const O_RDONLY: ::c_int = 0;
466pub const O_WRONLY: ::c_int = 1;
467pub const O_RDWR: ::c_int = 2;
468pub const O_APPEND: ::c_int = 8;
469pub const O_CREAT: ::c_int = 256;
470pub const O_EXCL: ::c_int = 1024;
471pub const O_NOCTTY: ::c_int = 2048;
472pub const O_TRUNC: ::c_int = 512;
473pub const O_CLOEXEC: ::c_int = 0x800000;
474pub const O_ACCMODE: ::c_int = 0x600003;
475pub const S_IFIFO: mode_t = 4096;
476pub const S_IFCHR: mode_t = 8192;
477pub const S_IFBLK: mode_t = 24576;
478pub const S_IFDIR: mode_t = 16384;
479pub const S_IFREG: mode_t = 32768;
480pub const S_IFLNK: mode_t = 40960;
481pub const S_IFSOCK: mode_t = 49152;
482pub const S_IFMT: mode_t = 61440;
483pub const S_IEXEC: mode_t = 64;
484pub const S_IWRITE: mode_t = 128;
485pub const S_IREAD: mode_t = 256;
486pub const S_IRWXU: mode_t = 448;
487pub const S_IXUSR: mode_t = 64;
488pub const S_IWUSR: mode_t = 128;
489pub const S_IRUSR: mode_t = 256;
490pub const S_IRWXG: mode_t = 56;
491pub const S_IXGRP: mode_t = 8;
492pub const S_IWGRP: mode_t = 16;
493pub const S_IRGRP: mode_t = 32;
494pub const S_IRWXO: mode_t = 7;
495pub const S_IXOTH: mode_t = 1;
496pub const S_IWOTH: mode_t = 2;
497pub const S_IROTH: mode_t = 4;
498pub const F_OK: ::c_int = 0;
499pub const R_OK: ::c_int = 4;
500pub const W_OK: ::c_int = 2;
501pub const X_OK: ::c_int = 1;
502pub const STDIN_FILENO: ::c_int = 0;
503pub const STDOUT_FILENO: ::c_int = 1;
504pub const STDERR_FILENO: ::c_int = 2;
505pub const F_LOCK: ::c_int = 1;
506pub const F_TEST: ::c_int = 3;
507pub const F_TLOCK: ::c_int = 2;
508pub const F_ULOCK: ::c_int = 0;
509pub const F_DUPFD_CLOEXEC: ::c_int = 37;
510pub const F_SETLK: ::c_int = 6;
511pub const F_SETLKW: ::c_int = 7;
512pub const F_GETLK: ::c_int = 14;
513pub const SIGHUP: ::c_int = 1;
514pub const SIGINT: ::c_int = 2;
515pub const SIGQUIT: ::c_int = 3;
516pub const SIGILL: ::c_int = 4;
517pub const SIGABRT: ::c_int = 6;
518pub const SIGEMT: ::c_int = 7;
519pub const SIGFPE: ::c_int = 8;
520pub const SIGKILL: ::c_int = 9;
521pub const SIGSEGV: ::c_int = 11;
522pub const SIGSYS: ::c_int = 12;
523pub const SIGPIPE: ::c_int = 13;
524pub const SIGALRM: ::c_int = 14;
525pub const SIGTERM: ::c_int = 15;
526pub const SIGUSR1: ::c_int = 16;
527pub const SIGUSR2: ::c_int = 17;
528pub const SIGPWR: ::c_int = 19;
529pub const SIGWINCH: ::c_int = 20;
530pub const SIGURG: ::c_int = 21;
531pub const SIGPOLL: ::c_int = 22;
532pub const SIGIO: ::c_int = SIGPOLL;
533pub const SIGSTOP: ::c_int = 23;
534pub const SIGTSTP: ::c_int = 24;
535pub const SIGCONT: ::c_int = 25;
536pub const SIGTTIN: ::c_int = 26;
537pub const SIGTTOU: ::c_int = 27;
538pub const SIGVTALRM: ::c_int = 28;
539pub const SIGPROF: ::c_int = 29;
540pub const SIGXCPU: ::c_int = 30;
541pub const SIGXFSZ: ::c_int = 31;
542
543pub const WNOHANG: ::c_int = 0x40;
544
545pub const PROT_NONE: ::c_int = 0;
546pub const PROT_READ: ::c_int = 1;
547pub const PROT_WRITE: ::c_int = 2;
548pub const PROT_EXEC: ::c_int = 4;
549
550pub const MAP_SHARED: ::c_int = 0x0001;
551pub const MAP_PRIVATE: ::c_int = 0x0002;
552pub const MAP_FIXED: ::c_int = 0x0010;
553pub const MAP_NORESERVE: ::c_int = 0x40;
554pub const MAP_ANON: ::c_int = 0x0100;
555pub const MAP_RENAME: ::c_int = 0x20;
556pub const MAP_ALIGN: ::c_int = 0x200;
557pub const MAP_TEXT: ::c_int = 0x400;
558pub const MAP_INITDATA: ::c_int = 0x800;
559pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
560
561pub const MCL_CURRENT: ::c_int = 0x0001;
562pub const MCL_FUTURE: ::c_int = 0x0002;
563
564pub const MS_SYNC: ::c_int = 0x0004;
565pub const MS_ASYNC: ::c_int = 0x0001;
566pub const MS_INVALIDATE: ::c_int = 0x0002;
567pub const MS_INVALCURPROC: ::c_int = 0x0008;
568
569pub const EPERM: ::c_int = 1;
570pub const ENOENT: ::c_int = 2;
571pub const ESRCH: ::c_int = 3;
572pub const EINTR: ::c_int = 4;
573pub const EIO: ::c_int = 5;
574pub const ENXIO: ::c_int = 6;
575pub const E2BIG: ::c_int = 7;
576pub const ENOEXEC: ::c_int = 8;
577pub const EBADF: ::c_int = 9;
578pub const ECHILD: ::c_int = 10;
579pub const EDEADLK: ::c_int = 45;
580pub const ENOMEM: ::c_int = 12;
581pub const EACCES: ::c_int = 13;
582pub const EFAULT: ::c_int = 14;
583pub const ENOTBLK: ::c_int = 15;
584pub const EBUSY: ::c_int = 16;
585pub const EEXIST: ::c_int = 17;
586pub const EXDEV: ::c_int = 18;
587pub const ENODEV: ::c_int = 19;
588pub const ENOTDIR: ::c_int = 20;
589pub const EISDIR: ::c_int = 21;
590pub const EINVAL: ::c_int = 22;
591pub const ENFILE: ::c_int = 23;
592pub const EMFILE: ::c_int = 24;
593pub const ENOTTY: ::c_int = 25;
594pub const ETXTBSY: ::c_int = 26;
595pub const EFBIG: ::c_int = 27;
596pub const ENOSPC: ::c_int = 28;
597pub const ESPIPE: ::c_int = 29;
598pub const EROFS: ::c_int = 30;
599pub const EMLINK: ::c_int = 31;
600pub const EPIPE: ::c_int = 32;
601pub const EDOM: ::c_int = 33;
602pub const ERANGE: ::c_int = 34;
603pub const EAGAIN: ::c_int = 11;
604pub const EWOULDBLOCK: ::c_int = 11;
605pub const EINPROGRESS: ::c_int = 150;
606pub const EALREADY: ::c_int = 149;
607pub const ENOTSOCK: ::c_int = 95;
608pub const EDESTADDRREQ: ::c_int = 96;
609pub const EMSGSIZE: ::c_int = 97;
610pub const EPROTOTYPE: ::c_int = 98;
611pub const ENOPROTOOPT: ::c_int = 99;
612pub const EPROTONOSUPPORT: ::c_int = 120;
613pub const ESOCKTNOSUPPORT: ::c_int = 121;
614pub const EOPNOTSUPP: ::c_int = 122;
615pub const EPFNOSUPPORT: ::c_int = 123;
616pub const EAFNOSUPPORT: ::c_int = 124;
617pub const EADDRINUSE: ::c_int = 125;
618pub const EADDRNOTAVAIL: ::c_int = 126;
619pub const ENETDOWN: ::c_int = 127;
620pub const ENETUNREACH: ::c_int = 128;
621pub const ENETRESET: ::c_int = 129;
622pub const ECONNABORTED: ::c_int = 130;
623pub const ECONNRESET: ::c_int = 131;
624pub const ENOBUFS: ::c_int = 132;
625pub const EISCONN: ::c_int = 133;
626pub const ENOTCONN: ::c_int = 134;
627pub const ESHUTDOWN: ::c_int = 143;
628pub const ETOOMANYREFS: ::c_int = 144;
629pub const ETIMEDOUT: ::c_int = 145;
630pub const ECONNREFUSED: ::c_int = 146;
631pub const ELOOP: ::c_int = 90;
632pub const ENAMETOOLONG: ::c_int = 78;
633pub const EHOSTDOWN: ::c_int = 147;
634pub const EHOSTUNREACH: ::c_int = 148;
635pub const ENOTEMPTY: ::c_int = 93;
636pub const EUSERS: ::c_int = 94;
637pub const EDQUOT: ::c_int = 49;
638pub const ESTALE: ::c_int = 151;
639pub const EREMOTE: ::c_int = 66;
640pub const ENOLCK: ::c_int = 46;
641pub const ENOSYS: ::c_int = 89;
642pub const EIDRM: ::c_int = 36;
643pub const ENOMSG: ::c_int = 35;
644pub const EOVERFLOW: ::c_int = 79;
645pub const ECANCELED: ::c_int = 47;
646pub const EILSEQ: ::c_int = 88;
647pub const EBADMSG: ::c_int = 77;
648pub const EMULTIHOP: ::c_int = 74;
649pub const ENOLINK: ::c_int = 67;
650pub const EPROTO: ::c_int = 71;
651
652pub const F_DUPFD: ::c_int = 0;
653pub const F_GETFD: ::c_int = 1;
654pub const F_SETFD: ::c_int = 2;
655pub const F_GETFL: ::c_int = 3;
656pub const F_SETFL: ::c_int = 4;
657
658pub const SIGTRAP: ::c_int = 5;
659
660pub const GLOB_APPEND : ::c_int = 32;
661pub const GLOB_DOOFFS : ::c_int = 16;
662pub const GLOB_ERR : ::c_int = 1;
663pub const GLOB_MARK : ::c_int = 2;
664pub const GLOB_NOCHECK : ::c_int = 8;
665pub const GLOB_NOSORT : ::c_int = 4;
666pub const GLOB_NOESCAPE: ::c_int = 64;
667
668pub const GLOB_NOSPACE : ::c_int = -2;
669pub const GLOB_ABORTED : ::c_int = -1;
670pub const GLOB_NOMATCH : ::c_int = -3;
671
672pub const POSIX_MADV_NORMAL: ::c_int = 0;
673pub const POSIX_MADV_RANDOM: ::c_int = 1;
674pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
675pub const POSIX_MADV_WILLNEED: ::c_int = 3;
676pub const POSIX_MADV_DONTNEED: ::c_int = 4;
677
678pub const _SC_IOV_MAX: ::c_int = 77;
679pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 569;
680pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 570;
681pub const _SC_LOGIN_NAME_MAX: ::c_int = 571;
682pub const _SC_MQ_PRIO_MAX: ::c_int = 30;
683pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 577;
684pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 578;
685pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 568;
686pub const _SC_THREAD_KEYS_MAX: ::c_int = 572;
687pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 580;
688pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 581;
689pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 579;
690pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 582;
691pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 583;
692pub const _SC_THREAD_STACK_MIN: ::c_int = 573;
693pub const _SC_THREAD_THREADS_MAX: ::c_int = 574;
694pub const _SC_THREADS: ::c_int = 576;
695pub const _SC_TTY_NAME_MAX: ::c_int = 575;
696pub const _SC_ATEXIT_MAX: ::c_int = 76;
697pub const _SC_XOPEN_CRYPT: ::c_int = 62;
698pub const _SC_XOPEN_ENH_I18N: ::c_int = 63;
699pub const _SC_XOPEN_LEGACY: ::c_int = 717;
700pub const _SC_XOPEN_REALTIME: ::c_int = 718;
701pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 719;
702pub const _SC_XOPEN_SHM: ::c_int = 64;
703pub const _SC_XOPEN_UNIX: ::c_int = 78;
704pub const _SC_XOPEN_VERSION: ::c_int = 12;
705pub const _SC_XOPEN_XCU_VERSION: ::c_int = 67;
706
707pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
708pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x40;
709pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
710pub const PTHREAD_PROCESS_PRIVATE: u16 = 0;
711pub const PTHREAD_STACK_MIN: ::size_t = 4096;
712
713pub 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
725pub const CLOCK_REALTIME: clockid_t = 3;
726pub const CLOCK_MONOTONIC: clockid_t = 4;
727pub const TIMER_RELTIME: ::c_int = 0;
728pub const TIMER_ABSTIME: ::c_int = 1;
729
730pub const RLIMIT_CPU: ::c_int = 0;
731pub const RLIMIT_FSIZE: ::c_int = 1;
732pub const RLIMIT_DATA: ::c_int = 2;
733pub const RLIMIT_STACK: ::c_int = 3;
734pub const RLIMIT_CORE: ::c_int = 4;
735pub const RLIMIT_NOFILE: ::c_int = 5;
736pub const RLIMIT_VMEM: ::c_int = 6;
737pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM;
738
739pub const RLIM_NLIMITS: rlim_t = 7;
740pub const RLIM_INFINITY: rlim_t = 0x7fffffff;
741
742pub const RUSAGE_SELF: ::c_int = 0;
743pub const RUSAGE_CHILDREN: ::c_int = -1;
744
745pub const MADV_NORMAL: ::c_int = 0;
746pub const MADV_RANDOM: ::c_int = 1;
747pub const MADV_SEQUENTIAL: ::c_int = 2;
748pub const MADV_WILLNEED: ::c_int = 3;
749pub const MADV_DONTNEED: ::c_int = 4;
750pub const MADV_FREE: ::c_int = 5;
751
752pub const AF_INET: ::c_int = 2;
753pub const AF_INET6: ::c_int = 26;
754pub const AF_UNIX: ::c_int = 1;
755pub const SOCK_DGRAM: ::c_int = 1;
756pub const SOCK_STREAM: ::c_int = 2;
757pub const SOCK_RAW: ::c_int = 4;
758pub const SOCK_RDM: ::c_int = 5;
759pub const SOCK_SEQPACKET: ::c_int = 6;
760pub const IPPROTO_TCP: ::c_int = 6;
761pub const IPPROTO_IP: ::c_int = 0;
762pub const IPPROTO_IPV6: ::c_int = 41;
763pub const IP_MULTICAST_TTL: ::c_int = 17;
764pub const IP_MULTICAST_LOOP: ::c_int = 18;
765pub const IP_TTL: ::c_int = 4;
766pub const IP_HDRINCL: ::c_int = 2;
767pub const IP_ADD_MEMBERSHIP: ::c_int = 19;
768pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
769pub const IPV6_JOIN_GROUP: ::c_int = 9;
770pub const IPV6_LEAVE_GROUP: ::c_int = 10;
771
772pub const TCP_NODELAY: ::c_int = 1;
773pub const TCP_KEEPIDLE: ::c_int = 34;
774pub const SOL_SOCKET: ::c_int = 0xffff;
775pub const SO_DEBUG: ::c_int = 0x01;
776pub const SO_ACCEPTCONN: ::c_int = 0x0002;
777pub const SO_REUSEADDR: ::c_int = 0x0004;
778pub const SO_KEEPALIVE: ::c_int = 0x0008;
779pub const SO_DONTROUTE: ::c_int = 0x0010;
780pub const SO_BROADCAST: ::c_int = 0x0020;
781pub const SO_USELOOPBACK: ::c_int = 0x0040;
782pub const SO_LINGER: ::c_int = 0x0080;
783pub const SO_OOBINLINE: ::c_int = 0x0100;
784pub const SO_SNDBUF: ::c_int = 0x1001;
785pub const SO_RCVBUF: ::c_int = 0x1002;
786pub const SO_SNDLOWAT: ::c_int = 0x1003;
787pub const SO_RCVLOWAT: ::c_int = 0x1004;
788pub const SO_SNDTIMEO: ::c_int = 0x1005;
789pub const SO_RCVTIMEO: ::c_int = 0x1006;
790pub const SO_ERROR: ::c_int = 0x1007;
791pub const SO_TYPE: ::c_int = 0x1008;
792
793pub const IFF_LOOPBACK: ::c_int = 0x8;
794
795pub const SHUT_RD: ::c_int = 0;
796pub const SHUT_WR: ::c_int = 1;
797pub const SHUT_RDWR: ::c_int = 2;
798
799pub const LOCK_SH: ::c_int = 1;
800pub const LOCK_EX: ::c_int = 2;
801pub const LOCK_NB: ::c_int = 4;
802pub const LOCK_UN: ::c_int = 8;
803
804pub const O_SYNC: ::c_int = 16;
805pub const O_NONBLOCK: ::c_int = 128;
806
807pub const IPPROTO_RAW: ::c_int = 255;
808
809pub const _SC_ARG_MAX: ::c_int = 1;
810pub const _SC_CHILD_MAX: ::c_int = 2;
811pub const _SC_CLK_TCK: ::c_int = 3;
812pub const _SC_NGROUPS_MAX: ::c_int = 4;
813pub const _SC_OPEN_MAX: ::c_int = 5;
814pub const _SC_JOB_CONTROL: ::c_int = 6;
815pub const _SC_SAVED_IDS: ::c_int = 7;
816pub const _SC_VERSION: ::c_int = 8;
817pub const _SC_PAGESIZE: ::c_int = 11;
818pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
819pub const _SC_NPROCESSORS_ONLN: ::c_int = 15;
820pub const _SC_STREAM_MAX: ::c_int = 16;
821pub const _SC_TZNAME_MAX: ::c_int = 17;
822pub const _SC_AIO_LISTIO_MAX: ::c_int = 18;
823pub const _SC_AIO_MAX: ::c_int = 19;
824pub const _SC_BC_BASE_MAX: ::c_int = 54;
825pub const _SC_BC_DIM_MAX: ::c_int = 55;
826pub const _SC_BC_SCALE_MAX: ::c_int = 56;
827pub const _SC_BC_STRING_MAX: ::c_int = 57;
828pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 58;
829pub const _SC_EXPR_NEST_MAX: ::c_int = 59;
830pub const _SC_LINE_MAX: ::c_int = 60;
831pub const _SC_RE_DUP_MAX: ::c_int = 61;
832pub const _SC_2_VERSION: ::c_int = 53;
833pub const _SC_2_C_BIND: ::c_int = 45;
834pub const _SC_2_C_DEV: ::c_int = 46;
835pub const _SC_2_CHAR_TERM: ::c_int = 66;
836pub const _SC_2_FORT_DEV: ::c_int = 48;
837pub const _SC_2_FORT_RUN: ::c_int = 49;
838pub const _SC_2_LOCALEDEF: ::c_int = 50;
839pub const _SC_2_SW_DEV: ::c_int = 51;
840pub const _SC_2_UPE: ::c_int = 52;
841pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21;
842pub const _SC_MAPPED_FILES: ::c_int = 24;
843pub const _SC_MEMLOCK: ::c_int = 25;
844pub const _SC_MEMLOCK_RANGE: ::c_int = 26;
845pub const _SC_MEMORY_PROTECTION: ::c_int = 27;
846pub const _SC_MESSAGE_PASSING: ::c_int = 28;
847pub const _SC_PRIORITIZED_IO: ::c_int = 31;
848pub const _SC_PRIORITY_SCHEDULING: ::c_int = 32;
849pub const _SC_REALTIME_SIGNALS: ::c_int = 33;
850pub const _SC_SEMAPHORES: ::c_int = 35;
851pub const _SC_FSYNC: ::c_int = 23;
852pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 38;
853pub const _SC_SYNCHRONIZED_IO: ::c_int = 42;
854pub const _SC_TIMERS: ::c_int = 43;
855pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 20;
856pub const _SC_DELAYTIMER_MAX: ::c_int = 22;
857pub const _SC_MQ_OPEN_MAX: ::c_int = 29;
858pub const _SC_RTSIG_MAX: ::c_int = 34;
859pub const _SC_SEM_NSEMS_MAX: ::c_int = 36;
860pub const _SC_SEM_VALUE_MAX: ::c_int = 37;
861pub const _SC_SIGQUEUE_MAX: ::c_int = 39;
862pub const _SC_TIMER_MAX: ::c_int = 44;
863
864pub const _MUTEX_MAGIC: u16 = 0x4d58; // MX
865pub const _COND_MAGIC: u16 = 0x4356; // CV
866pub const _RWL_MAGIC: u16 = 0x5257; // RW
867
868pub const NCCS: usize = 19;
869
870pub const LOG_CRON: ::c_int = 15 << 3;
871
872pub 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};
881pub 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};
887pub 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};
895pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
896pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
897pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 4;
898pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
899
900pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void;
901pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
902pub const RTLD_SELF: *mut ::c_void = -3isize as *mut ::c_void;
903pub const RTLD_PROBE: *mut ::c_void = -4isize as *mut ::c_void;
904
905pub const RTLD_NOW: ::c_int = 0x2;
906pub const RTLD_NOLOAD: ::c_int = 0x4;
907pub const RTLD_GLOBAL: ::c_int = 0x100;
908pub const RTLD_LOCAL: ::c_int = 0x0;
909pub const RTLD_PARENT: ::c_int = 0x200;
910pub const RTLD_GROUP: ::c_int = 0x400;
911pub const RTLD_WORLD: ::c_int = 0x800;
912pub const RTLD_NODELETE: ::c_int = 0x1000;
913pub const RTLD_FIRST: ::c_int = 0x2000;
914pub const RTLD_CONFGEN: ::c_int = 0x10000;
915
916f! {
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
953extern {
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
3pub type c_char = i8;
4pub type c_long = i32;
5pub type c_ulong = u32;
6pub type wchar_t = u16;
7
8pub type clock_t = i32;
9
10cfg_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
18pub type off_t = i32;
19pub type dev_t = u32;
20pub type ino_t = u16;
21pub enum timezone {}
22pub type time64_t = i64;
23
24s! {
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
57pub const EXIT_FAILURE: ::c_int = 1;
58pub const EXIT_SUCCESS: ::c_int = 0;
59pub const RAND_MAX: ::c_int = 32767;
60pub const EOF: ::c_int = -1;
61pub const SEEK_SET: ::c_int = 0;
62pub const SEEK_CUR: ::c_int = 1;
63pub const SEEK_END: ::c_int = 2;
64pub const _IOFBF: ::c_int = 0;
65pub const _IONBF: ::c_int = 4;
66pub const _IOLBF: ::c_int = 64;
67pub const BUFSIZ: ::c_uint = 512;
68pub const FOPEN_MAX: ::c_uint = 20;
69pub const FILENAME_MAX: ::c_uint = 260;
70
71cfg_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
83pub const O_RDONLY: ::c_int = 0;
84pub const O_WRONLY: ::c_int = 1;
85pub const O_RDWR: ::c_int = 2;
86pub const O_APPEND: ::c_int = 8;
87pub const O_CREAT: ::c_int = 256;
88pub const O_EXCL: ::c_int = 1024;
89pub const O_TEXT: ::c_int = 16384;
90pub const O_BINARY: ::c_int = 32768;
91pub const O_NOINHERIT: ::c_int = 128;
92pub const O_TRUNC: ::c_int = 512;
93pub const S_IFCHR: ::c_int = 8192;
94pub const S_IFDIR: ::c_int = 16384;
95pub const S_IFREG: ::c_int = 32768;
96pub const S_IFMT: ::c_int = 61440;
97pub const S_IEXEC: ::c_int = 64;
98pub const S_IWRITE: ::c_int = 128;
99pub const S_IREAD: ::c_int = 256;
100
101pub const LC_ALL: ::c_int = 0;
102pub const LC_COLLATE: ::c_int = 1;
103pub const LC_CTYPE: ::c_int = 2;
104pub const LC_MONETARY: ::c_int = 3;
105pub const LC_NUMERIC: ::c_int = 4;
106pub const LC_TIME: ::c_int = 5;
107
108#[cfg(target_env = "msvc")] // " if " -- appease style checker
109#[link(name = "msvcrt")]
110extern {}
111
112extern {
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}