mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
No bug - Revendor rust dependencies
This commit is contained in:
parent
318d3094c5
commit
9569e8c8f2
@ -1 +0,0 @@
|
||||
{"files":{".travis.yml":"d2a9bb7c029e8ed0acfb8dc8e786014cfa4f053b6f4c525303d69fd7e28704e9","Cargo.toml":"58c04bac67faab6be97b59de07794082d3939573035d206bfdd097943a5db79c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"d4e2bab975203277cab1daa6560bd918fdc35e50a7a41a97a55eeea06526a441","src/builder.rs":"528640f717f5769e522a9ac066a994c21973ff3a5e9359d087f410233887c83c","src/delta.rs":"510fc3dbf0a70d635d0488c5a5a32a2ba8e1490ce05bee39d944ea8c02189bbc","src/draft.rs":"bd11960db08f4e4368937845fc18b842e474391738e4457a3441df2789c9d320","src/jar.rs":"98237c4a37143e08bcb6e84c5ed69b799a8a08f89a1b83f02c425cc92b089252","src/lib.rs":"c9713205a51c98138cdcf422313fde959d8bcabf483c4803f2ed6c755eb9f7d5","src/parse.rs":"ee46cee7fa445e6545f29eac3eac81e76ec29e9c53e000195af427c7315ee11c","src/secure/key.rs":"734f35ef4b0d6b63174befdcb970f0304ac63f0895871b7c2f267fefdd43b648","src/secure/macros.rs":"83d770e5c4eb7fbd3c3d86973b69042e9e2bb9fafb72a4456598e2ae78638d5f","src/secure/mod.rs":"5d7fecb62295827d474ed1ce6b7628fe93d4a09eb14babfde036d64e8e4a04f8","src/secure/private.rs":"fbe9b8f79acaab9f9698298e7be57d3fcc33ca3fffbd13f576951b16f28cba60","src/secure/signed.rs":"8440c9ce5a0be4e162fb502cd1fbe24572ce00709f5554c45f8bece39637590d"},"package":"a54aa6d675d62b2f95b56b331b5222a520149a54f23a2d21974dfcc69caf0a9d"}
|
26
third_party/rust/cookie-0.9.1/.travis.yml
vendored
26
third_party/rust/cookie-0.9.1/.travis.yml
vendored
@ -1,26 +0,0 @@
|
||||
language: rust
|
||||
rust:
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
sudo: false
|
||||
before_script:
|
||||
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
|
||||
script:
|
||||
- cargo build --verbose
|
||||
- cargo test --verbose --no-default-features
|
||||
- cargo test --verbose
|
||||
- cargo test --verbose --features percent-encode
|
||||
- cargo test --verbose --features secure
|
||||
- cargo test --verbose --all-features
|
||||
- rustdoc --test README.md -L target
|
||||
- cargo doc --no-deps
|
||||
after_success:
|
||||
- travis-cargo --only nightly doc-upload
|
||||
env:
|
||||
global:
|
||||
secure: "TyMGH+sbPmKs9lKCziKShxWr3G6im0owEchVrbUChWnQIQv1WydXftFoEoUsVl6qZspjehWK1b1AsnIgCXK0HtEi4DnqLsxs0s36bOjfg5yHBT/pETTr6kcq7KAL4Be4GmI331k6gT1Oi0TPFp7Sg9xpiWsQqKIHA5Szk2wpFQ8="
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
38
third_party/rust/cookie-0.9.1/Cargo.toml
vendored
38
third_party/rust/cookie-0.9.1/Cargo.toml
vendored
@ -1,38 +0,0 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
name = "cookie"
|
||||
version = "0.9.1"
|
||||
authors = ["Alex Crichton <alex@alexcrichton.com>", "Sergio Benitez <sb@sergio.bz>"]
|
||||
description = "Crate for parsing HTTP cookie headers and managing a cookie jar. Supports signed\nand private (encrypted + signed) jars.\n"
|
||||
documentation = "https://docs.rs/cookie"
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/alexcrichton/cookie-rs"
|
||||
[dependencies.url]
|
||||
version = "1.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.ring]
|
||||
version = "0.11.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.base64]
|
||||
version = "0.6.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.time]
|
||||
version = "0.1"
|
||||
|
||||
[features]
|
||||
percent-encode = ["url"]
|
||||
secure = ["ring", "base64"]
|
201
third_party/rust/cookie-0.9.1/LICENSE-APACHE
vendored
201
third_party/rust/cookie-0.9.1/LICENSE-APACHE
vendored
@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
25
third_party/rust/cookie-0.9.1/LICENSE-MIT
vendored
25
third_party/rust/cookie-0.9.1/LICENSE-MIT
vendored
@ -1,25 +0,0 @@
|
||||
Copyright (c) 2014 Alex Crichton
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
26
third_party/rust/cookie-0.9.1/README.md
vendored
26
third_party/rust/cookie-0.9.1/README.md
vendored
@ -1,26 +0,0 @@
|
||||
# cookie-rs
|
||||
|
||||
[![Build Status](https://travis-ci.org/alexcrichton/cookie-rs.svg?branch=master)](https://travis-ci.org/alexcrichton/cookie-rs)
|
||||
[![Current Crates.io Version](https://img.shields.io/crates/v/cookie.svg)](https://crates.io/crates/cookie)
|
||||
|
||||
A library for parsing HTTP cookies and managing cookie jars.
|
||||
|
||||
# Usage
|
||||
|
||||
Add the following to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
cookie = "0.9"
|
||||
```
|
||||
|
||||
See the [documentation](http://docs.rs/cookie) for detailed usage information.
|
||||
|
||||
# License
|
||||
|
||||
`cookie-rs` is primarily distributed under the terms of both the MIT license and
|
||||
the Apache License (Version 2.0), with portions covered by various BSD-like
|
||||
licenses.
|
||||
|
||||
See [LICENSE-APACHE](LICENSE-APACHE), and [LICENSE-MIT](LICENSE-MIT) for
|
||||
details.
|
250
third_party/rust/cookie-0.9.1/src/builder.rs
vendored
250
third_party/rust/cookie-0.9.1/src/builder.rs
vendored
@ -1,250 +0,0 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use time::{Tm, Duration};
|
||||
|
||||
use ::{Cookie, SameSite};
|
||||
|
||||
/// Structure that follows the builder pattern for building `Cookie` structs.
|
||||
///
|
||||
/// To construct a cookie:
|
||||
///
|
||||
/// 1. Call [`Cookie::build`](struct.Cookie.html#method.build) to start building.
|
||||
/// 2. Use any of the builder methods to set fields in the cookie.
|
||||
/// 3. Call [finish](#method.finish) to retrieve the built cookie.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate cookie;
|
||||
/// extern crate time;
|
||||
///
|
||||
/// use cookie::Cookie;
|
||||
/// use time::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let cookie: Cookie = Cookie::build("name", "value")
|
||||
/// .domain("www.rust-lang.org")
|
||||
/// .path("/")
|
||||
/// .secure(true)
|
||||
/// .http_only(true)
|
||||
/// .max_age(Duration::days(1))
|
||||
/// .finish();
|
||||
/// # }
|
||||
/// ```
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CookieBuilder {
|
||||
/// The cookie being built.
|
||||
cookie: Cookie<'static>,
|
||||
}
|
||||
|
||||
impl CookieBuilder {
|
||||
/// Creates a new `CookieBuilder` instance from the given name and value.
|
||||
///
|
||||
/// This method is typically called indirectly via
|
||||
/// [Cookie::build](struct.Cookie.html#method.build).
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Cookie;
|
||||
///
|
||||
/// let c = Cookie::build("foo", "bar").finish();
|
||||
/// assert_eq!(c.name_value(), ("foo", "bar"));
|
||||
/// ```
|
||||
pub fn new<N, V>(name: N, value: V) -> CookieBuilder
|
||||
where N: Into<Cow<'static, str>>,
|
||||
V: Into<Cow<'static, str>>
|
||||
{
|
||||
CookieBuilder { cookie: Cookie::new(name, value) }
|
||||
}
|
||||
|
||||
/// Sets the `expires` field in the cookie being built.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate cookie;
|
||||
/// extern crate time;
|
||||
///
|
||||
/// use cookie::Cookie;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .expires(time::now())
|
||||
/// .finish();
|
||||
///
|
||||
/// assert!(c.expires().is_some());
|
||||
/// # }
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn expires(mut self, when: Tm) -> CookieBuilder {
|
||||
self.cookie.set_expires(when);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the `max_age` field in the cookie being built.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate cookie;
|
||||
/// extern crate time;
|
||||
/// use time::Duration;
|
||||
///
|
||||
/// use cookie::Cookie;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .max_age(Duration::minutes(30))
|
||||
/// .finish();
|
||||
///
|
||||
/// assert_eq!(c.max_age(), Some(Duration::seconds(30 * 60)));
|
||||
/// # }
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn max_age(mut self, value: Duration) -> CookieBuilder {
|
||||
self.cookie.set_max_age(value);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the `domain` field in the cookie being built.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Cookie;
|
||||
///
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .domain("www.rust-lang.org")
|
||||
/// .finish();
|
||||
///
|
||||
/// assert_eq!(c.domain(), Some("www.rust-lang.org"));
|
||||
/// ```
|
||||
pub fn domain<D: Into<Cow<'static, str>>>(mut self, value: D) -> CookieBuilder {
|
||||
self.cookie.set_domain(value);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the `path` field in the cookie being built.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Cookie;
|
||||
///
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .path("/")
|
||||
/// .finish();
|
||||
///
|
||||
/// assert_eq!(c.path(), Some("/"));
|
||||
/// ```
|
||||
pub fn path<P: Into<Cow<'static, str>>>(mut self, path: P) -> CookieBuilder {
|
||||
self.cookie.set_path(path);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the `secure` field in the cookie being built.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Cookie;
|
||||
///
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .secure(true)
|
||||
/// .finish();
|
||||
///
|
||||
/// assert_eq!(c.secure(), true);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn secure(mut self, value: bool) -> CookieBuilder {
|
||||
self.cookie.set_secure(value);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the `http_only` field in the cookie being built.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Cookie;
|
||||
///
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .http_only(true)
|
||||
/// .finish();
|
||||
///
|
||||
/// assert_eq!(c.http_only(), true);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn http_only(mut self, value: bool) -> CookieBuilder {
|
||||
self.cookie.set_http_only(value);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the `same_site` field in the cookie being built.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{Cookie, SameSite};
|
||||
///
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .same_site(SameSite::Strict)
|
||||
/// .finish();
|
||||
///
|
||||
/// assert_eq!(c.same_site(), Some(SameSite::Strict));
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn same_site(mut self, value: SameSite) -> CookieBuilder {
|
||||
self.cookie.set_same_site(value);
|
||||
self
|
||||
}
|
||||
|
||||
/// Makes the cookie being built 'permanent' by extending its expiration and
|
||||
/// max age 20 years into the future.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate cookie;
|
||||
/// extern crate time;
|
||||
///
|
||||
/// use cookie::Cookie;
|
||||
/// use time::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .permanent()
|
||||
/// .finish();
|
||||
///
|
||||
/// assert_eq!(c.max_age(), Some(Duration::days(365 * 20)));
|
||||
/// # assert!(c.expires().is_some());
|
||||
/// # }
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn permanent(mut self) -> CookieBuilder {
|
||||
self.cookie.make_permanent();
|
||||
self
|
||||
}
|
||||
|
||||
/// Finishes building and returns the built `Cookie`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Cookie;
|
||||
///
|
||||
/// let c = Cookie::build("foo", "bar")
|
||||
/// .domain("crates.io")
|
||||
/// .path("/")
|
||||
/// .finish();
|
||||
///
|
||||
/// assert_eq!(c.name_value(), ("foo", "bar"));
|
||||
/// assert_eq!(c.domain(), Some("crates.io"));
|
||||
/// assert_eq!(c.path(), Some("/"));
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn finish(self) -> Cookie<'static> {
|
||||
self.cookie
|
||||
}
|
||||
}
|
71
third_party/rust/cookie-0.9.1/src/delta.rs
vendored
71
third_party/rust/cookie-0.9.1/src/delta.rs
vendored
@ -1,71 +0,0 @@
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::borrow::Borrow;
|
||||
|
||||
use Cookie;
|
||||
|
||||
/// A `DeltaCookie` is a helper structure used in a cookie jar. It wraps a
|
||||
/// `Cookie` so that it can be hashed and compared purely by name. It further
|
||||
/// records whether the wrapped cookie is a "removal" cookie, that is, a cookie
|
||||
/// that when sent to the client removes the named cookie on the client's
|
||||
/// machine.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DeltaCookie {
|
||||
pub cookie: Cookie<'static>,
|
||||
pub removed: bool,
|
||||
}
|
||||
|
||||
impl DeltaCookie {
|
||||
/// Create a new `DeltaCookie` that is being added to a jar.
|
||||
#[inline]
|
||||
pub fn added(cookie: Cookie<'static>) -> DeltaCookie {
|
||||
DeltaCookie {
|
||||
cookie: cookie,
|
||||
removed: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new `DeltaCookie` that is being removed from a jar. The
|
||||
/// `cookie` should be a "removal" cookie.
|
||||
#[inline]
|
||||
pub fn removed(cookie: Cookie<'static>) -> DeltaCookie {
|
||||
DeltaCookie {
|
||||
cookie: cookie,
|
||||
removed: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for DeltaCookie {
|
||||
type Target = Cookie<'static>;
|
||||
|
||||
fn deref(&self) -> &Cookie<'static> {
|
||||
&self.cookie
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for DeltaCookie {
|
||||
fn deref_mut(&mut self) -> &mut Cookie<'static> {
|
||||
&mut self.cookie
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for DeltaCookie {
|
||||
fn eq(&self, other: &DeltaCookie) -> bool {
|
||||
self.name() == other.name()
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for DeltaCookie {}
|
||||
|
||||
impl Hash for DeltaCookie {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.name().hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl Borrow<str> for DeltaCookie {
|
||||
fn borrow(&self) -> &str {
|
||||
self.name()
|
||||
}
|
||||
}
|
71
third_party/rust/cookie-0.9.1/src/draft.rs
vendored
71
third_party/rust/cookie-0.9.1/src/draft.rs
vendored
@ -1,71 +0,0 @@
|
||||
//! This module contains types that represent cookie properties that are not yet
|
||||
//! standardized. That is, _draft_ features.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
/// The `SameSite` cookie attribute.
|
||||
///
|
||||
/// A cookie with a `SameSite` attribute is imposed restrictions on when it is
|
||||
/// sent to the origin server in a cross-site request. If the `SameSite`
|
||||
/// attribute is "Strict", then the cookie is never sent in cross-site requests.
|
||||
/// If the `SameSite` attribute is "Lax", the cookie is only sent in cross-site
|
||||
/// requests with "safe" HTTP methods, i.e, `GET`, `HEAD`, `OPTIONS`, `TRACE`.
|
||||
///
|
||||
/// **Note:** This cookie attribute is an HTTP draft! Its meaning and definition
|
||||
/// are subject to change.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum SameSite {
|
||||
/// The "Strict" `SameSite` attribute.
|
||||
Strict,
|
||||
/// The "Lax" `SameSite` attribute.
|
||||
Lax
|
||||
}
|
||||
|
||||
impl SameSite {
|
||||
/// Returns `true` if `self` is `SameSite::Strict` and `false` otherwise.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::SameSite;
|
||||
///
|
||||
/// let strict = SameSite::Strict;
|
||||
/// assert!(strict.is_strict());
|
||||
/// assert!(!strict.is_lax());
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn is_strict(&self) -> bool {
|
||||
match *self {
|
||||
SameSite::Strict => true,
|
||||
SameSite::Lax => false
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if `self` is `SameSite::Lax` and `false` otherwise.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::SameSite;
|
||||
///
|
||||
/// let lax = SameSite::Lax;
|
||||
/// assert!(lax.is_lax());
|
||||
/// assert!(!lax.is_strict());
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn is_lax(&self) -> bool {
|
||||
match *self {
|
||||
SameSite::Strict => false,
|
||||
SameSite::Lax => true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for SameSite {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
SameSite::Strict => write!(f, "Strict"),
|
||||
SameSite::Lax => write!(f, "Lax")
|
||||
}
|
||||
}
|
||||
}
|
604
third_party/rust/cookie-0.9.1/src/jar.rs
vendored
604
third_party/rust/cookie-0.9.1/src/jar.rs
vendored
@ -1,604 +0,0 @@
|
||||
use std::collections::HashSet;
|
||||
use std::mem::replace;
|
||||
|
||||
use time::{self, Duration};
|
||||
|
||||
#[cfg(feature = "secure")]
|
||||
use secure::{PrivateJar, SignedJar, Key};
|
||||
use delta::DeltaCookie;
|
||||
use Cookie;
|
||||
|
||||
/// A collection of cookies that tracks its modifications.
|
||||
///
|
||||
/// A `CookieJar` provides storage for any number of cookies. Any changes made
|
||||
/// to the jar are tracked; the changes can be retrieved via the
|
||||
/// [delta](#method.delta) method which returns an interator over the changes.
|
||||
///
|
||||
/// # Usage
|
||||
///
|
||||
/// A jar's life begins via [new](#method.new) and calls to
|
||||
/// [`add_original`](#method.add_original):
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{Cookie, CookieJar};
|
||||
///
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.add_original(Cookie::new("name", "value"));
|
||||
/// jar.add_original(Cookie::new("second", "another"));
|
||||
/// ```
|
||||
///
|
||||
/// Cookies can be added via [add](#method.add) and removed via
|
||||
/// [remove](#method.remove). Finally, cookies can be looked up via
|
||||
/// [get](#method.get):
|
||||
///
|
||||
/// ```rust
|
||||
/// # use cookie::{Cookie, CookieJar};
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.add(Cookie::new("a", "one"));
|
||||
/// jar.add(Cookie::new("b", "two"));
|
||||
///
|
||||
/// assert_eq!(jar.get("a").map(|c| c.value()), Some("one"));
|
||||
/// assert_eq!(jar.get("b").map(|c| c.value()), Some("two"));
|
||||
///
|
||||
/// jar.remove(Cookie::named("b"));
|
||||
/// assert!(jar.get("b").is_none());
|
||||
/// ```
|
||||
///
|
||||
/// # Deltas
|
||||
///
|
||||
/// A jar keeps track of any modifications made to it over time. The
|
||||
/// modifications are recorded as cookies. The modifications can be retrieved
|
||||
/// via [delta](#method.delta). Any new `Cookie` added to a jar via `add`
|
||||
/// results in the same `Cookie` appearing in the `delta`; cookies added via
|
||||
/// `add_original` do not count towards the delta. Any _original_ cookie that is
|
||||
/// removed from a jar results in a "removal" cookie appearing in the delta. A
|
||||
/// "removal" cookie is a cookie that a server sends so that the cookie is
|
||||
/// removed from the client's machine.
|
||||
///
|
||||
/// Deltas are typically used to create `Set-Cookie` headers corresponding to
|
||||
/// the changes made to a cookie jar over a period of time.
|
||||
///
|
||||
/// ```rust
|
||||
/// # use cookie::{Cookie, CookieJar};
|
||||
/// let mut jar = CookieJar::new();
|
||||
///
|
||||
/// // original cookies don't affect the delta
|
||||
/// jar.add_original(Cookie::new("original", "value"));
|
||||
/// assert_eq!(jar.delta().count(), 0);
|
||||
///
|
||||
/// // new cookies result in an equivalent `Cookie` in the delta
|
||||
/// jar.add(Cookie::new("a", "one"));
|
||||
/// jar.add(Cookie::new("b", "two"));
|
||||
/// assert_eq!(jar.delta().count(), 2);
|
||||
///
|
||||
/// // removing an original cookie adds a "removal" cookie to the delta
|
||||
/// jar.remove(Cookie::named("original"));
|
||||
/// assert_eq!(jar.delta().count(), 3);
|
||||
///
|
||||
/// // removing a new cookie that was added removes that `Cookie` from the delta
|
||||
/// jar.remove(Cookie::named("a"));
|
||||
/// assert_eq!(jar.delta().count(), 2);
|
||||
/// ```
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct CookieJar {
|
||||
original_cookies: HashSet<DeltaCookie>,
|
||||
delta_cookies: HashSet<DeltaCookie>,
|
||||
}
|
||||
|
||||
impl CookieJar {
|
||||
/// Creates an empty cookie jar.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::CookieJar;
|
||||
///
|
||||
/// let jar = CookieJar::new();
|
||||
/// assert_eq!(jar.iter().count(), 0);
|
||||
/// ```
|
||||
pub fn new() -> CookieJar {
|
||||
CookieJar::default()
|
||||
}
|
||||
|
||||
/// Returns a reference to the `Cookie` inside this jar with the name
|
||||
/// `name`. If no such cookie exists, returns `None`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie};
|
||||
///
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// assert!(jar.get("name").is_none());
|
||||
///
|
||||
/// jar.add(Cookie::new("name", "value"));
|
||||
/// assert_eq!(jar.get("name").map(|c| c.value()), Some("value"));
|
||||
/// ```
|
||||
pub fn get(&self, name: &str) -> Option<&Cookie<'static>> {
|
||||
self.delta_cookies
|
||||
.get(name)
|
||||
.or_else(|| self.original_cookies.get(name))
|
||||
.and_then(|c| if !c.removed { Some(&c.cookie) } else { None })
|
||||
}
|
||||
|
||||
/// Adds an "original" `cookie` to this jar. Adding an original cookie does
|
||||
/// not affect the [delta](#method.delta) computation. This method is
|
||||
/// intended to be used to seed the cookie jar with cookies received from a
|
||||
/// client's HTTP message.
|
||||
///
|
||||
/// For accurate `delta` computations, this method should not be called
|
||||
/// after calling `remove`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie};
|
||||
///
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.add_original(Cookie::new("name", "value"));
|
||||
/// jar.add_original(Cookie::new("second", "two"));
|
||||
///
|
||||
/// assert_eq!(jar.get("name").map(|c| c.value()), Some("value"));
|
||||
/// assert_eq!(jar.get("second").map(|c| c.value()), Some("two"));
|
||||
/// assert_eq!(jar.iter().count(), 2);
|
||||
/// assert_eq!(jar.delta().count(), 0);
|
||||
/// ```
|
||||
pub fn add_original(&mut self, cookie: Cookie<'static>) {
|
||||
self.original_cookies.replace(DeltaCookie::added(cookie));
|
||||
}
|
||||
|
||||
/// Adds `cookie` to this jar.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie};
|
||||
///
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.add(Cookie::new("name", "value"));
|
||||
/// jar.add(Cookie::new("second", "two"));
|
||||
///
|
||||
/// assert_eq!(jar.get("name").map(|c| c.value()), Some("value"));
|
||||
/// assert_eq!(jar.get("second").map(|c| c.value()), Some("two"));
|
||||
/// assert_eq!(jar.iter().count(), 2);
|
||||
/// assert_eq!(jar.delta().count(), 2);
|
||||
/// ```
|
||||
pub fn add(&mut self, cookie: Cookie<'static>) {
|
||||
self.delta_cookies.replace(DeltaCookie::added(cookie));
|
||||
}
|
||||
|
||||
/// Removes `cookie` from this jar. If an _original_ cookie with the same
|
||||
/// name as `cookie` is present in the jar, a _removal_ cookie will be
|
||||
/// present in the `delta` computation. To properly generate the removal
|
||||
/// cookie, `cookie` must contain the same `path` and `domain` as the cookie
|
||||
/// that was initially set.
|
||||
///
|
||||
/// A "removal" cookie is a cookie that has the same name as the original
|
||||
/// cookie but has an empty value, a max-age of 0, and an expiration date
|
||||
/// far in the past.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// Removing an _original_ cookie results in a _removal_ cookie:
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate cookie;
|
||||
/// extern crate time;
|
||||
///
|
||||
/// use cookie::{CookieJar, Cookie};
|
||||
/// use time::Duration;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// let mut jar = CookieJar::new();
|
||||
///
|
||||
/// // Assume this cookie originally had a path of "/" and domain of "a.b".
|
||||
/// jar.add_original(Cookie::new("name", "value"));
|
||||
///
|
||||
/// // If the path and domain were set, they must be provided to `remove`.
|
||||
/// jar.remove(Cookie::build("name", "").path("/").domain("a.b").finish());
|
||||
///
|
||||
/// // The delta will contain the removal cookie.
|
||||
/// let delta: Vec<_> = jar.delta().collect();
|
||||
/// assert_eq!(delta.len(), 1);
|
||||
/// assert_eq!(delta[0].name(), "name");
|
||||
/// assert_eq!(delta[0].max_age(), Some(Duration::seconds(0)));
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// Removing a new cookie does not result in a _removal_ cookie:
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie};
|
||||
///
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.add(Cookie::new("name", "value"));
|
||||
/// assert_eq!(jar.delta().count(), 1);
|
||||
///
|
||||
/// jar.remove(Cookie::named("name"));
|
||||
/// assert_eq!(jar.delta().count(), 0);
|
||||
/// ```
|
||||
pub fn remove(&mut self, mut cookie: Cookie<'static>) {
|
||||
if self.original_cookies.contains(cookie.name()) {
|
||||
cookie.set_value("");
|
||||
cookie.set_max_age(Duration::seconds(0));
|
||||
cookie.set_expires(time::now() - Duration::days(365));
|
||||
self.delta_cookies.replace(DeltaCookie::removed(cookie));
|
||||
} else {
|
||||
self.delta_cookies.remove(cookie.name());
|
||||
}
|
||||
}
|
||||
|
||||
/// Removes all cookies from this cookie jar.
|
||||
#[deprecated(since = "0.7.0", note = "calling this method may not remove \
|
||||
all cookies since the path and domain are not specified; use \
|
||||
`remove` instead")]
|
||||
pub fn clear(&mut self) {
|
||||
self.delta_cookies.clear();
|
||||
for delta in replace(&mut self.original_cookies, HashSet::new()) {
|
||||
self.remove(delta.cookie);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an iterator over cookies that represent the changes to this jar
|
||||
/// over time. These cookies can be rendered directly as `Set-Cookie` header
|
||||
/// values to affect the changes made to this jar on the client.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie};
|
||||
///
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.add_original(Cookie::new("name", "value"));
|
||||
/// jar.add_original(Cookie::new("second", "two"));
|
||||
///
|
||||
/// // Add new cookies.
|
||||
/// jar.add(Cookie::new("new", "third"));
|
||||
/// jar.add(Cookie::new("another", "fourth"));
|
||||
/// jar.add(Cookie::new("yac", "fifth"));
|
||||
///
|
||||
/// // Remove some cookies.
|
||||
/// jar.remove(Cookie::named("name"));
|
||||
/// jar.remove(Cookie::named("another"));
|
||||
///
|
||||
/// // Delta contains two new cookies ("new", "yac") and a removal ("name").
|
||||
/// assert_eq!(jar.delta().count(), 3);
|
||||
/// ```
|
||||
pub fn delta(&self) -> Delta {
|
||||
Delta { iter: self.delta_cookies.iter() }
|
||||
}
|
||||
|
||||
/// Returns an iterator over all of the cookies present in this jar.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie};
|
||||
///
|
||||
/// let mut jar = CookieJar::new();
|
||||
///
|
||||
/// jar.add_original(Cookie::new("name", "value"));
|
||||
/// jar.add_original(Cookie::new("second", "two"));
|
||||
///
|
||||
/// jar.add(Cookie::new("new", "third"));
|
||||
/// jar.add(Cookie::new("another", "fourth"));
|
||||
/// jar.add(Cookie::new("yac", "fifth"));
|
||||
///
|
||||
/// jar.remove(Cookie::named("name"));
|
||||
/// jar.remove(Cookie::named("another"));
|
||||
///
|
||||
/// // There are three cookies in the jar: "second", "new", and "yac".
|
||||
/// # assert_eq!(jar.iter().count(), 3);
|
||||
/// for cookie in jar.iter() {
|
||||
/// match cookie.name() {
|
||||
/// "second" => assert_eq!(cookie.value(), "two"),
|
||||
/// "new" => assert_eq!(cookie.value(), "third"),
|
||||
/// "yac" => assert_eq!(cookie.value(), "fifth"),
|
||||
/// _ => unreachable!("there are only three cookies in the jar")
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
pub fn iter(&self) -> Iter {
|
||||
Iter { delta_cookies: self.delta_cookies.union(&self.original_cookies) }
|
||||
}
|
||||
|
||||
/// Returns a `PrivateJar` with `self` as its parent jar using the key `key`
|
||||
/// to sign/encrypt and verify/decrypt cookies added/retrieved from the
|
||||
/// child jar.
|
||||
///
|
||||
/// Any modifications to the child jar will be reflected on the parent jar,
|
||||
/// and any retrievals from the child jar will be made from the parent jar.
|
||||
///
|
||||
/// This method is only available when the `secure` feature is enabled.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{Cookie, CookieJar, Key};
|
||||
///
|
||||
/// // Generate a secure key.
|
||||
/// let key = Key::generate();
|
||||
///
|
||||
/// // Add a private (signed + encrypted) cookie.
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.private(&key).add(Cookie::new("private", "text"));
|
||||
///
|
||||
/// // The cookie's contents are encrypted.
|
||||
/// assert_ne!(jar.get("private").unwrap().value(), "text");
|
||||
///
|
||||
/// // They can be decrypted and verified through the child jar.
|
||||
/// assert_eq!(jar.private(&key).get("private").unwrap().value(), "text");
|
||||
///
|
||||
/// // A tampered with cookie does not validate but still exists.
|
||||
/// let mut cookie = jar.get("private").unwrap().clone();
|
||||
/// jar.add(Cookie::new("private", cookie.value().to_string() + "!"));
|
||||
/// assert!(jar.private(&key).get("private").is_none());
|
||||
/// assert!(jar.get("private").is_some());
|
||||
/// ```
|
||||
#[cfg(feature = "secure")]
|
||||
pub fn private(&mut self, key: &Key) -> PrivateJar {
|
||||
PrivateJar::new(self, key)
|
||||
}
|
||||
|
||||
/// Returns a `SignedJar` with `self` as its parent jar using the key `key`
|
||||
/// to sign/verify cookies added/retrieved from the child jar.
|
||||
///
|
||||
/// Any modifications to the child jar will be reflected on the parent jar,
|
||||
/// and any retrievals from the child jar will be made from the parent jar.
|
||||
///
|
||||
/// This method is only available when the `secure` feature is enabled.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{Cookie, CookieJar, Key};
|
||||
///
|
||||
/// // Generate a secure key.
|
||||
/// let key = Key::generate();
|
||||
///
|
||||
/// // Add a signed cookie.
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.signed(&key).add(Cookie::new("signed", "text"));
|
||||
///
|
||||
/// // The cookie's contents are signed but still in plaintext.
|
||||
/// assert_ne!(jar.get("signed").unwrap().value(), "text");
|
||||
/// assert!(jar.get("signed").unwrap().value().contains("text"));
|
||||
///
|
||||
/// // They can be verified through the child jar.
|
||||
/// assert_eq!(jar.signed(&key).get("signed").unwrap().value(), "text");
|
||||
///
|
||||
/// // A tampered with cookie does not validate but still exists.
|
||||
/// let mut cookie = jar.get("signed").unwrap().clone();
|
||||
/// jar.add(Cookie::new("signed", cookie.value().to_string() + "!"));
|
||||
/// assert!(jar.signed(&key).get("signed").is_none());
|
||||
/// assert!(jar.get("signed").is_some());
|
||||
/// ```
|
||||
#[cfg(feature = "secure")]
|
||||
pub fn signed(&mut self, key: &Key) -> SignedJar {
|
||||
SignedJar::new(self, key)
|
||||
}
|
||||
}
|
||||
|
||||
use std::collections::hash_set::Iter as HashSetIter;
|
||||
|
||||
/// Iterator over the changes to a cookie jar.
|
||||
pub struct Delta<'a> {
|
||||
iter: HashSetIter<'a, DeltaCookie>,
|
||||
}
|
||||
|
||||
impl<'a> Iterator for Delta<'a> {
|
||||
type Item = &'a Cookie<'static>;
|
||||
|
||||
fn next(&mut self) -> Option<&'a Cookie<'static>> {
|
||||
self.iter.next().map(|c| &c.cookie)
|
||||
}
|
||||
}
|
||||
|
||||
use std::collections::hash_set::Union;
|
||||
use std::collections::hash_map::RandomState;
|
||||
|
||||
/// Iterator over all of the cookies in a jar.
|
||||
pub struct Iter<'a> {
|
||||
delta_cookies: Union<'a, DeltaCookie, RandomState>,
|
||||
}
|
||||
|
||||
impl<'a> Iterator for Iter<'a> {
|
||||
type Item = &'a Cookie<'static>;
|
||||
|
||||
fn next(&mut self) -> Option<&'a Cookie<'static>> {
|
||||
for cookie in self.delta_cookies.by_ref() {
|
||||
if !cookie.removed {
|
||||
return Some(&*cookie);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::CookieJar;
|
||||
use Cookie;
|
||||
|
||||
#[test]
|
||||
#[allow(deprecated)]
|
||||
fn simple() {
|
||||
let mut c = CookieJar::new();
|
||||
|
||||
c.add(Cookie::new("test", ""));
|
||||
c.add(Cookie::new("test2", ""));
|
||||
c.remove(Cookie::named("test"));
|
||||
|
||||
assert!(c.get("test").is_none());
|
||||
assert!(c.get("test2").is_some());
|
||||
|
||||
c.add(Cookie::new("test3", ""));
|
||||
c.clear();
|
||||
|
||||
assert!(c.get("test").is_none());
|
||||
assert!(c.get("test2").is_none());
|
||||
assert!(c.get("test3").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn jar_is_send() {
|
||||
fn is_send<T: Send>(_: T) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
assert!(is_send(CookieJar::new()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "secure")]
|
||||
fn iter() {
|
||||
let key = ::Key::generate();
|
||||
let mut c = CookieJar::new();
|
||||
|
||||
c.add_original(Cookie::new("original", "original"));
|
||||
|
||||
c.add(Cookie::new("test", "test"));
|
||||
c.add(Cookie::new("test2", "test2"));
|
||||
c.add(Cookie::new("test3", "test3"));
|
||||
assert_eq!(c.iter().count(), 4);
|
||||
|
||||
c.signed(&key).add(Cookie::new("signed", "signed"));
|
||||
c.private(&key).add(Cookie::new("encrypted", "encrypted"));
|
||||
assert_eq!(c.iter().count(), 6);
|
||||
|
||||
c.remove(Cookie::named("test"));
|
||||
assert_eq!(c.iter().count(), 5);
|
||||
|
||||
c.remove(Cookie::named("signed"));
|
||||
c.remove(Cookie::named("test2"));
|
||||
assert_eq!(c.iter().count(), 3);
|
||||
|
||||
c.add(Cookie::new("test2", "test2"));
|
||||
assert_eq!(c.iter().count(), 4);
|
||||
|
||||
c.remove(Cookie::named("test2"));
|
||||
assert_eq!(c.iter().count(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "secure")]
|
||||
fn delta() {
|
||||
use std::collections::HashMap;
|
||||
use time::Duration;
|
||||
|
||||
let mut c = CookieJar::new();
|
||||
|
||||
c.add_original(Cookie::new("original", "original"));
|
||||
c.add_original(Cookie::new("original1", "original1"));
|
||||
|
||||
c.add(Cookie::new("test", "test"));
|
||||
c.add(Cookie::new("test2", "test2"));
|
||||
c.add(Cookie::new("test3", "test3"));
|
||||
c.add(Cookie::new("test4", "test4"));
|
||||
|
||||
c.remove(Cookie::named("test"));
|
||||
c.remove(Cookie::named("original"));
|
||||
|
||||
assert_eq!(c.delta().count(), 4);
|
||||
|
||||
let names: HashMap<_, _> = c.delta()
|
||||
.map(|c| (c.name(), c.max_age()))
|
||||
.collect();
|
||||
|
||||
assert!(names.get("test2").unwrap().is_none());
|
||||
assert!(names.get("test3").unwrap().is_none());
|
||||
assert!(names.get("test4").unwrap().is_none());
|
||||
assert_eq!(names.get("original").unwrap(), &Some(Duration::seconds(0)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replace_original() {
|
||||
let mut jar = CookieJar::new();
|
||||
jar.add_original(Cookie::new("original_a", "a"));
|
||||
jar.add_original(Cookie::new("original_b", "b"));
|
||||
assert_eq!(jar.get("original_a").unwrap().value(), "a");
|
||||
|
||||
jar.add(Cookie::new("original_a", "av2"));
|
||||
assert_eq!(jar.get("original_a").unwrap().value(), "av2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_delta() {
|
||||
let mut jar = CookieJar::new();
|
||||
jar.add(Cookie::new("name", "val"));
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
|
||||
jar.remove(Cookie::named("name"));
|
||||
assert_eq!(jar.delta().count(), 0);
|
||||
|
||||
jar.add_original(Cookie::new("name", "val"));
|
||||
assert_eq!(jar.delta().count(), 0);
|
||||
|
||||
jar.remove(Cookie::named("name"));
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
|
||||
jar.add(Cookie::new("name", "val"));
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
|
||||
jar.remove(Cookie::named("name"));
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_remove_add() {
|
||||
let mut jar = CookieJar::new();
|
||||
jar.add_original(Cookie::new("name", "val"));
|
||||
assert_eq!(jar.delta().count(), 0);
|
||||
|
||||
jar.remove(Cookie::named("name"));
|
||||
assert_eq!(jar.delta().filter(|c| c.value().is_empty()).count(), 1);
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
|
||||
// The cookie's been deleted. Another original doesn't change that.
|
||||
jar.add_original(Cookie::new("name", "val"));
|
||||
assert_eq!(jar.delta().filter(|c| c.value().is_empty()).count(), 1);
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
|
||||
jar.remove(Cookie::named("name"));
|
||||
assert_eq!(jar.delta().filter(|c| c.value().is_empty()).count(), 1);
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
|
||||
jar.add(Cookie::new("name", "val"));
|
||||
assert_eq!(jar.delta().filter(|c| !c.value().is_empty()).count(), 1);
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
|
||||
jar.remove(Cookie::named("name"));
|
||||
assert_eq!(jar.delta().filter(|c| c.value().is_empty()).count(), 1);
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replace_remove() {
|
||||
let mut jar = CookieJar::new();
|
||||
jar.add_original(Cookie::new("name", "val"));
|
||||
assert_eq!(jar.delta().count(), 0);
|
||||
|
||||
jar.add(Cookie::new("name", "val"));
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
assert_eq!(jar.delta().filter(|c| !c.value().is_empty()).count(), 1);
|
||||
|
||||
jar.remove(Cookie::named("name"));
|
||||
assert_eq!(jar.delta().filter(|c| c.value().is_empty()).count(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_with_path() {
|
||||
let mut jar = CookieJar::new();
|
||||
jar.add_original(Cookie::build("name", "val").finish());
|
||||
assert_eq!(jar.iter().count(), 1);
|
||||
assert_eq!(jar.delta().count(), 0);
|
||||
assert_eq!(jar.iter().filter(|c| c.path().is_none()).count(), 1);
|
||||
|
||||
jar.remove(Cookie::build("name", "").path("/").finish());
|
||||
assert_eq!(jar.iter().count(), 0);
|
||||
assert_eq!(jar.delta().count(), 1);
|
||||
assert_eq!(jar.delta().filter(|c| c.value().is_empty()).count(), 1);
|
||||
assert_eq!(jar.delta().filter(|c| c.path() == Some("/")).count(), 1);
|
||||
}
|
||||
}
|
1063
third_party/rust/cookie-0.9.1/src/lib.rs
vendored
1063
third_party/rust/cookie-0.9.1/src/lib.rs
vendored
File diff suppressed because it is too large
Load Diff
410
third_party/rust/cookie-0.9.1/src/parse.rs
vendored
410
third_party/rust/cookie-0.9.1/src/parse.rs
vendored
@ -1,410 +0,0 @@
|
||||
use std::borrow::Cow;
|
||||
use std::cmp;
|
||||
use std::error::Error;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::str::Utf8Error;
|
||||
use std::fmt;
|
||||
use std::convert::From;
|
||||
|
||||
#[cfg(feature = "percent-encode")]
|
||||
use url::percent_encoding::percent_decode;
|
||||
use time::{self, Duration};
|
||||
|
||||
use ::{Cookie, SameSite, CookieStr};
|
||||
|
||||
/// Enum corresponding to a parsing error.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum ParseError {
|
||||
/// The cookie did not contain a name/value pair.
|
||||
MissingPair,
|
||||
/// The cookie's name was empty.
|
||||
EmptyName,
|
||||
/// Decoding the cookie's name or value resulted in invalid UTF-8.
|
||||
Utf8Error(Utf8Error),
|
||||
/// It is discouraged to exhaustively match on this enum as its variants may
|
||||
/// grow without a breaking-change bump in version numbers.
|
||||
#[doc(hidden)]
|
||||
__Nonexhasutive,
|
||||
}
|
||||
|
||||
impl ParseError {
|
||||
/// Returns a description of this error as a string
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match *self {
|
||||
ParseError::MissingPair => "the cookie is missing a name/value pair",
|
||||
ParseError::EmptyName => "the cookie's name is empty",
|
||||
ParseError::Utf8Error(_) => {
|
||||
"decoding the cookie's name or value resulted in invalid UTF-8"
|
||||
}
|
||||
ParseError::__Nonexhasutive => unreachable!("__Nonexhasutive ParseError"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ParseError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Utf8Error> for ParseError {
|
||||
fn from(error: Utf8Error) -> ParseError {
|
||||
ParseError::Utf8Error(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for ParseError {
|
||||
fn description(&self) -> &str {
|
||||
self.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
fn indexes_of(needle: &str, haystack: &str) -> Option<(usize, usize)> {
|
||||
let haystack_start = haystack.as_ptr() as usize;
|
||||
let needle_start = needle.as_ptr() as usize;
|
||||
|
||||
if needle_start < haystack_start {
|
||||
return None;
|
||||
}
|
||||
|
||||
if (needle_start + needle.len()) > (haystack_start + haystack.len()) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let start = needle_start - haystack_start;
|
||||
let end = start + needle.len();
|
||||
Some((start, end))
|
||||
}
|
||||
|
||||
#[cfg(feature = "percent-encode")]
|
||||
fn name_val_decoded(name: &str, val: &str) -> Result<(CookieStr, CookieStr), ParseError> {
|
||||
let decoded_name = percent_decode(name.as_bytes()).decode_utf8()?;
|
||||
let decoded_value = percent_decode(val.as_bytes()).decode_utf8()?;
|
||||
let name = CookieStr::Concrete(Cow::Owned(decoded_name.into_owned()));
|
||||
let val = CookieStr::Concrete(Cow::Owned(decoded_value.into_owned()));
|
||||
|
||||
Ok((name, val))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "percent-encode"))]
|
||||
fn name_val_decoded(_: &str, _: &str) -> Result<(CookieStr, CookieStr), ParseError> {
|
||||
unreachable!("This function should never be called when the feature is disabled!")
|
||||
}
|
||||
|
||||
// This function does the real parsing but _does not_ set the `cookie_string` in
|
||||
// the returned cookie object. This only exists so that the borrow to `s` is
|
||||
// returned at the end of the call, allowing the `cookie_string` field to be
|
||||
// set in the outer `parse` function.
|
||||
fn parse_inner<'c>(s: &str, decode: bool) -> Result<Cookie<'c>, ParseError> {
|
||||
let mut attributes = s.split(';');
|
||||
let key_value = match attributes.next() {
|
||||
Some(s) => s,
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
// Determine the name = val.
|
||||
let (name, value) = match key_value.find('=') {
|
||||
Some(i) => (key_value[..i].trim(), key_value[(i + 1)..].trim()),
|
||||
None => return Err(ParseError::MissingPair)
|
||||
};
|
||||
|
||||
if name.is_empty() {
|
||||
return Err(ParseError::EmptyName);
|
||||
}
|
||||
|
||||
// Create a cookie with all of the defaults. We'll fill things in while we
|
||||
// iterate through the parameters below.
|
||||
let (name, value) = if decode {
|
||||
name_val_decoded(name, value)?
|
||||
} else {
|
||||
let name_indexes = indexes_of(name, s).expect("name sub");
|
||||
let value_indexes = indexes_of(value, s).expect("value sub");
|
||||
let name = CookieStr::Indexed(name_indexes.0, name_indexes.1);
|
||||
let value = CookieStr::Indexed(value_indexes.0, value_indexes.1);
|
||||
|
||||
(name, value)
|
||||
};
|
||||
|
||||
let mut cookie = Cookie {
|
||||
cookie_string: None,
|
||||
name: name,
|
||||
value: value,
|
||||
expires: None,
|
||||
max_age: None,
|
||||
domain: None,
|
||||
path: None,
|
||||
secure: false,
|
||||
http_only: false,
|
||||
same_site: None
|
||||
};
|
||||
|
||||
for attr in attributes {
|
||||
let (key, value) = match attr.find('=') {
|
||||
Some(i) => (attr[..i].trim(), Some(attr[(i + 1)..].trim())),
|
||||
None => (attr.trim(), None),
|
||||
};
|
||||
|
||||
match (&*key.to_ascii_lowercase(), value) {
|
||||
("secure", _) => cookie.secure = true,
|
||||
("httponly", _) => cookie.http_only = true,
|
||||
("max-age", Some(v)) => {
|
||||
// See RFC 6265 Section 5.2.2, negative values indicate that the
|
||||
// earliest possible expiration time should be used, so set the
|
||||
// max age as 0 seconds.
|
||||
cookie.max_age = match v.parse() {
|
||||
Ok(val) if val <= 0 => Some(Duration::zero()),
|
||||
Ok(val) => {
|
||||
// Don't panic if the max age seconds is greater than what's supported by
|
||||
// `Duration`.
|
||||
let val = cmp::min(val, Duration::max_value().num_seconds());
|
||||
Some(Duration::seconds(val))
|
||||
}
|
||||
Err(_) => continue,
|
||||
};
|
||||
}
|
||||
("domain", Some(mut domain)) if !domain.is_empty() => {
|
||||
if domain.starts_with('.') {
|
||||
domain = &domain[1..];
|
||||
}
|
||||
|
||||
let (i, j) = indexes_of(domain, s).expect("domain sub");
|
||||
cookie.domain = Some(CookieStr::Indexed(i, j));
|
||||
}
|
||||
("path", Some(v)) => {
|
||||
let (i, j) = indexes_of(v, s).expect("path sub");
|
||||
cookie.path = Some(CookieStr::Indexed(i, j));
|
||||
}
|
||||
("samesite", Some(v)) => {
|
||||
if v.eq_ignore_ascii_case("strict") {
|
||||
cookie.same_site = Some(SameSite::Strict);
|
||||
} else if v.eq_ignore_ascii_case("lax") {
|
||||
cookie.same_site = Some(SameSite::Lax);
|
||||
} else {
|
||||
// We do nothing here, for now. When/if the `SameSite`
|
||||
// attribute becomes standard, the spec says that we should
|
||||
// ignore this cookie, i.e, fail to parse it, when an
|
||||
// invalid value is passed in. The draft is at
|
||||
// http://httpwg.org/http-extensions/draft-ietf-httpbis-cookie-same-site.html.
|
||||
}
|
||||
}
|
||||
("expires", Some(v)) => {
|
||||
// Try strptime with three date formats according to
|
||||
// http://tools.ietf.org/html/rfc2616#section-3.3.1. Try
|
||||
// additional ones as encountered in the real world.
|
||||
let tm = time::strptime(v, "%a, %d %b %Y %H:%M:%S %Z")
|
||||
.or_else(|_| time::strptime(v, "%A, %d-%b-%y %H:%M:%S %Z"))
|
||||
.or_else(|_| time::strptime(v, "%a, %d-%b-%Y %H:%M:%S %Z"))
|
||||
.or_else(|_| time::strptime(v, "%a %b %d %H:%M:%S %Y"));
|
||||
|
||||
if let Ok(time) = tm {
|
||||
cookie.expires = Some(time)
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// We're going to be permissive here. If we have no idea what
|
||||
// this is, then it's something nonstandard. We're not going to
|
||||
// store it (because it's not compliant), but we're also not
|
||||
// going to emit an error.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(cookie)
|
||||
}
|
||||
|
||||
pub fn parse_cookie<'c, S>(cow: S, decode: bool) -> Result<Cookie<'c>, ParseError>
|
||||
where S: Into<Cow<'c, str>>
|
||||
{
|
||||
let s = cow.into();
|
||||
let mut cookie = parse_inner(&s, decode)?;
|
||||
cookie.cookie_string = Some(s);
|
||||
Ok(cookie)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ::{Cookie, SameSite};
|
||||
use ::time::{strptime, Duration};
|
||||
|
||||
macro_rules! assert_eq_parse {
|
||||
($string:expr, $expected:expr) => (
|
||||
let cookie = match Cookie::parse($string) {
|
||||
Ok(cookie) => cookie,
|
||||
Err(e) => panic!("Failed to parse {:?}: {:?}", $string, e)
|
||||
};
|
||||
|
||||
assert_eq!(cookie, $expected);
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! assert_ne_parse {
|
||||
($string:expr, $expected:expr) => (
|
||||
let cookie = match Cookie::parse($string) {
|
||||
Ok(cookie) => cookie,
|
||||
Err(e) => panic!("Failed to parse {:?}: {:?}", $string, e)
|
||||
};
|
||||
|
||||
assert_ne!(cookie, $expected);
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_same_site() {
|
||||
let expected = Cookie::build("foo", "bar")
|
||||
.same_site(SameSite::Lax)
|
||||
.finish();
|
||||
|
||||
assert_eq_parse!("foo=bar; SameSite=Lax", expected);
|
||||
assert_eq_parse!("foo=bar; SameSite=lax", expected);
|
||||
assert_eq_parse!("foo=bar; SameSite=LAX", expected);
|
||||
assert_eq_parse!("foo=bar; samesite=Lax", expected);
|
||||
assert_eq_parse!("foo=bar; SAMESITE=Lax", expected);
|
||||
|
||||
let expected = Cookie::build("foo", "bar")
|
||||
.same_site(SameSite::Strict)
|
||||
.finish();
|
||||
|
||||
assert_eq_parse!("foo=bar; SameSite=Strict", expected);
|
||||
assert_eq_parse!("foo=bar; SameSITE=Strict", expected);
|
||||
assert_eq_parse!("foo=bar; SameSite=strict", expected);
|
||||
assert_eq_parse!("foo=bar; SameSite=STrICT", expected);
|
||||
assert_eq_parse!("foo=bar; SameSite=STRICT", expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse() {
|
||||
assert!(Cookie::parse("bar").is_err());
|
||||
assert!(Cookie::parse("=bar").is_err());
|
||||
assert!(Cookie::parse(" =bar").is_err());
|
||||
assert!(Cookie::parse("foo=").is_ok());
|
||||
|
||||
let expected = Cookie::build("foo", "bar=baz").finish();
|
||||
assert_eq_parse!("foo=bar=baz", expected);
|
||||
|
||||
let mut expected = Cookie::build("foo", "bar").finish();
|
||||
assert_eq_parse!("foo=bar", expected);
|
||||
assert_eq_parse!("foo = bar", expected);
|
||||
assert_eq_parse!(" foo=bar ", expected);
|
||||
assert_eq_parse!(" foo=bar ;Domain=", expected);
|
||||
assert_eq_parse!(" foo=bar ;Domain= ", expected);
|
||||
assert_eq_parse!(" foo=bar ;Ignored", expected);
|
||||
|
||||
let mut unexpected = Cookie::build("foo", "bar").http_only(false).finish();
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly", unexpected);
|
||||
assert_ne_parse!(" foo=bar; httponly", unexpected);
|
||||
|
||||
expected.set_http_only(true);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly", expected);
|
||||
assert_eq_parse!(" foo=bar ;httponly", expected);
|
||||
assert_eq_parse!(" foo=bar ;HTTPONLY=whatever", expected);
|
||||
assert_eq_parse!(" foo=bar ; sekure; HTTPONLY", expected);
|
||||
|
||||
expected.set_secure(true);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure", expected);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure=aaaa", expected);
|
||||
|
||||
unexpected.set_http_only(true);
|
||||
unexpected.set_secure(true);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; skeure", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; =secure", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly;", unexpected);
|
||||
|
||||
unexpected.set_secure(false);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; secure", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; secure", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; secure", unexpected);
|
||||
|
||||
expected.set_max_age(Duration::zero());
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=0", expected);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age = 0 ", expected);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=-1", expected);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age = -1 ", expected);
|
||||
|
||||
expected.set_max_age(Duration::minutes(1));
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=60", expected);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age = 60 ", expected);
|
||||
|
||||
expected.set_max_age(Duration::seconds(4));
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=4", expected);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age = 4 ", expected);
|
||||
|
||||
unexpected.set_secure(true);
|
||||
unexpected.set_max_age(Duration::minutes(1));
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=122", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; Secure; Max-Age = 38 ", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=51", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; Secure; Max-Age = -1 ", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; Secure; Max-Age = 0", unexpected);
|
||||
|
||||
expected.set_path("/");
|
||||
assert_eq_parse!("foo=bar;HttpOnly; Secure; Max-Age=4; Path=/", expected);
|
||||
assert_eq_parse!("foo=bar;HttpOnly; Secure; Max-Age=4;Path=/", expected);
|
||||
|
||||
expected.set_path("/foo");
|
||||
assert_eq_parse!("foo=bar;HttpOnly; Secure; Max-Age=4; Path=/foo", expected);
|
||||
assert_eq_parse!("foo=bar;HttpOnly; Secure; Max-Age=4;Path=/foo", expected);
|
||||
assert_eq_parse!("foo=bar;HttpOnly; Secure; Max-Age=4;path=/foo", expected);
|
||||
assert_eq_parse!("foo=bar;HttpOnly; Secure; Max-Age=4;path = /foo", expected);
|
||||
|
||||
unexpected.set_max_age(Duration::seconds(4));
|
||||
unexpected.set_path("/bar");
|
||||
assert_ne_parse!("foo=bar;HttpOnly; Secure; Max-Age=4; Path=/foo", unexpected);
|
||||
assert_ne_parse!("foo=bar;HttpOnly; Secure; Max-Age=4;Path=/baz", unexpected);
|
||||
|
||||
expected.set_domain("www.foo.com");
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
Domain=www.foo.com", expected);
|
||||
|
||||
expected.set_domain("foo.com");
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
Domain=foo.com", expected);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
Domain=FOO.COM", expected);
|
||||
|
||||
unexpected.set_path("/foo");
|
||||
unexpected.set_domain("bar.com");
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
Domain=foo.com", unexpected);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
Domain=FOO.COM", unexpected);
|
||||
|
||||
let time_str = "Wed, 21 Oct 2015 07:28:00 GMT";
|
||||
let expires = strptime(time_str, "%a, %d %b %Y %H:%M:%S %Z").unwrap();
|
||||
expected.set_expires(expires);
|
||||
assert_eq_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
Domain=foo.com; Expires=Wed, 21 Oct 2015 07:28:00 GMT", expected);
|
||||
|
||||
unexpected.set_domain("foo.com");
|
||||
let bad_expires = strptime(time_str, "%a, %d %b %Y %H:%S:%M %Z").unwrap();
|
||||
expected.set_expires(bad_expires);
|
||||
assert_ne_parse!(" foo=bar ;HttpOnly; Secure; Max-Age=4; Path=/foo; \
|
||||
Domain=foo.com; Expires=Wed, 21 Oct 2015 07:28:00 GMT", unexpected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn odd_characters() {
|
||||
let expected = Cookie::new("foo", "b%2Fr");
|
||||
assert_eq_parse!("foo=b%2Fr", expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "percent-encode")]
|
||||
fn odd_characters_encoded() {
|
||||
let expected = Cookie::new("foo", "b/r");
|
||||
let cookie = match Cookie::parse_encoded("foo=b%2Fr") {
|
||||
Ok(cookie) => cookie,
|
||||
Err(e) => panic!("Failed to parse: {:?}", e)
|
||||
};
|
||||
|
||||
assert_eq!(cookie, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn do_not_panic_on_large_max_ages() {
|
||||
let max_seconds = Duration::max_value().num_seconds();
|
||||
let expected = Cookie::build("foo", "bar")
|
||||
.max_age(Duration::seconds(max_seconds))
|
||||
.finish();
|
||||
assert_eq_parse!(format!(" foo=bar; Max-Age={:?}", max_seconds + 1), expected);
|
||||
}
|
||||
}
|
174
third_party/rust/cookie-0.9.1/src/secure/key.rs
vendored
174
third_party/rust/cookie-0.9.1/src/secure/key.rs
vendored
@ -1,174 +0,0 @@
|
||||
use secure::ring::hkdf::expand;
|
||||
use secure::ring::digest::{SHA256, Algorithm};
|
||||
use secure::ring::hmac::SigningKey;
|
||||
use secure::ring::rand::{SecureRandom, SystemRandom};
|
||||
|
||||
use secure::private::KEY_LEN as PRIVATE_KEY_LEN;
|
||||
use secure::signed::KEY_LEN as SIGNED_KEY_LEN;
|
||||
|
||||
static HKDF_DIGEST: &'static Algorithm = &SHA256;
|
||||
const KEYS_INFO: &'static str = "COOKIE;SIGNED:HMAC-SHA256;PRIVATE:AEAD-AES-256-GCM";
|
||||
|
||||
/// A cryptographic master key for use with `Signed` and/or `Private` jars.
|
||||
///
|
||||
/// This structure encapsulates secure, cryptographic keys for use with both
|
||||
/// [PrivateJar](struct.PrivateJar.html) and [SignedJar](struct.SignedJar.html).
|
||||
/// It can be derived from a single master key via
|
||||
/// [from_master](#method.from_master) or generated from a secure random source
|
||||
/// via [generate](#method.generate). A single instance of `Key` can be used for
|
||||
/// both a `PrivateJar` and a `SignedJar`.
|
||||
///
|
||||
/// This type is only available when the `secure` feature is enabled.
|
||||
#[derive(Clone)]
|
||||
pub struct Key {
|
||||
signing_key: [u8; SIGNED_KEY_LEN],
|
||||
encryption_key: [u8; PRIVATE_KEY_LEN]
|
||||
}
|
||||
|
||||
impl Key {
|
||||
/// Derives new signing/encryption keys from a master key.
|
||||
///
|
||||
/// The master key must be at least 256-bits (32 bytes). For security, the
|
||||
/// master key _must_ be cryptographically random. The keys are derived
|
||||
/// deterministically from the master key.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `key` is less than 32 bytes in length.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Key;
|
||||
///
|
||||
/// # /*
|
||||
/// let master_key = { /* a cryptographically random key >= 32 bytes */ };
|
||||
/// # */
|
||||
/// # let master_key: &Vec<u8> = &(0..32).collect();
|
||||
///
|
||||
/// let key = Key::from_master(master_key);
|
||||
/// ```
|
||||
pub fn from_master(key: &[u8]) -> Key {
|
||||
if key.len() < 32 {
|
||||
panic!("bad master key length: expected at least 32 bytes, found {}", key.len());
|
||||
}
|
||||
|
||||
// Expand the user's key into two.
|
||||
let prk = SigningKey::new(HKDF_DIGEST, key);
|
||||
let mut both_keys = [0; SIGNED_KEY_LEN + PRIVATE_KEY_LEN];
|
||||
expand(&prk, KEYS_INFO.as_bytes(), &mut both_keys);
|
||||
|
||||
// Copy the keys into their respective arrays.
|
||||
let mut signing_key = [0; SIGNED_KEY_LEN];
|
||||
let mut encryption_key = [0; PRIVATE_KEY_LEN];
|
||||
signing_key.copy_from_slice(&both_keys[..SIGNED_KEY_LEN]);
|
||||
encryption_key.copy_from_slice(&both_keys[SIGNED_KEY_LEN..]);
|
||||
|
||||
Key {
|
||||
signing_key: signing_key,
|
||||
encryption_key: encryption_key
|
||||
}
|
||||
}
|
||||
|
||||
/// Generates signing/encryption keys from a secure, random source. Keys are
|
||||
/// generated nondeterministically.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if randomness cannot be retrieved from the operating system. See
|
||||
/// [try_generate](#method.try_generate) for a non-panicking version.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Key;
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// ```
|
||||
pub fn generate() -> Key {
|
||||
Self::try_generate().expect("failed to generate `Key` from randomness")
|
||||
}
|
||||
|
||||
/// Attempts to generate signing/encryption keys from a secure, random
|
||||
/// source. Keys are generated nondeterministically. If randomness cannot be
|
||||
/// retrieved from the underlying operating system, returns `None`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Key;
|
||||
///
|
||||
/// let key = Key::try_generate();
|
||||
/// ```
|
||||
pub fn try_generate() -> Option<Key> {
|
||||
let mut sign_key = [0; SIGNED_KEY_LEN];
|
||||
let mut enc_key = [0; PRIVATE_KEY_LEN];
|
||||
|
||||
let rng = SystemRandom::new();
|
||||
if rng.fill(&mut sign_key).is_err() || rng.fill(&mut enc_key).is_err() {
|
||||
return None
|
||||
}
|
||||
|
||||
Some(Key { signing_key: sign_key, encryption_key: enc_key })
|
||||
}
|
||||
|
||||
/// Returns the raw bytes of a key suitable for signing cookies.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Key;
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// let signing_key = key.signing();
|
||||
/// ```
|
||||
pub fn signing(&self) -> &[u8] {
|
||||
&self.signing_key[..]
|
||||
}
|
||||
|
||||
/// Returns the raw bytes of a key suitable for encrypting cookies.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::Key;
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// let encryption_key = key.encryption();
|
||||
/// ```
|
||||
pub fn encryption(&self) -> &[u8] {
|
||||
&self.encryption_key[..]
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::Key;
|
||||
|
||||
#[test]
|
||||
fn deterministic_from_master() {
|
||||
let master_key: Vec<u8> = (0..32).collect();
|
||||
|
||||
let key_a = Key::from_master(&master_key);
|
||||
let key_b = Key::from_master(&master_key);
|
||||
|
||||
assert_eq!(key_a.signing(), key_b.signing());
|
||||
assert_eq!(key_a.encryption(), key_b.encryption());
|
||||
assert_ne!(key_a.encryption(), key_a.signing());
|
||||
|
||||
let master_key_2: Vec<u8> = (32..64).collect();
|
||||
let key_2 = Key::from_master(&master_key_2);
|
||||
|
||||
assert_ne!(key_2.signing(), key_a.signing());
|
||||
assert_ne!(key_2.encryption(), key_a.encryption());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn non_deterministic_generate() {
|
||||
let key_a = Key::generate();
|
||||
let key_b = Key::generate();
|
||||
|
||||
assert_ne!(key_a.signing(), key_b.signing());
|
||||
assert_ne!(key_a.encryption(), key_b.encryption());
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
#[cfg(test)]
|
||||
macro_rules! assert_simple_behaviour {
|
||||
($clear:expr, $secure:expr) => ({
|
||||
assert_eq!($clear.iter().count(), 0);
|
||||
|
||||
$secure.add(Cookie::new("name", "val"));
|
||||
assert_eq!($clear.iter().count(), 1);
|
||||
assert_eq!($secure.get("name").unwrap().value(), "val");
|
||||
assert_ne!($clear.get("name").unwrap().value(), "val");
|
||||
|
||||
$secure.add(Cookie::new("another", "two"));
|
||||
assert_eq!($clear.iter().count(), 2);
|
||||
|
||||
$clear.remove(Cookie::named("another"));
|
||||
assert_eq!($clear.iter().count(), 1);
|
||||
|
||||
$secure.remove(Cookie::named("name"));
|
||||
assert_eq!($clear.iter().count(), 0);
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
macro_rules! assert_secure_behaviour {
|
||||
($clear:expr, $secure:expr) => ({
|
||||
$secure.add(Cookie::new("secure", "secure"));
|
||||
assert!($clear.get("secure").unwrap().value() != "secure");
|
||||
assert!($secure.get("secure").unwrap().value() == "secure");
|
||||
|
||||
let mut cookie = $clear.get("secure").unwrap().clone();
|
||||
let new_val = format!("{}l", cookie.value());
|
||||
cookie.set_value(new_val);
|
||||
$clear.add(cookie);
|
||||
assert!($secure.get("secure").is_none());
|
||||
|
||||
let mut cookie = $clear.get("secure").unwrap().clone();
|
||||
cookie.set_value("foobar");
|
||||
$clear.add(cookie);
|
||||
assert!($secure.get("secure").is_none());
|
||||
})
|
||||
}
|
||||
|
12
third_party/rust/cookie-0.9.1/src/secure/mod.rs
vendored
12
third_party/rust/cookie-0.9.1/src/secure/mod.rs
vendored
@ -1,12 +0,0 @@
|
||||
extern crate ring;
|
||||
extern crate base64;
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
mod private;
|
||||
mod signed;
|
||||
mod key;
|
||||
|
||||
pub use self::private::*;
|
||||
pub use self::signed::*;
|
||||
pub use self::key::*;
|
178
third_party/rust/cookie-0.9.1/src/secure/private.rs
vendored
178
third_party/rust/cookie-0.9.1/src/secure/private.rs
vendored
@ -1,178 +0,0 @@
|
||||
use secure::ring::aead::{seal_in_place, open_in_place, Algorithm, AES_256_GCM};
|
||||
use secure::ring::aead::{OpeningKey, SealingKey};
|
||||
use secure::ring::rand::{SecureRandom, SystemRandom};
|
||||
use secure::{base64, Key};
|
||||
|
||||
use {Cookie, CookieJar};
|
||||
|
||||
// Keep these in sync, and keep the key len synced with the `private` docs as
|
||||
// well as the `KEYS_INFO` const in secure::Key.
|
||||
static ALGO: &'static Algorithm = &AES_256_GCM;
|
||||
const NONCE_LEN: usize = 12;
|
||||
pub const KEY_LEN: usize = 32;
|
||||
|
||||
/// A child cookie jar that provides authenticated encryption for its cookies.
|
||||
///
|
||||
/// A _private_ child jar signs and encrypts all the cookies added to it and
|
||||
/// verifies and decrypts cookies retrieved from it. Any cookies stored in a
|
||||
/// `PrivateJar` are simultaneously assured confidentiality, integrity, and
|
||||
/// authenticity. In other words, clients cannot discover nor tamper with the
|
||||
/// contents of a cookie, nor can they fabricate cookie data.
|
||||
///
|
||||
/// This type is only available when the `secure` feature is enabled.
|
||||
pub struct PrivateJar<'a> {
|
||||
parent: &'a mut CookieJar,
|
||||
key: [u8; KEY_LEN]
|
||||
}
|
||||
|
||||
impl<'a> PrivateJar<'a> {
|
||||
/// Creates a new child `PrivateJar` with parent `parent` and key `key`.
|
||||
/// This method is typically called indirectly via the `signed` method of
|
||||
/// `CookieJar`.
|
||||
#[doc(hidden)]
|
||||
pub fn new(parent: &'a mut CookieJar, key: &Key) -> PrivateJar<'a> {
|
||||
let mut key_array = [0u8; KEY_LEN];
|
||||
key_array.copy_from_slice(key.encryption());
|
||||
PrivateJar { parent: parent, key: key_array }
|
||||
}
|
||||
|
||||
/// Given a sealed value `str` where the nonce is prepended to the original
|
||||
/// value and then both are Base64 encoded, verifies and decrypts the sealed
|
||||
/// value and returns it. If there's a problem, returns an `Err` with a
|
||||
/// string describing the issue.
|
||||
fn unseal(&self, value: &str) -> Result<String, &'static str> {
|
||||
let mut data = base64::decode(value).map_err(|_| "bad base64 value")?;
|
||||
if data.len() <= NONCE_LEN {
|
||||
return Err("length of decoded data is <= NONCE_LEN");
|
||||
}
|
||||
|
||||
let key = OpeningKey::new(ALGO, &self.key).expect("opening key");
|
||||
let (nonce, sealed) = data.split_at_mut(NONCE_LEN);
|
||||
let unsealed = open_in_place(&key, nonce, &[], 0, sealed)
|
||||
.map_err(|_| "invalid key/nonce/value: bad seal")?;
|
||||
|
||||
::std::str::from_utf8(unsealed)
|
||||
.map(|s| s.to_string())
|
||||
.map_err(|_| "bad unsealed utf8")
|
||||
}
|
||||
|
||||
/// Returns a reference to the `Cookie` inside this jar with the name `name`
|
||||
/// and authenticates and decrypts the cookie's value, returning a `Cookie`
|
||||
/// with the decrypted value. If the cookie cannot be found, or the cookie
|
||||
/// fails to authenticate or decrypt, `None` is returned.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie, Key};
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// let mut private_jar = jar.private(&key);
|
||||
/// assert!(private_jar.get("name").is_none());
|
||||
///
|
||||
/// private_jar.add(Cookie::new("name", "value"));
|
||||
/// assert_eq!(private_jar.get("name").unwrap().value(), "value");
|
||||
/// ```
|
||||
pub fn get(&self, name: &str) -> Option<Cookie<'static>> {
|
||||
if let Some(cookie_ref) = self.parent.get(name) {
|
||||
let mut cookie = cookie_ref.clone();
|
||||
if let Ok(value) = self.unseal(cookie.value()) {
|
||||
cookie.set_value(value);
|
||||
return Some(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
/// Adds `cookie` to the parent jar. The cookie's value is encrypted with
|
||||
/// authenticated encryption assuring confidentiality, integrity, and
|
||||
/// authenticity.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie, Key};
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.private(&key).add(Cookie::new("name", "value"));
|
||||
///
|
||||
/// assert_ne!(jar.get("name").unwrap().value(), "value");
|
||||
/// assert_eq!(jar.private(&key).get("name").unwrap().value(), "value");
|
||||
/// ```
|
||||
pub fn add(&mut self, mut cookie: Cookie<'static>) {
|
||||
let mut data;
|
||||
let output_len = {
|
||||
// Create the `SealingKey` structure.
|
||||
let key = SealingKey::new(ALGO, &self.key).expect("sealing key creation");
|
||||
|
||||
// Create a vec to hold the [nonce | cookie value | overhead].
|
||||
let overhead = ALGO.tag_len();
|
||||
let cookie_val = cookie.value().as_bytes();
|
||||
data = vec![0; NONCE_LEN + cookie_val.len() + overhead];
|
||||
|
||||
// Randomly generate the nonce, then copy the cookie value as input.
|
||||
let (nonce, in_out) = data.split_at_mut(NONCE_LEN);
|
||||
SystemRandom::new().fill(nonce).expect("couldn't random fill nonce");
|
||||
in_out[..cookie_val.len()].copy_from_slice(cookie_val);
|
||||
|
||||
// Perform the actual sealing operation and get the output length.
|
||||
seal_in_place(&key, nonce, &[], in_out, overhead).expect("in-place seal")
|
||||
};
|
||||
|
||||
// Base64 encode the nonce and encrypted value.
|
||||
let sealed_value = base64::encode(&data[..(NONCE_LEN + output_len)]);
|
||||
cookie.set_value(sealed_value);
|
||||
|
||||
// Add the sealed cookie to the parent.
|
||||
self.parent.add(cookie);
|
||||
}
|
||||
|
||||
/// Removes `cookie` from the parent jar.
|
||||
///
|
||||
/// For correct removal, the passed in `cookie` must contain the same `path`
|
||||
/// and `domain` as the cookie that was initially set.
|
||||
///
|
||||
/// See [CookieJar::remove](struct.CookieJar.html#method.remove) for more
|
||||
/// details.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie, Key};
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// let mut private_jar = jar.private(&key);
|
||||
///
|
||||
/// private_jar.add(Cookie::new("name", "value"));
|
||||
/// assert!(private_jar.get("name").is_some());
|
||||
///
|
||||
/// private_jar.remove(Cookie::named("name"));
|
||||
/// assert!(private_jar.get("name").is_none());
|
||||
/// ```
|
||||
pub fn remove(&mut self, cookie: Cookie<'static>) {
|
||||
self.parent.remove(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use {CookieJar, Cookie, Key};
|
||||
|
||||
#[test]
|
||||
fn simple() {
|
||||
let key = Key::generate();
|
||||
let mut jar = CookieJar::new();
|
||||
assert_simple_behaviour!(jar, jar.private(&key));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn private() {
|
||||
let key = Key::generate();
|
||||
let mut jar = CookieJar::new();
|
||||
assert_secure_behaviour!(jar, jar.private(&key));
|
||||
}
|
||||
}
|
152
third_party/rust/cookie-0.9.1/src/secure/signed.rs
vendored
152
third_party/rust/cookie-0.9.1/src/secure/signed.rs
vendored
@ -1,152 +0,0 @@
|
||||
use secure::ring::digest::{SHA256, Algorithm};
|
||||
use secure::ring::hmac::{SigningKey, sign, verify_with_own_key as verify};
|
||||
use secure::{base64, Key};
|
||||
|
||||
use {Cookie, CookieJar};
|
||||
|
||||
// Keep these in sync, and keep the key len synced with the `signed` docs as
|
||||
// well as the `KEYS_INFO` const in secure::Key.
|
||||
static HMAC_DIGEST: &'static Algorithm = &SHA256;
|
||||
const BASE64_DIGEST_LEN: usize = 44;
|
||||
pub const KEY_LEN: usize = 32;
|
||||
|
||||
/// A child cookie jar that authenticates its cookies.
|
||||
///
|
||||
/// A _signed_ child jar signs all the cookies added to it and verifies cookies
|
||||
/// retrieved from it. Any cookies stored in a `SignedJar` are assured integrity
|
||||
/// and authenticity. In other words, clients cannot tamper with the contents of
|
||||
/// a cookie nor can they fabricate cookie values, but the data is visible in
|
||||
/// plaintext.
|
||||
///
|
||||
/// This type is only available when the `secure` feature is enabled.
|
||||
pub struct SignedJar<'a> {
|
||||
parent: &'a mut CookieJar,
|
||||
key: SigningKey
|
||||
}
|
||||
|
||||
impl<'a> SignedJar<'a> {
|
||||
/// Creates a new child `SignedJar` with parent `parent` and key `key`. This
|
||||
/// method is typically called indirectly via the `signed` method of
|
||||
/// `CookieJar`.
|
||||
#[doc(hidden)]
|
||||
pub fn new(parent: &'a mut CookieJar, key: &Key) -> SignedJar<'a> {
|
||||
SignedJar { parent: parent, key: SigningKey::new(HMAC_DIGEST, key.signing()) }
|
||||
}
|
||||
|
||||
/// Given a signed value `str` where the signature is prepended to `value`,
|
||||
/// verifies the signed value and returns it. If there's a problem, returns
|
||||
/// an `Err` with a string describing the issue.
|
||||
fn verify(&self, cookie_value: &str) -> Result<String, &'static str> {
|
||||
if cookie_value.len() < BASE64_DIGEST_LEN {
|
||||
return Err("length of value is <= BASE64_DIGEST_LEN");
|
||||
}
|
||||
|
||||
let (digest_str, value) = cookie_value.split_at(BASE64_DIGEST_LEN);
|
||||
let sig = base64::decode(digest_str).map_err(|_| "bad base64 digest")?;
|
||||
|
||||
verify(&self.key, value.as_bytes(), &sig)
|
||||
.map(|_| value.to_string())
|
||||
.map_err(|_| "value did not verify")
|
||||
}
|
||||
|
||||
/// Returns a reference to the `Cookie` inside this jar with the name `name`
|
||||
/// and verifies the authenticity and integrity of the cookie's value,
|
||||
/// returning a `Cookie` with the authenticated value. If the cookie cannot
|
||||
/// be found, or the cookie fails to verify, `None` is returned.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie, Key};
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// let mut signed_jar = jar.signed(&key);
|
||||
/// assert!(signed_jar.get("name").is_none());
|
||||
///
|
||||
/// signed_jar.add(Cookie::new("name", "value"));
|
||||
/// assert_eq!(signed_jar.get("name").unwrap().value(), "value");
|
||||
/// ```
|
||||
pub fn get(&self, name: &str) -> Option<Cookie<'static>> {
|
||||
if let Some(cookie_ref) = self.parent.get(name) {
|
||||
let mut cookie = cookie_ref.clone();
|
||||
if let Ok(value) = self.verify(cookie.value()) {
|
||||
cookie.set_value(value);
|
||||
return Some(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
/// Adds `cookie` to the parent jar. The cookie's value is signed assuring
|
||||
/// integrity and authenticity.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie, Key};
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// jar.signed(&key).add(Cookie::new("name", "value"));
|
||||
///
|
||||
/// assert_ne!(jar.get("name").unwrap().value(), "value");
|
||||
/// assert!(jar.get("name").unwrap().value().contains("value"));
|
||||
/// assert_eq!(jar.signed(&key).get("name").unwrap().value(), "value");
|
||||
/// ```
|
||||
pub fn add(&mut self, mut cookie: Cookie<'static>) {
|
||||
let digest = sign(&self.key, cookie.value().as_bytes());
|
||||
let mut new_value = base64::encode(digest.as_ref());
|
||||
new_value.push_str(cookie.value());
|
||||
cookie.set_value(new_value);
|
||||
|
||||
self.parent.add(cookie);
|
||||
}
|
||||
|
||||
/// Removes `cookie` from the parent jar.
|
||||
///
|
||||
/// For correct removal, the passed in `cookie` must contain the same `path`
|
||||
/// and `domain` as the cookie that was initially set.
|
||||
///
|
||||
/// See [CookieJar::remove](struct.CookieJar.html#method.remove) for more
|
||||
/// details.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use cookie::{CookieJar, Cookie, Key};
|
||||
///
|
||||
/// let key = Key::generate();
|
||||
/// let mut jar = CookieJar::new();
|
||||
/// let mut signed_jar = jar.signed(&key);
|
||||
///
|
||||
/// signed_jar.add(Cookie::new("name", "value"));
|
||||
/// assert!(signed_jar.get("name").is_some());
|
||||
///
|
||||
/// signed_jar.remove(Cookie::named("name"));
|
||||
/// assert!(signed_jar.get("name").is_none());
|
||||
/// ```
|
||||
pub fn remove(&mut self, cookie: Cookie<'static>) {
|
||||
self.parent.remove(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use {CookieJar, Cookie, Key};
|
||||
|
||||
#[test]
|
||||
fn simple() {
|
||||
let key = Key::generate();
|
||||
let mut jar = CookieJar::new();
|
||||
assert_simple_behaviour!(jar, jar.signed(&key));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn private() {
|
||||
let key = Key::generate();
|
||||
let mut jar = CookieJar::new();
|
||||
assert_secure_behaviour!(jar, jar.signed(&key));
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
98
third_party/rust/libc-0.2.30/.travis.yml
vendored
98
third_party/rust/libc-0.2.30/.travis.yml
vendored
@ -1,98 +0,0 @@
|
||||
language: rust
|
||||
rust: stable
|
||||
sudo: required
|
||||
dist: trusty
|
||||
services:
|
||||
- docker
|
||||
install:
|
||||
- if [ -z "$NO_ADD" ]; then rustup target add $TARGET; fi
|
||||
script:
|
||||
- cargo build
|
||||
- cargo build --no-default-features
|
||||
- cargo generate-lockfile --manifest-path libc-test/Cargo.toml
|
||||
- if [[ $TRAVIS_OS_NAME = "linux" ]]; then
|
||||
sh ci/run-docker.sh $TARGET;
|
||||
else
|
||||
export CARGO_TARGET_DIR=`pwd`/target;
|
||||
sh ci/run.sh $TARGET;
|
||||
fi
|
||||
- rustc ci/style.rs && ./style src
|
||||
env:
|
||||
global:
|
||||
secure: "e2/3QjgRN9atOuSHp22TrYG7QVKcYUWY48Hi9b60w+r1+BhPkTseIJLte7WefRhdXtqpjjUJTooKDhnurFOeHaCT+nmBgiv+FPU893sBl4bhesY4m0vgUJVbNZcs6lTImYekWVb+aqjGdgV/XAgCw7c3kPmrZV0MzGDWL64Xaps="
|
||||
matrix:
|
||||
include:
|
||||
# 1.0.0 compat
|
||||
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
|
||||
rust: 1.0.0
|
||||
script: cargo build
|
||||
install:
|
||||
|
||||
# build documentation
|
||||
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
|
||||
rust: nightly
|
||||
script: sh ci/dox.sh
|
||||
|
||||
# stable compat
|
||||
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
|
||||
- env: TARGET=i686-unknown-linux-gnu
|
||||
- os: osx
|
||||
env: TARGET=x86_64-apple-darwin NO_ADD=1
|
||||
- os: osx
|
||||
env: TARGET=i686-apple-darwin
|
||||
- env: TARGET=arm-linux-androideabi
|
||||
- env: TARGET=aarch64-linux-android
|
||||
- env: TARGET=i686-linux-android
|
||||
- env: TARGET=x86_64-linux-android
|
||||
- env: TARGET=x86_64-unknown-linux-musl
|
||||
- env: TARGET=i686-unknown-linux-musl
|
||||
- env: TARGET=arm-unknown-linux-gnueabihf
|
||||
- env: TARGET=aarch64-unknown-linux-gnu
|
||||
- os: osx
|
||||
osx_image: xcode8.2
|
||||
env: TARGET=i386-apple-ios
|
||||
CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
|
||||
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
|
||||
before_install:
|
||||
rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
|
||||
- os: osx
|
||||
osx_image: xcode8.2
|
||||
env: TARGET=x86_64-apple-ios
|
||||
CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
|
||||
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
|
||||
before_install:
|
||||
rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
|
||||
- env: TARGET=x86_64-rumprun-netbsd
|
||||
- env: TARGET=powerpc-unknown-linux-gnu
|
||||
- env: TARGET=powerpc64-unknown-linux-gnu
|
||||
- env: TARGET=mips-unknown-linux-musl
|
||||
- env: TARGET=mipsel-unknown-linux-musl
|
||||
- env: TARGET=mips64-unknown-linux-gnuabi64
|
||||
- env: TARGET=mips-unknown-linux-gnu
|
||||
- env: TARGET=s390x-unknown-linux-gnu
|
||||
- env: TARGET=asmjs-unknown-emscripten
|
||||
- env: TARGET=wasm32-unknown-emscripten
|
||||
|
||||
# beta
|
||||
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
|
||||
rust: beta
|
||||
- os: osx
|
||||
env: TARGET=x86_64-apple-darwin NO_ADD=1
|
||||
rust: beta
|
||||
|
||||
# nightly
|
||||
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
|
||||
rust: nightly
|
||||
- os: osx
|
||||
env: TARGET=x86_64-apple-darwin NO_ADD=1
|
||||
rust: nightly
|
||||
|
||||
# QEMU based targets that compile in an emulator
|
||||
- env: TARGET=x86_64-unknown-freebsd
|
||||
|
||||
cache: cargo
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
webhooks: https://buildbot.rust-lang.org/homu/travis
|
31
third_party/rust/libc-0.2.30/Cargo.toml
vendored
31
third_party/rust/libc-0.2.30/Cargo.toml
vendored
@ -1,31 +0,0 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
name = "libc"
|
||||
version = "0.2.30"
|
||||
authors = ["The Rust Project Developers"]
|
||||
description = "A library for types and bindings to native C functions often found in libc or\nother common platform libraries.\n"
|
||||
homepage = "https://github.com/rust-lang/libc"
|
||||
documentation = "http://doc.rust-lang.org/libc"
|
||||
readme = "README.md"
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rust-lang/libc"
|
||||
|
||||
[features]
|
||||
default = ["use_std"]
|
||||
use_std = []
|
||||
[badges.travis-ci]
|
||||
repository = "rust-lang/libc"
|
||||
|
||||
[badges.appveyor]
|
||||
repository = "rust-lang-libs/libc"
|
201
third_party/rust/libc-0.2.30/LICENSE-APACHE
vendored
201
third_party/rust/libc-0.2.30/LICENSE-APACHE
vendored
@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
25
third_party/rust/libc-0.2.30/LICENSE-MIT
vendored
25
third_party/rust/libc-0.2.30/LICENSE-MIT
vendored
@ -1,25 +0,0 @@
|
||||
Copyright (c) 2014 The Rust Project Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
156
third_party/rust/libc-0.2.30/README.md
vendored
156
third_party/rust/libc-0.2.30/README.md
vendored
@ -1,156 +0,0 @@
|
||||
libc
|
||||
====
|
||||
|
||||
A Rust library with native bindings to the types and functions commonly found on
|
||||
various systems, including libc.
|
||||
|
||||
[![Build Status](https://travis-ci.org/rust-lang/libc.svg?branch=master)](https://travis-ci.org/rust-lang/libc)
|
||||
[![Build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/libc?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/libc)
|
||||
|
||||
[Documentation](#platforms-and-documentation)
|
||||
|
||||
## Usage
|
||||
|
||||
First, add the following to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
```
|
||||
|
||||
Next, add this to your crate root:
|
||||
|
||||
```rust
|
||||
extern crate libc;
|
||||
```
|
||||
|
||||
Currently libc by default links to the standard library, but if you would
|
||||
instead like to use libc in a `#![no_std]` situation or crate you can request
|
||||
this via:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
libc = { version = "0.2", default-features = false }
|
||||
```
|
||||
|
||||
## What is libc?
|
||||
|
||||
The primary purpose of this crate is to provide all of the definitions necessary
|
||||
to easily interoperate with C code (or "C-like" code) on each of the platforms
|
||||
that Rust supports. This includes type definitions (e.g. `c_int`), constants
|
||||
(e.g. `EINVAL`) as well as function headers (e.g. `malloc`).
|
||||
|
||||
This crate does not strive to have any form of compatibility across platforms,
|
||||
but rather it is simply a straight binding to the system libraries on the
|
||||
platform in question.
|
||||
|
||||
## Public API
|
||||
|
||||
This crate exports all underlying platform types, functions, and constants under
|
||||
the crate root, so all items are accessible as `libc::foo`. The types and values
|
||||
of all the exported APIs match the platform that libc is compiled for.
|
||||
|
||||
More detailed information about the design of this library can be found in its
|
||||
[associated RFC][rfc].
|
||||
|
||||
[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1291-promote-libc.md
|
||||
|
||||
## Adding an API
|
||||
|
||||
Want to use an API which currently isn't bound in `libc`? It's quite easy to add
|
||||
one!
|
||||
|
||||
The internal structure of this crate is designed to minimize the number of
|
||||
`#[cfg]` attributes in order to easily be able to add new items which apply
|
||||
to all platforms in the future. As a result, the crate is organized
|
||||
hierarchically based on platform. Each module has a number of `#[cfg]`'d
|
||||
children, but only one is ever actually compiled. Each module then reexports all
|
||||
the contents of its children.
|
||||
|
||||
This means that for each platform that libc supports, the path from a
|
||||
leaf module to the root will contain all bindings for the platform in question.
|
||||
Consequently, this indicates where an API should be added! Adding an API at a
|
||||
particular level in the hierarchy means that it is supported on all the child
|
||||
platforms of that level. For example, when adding a Unix API it should be added
|
||||
to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to
|
||||
`src/unix/notbsd/linux/mod.rs`.
|
||||
|
||||
If you're not 100% sure at what level of the hierarchy an API should be added
|
||||
at, fear not! This crate has CI support which tests any binding against all
|
||||
platforms supported, so you'll see failures if an API is added at the wrong
|
||||
level or has different signatures across platforms.
|
||||
|
||||
With that in mind, the steps for adding a new API are:
|
||||
|
||||
1. Determine where in the module hierarchy your API should be added.
|
||||
2. Add the API.
|
||||
3. Send a PR to this repo.
|
||||
4. Wait for CI to pass, fixing errors.
|
||||
5. Wait for a merge!
|
||||
|
||||
### Test before you commit
|
||||
|
||||
We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc):
|
||||
|
||||
1. [`libc-test`](https://github.com/alexcrichton/ctest)
|
||||
- `cd libc-test && cargo test`
|
||||
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
|
||||
2. Style checker
|
||||
- `rustc ci/style.rs && ./style src`
|
||||
|
||||
### Releasing your change to crates.io
|
||||
|
||||
Now that you've done the amazing job of landing your new API or your new
|
||||
platform in this crate, the next step is to get that sweet, sweet usage from
|
||||
crates.io! The only next step is to bump the version of libc and then publish
|
||||
it. If you'd like to get a release out ASAP you can follow these steps:
|
||||
|
||||
1. Update the version number in `Cargo.toml`, you'll just be bumping the patch
|
||||
version number.
|
||||
2. Run `cargo update` to regenerate the lockfile to encode your version bump in
|
||||
the lock file. You may pull in some other updated dependencies, that's ok.
|
||||
3. Send a PR to this repository. It should [look like this][example], but it'd
|
||||
also be nice to fill out the description with a small rationale for the
|
||||
release (any rationale is ok though!)
|
||||
4. Once merged the release will be tagged and published by one of the libc crate
|
||||
maintainers.
|
||||
|
||||
[example]: https://github.com/rust-lang/libc/pull/583
|
||||
|
||||
## Platforms and Documentation
|
||||
|
||||
The following platforms are currently tested and have documentation available:
|
||||
|
||||
Tested:
|
||||
* [`i686-pc-windows-msvc`](https://doc.rust-lang.org/libc/i686-pc-windows-msvc/libc/)
|
||||
* [`x86_64-pc-windows-msvc`](https://doc.rust-lang.org/libc/x86_64-pc-windows-msvc/libc/)
|
||||
(Windows)
|
||||
* [`i686-pc-windows-gnu`](https://doc.rust-lang.org/libc/i686-pc-windows-gnu/libc/)
|
||||
* [`x86_64-pc-windows-gnu`](https://doc.rust-lang.org/libc/x86_64-pc-windows-gnu/libc/)
|
||||
* [`i686-apple-darwin`](https://doc.rust-lang.org/libc/i686-apple-darwin/libc/)
|
||||
* [`x86_64-apple-darwin`](https://doc.rust-lang.org/libc/x86_64-apple-darwin/libc/)
|
||||
(OSX)
|
||||
* `i386-apple-ios`
|
||||
* `x86_64-apple-ios`
|
||||
* [`i686-unknown-linux-gnu`](https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/)
|
||||
* [`x86_64-unknown-linux-gnu`](https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu/libc/)
|
||||
(Linux)
|
||||
* [`x86_64-unknown-linux-musl`](https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl/libc/)
|
||||
(Linux MUSL)
|
||||
* [`aarch64-unknown-linux-gnu`](https://doc.rust-lang.org/libc/aarch64-unknown-linux-gnu/libc/)
|
||||
* [`mips-unknown-linux-gnu`](https://doc.rust-lang.org/libc/mips-unknown-linux-gnu/libc/)
|
||||
* [`arm-unknown-linux-gnueabihf`](https://doc.rust-lang.org/libc/arm-unknown-linux-gnueabihf/libc/)
|
||||
* [`arm-linux-androideabi`](https://doc.rust-lang.org/libc/arm-linux-androideabi/libc/)
|
||||
(Android)
|
||||
* [`x86_64-unknown-freebsd`](https://doc.rust-lang.org/libc/x86_64-unknown-freebsd/libc/)
|
||||
* [`x86_64-unknown-openbsd`](https://doc.rust-lang.org/libc/x86_64-unknown-openbsd/libc/)
|
||||
* [`x86_64-rumprun-netbsd`](https://doc.rust-lang.org/libc/x86_64-unknown-netbsd/libc/)
|
||||
|
||||
The following may be supported, but are not guaranteed to always work:
|
||||
|
||||
* `i686-unknown-freebsd`
|
||||
* [`x86_64-unknown-bitrig`](https://doc.rust-lang.org/libc/x86_64-unknown-bitrig/libc/)
|
||||
* [`x86_64-unknown-dragonfly`](https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly/libc/)
|
||||
* `i686-unknown-haiku`
|
||||
* `x86_64-unknown-haiku`
|
||||
* [`x86_64-unknown-netbsd`](https://doc.rust-lang.org/libc/x86_64-unknown-netbsd/libc/)
|
31
third_party/rust/libc-0.2.30/appveyor.yml
vendored
31
third_party/rust/libc-0.2.30/appveyor.yml
vendored
@ -1,31 +0,0 @@
|
||||
environment:
|
||||
# When this was added there were revocation check failures when using the
|
||||
# libcurl backend as libcurl checks by default, but rustup doesn't provide the
|
||||
# switch to turn this off. Switch to Hyper which looks to not check for
|
||||
# revocation by default like libcurl does.
|
||||
RUSTUP_USE_HYPER: 1
|
||||
CARGO_HTTP_CHECK_REVOKE: false
|
||||
matrix:
|
||||
- TARGET: x86_64-pc-windows-gnu
|
||||
MSYS2_BITS: 64
|
||||
- TARGET: i686-pc-windows-gnu
|
||||
MSYS2_BITS: 32
|
||||
- TARGET: x86_64-pc-windows-msvc
|
||||
- TARGET: i686-pc-windows-msvc
|
||||
install:
|
||||
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
- rustup-init.exe -y --default-host %TARGET%
|
||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||
- if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin
|
||||
- rustc -V
|
||||
- cargo -V
|
||||
|
||||
build: false
|
||||
|
||||
test_script:
|
||||
- cargo test --target %TARGET%
|
||||
- cargo test --manifest-path libc-test/Cargo.toml --target %TARGET%
|
||||
|
||||
cache:
|
||||
- target
|
||||
- C:\Users\appveyor\.cargo\registry
|
203
third_party/rust/libc-0.2.30/ci/README.md
vendored
203
third_party/rust/libc-0.2.30/ci/README.md
vendored
@ -1,203 +0,0 @@
|
||||
The goal of the libc crate is to have CI running everywhere to have the
|
||||
strongest guarantees about the definitions that this library contains, and as a
|
||||
result the CI is pretty complicated and also pretty large! Hopefully this can
|
||||
serve as a guide through the sea of scripts in this directory and elsewhere in
|
||||
this project.
|
||||
|
||||
# Files
|
||||
|
||||
First up, let's talk about the files in this directory:
|
||||
|
||||
* `run-travis.sh` - a shell script run by all Travis builders, this is
|
||||
responsible for setting up the rest of the environment such as installing new
|
||||
packages, downloading Rust target libraries, etc.
|
||||
|
||||
* `run.sh` - the actual script which runs tests for a particular architecture.
|
||||
Called from the `run-travis.sh` script this will run all tests for the target
|
||||
specified.
|
||||
|
||||
* `cargo-config` - Cargo configuration of linkers to use copied into place by
|
||||
the `run-travis.sh` script before builds are run.
|
||||
|
||||
* `dox.sh` - script called from `run-travis.sh` on only the linux 64-bit nightly
|
||||
Travis bots to build documentation for this crate.
|
||||
|
||||
* `landing-page-*.html` - used by `dox.sh` to generate a landing page for all
|
||||
architectures' documentation.
|
||||
|
||||
* `run-qemu.sh` - see discussion about QEMU below
|
||||
|
||||
* `mips`, `rumprun` - instructions to build the docker image for each respective
|
||||
CI target
|
||||
|
||||
# CI Systems
|
||||
|
||||
Currently this repository leverages a combination of Travis CI and AppVeyor for
|
||||
running tests. The triples tested are:
|
||||
|
||||
* AppVeyor
|
||||
* `{i686,x86_64}-pc-windows-{msvc,gnu}`
|
||||
* Travis
|
||||
* `{i686,x86_64,mips,aarch64}-unknown-linux-gnu`
|
||||
* `x86_64-unknown-linux-musl`
|
||||
* `arm-unknown-linux-gnueabihf`
|
||||
* `arm-linux-androideabi`
|
||||
* `{i686,x86_64}-apple-{darwin,ios}`
|
||||
* `x86_64-rumprun-netbsd`
|
||||
* `x86_64-unknown-freebsd`
|
||||
* `x86_64-unknown-openbsd`
|
||||
|
||||
The Windows triples are all pretty standard, they just set up their environment
|
||||
then run tests, no need for downloading any extra target libs (we just download
|
||||
the right installer). The Intel Linux/OSX builds are similar in that we just
|
||||
download the right target libs and run tests. Note that the Intel Linux/OSX
|
||||
builds are run on stable/beta/nightly, but are the only ones that do so.
|
||||
|
||||
The remaining architectures look like:
|
||||
|
||||
* Android runs in a [docker image][android-docker] with an emulator, the NDK,
|
||||
and the SDK already set up. The entire build happens within the docker image.
|
||||
* The MIPS, ARM, and AArch64 builds all use the QEMU userspace emulator to run
|
||||
the generated binary to actually verify the tests pass.
|
||||
* The MUSL build just has to download a MUSL compiler and target libraries and
|
||||
then otherwise runs tests normally.
|
||||
* iOS builds need an extra linker flag currently, but beyond that they're built
|
||||
as standard as everything else.
|
||||
* The rumprun target builds an entire kernel from the test suite and then runs
|
||||
it inside QEMU using the serial console to test whether it succeeded or
|
||||
failed.
|
||||
* The BSD builds, currently OpenBSD and FreeBSD, use QEMU to boot up a system
|
||||
and compile/run tests. More information on that below.
|
||||
|
||||
[android-docker]: https://github.com/rust-lang/rust-buildbot/blob/master/slaves/android/Dockerfile
|
||||
|
||||
## QEMU
|
||||
|
||||
Lots of the architectures tested here use QEMU in the tests, so it's worth going
|
||||
over all the crazy capabilities QEMU has and the various flavors in which we use
|
||||
it!
|
||||
|
||||
First up, QEMU has userspace emulation where it doesn't boot a full kernel, it
|
||||
just runs a binary from another architecture (using the `qemu-<arch>` wrappers).
|
||||
We provide it the runtime path for the dynamically loaded system libraries,
|
||||
however. This strategy is used for all Linux architectures that aren't intel.
|
||||
Note that one downside of this QEMU system is that threads are barely
|
||||
implemented, so we're careful to not spawn many threads.
|
||||
|
||||
For the rumprun target the only output is a kernel image, so we just use that
|
||||
plus the `rumpbake` command to create a full kernel image which is then run from
|
||||
within QEMU.
|
||||
|
||||
Finally, the fun part, the BSDs. Quite a few hoops are jumped through to get CI
|
||||
working for these platforms, but the gist of it looks like:
|
||||
|
||||
* Cross compiling from Linux to any of the BSDs seems to be quite non-standard.
|
||||
We may be able to get it working but it might be difficult at that point to
|
||||
ensure that the libc definitions align with what you'd get on the BSD itself.
|
||||
As a result, we try to do compiles within the BSD distro.
|
||||
* On Travis we can't run a VM-in-a-VM, so we resort to userspace emulation
|
||||
(QEMU).
|
||||
* Unfortunately on Travis we also can't use KVM, so the emulation is super slow.
|
||||
|
||||
With all that in mind, the way BSD is tested looks like:
|
||||
|
||||
1. Download a pre-prepared image for the OS being tested.
|
||||
2. Generate the tests for the OS being tested. This involves running the `ctest`
|
||||
library over libc to generate a Rust file and a C file which will then be
|
||||
compiled into the final test.
|
||||
3. Generate a disk image which will later be mounted by the OS being tested.
|
||||
This image is mostly just the libc directory, but some modifications are made
|
||||
to compile the generated files from step 2.
|
||||
4. The kernel is booted in QEMU, and it is configured to detect the libc-test
|
||||
image being available, run the test script, and then shut down afterwards.
|
||||
5. Look for whether the tests passed in the serial console output of the kernel.
|
||||
|
||||
There's some pretty specific instructions for setting up each image (detailed
|
||||
below), but the main gist of this is that we must avoid a vanilla `cargo run`
|
||||
inside of the `libc-test` directory (which is what it's intended for) because
|
||||
that would compile `syntex_syntax`, a large library, with userspace emulation.
|
||||
This invariably times out on Travis, so we can't do that.
|
||||
|
||||
Once all those hoops are jumped through, however, we can be happy that we're
|
||||
testing almost everything!
|
||||
|
||||
Below are some details of how to set up the initial OS images which are
|
||||
downloaded. Each image must be enabled have input/output over the serial
|
||||
console, log in automatically at the serial console, detect if a second drive in
|
||||
QEMU is available, and if so mount it, run a script (it'll specifically be
|
||||
`run-qemu.sh` in this folder which is copied into the generated image talked
|
||||
about above), and then shut down.
|
||||
|
||||
### QEMU setup - FreeBSD
|
||||
|
||||
1. Download CD installer (most minimal is fine)
|
||||
2. `qemu-img create -f qcow2 foo.qcow2 2G`
|
||||
3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user`
|
||||
4. run installer
|
||||
5. `echo 'console="comconsole"' >> /boot/loader.conf`
|
||||
6. `echo 'autoboot_delay="0"' >> /boot/loader.conf`
|
||||
7. look at /etc/ttys, see what getty argument is for ttyu0
|
||||
8. edit /etc/gettytab, look for ttyu0 argument, prepend `:al=root` to line
|
||||
beneath
|
||||
|
||||
(note that the current image has a `freebsd` user, but this isn't really
|
||||
necessary)
|
||||
|
||||
Once that's done, arrange for this script to run at login:
|
||||
|
||||
```
|
||||
#!/bin/sh
|
||||
|
||||
sudo kldload ext2fs
|
||||
[ -e /dev/vtbd1 ] || exit 0
|
||||
sudo mount -t ext2fs /dev/vtbd1 /mnt
|
||||
sh /mnt/run.sh /mnt
|
||||
sudo poweroff
|
||||
```
|
||||
|
||||
Helpful links
|
||||
|
||||
* https://en.wikibooks.org/wiki/QEMU/Images
|
||||
* https://blog.nekoconeko.nl/blog/2015/06/04/creating-an-openstack-freebsd-image.html
|
||||
* https://www.freebsd.org/doc/handbook/serialconsole-setup.html
|
||||
|
||||
|
||||
### QEMU setup - OpenBSD
|
||||
|
||||
1. Download CD installer
|
||||
2. `qemu-img create -f qcow2 foo.qcow2 2G`
|
||||
3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user`
|
||||
4. run installer
|
||||
5. `echo 'set tty com0' >> /etc/boot.conf`
|
||||
6. `echo 'boot' >> /etc/boot.conf`
|
||||
7. Modify /etc/ttys, change the `tty00` at the end from 'unknown off' to
|
||||
'vt220 on secure'
|
||||
8. Modify same line in /etc/ttys to have `"/root/foo.sh"` as the shell
|
||||
9. Add this script to `/root/foo.sh`
|
||||
|
||||
```
|
||||
#!/bin/sh
|
||||
exec 1>/dev/tty00
|
||||
exec 2>&1
|
||||
|
||||
if mount -t ext2fs /dev/sd1c /mnt; then
|
||||
sh /mnt/run.sh /mnt
|
||||
shutdown -ph now
|
||||
fi
|
||||
|
||||
# limited shell...
|
||||
exec /bin/sh < /dev/tty00
|
||||
```
|
||||
|
||||
10. `chmod +x /root/foo.sh`
|
||||
|
||||
Helpful links:
|
||||
|
||||
* https://en.wikibooks.org/wiki/QEMU/Images
|
||||
* http://www.openbsd.org/faq/faq7.html#SerCon
|
||||
|
||||
# Questions?
|
||||
|
||||
Hopefully that's at least somewhat of an introduction to everything going on
|
||||
here, and feel free to ping @alexcrichton with questions!
|
||||
|
@ -1,15 +0,0 @@
|
||||
#!/usr/bin/expect -f
|
||||
# ignore-license
|
||||
|
||||
set timeout 1800
|
||||
set cmd [lindex $argv 0]
|
||||
set licenses [lindex $argv 1]
|
||||
|
||||
spawn {*}$cmd
|
||||
expect {
|
||||
"Do you accept the license '*'*" {
|
||||
exp_send "y\r"
|
||||
exp_continue
|
||||
}
|
||||
eof
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
curl -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip
|
||||
unzip -q android-ndk-r15b-linux-x86_64.zip
|
||||
|
||||
case "$1" in
|
||||
aarch64)
|
||||
arch=arm64
|
||||
;;
|
||||
|
||||
i686)
|
||||
arch=x86
|
||||
;;
|
||||
|
||||
*)
|
||||
arch=$1
|
||||
;;
|
||||
esac;
|
||||
|
||||
android-ndk-r15b/build/tools/make_standalone_toolchain.py \
|
||||
--unified-headers \
|
||||
--install-dir /android/ndk-$1 \
|
||||
--arch $arch \
|
||||
--api 24
|
||||
|
||||
rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b
|
@ -1,57 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
# Prep the SDK and emulator
|
||||
#
|
||||
# Note that the update process requires that we accept a bunch of licenses, and
|
||||
# we can't just pipe `yes` into it for some reason, so we take the same strategy
|
||||
# located in https://github.com/appunite/docker by just wrapping it in a script
|
||||
# which apparently magically accepts the licenses.
|
||||
|
||||
mkdir sdk
|
||||
curl https://dl.google.com/android/repository/tools_r25.2.5-linux.zip -O
|
||||
unzip -d sdk tools_r25.2.5-linux.zip
|
||||
|
||||
filter="platform-tools,android-24"
|
||||
|
||||
case "$1" in
|
||||
arm | armv7)
|
||||
abi=armeabi-v7a
|
||||
;;
|
||||
|
||||
aarch64)
|
||||
abi=arm64-v8a
|
||||
;;
|
||||
|
||||
i686)
|
||||
abi=x86
|
||||
;;
|
||||
|
||||
x86_64)
|
||||
abi=x86_64
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "invalid arch: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac;
|
||||
|
||||
filter="$filter,sys-img-$abi-android-24"
|
||||
|
||||
./android-accept-licenses.sh "android - update sdk -a --no-ui --filter $filter"
|
||||
|
||||
echo "no" | android create avd \
|
||||
--name $1 \
|
||||
--target android-24 \
|
||||
--abi $abi
|
@ -1,52 +0,0 @@
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
URL=https://dl.google.com/android/repository/sys-img/android
|
||||
|
||||
main() {
|
||||
local arch=$1
|
||||
local name=$2
|
||||
local dest=/system
|
||||
local td=$(mktemp -d)
|
||||
|
||||
apt-get install --no-install-recommends e2tools
|
||||
|
||||
pushd $td
|
||||
curl -O $URL/$name
|
||||
unzip -q $name
|
||||
|
||||
local system=$(find . -name system.img)
|
||||
mkdir -p $dest/{bin,lib,lib64}
|
||||
|
||||
# Extract android linker and libraries to /system
|
||||
# This allows android executables to be run directly (or with qemu)
|
||||
if [ $arch = "x86_64" -o $arch = "arm64" ]; then
|
||||
e2cp -p $system:/bin/linker64 $dest/bin/
|
||||
e2cp -p $system:/lib64/libdl.so $dest/lib64/
|
||||
e2cp -p $system:/lib64/libc.so $dest/lib64/
|
||||
e2cp -p $system:/lib64/libm.so $dest/lib64/
|
||||
else
|
||||
e2cp -p $system:/bin/linker $dest/bin/
|
||||
e2cp -p $system:/lib/libdl.so $dest/lib/
|
||||
e2cp -p $system:/lib/libc.so $dest/lib/
|
||||
e2cp -p $system:/lib/libm.so $dest/lib/
|
||||
fi
|
||||
|
||||
# clean up
|
||||
apt-get purge --auto-remove -y e2tools
|
||||
|
||||
popd
|
||||
|
||||
rm -rf $td
|
||||
}
|
||||
|
||||
main "${@}"
|
@ -1,45 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python \
|
||||
unzip \
|
||||
expect \
|
||||
openjdk-9-jre \
|
||||
libstdc++6:i386 \
|
||||
libpulse0 \
|
||||
gcc \
|
||||
libc6-dev
|
||||
|
||||
WORKDIR /android/
|
||||
COPY android* /android/
|
||||
|
||||
ENV ANDROID_ARCH=aarch64
|
||||
ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools
|
||||
|
||||
RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
|
||||
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
|
||||
RUN mv /root/.android /tmp
|
||||
RUN chmod 777 -R /tmp/.android
|
||||
RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
|
||||
|
||||
ENV PATH=$PATH:/rust/bin \
|
||||
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
|
||||
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \
|
||||
HOME=/tmp
|
||||
|
||||
ADD runtest-android.rs /tmp/runtest.rs
|
||||
ENTRYPOINT [ \
|
||||
"bash", \
|
||||
"-c", \
|
||||
# set SHELL so android can detect a 64bits system, see
|
||||
# http://stackoverflow.com/a/41789144
|
||||
"SHELL=/bin/dash emulator @aarch64 -no-window & \
|
||||
rustc /tmp/runtest.rs -o /tmp/runtest && \
|
||||
exec \"$@\"", \
|
||||
"--" \
|
||||
]
|
@ -1,7 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev ca-certificates \
|
||||
gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
|
||||
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \
|
||||
PATH=$PATH:/rust/bin
|
@ -1,45 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python \
|
||||
unzip \
|
||||
expect \
|
||||
openjdk-9-jre \
|
||||
libstdc++6:i386 \
|
||||
libpulse0 \
|
||||
gcc \
|
||||
libc6-dev
|
||||
|
||||
WORKDIR /android/
|
||||
COPY android* /android/
|
||||
|
||||
ENV ANDROID_ARCH=arm
|
||||
ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools
|
||||
|
||||
RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
|
||||
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
|
||||
RUN mv /root/.android /tmp
|
||||
RUN chmod 777 -R /tmp/.android
|
||||
RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
|
||||
|
||||
ENV PATH=$PATH:/rust/bin \
|
||||
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
|
||||
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
|
||||
HOME=/tmp
|
||||
|
||||
ADD runtest-android.rs /tmp/runtest.rs
|
||||
ENTRYPOINT [ \
|
||||
"bash", \
|
||||
"-c", \
|
||||
# set SHELL so android can detect a 64bits system, see
|
||||
# http://stackoverflow.com/a/41789144
|
||||
"SHELL=/bin/dash emulator @arm -no-window & \
|
||||
rustc /tmp/runtest.rs -o /tmp/runtest && \
|
||||
exec \"$@\"", \
|
||||
"--" \
|
||||
]
|
@ -1,7 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev ca-certificates \
|
||||
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user
|
||||
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
|
||||
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \
|
||||
PATH=$PATH:/rust/bin
|
@ -1,20 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
libc6-dev \
|
||||
python \
|
||||
xz-utils
|
||||
|
||||
COPY emscripten.sh /
|
||||
RUN bash /emscripten.sh
|
||||
|
||||
ENV PATH=$PATH:/rust/bin \
|
||||
CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node
|
||||
|
||||
COPY emscripten-entry.sh /
|
||||
ENTRYPOINT ["/emscripten-entry.sh"]
|
@ -1,45 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
file \
|
||||
curl \
|
||||
ca-certificates \
|
||||
python \
|
||||
unzip \
|
||||
expect \
|
||||
openjdk-9-jre \
|
||||
libstdc++6:i386 \
|
||||
libpulse0 \
|
||||
gcc \
|
||||
libc6-dev
|
||||
|
||||
WORKDIR /android/
|
||||
COPY android* /android/
|
||||
|
||||
ENV ANDROID_ARCH=i686
|
||||
ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools
|
||||
|
||||
RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
|
||||
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
|
||||
RUN mv /root/.android /tmp
|
||||
RUN chmod 777 -R /tmp/.android
|
||||
RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
|
||||
|
||||
ENV PATH=$PATH:/rust/bin \
|
||||
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
|
||||
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
|
||||
HOME=/tmp
|
||||
|
||||
ADD runtest-android.rs /tmp/runtest.rs
|
||||
ENTRYPOINT [ \
|
||||
"bash", \
|
||||
"-c", \
|
||||
# set SHELL so android can detect a 64bits system, see
|
||||
# http://stackoverflow.com/a/41789144
|
||||
"SHELL=/bin/dash emulator @i686 -no-window -no-accel & \
|
||||
rustc /tmp/runtest.rs -o /tmp/runtest && \
|
||||
exec \"$@\"", \
|
||||
"--" \
|
||||
]
|
@ -1,5 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
gcc-multilib libc6-dev ca-certificates
|
||||
ENV PATH=$PATH:/rust/bin
|
@ -1,30 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN dpkg --add-architecture i386
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
gcc-multilib make libc6-dev git curl ca-certificates libc6:i386
|
||||
# Below we're cross-compiling musl for i686 using the system compiler on an
|
||||
# x86_64 system. This is an awkward thing to be doing and so we have to jump
|
||||
# through a couple hoops to get musl to be happy. In particular:
|
||||
#
|
||||
# * We specifically pass -m32 in CFLAGS and override CC when running ./configure,
|
||||
# since otherwise the script will fail to find a compiler.
|
||||
# * We manually unset CROSS_COMPILE when running make; otherwise the makefile
|
||||
# will call the non-existent binary 'i686-ar'.
|
||||
RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
|
||||
tar xzf - && \
|
||||
cd musl-1.1.15 && \
|
||||
CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
|
||||
make CROSS_COMPILE= install -j4 && \
|
||||
cd .. && \
|
||||
rm -rf musl-1.1.15 && \
|
||||
# Install linux kernel headers sanitized for use with musl
|
||||
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
|
||||
tar xzf - && \
|
||||
cd kernel-headers-3.12.6-5 && \
|
||||
make ARCH=i386 prefix=/musl-i686 install -j4 && \
|
||||
cd .. && \
|
||||
rm -rf kernel-headers-3.12.6-5
|
||||
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
|
||||
CC_i686_unknown_linux_musl=musl-gcc
|
@ -1,10 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev qemu-user ca-certificates \
|
||||
gcc-mips-linux-gnu libc6-dev-mips-cross \
|
||||
qemu-system-mips
|
||||
|
||||
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
|
||||
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \
|
||||
PATH=$PATH:/rust/bin
|
@ -1,17 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
|
||||
bzip2
|
||||
|
||||
RUN mkdir /toolchain
|
||||
|
||||
# Note that this originally came from:
|
||||
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
|
||||
RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
|
||||
tar xjf - -C /toolchain --strip-components=1
|
||||
|
||||
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \
|
||||
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
|
||||
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \
|
||||
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15"
|
@ -1,11 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev qemu-user ca-certificates \
|
||||
gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
|
||||
qemu-system-mips64
|
||||
|
||||
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
|
||||
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \
|
||||
CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
|
||||
PATH=$PATH:/rust/bin
|
@ -1,17 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
|
||||
bzip2
|
||||
|
||||
RUN mkdir /toolchain
|
||||
|
||||
# Note that this originally came from:
|
||||
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
|
||||
RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
|
||||
tar xjf - -C /toolchain --strip-components=2
|
||||
|
||||
ENV PATH=$PATH:/rust/bin:/toolchain/bin \
|
||||
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
|
||||
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \
|
||||
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain"
|
@ -1,10 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev qemu-user ca-certificates \
|
||||
gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \
|
||||
qemu-system-ppc
|
||||
|
||||
ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
|
||||
CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \
|
||||
PATH=$PATH:/rust/bin
|
@ -1,11 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev qemu-user ca-certificates \
|
||||
gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \
|
||||
qemu-system-ppc
|
||||
|
||||
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
|
||||
CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \
|
||||
CC=powerpc64-linux-gnu-gcc \
|
||||
PATH=$PATH:/rust/bin
|
@ -1,12 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev qemu-user ca-certificates \
|
||||
gcc-s390x-linux-gnu libc6-dev-s390x-cross
|
||||
|
||||
ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
|
||||
# TODO: in theory we should execute this, but qemu segfaults immediately :(
|
||||
# CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu" \
|
||||
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER=true \
|
||||
CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \
|
||||
PATH=$PATH:/rust/bin
|
@ -1,21 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gcc \
|
||||
git \
|
||||
libc6-dev \
|
||||
python \
|
||||
xz-utils
|
||||
|
||||
COPY emscripten.sh /
|
||||
RUN bash /emscripten.sh
|
||||
|
||||
ENV PATH=$PATH:/rust/bin \
|
||||
CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh
|
||||
|
||||
COPY emscripten-entry.sh /
|
||||
COPY docker/wasm32-unknown-emscripten/node-wrapper.sh /usr/local/bin/node-wrapper.sh
|
||||
ENTRYPOINT ["/emscripten-entry.sh"]
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
me=$1
|
||||
shift
|
||||
dir=$(dirname $me)
|
||||
file=$(basename $me)
|
||||
|
||||
cd $dir
|
||||
exec node $file "$@"
|
@ -1,26 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gcc \
|
||||
libc-dev \
|
||||
python \
|
||||
unzip
|
||||
|
||||
WORKDIR /android/
|
||||
ENV ANDROID_ARCH=x86_64
|
||||
COPY android-install-ndk.sh /android/
|
||||
RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
|
||||
|
||||
# We do not run x86_64-linux-android tests on an android emulator.
|
||||
# See ci/android-sysimage.sh for informations about how tests are run.
|
||||
COPY android-sysimage.sh /android/
|
||||
RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip
|
||||
|
||||
ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \
|
||||
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
|
||||
CC_x86_64_linux_android=x86_64-linux-android-gcc \
|
||||
CXX_x86_64_linux_android=x86_64-linux-android-g++ \
|
||||
HOME=/tmp
|
@ -1,10 +0,0 @@
|
||||
FROM mato/rumprun-toolchain-hw-x86_64
|
||||
USER root
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
qemu
|
||||
ENV PATH=$PATH:/rust/bin \
|
||||
CARGO_TARGET_X86_64_RUMPRUN_NETBSD_RUNNER=/tmp/runtest
|
||||
|
||||
ADD docker/x86_64-rumprun-netbsd/runtest.rs /tmp/
|
||||
ENTRYPOINT ["sh", "-c", "rustc /tmp/runtest.rs -o /tmp/runtest && exec \"$@\"", "--"]
|
@ -1,54 +0,0 @@
|
||||
use std::env;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::io::{BufRead, BufReader, Read};
|
||||
|
||||
fn main() {
|
||||
assert_eq!(env::args().len(), 2);
|
||||
|
||||
let status = Command::new("rumprun-bake")
|
||||
.arg("hw_virtio")
|
||||
.arg("/tmp/libc-test.img")
|
||||
.arg(env::args().nth(1).unwrap())
|
||||
.status()
|
||||
.expect("failed to run rumprun-bake");
|
||||
assert!(status.success());
|
||||
|
||||
let mut child = Command::new("qemu-system-x86_64")
|
||||
.arg("-nographic")
|
||||
.arg("-vga").arg("none")
|
||||
.arg("-m").arg("64")
|
||||
.arg("-kernel").arg("/tmp/libc-test.img")
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
.expect("failed to spawn qemu");
|
||||
|
||||
let mut stdout = child.stdout.take().unwrap();
|
||||
let mut stderr = child.stderr.take().unwrap();
|
||||
let (tx, rx) = mpsc::channel();
|
||||
let tx2 = tx.clone();
|
||||
let t1 = thread::spawn(move || find_ok(&mut stdout, tx));
|
||||
let t2 = thread::spawn(move || find_ok(&mut stderr, tx2));
|
||||
|
||||
let res = rx.recv_timeout(Duration::new(5, 0));
|
||||
child.kill().unwrap();
|
||||
t1.join().unwrap();
|
||||
t2.join().unwrap();
|
||||
|
||||
if res.is_err() {
|
||||
panic!("didn't find success");
|
||||
}
|
||||
}
|
||||
|
||||
fn find_ok(input: &mut Read, tx: mpsc::Sender<()>) {
|
||||
for line in BufReader::new(input).lines() {
|
||||
let line = line.unwrap();
|
||||
println!("{}", line);
|
||||
if line.starts_with("PASSED ") && line.contains(" tests") {
|
||||
tx.send(()).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
FROM alexcrichton/rust-slave-linux-cross:2016-04-15
|
||||
USER root
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
qemu genext2fs
|
||||
|
||||
ENTRYPOINT ["sh"]
|
||||
|
||||
ENV PATH=$PATH:/rust/bin \
|
||||
QEMU=2016-11-06/freebsd.qcow2.gz \
|
||||
CAN_CROSS=1 \
|
||||
CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc
|
@ -1,5 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev ca-certificates
|
||||
ENV PATH=$PATH:/rust/bin
|
@ -1,20 +0,0 @@
|
||||
FROM ubuntu:17.10
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
gcc make libc6-dev git curl ca-certificates
|
||||
RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
|
||||
tar xzf - && \
|
||||
cd musl-1.1.15 && \
|
||||
./configure --prefix=/musl-x86_64 && \
|
||||
make install -j4 && \
|
||||
cd .. && \
|
||||
rm -rf musl-1.1.15 && \
|
||||
# Install linux kernel headers sanitized for use with musl
|
||||
curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
|
||||
tar xzf - && \
|
||||
cd kernel-headers-3.12.6-5 && \
|
||||
make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \
|
||||
cd .. && \
|
||||
rm -rf kernel-headers-3.12.6-5
|
||||
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin
|
33
third_party/rust/libc-0.2.30/ci/dox.sh
vendored
33
third_party/rust/libc-0.2.30/ci/dox.sh
vendored
@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Builds documentation for all target triples that we have a registered URL for
|
||||
# in liblibc. This scrapes the list of triples to document from `src/lib.rs`
|
||||
# which has a bunch of `html_root_url` directives we pick up.
|
||||
|
||||
set -e
|
||||
|
||||
TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'`
|
||||
|
||||
rm -rf target/doc
|
||||
mkdir -p target/doc
|
||||
|
||||
cp ci/landing-page-head.html target/doc/index.html
|
||||
|
||||
for target in $TARGETS; do
|
||||
echo documenting $target
|
||||
|
||||
rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \
|
||||
--crate-name libc
|
||||
|
||||
echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \
|
||||
>> target/doc/index.html
|
||||
done
|
||||
|
||||
cat ci/landing-page-footer.html >> target/doc/index.html
|
||||
|
||||
# If we're on travis, not a PR, and on the right branch, publish!
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
|
||||
pip install ghp_import --install-option="--prefix=$HOME/.local"
|
||||
$HOME/.local/bin/ghp-import -n target/doc
|
||||
git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
|
||||
fi
|
@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
source /emsdk-portable/emsdk_env.sh &> /dev/null
|
||||
|
||||
# emsdk-portable provides a node binary, but we need version 8 to run wasm
|
||||
export PATH="/node-v8.0.0-linux-x64/bin:$PATH"
|
||||
|
||||
exec "$@"
|
54
third_party/rust/libc-0.2.30/ci/emscripten.sh
vendored
54
third_party/rust/libc-0.2.30/ci/emscripten.sh
vendored
@ -1,54 +0,0 @@
|
||||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
|
||||
hide_output() {
|
||||
set +x
|
||||
on_err="
|
||||
echo ERROR: An error was encountered with the build.
|
||||
cat /tmp/build.log
|
||||
exit 1
|
||||
"
|
||||
trap "$on_err" ERR
|
||||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
|
||||
PING_LOOP_PID=$!
|
||||
$@ &> /tmp/build.log
|
||||
trap - ERR
|
||||
kill $PING_LOOP_PID
|
||||
rm -f /tmp/build.log
|
||||
set -x
|
||||
}
|
||||
|
||||
cd /
|
||||
curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
|
||||
tar -xz
|
||||
|
||||
cd /emsdk-portable
|
||||
./emsdk update
|
||||
hide_output ./emsdk install sdk-1.37.20-64bit
|
||||
./emsdk activate sdk-1.37.20-64bit
|
||||
|
||||
# Compile and cache libc
|
||||
source ./emsdk_env.sh
|
||||
echo "main(){}" > a.c
|
||||
HOME=/emsdk-portable/ emcc a.c
|
||||
HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
|
||||
rm -f a.*
|
||||
|
||||
# Make emsdk usable by any user
|
||||
cp /root/.emscripten /emsdk-portable
|
||||
chmod a+rxw -R /emsdk-portable
|
||||
|
||||
# node 8 is required to run wasm
|
||||
cd /
|
||||
curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
|
||||
tar -xJ
|
||||
|
@ -1,171 +0,0 @@
|
||||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// This is a script to deploy and execute a binary on an iOS simulator.
|
||||
// The primary use of this is to be able to run unit tests on the simulator and
|
||||
// retrieve the results.
|
||||
//
|
||||
// To do this through Cargo instead, use Dinghy
|
||||
// (https://github.com/snipsco/dinghy): cargo dinghy install, then cargo dinghy
|
||||
// test.
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::process;
|
||||
use std::process::Command;
|
||||
|
||||
macro_rules! t {
|
||||
($e:expr) => (match $e {
|
||||
Ok(e) => e,
|
||||
Err(e) => panic!("{} failed with: {}", stringify!($e), e),
|
||||
})
|
||||
}
|
||||
|
||||
// Step one: Wrap as an app
|
||||
fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) {
|
||||
println!("Packaging simulator app");
|
||||
drop(fs::remove_dir_all("ios_simulator_app"));
|
||||
t!(fs::create_dir("ios_simulator_app"));
|
||||
t!(fs::copy(test_binary_path,
|
||||
Path::new("ios_simulator_app").join(crate_name)));
|
||||
|
||||
let mut f = t!(File::create("ios_simulator_app/Info.plist"));
|
||||
t!(f.write_all(format!(r#"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC
|
||||
"-//Apple//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.rust.unittests</string>
|
||||
</dict>
|
||||
</plist>
|
||||
"#, crate_name).as_bytes()));
|
||||
}
|
||||
|
||||
// Step two: Start the iOS simulator
|
||||
fn start_simulator() {
|
||||
println!("Looking for iOS simulator");
|
||||
let output = t!(Command::new("xcrun").arg("simctl").arg("list").output());
|
||||
assert!(output.status.success());
|
||||
let mut simulator_exists = false;
|
||||
let mut simulator_booted = false;
|
||||
let mut found_rust_sim = false;
|
||||
let stdout = t!(String::from_utf8(output.stdout));
|
||||
for line in stdout.lines() {
|
||||
if line.contains("rust_ios") {
|
||||
if found_rust_sim {
|
||||
panic!("Duplicate rust_ios simulators found. Please \
|
||||
double-check xcrun simctl list.");
|
||||
}
|
||||
simulator_exists = true;
|
||||
simulator_booted = line.contains("(Booted)");
|
||||
found_rust_sim = true;
|
||||
}
|
||||
}
|
||||
|
||||
if simulator_exists == false {
|
||||
println!("Creating iOS simulator");
|
||||
Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("create")
|
||||
.arg("rust_ios")
|
||||
.arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
|
||||
.arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
|
||||
.check_status();
|
||||
} else if simulator_booted == true {
|
||||
println!("Shutting down already-booted simulator");
|
||||
Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("shutdown")
|
||||
.arg("rust_ios")
|
||||
.check_status();
|
||||
}
|
||||
|
||||
println!("Starting iOS simulator");
|
||||
// We can't uninstall the app (if present) as that will hang if the
|
||||
// simulator isn't completely booted; just erase the simulator instead.
|
||||
Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status();
|
||||
Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status();
|
||||
}
|
||||
|
||||
// Step three: Install the app
|
||||
fn install_app_to_simulator() {
|
||||
println!("Installing app to simulator");
|
||||
Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("install")
|
||||
.arg("booted")
|
||||
.arg("ios_simulator_app/")
|
||||
.check_status();
|
||||
}
|
||||
|
||||
// Step four: Run the app
|
||||
fn run_app_on_simulator() {
|
||||
println!("Running app");
|
||||
let output = t!(Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("launch")
|
||||
.arg("--console")
|
||||
.arg("booted")
|
||||
.arg("com.rust.unittests")
|
||||
.output());
|
||||
|
||||
println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
|
||||
println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
let passed = stdout.lines()
|
||||
.find(|l| l.contains("PASSED"))
|
||||
.map(|l| l.contains("tests"))
|
||||
.unwrap_or(false);
|
||||
|
||||
println!("Shutting down simulator");
|
||||
Command::new("xcrun")
|
||||
.arg("simctl")
|
||||
.arg("shutdown")
|
||||
.arg("rust_ios")
|
||||
.check_status();
|
||||
if !passed {
|
||||
panic!("tests didn't pass");
|
||||
}
|
||||
}
|
||||
|
||||
trait CheckStatus {
|
||||
fn check_status(&mut self);
|
||||
}
|
||||
|
||||
impl CheckStatus for Command {
|
||||
fn check_status(&mut self) {
|
||||
println!("\trunning: {:?}", self);
|
||||
assert!(t!(self.status()).success());
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() != 2 {
|
||||
println!("Usage: {} <executable>", args[0]);
|
||||
process::exit(-1);
|
||||
}
|
||||
|
||||
let test_binary_path = Path::new(&args[1]);
|
||||
let crate_name = test_binary_path.file_name().unwrap();
|
||||
|
||||
package_as_simulator_app(crate_name.to_str().unwrap(), test_binary_path);
|
||||
start_simulator();
|
||||
install_app_to_simulator();
|
||||
run_app_on_simulator();
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
@ -1,7 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
36
third_party/rust/libc-0.2.30/ci/run-docker.sh
vendored
36
third_party/rust/libc-0.2.30/ci/run-docker.sh
vendored
@ -1,36 +0,0 @@
|
||||
# Small script to run tests for a target (or all targets) inside all the
|
||||
# respective docker images.
|
||||
|
||||
set -ex
|
||||
|
||||
run() {
|
||||
echo $1
|
||||
# use -f so we can use ci/ as build context
|
||||
docker build -t libc -f ci/docker/$1/Dockerfile ci/
|
||||
mkdir -p target
|
||||
if [ -w /dev/kvm ]; then
|
||||
kvm="--volume /dev/kvm:/dev/kvm"
|
||||
fi
|
||||
docker run \
|
||||
--user `id -u`:`id -g` \
|
||||
--rm \
|
||||
--init \
|
||||
--volume $HOME/.cargo:/cargo \
|
||||
$kvm \
|
||||
--env CARGO_HOME=/cargo \
|
||||
--volume `rustc --print sysroot`:/rust:ro \
|
||||
--volume `pwd`:/checkout:ro \
|
||||
--volume `pwd`/target:/checkout/target \
|
||||
--env CARGO_TARGET_DIR=/checkout/target \
|
||||
--workdir /checkout \
|
||||
libc \
|
||||
ci/run.sh $1
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
for d in `ls ci/docker/`; do
|
||||
run $d
|
||||
done
|
||||
else
|
||||
run $1
|
||||
fi
|
32
third_party/rust/libc-0.2.30/ci/run-qemu.sh
vendored
32
third_party/rust/libc-0.2.30/ci/run-qemu.sh
vendored
@ -1,32 +0,0 @@
|
||||
# Initial script which is run inside of all qemu images. The first argument to
|
||||
# this script (as arranged by the qemu image itself) is the path to where the
|
||||
# libc crate is mounted.
|
||||
#
|
||||
# For qemu images we currently need to install Rust manually as this wasn't done
|
||||
# by the initial run-travis.sh script
|
||||
#
|
||||
# FIXME: feels like run-travis.sh should be responsible for downloading the
|
||||
# compiler.
|
||||
|
||||
set -ex
|
||||
|
||||
ROOT=$1
|
||||
cp -r $ROOT/libc /tmp/libc
|
||||
cd /tmp/libc
|
||||
|
||||
TARGET=$(cat $ROOT/TARGET)
|
||||
export CARGO_TARGET_DIR=/tmp
|
||||
|
||||
case $TARGET in
|
||||
*-openbsd)
|
||||
pkg_add cargo gcc%4.9 rust
|
||||
export CC=egcc
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown target: $TARGET"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exec sh ci/run.sh $TARGET
|
71
third_party/rust/libc-0.2.30/ci/run.sh
vendored
71
third_party/rust/libc-0.2.30/ci/run.sh
vendored
@ -1,71 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Builds and runs tests for a particular target passed as an argument to this
|
||||
# script.
|
||||
|
||||
set -ex
|
||||
|
||||
TARGET=$1
|
||||
|
||||
# If we're going to run tests inside of a qemu image, then we don't need any of
|
||||
# the scripts below. Instead, download the image, prepare a filesystem which has
|
||||
# the current state of this repository, and then run the image.
|
||||
#
|
||||
# It's assume that all images, when run with two disks, will run the `run.sh`
|
||||
# script from the second which we place inside.
|
||||
if [ "$QEMU" != "" ]; then
|
||||
tmpdir=/tmp/qemu-img-creation
|
||||
mkdir -p $tmpdir
|
||||
|
||||
if [ -z "${QEMU#*.gz}" ]; then
|
||||
# image is .gz : download and uncompress it
|
||||
qemufile=$(echo ${QEMU%.gz} | sed 's/\//__/g')
|
||||
if [ ! -f $tmpdir/$qemufile ]; then
|
||||
curl https://s3.amazonaws.com/rust-lang-ci/libc/$QEMU | \
|
||||
gunzip -d > $tmpdir/$qemufile
|
||||
fi
|
||||
else
|
||||
# plain qcow2 image: just download it
|
||||
qemufile=$(echo ${QEMU} | sed 's/\//__/g')
|
||||
if [ ! -f $tmpdir/$qemufile ]; then
|
||||
curl https://s3.amazonaws.com/rust-lang-ci/libc/$QEMU \
|
||||
> $tmpdir/$qemufile
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create a mount a fresh new filesystem image that we'll later pass to QEMU.
|
||||
# This will have a `run.sh` script will which use the artifacts inside to run
|
||||
# on the host.
|
||||
rm -f $tmpdir/libc-test.img
|
||||
mkdir $tmpdir/mount
|
||||
|
||||
# Do the standard rigamarole of cross-compiling an executable and then the
|
||||
# script to run just executes the binary.
|
||||
cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
|
||||
cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/
|
||||
echo 'exec $1/libc-test' > $tmpdir/mount/run.sh
|
||||
|
||||
du -sh $tmpdir/mount
|
||||
genext2fs \
|
||||
--root $tmpdir/mount \
|
||||
--size-in-blocks 100000 \
|
||||
$tmpdir/libc-test.img
|
||||
|
||||
# Pass -snapshot to prevent tampering with the disk images, this helps when
|
||||
# running this script in development. The two drives are then passed next,
|
||||
# first is the OS and second is the one we just made. Next the network is
|
||||
# configured to work (I'm not entirely sure how), and then finally we turn off
|
||||
# graphics and redirect the serial console output to out.log.
|
||||
qemu-system-x86_64 \
|
||||
-m 1024 \
|
||||
-snapshot \
|
||||
-drive if=virtio,file=$tmpdir/$qemufile \
|
||||
-drive if=virtio,file=$tmpdir/libc-test.img \
|
||||
-net nic,model=virtio \
|
||||
-net user \
|
||||
-nographic \
|
||||
-vga none 2>&1 | tee $CARGO_TARGET_DIR/out.log
|
||||
exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
|
||||
fi
|
||||
|
||||
exec cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
|
@ -1,41 +0,0 @@
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn main() {
|
||||
assert_eq!(env::args_os().len(), 2);
|
||||
let test = PathBuf::from(env::args_os().nth(1).unwrap());
|
||||
let dst = Path::new("/data/local/tmp").join(test.file_name().unwrap());
|
||||
|
||||
let status = Command::new("adb")
|
||||
.arg("wait-for-device")
|
||||
.status()
|
||||
.expect("failed to run rumprun-bake");
|
||||
assert!(status.success());
|
||||
|
||||
let status = Command::new("adb")
|
||||
.arg("push")
|
||||
.arg(&test)
|
||||
.arg(&dst)
|
||||
.status()
|
||||
.expect("failed to run rumprun-bake");
|
||||
assert!(status.success());
|
||||
|
||||
let output = Command::new("adb")
|
||||
.arg("shell")
|
||||
.arg(&dst)
|
||||
.output()
|
||||
.expect("failed to run rumprun-bake");
|
||||
assert!(status.success());
|
||||
|
||||
println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
|
||||
output.status,
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr));
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
let mut lines = stdout.lines().filter(|l| l.starts_with("PASSED "));
|
||||
if !lines.any(|l| l.contains(" tests")) {
|
||||
panic!("failed to find successful test run");
|
||||
}
|
||||
}
|
204
third_party/rust/libc-0.2.30/ci/style.rs
vendored
204
third_party/rust/libc-0.2.30/ci/style.rs
vendored
@ -1,204 +0,0 @@
|
||||
//! Simple script to verify the coding style of this library
|
||||
//!
|
||||
//! ## How to run
|
||||
//!
|
||||
//! The first argument to this script is the directory to run on, so running
|
||||
//! this script should be as simple as:
|
||||
//!
|
||||
//! ```notrust
|
||||
//! rustc ci/style.rs
|
||||
//! ./style src
|
||||
//! ```
|
||||
//!
|
||||
//! ## Guidelines
|
||||
//!
|
||||
//! The current style is:
|
||||
//!
|
||||
//! * No trailing whitespace
|
||||
//! * No tabs
|
||||
//! * 80-character lines
|
||||
//! * `extern` instead of `extern "C"`
|
||||
//! * Specific module layout:
|
||||
//! 1. use directives
|
||||
//! 2. typedefs
|
||||
//! 3. structs
|
||||
//! 4. constants
|
||||
//! 5. f! { ... } functions
|
||||
//! 6. extern functions
|
||||
//! 7. modules + pub use
|
||||
//!
|
||||
//! Things not verified:
|
||||
//!
|
||||
//! * alignment
|
||||
//! * 4-space tabs
|
||||
//! * leading colons on paths
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io::prelude::*;
|
||||
use std::path::Path;
|
||||
|
||||
macro_rules! t {
|
||||
($e:expr) => (match $e {
|
||||
Ok(e) => e,
|
||||
Err(e) => panic!("{} failed with {}", stringify!($e), e),
|
||||
})
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let arg = env::args().skip(1).next().unwrap_or(".".to_string());
|
||||
|
||||
let mut errors = Errors { errs: false };
|
||||
walk(Path::new(&arg), &mut errors);
|
||||
|
||||
if errors.errs {
|
||||
panic!("found some lint errors");
|
||||
} else {
|
||||
println!("good style!");
|
||||
}
|
||||
}
|
||||
|
||||
fn walk(path: &Path, err: &mut Errors) {
|
||||
for entry in t!(path.read_dir()).map(|e| t!(e)) {
|
||||
let path = entry.path();
|
||||
if t!(entry.file_type()).is_dir() {
|
||||
walk(&path, err);
|
||||
continue
|
||||
}
|
||||
|
||||
let name = entry.file_name().into_string().unwrap();
|
||||
match &name[..] {
|
||||
n if !n.ends_with(".rs") => continue,
|
||||
|
||||
"dox.rs" |
|
||||
"lib.rs" |
|
||||
"macros.rs" => continue,
|
||||
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let mut contents = String::new();
|
||||
t!(t!(fs::File::open(&path)).read_to_string(&mut contents));
|
||||
|
||||
check_style(&contents, &path, err);
|
||||
}
|
||||
}
|
||||
|
||||
struct Errors {
|
||||
errs: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
enum State {
|
||||
Start,
|
||||
Imports,
|
||||
Typedefs,
|
||||
Structs,
|
||||
Constants,
|
||||
FunctionDefinitions,
|
||||
Functions,
|
||||
Modules,
|
||||
}
|
||||
|
||||
fn check_style(file: &str, path: &Path, err: &mut Errors) {
|
||||
let mut state = State::Start;
|
||||
let mut s_macros = 0;
|
||||
let mut f_macros = 0;
|
||||
let mut prev_blank = false;
|
||||
|
||||
for (i, line) in file.lines().enumerate() {
|
||||
if line == "" {
|
||||
if prev_blank {
|
||||
err.error(path, i, "double blank line");
|
||||
}
|
||||
prev_blank = true;
|
||||
} else {
|
||||
prev_blank = false;
|
||||
}
|
||||
if line != line.trim_right() {
|
||||
err.error(path, i, "trailing whitespace");
|
||||
}
|
||||
if line.contains("\t") {
|
||||
err.error(path, i, "tab character");
|
||||
}
|
||||
if line.len() > 80 {
|
||||
err.error(path, i, "line longer than 80 chars");
|
||||
}
|
||||
if line.contains("extern \"C\"") {
|
||||
err.error(path, i, "use `extern` instead of `extern \"C\"");
|
||||
}
|
||||
if line.contains("#[cfg(") && !line.contains(" if ") {
|
||||
if state != State::Structs {
|
||||
err.error(path, i, "use cfg_if! and submodules \
|
||||
instead of #[cfg]");
|
||||
}
|
||||
}
|
||||
|
||||
let line = line.trim_left();
|
||||
let is_pub = line.starts_with("pub ");
|
||||
let line = if is_pub {&line[4..]} else {line};
|
||||
|
||||
let line_state = if line.starts_with("use ") {
|
||||
if is_pub {
|
||||
State::Modules
|
||||
} else {
|
||||
State::Imports
|
||||
}
|
||||
} else if line.starts_with("const ") {
|
||||
State::Constants
|
||||
} else if line.starts_with("type ") {
|
||||
State::Typedefs
|
||||
} else if line.starts_with("s! {") {
|
||||
s_macros += 1;
|
||||
State::Structs
|
||||
} else if line.starts_with("f! {") {
|
||||
f_macros += 1;
|
||||
State::FunctionDefinitions
|
||||
} else if line.starts_with("extern ") {
|
||||
State::Functions
|
||||
} else if line.starts_with("mod ") {
|
||||
State::Modules
|
||||
} else {
|
||||
continue
|
||||
};
|
||||
|
||||
if state as usize > line_state as usize {
|
||||
err.error(path, i, &format!("{} found after {} when \
|
||||
it belongs before",
|
||||
line_state.desc(), state.desc()));
|
||||
}
|
||||
|
||||
if f_macros == 2 {
|
||||
f_macros += 1;
|
||||
err.error(path, i, "multiple f! macros in one module");
|
||||
}
|
||||
if s_macros == 2 {
|
||||
s_macros += 1;
|
||||
err.error(path, i, "multiple s! macros in one module");
|
||||
}
|
||||
|
||||
state = line_state;
|
||||
}
|
||||
}
|
||||
|
||||
impl State {
|
||||
fn desc(&self) -> &str {
|
||||
match *self {
|
||||
State::Start => "start",
|
||||
State::Imports => "import",
|
||||
State::Typedefs => "typedef",
|
||||
State::Structs => "struct",
|
||||
State::Constants => "constant",
|
||||
State::FunctionDefinitions => "function definition",
|
||||
State::Functions => "extern function",
|
||||
State::Modules => "module",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Errors {
|
||||
fn error(&mut self, path: &Path, line: usize, msg: &str) {
|
||||
self.errs = true;
|
||||
println!("{}:{} - {}", path.display(), line + 1, msg);
|
||||
}
|
||||
}
|
175
third_party/rust/libc-0.2.30/src/dox.rs
vendored
175
third_party/rust/libc-0.2.30/src/dox.rs
vendored
@ -1,175 +0,0 @@
|
||||
pub use self::imp::*;
|
||||
|
||||
#[cfg(not(dox))]
|
||||
mod imp {
|
||||
pub use core::option::Option;
|
||||
pub use core::clone::Clone;
|
||||
pub use core::marker::Copy;
|
||||
pub use core::mem;
|
||||
}
|
||||
|
||||
#[cfg(dox)]
|
||||
mod imp {
|
||||
pub enum Option<T> {
|
||||
Some(T),
|
||||
None,
|
||||
}
|
||||
impl<T: Copy> Copy for Option<T> {}
|
||||
impl<T: Clone> Clone for Option<T> {
|
||||
fn clone(&self) -> Option<T> { loop {} }
|
||||
}
|
||||
|
||||
pub trait Clone {
|
||||
fn clone(&self) -> Self;
|
||||
}
|
||||
|
||||
#[lang = "copy"]
|
||||
pub trait Copy {}
|
||||
|
||||
#[lang = "freeze"]
|
||||
pub trait Freeze {}
|
||||
|
||||
#[lang = "sync"]
|
||||
pub trait Sync {}
|
||||
impl<T> Sync for T {}
|
||||
|
||||
#[lang = "sized"]
|
||||
pub trait Sized {}
|
||||
|
||||
macro_rules! each_int {
|
||||
($mac:ident) => (
|
||||
$mac!(u8);
|
||||
$mac!(u16);
|
||||
$mac!(u32);
|
||||
$mac!(u64);
|
||||
$mac!(usize);
|
||||
each_signed_int!($mac);
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! each_signed_int {
|
||||
($mac:ident) => (
|
||||
$mac!(i8);
|
||||
$mac!(i16);
|
||||
$mac!(i32);
|
||||
$mac!(i64);
|
||||
$mac!(isize);
|
||||
)
|
||||
}
|
||||
|
||||
#[lang = "div"]
|
||||
pub trait Div<RHS> {
|
||||
type Output;
|
||||
fn div(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! impl_div {
|
||||
($($i:ident)*) => ($(
|
||||
impl Div<$i> for $i {
|
||||
type Output = $i;
|
||||
fn div(self, rhs: $i) -> $i { self / rhs }
|
||||
}
|
||||
)*)
|
||||
}
|
||||
each_int!(impl_div);
|
||||
|
||||
#[lang = "shl"]
|
||||
pub trait Shl<RHS> {
|
||||
type Output;
|
||||
fn shl(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! impl_shl {
|
||||
($($i:ident)*) => ($(
|
||||
impl Shl<$i> for $i {
|
||||
type Output = $i;
|
||||
fn shl(self, rhs: $i) -> $i { self << rhs }
|
||||
}
|
||||
)*)
|
||||
}
|
||||
each_int!(impl_shl);
|
||||
|
||||
#[lang = "mul"]
|
||||
pub trait Mul<RHS=Self> {
|
||||
type Output;
|
||||
fn mul(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! impl_mul {
|
||||
($($i:ident)*) => ($(
|
||||
impl Mul for $i {
|
||||
type Output = $i;
|
||||
fn mul(self, rhs: $i) -> $i { self * rhs }
|
||||
}
|
||||
)*)
|
||||
}
|
||||
each_int!(impl_mul);
|
||||
|
||||
#[lang = "sub"]
|
||||
pub trait Sub<RHS=Self> {
|
||||
type Output;
|
||||
fn sub(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! impl_sub {
|
||||
($($i:ident)*) => ($(
|
||||
impl Sub for $i {
|
||||
type Output = $i;
|
||||
fn sub(self, rhs: $i) -> $i { self - rhs }
|
||||
}
|
||||
)*)
|
||||
}
|
||||
each_int!(impl_sub);
|
||||
|
||||
#[lang = "bitor"]
|
||||
pub trait Bitor<RHS=Self> {
|
||||
type Output;
|
||||
fn bitor(self, rhs: RHS) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! impl_bitor {
|
||||
($($i:ident)*) => ($(
|
||||
impl Bitor for $i {
|
||||
type Output = $i;
|
||||
fn bitor(self, rhs: $i) -> $i { self | rhs }
|
||||
}
|
||||
)*)
|
||||
}
|
||||
each_int!(impl_bitor);
|
||||
|
||||
#[lang = "neg"]
|
||||
pub trait Neg {
|
||||
type Output;
|
||||
fn neg(self) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! impl_neg {
|
||||
($($i:ident)*) => ($(
|
||||
impl Neg for $i {
|
||||
type Output = $i;
|
||||
fn neg(self) -> $i { -self }
|
||||
}
|
||||
)*)
|
||||
}
|
||||
each_signed_int!(impl_neg);
|
||||
|
||||
#[lang = "not"]
|
||||
pub trait Not {
|
||||
type Output;
|
||||
fn not(self) -> Self::Output;
|
||||
}
|
||||
|
||||
macro_rules! impl_not {
|
||||
($($i:ident)*) => ($(
|
||||
impl Not for $i {
|
||||
type Output = $i;
|
||||
fn not(self) -> $i { !self }
|
||||
}
|
||||
)*)
|
||||
}
|
||||
each_int!(impl_not);
|
||||
|
||||
pub mod mem {
|
||||
pub fn size_of_val<T>(_: &T) -> usize { 4 }
|
||||
}
|
||||
}
|
285
third_party/rust/libc-0.2.30/src/lib.rs
vendored
285
third_party/rust/libc-0.2.30/src/lib.rs
vendored
@ -1,285 +0,0 @@
|
||||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Crate docs
|
||||
|
||||
#![allow(bad_style, overflowing_literals, improper_ctypes)]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_name = "libc"]
|
||||
#![cfg_attr(dox, feature(no_core, lang_items))]
|
||||
#![cfg_attr(dox, no_core)]
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico")]
|
||||
|
||||
#![cfg_attr(all(target_os = "linux", target_arch = "x86_64"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "linux", target_arch = "x86"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/i686-unknown-linux-gnu"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "linux", target_arch = "arm"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/arm-unknown-linux-gnueabihf"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "linux", target_arch = "mips"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/mips-unknown-linux-gnu"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "linux", target_arch = "aarch64"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/aarch64-unknown-linux-gnu"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "linux", target_env = "musl"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "macos", target_arch = "x86_64"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-apple-darwin"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "macos", target_arch = "x86"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/i686-apple-darwin"
|
||||
))]
|
||||
#![cfg_attr(all(windows, target_arch = "x86_64", target_env = "gnu"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-pc-windows-gnu"
|
||||
))]
|
||||
#![cfg_attr(all(windows, target_arch = "x86", target_env = "gnu"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/i686-pc-windows-gnu"
|
||||
))]
|
||||
#![cfg_attr(all(windows, target_arch = "x86_64", target_env = "msvc"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-pc-windows-msvc"
|
||||
))]
|
||||
#![cfg_attr(all(windows, target_arch = "x86", target_env = "msvc"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/i686-pc-windows-msvc"
|
||||
))]
|
||||
#![cfg_attr(target_os = "android", doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/arm-linux-androideabi"
|
||||
))]
|
||||
#![cfg_attr(target_os = "freebsd", doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-freebsd"
|
||||
))]
|
||||
#![cfg_attr(target_os = "openbsd", doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-openbsd"
|
||||
))]
|
||||
#![cfg_attr(target_os = "bitrig", doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-bitrig"
|
||||
))]
|
||||
#![cfg_attr(target_os = "netbsd", doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-netbsd"
|
||||
))]
|
||||
#![cfg_attr(target_os = "dragonfly", doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "emscripten", target_arch = "asmjs"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/asmjs-unknown-emscripten"
|
||||
))]
|
||||
#![cfg_attr(all(target_os = "emscripten", target_arch = "wasm32"), doc(
|
||||
html_root_url = "https://doc.rust-lang.org/libc/wasm32-unknown-emscripten"
|
||||
))]
|
||||
|
||||
// Attributes needed when building as part of the standard library
|
||||
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))]
|
||||
#![cfg_attr(stdbuild, feature(link_cfg))]
|
||||
#![cfg_attr(stdbuild, no_std)]
|
||||
#![cfg_attr(stdbuild, staged_api)]
|
||||
#![cfg_attr(stdbuild, allow(warnings))]
|
||||
#![cfg_attr(stdbuild, unstable(feature = "libc",
|
||||
reason = "use `libc` from crates.io",
|
||||
issue = "27783"))]
|
||||
|
||||
#![cfg_attr(not(feature = "use_std"), no_std)]
|
||||
|
||||
#[cfg(all(not(stdbuild), not(dox), feature = "use_std"))]
|
||||
extern crate std as core;
|
||||
|
||||
#[macro_use] mod macros;
|
||||
mod dox;
|
||||
|
||||
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
|
||||
// more optimization opportunities around it recognizing things like
|
||||
// malloc/free.
|
||||
#[repr(u8)]
|
||||
pub enum c_void {
|
||||
// Two dummy variants so the #[repr] attribute can be used.
|
||||
#[doc(hidden)]
|
||||
__variant1,
|
||||
#[doc(hidden)]
|
||||
__variant2,
|
||||
}
|
||||
|
||||
pub type int8_t = i8;
|
||||
pub type int16_t = i16;
|
||||
pub type int32_t = i32;
|
||||
pub type int64_t = i64;
|
||||
pub type uint8_t = u8;
|
||||
pub type uint16_t = u16;
|
||||
pub type uint32_t = u32;
|
||||
pub type uint64_t = u64;
|
||||
|
||||
pub type c_schar = i8;
|
||||
pub type c_uchar = u8;
|
||||
pub type c_short = i16;
|
||||
pub type c_ushort = u16;
|
||||
pub type c_int = i32;
|
||||
pub type c_uint = u32;
|
||||
pub type c_float = f32;
|
||||
pub type c_double = f64;
|
||||
pub type c_longlong = i64;
|
||||
pub type c_ulonglong = u64;
|
||||
pub type intmax_t = i64;
|
||||
pub type uintmax_t = u64;
|
||||
|
||||
pub type size_t = usize;
|
||||
pub type ptrdiff_t = isize;
|
||||
pub type intptr_t = isize;
|
||||
pub type uintptr_t = usize;
|
||||
pub type ssize_t = isize;
|
||||
|
||||
pub enum FILE {}
|
||||
pub enum fpos_t {} // TODO: fill this out with a struct
|
||||
|
||||
extern {
|
||||
pub fn isalnum(c: c_int) -> c_int;
|
||||
pub fn isalpha(c: c_int) -> c_int;
|
||||
pub fn iscntrl(c: c_int) -> c_int;
|
||||
pub fn isdigit(c: c_int) -> c_int;
|
||||
pub fn isgraph(c: c_int) -> c_int;
|
||||
pub fn islower(c: c_int) -> c_int;
|
||||
pub fn isprint(c: c_int) -> c_int;
|
||||
pub fn ispunct(c: c_int) -> c_int;
|
||||
pub fn isspace(c: c_int) -> c_int;
|
||||
pub fn isupper(c: c_int) -> c_int;
|
||||
pub fn isxdigit(c: c_int) -> c_int;
|
||||
pub fn tolower(c: c_int) -> c_int;
|
||||
pub fn toupper(c: c_int) -> c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fopen$UNIX2003")]
|
||||
pub fn fopen(filename: *const c_char,
|
||||
mode: *const c_char) -> *mut FILE;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "freopen$UNIX2003")]
|
||||
pub fn freopen(filename: *const c_char, mode: *const c_char,
|
||||
file: *mut FILE) -> *mut FILE;
|
||||
pub fn fflush(file: *mut FILE) -> c_int;
|
||||
pub fn fclose(file: *mut FILE) -> c_int;
|
||||
pub fn remove(filename: *const c_char) -> c_int;
|
||||
pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
|
||||
pub fn tmpfile() -> *mut FILE;
|
||||
pub fn setvbuf(stream: *mut FILE,
|
||||
buffer: *mut c_char,
|
||||
mode: c_int,
|
||||
size: size_t) -> c_int;
|
||||
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
|
||||
pub fn getchar() -> c_int;
|
||||
pub fn putchar(c: c_int) -> c_int;
|
||||
pub fn fgetc(stream: *mut FILE) -> c_int;
|
||||
pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
|
||||
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fputs$UNIX2003")]
|
||||
pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int;
|
||||
pub fn puts(s: *const c_char) -> c_int;
|
||||
pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
|
||||
pub fn fread(ptr: *mut c_void,
|
||||
size: size_t,
|
||||
nobj: size_t,
|
||||
stream: *mut FILE)
|
||||
-> size_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fwrite$UNIX2003")]
|
||||
pub fn fwrite(ptr: *const c_void,
|
||||
size: size_t,
|
||||
nobj: size_t,
|
||||
stream: *mut FILE)
|
||||
-> size_t;
|
||||
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
|
||||
pub fn ftell(stream: *mut FILE) -> c_long;
|
||||
pub fn rewind(stream: *mut FILE);
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
|
||||
pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
|
||||
pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
|
||||
pub fn feof(stream: *mut FILE) -> c_int;
|
||||
pub fn ferror(stream: *mut FILE) -> c_int;
|
||||
pub fn perror(s: *const c_char);
|
||||
pub fn atoi(s: *const c_char) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "strtod$UNIX2003")]
|
||||
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
|
||||
pub fn strtol(s: *const c_char,
|
||||
endp: *mut *mut c_char, base: c_int) -> c_long;
|
||||
pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
|
||||
base: c_int) -> c_ulong;
|
||||
pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
|
||||
pub fn malloc(size: size_t) -> *mut c_void;
|
||||
pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
|
||||
pub fn free(p: *mut c_void);
|
||||
pub fn abort() -> !;
|
||||
pub fn exit(status: c_int) -> !;
|
||||
pub fn _exit(status: c_int) -> !;
|
||||
pub fn atexit(cb: extern fn()) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "system$UNIX2003")]
|
||||
pub fn system(s: *const c_char) -> c_int;
|
||||
pub fn getenv(s: *const c_char) -> *mut c_char;
|
||||
|
||||
pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
|
||||
pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t)
|
||||
-> *mut c_char;
|
||||
pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
|
||||
pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
|
||||
pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
|
||||
pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
|
||||
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
|
||||
pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
|
||||
pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
|
||||
pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
|
||||
pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
|
||||
pub fn strdup(cs: *const c_char) -> *mut c_char;
|
||||
pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
|
||||
pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
|
||||
pub fn strlen(cs: *const c_char) -> size_t;
|
||||
pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "strerror$UNIX2003")]
|
||||
pub fn strerror(n: c_int) -> *mut c_char;
|
||||
pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
|
||||
pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
|
||||
pub fn wcslen(buf: *const wchar_t) -> size_t;
|
||||
pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t;
|
||||
|
||||
pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
|
||||
pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
|
||||
pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
|
||||
pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
|
||||
pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
|
||||
}
|
||||
|
||||
// These are all inline functions on android, so they end up just being entirely
|
||||
// missing on that platform.
|
||||
#[cfg(not(target_os = "android"))]
|
||||
extern {
|
||||
pub fn abs(i: c_int) -> c_int;
|
||||
pub fn atof(s: *const c_char) -> c_double;
|
||||
pub fn labs(i: c_long) -> c_long;
|
||||
pub fn rand() -> c_int;
|
||||
pub fn srand(seed: c_uint);
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
mod windows;
|
||||
pub use windows::*;
|
||||
} else if #[cfg(target_os = "redox")] {
|
||||
mod redox;
|
||||
pub use redox::*;
|
||||
} else if #[cfg(unix)] {
|
||||
mod unix;
|
||||
pub use unix::*;
|
||||
} else {
|
||||
// Unknown target_family
|
||||
}
|
||||
}
|
71
third_party/rust/libc-0.2.30/src/macros.rs
vendored
71
third_party/rust/libc-0.2.30/src/macros.rs
vendored
@ -1,71 +0,0 @@
|
||||
/// A macro for defining #[cfg] if-else statements.
|
||||
///
|
||||
/// This is similar to the `if/elif` C preprocessor macro by allowing definition
|
||||
/// of a cascade of `#[cfg]` cases, emitting the implementation which matches
|
||||
/// first.
|
||||
///
|
||||
/// This allows you to conveniently provide a long list #[cfg]'d blocks of code
|
||||
/// without having to rewrite each clause multiple times.
|
||||
macro_rules! cfg_if {
|
||||
($(
|
||||
if #[cfg($($meta:meta),*)] { $($it:item)* }
|
||||
) else * else {
|
||||
$($it2:item)*
|
||||
}) => {
|
||||
__cfg_if_items! {
|
||||
() ;
|
||||
$( ( ($($meta),*) ($($it)*) ), )*
|
||||
( () ($($it2)*) ),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! __cfg_if_items {
|
||||
(($($not:meta,)*) ; ) => {};
|
||||
(($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
|
||||
__cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* }
|
||||
__cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* }
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! __cfg_if_apply {
|
||||
($m:meta, $($it:item)*) => {
|
||||
$(#[$m] $it)*
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! s {
|
||||
($($(#[$attr:meta])* pub struct $i:ident { $($field:tt)* })*) => ($(
|
||||
__item! {
|
||||
#[repr(C)]
|
||||
$(#[$attr])*
|
||||
pub struct $i { $($field)* }
|
||||
}
|
||||
impl ::dox::Copy for $i {}
|
||||
impl ::dox::Clone for $i {
|
||||
fn clone(&self) -> $i { *self }
|
||||
}
|
||||
)*)
|
||||
}
|
||||
|
||||
macro_rules! f {
|
||||
($(pub fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty {
|
||||
$($body:stmt);*
|
||||
})*) => ($(
|
||||
#[inline]
|
||||
#[cfg(not(dox))]
|
||||
pub unsafe extern fn $i($($arg: $argty),*) -> $ret {
|
||||
$($body);*
|
||||
}
|
||||
|
||||
#[cfg(dox)]
|
||||
#[allow(dead_code)]
|
||||
pub unsafe extern fn $i($($arg: $argty),*) -> $ret {
|
||||
loop {}
|
||||
}
|
||||
)*)
|
||||
}
|
||||
|
||||
macro_rules! __item {
|
||||
($i:item) => ($i)
|
||||
}
|
96
third_party/rust/libc-0.2.30/src/redox.rs
vendored
96
third_party/rust/libc-0.2.30/src/redox.rs
vendored
@ -1,96 +0,0 @@
|
||||
pub type c_char = i8;
|
||||
pub type c_long = i64;
|
||||
pub type c_ulong = u64;
|
||||
|
||||
pub type wchar_t = i16;
|
||||
|
||||
pub type off_t = c_long;
|
||||
pub type mode_t = u16;
|
||||
pub type time_t = i64;
|
||||
pub type pid_t = usize;
|
||||
pub type gid_t = usize;
|
||||
pub type uid_t = usize;
|
||||
|
||||
pub type in_addr_t = u32;
|
||||
pub type in_port_t = u16;
|
||||
|
||||
pub type socklen_t = u32;
|
||||
pub type sa_family_t = u16;
|
||||
|
||||
s! {
|
||||
pub struct in_addr {
|
||||
pub s_addr: in_addr_t,
|
||||
}
|
||||
|
||||
pub struct in6_addr {
|
||||
pub s6_addr: [u8; 16],
|
||||
__align: [u32; 0],
|
||||
}
|
||||
|
||||
pub struct sockaddr {
|
||||
pub sa_family: sa_family_t,
|
||||
pub sa_data: [::c_char; 14],
|
||||
}
|
||||
|
||||
pub struct sockaddr_in {
|
||||
pub sin_family: sa_family_t,
|
||||
pub sin_port: ::in_port_t,
|
||||
pub sin_addr: ::in_addr,
|
||||
pub sin_zero: [u8; 8],
|
||||
}
|
||||
|
||||
pub struct sockaddr_in6 {
|
||||
pub sin6_family: sa_family_t,
|
||||
pub sin6_port: in_port_t,
|
||||
pub sin6_flowinfo: u32,
|
||||
pub sin6_addr: ::in6_addr,
|
||||
pub sin6_scope_id: u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub const STDIN_FILENO: ::c_int = 0;
|
||||
pub const STDOUT_FILENO: ::c_int = 1;
|
||||
pub const STDERR_FILENO: ::c_int = 2;
|
||||
|
||||
pub const EXIT_FAILURE: ::c_int = 1;
|
||||
pub const EXIT_SUCCESS: ::c_int = 0;
|
||||
|
||||
pub const S_ISUID: ::c_int = 0x800;
|
||||
pub const S_ISGID: ::c_int = 0x400;
|
||||
pub const S_ISVTX: ::c_int = 0x200;
|
||||
|
||||
pub const S_IFIFO: mode_t = 0x1000;
|
||||
pub const S_IFCHR: mode_t = 0x2000;
|
||||
pub const S_IFBLK: mode_t = 0x6000;
|
||||
pub const S_IFDIR: mode_t = 0x4000;
|
||||
pub const S_IFREG: mode_t = 0x8000;
|
||||
pub const S_IFLNK: mode_t = 0xA000;
|
||||
pub const S_IFSOCK: mode_t = 0xC000;
|
||||
pub const S_IFMT: mode_t = 0xF000;
|
||||
pub const S_IEXEC: mode_t = 0x40;
|
||||
pub const S_IWRITE: mode_t = 0x80;
|
||||
pub const S_IREAD: mode_t = 0x100;
|
||||
pub const S_IRWXU: mode_t = 0x1C0;
|
||||
pub const S_IXUSR: mode_t = 0x40;
|
||||
pub const S_IWUSR: mode_t = 0x80;
|
||||
pub const S_IRUSR: mode_t = 0x100;
|
||||
pub const S_IRWXG: mode_t = 0x38;
|
||||
pub const S_IXGRP: mode_t = 0x8;
|
||||
pub const S_IWGRP: mode_t = 0x10;
|
||||
pub const S_IRGRP: mode_t = 0x20;
|
||||
pub const S_IRWXO: mode_t = 0x7;
|
||||
pub const S_IXOTH: mode_t = 0x1;
|
||||
pub const S_IWOTH: mode_t = 0x2;
|
||||
pub const S_IROTH: mode_t = 0x4;
|
||||
|
||||
extern {
|
||||
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
|
||||
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
|
||||
-> ::ssize_t;
|
||||
pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
|
||||
-> ::ssize_t;
|
||||
}
|
||||
|
||||
#[link(name = "c")]
|
||||
#[link(name = "m")]
|
||||
extern {}
|
@ -1,53 +0,0 @@
|
||||
//! 32-bit specific Apple (ios/darwin) definitions
|
||||
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
||||
pub type boolean_t = ::c_int;
|
||||
|
||||
s! {
|
||||
pub struct pthread_attr_t {
|
||||
__sig: c_long,
|
||||
__opaque: [::c_char; 36]
|
||||
}
|
||||
|
||||
pub struct if_data {
|
||||
pub ifi_type: ::c_uchar,
|
||||
pub ifi_typelen: ::c_uchar,
|
||||
pub ifi_physical: ::c_uchar,
|
||||
pub ifi_addrlen: ::c_uchar,
|
||||
pub ifi_hdrlen: ::c_uchar,
|
||||
pub ifi_recvquota: ::c_uchar,
|
||||
pub ifi_xmitquota: ::c_uchar,
|
||||
pub ifi_unused1: ::c_uchar,
|
||||
pub ifi_mtu: u32,
|
||||
pub ifi_metric: u32,
|
||||
pub ifi_baudrate: u32,
|
||||
pub ifi_ipackets: u32,
|
||||
pub ifi_ierrors: u32,
|
||||
pub ifi_opackets: u32,
|
||||
pub ifi_oerrors: u32,
|
||||
pub ifi_collisions: u32,
|
||||
pub ifi_ibytes: u32,
|
||||
pub ifi_obytes: u32,
|
||||
pub ifi_imcasts: u32,
|
||||
pub ifi_omcasts: u32,
|
||||
pub ifi_iqdrops: u32,
|
||||
pub ifi_noproto: u32,
|
||||
pub ifi_recvtiming: u32,
|
||||
pub ifi_xmittiming: u32,
|
||||
pub ifi_lastchange: ::timeval,
|
||||
pub ifi_unused2: u32,
|
||||
pub ifi_hwassist: u32,
|
||||
pub ifi_reserved1: u32,
|
||||
pub ifi_reserved2: u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
|
||||
pub const __PTHREAD_COND_SIZE__: usize = 24;
|
||||
pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
|
||||
pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
|
||||
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12;
|
||||
|
||||
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
|
||||
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458;
|
@ -1,60 +0,0 @@
|
||||
//! 64-bit specific Apple (ios/darwin) definitions
|
||||
|
||||
pub type c_long = i64;
|
||||
pub type c_ulong = u64;
|
||||
pub type boolean_t = ::c_uint;
|
||||
|
||||
s! {
|
||||
pub struct pthread_attr_t {
|
||||
__sig: c_long,
|
||||
__opaque: [::c_char; 56]
|
||||
}
|
||||
|
||||
pub struct timeval32 {
|
||||
pub tv_sec: i32,
|
||||
pub tv_usec: i32,
|
||||
}
|
||||
|
||||
pub struct if_data {
|
||||
pub ifi_type: ::c_uchar,
|
||||
pub ifi_typelen: ::c_uchar,
|
||||
pub ifi_physical: ::c_uchar,
|
||||
pub ifi_addrlen: ::c_uchar,
|
||||
pub ifi_hdrlen: ::c_uchar,
|
||||
pub ifi_recvquota: ::c_uchar,
|
||||
pub ifi_xmitquota: ::c_uchar,
|
||||
pub ifi_unused1: ::c_uchar,
|
||||
pub ifi_mtu: u32,
|
||||
pub ifi_metric: u32,
|
||||
pub ifi_baudrate: u32,
|
||||
pub ifi_ipackets: u32,
|
||||
pub ifi_ierrors: u32,
|
||||
pub ifi_opackets: u32,
|
||||
pub ifi_oerrors: u32,
|
||||
pub ifi_collisions: u32,
|
||||
pub ifi_ibytes: u32,
|
||||
pub ifi_obytes: u32,
|
||||
pub ifi_imcasts: u32,
|
||||
pub ifi_omcasts: u32,
|
||||
pub ifi_iqdrops: u32,
|
||||
pub ifi_noproto: u32,
|
||||
pub ifi_recvtiming: u32,
|
||||
pub ifi_xmittiming: u32,
|
||||
pub ifi_lastchange: timeval32,
|
||||
pub ifi_unused2: u32,
|
||||
pub ifi_hwassist: u32,
|
||||
pub ifi_reserved1: u32,
|
||||
pub ifi_reserved2: u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
|
||||
pub const __PTHREAD_COND_SIZE__: usize = 40;
|
||||
pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
|
||||
pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
|
||||
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
|
||||
|
||||
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
|
||||
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;
|
||||
|
||||
pub const FIONREAD: ::c_ulong = 0x4004667f;
|
1826
third_party/rust/libc-0.2.30/src/unix/bsd/apple/mod.rs
vendored
1826
third_party/rust/libc-0.2.30/src/unix/bsd/apple/mod.rs
vendored
File diff suppressed because it is too large
Load Diff
@ -1,478 +0,0 @@
|
||||
pub type clock_t = u64;
|
||||
pub type ino_t = u64;
|
||||
pub type nlink_t = u32;
|
||||
pub type blksize_t = i64;
|
||||
pub type clockid_t = ::c_ulong;
|
||||
|
||||
pub type c_long = i64;
|
||||
pub type c_ulong = u64;
|
||||
pub type time_t = i64;
|
||||
pub type suseconds_t = i64;
|
||||
|
||||
pub type uuid_t = ::uuid;
|
||||
|
||||
pub type fsblkcnt_t = u64;
|
||||
pub type fsfilcnt_t = u64;
|
||||
|
||||
pub type sem_t = *mut sem;
|
||||
|
||||
pub enum sem {}
|
||||
|
||||
s! {
|
||||
|
||||
pub struct exit_status {
|
||||
pub e_termination: u16,
|
||||
pub e_exit: u16
|
||||
}
|
||||
|
||||
pub struct utmpx {
|
||||
pub ut_name: [::c_char; 32],
|
||||
pub ut_id: [::c_char; 4],
|
||||
|
||||
pub ut_line: [::c_char; 32],
|
||||
pub ut_host: [::c_char; 256],
|
||||
|
||||
pub ut_unused: [u8; 16],
|
||||
pub ut_session: u16,
|
||||
pub ut_type: u16,
|
||||
pub ut_pid: ::pid_t,
|
||||
ut_exit: exit_status,
|
||||
ut_ss: ::sockaddr_storage,
|
||||
pub ut_tv: ::timeval,
|
||||
pub ut_unused2: [u8; 16],
|
||||
}
|
||||
|
||||
pub struct aiocb {
|
||||
pub aio_fildes: ::c_int,
|
||||
pub aio_offset: ::off_t,
|
||||
pub aio_buf: *mut ::c_void,
|
||||
pub aio_nbytes: ::size_t,
|
||||
pub aio_sigevent: sigevent,
|
||||
pub aio_lio_opcode: ::c_int,
|
||||
pub aio_reqprio: ::c_int,
|
||||
_aio_val: ::c_int,
|
||||
_aio_err: ::c_int
|
||||
}
|
||||
|
||||
pub struct dirent {
|
||||
pub d_fileno: ::ino_t,
|
||||
pub d_namlen: u16,
|
||||
pub d_type: u8,
|
||||
__unused1: u8,
|
||||
__unused2: u32,
|
||||
pub d_name: [::c_char; 256],
|
||||
}
|
||||
|
||||
pub struct uuid {
|
||||
pub time_low: u32,
|
||||
pub time_mid: u16,
|
||||
pub time_hi_and_version: u16,
|
||||
pub clock_seq_hi_and_reserved: u8,
|
||||
pub clock_seq_low: u8,
|
||||
pub node: [u8; 6],
|
||||
}
|
||||
|
||||
pub struct sigevent {
|
||||
pub sigev_notify: ::c_int,
|
||||
// The union is 8-byte in size, so it is aligned at a 8-byte offset.
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
__unused1: ::c_int,
|
||||
pub sigev_signo: ::c_int, //actually a union
|
||||
// pad the union
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
__unused2: ::c_int,
|
||||
pub sigev_value: ::sigval,
|
||||
__unused3: *mut ::c_void //actually a function pointer
|
||||
}
|
||||
|
||||
pub struct statvfs {
|
||||
pub f_bsize: ::c_ulong,
|
||||
pub f_frsize: ::c_ulong,
|
||||
pub f_blocks: ::fsblkcnt_t,
|
||||
pub f_bfree: ::fsblkcnt_t,
|
||||
pub f_bavail: ::fsblkcnt_t,
|
||||
pub f_files: ::fsfilcnt_t,
|
||||
pub f_ffree: ::fsfilcnt_t,
|
||||
pub f_favail: ::fsfilcnt_t,
|
||||
pub f_fsid: ::c_ulong,
|
||||
pub f_flag: ::c_ulong,
|
||||
pub f_namemax: ::c_ulong,
|
||||
pub f_owner: ::uid_t,
|
||||
pub f_type: ::c_uint,
|
||||
pub f_syncreads: u64,
|
||||
pub f_syncwrites: u64,
|
||||
pub f_asyncreads: u64,
|
||||
pub f_asyncwrites: u64,
|
||||
pub f_fsid_uuid: ::uuid_t,
|
||||
pub f_uid_uuid: ::uuid_t,
|
||||
}
|
||||
|
||||
pub struct stat {
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_nlink: ::nlink_t,
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_mode: ::mode_t,
|
||||
pub st_padding1: ::uint16_t,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
pub st_atime: ::time_t,
|
||||
pub st_atime_nsec: ::c_long,
|
||||
pub st_mtime: ::time_t,
|
||||
pub st_mtime_nsec: ::c_long,
|
||||
pub st_ctime: ::time_t,
|
||||
pub st_ctime_nsec: ::c_long,
|
||||
pub st_size: ::off_t,
|
||||
pub st_blocks: ::int64_t,
|
||||
pub st_blksize: ::uint32_t,
|
||||
pub st_flags: ::uint32_t,
|
||||
pub st_gen: ::uint32_t,
|
||||
pub st_lspare: ::int32_t,
|
||||
pub st_qspare1: ::int64_t,
|
||||
pub st_qspare2: ::int64_t,
|
||||
}
|
||||
|
||||
pub struct if_data {
|
||||
pub ifi_type: ::c_uchar,
|
||||
pub ifi_physical: ::c_uchar,
|
||||
pub ifi_addrlen: ::c_uchar,
|
||||
pub ifi_hdrlen: ::c_uchar,
|
||||
pub ifi_recvquota: ::c_uchar,
|
||||
pub ifi_xmitquota: ::c_uchar,
|
||||
pub ifi_mtu: ::c_ulong,
|
||||
pub ifi_metric: ::c_ulong,
|
||||
pub ifi_link_state: ::c_ulong,
|
||||
pub ifi_baudrate: u64,
|
||||
pub ifi_ipackets: ::c_ulong,
|
||||
pub ifi_ierrors: ::c_ulong,
|
||||
pub ifi_opackets: ::c_ulong,
|
||||
pub ifi_oerrors: ::c_ulong,
|
||||
pub ifi_collisions: ::c_ulong,
|
||||
pub ifi_ibytes: ::c_ulong,
|
||||
pub ifi_obytes: ::c_ulong,
|
||||
pub ifi_imcasts: ::c_ulong,
|
||||
pub ifi_omcasts: ::c_ulong,
|
||||
pub ifi_iqdrops: ::c_ulong,
|
||||
pub ifi_noproto: ::c_ulong,
|
||||
pub ifi_hwassist: ::c_ulong,
|
||||
pub ifi_oqdrops: ::c_ulong,
|
||||
pub ifi_lastchange: ::timeval,
|
||||
}
|
||||
|
||||
pub struct if_msghdr {
|
||||
pub ifm_msglen: ::c_ushort,
|
||||
pub ifm_version: ::c_uchar,
|
||||
pub ifm_type: ::c_uchar,
|
||||
pub ifm_addrs: ::c_int,
|
||||
pub ifm_flags: ::c_int,
|
||||
pub ifm_index: ::c_ushort,
|
||||
pub ifm_data: if_data,
|
||||
}
|
||||
}
|
||||
|
||||
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
|
||||
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
|
||||
pub const SIGSTKSZ: ::size_t = 40960;
|
||||
pub const MADV_INVAL: ::c_int = 10;
|
||||
pub const O_CLOEXEC: ::c_int = 0x00020000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x08000000;
|
||||
pub const F_GETLK: ::c_int = 7;
|
||||
pub const F_SETLK: ::c_int = 8;
|
||||
pub const F_SETLKW: ::c_int = 9;
|
||||
pub const ELAST: ::c_int = 99;
|
||||
pub const RLIMIT_POSIXLOCKS: ::c_int = 11;
|
||||
pub const RLIM_NLIMITS: ::rlim_t = 12;
|
||||
|
||||
pub const Q_GETQUOTA: ::c_int = 0x300;
|
||||
pub const Q_SETQUOTA: ::c_int = 0x400;
|
||||
|
||||
pub const CLOCK_REALTIME: ::clockid_t = 0;
|
||||
pub const CLOCK_VIRTUAL: ::clockid_t = 1;
|
||||
pub const CLOCK_PROF: ::clockid_t = 2;
|
||||
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
|
||||
pub const CLOCK_UPTIME: ::clockid_t = 5;
|
||||
pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
|
||||
pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
|
||||
pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
|
||||
pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
|
||||
pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
|
||||
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
|
||||
pub const CLOCK_SECOND: ::clockid_t = 13;
|
||||
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
|
||||
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
|
||||
|
||||
pub const CTL_UNSPEC: ::c_int = 0;
|
||||
pub const CTL_KERN: ::c_int = 1;
|
||||
pub const CTL_VM: ::c_int = 2;
|
||||
pub const CTL_VFS: ::c_int = 3;
|
||||
pub const CTL_NET: ::c_int = 4;
|
||||
pub const CTL_DEBUG: ::c_int = 5;
|
||||
pub const CTL_HW: ::c_int = 6;
|
||||
pub const CTL_MACHDEP: ::c_int = 7;
|
||||
pub const CTL_USER: ::c_int = 8;
|
||||
pub const CTL_P1003_1B: ::c_int = 9;
|
||||
pub const CTL_LWKT: ::c_int = 10;
|
||||
pub const CTL_MAXID: ::c_int = 11;
|
||||
pub const KERN_OSTYPE: ::c_int = 1;
|
||||
pub const KERN_OSRELEASE: ::c_int = 2;
|
||||
pub const KERN_OSREV: ::c_int = 3;
|
||||
pub const KERN_VERSION: ::c_int = 4;
|
||||
pub const KERN_MAXVNODES: ::c_int = 5;
|
||||
pub const KERN_MAXPROC: ::c_int = 6;
|
||||
pub const KERN_MAXFILES: ::c_int = 7;
|
||||
pub const KERN_ARGMAX: ::c_int = 8;
|
||||
pub const KERN_SECURELVL: ::c_int = 9;
|
||||
pub const KERN_HOSTNAME: ::c_int = 10;
|
||||
pub const KERN_HOSTID: ::c_int = 11;
|
||||
pub const KERN_CLOCKRATE: ::c_int = 12;
|
||||
pub const KERN_VNODE: ::c_int = 13;
|
||||
pub const KERN_PROC: ::c_int = 14;
|
||||
pub const KERN_FILE: ::c_int = 15;
|
||||
pub const KERN_PROF: ::c_int = 16;
|
||||
pub const KERN_POSIX1: ::c_int = 17;
|
||||
pub const KERN_NGROUPS: ::c_int = 18;
|
||||
pub const KERN_JOB_CONTROL: ::c_int = 19;
|
||||
pub const KERN_SAVED_IDS: ::c_int = 20;
|
||||
pub const KERN_BOOTTIME: ::c_int = 21;
|
||||
pub const KERN_NISDOMAINNAME: ::c_int = 22;
|
||||
pub const KERN_UPDATEINTERVAL: ::c_int = 23;
|
||||
pub const KERN_OSRELDATE: ::c_int = 24;
|
||||
pub const KERN_NTP_PLL: ::c_int = 25;
|
||||
pub const KERN_BOOTFILE: ::c_int = 26;
|
||||
pub const KERN_MAXFILESPERPROC: ::c_int = 27;
|
||||
pub const KERN_MAXPROCPERUID: ::c_int = 28;
|
||||
pub const KERN_DUMPDEV: ::c_int = 29;
|
||||
pub const KERN_IPC: ::c_int = 30;
|
||||
pub const KERN_DUMMY: ::c_int = 31;
|
||||
pub const KERN_PS_STRINGS: ::c_int = 32;
|
||||
pub const KERN_USRSTACK: ::c_int = 33;
|
||||
pub const KERN_LOGSIGEXIT: ::c_int = 34;
|
||||
pub const KERN_IOV_MAX: ::c_int = 35;
|
||||
pub const KERN_MAXPOSIXLOCKSPERUID: ::c_int = 36;
|
||||
pub const KERN_MAXID: ::c_int = 37;
|
||||
pub const KERN_PROC_ALL: ::c_int = 0;
|
||||
pub const KERN_PROC_PID: ::c_int = 1;
|
||||
pub const KERN_PROC_PGRP: ::c_int = 2;
|
||||
pub const KERN_PROC_SESSION: ::c_int = 3;
|
||||
pub const KERN_PROC_TTY: ::c_int = 4;
|
||||
pub const KERN_PROC_UID: ::c_int = 5;
|
||||
pub const KERN_PROC_RUID: ::c_int = 6;
|
||||
pub const KERN_PROC_ARGS: ::c_int = 7;
|
||||
pub const KERN_PROC_CWD: ::c_int = 8;
|
||||
pub const KERN_PROC_PATHNAME: ::c_int = 9;
|
||||
pub const KERN_PROC_FLAGMASK: ::c_int = 0x10;
|
||||
pub const KERN_PROC_FLAG_LWP: ::c_int = 0x10;
|
||||
pub const KIPC_MAXSOCKBUF: ::c_int = 1;
|
||||
pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
|
||||
pub const KIPC_SOMAXCONN: ::c_int = 3;
|
||||
pub const KIPC_MAX_LINKHDR: ::c_int = 4;
|
||||
pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
|
||||
pub const KIPC_MAX_HDR: ::c_int = 6;
|
||||
pub const KIPC_MAX_DATALEN: ::c_int = 7;
|
||||
pub const KIPC_MBSTAT: ::c_int = 8;
|
||||
pub const KIPC_NMBCLUSTERS: ::c_int = 9;
|
||||
pub const HW_MACHINE: ::c_int = 1;
|
||||
pub const HW_MODEL: ::c_int = 2;
|
||||
pub const HW_NCPU: ::c_int = 3;
|
||||
pub const HW_BYTEORDER: ::c_int = 4;
|
||||
pub const HW_PHYSMEM: ::c_int = 5;
|
||||
pub const HW_USERMEM: ::c_int = 6;
|
||||
pub const HW_PAGESIZE: ::c_int = 7;
|
||||
pub const HW_DISKNAMES: ::c_int = 8;
|
||||
pub const HW_DISKSTATS: ::c_int = 9;
|
||||
pub const HW_FLOATINGPT: ::c_int = 10;
|
||||
pub const HW_MACHINE_ARCH: ::c_int = 11;
|
||||
pub const HW_MACHINE_PLATFORM: ::c_int = 12;
|
||||
pub const HW_SENSORS: ::c_int = 13;
|
||||
pub const HW_MAXID: ::c_int = 14;
|
||||
pub const USER_CS_PATH: ::c_int = 1;
|
||||
pub const USER_BC_BASE_MAX: ::c_int = 2;
|
||||
pub const USER_BC_DIM_MAX: ::c_int = 3;
|
||||
pub const USER_BC_SCALE_MAX: ::c_int = 4;
|
||||
pub const USER_BC_STRING_MAX: ::c_int = 5;
|
||||
pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
|
||||
pub const USER_EXPR_NEST_MAX: ::c_int = 7;
|
||||
pub const USER_LINE_MAX: ::c_int = 8;
|
||||
pub const USER_RE_DUP_MAX: ::c_int = 9;
|
||||
pub const USER_POSIX2_VERSION: ::c_int = 10;
|
||||
pub const USER_POSIX2_C_BIND: ::c_int = 11;
|
||||
pub const USER_POSIX2_C_DEV: ::c_int = 12;
|
||||
pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
|
||||
pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
|
||||
pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
|
||||
pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
|
||||
pub const USER_POSIX2_SW_DEV: ::c_int = 17;
|
||||
pub const USER_POSIX2_UPE: ::c_int = 18;
|
||||
pub const USER_STREAM_MAX: ::c_int = 19;
|
||||
pub const USER_TZNAME_MAX: ::c_int = 20;
|
||||
pub const USER_MAXID: ::c_int = 21;
|
||||
pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
|
||||
pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
|
||||
pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
|
||||
pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4;
|
||||
pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5;
|
||||
pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6;
|
||||
pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7;
|
||||
pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8;
|
||||
pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9;
|
||||
pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10;
|
||||
pub const CTL_P1003_1B_FSYNC: ::c_int = 11;
|
||||
pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12;
|
||||
pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13;
|
||||
pub const CTL_P1003_1B_TIMERS: ::c_int = 14;
|
||||
pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15;
|
||||
pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16;
|
||||
pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17;
|
||||
pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18;
|
||||
pub const CTL_P1003_1B_UNUSED1: ::c_int = 19;
|
||||
pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20;
|
||||
pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21;
|
||||
pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
|
||||
pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
|
||||
pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
|
||||
pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
|
||||
pub const CTL_P1003_1B_MAXID: ::c_int = 26;
|
||||
|
||||
pub const EVFILT_READ: ::int16_t = -1;
|
||||
pub const EVFILT_WRITE: ::int16_t = -2;
|
||||
pub const EVFILT_AIO: ::int16_t = -3;
|
||||
pub const EVFILT_VNODE: ::int16_t = -4;
|
||||
pub const EVFILT_PROC: ::int16_t = -5;
|
||||
pub const EVFILT_SIGNAL: ::int16_t = -6;
|
||||
pub const EVFILT_TIMER: ::int16_t = -7;
|
||||
pub const EVFILT_EXCEPT: ::int16_t = -8;
|
||||
pub const EVFILT_USER: ::int16_t = -9;
|
||||
pub const EVFILT_FS: ::int16_t = -10;
|
||||
|
||||
pub const EV_ADD: ::uint16_t = 0x1;
|
||||
pub const EV_DELETE: ::uint16_t = 0x2;
|
||||
pub const EV_ENABLE: ::uint16_t = 0x4;
|
||||
pub const EV_DISABLE: ::uint16_t = 0x8;
|
||||
pub const EV_ONESHOT: ::uint16_t = 0x10;
|
||||
pub const EV_CLEAR: ::uint16_t = 0x20;
|
||||
pub const EV_RECEIPT: ::uint16_t = 0x40;
|
||||
pub const EV_DISPATCH: ::uint16_t = 0x80;
|
||||
pub const EV_NODATA: ::uint16_t = 0x1000;
|
||||
pub const EV_FLAG1: ::uint16_t = 0x2000;
|
||||
pub const EV_ERROR: ::uint16_t = 0x4000;
|
||||
pub const EV_EOF: ::uint16_t = 0x8000;
|
||||
pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
|
||||
|
||||
pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
|
||||
pub const NOTE_FFNOP: ::uint32_t = 0x00000000;
|
||||
pub const NOTE_FFAND: ::uint32_t = 0x40000000;
|
||||
pub const NOTE_FFOR: ::uint32_t = 0x80000000;
|
||||
pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
|
||||
pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
|
||||
pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
|
||||
pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_OOB: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_DELETE: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_WRITE: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
|
||||
pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
|
||||
pub const NOTE_LINK: ::uint32_t = 0x00000010;
|
||||
pub const NOTE_RENAME: ::uint32_t = 0x00000020;
|
||||
pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
|
||||
pub const NOTE_EXIT: ::uint32_t = 0x80000000;
|
||||
pub const NOTE_FORK: ::uint32_t = 0x40000000;
|
||||
pub const NOTE_EXEC: ::uint32_t = 0x20000000;
|
||||
pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
|
||||
pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
|
||||
pub const NOTE_TRACK: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
|
||||
|
||||
pub const SO_SNDSPACE: ::c_int = 0x100a;
|
||||
pub const SO_CPUHINT: ::c_int = 0x1030;
|
||||
|
||||
pub const AF_BLUETOOTH: ::c_int = 33;
|
||||
pub const AF_MPLS: ::c_int = 34;
|
||||
pub const AF_IEEE80211: ::c_int = 35;
|
||||
pub const AF_MAX: ::c_int = 36;
|
||||
|
||||
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
|
||||
pub const PF_MAX: ::c_int = AF_MAX;
|
||||
|
||||
pub const NET_RT_DUMP: ::c_int = 1;
|
||||
pub const NET_RT_FLAGS: ::c_int = 2;
|
||||
pub const NET_RT_IFLIST: ::c_int = 3;
|
||||
pub const NET_RT_MAXID: ::c_int = 4;
|
||||
|
||||
pub const SOMAXOPT_SIZE: ::c_int = 65536;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub const NET_MAXID: ::c_int = AF_MAX;
|
||||
|
||||
pub const MSG_UNUSED09: ::c_int = 0x00000200;
|
||||
pub const MSG_NOSIGNAL: ::c_int = 0x00000400;
|
||||
pub const MSG_SYNC: ::c_int = 0x00000800;
|
||||
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00001000;
|
||||
pub const MSG_FBLOCKING: ::c_int = 0x00010000;
|
||||
pub const MSG_FNONBLOCKING: ::c_int = 0x00020000;
|
||||
pub const MSG_FMASK: ::c_int = 0xFFFF0000;
|
||||
|
||||
pub const EMPTY: ::c_short = 0;
|
||||
pub const RUN_LVL: ::c_short = 1;
|
||||
pub const BOOT_TIME: ::c_short = 2;
|
||||
pub const OLD_TIME: ::c_short = 3;
|
||||
pub const NEW_TIME: ::c_short = 4;
|
||||
pub const INIT_PROCESS: ::c_short = 5;
|
||||
pub const LOGIN_PROCESS: ::c_short = 6;
|
||||
pub const USER_PROCESS: ::c_short = 7;
|
||||
pub const DEAD_PROCESS: ::c_short = 8;
|
||||
|
||||
pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
|
||||
pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
|
||||
pub const LC_MONETARY_MASK: ::c_int = (1 << 2);
|
||||
pub const LC_NUMERIC_MASK: ::c_int = (1 << 3);
|
||||
pub const LC_TIME_MASK: ::c_int = (1 << 4);
|
||||
pub const LC_MESSAGES_MASK: ::c_int = (1 << 5);
|
||||
pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
|
||||
| LC_CTYPE_MASK
|
||||
| LC_MESSAGES_MASK
|
||||
| LC_MONETARY_MASK
|
||||
| LC_NUMERIC_MASK
|
||||
| LC_TIME_MASK;
|
||||
|
||||
pub const TIOCSIG: ::c_uint = 0x2000745f;
|
||||
pub const BTUARTDISC: ::c_int = 0x7;
|
||||
pub const TIOCDCDTIMESTAMP: ::c_uint = 0x40107458;
|
||||
pub const TIOCISPTMASTER: ::c_uint = 0x20007455;
|
||||
pub const TIOCMODG: ::c_uint = 0x40047403;
|
||||
pub const TIOCMODS: ::c_ulong = 0x80047404;
|
||||
pub const TIOCREMOTE: ::c_ulong = 0x80047469;
|
||||
|
||||
// Constants used by "at" family of system calls.
|
||||
pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor
|
||||
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 1;
|
||||
pub const AT_REMOVEDIR: ::c_int = 2;
|
||||
pub const AT_EACCESS: ::c_int = 4;
|
||||
pub const AT_SYMLINK_FOLLOW: ::c_int = 8;
|
||||
|
||||
pub const VCHECKPT: usize = 19;
|
||||
|
||||
pub const _PC_2_SYMLINKS: ::c_int = 22;
|
||||
pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 23;
|
||||
|
||||
pub const _SC_V7_ILP32_OFF32: ::c_int = 122;
|
||||
pub const _SC_V7_ILP32_OFFBIG: ::c_int = 123;
|
||||
pub const _SC_V7_LP64_OFF64: ::c_int = 124;
|
||||
pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 125;
|
||||
pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 126;
|
||||
pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 127;
|
||||
|
||||
extern {
|
||||
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
|
||||
-> ::c_int;
|
||||
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
|
||||
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
|
||||
pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
|
||||
|
||||
pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;
|
||||
|
||||
pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
|
||||
timeout: *mut ::timespec) -> ::c_int;
|
||||
|
||||
pub fn freelocale(loc: ::locale_t);
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
pub type c_long = i64;
|
||||
pub type c_ulong = u64;
|
||||
pub type time_t = i64;
|
||||
pub type suseconds_t = i64;
|
||||
|
||||
s! {
|
||||
pub struct stat {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_mode: ::mode_t,
|
||||
pub st_nlink: ::nlink_t,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
pub st_atime: ::time_t,
|
||||
pub st_atime_nsec: ::c_long,
|
||||
pub st_mtime: ::time_t,
|
||||
pub st_mtime_nsec: ::c_long,
|
||||
pub st_ctime: ::time_t,
|
||||
pub st_ctime_nsec: ::c_long,
|
||||
pub st_size: ::off_t,
|
||||
pub st_blocks: ::blkcnt_t,
|
||||
pub st_blksize: ::blksize_t,
|
||||
pub st_flags: ::fflags_t,
|
||||
pub st_gen: ::uint32_t,
|
||||
pub st_lspare: ::int32_t,
|
||||
pub st_birthtime: ::time_t,
|
||||
pub st_birthtime_nsec: ::c_long,
|
||||
}
|
||||
}
|
||||
|
||||
pub const MAP_32BIT: ::c_int = 0x00080000;
|
@ -1,597 +0,0 @@
|
||||
pub type fflags_t = u32;
|
||||
pub type clock_t = i32;
|
||||
pub type ino_t = u32;
|
||||
pub type lwpid_t = i32;
|
||||
pub type nlink_t = u16;
|
||||
pub type blksize_t = u32;
|
||||
pub type clockid_t = ::c_int;
|
||||
pub type sem_t = _sem;
|
||||
|
||||
pub type fsblkcnt_t = ::uint64_t;
|
||||
pub type fsfilcnt_t = ::uint64_t;
|
||||
pub type idtype_t = ::c_uint;
|
||||
|
||||
pub type key_t = ::c_long;
|
||||
pub type msglen_t = ::c_ulong;
|
||||
pub type msgqnum_t = ::c_ulong;
|
||||
|
||||
s! {
|
||||
pub struct utmpx {
|
||||
pub ut_type: ::c_short,
|
||||
pub ut_tv: ::timeval,
|
||||
pub ut_id: [::c_char; 8],
|
||||
pub ut_pid: ::pid_t,
|
||||
pub ut_user: [::c_char; 32],
|
||||
pub ut_line: [::c_char; 16],
|
||||
pub ut_host: [::c_char; 128],
|
||||
pub __ut_spare: [::c_char; 64],
|
||||
}
|
||||
|
||||
pub struct aiocb {
|
||||
pub aio_fildes: ::c_int,
|
||||
pub aio_offset: ::off_t,
|
||||
pub aio_buf: *mut ::c_void,
|
||||
pub aio_nbytes: ::size_t,
|
||||
__unused1: [::c_int; 2],
|
||||
__unused2: *mut ::c_void,
|
||||
pub aio_lio_opcode: ::c_int,
|
||||
pub aio_reqprio: ::c_int,
|
||||
// unused 3 through 5 are the __aiocb_private structure
|
||||
__unused3: ::c_long,
|
||||
__unused4: ::c_long,
|
||||
__unused5: *mut ::c_void,
|
||||
pub aio_sigevent: sigevent
|
||||
}
|
||||
|
||||
pub struct dirent {
|
||||
pub d_fileno: u32,
|
||||
pub d_reclen: u16,
|
||||
pub d_type: u8,
|
||||
pub d_namlen: u8,
|
||||
pub d_name: [::c_char; 256],
|
||||
}
|
||||
|
||||
pub struct jail {
|
||||
pub version: u32,
|
||||
pub path: *mut ::c_char,
|
||||
pub hostname: *mut ::c_char,
|
||||
pub jailname: *mut ::c_char,
|
||||
pub ip4s: ::c_uint,
|
||||
pub ip6s: ::c_uint,
|
||||
pub ip4: *mut ::in_addr,
|
||||
pub ip6: *mut ::in6_addr,
|
||||
}
|
||||
|
||||
pub struct sigevent {
|
||||
pub sigev_notify: ::c_int,
|
||||
pub sigev_signo: ::c_int,
|
||||
pub sigev_value: ::sigval,
|
||||
//The rest of the structure is actually a union. We expose only
|
||||
//sigev_notify_thread_id because it's the most useful union member.
|
||||
pub sigev_notify_thread_id: ::lwpid_t,
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
__unused1: ::c_int,
|
||||
__unused2: [::c_long; 7]
|
||||
}
|
||||
|
||||
pub struct statvfs {
|
||||
pub f_bavail: ::fsblkcnt_t,
|
||||
pub f_bfree: ::fsblkcnt_t,
|
||||
pub f_blocks: ::fsblkcnt_t,
|
||||
pub f_favail: ::fsfilcnt_t,
|
||||
pub f_ffree: ::fsfilcnt_t,
|
||||
pub f_files: ::fsfilcnt_t,
|
||||
pub f_bsize: ::c_ulong,
|
||||
pub f_flag: ::c_ulong,
|
||||
pub f_frsize: ::c_ulong,
|
||||
pub f_fsid: ::c_ulong,
|
||||
pub f_namemax: ::c_ulong,
|
||||
}
|
||||
|
||||
// internal structure has changed over time
|
||||
pub struct _sem {
|
||||
data: [u32; 4],
|
||||
}
|
||||
|
||||
pub struct ipc_perm {
|
||||
pub cuid: ::uid_t,
|
||||
pub cgid: ::gid_t,
|
||||
pub uid: ::uid_t,
|
||||
pub gid: ::gid_t,
|
||||
pub mode: ::mode_t,
|
||||
pub seq: ::c_ushort,
|
||||
pub key: ::key_t,
|
||||
}
|
||||
|
||||
pub struct msqid_ds {
|
||||
pub msg_perm: ::ipc_perm,
|
||||
__unused1: *mut ::c_void,
|
||||
__unused2: *mut ::c_void,
|
||||
pub msg_cbytes: ::msglen_t,
|
||||
pub msg_qnum: ::msgqnum_t,
|
||||
pub msg_qbytes: ::msglen_t,
|
||||
pub msg_lspid: ::pid_t,
|
||||
pub msg_lrpid: ::pid_t,
|
||||
pub msg_stime: ::time_t,
|
||||
pub msg_rtime: ::time_t,
|
||||
pub msg_ctime: ::time_t,
|
||||
}
|
||||
|
||||
pub struct shmid_ds {
|
||||
pub shm_perm: ::ipc_perm,
|
||||
pub shm_segsz: ::size_t,
|
||||
pub shm_lpid: ::pid_t,
|
||||
pub shm_cpid: ::pid_t,
|
||||
pub shm_nattch: ::c_int,
|
||||
pub shm_atime: ::time_t,
|
||||
pub shm_dtime: ::time_t,
|
||||
pub shm_ctime: ::time_t,
|
||||
}
|
||||
}
|
||||
|
||||
pub const SIGEV_THREAD_ID: ::c_int = 4;
|
||||
|
||||
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
|
||||
pub const PTHREAD_STACK_MIN: ::size_t = 2048;
|
||||
pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
|
||||
pub const SIGSTKSZ: ::size_t = 34816;
|
||||
pub const SF_NODISKIO: ::c_int = 0x00000001;
|
||||
pub const SF_MNOWAIT: ::c_int = 0x00000002;
|
||||
pub const SF_SYNC: ::c_int = 0x00000004;
|
||||
pub const O_CLOEXEC: ::c_int = 0x00100000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x00020000;
|
||||
pub const O_EXEC: ::c_int = 0x00040000;
|
||||
pub const O_TTY_INIT: ::c_int = 0x00080000;
|
||||
pub const F_GETLK: ::c_int = 11;
|
||||
pub const F_SETLK: ::c_int = 12;
|
||||
pub const F_SETLKW: ::c_int = 13;
|
||||
pub const ELAST: ::c_int = 96;
|
||||
pub const RLIMIT_NPTS: ::c_int = 11;
|
||||
pub const RLIMIT_SWAP: ::c_int = 12;
|
||||
pub const RLIM_NLIMITS: ::rlim_t = 13;
|
||||
|
||||
pub const Q_GETQUOTA: ::c_int = 0x700;
|
||||
pub const Q_SETQUOTA: ::c_int = 0x800;
|
||||
|
||||
pub const POSIX_FADV_NORMAL: ::c_int = 0;
|
||||
pub const POSIX_FADV_RANDOM: ::c_int = 1;
|
||||
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
|
||||
pub const POSIX_FADV_WILLNEED: ::c_int = 3;
|
||||
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
|
||||
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
|
||||
|
||||
pub const POLLINIGNEOF: ::c_short = 0x2000;
|
||||
|
||||
pub const EVFILT_READ: ::int16_t = -1;
|
||||
pub const EVFILT_WRITE: ::int16_t = -2;
|
||||
pub const EVFILT_AIO: ::int16_t = -3;
|
||||
pub const EVFILT_VNODE: ::int16_t = -4;
|
||||
pub const EVFILT_PROC: ::int16_t = -5;
|
||||
pub const EVFILT_SIGNAL: ::int16_t = -6;
|
||||
pub const EVFILT_TIMER: ::int16_t = -7;
|
||||
pub const EVFILT_FS: ::int16_t = -9;
|
||||
pub const EVFILT_LIO: ::int16_t = -10;
|
||||
pub const EVFILT_USER: ::int16_t = -11;
|
||||
|
||||
pub const EV_ADD: ::uint16_t = 0x1;
|
||||
pub const EV_DELETE: ::uint16_t = 0x2;
|
||||
pub const EV_ENABLE: ::uint16_t = 0x4;
|
||||
pub const EV_DISABLE: ::uint16_t = 0x8;
|
||||
pub const EV_ONESHOT: ::uint16_t = 0x10;
|
||||
pub const EV_CLEAR: ::uint16_t = 0x20;
|
||||
pub const EV_RECEIPT: ::uint16_t = 0x40;
|
||||
pub const EV_DISPATCH: ::uint16_t = 0x80;
|
||||
pub const EV_DROP: ::uint16_t = 0x1000;
|
||||
pub const EV_FLAG1: ::uint16_t = 0x2000;
|
||||
pub const EV_ERROR: ::uint16_t = 0x4000;
|
||||
pub const EV_EOF: ::uint16_t = 0x8000;
|
||||
pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
|
||||
|
||||
pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
|
||||
pub const NOTE_FFNOP: ::uint32_t = 0x00000000;
|
||||
pub const NOTE_FFAND: ::uint32_t = 0x40000000;
|
||||
pub const NOTE_FFOR: ::uint32_t = 0x80000000;
|
||||
pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
|
||||
pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
|
||||
pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
|
||||
pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_DELETE: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_WRITE: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
|
||||
pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
|
||||
pub const NOTE_LINK: ::uint32_t = 0x00000010;
|
||||
pub const NOTE_RENAME: ::uint32_t = 0x00000020;
|
||||
pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
|
||||
pub const NOTE_EXIT: ::uint32_t = 0x80000000;
|
||||
pub const NOTE_FORK: ::uint32_t = 0x40000000;
|
||||
pub const NOTE_EXEC: ::uint32_t = 0x20000000;
|
||||
pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
|
||||
pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
|
||||
pub const NOTE_TRACK: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
|
||||
pub const NOTE_SECONDS: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_MSECONDS: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_USECONDS: ::uint32_t = 0x00000004;
|
||||
pub const NOTE_NSECONDS: ::uint32_t = 0x00000008;
|
||||
|
||||
pub const MADV_PROTECT: ::c_int = 10;
|
||||
pub const RUSAGE_THREAD: ::c_int = 1;
|
||||
|
||||
pub const CLOCK_REALTIME: ::clockid_t = 0;
|
||||
pub const CLOCK_VIRTUAL: ::clockid_t = 1;
|
||||
pub const CLOCK_PROF: ::clockid_t = 2;
|
||||
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
|
||||
pub const CLOCK_UPTIME: ::clockid_t = 5;
|
||||
pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
|
||||
pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
|
||||
pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
|
||||
pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
|
||||
pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
|
||||
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
|
||||
pub const CLOCK_SECOND: ::clockid_t = 13;
|
||||
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
|
||||
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
|
||||
|
||||
pub const CTL_UNSPEC: ::c_int = 0;
|
||||
pub const CTL_KERN: ::c_int = 1;
|
||||
pub const CTL_VM: ::c_int = 2;
|
||||
pub const CTL_VFS: ::c_int = 3;
|
||||
pub const CTL_NET: ::c_int = 4;
|
||||
pub const CTL_DEBUG: ::c_int = 5;
|
||||
pub const CTL_HW: ::c_int = 6;
|
||||
pub const CTL_MACHDEP: ::c_int = 7;
|
||||
pub const CTL_USER: ::c_int = 8;
|
||||
pub const CTL_P1003_1B: ::c_int = 9;
|
||||
pub const KERN_OSTYPE: ::c_int = 1;
|
||||
pub const KERN_OSRELEASE: ::c_int = 2;
|
||||
pub const KERN_OSREV: ::c_int = 3;
|
||||
pub const KERN_VERSION: ::c_int = 4;
|
||||
pub const KERN_MAXVNODES: ::c_int = 5;
|
||||
pub const KERN_MAXPROC: ::c_int = 6;
|
||||
pub const KERN_MAXFILES: ::c_int = 7;
|
||||
pub const KERN_ARGMAX: ::c_int = 8;
|
||||
pub const KERN_SECURELVL: ::c_int = 9;
|
||||
pub const KERN_HOSTNAME: ::c_int = 10;
|
||||
pub const KERN_HOSTID: ::c_int = 11;
|
||||
pub const KERN_CLOCKRATE: ::c_int = 12;
|
||||
pub const KERN_VNODE: ::c_int = 13;
|
||||
pub const KERN_PROC: ::c_int = 14;
|
||||
pub const KERN_FILE: ::c_int = 15;
|
||||
pub const KERN_PROF: ::c_int = 16;
|
||||
pub const KERN_POSIX1: ::c_int = 17;
|
||||
pub const KERN_NGROUPS: ::c_int = 18;
|
||||
pub const KERN_JOB_CONTROL: ::c_int = 19;
|
||||
pub const KERN_SAVED_IDS: ::c_int = 20;
|
||||
pub const KERN_BOOTTIME: ::c_int = 21;
|
||||
pub const KERN_NISDOMAINNAME: ::c_int = 22;
|
||||
pub const KERN_UPDATEINTERVAL: ::c_int = 23;
|
||||
pub const KERN_OSRELDATE: ::c_int = 24;
|
||||
pub const KERN_NTP_PLL: ::c_int = 25;
|
||||
pub const KERN_BOOTFILE: ::c_int = 26;
|
||||
pub const KERN_MAXFILESPERPROC: ::c_int = 27;
|
||||
pub const KERN_MAXPROCPERUID: ::c_int = 28;
|
||||
pub const KERN_DUMPDEV: ::c_int = 29;
|
||||
pub const KERN_IPC: ::c_int = 30;
|
||||
pub const KERN_DUMMY: ::c_int = 31;
|
||||
pub const KERN_PS_STRINGS: ::c_int = 32;
|
||||
pub const KERN_USRSTACK: ::c_int = 33;
|
||||
pub const KERN_LOGSIGEXIT: ::c_int = 34;
|
||||
pub const KERN_IOV_MAX: ::c_int = 35;
|
||||
pub const KERN_HOSTUUID: ::c_int = 36;
|
||||
pub const KERN_ARND: ::c_int = 37;
|
||||
pub const KERN_PROC_ALL: ::c_int = 0;
|
||||
pub const KERN_PROC_PID: ::c_int = 1;
|
||||
pub const KERN_PROC_PGRP: ::c_int = 2;
|
||||
pub const KERN_PROC_SESSION: ::c_int = 3;
|
||||
pub const KERN_PROC_TTY: ::c_int = 4;
|
||||
pub const KERN_PROC_UID: ::c_int = 5;
|
||||
pub const KERN_PROC_RUID: ::c_int = 6;
|
||||
pub const KERN_PROC_ARGS: ::c_int = 7;
|
||||
pub const KERN_PROC_PROC: ::c_int = 8;
|
||||
pub const KERN_PROC_SV_NAME: ::c_int = 9;
|
||||
pub const KERN_PROC_RGID: ::c_int = 10;
|
||||
pub const KERN_PROC_GID: ::c_int = 11;
|
||||
pub const KERN_PROC_PATHNAME: ::c_int = 12;
|
||||
pub const KERN_PROC_OVMMAP: ::c_int = 13;
|
||||
pub const KERN_PROC_OFILEDESC: ::c_int = 14;
|
||||
pub const KERN_PROC_KSTACK: ::c_int = 15;
|
||||
pub const KERN_PROC_INC_THREAD: ::c_int = 0x10;
|
||||
pub const KERN_PROC_VMMAP: ::c_int = 32;
|
||||
pub const KERN_PROC_FILEDESC: ::c_int = 33;
|
||||
pub const KERN_PROC_GROUPS: ::c_int = 34;
|
||||
pub const KERN_PROC_ENV: ::c_int = 35;
|
||||
pub const KERN_PROC_AUXV: ::c_int = 36;
|
||||
pub const KERN_PROC_RLIMIT: ::c_int = 37;
|
||||
pub const KERN_PROC_PS_STRINGS: ::c_int = 38;
|
||||
pub const KERN_PROC_UMASK: ::c_int = 39;
|
||||
pub const KERN_PROC_OSREL: ::c_int = 40;
|
||||
pub const KERN_PROC_SIGTRAMP: ::c_int = 41;
|
||||
pub const KIPC_MAXSOCKBUF: ::c_int = 1;
|
||||
pub const KIPC_SOCKBUF_WASTE: ::c_int = 2;
|
||||
pub const KIPC_SOMAXCONN: ::c_int = 3;
|
||||
pub const KIPC_MAX_LINKHDR: ::c_int = 4;
|
||||
pub const KIPC_MAX_PROTOHDR: ::c_int = 5;
|
||||
pub const KIPC_MAX_HDR: ::c_int = 6;
|
||||
pub const KIPC_MAX_DATALEN: ::c_int = 7;
|
||||
pub const HW_MACHINE: ::c_int = 1;
|
||||
pub const HW_MODEL: ::c_int = 2;
|
||||
pub const HW_NCPU: ::c_int = 3;
|
||||
pub const HW_BYTEORDER: ::c_int = 4;
|
||||
pub const HW_PHYSMEM: ::c_int = 5;
|
||||
pub const HW_USERMEM: ::c_int = 6;
|
||||
pub const HW_PAGESIZE: ::c_int = 7;
|
||||
pub const HW_DISKNAMES: ::c_int = 8;
|
||||
pub const HW_DISKSTATS: ::c_int = 9;
|
||||
pub const HW_FLOATINGPT: ::c_int = 10;
|
||||
pub const HW_MACHINE_ARCH: ::c_int = 11;
|
||||
pub const HW_REALMEM: ::c_int = 12;
|
||||
pub const USER_CS_PATH: ::c_int = 1;
|
||||
pub const USER_BC_BASE_MAX: ::c_int = 2;
|
||||
pub const USER_BC_DIM_MAX: ::c_int = 3;
|
||||
pub const USER_BC_SCALE_MAX: ::c_int = 4;
|
||||
pub const USER_BC_STRING_MAX: ::c_int = 5;
|
||||
pub const USER_COLL_WEIGHTS_MAX: ::c_int = 6;
|
||||
pub const USER_EXPR_NEST_MAX: ::c_int = 7;
|
||||
pub const USER_LINE_MAX: ::c_int = 8;
|
||||
pub const USER_RE_DUP_MAX: ::c_int = 9;
|
||||
pub const USER_POSIX2_VERSION: ::c_int = 10;
|
||||
pub const USER_POSIX2_C_BIND: ::c_int = 11;
|
||||
pub const USER_POSIX2_C_DEV: ::c_int = 12;
|
||||
pub const USER_POSIX2_CHAR_TERM: ::c_int = 13;
|
||||
pub const USER_POSIX2_FORT_DEV: ::c_int = 14;
|
||||
pub const USER_POSIX2_FORT_RUN: ::c_int = 15;
|
||||
pub const USER_POSIX2_LOCALEDEF: ::c_int = 16;
|
||||
pub const USER_POSIX2_SW_DEV: ::c_int = 17;
|
||||
pub const USER_POSIX2_UPE: ::c_int = 18;
|
||||
pub const USER_STREAM_MAX: ::c_int = 19;
|
||||
pub const USER_TZNAME_MAX: ::c_int = 20;
|
||||
pub const CTL_P1003_1B_ASYNCHRONOUS_IO: ::c_int = 1;
|
||||
pub const CTL_P1003_1B_MAPPED_FILES: ::c_int = 2;
|
||||
pub const CTL_P1003_1B_MEMLOCK: ::c_int = 3;
|
||||
pub const CTL_P1003_1B_MEMLOCK_RANGE: ::c_int = 4;
|
||||
pub const CTL_P1003_1B_MEMORY_PROTECTION: ::c_int = 5;
|
||||
pub const CTL_P1003_1B_MESSAGE_PASSING: ::c_int = 6;
|
||||
pub const CTL_P1003_1B_PRIORITIZED_IO: ::c_int = 7;
|
||||
pub const CTL_P1003_1B_PRIORITY_SCHEDULING: ::c_int = 8;
|
||||
pub const CTL_P1003_1B_REALTIME_SIGNALS: ::c_int = 9;
|
||||
pub const CTL_P1003_1B_SEMAPHORES: ::c_int = 10;
|
||||
pub const CTL_P1003_1B_FSYNC: ::c_int = 11;
|
||||
pub const CTL_P1003_1B_SHARED_MEMORY_OBJECTS: ::c_int = 12;
|
||||
pub const CTL_P1003_1B_SYNCHRONIZED_IO: ::c_int = 13;
|
||||
pub const CTL_P1003_1B_TIMERS: ::c_int = 14;
|
||||
pub const CTL_P1003_1B_AIO_LISTIO_MAX: ::c_int = 15;
|
||||
pub const CTL_P1003_1B_AIO_MAX: ::c_int = 16;
|
||||
pub const CTL_P1003_1B_AIO_PRIO_DELTA_MAX: ::c_int = 17;
|
||||
pub const CTL_P1003_1B_DELAYTIMER_MAX: ::c_int = 18;
|
||||
pub const CTL_P1003_1B_MQ_OPEN_MAX: ::c_int = 19;
|
||||
pub const CTL_P1003_1B_PAGESIZE: ::c_int = 20;
|
||||
pub const CTL_P1003_1B_RTSIG_MAX: ::c_int = 21;
|
||||
pub const CTL_P1003_1B_SEM_NSEMS_MAX: ::c_int = 22;
|
||||
pub const CTL_P1003_1B_SEM_VALUE_MAX: ::c_int = 23;
|
||||
pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24;
|
||||
pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
|
||||
pub const TIOCGPTN: ::c_uint = 0x4004740f;
|
||||
pub const TIOCPTMASTER: ::c_uint = 0x2000741c;
|
||||
pub const TIOCSIG: ::c_uint = 0x2004745f;
|
||||
pub const TIOCM_DCD: ::c_int = 0x40;
|
||||
pub const H4DISC: ::c_int = 0x7;
|
||||
|
||||
pub const JAIL_API_VERSION: u32 = 2;
|
||||
pub const JAIL_CREATE: ::c_int = 0x01;
|
||||
pub const JAIL_UPDATE: ::c_int = 0x02;
|
||||
pub const JAIL_ATTACH: ::c_int = 0x04;
|
||||
pub const JAIL_DYING: ::c_int = 0x08;
|
||||
pub const JAIL_SET_MASK: ::c_int = 0x0f;
|
||||
pub const JAIL_GET_MASK: ::c_int = 0x08;
|
||||
pub const JAIL_SYS_DISABLE: ::c_int = 0;
|
||||
pub const JAIL_SYS_NEW: ::c_int = 1;
|
||||
pub const JAIL_SYS_INHERIT: ::c_int = 2;
|
||||
|
||||
pub const SO_BINTIME: ::c_int = 0x2000;
|
||||
pub const SO_NO_OFFLOAD: ::c_int = 0x4000;
|
||||
pub const SO_NO_DDP: ::c_int = 0x8000;
|
||||
pub const SO_LABEL: ::c_int = 0x1009;
|
||||
pub const SO_PEERLABEL: ::c_int = 0x1010;
|
||||
pub const SO_LISTENQLIMIT: ::c_int = 0x1011;
|
||||
pub const SO_LISTENQLEN: ::c_int = 0x1012;
|
||||
pub const SO_LISTENINCQLEN: ::c_int = 0x1013;
|
||||
pub const SO_SETFIB: ::c_int = 0x1014;
|
||||
pub const SO_USER_COOKIE: ::c_int = 0x1015;
|
||||
pub const SO_PROTOCOL: ::c_int = 0x1016;
|
||||
pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
|
||||
pub const SO_VENDOR: ::c_int = 0x80000000;
|
||||
|
||||
pub const AF_SLOW: ::c_int = 33;
|
||||
pub const AF_SCLUSTER: ::c_int = 34;
|
||||
pub const AF_ARP: ::c_int = 35;
|
||||
pub const AF_BLUETOOTH: ::c_int = 36;
|
||||
pub const AF_IEEE80211: ::c_int = 37;
|
||||
pub const AF_INET_SDP: ::c_int = 40;
|
||||
pub const AF_INET6_SDP: ::c_int = 42;
|
||||
#[doc(hidden)]
|
||||
pub const AF_MAX: ::c_int = 42;
|
||||
|
||||
pub const IPPROTO_DIVERT: ::c_int = 258;
|
||||
|
||||
pub const PF_SLOW: ::c_int = AF_SLOW;
|
||||
pub const PF_SCLUSTER: ::c_int = AF_SCLUSTER;
|
||||
pub const PF_ARP: ::c_int = AF_ARP;
|
||||
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
|
||||
pub const PF_IEEE80211: ::c_int = AF_IEEE80211;
|
||||
pub const PF_INET_SDP: ::c_int = AF_INET_SDP;
|
||||
pub const PF_INET6_SDP: ::c_int = AF_INET6_SDP;
|
||||
#[doc(hidden)]
|
||||
pub const PF_MAX: ::c_int = AF_MAX;
|
||||
|
||||
pub const NET_RT_DUMP: ::c_int = 1;
|
||||
pub const NET_RT_FLAGS: ::c_int = 2;
|
||||
pub const NET_RT_IFLIST: ::c_int = 3;
|
||||
pub const NET_RT_IFMALIST: ::c_int = 4;
|
||||
pub const NET_RT_IFLISTL: ::c_int = 5;
|
||||
|
||||
// System V IPC
|
||||
pub const IPC_PRIVATE: ::key_t = 0;
|
||||
pub const IPC_CREAT: ::c_int = 0o1000;
|
||||
pub const IPC_EXCL: ::c_int = 0o2000;
|
||||
pub const IPC_NOWAIT: ::c_int = 0o4000;
|
||||
pub const IPC_RMID: ::c_int = 0;
|
||||
pub const IPC_SET: ::c_int = 1;
|
||||
pub const IPC_STAT: ::c_int = 2;
|
||||
pub const IPC_INFO: ::c_int = 3;
|
||||
pub const IPC_R : ::c_int = 0o400;
|
||||
pub const IPC_W : ::c_int = 0o200;
|
||||
pub const IPC_M : ::c_int = 0o10000;
|
||||
pub const MSG_NOERROR: ::c_int = 0o10000;
|
||||
pub const SHM_RDONLY: ::c_int = 0o10000;
|
||||
pub const SHM_RND: ::c_int = 0o20000;
|
||||
pub const SHM_R: ::c_int = 0o400;
|
||||
pub const SHM_W: ::c_int = 0o200;
|
||||
pub const SHM_LOCK: ::c_int = 11;
|
||||
pub const SHM_UNLOCK: ::c_int = 12;
|
||||
pub const SHM_STAT: ::c_int = 13;
|
||||
pub const SHM_INFO: ::c_int = 14;
|
||||
|
||||
// The *_MAXID constants never should've been used outside of the
|
||||
// FreeBSD base system. And with the exception of CTL_P1003_1B_MAXID,
|
||||
// they were all removed in svn r262489. They remain here for backwards
|
||||
// compatibility only, and are scheduled to be removed in libc 1.0.0.
|
||||
#[doc(hidden)]
|
||||
pub const NET_MAXID: ::c_int = AF_MAX;
|
||||
#[doc(hidden)]
|
||||
pub const CTL_MAXID: ::c_int = 10;
|
||||
#[doc(hidden)]
|
||||
pub const KERN_MAXID: ::c_int = 38;
|
||||
#[doc(hidden)]
|
||||
pub const HW_MAXID: ::c_int = 13;
|
||||
#[doc(hidden)]
|
||||
pub const USER_MAXID: ::c_int = 21;
|
||||
#[doc(hidden)]
|
||||
pub const CTL_P1003_1B_MAXID: ::c_int = 26;
|
||||
|
||||
pub const MSG_NOTIFICATION: ::c_int = 0x00002000;
|
||||
pub const MSG_NBIO: ::c_int = 0x00004000;
|
||||
pub const MSG_COMPAT: ::c_int = 0x00008000;
|
||||
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00040000;
|
||||
pub const MSG_NOSIGNAL: ::c_int = 0x20000;
|
||||
|
||||
pub const EMPTY: ::c_short = 0;
|
||||
pub const BOOT_TIME: ::c_short = 1;
|
||||
pub const OLD_TIME: ::c_short = 2;
|
||||
pub const NEW_TIME: ::c_short = 3;
|
||||
pub const USER_PROCESS: ::c_short = 4;
|
||||
pub const INIT_PROCESS: ::c_short = 5;
|
||||
pub const LOGIN_PROCESS: ::c_short = 6;
|
||||
pub const DEAD_PROCESS: ::c_short = 7;
|
||||
pub const SHUTDOWN_TIME: ::c_short = 8;
|
||||
|
||||
pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
|
||||
pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
|
||||
pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
|
||||
pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
|
||||
pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
|
||||
pub const LC_TIME_MASK: ::c_int = (1 << 5);
|
||||
pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
|
||||
| LC_CTYPE_MASK
|
||||
| LC_MESSAGES_MASK
|
||||
| LC_MONETARY_MASK
|
||||
| LC_NUMERIC_MASK
|
||||
| LC_TIME_MASK;
|
||||
|
||||
pub const WSTOPPED: ::c_int = 2; // same as WUNTRACED
|
||||
pub const WCONTINUED: ::c_int = 4;
|
||||
pub const WNOWAIT: ::c_int = 8;
|
||||
pub const WEXITED: ::c_int = 16;
|
||||
pub const WTRAPPED: ::c_int = 32;
|
||||
|
||||
// FreeBSD defines a great many more of these, we only expose the
|
||||
// standardized ones.
|
||||
pub const P_PID: idtype_t = 0;
|
||||
pub const P_PGID: idtype_t = 2;
|
||||
pub const P_ALL: idtype_t = 7;
|
||||
|
||||
pub const B460800: ::speed_t = 460800;
|
||||
pub const B921600: ::speed_t = 921600;
|
||||
|
||||
pub const AT_FDCWD: ::c_int = -100;
|
||||
pub const AT_EACCESS: ::c_int = 0x100;
|
||||
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
|
||||
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
|
||||
pub const AT_REMOVEDIR: ::c_int = 0x800;
|
||||
|
||||
pub const TABDLY: ::tcflag_t = 0x00000004;
|
||||
pub const TAB0: ::tcflag_t = 0x00000000;
|
||||
pub const TAB3: ::tcflag_t = 0x00000004;
|
||||
|
||||
pub const _PC_ACL_NFS4: ::c_int = 64;
|
||||
|
||||
pub const _SC_CPUSET_SIZE: ::c_int = 122;
|
||||
|
||||
extern {
|
||||
pub fn __error() -> *mut ::c_int;
|
||||
|
||||
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
|
||||
-> ::c_int;
|
||||
|
||||
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
|
||||
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
|
||||
pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
|
||||
|
||||
pub fn jail(jail: *mut ::jail) -> ::c_int;
|
||||
pub fn jail_attach(jid: ::c_int) -> ::c_int;
|
||||
pub fn jail_remove(jid: ::c_int) -> ::c_int;
|
||||
pub fn jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int)
|
||||
-> ::c_int;
|
||||
pub fn jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int)
|
||||
-> ::c_int;
|
||||
|
||||
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
|
||||
len: ::off_t) -> ::c_int;
|
||||
pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
|
||||
advise: ::c_int) -> ::c_int;
|
||||
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
|
||||
pub fn mkostemps(template: *mut ::c_char,
|
||||
suffixlen: ::c_int,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn getutxuser(user: *const ::c_char) -> *mut utmpx;
|
||||
pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int;
|
||||
|
||||
pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
|
||||
timeout: *mut ::timespec) -> ::ssize_t;
|
||||
|
||||
pub fn freelocale(loc: ::locale_t) -> ::c_int;
|
||||
pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t,
|
||||
options: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
|
||||
pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
|
||||
pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void,
|
||||
shmflg: ::c_int) -> *mut ::c_void;
|
||||
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
|
||||
pub fn shmctl(shmid: ::c_int, cmd: ::c_int,
|
||||
buf: *mut ::shmid_ds) -> ::c_int;
|
||||
pub fn msgctl(msqid: ::c_int, cmd: ::c_int,
|
||||
buf: *mut ::msqid_ds) -> ::c_int;
|
||||
pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
|
||||
pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
|
||||
msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int;
|
||||
pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
|
||||
msgflg: ::c_int) -> ::c_int;
|
||||
pub fn cfmakesane(termios: *mut ::termios);
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_arch = "x86")] {
|
||||
mod x86;
|
||||
pub use self::x86::*;
|
||||
} else if #[cfg(target_arch = "x86_64")] {
|
||||
mod x86_64;
|
||||
pub use self::x86_64::*;
|
||||
} else if #[cfg(target_arch = "aarch64")] {
|
||||
mod aarch64;
|
||||
pub use self::aarch64::*;
|
||||
} else {
|
||||
// Unknown target_arch
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
||||
pub type time_t = i32;
|
||||
pub type suseconds_t = i32;
|
||||
|
||||
s! {
|
||||
pub struct stat {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_mode: ::mode_t,
|
||||
pub st_nlink: ::nlink_t,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
pub st_atime: ::time_t,
|
||||
pub st_atime_nsec: ::c_long,
|
||||
pub st_mtime: ::time_t,
|
||||
pub st_mtime_nsec: ::c_long,
|
||||
pub st_ctime: ::time_t,
|
||||
pub st_ctime_nsec: ::c_long,
|
||||
pub st_size: ::off_t,
|
||||
pub st_blocks: ::blkcnt_t,
|
||||
pub st_blksize: ::blksize_t,
|
||||
pub st_flags: ::fflags_t,
|
||||
pub st_gen: ::uint32_t,
|
||||
pub st_lspare: ::int32_t,
|
||||
pub st_birthtime: ::time_t,
|
||||
pub st_birthtime_nsec: ::c_long,
|
||||
__unused: [u8; 8],
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
pub type c_long = i64;
|
||||
pub type c_ulong = u64;
|
||||
pub type time_t = i64;
|
||||
pub type suseconds_t = i64;
|
||||
|
||||
s! {
|
||||
pub struct stat {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_mode: ::mode_t,
|
||||
pub st_nlink: ::nlink_t,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
pub st_atime: ::time_t,
|
||||
pub st_atime_nsec: ::c_long,
|
||||
pub st_mtime: ::time_t,
|
||||
pub st_mtime_nsec: ::c_long,
|
||||
pub st_ctime: ::time_t,
|
||||
pub st_ctime_nsec: ::c_long,
|
||||
pub st_size: ::off_t,
|
||||
pub st_blocks: ::blkcnt_t,
|
||||
pub st_blksize: ::blksize_t,
|
||||
pub st_flags: ::fflags_t,
|
||||
pub st_gen: ::uint32_t,
|
||||
pub st_lspare: ::int32_t,
|
||||
pub st_birthtime: ::time_t,
|
||||
pub st_birthtime_nsec: ::c_long,
|
||||
}
|
||||
}
|
||||
|
||||
pub const MAP_32BIT: ::c_int = 0x00080000;
|
File diff suppressed because it is too large
Load Diff
535
third_party/rust/libc-0.2.30/src/unix/bsd/mod.rs
vendored
535
third_party/rust/libc-0.2.30/src/unix/bsd/mod.rs
vendored
@ -1,535 +0,0 @@
|
||||
use dox::{mem, Option};
|
||||
|
||||
pub type c_char = i8;
|
||||
pub type wchar_t = i32;
|
||||
pub type off_t = i64;
|
||||
pub type useconds_t = u32;
|
||||
pub type blkcnt_t = i64;
|
||||
pub type socklen_t = u32;
|
||||
pub type sa_family_t = u8;
|
||||
pub type pthread_t = ::uintptr_t;
|
||||
pub type nfds_t = ::c_uint;
|
||||
|
||||
s! {
|
||||
pub struct sockaddr {
|
||||
pub sa_len: u8,
|
||||
pub sa_family: sa_family_t,
|
||||
pub sa_data: [::c_char; 14],
|
||||
}
|
||||
|
||||
pub struct sockaddr_in6 {
|
||||
pub sin6_len: u8,
|
||||
pub sin6_family: sa_family_t,
|
||||
pub sin6_port: ::in_port_t,
|
||||
pub sin6_flowinfo: u32,
|
||||
pub sin6_addr: ::in6_addr,
|
||||
pub sin6_scope_id: u32,
|
||||
}
|
||||
|
||||
pub struct sockaddr_un {
|
||||
pub sun_len: u8,
|
||||
pub sun_family: sa_family_t,
|
||||
pub sun_path: [c_char; 104]
|
||||
}
|
||||
|
||||
pub struct passwd {
|
||||
pub pw_name: *mut ::c_char,
|
||||
pub pw_passwd: *mut ::c_char,
|
||||
pub pw_uid: ::uid_t,
|
||||
pub pw_gid: ::gid_t,
|
||||
pub pw_change: ::time_t,
|
||||
pub pw_class: *mut ::c_char,
|
||||
pub pw_gecos: *mut ::c_char,
|
||||
pub pw_dir: *mut ::c_char,
|
||||
pub pw_shell: *mut ::c_char,
|
||||
pub pw_expire: ::time_t,
|
||||
|
||||
#[cfg(not(any(target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd")))]
|
||||
pub pw_fields: ::c_int,
|
||||
}
|
||||
|
||||
pub struct ifaddrs {
|
||||
pub ifa_next: *mut ifaddrs,
|
||||
pub ifa_name: *mut ::c_char,
|
||||
pub ifa_flags: ::c_uint,
|
||||
pub ifa_addr: *mut ::sockaddr,
|
||||
pub ifa_netmask: *mut ::sockaddr,
|
||||
pub ifa_dstaddr: *mut ::sockaddr,
|
||||
pub ifa_data: *mut ::c_void
|
||||
}
|
||||
|
||||
pub struct fd_set {
|
||||
#[cfg(all(target_pointer_width = "64",
|
||||
any(target_os = "freebsd", target_os = "dragonfly")))]
|
||||
fds_bits: [i64; FD_SETSIZE / 64],
|
||||
#[cfg(not(all(target_pointer_width = "64",
|
||||
any(target_os = "freebsd", target_os = "dragonfly"))))]
|
||||
fds_bits: [i32; FD_SETSIZE / 32],
|
||||
}
|
||||
|
||||
pub struct tm {
|
||||
pub tm_sec: ::c_int,
|
||||
pub tm_min: ::c_int,
|
||||
pub tm_hour: ::c_int,
|
||||
pub tm_mday: ::c_int,
|
||||
pub tm_mon: ::c_int,
|
||||
pub tm_year: ::c_int,
|
||||
pub tm_wday: ::c_int,
|
||||
pub tm_yday: ::c_int,
|
||||
pub tm_isdst: ::c_int,
|
||||
pub tm_gmtoff: ::c_long,
|
||||
pub tm_zone: *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct utsname {
|
||||
#[cfg(not(target_os = "dragonfly"))]
|
||||
pub sysname: [::c_char; 256],
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub sysname: [::c_char; 32],
|
||||
#[cfg(not(target_os = "dragonfly"))]
|
||||
pub nodename: [::c_char; 256],
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub nodename: [::c_char; 32],
|
||||
#[cfg(not(target_os = "dragonfly"))]
|
||||
pub release: [::c_char; 256],
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub release: [::c_char; 32],
|
||||
#[cfg(not(target_os = "dragonfly"))]
|
||||
pub version: [::c_char; 256],
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub version: [::c_char; 32],
|
||||
#[cfg(not(target_os = "dragonfly"))]
|
||||
pub machine: [::c_char; 256],
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub machine: [::c_char; 32],
|
||||
}
|
||||
|
||||
pub struct msghdr {
|
||||
pub msg_name: *mut ::c_void,
|
||||
pub msg_namelen: ::socklen_t,
|
||||
pub msg_iov: *mut ::iovec,
|
||||
pub msg_iovlen: ::c_int,
|
||||
pub msg_control: *mut ::c_void,
|
||||
pub msg_controllen: ::socklen_t,
|
||||
pub msg_flags: ::c_int,
|
||||
}
|
||||
|
||||
pub struct cmsghdr {
|
||||
pub cmsg_len: ::socklen_t,
|
||||
pub cmsg_level: ::c_int,
|
||||
pub cmsg_type: ::c_int,
|
||||
}
|
||||
|
||||
pub struct fsid_t {
|
||||
__fsid_val: [::int32_t; 2],
|
||||
}
|
||||
|
||||
pub struct if_nameindex {
|
||||
pub if_index: ::c_uint,
|
||||
pub if_name: *mut ::c_char,
|
||||
}
|
||||
}
|
||||
|
||||
pub const LC_ALL: ::c_int = 0;
|
||||
pub const LC_COLLATE: ::c_int = 1;
|
||||
pub const LC_CTYPE: ::c_int = 2;
|
||||
pub const LC_MONETARY: ::c_int = 3;
|
||||
pub const LC_NUMERIC: ::c_int = 4;
|
||||
pub const LC_TIME: ::c_int = 5;
|
||||
pub const LC_MESSAGES: ::c_int = 6;
|
||||
|
||||
pub const FIOCLEX: ::c_ulong = 0x20006601;
|
||||
pub const FIONBIO: ::c_ulong = 0x8004667e;
|
||||
|
||||
pub const PATH_MAX: ::c_int = 1024;
|
||||
|
||||
pub const SA_ONSTACK: ::c_int = 0x0001;
|
||||
pub const SA_SIGINFO: ::c_int = 0x0040;
|
||||
pub const SA_RESTART: ::c_int = 0x0002;
|
||||
pub const SA_RESETHAND: ::c_int = 0x0004;
|
||||
pub const SA_NOCLDSTOP: ::c_int = 0x0008;
|
||||
pub const SA_NODEFER: ::c_int = 0x0010;
|
||||
pub const SA_NOCLDWAIT: ::c_int = 0x0020;
|
||||
|
||||
pub const SS_ONSTACK: ::c_int = 1;
|
||||
pub const SS_DISABLE: ::c_int = 4;
|
||||
|
||||
pub const SIGCHLD: ::c_int = 20;
|
||||
pub const SIGBUS: ::c_int = 10;
|
||||
pub const SIGUSR1: ::c_int = 30;
|
||||
pub const SIGUSR2: ::c_int = 31;
|
||||
pub const SIGCONT: ::c_int = 19;
|
||||
pub const SIGSTOP: ::c_int = 17;
|
||||
pub const SIGTSTP: ::c_int = 18;
|
||||
pub const SIGURG: ::c_int = 16;
|
||||
pub const SIGIO: ::c_int = 23;
|
||||
pub const SIGSYS: ::c_int = 12;
|
||||
pub const SIGTTIN: ::c_int = 21;
|
||||
pub const SIGTTOU: ::c_int = 22;
|
||||
pub const SIGXCPU: ::c_int = 24;
|
||||
pub const SIGXFSZ: ::c_int = 25;
|
||||
pub const SIGVTALRM: ::c_int = 26;
|
||||
pub const SIGPROF: ::c_int = 27;
|
||||
pub const SIGWINCH: ::c_int = 28;
|
||||
pub const SIGINFO: ::c_int = 29;
|
||||
|
||||
pub const SIG_SETMASK: ::c_int = 3;
|
||||
pub const SIG_BLOCK: ::c_int = 0x1;
|
||||
pub const SIG_UNBLOCK: ::c_int = 0x2;
|
||||
|
||||
pub const IP_MULTICAST_IF: ::c_int = 9;
|
||||
pub const IP_MULTICAST_TTL: ::c_int = 10;
|
||||
pub const IP_MULTICAST_LOOP: ::c_int = 11;
|
||||
|
||||
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
|
||||
pub const IPV6_V6ONLY: ::c_int = 27;
|
||||
|
||||
pub const ST_RDONLY: ::c_ulong = 1;
|
||||
|
||||
pub const SCM_RIGHTS: ::c_int = 0x01;
|
||||
|
||||
pub const NCCS: usize = 20;
|
||||
|
||||
pub const O_ACCMODE: ::c_int = 0x3;
|
||||
pub const O_RDONLY: ::c_int = 0;
|
||||
pub const O_WRONLY: ::c_int = 1;
|
||||
pub const O_RDWR: ::c_int = 2;
|
||||
pub const O_APPEND: ::c_int = 8;
|
||||
pub const O_CREAT: ::c_int = 512;
|
||||
pub const O_TRUNC: ::c_int = 1024;
|
||||
pub const O_EXCL: ::c_int = 2048;
|
||||
pub const O_ASYNC: ::c_int = 0x40;
|
||||
pub const O_SYNC: ::c_int = 0x80;
|
||||
pub const O_NONBLOCK: ::c_int = 0x4;
|
||||
pub const O_NOFOLLOW: ::c_int = 0x100;
|
||||
pub const O_SHLOCK: ::c_int = 0x10;
|
||||
pub const O_EXLOCK: ::c_int = 0x20;
|
||||
pub const O_FSYNC: ::c_int = O_SYNC;
|
||||
pub const O_NDELAY: ::c_int = O_NONBLOCK;
|
||||
|
||||
pub const F_GETOWN: ::c_int = 5;
|
||||
pub const F_SETOWN: ::c_int = 6;
|
||||
|
||||
pub const MNT_FORCE: ::c_int = 0x80000;
|
||||
|
||||
pub const Q_SYNC: ::c_int = 0x600;
|
||||
pub const Q_QUOTAON: ::c_int = 0x100;
|
||||
pub const Q_QUOTAOFF: ::c_int = 0x200;
|
||||
|
||||
pub const TCIOFF: ::c_int = 3;
|
||||
pub const TCION: ::c_int = 4;
|
||||
pub const TCOOFF: ::c_int = 1;
|
||||
pub const TCOON: ::c_int = 2;
|
||||
pub const TCIFLUSH: ::c_int = 1;
|
||||
pub const TCOFLUSH: ::c_int = 2;
|
||||
pub const TCIOFLUSH: ::c_int = 3;
|
||||
pub const TCSANOW: ::c_int = 0;
|
||||
pub const TCSADRAIN: ::c_int = 1;
|
||||
pub const TCSAFLUSH: ::c_int = 2;
|
||||
pub const VEOF: usize = 0;
|
||||
pub const VEOL: usize = 1;
|
||||
pub const VEOL2: usize = 2;
|
||||
pub const VERASE: usize = 3;
|
||||
pub const VWERASE: usize = 4;
|
||||
pub const VKILL: usize = 5;
|
||||
pub const VREPRINT: usize = 6;
|
||||
pub const VINTR: usize = 8;
|
||||
pub const VQUIT: usize = 9;
|
||||
pub const VSUSP: usize = 10;
|
||||
pub const VDSUSP: usize = 11;
|
||||
pub const VSTART: usize = 12;
|
||||
pub const VSTOP: usize = 13;
|
||||
pub const VLNEXT: usize = 14;
|
||||
pub const VDISCARD: usize = 15;
|
||||
pub const VMIN: usize = 16;
|
||||
pub const VTIME: usize = 17;
|
||||
pub const VSTATUS: usize = 18;
|
||||
pub const _POSIX_VDISABLE: ::cc_t = 0xff;
|
||||
pub const IGNBRK: ::tcflag_t = 0x00000001;
|
||||
pub const BRKINT: ::tcflag_t = 0x00000002;
|
||||
pub const IGNPAR: ::tcflag_t = 0x00000004;
|
||||
pub const PARMRK: ::tcflag_t = 0x00000008;
|
||||
pub const INPCK: ::tcflag_t = 0x00000010;
|
||||
pub const ISTRIP: ::tcflag_t = 0x00000020;
|
||||
pub const INLCR: ::tcflag_t = 0x00000040;
|
||||
pub const IGNCR: ::tcflag_t = 0x00000080;
|
||||
pub const ICRNL: ::tcflag_t = 0x00000100;
|
||||
pub const IXON: ::tcflag_t = 0x00000200;
|
||||
pub const IXOFF: ::tcflag_t = 0x00000400;
|
||||
pub const IXANY: ::tcflag_t = 0x00000800;
|
||||
pub const IMAXBEL: ::tcflag_t = 0x00002000;
|
||||
pub const OPOST: ::tcflag_t = 0x1;
|
||||
pub const ONLCR: ::tcflag_t = 0x2;
|
||||
pub const OXTABS: ::tcflag_t = 0x4;
|
||||
pub const ONOEOT: ::tcflag_t = 0x8;
|
||||
pub const CIGNORE: ::tcflag_t = 0x00000001;
|
||||
pub const CSIZE: ::tcflag_t = 0x00000300;
|
||||
pub const CS5: ::tcflag_t = 0x00000000;
|
||||
pub const CS6: ::tcflag_t = 0x00000100;
|
||||
pub const CS7: ::tcflag_t = 0x00000200;
|
||||
pub const CS8: ::tcflag_t = 0x00000300;
|
||||
pub const CSTOPB: ::tcflag_t = 0x00000400;
|
||||
pub const CREAD: ::tcflag_t = 0x00000800;
|
||||
pub const PARENB: ::tcflag_t = 0x00001000;
|
||||
pub const PARODD: ::tcflag_t = 0x00002000;
|
||||
pub const HUPCL: ::tcflag_t = 0x00004000;
|
||||
pub const CLOCAL: ::tcflag_t = 0x00008000;
|
||||
pub const ECHOKE: ::tcflag_t = 0x00000001;
|
||||
pub const ECHOE: ::tcflag_t = 0x00000002;
|
||||
pub const ECHOK: ::tcflag_t = 0x00000004;
|
||||
pub const ECHO: ::tcflag_t = 0x00000008;
|
||||
pub const ECHONL: ::tcflag_t = 0x00000010;
|
||||
pub const ECHOPRT: ::tcflag_t = 0x00000020;
|
||||
pub const ECHOCTL: ::tcflag_t = 0x00000040;
|
||||
pub const ISIG: ::tcflag_t = 0x00000080;
|
||||
pub const ICANON: ::tcflag_t = 0x00000100;
|
||||
pub const ALTWERASE: ::tcflag_t = 0x00000200;
|
||||
pub const IEXTEN: ::tcflag_t = 0x00000400;
|
||||
pub const EXTPROC: ::tcflag_t = 0x00000800;
|
||||
pub const TOSTOP: ::tcflag_t = 0x00400000;
|
||||
pub const FLUSHO: ::tcflag_t = 0x00800000;
|
||||
pub const NOKERNINFO: ::tcflag_t = 0x02000000;
|
||||
pub const PENDIN: ::tcflag_t = 0x20000000;
|
||||
pub const NOFLSH: ::tcflag_t = 0x80000000;
|
||||
pub const MDMBUF: ::tcflag_t = 0x00100000;
|
||||
|
||||
pub const WNOHANG: ::c_int = 0x00000001;
|
||||
pub const WUNTRACED: ::c_int = 0x00000002;
|
||||
|
||||
pub const RTLD_NOW: ::c_int = 0x2;
|
||||
pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void;
|
||||
pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
|
||||
pub const RTLD_SELF: *mut ::c_void = -3isize as *mut ::c_void;
|
||||
|
||||
pub const LOG_CRON: ::c_int = 9 << 3;
|
||||
pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
|
||||
pub const LOG_FTP: ::c_int = 11 << 3;
|
||||
pub const LOG_PERROR: ::c_int = 0x20;
|
||||
|
||||
pub const TCP_MAXSEG: ::c_int = 2;
|
||||
|
||||
pub const PIPE_BUF: usize = 512;
|
||||
|
||||
pub const POLLRDNORM: ::c_short = 0x040;
|
||||
pub const POLLWRNORM: ::c_short = 0x004;
|
||||
pub const POLLRDBAND: ::c_short = 0x080;
|
||||
pub const POLLWRBAND: ::c_short = 0x100;
|
||||
|
||||
f! {
|
||||
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
|
||||
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
let fd = fd as usize;
|
||||
(*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
|
||||
return
|
||||
}
|
||||
|
||||
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
|
||||
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
let fd = fd as usize;
|
||||
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0
|
||||
}
|
||||
|
||||
pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
|
||||
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
let fd = fd as usize;
|
||||
(*set).fds_bits[fd / bits] |= 1 << (fd % bits);
|
||||
return
|
||||
}
|
||||
|
||||
pub fn FD_ZERO(set: *mut fd_set) -> () {
|
||||
for slot in (*set).fds_bits.iter_mut() {
|
||||
*slot = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn WTERMSIG(status: ::c_int) -> ::c_int {
|
||||
status & 0o177
|
||||
}
|
||||
|
||||
pub fn WIFEXITED(status: ::c_int) -> bool {
|
||||
(status & 0o177) == 0
|
||||
}
|
||||
|
||||
pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
|
||||
status >> 8
|
||||
}
|
||||
|
||||
pub fn WCOREDUMP(status: ::c_int) -> bool {
|
||||
(status & 0o200) != 0
|
||||
}
|
||||
}
|
||||
|
||||
extern {
|
||||
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
|
||||
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
|
||||
pub fn setgroups(ngroups: ::c_int,
|
||||
ptr: *const ::gid_t) -> ::c_int;
|
||||
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
|
||||
pub fn kqueue() -> ::c_int;
|
||||
pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;
|
||||
pub fn syscall(num: ::c_int, ...) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")]
|
||||
pub fn getpwent() -> *mut passwd;
|
||||
pub fn setpwent();
|
||||
pub fn endpwent();
|
||||
pub fn getprogname() -> *const ::c_char;
|
||||
pub fn setprogname(name: *const ::c_char);
|
||||
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
|
||||
pub fn if_nameindex() -> *mut if_nameindex;
|
||||
pub fn if_freenameindex(ptr: *mut if_nameindex);
|
||||
|
||||
pub fn getpeereid(socket: ::c_int,
|
||||
euid: *mut ::uid_t,
|
||||
egid: *mut ::gid_t) -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
|
||||
pub fn glob(pattern: *const ::c_char,
|
||||
flags: ::c_int,
|
||||
errfunc: Option<extern fn(epath: *const ::c_char,
|
||||
errno: ::c_int) -> ::c_int>,
|
||||
pglob: *mut ::glob_t) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__globfree30")]
|
||||
pub fn globfree(pglob: *mut ::glob_t);
|
||||
|
||||
pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
|
||||
-> ::c_int;
|
||||
|
||||
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "seekdir$INODE64")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "seekdir$INODE64$UNIX2003")]
|
||||
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "telldir$INODE64")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "telldir$INODE64$UNIX2003")]
|
||||
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
|
||||
pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
|
||||
-> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "msync$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__msync13")]
|
||||
pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "recvfrom$UNIX2003")]
|
||||
pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
|
||||
flags: ::c_int, addr: *mut ::sockaddr,
|
||||
addrlen: *mut ::socklen_t) -> ::ssize_t;
|
||||
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
|
||||
pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
|
||||
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "bind$UNIX2003")]
|
||||
pub fn bind(socket: ::c_int, address: *const ::sockaddr,
|
||||
address_len: ::socklen_t) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "writev$UNIX2003")]
|
||||
pub fn writev(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int) -> ::ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "readv$UNIX2003")]
|
||||
pub fn readv(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int) -> ::ssize_t;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sendmsg$UNIX2003")]
|
||||
pub fn sendmsg(fd: ::c_int,
|
||||
msg: *const ::msghdr,
|
||||
flags: ::c_int) -> ::ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "recvmsg$UNIX2003")]
|
||||
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
|
||||
-> ::ssize_t;
|
||||
|
||||
pub fn sync();
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
|
||||
pub fn getgrgid_r(uid: ::uid_t,
|
||||
grp: *mut ::group,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut ::group) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sigaltstack$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
|
||||
pub fn sigaltstack(ss: *const stack_t,
|
||||
oss: *mut stack_t) -> ::c_int;
|
||||
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
|
||||
pub fn getdtablesize() -> ::c_int;
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
|
||||
pub fn getgrnam_r(name: *const ::c_char,
|
||||
grp: *mut ::group,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut ::group) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_sigmask$UNIX2003")]
|
||||
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
|
||||
oldset: *mut sigset_t) -> ::c_int;
|
||||
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
|
||||
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
|
||||
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
|
||||
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
|
||||
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
|
||||
pub fn getpwnam_r(name: *const ::c_char,
|
||||
pwd: *mut passwd,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut passwd) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
|
||||
pub fn getpwuid_r(uid: ::uid_t,
|
||||
pwd: *mut passwd,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut passwd) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch ="x86"),
|
||||
link_name = "sigwait$UNIX2003")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
|
||||
pub fn sigwait(set: *const sigset_t,
|
||||
sig: *mut ::c_int) -> ::c_int;
|
||||
pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
|
||||
parent: Option<unsafe extern fn()>,
|
||||
child: Option<unsafe extern fn()>) -> ::c_int;
|
||||
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "popen$UNIX2003")]
|
||||
pub fn popen(command: *const c_char,
|
||||
mode: *const c_char) -> *mut ::FILE;
|
||||
pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
mode: ::c_int, flags: ::c_int) -> ::c_int;
|
||||
pub fn pthread_create(native: *mut ::pthread_t,
|
||||
attr: *const ::pthread_attr_t,
|
||||
f: extern fn(*mut ::c_void) -> *mut ::c_void,
|
||||
value: *mut ::c_void) -> ::c_int;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(any(target_os = "macos", target_os = "ios"))] {
|
||||
mod apple;
|
||||
pub use self::apple::*;
|
||||
} else if #[cfg(any(target_os = "openbsd", target_os = "netbsd",
|
||||
target_os = "bitrig"))] {
|
||||
mod netbsdlike;
|
||||
pub use self::netbsdlike::*;
|
||||
} else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] {
|
||||
mod freebsdlike;
|
||||
pub use self::freebsdlike::*;
|
||||
} else {
|
||||
// Unknown target_os
|
||||
}
|
||||
}
|
@ -1,640 +0,0 @@
|
||||
pub type time_t = i64;
|
||||
pub type mode_t = u32;
|
||||
pub type nlink_t = ::uint32_t;
|
||||
pub type ino_t = ::uint64_t;
|
||||
pub type pthread_key_t = ::c_int;
|
||||
pub type rlim_t = u64;
|
||||
pub type speed_t = ::c_uint;
|
||||
pub type tcflag_t = ::c_uint;
|
||||
pub type nl_item = c_long;
|
||||
pub type clockid_t = ::c_int;
|
||||
pub type id_t = ::uint32_t;
|
||||
pub type sem_t = *mut sem;
|
||||
|
||||
pub enum timezone {}
|
||||
pub enum sem {}
|
||||
|
||||
s! {
|
||||
pub struct sigaction {
|
||||
pub sa_sigaction: ::sighandler_t,
|
||||
pub sa_mask: ::sigset_t,
|
||||
pub sa_flags: ::c_int,
|
||||
}
|
||||
|
||||
pub struct stack_t {
|
||||
pub ss_sp: *mut ::c_void,
|
||||
pub ss_size: ::size_t,
|
||||
pub ss_flags: ::c_int,
|
||||
}
|
||||
|
||||
pub struct sockaddr_in {
|
||||
pub sin_len: u8,
|
||||
pub sin_family: ::sa_family_t,
|
||||
pub sin_port: ::in_port_t,
|
||||
pub sin_addr: ::in_addr,
|
||||
pub sin_zero: [::int8_t; 8],
|
||||
}
|
||||
|
||||
pub struct termios {
|
||||
pub c_iflag: ::tcflag_t,
|
||||
pub c_oflag: ::tcflag_t,
|
||||
pub c_cflag: ::tcflag_t,
|
||||
pub c_lflag: ::tcflag_t,
|
||||
pub c_cc: [::cc_t; ::NCCS],
|
||||
pub c_ispeed: ::c_int,
|
||||
pub c_ospeed: ::c_int,
|
||||
}
|
||||
|
||||
pub struct flock {
|
||||
pub l_start: ::off_t,
|
||||
pub l_len: ::off_t,
|
||||
pub l_pid: ::pid_t,
|
||||
pub l_type: ::c_short,
|
||||
pub l_whence: ::c_short,
|
||||
}
|
||||
}
|
||||
|
||||
pub const D_T_FMT: ::nl_item = 0;
|
||||
pub const D_FMT: ::nl_item = 1;
|
||||
pub const T_FMT: ::nl_item = 2;
|
||||
pub const T_FMT_AMPM: ::nl_item = 3;
|
||||
pub const AM_STR: ::nl_item = 4;
|
||||
pub const PM_STR: ::nl_item = 5;
|
||||
|
||||
pub const DAY_1: ::nl_item = 6;
|
||||
pub const DAY_2: ::nl_item = 7;
|
||||
pub const DAY_3: ::nl_item = 8;
|
||||
pub const DAY_4: ::nl_item = 9;
|
||||
pub const DAY_5: ::nl_item = 10;
|
||||
pub const DAY_6: ::nl_item = 11;
|
||||
pub const DAY_7: ::nl_item = 12;
|
||||
|
||||
pub const ABDAY_1: ::nl_item = 13;
|
||||
pub const ABDAY_2: ::nl_item = 14;
|
||||
pub const ABDAY_3: ::nl_item = 15;
|
||||
pub const ABDAY_4: ::nl_item = 16;
|
||||
pub const ABDAY_5: ::nl_item = 17;
|
||||
pub const ABDAY_6: ::nl_item = 18;
|
||||
pub const ABDAY_7: ::nl_item = 19;
|
||||
|
||||
pub const MON_1: ::nl_item = 20;
|
||||
pub const MON_2: ::nl_item = 21;
|
||||
pub const MON_3: ::nl_item = 22;
|
||||
pub const MON_4: ::nl_item = 23;
|
||||
pub const MON_5: ::nl_item = 24;
|
||||
pub const MON_6: ::nl_item = 25;
|
||||
pub const MON_7: ::nl_item = 26;
|
||||
pub const MON_8: ::nl_item = 27;
|
||||
pub const MON_9: ::nl_item = 28;
|
||||
pub const MON_10: ::nl_item = 29;
|
||||
pub const MON_11: ::nl_item = 30;
|
||||
pub const MON_12: ::nl_item = 31;
|
||||
|
||||
pub const ABMON_1: ::nl_item = 32;
|
||||
pub const ABMON_2: ::nl_item = 33;
|
||||
pub const ABMON_3: ::nl_item = 34;
|
||||
pub const ABMON_4: ::nl_item = 35;
|
||||
pub const ABMON_5: ::nl_item = 36;
|
||||
pub const ABMON_6: ::nl_item = 37;
|
||||
pub const ABMON_7: ::nl_item = 38;
|
||||
pub const ABMON_8: ::nl_item = 39;
|
||||
pub const ABMON_9: ::nl_item = 40;
|
||||
pub const ABMON_10: ::nl_item = 41;
|
||||
pub const ABMON_11: ::nl_item = 42;
|
||||
pub const ABMON_12: ::nl_item = 43;
|
||||
|
||||
pub const RADIXCHAR: ::nl_item = 44;
|
||||
pub const THOUSEP: ::nl_item = 45;
|
||||
pub const YESSTR: ::nl_item = 46;
|
||||
pub const YESEXPR: ::nl_item = 47;
|
||||
pub const NOSTR: ::nl_item = 48;
|
||||
pub const NOEXPR: ::nl_item = 49;
|
||||
pub const CRNCYSTR: ::nl_item = 50;
|
||||
|
||||
pub const CODESET: ::nl_item = 51;
|
||||
|
||||
pub const EXIT_FAILURE : ::c_int = 1;
|
||||
pub const EXIT_SUCCESS : ::c_int = 0;
|
||||
pub const RAND_MAX : ::c_int = 2147483647;
|
||||
pub const EOF : ::c_int = -1;
|
||||
pub const SEEK_SET : ::c_int = 0;
|
||||
pub const SEEK_CUR : ::c_int = 1;
|
||||
pub const SEEK_END : ::c_int = 2;
|
||||
pub const _IOFBF : ::c_int = 0;
|
||||
pub const _IONBF : ::c_int = 2;
|
||||
pub const _IOLBF : ::c_int = 1;
|
||||
pub const BUFSIZ : ::c_uint = 1024;
|
||||
pub const FOPEN_MAX : ::c_uint = 20;
|
||||
pub const FILENAME_MAX : ::c_uint = 1024;
|
||||
pub const L_tmpnam : ::c_uint = 1024;
|
||||
pub const O_NOCTTY : ::c_int = 32768;
|
||||
pub const S_IFIFO : mode_t = 4096;
|
||||
pub const S_IFCHR : mode_t = 8192;
|
||||
pub const S_IFBLK : mode_t = 24576;
|
||||
pub const S_IFDIR : mode_t = 16384;
|
||||
pub const S_IFREG : mode_t = 32768;
|
||||
pub const S_IFLNK : mode_t = 40960;
|
||||
pub const S_IFSOCK : mode_t = 49152;
|
||||
pub const S_IFMT : mode_t = 61440;
|
||||
pub const S_IEXEC : mode_t = 64;
|
||||
pub const S_IWRITE : mode_t = 128;
|
||||
pub const S_IREAD : mode_t = 256;
|
||||
pub const S_IRWXU : mode_t = 448;
|
||||
pub const S_IXUSR : mode_t = 64;
|
||||
pub const S_IWUSR : mode_t = 128;
|
||||
pub const S_IRUSR : mode_t = 256;
|
||||
pub const S_IRWXG : mode_t = 56;
|
||||
pub const S_IXGRP : mode_t = 8;
|
||||
pub const S_IWGRP : mode_t = 16;
|
||||
pub const S_IRGRP : mode_t = 32;
|
||||
pub const S_IRWXO : mode_t = 7;
|
||||
pub const S_IXOTH : mode_t = 1;
|
||||
pub const S_IWOTH : mode_t = 2;
|
||||
pub const S_IROTH : mode_t = 4;
|
||||
pub const F_OK : ::c_int = 0;
|
||||
pub const R_OK : ::c_int = 4;
|
||||
pub const W_OK : ::c_int = 2;
|
||||
pub const X_OK : ::c_int = 1;
|
||||
pub const STDIN_FILENO : ::c_int = 0;
|
||||
pub const STDOUT_FILENO : ::c_int = 1;
|
||||
pub const STDERR_FILENO : ::c_int = 2;
|
||||
pub const F_LOCK : ::c_int = 1;
|
||||
pub const F_TEST : ::c_int = 3;
|
||||
pub const F_TLOCK : ::c_int = 2;
|
||||
pub const F_ULOCK : ::c_int = 0;
|
||||
pub const F_GETLK: ::c_int = 7;
|
||||
pub const F_SETLK: ::c_int = 8;
|
||||
pub const F_SETLKW: ::c_int = 9;
|
||||
pub const SIGHUP : ::c_int = 1;
|
||||
pub const SIGINT : ::c_int = 2;
|
||||
pub const SIGQUIT : ::c_int = 3;
|
||||
pub const SIGILL : ::c_int = 4;
|
||||
pub const SIGABRT : ::c_int = 6;
|
||||
pub const SIGEMT: ::c_int = 7;
|
||||
pub const SIGFPE : ::c_int = 8;
|
||||
pub const SIGKILL : ::c_int = 9;
|
||||
pub const SIGSEGV : ::c_int = 11;
|
||||
pub const SIGPIPE : ::c_int = 13;
|
||||
pub const SIGALRM : ::c_int = 14;
|
||||
pub const SIGTERM : ::c_int = 15;
|
||||
pub const SIGSTKSZ : ::size_t = 40960;
|
||||
|
||||
pub const PROT_NONE : ::c_int = 0;
|
||||
pub const PROT_READ : ::c_int = 1;
|
||||
pub const PROT_WRITE : ::c_int = 2;
|
||||
pub const PROT_EXEC : ::c_int = 4;
|
||||
|
||||
pub const MAP_FILE : ::c_int = 0x0000;
|
||||
pub const MAP_SHARED : ::c_int = 0x0001;
|
||||
pub const MAP_PRIVATE : ::c_int = 0x0002;
|
||||
pub const MAP_FIXED : ::c_int = 0x0010;
|
||||
pub const MAP_ANON : ::c_int = 0x1000;
|
||||
|
||||
pub const MAP_FAILED : *mut ::c_void = !0 as *mut ::c_void;
|
||||
|
||||
pub const MCL_CURRENT : ::c_int = 0x0001;
|
||||
pub const MCL_FUTURE : ::c_int = 0x0002;
|
||||
|
||||
pub const MS_ASYNC : ::c_int = 0x0001;
|
||||
|
||||
pub const EPERM : ::c_int = 1;
|
||||
pub const ENOENT : ::c_int = 2;
|
||||
pub const ESRCH : ::c_int = 3;
|
||||
pub const EINTR : ::c_int = 4;
|
||||
pub const EIO : ::c_int = 5;
|
||||
pub const ENXIO : ::c_int = 6;
|
||||
pub const E2BIG : ::c_int = 7;
|
||||
pub const ENOEXEC : ::c_int = 8;
|
||||
pub const EBADF : ::c_int = 9;
|
||||
pub const ECHILD : ::c_int = 10;
|
||||
pub const EDEADLK : ::c_int = 11;
|
||||
pub const ENOMEM : ::c_int = 12;
|
||||
pub const EACCES : ::c_int = 13;
|
||||
pub const EFAULT : ::c_int = 14;
|
||||
pub const ENOTBLK : ::c_int = 15;
|
||||
pub const EBUSY : ::c_int = 16;
|
||||
pub const EEXIST : ::c_int = 17;
|
||||
pub const EXDEV : ::c_int = 18;
|
||||
pub const ENODEV : ::c_int = 19;
|
||||
pub const ENOTDIR : ::c_int = 20;
|
||||
pub const EISDIR : ::c_int = 21;
|
||||
pub const EINVAL : ::c_int = 22;
|
||||
pub const ENFILE : ::c_int = 23;
|
||||
pub const EMFILE : ::c_int = 24;
|
||||
pub const ENOTTY : ::c_int = 25;
|
||||
pub const ETXTBSY : ::c_int = 26;
|
||||
pub const EFBIG : ::c_int = 27;
|
||||
pub const ENOSPC : ::c_int = 28;
|
||||
pub const ESPIPE : ::c_int = 29;
|
||||
pub const EROFS : ::c_int = 30;
|
||||
pub const EMLINK : ::c_int = 31;
|
||||
pub const EPIPE : ::c_int = 32;
|
||||
pub const EDOM : ::c_int = 33;
|
||||
pub const ERANGE : ::c_int = 34;
|
||||
pub const EAGAIN : ::c_int = 35;
|
||||
pub const EWOULDBLOCK : ::c_int = 35;
|
||||
pub const EINPROGRESS : ::c_int = 36;
|
||||
pub const EALREADY : ::c_int = 37;
|
||||
pub const ENOTSOCK : ::c_int = 38;
|
||||
pub const EDESTADDRREQ : ::c_int = 39;
|
||||
pub const EMSGSIZE : ::c_int = 40;
|
||||
pub const EPROTOTYPE : ::c_int = 41;
|
||||
pub const ENOPROTOOPT : ::c_int = 42;
|
||||
pub const EPROTONOSUPPORT : ::c_int = 43;
|
||||
pub const ESOCKTNOSUPPORT : ::c_int = 44;
|
||||
pub const EOPNOTSUPP : ::c_int = 45;
|
||||
pub const EPFNOSUPPORT : ::c_int = 46;
|
||||
pub const EAFNOSUPPORT : ::c_int = 47;
|
||||
pub const EADDRINUSE : ::c_int = 48;
|
||||
pub const EADDRNOTAVAIL : ::c_int = 49;
|
||||
pub const ENETDOWN : ::c_int = 50;
|
||||
pub const ENETUNREACH : ::c_int = 51;
|
||||
pub const ENETRESET : ::c_int = 52;
|
||||
pub const ECONNABORTED : ::c_int = 53;
|
||||
pub const ECONNRESET : ::c_int = 54;
|
||||
pub const ENOBUFS : ::c_int = 55;
|
||||
pub const EISCONN : ::c_int = 56;
|
||||
pub const ENOTCONN : ::c_int = 57;
|
||||
pub const ESHUTDOWN : ::c_int = 58;
|
||||
pub const ETOOMANYREFS : ::c_int = 59;
|
||||
pub const ETIMEDOUT : ::c_int = 60;
|
||||
pub const ECONNREFUSED : ::c_int = 61;
|
||||
pub const ELOOP : ::c_int = 62;
|
||||
pub const ENAMETOOLONG : ::c_int = 63;
|
||||
pub const EHOSTDOWN : ::c_int = 64;
|
||||
pub const EHOSTUNREACH : ::c_int = 65;
|
||||
pub const ENOTEMPTY : ::c_int = 66;
|
||||
pub const EPROCLIM : ::c_int = 67;
|
||||
pub const EUSERS : ::c_int = 68;
|
||||
pub const EDQUOT : ::c_int = 69;
|
||||
pub const ESTALE : ::c_int = 70;
|
||||
pub const EREMOTE : ::c_int = 71;
|
||||
pub const EBADRPC : ::c_int = 72;
|
||||
pub const ERPCMISMATCH : ::c_int = 73;
|
||||
pub const EPROGUNAVAIL : ::c_int = 74;
|
||||
pub const EPROGMISMATCH : ::c_int = 75;
|
||||
pub const EPROCUNAVAIL : ::c_int = 76;
|
||||
pub const ENOLCK : ::c_int = 77;
|
||||
pub const ENOSYS : ::c_int = 78;
|
||||
pub const EFTYPE : ::c_int = 79;
|
||||
pub const EAUTH : ::c_int = 80;
|
||||
pub const ENEEDAUTH : ::c_int = 81;
|
||||
|
||||
pub const F_DUPFD : ::c_int = 0;
|
||||
pub const F_GETFD : ::c_int = 1;
|
||||
pub const F_SETFD : ::c_int = 2;
|
||||
pub const F_GETFL : ::c_int = 3;
|
||||
pub const F_SETFL : ::c_int = 4;
|
||||
|
||||
pub const SIGTRAP : ::c_int = 5;
|
||||
|
||||
pub const GLOB_APPEND : ::c_int = 0x0001;
|
||||
pub const GLOB_DOOFFS : ::c_int = 0x0002;
|
||||
pub const GLOB_ERR : ::c_int = 0x0004;
|
||||
pub const GLOB_MARK : ::c_int = 0x0008;
|
||||
pub const GLOB_NOCHECK : ::c_int = 0x0010;
|
||||
pub const GLOB_NOSORT : ::c_int = 0x0020;
|
||||
pub const GLOB_NOESCAPE : ::c_int = 0x1000;
|
||||
|
||||
pub const GLOB_NOSPACE : ::c_int = -1;
|
||||
pub const GLOB_ABORTED : ::c_int = -2;
|
||||
pub const GLOB_NOMATCH : ::c_int = -3;
|
||||
pub const GLOB_NOSYS : ::c_int = -4;
|
||||
|
||||
pub const POSIX_MADV_NORMAL : ::c_int = 0;
|
||||
pub const POSIX_MADV_RANDOM : ::c_int = 1;
|
||||
pub const POSIX_MADV_SEQUENTIAL : ::c_int = 2;
|
||||
pub const POSIX_MADV_WILLNEED : ::c_int = 3;
|
||||
pub const POSIX_MADV_DONTNEED : ::c_int = 4;
|
||||
|
||||
pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0;
|
||||
pub const PTHREAD_CREATE_DETACHED : ::c_int = 1;
|
||||
|
||||
// http://man.openbsd.org/OpenBSD-current/man2/clock_getres.2
|
||||
// The man page says clock_gettime(3) can accept various values as clockid_t but
|
||||
// http://fxr.watson.org/fxr/source/kern/kern_time.c?v=OPENBSD;im=excerpts#L161
|
||||
// the implementation rejects anything other than the below two
|
||||
//
|
||||
// http://netbsd.gw.com/cgi-bin/man-cgi?clock_gettime
|
||||
// https://github.com/jsonn/src/blob/HEAD/sys/kern/subr_time.c#L222
|
||||
// Basically the same goes for NetBSD
|
||||
pub const CLOCK_REALTIME: ::clockid_t = 0;
|
||||
pub const CLOCK_MONOTONIC: ::clockid_t = 3;
|
||||
|
||||
pub const RLIMIT_CPU: ::c_int = 0;
|
||||
pub const RLIMIT_FSIZE: ::c_int = 1;
|
||||
pub const RLIMIT_DATA: ::c_int = 2;
|
||||
pub const RLIMIT_STACK: ::c_int = 3;
|
||||
pub const RLIMIT_CORE: ::c_int = 4;
|
||||
pub const RLIMIT_RSS: ::c_int = 5;
|
||||
pub const RLIMIT_MEMLOCK: ::c_int = 6;
|
||||
pub const RLIMIT_NPROC: ::c_int = 7;
|
||||
pub const RLIMIT_NOFILE: ::c_int = 8;
|
||||
|
||||
pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
|
||||
pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
|
||||
pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
|
||||
|
||||
pub const RUSAGE_SELF: ::c_int = 0;
|
||||
pub const RUSAGE_CHILDREN: ::c_int = -1;
|
||||
|
||||
pub const MADV_NORMAL : ::c_int = 0;
|
||||
pub const MADV_RANDOM : ::c_int = 1;
|
||||
pub const MADV_SEQUENTIAL : ::c_int = 2;
|
||||
pub const MADV_WILLNEED : ::c_int = 3;
|
||||
pub const MADV_DONTNEED : ::c_int = 4;
|
||||
pub const MADV_FREE : ::c_int = 6;
|
||||
|
||||
pub const AF_UNSPEC: ::c_int = 0;
|
||||
pub const AF_LOCAL: ::c_int = 1;
|
||||
pub const AF_UNIX: ::c_int = AF_LOCAL;
|
||||
pub const AF_INET: ::c_int = 2;
|
||||
pub const AF_IMPLINK: ::c_int = 3;
|
||||
pub const AF_PUP: ::c_int = 4;
|
||||
pub const AF_CHAOS: ::c_int = 5;
|
||||
pub const AF_NS: ::c_int = 6;
|
||||
pub const AF_ISO: ::c_int = 7;
|
||||
pub const AF_OSI: ::c_int = AF_ISO;
|
||||
pub const AF_DATAKIT: ::c_int = 9;
|
||||
pub const AF_CCITT: ::c_int = 10;
|
||||
pub const AF_SNA: ::c_int = 11;
|
||||
pub const AF_DECnet: ::c_int = 12;
|
||||
pub const AF_DLI: ::c_int = 13;
|
||||
pub const AF_LAT: ::c_int = 14;
|
||||
pub const AF_HYLINK: ::c_int = 15;
|
||||
pub const AF_APPLETALK: ::c_int = 16;
|
||||
pub const AF_LINK: ::c_int = 18;
|
||||
pub const pseudo_AF_XTP: ::c_int = 19;
|
||||
pub const AF_COIP: ::c_int = 20;
|
||||
pub const AF_CNT: ::c_int = 21;
|
||||
pub const pseudo_AF_RTIP: ::c_int = 22;
|
||||
pub const AF_IPX: ::c_int = 23;
|
||||
pub const AF_INET6: ::c_int = 24;
|
||||
pub const pseudo_AF_PIP: ::c_int = 25;
|
||||
pub const AF_ISDN: ::c_int = 26;
|
||||
pub const AF_E164: ::c_int = AF_ISDN;
|
||||
pub const AF_NATM: ::c_int = 27;
|
||||
|
||||
pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
|
||||
pub const PF_LOCAL: ::c_int = AF_LOCAL;
|
||||
pub const PF_UNIX: ::c_int = PF_LOCAL;
|
||||
pub const PF_INET: ::c_int = AF_INET;
|
||||
pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
|
||||
pub const PF_PUP: ::c_int = AF_PUP;
|
||||
pub const PF_CHAOS: ::c_int = AF_CHAOS;
|
||||
pub const PF_NS: ::c_int = AF_NS;
|
||||
pub const PF_ISO: ::c_int = AF_ISO;
|
||||
pub const PF_OSI: ::c_int = AF_ISO;
|
||||
pub const PF_DATAKIT: ::c_int = AF_DATAKIT;
|
||||
pub const PF_CCITT: ::c_int = AF_CCITT;
|
||||
pub const PF_SNA: ::c_int = AF_SNA;
|
||||
pub const PF_DECnet: ::c_int = AF_DECnet;
|
||||
pub const PF_DLI: ::c_int = AF_DLI;
|
||||
pub const PF_LAT: ::c_int = AF_LAT;
|
||||
pub const PF_HYLINK: ::c_int = AF_HYLINK;
|
||||
pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
|
||||
pub const PF_LINK: ::c_int = AF_LINK;
|
||||
pub const PF_XTP: ::c_int = pseudo_AF_XTP;
|
||||
pub const PF_COIP: ::c_int = AF_COIP;
|
||||
pub const PF_CNT: ::c_int = AF_CNT;
|
||||
pub const PF_IPX: ::c_int = AF_IPX;
|
||||
pub const PF_INET6: ::c_int = AF_INET6;
|
||||
pub const PF_RTIP: ::c_int = pseudo_AF_RTIP;
|
||||
pub const PF_PIP: ::c_int = pseudo_AF_PIP;
|
||||
pub const PF_ISDN: ::c_int = AF_ISDN;
|
||||
pub const PF_NATM: ::c_int = AF_NATM;
|
||||
|
||||
pub const SOCK_STREAM: ::c_int = 1;
|
||||
pub const SOCK_DGRAM: ::c_int = 2;
|
||||
pub const SOCK_RAW: ::c_int = 3;
|
||||
pub const SOCK_RDM: ::c_int = 4;
|
||||
pub const SOCK_SEQPACKET: ::c_int = 5;
|
||||
pub const IP_TTL: ::c_int = 4;
|
||||
pub const IP_HDRINCL: ::c_int = 2;
|
||||
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
|
||||
pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
|
||||
|
||||
pub const TCP_NODELAY: ::c_int = 0x01;
|
||||
pub const SOL_SOCKET: ::c_int = 0xffff;
|
||||
pub const SO_DEBUG: ::c_int = 0x01;
|
||||
pub const SO_ACCEPTCONN: ::c_int = 0x0002;
|
||||
pub const SO_REUSEADDR: ::c_int = 0x0004;
|
||||
pub const SO_KEEPALIVE: ::c_int = 0x0008;
|
||||
pub const SO_DONTROUTE: ::c_int = 0x0010;
|
||||
pub const SO_BROADCAST: ::c_int = 0x0020;
|
||||
pub const SO_USELOOPBACK: ::c_int = 0x0040;
|
||||
pub const SO_LINGER: ::c_int = 0x0080;
|
||||
pub const SO_OOBINLINE: ::c_int = 0x0100;
|
||||
pub const SO_REUSEPORT: ::c_int = 0x0200;
|
||||
pub const SO_SNDBUF: ::c_int = 0x1001;
|
||||
pub const SO_RCVBUF: ::c_int = 0x1002;
|
||||
pub const SO_SNDLOWAT: ::c_int = 0x1003;
|
||||
pub const SO_RCVLOWAT: ::c_int = 0x1004;
|
||||
pub const SO_ERROR: ::c_int = 0x1007;
|
||||
pub const SO_TYPE: ::c_int = 0x1008;
|
||||
|
||||
pub const SOMAXCONN: ::c_int = 128;
|
||||
|
||||
pub const MSG_OOB: ::c_int = 0x1;
|
||||
pub const MSG_PEEK: ::c_int = 0x2;
|
||||
pub const MSG_DONTROUTE: ::c_int = 0x4;
|
||||
pub const MSG_EOR: ::c_int = 0x8;
|
||||
pub const MSG_TRUNC: ::c_int = 0x10;
|
||||
pub const MSG_CTRUNC: ::c_int = 0x20;
|
||||
pub const MSG_WAITALL: ::c_int = 0x40;
|
||||
pub const MSG_DONTWAIT: ::c_int = 0x80;
|
||||
pub const MSG_BCAST: ::c_int = 0x100;
|
||||
pub const MSG_MCAST: ::c_int = 0x200;
|
||||
pub const MSG_NOSIGNAL: ::c_int = 0x400;
|
||||
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
|
||||
|
||||
pub const IFF_LOOPBACK: ::c_int = 0x8;
|
||||
|
||||
pub const SHUT_RD: ::c_int = 0;
|
||||
pub const SHUT_WR: ::c_int = 1;
|
||||
pub const SHUT_RDWR: ::c_int = 2;
|
||||
|
||||
pub const LOCK_SH: ::c_int = 1;
|
||||
pub const LOCK_EX: ::c_int = 2;
|
||||
pub const LOCK_NB: ::c_int = 4;
|
||||
pub const LOCK_UN: ::c_int = 8;
|
||||
|
||||
pub const IPPROTO_RAW : ::c_int = 255;
|
||||
|
||||
pub const _SC_ARG_MAX : ::c_int = 1;
|
||||
pub const _SC_CHILD_MAX : ::c_int = 2;
|
||||
pub const _SC_NGROUPS_MAX : ::c_int = 4;
|
||||
pub const _SC_OPEN_MAX : ::c_int = 5;
|
||||
pub const _SC_JOB_CONTROL : ::c_int = 6;
|
||||
pub const _SC_SAVED_IDS : ::c_int = 7;
|
||||
pub const _SC_VERSION : ::c_int = 8;
|
||||
pub const _SC_BC_BASE_MAX : ::c_int = 9;
|
||||
pub const _SC_BC_DIM_MAX : ::c_int = 10;
|
||||
pub const _SC_BC_SCALE_MAX : ::c_int = 11;
|
||||
pub const _SC_BC_STRING_MAX : ::c_int = 12;
|
||||
pub const _SC_COLL_WEIGHTS_MAX : ::c_int = 13;
|
||||
pub const _SC_EXPR_NEST_MAX : ::c_int = 14;
|
||||
pub const _SC_LINE_MAX : ::c_int = 15;
|
||||
pub const _SC_RE_DUP_MAX : ::c_int = 16;
|
||||
pub const _SC_2_VERSION : ::c_int = 17;
|
||||
pub const _SC_2_C_BIND : ::c_int = 18;
|
||||
pub const _SC_2_C_DEV : ::c_int = 19;
|
||||
pub const _SC_2_CHAR_TERM : ::c_int = 20;
|
||||
pub const _SC_2_FORT_DEV : ::c_int = 21;
|
||||
pub const _SC_2_FORT_RUN : ::c_int = 22;
|
||||
pub const _SC_2_LOCALEDEF : ::c_int = 23;
|
||||
pub const _SC_2_SW_DEV : ::c_int = 24;
|
||||
pub const _SC_2_UPE : ::c_int = 25;
|
||||
pub const _SC_STREAM_MAX : ::c_int = 26;
|
||||
pub const _SC_TZNAME_MAX : ::c_int = 27;
|
||||
pub const _SC_PAGESIZE : ::c_int = 28;
|
||||
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
|
||||
pub const _SC_FSYNC : ::c_int = 29;
|
||||
pub const _SC_XOPEN_SHM : ::c_int = 30;
|
||||
|
||||
pub const Q_GETQUOTA: ::c_int = 0x300;
|
||||
pub const Q_SETQUOTA: ::c_int = 0x400;
|
||||
|
||||
pub const RTLD_GLOBAL: ::c_int = 0x100;
|
||||
|
||||
pub const LOG_NFACILITIES: ::c_int = 24;
|
||||
|
||||
pub const HW_NCPU: ::c_int = 3;
|
||||
|
||||
pub const B0: speed_t = 0;
|
||||
pub const B50: speed_t = 50;
|
||||
pub const B75: speed_t = 75;
|
||||
pub const B110: speed_t = 110;
|
||||
pub const B134: speed_t = 134;
|
||||
pub const B150: speed_t = 150;
|
||||
pub const B200: speed_t = 200;
|
||||
pub const B300: speed_t = 300;
|
||||
pub const B600: speed_t = 600;
|
||||
pub const B1200: speed_t = 1200;
|
||||
pub const B1800: speed_t = 1800;
|
||||
pub const B2400: speed_t = 2400;
|
||||
pub const B4800: speed_t = 4800;
|
||||
pub const B9600: speed_t = 9600;
|
||||
pub const B19200: speed_t = 19200;
|
||||
pub const B38400: speed_t = 38400;
|
||||
pub const B7200: speed_t = 7200;
|
||||
pub const B14400: speed_t = 14400;
|
||||
pub const B28800: speed_t = 28800;
|
||||
pub const B57600: speed_t = 57600;
|
||||
pub const B76800: speed_t = 76800;
|
||||
pub const B115200: speed_t = 115200;
|
||||
pub const B230400: speed_t = 230400;
|
||||
pub const EXTA: speed_t = 19200;
|
||||
pub const EXTB: speed_t = 38400;
|
||||
|
||||
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
|
||||
|
||||
pub const CRTSCTS: ::tcflag_t = 0x00010000;
|
||||
pub const CRTS_IFLOW: ::tcflag_t = CRTSCTS;
|
||||
pub const CCTS_OFLOW: ::tcflag_t = CRTSCTS;
|
||||
pub const OCRNL: ::tcflag_t = 0x10;
|
||||
|
||||
pub const TIOCM_LE: ::c_int = 0o0001;
|
||||
pub const TIOCM_DTR: ::c_int = 0o0002;
|
||||
pub const TIOCM_RTS: ::c_int = 0o0004;
|
||||
pub const TIOCM_ST: ::c_int = 0o0010;
|
||||
pub const TIOCM_SR: ::c_int = 0o0020;
|
||||
pub const TIOCM_CTS: ::c_int = 0o0040;
|
||||
pub const TIOCM_CAR: ::c_int = 0o0100;
|
||||
pub const TIOCM_RNG: ::c_int = 0o0200;
|
||||
pub const TIOCM_DSR: ::c_int = 0o0400;
|
||||
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
|
||||
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
|
||||
|
||||
f! {
|
||||
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
|
||||
status >> 8
|
||||
}
|
||||
|
||||
pub fn WIFSIGNALED(status: ::c_int) -> bool {
|
||||
(status & 0o177) != 0o177 && (status & 0o177) != 0
|
||||
}
|
||||
|
||||
pub fn WIFSTOPPED(status: ::c_int) -> bool {
|
||||
(status & 0o177) == 0o177
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "util")]
|
||||
extern {
|
||||
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
|
||||
vec: *mut ::c_char) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
|
||||
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
|
||||
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__clock_settime50")]
|
||||
pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
|
||||
pub fn __errno() -> *mut ::c_int;
|
||||
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
|
||||
-> ::c_int;
|
||||
pub fn memrchr(cx: *const ::c_void,
|
||||
c: ::c_int,
|
||||
n: ::size_t) -> *mut ::c_void;
|
||||
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
|
||||
pub fn mkostemps(template: *mut ::c_char,
|
||||
suffixlen: ::c_int,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
pub fn pwritev(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int,
|
||||
offset: ::off_t) -> ::ssize_t;
|
||||
pub fn preadv(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int,
|
||||
offset: ::off_t) -> ::ssize_t;
|
||||
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
|
||||
pub fn fdatasync(fd: ::c_int) -> ::c_int;
|
||||
pub fn openpty(amaster: *mut ::c_int,
|
||||
aslave: *mut ::c_int,
|
||||
name: *mut ::c_char,
|
||||
termp: *mut termios,
|
||||
winp: *mut ::winsize) -> ::c_int;
|
||||
pub fn forkpty(amaster: *mut ::c_int,
|
||||
name: *mut ::c_char,
|
||||
termp: *mut termios,
|
||||
winp: *mut ::winsize) -> ::pid_t;
|
||||
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
|
||||
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
|
||||
|
||||
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
mode: ::mode_t, dev: dev_t) -> ::c_int;
|
||||
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
mode: ::mode_t) -> ::c_int;
|
||||
pub fn sem_timedwait(sem: *mut sem_t,
|
||||
abstime: *const ::timespec) -> ::c_int;
|
||||
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
|
||||
clock_id: ::clockid_t) -> ::c_int;
|
||||
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
|
||||
pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
|
||||
abstime: *const ::timespec) -> ::c_int;
|
||||
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn getgrouplist(name: *const ::c_char,
|
||||
basegid: ::gid_t,
|
||||
groups: *mut ::gid_t,
|
||||
ngroups: *mut ::c_int) -> ::c_int;
|
||||
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
|
||||
pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
|
||||
envp: *const *const ::c_char)
|
||||
-> ::c_int;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_os = "netbsd")] {
|
||||
mod netbsd;
|
||||
pub use self::netbsd::*;
|
||||
} else if #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] {
|
||||
mod openbsdlike;
|
||||
pub use self::openbsdlike::*;
|
||||
} else {
|
||||
// Unknown target_os
|
||||
}
|
||||
}
|
@ -1,832 +0,0 @@
|
||||
pub type clock_t = ::c_uint;
|
||||
pub type suseconds_t = ::c_int;
|
||||
pub type dev_t = u64;
|
||||
pub type blksize_t = ::int32_t;
|
||||
pub type fsblkcnt_t = ::uint64_t;
|
||||
pub type fsfilcnt_t = ::uint64_t;
|
||||
pub type idtype_t = ::c_int;
|
||||
|
||||
s! {
|
||||
pub struct aiocb {
|
||||
pub aio_offset: ::off_t,
|
||||
pub aio_buf: *mut ::c_void,
|
||||
pub aio_nbytes: ::size_t,
|
||||
pub aio_fildes: ::c_int,
|
||||
pub aio_lio_opcode: ::c_int,
|
||||
pub aio_reqprio: ::c_int,
|
||||
pub aio_sigevent: ::sigevent,
|
||||
_state: ::c_int,
|
||||
_errno: ::c_int,
|
||||
_retval: ::ssize_t
|
||||
}
|
||||
|
||||
pub struct dirent {
|
||||
pub d_fileno: ::ino_t,
|
||||
pub d_reclen: u16,
|
||||
pub d_namlen: u16,
|
||||
pub d_type: u8,
|
||||
pub d_name: [::c_char; 512],
|
||||
}
|
||||
|
||||
pub struct glob_t {
|
||||
pub gl_pathc: ::size_t,
|
||||
pub gl_matchc: ::size_t,
|
||||
pub gl_offs: ::size_t,
|
||||
pub gl_flags: ::c_int,
|
||||
pub gl_pathv: *mut *mut ::c_char,
|
||||
|
||||
__unused3: *mut ::c_void,
|
||||
|
||||
__unused4: *mut ::c_void,
|
||||
__unused5: *mut ::c_void,
|
||||
__unused6: *mut ::c_void,
|
||||
__unused7: *mut ::c_void,
|
||||
__unused8: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct sigevent {
|
||||
pub sigev_notify: ::c_int,
|
||||
pub sigev_signo: ::c_int,
|
||||
pub sigev_value: ::sigval,
|
||||
__unused1: *mut ::c_void, //actually a function pointer
|
||||
pub sigev_notify_attributes: *mut ::c_void
|
||||
}
|
||||
|
||||
pub struct sigset_t {
|
||||
__bits: [u32; 4],
|
||||
}
|
||||
|
||||
pub struct stat {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_mode: ::mode_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_nlink: ::nlink_t,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
pub st_atime: ::time_t,
|
||||
pub st_atimensec: ::c_long,
|
||||
pub st_mtime: ::time_t,
|
||||
pub st_mtimensec: ::c_long,
|
||||
pub st_ctime: ::time_t,
|
||||
pub st_ctimensec: ::c_long,
|
||||
pub st_birthtime: ::time_t,
|
||||
pub st_birthtimensec: ::c_long,
|
||||
pub st_size: ::off_t,
|
||||
pub st_blocks: ::blkcnt_t,
|
||||
pub st_blksize: ::blksize_t,
|
||||
pub st_flags: ::uint32_t,
|
||||
pub st_gen: ::uint32_t,
|
||||
pub st_spare: [::uint32_t; 2],
|
||||
}
|
||||
|
||||
pub struct statvfs {
|
||||
pub f_flag: ::c_ulong,
|
||||
pub f_bsize: ::c_ulong,
|
||||
pub f_frsize: ::c_ulong,
|
||||
pub f_iosize: ::c_ulong,
|
||||
|
||||
pub f_blocks: ::fsblkcnt_t,
|
||||
pub f_bfree: ::fsblkcnt_t,
|
||||
pub f_bavail: ::fsblkcnt_t,
|
||||
pub f_bresvd: ::fsblkcnt_t,
|
||||
|
||||
pub f_files: ::fsfilcnt_t,
|
||||
pub f_ffree: ::fsfilcnt_t,
|
||||
pub f_favail: ::fsfilcnt_t,
|
||||
pub f_fresvd: ::fsfilcnt_t,
|
||||
|
||||
pub f_syncreads: ::uint64_t,
|
||||
pub f_syncwrites: ::uint64_t,
|
||||
|
||||
pub f_asyncreads: ::uint64_t,
|
||||
pub f_asyncwrites: ::uint64_t,
|
||||
|
||||
pub f_fsidx: ::fsid_t,
|
||||
pub f_fsid: ::c_ulong,
|
||||
pub f_namemax: ::c_ulong,
|
||||
pub f_owner: ::uid_t,
|
||||
|
||||
pub f_spare: [::uint32_t; 4],
|
||||
|
||||
pub f_fstypename: [::c_char; 32],
|
||||
pub f_mntonname: [::c_char; 1024],
|
||||
pub f_mntfromname: [::c_char; 1024],
|
||||
}
|
||||
|
||||
pub struct addrinfo {
|
||||
pub ai_flags: ::c_int,
|
||||
pub ai_family: ::c_int,
|
||||
pub ai_socktype: ::c_int,
|
||||
pub ai_protocol: ::c_int,
|
||||
pub ai_addrlen: ::socklen_t,
|
||||
pub ai_canonname: *mut ::c_char,
|
||||
pub ai_addr: *mut ::sockaddr,
|
||||
pub ai_next: *mut ::addrinfo,
|
||||
}
|
||||
|
||||
pub struct sockaddr_storage {
|
||||
pub ss_len: u8,
|
||||
pub ss_family: ::sa_family_t,
|
||||
__ss_pad1: [u8; 6],
|
||||
__ss_pad2: i64,
|
||||
__ss_pad3: [u8; 112],
|
||||
}
|
||||
|
||||
pub struct siginfo_t {
|
||||
pub si_signo: ::c_int,
|
||||
pub si_code: ::c_int,
|
||||
pub si_errno: ::c_int,
|
||||
__pad1: ::c_int,
|
||||
pub si_addr: *mut ::c_void,
|
||||
__pad2: [u64; 13],
|
||||
}
|
||||
|
||||
pub struct pthread_attr_t {
|
||||
pta_magic: ::c_uint,
|
||||
pta_flags: ::c_int,
|
||||
pta_private: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct pthread_mutex_t {
|
||||
ptm_magic: ::c_uint,
|
||||
ptm_errorcheck: ::c_uchar,
|
||||
ptm_pad1: [u8; 3],
|
||||
ptm_interlock: ::c_uchar,
|
||||
ptm_pad2: [u8; 3],
|
||||
ptm_owner: ::pthread_t,
|
||||
ptm_waiters: *mut u8,
|
||||
ptm_recursed: ::c_uint,
|
||||
ptm_spare2: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct pthread_mutexattr_t {
|
||||
ptma_magic: ::c_uint,
|
||||
ptma_private: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct pthread_rwlockattr_t {
|
||||
ptra_magic: ::c_uint,
|
||||
ptra_private: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct pthread_cond_t {
|
||||
ptc_magic: ::c_uint,
|
||||
ptc_lock: ::c_uchar,
|
||||
ptc_waiters_first: *mut u8,
|
||||
ptc_waiters_last: *mut u8,
|
||||
ptc_mutex: *mut ::pthread_mutex_t,
|
||||
ptc_private: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct pthread_condattr_t {
|
||||
ptca_magic: ::c_uint,
|
||||
ptca_private: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct pthread_rwlock_t {
|
||||
ptr_magic: ::c_uint,
|
||||
ptr_interlock: ::c_uchar,
|
||||
ptr_rblocked_first: *mut u8,
|
||||
ptr_rblocked_last: *mut u8,
|
||||
ptr_wblocked_first: *mut u8,
|
||||
ptr_wblocked_last: *mut u8,
|
||||
ptr_nreaders: ::c_uint,
|
||||
ptr_owner: ::pthread_t,
|
||||
ptr_private: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct kevent {
|
||||
pub ident: ::uintptr_t,
|
||||
pub filter: ::uint32_t,
|
||||
pub flags: ::uint32_t,
|
||||
pub fflags: ::uint32_t,
|
||||
pub data: ::int64_t,
|
||||
pub udata: ::intptr_t,
|
||||
}
|
||||
|
||||
pub struct dqblk {
|
||||
pub dqb_bhardlimit: ::uint32_t,
|
||||
pub dqb_bsoftlimit: ::uint32_t,
|
||||
pub dqb_curblocks: ::uint32_t,
|
||||
pub dqb_ihardlimit: ::uint32_t,
|
||||
pub dqb_isoftlimit: ::uint32_t,
|
||||
pub dqb_curinodes: ::uint32_t,
|
||||
pub dqb_btime: ::int32_t,
|
||||
pub dqb_itime: ::int32_t,
|
||||
}
|
||||
|
||||
pub struct Dl_info {
|
||||
pub dli_fname: *const ::c_char,
|
||||
pub dli_fbase: *mut ::c_void,
|
||||
pub dli_sname: *const ::c_char,
|
||||
pub dli_saddr: *const ::c_void,
|
||||
}
|
||||
|
||||
pub struct lconv {
|
||||
pub decimal_point: *mut ::c_char,
|
||||
pub thousands_sep: *mut ::c_char,
|
||||
pub grouping: *mut ::c_char,
|
||||
pub int_curr_symbol: *mut ::c_char,
|
||||
pub currency_symbol: *mut ::c_char,
|
||||
pub mon_decimal_point: *mut ::c_char,
|
||||
pub mon_thousands_sep: *mut ::c_char,
|
||||
pub mon_grouping: *mut ::c_char,
|
||||
pub positive_sign: *mut ::c_char,
|
||||
pub negative_sign: *mut ::c_char,
|
||||
pub int_frac_digits: ::c_char,
|
||||
pub frac_digits: ::c_char,
|
||||
pub p_cs_precedes: ::c_char,
|
||||
pub p_sep_by_space: ::c_char,
|
||||
pub n_cs_precedes: ::c_char,
|
||||
pub n_sep_by_space: ::c_char,
|
||||
pub p_sign_posn: ::c_char,
|
||||
pub n_sign_posn: ::c_char,
|
||||
pub int_p_cs_precedes: ::c_char,
|
||||
pub int_n_cs_precedes: ::c_char,
|
||||
pub int_p_sep_by_space: ::c_char,
|
||||
pub int_n_sep_by_space: ::c_char,
|
||||
pub int_p_sign_posn: ::c_char,
|
||||
pub int_n_sign_posn: ::c_char,
|
||||
}
|
||||
|
||||
pub struct if_data {
|
||||
pub ifi_type: ::c_uchar,
|
||||
pub ifi_addrlen: ::c_uchar,
|
||||
pub ifi_hdrlen: ::c_uchar,
|
||||
pub ifi_link_state: ::c_int,
|
||||
pub ifi_mtu: u64,
|
||||
pub ifi_metric: u64,
|
||||
pub ifi_baudrate: u64,
|
||||
pub ifi_ipackets: u64,
|
||||
pub ifi_ierrors: u64,
|
||||
pub ifi_opackets: u64,
|
||||
pub ifi_oerrors: u64,
|
||||
pub ifi_collisions: u64,
|
||||
pub ifi_ibytes: u64,
|
||||
pub ifi_obytes: u64,
|
||||
pub ifi_imcasts: u64,
|
||||
pub ifi_omcasts: u64,
|
||||
pub ifi_iqdrops: u64,
|
||||
pub ifi_noproto: u64,
|
||||
pub ifi_lastchange: ::timespec,
|
||||
}
|
||||
|
||||
pub struct if_msghdr {
|
||||
pub ifm_msglen: ::c_ushort,
|
||||
pub ifm_version: ::c_uchar,
|
||||
pub ifm_type: ::c_uchar,
|
||||
pub ifm_addrs: ::c_int,
|
||||
pub ifm_flags: ::c_int,
|
||||
pub ifm_index: ::c_ushort,
|
||||
pub ifm_data: if_data,
|
||||
}
|
||||
}
|
||||
|
||||
pub const AT_FDCWD: ::c_int = -100;
|
||||
pub const AT_EACCESS: ::c_int = 0x100;
|
||||
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
|
||||
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
|
||||
pub const AT_REMOVEDIR: ::c_int = 0x800;
|
||||
|
||||
pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE);
|
||||
pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE);
|
||||
pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY);
|
||||
pub const LC_NUMERIC_MASK: ::c_int = (1 << ::LC_NUMERIC);
|
||||
pub const LC_TIME_MASK: ::c_int = (1 << ::LC_TIME);
|
||||
pub const LC_MESSAGES_MASK: ::c_int = (1 << ::LC_MESSAGES);
|
||||
pub const LC_ALL_MASK: ::c_int = !0;
|
||||
|
||||
pub const ERA: ::nl_item = 52;
|
||||
pub const ERA_D_FMT: ::nl_item = 53;
|
||||
pub const ERA_D_T_FMT: ::nl_item = 54;
|
||||
pub const ERA_T_FMT: ::nl_item = 55;
|
||||
pub const ALT_DIGITS: ::nl_item = 56;
|
||||
|
||||
pub const O_CLOEXEC: ::c_int = 0x400000;
|
||||
pub const O_ALT_IO: ::c_int = 0x40000;
|
||||
pub const O_NOSIGPIPE: ::c_int = 0x1000000;
|
||||
pub const O_SEARCH: ::c_int = 0x800000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x200000;
|
||||
pub const O_DIRECT : ::c_int = 0x00080000;
|
||||
pub const O_RSYNC : ::c_int = 0x00020000;
|
||||
|
||||
pub const MS_SYNC : ::c_int = 0x4;
|
||||
pub const MS_INVALIDATE : ::c_int = 0x2;
|
||||
|
||||
pub const RLIM_NLIMITS: ::c_int = 12;
|
||||
|
||||
pub const ENOATTR : ::c_int = 93;
|
||||
pub const EILSEQ : ::c_int = 85;
|
||||
pub const EOVERFLOW : ::c_int = 84;
|
||||
pub const ECANCELED : ::c_int = 87;
|
||||
pub const EIDRM : ::c_int = 82;
|
||||
pub const ENOMSG : ::c_int = 83;
|
||||
pub const ENOTSUP : ::c_int = 86;
|
||||
pub const ELAST : ::c_int = 96;
|
||||
|
||||
pub const F_DUPFD_CLOEXEC : ::c_int = 12;
|
||||
pub const F_CLOSEM: ::c_int = 10;
|
||||
pub const F_GETNOSIGPIPE: ::c_int = 13;
|
||||
pub const F_SETNOSIGPIPE: ::c_int = 14;
|
||||
pub const F_MAXFD: ::c_int = 11;
|
||||
|
||||
pub const IPV6_JOIN_GROUP: ::c_int = 12;
|
||||
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
|
||||
|
||||
pub const SOCK_CONN_DGRAM: ::c_int = 6;
|
||||
pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
|
||||
pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000;
|
||||
pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000;
|
||||
|
||||
pub const SO_SNDTIMEO: ::c_int = 0x100b;
|
||||
pub const SO_RCVTIMEO: ::c_int = 0x100c;
|
||||
pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
|
||||
pub const SO_TIMESTAMP: ::c_int = 0x2000;
|
||||
pub const SO_OVERFLOWED: ::c_int = 0x1009;
|
||||
pub const SO_NOHEADER: ::c_int = 0x100a;
|
||||
|
||||
pub const AF_OROUTE: ::c_int = 17;
|
||||
pub const AF_ARP: ::c_int = 28;
|
||||
pub const pseudo_AF_KEY: ::c_int = 29;
|
||||
pub const pseudo_AF_HDRCMPLT: ::c_int = 30;
|
||||
pub const AF_BLUETOOTH: ::c_int = 31;
|
||||
pub const AF_IEEE80211: ::c_int = 32;
|
||||
pub const AF_MPLS: ::c_int = 33;
|
||||
pub const AF_ROUTE: ::c_int = 34;
|
||||
pub const AF_MAX: ::c_int = 35;
|
||||
|
||||
pub const NET_MAXID: ::c_int = AF_MAX;
|
||||
pub const NET_RT_DUMP: ::c_int = 1;
|
||||
pub const NET_RT_FLAGS: ::c_int = 2;
|
||||
pub const NET_RT_OOIFLIST: ::c_int = 3;
|
||||
pub const NET_RT_OIFLIST: ::c_int = 4;
|
||||
pub const NET_RT_IFLIST: ::c_int = 5;
|
||||
pub const NET_RT_MAXID: ::c_int = 6;
|
||||
|
||||
pub const PF_OROUTE: ::c_int = AF_OROUTE;
|
||||
pub const PF_ARP: ::c_int = AF_ARP;
|
||||
pub const PF_KEY: ::c_int = pseudo_AF_KEY;
|
||||
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
|
||||
pub const PF_MPLS: ::c_int = AF_MPLS;
|
||||
pub const PF_ROUTE: ::c_int = AF_ROUTE;
|
||||
pub const PF_MAX: ::c_int = AF_MAX;
|
||||
|
||||
pub const MSG_NBIO: ::c_int = 0x1000;
|
||||
pub const MSG_WAITFORONE: ::c_int = 0x2000;
|
||||
pub const MSG_NOTIFICATION: ::c_int = 0x4000;
|
||||
|
||||
pub const SCM_TIMESTAMP: ::c_int = 0x08;
|
||||
pub const SCM_CREDS: ::c_int = 0x10;
|
||||
|
||||
pub const O_DSYNC : ::c_int = 0x10000;
|
||||
|
||||
pub const MAP_RENAME : ::c_int = 0x20;
|
||||
pub const MAP_NORESERVE : ::c_int = 0x40;
|
||||
pub const MAP_HASSEMAPHORE : ::c_int = 0x200;
|
||||
pub const MAP_WIRED: ::c_int = 0x800;
|
||||
|
||||
pub const _PC_LINK_MAX : ::c_int = 1;
|
||||
pub const _PC_MAX_CANON : ::c_int = 2;
|
||||
pub const _PC_MAX_INPUT : ::c_int = 3;
|
||||
pub const _PC_NAME_MAX : ::c_int = 4;
|
||||
pub const _PC_PATH_MAX : ::c_int = 5;
|
||||
pub const _PC_PIPE_BUF : ::c_int = 6;
|
||||
pub const _PC_CHOWN_RESTRICTED : ::c_int = 7;
|
||||
pub const _PC_NO_TRUNC : ::c_int = 8;
|
||||
pub const _PC_VDISABLE : ::c_int = 9;
|
||||
pub const _PC_SYNC_IO : ::c_int = 10;
|
||||
pub const _PC_FILESIZEBITS : ::c_int = 11;
|
||||
pub const _PC_SYMLINK_MAX : ::c_int = 12;
|
||||
pub const _PC_2_SYMLINKS : ::c_int = 13;
|
||||
pub const _PC_ACL_EXTENDED : ::c_int = 14;
|
||||
pub const _PC_MIN_HOLE_SIZE : ::c_int = 15;
|
||||
|
||||
pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
|
||||
pub const _SC_IOV_MAX : ::c_int = 32;
|
||||
pub const _SC_MAPPED_FILES : ::c_int = 33;
|
||||
pub const _SC_MEMLOCK : ::c_int = 34;
|
||||
pub const _SC_MEMLOCK_RANGE : ::c_int = 35;
|
||||
pub const _SC_MEMORY_PROTECTION : ::c_int = 36;
|
||||
pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
|
||||
pub const _SC_MONOTONIC_CLOCK : ::c_int = 38;
|
||||
pub const _SC_CLK_TCK : ::c_int = 39;
|
||||
pub const _SC_ATEXIT_MAX : ::c_int = 40;
|
||||
pub const _SC_THREADS : ::c_int = 41;
|
||||
pub const _SC_SEMAPHORES : ::c_int = 42;
|
||||
pub const _SC_BARRIERS : ::c_int = 43;
|
||||
pub const _SC_TIMERS : ::c_int = 44;
|
||||
pub const _SC_SPIN_LOCKS : ::c_int = 45;
|
||||
pub const _SC_READER_WRITER_LOCKS : ::c_int = 46;
|
||||
pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47;
|
||||
pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 48;
|
||||
pub const _SC_CLOCK_SELECTION : ::c_int = 49;
|
||||
pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
|
||||
pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
|
||||
pub const _SC_AIO_MAX : ::c_int = 52;
|
||||
pub const _SC_MESSAGE_PASSING : ::c_int = 53;
|
||||
pub const _SC_MQ_OPEN_MAX : ::c_int = 54;
|
||||
pub const _SC_MQ_PRIO_MAX : ::c_int = 55;
|
||||
pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56;
|
||||
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 57;
|
||||
pub const _SC_THREAD_KEYS_MAX : ::c_int = 58;
|
||||
pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
|
||||
pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
|
||||
pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
|
||||
pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
|
||||
pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
|
||||
pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 64;
|
||||
pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 65;
|
||||
pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 66;
|
||||
pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 67;
|
||||
pub const _SC_TTY_NAME_MAX : ::c_int = 68;
|
||||
pub const _SC_HOST_NAME_MAX : ::c_int = 69;
|
||||
pub const _SC_PASS_MAX : ::c_int = 70;
|
||||
pub const _SC_REGEXP : ::c_int = 71;
|
||||
pub const _SC_SHELL : ::c_int = 72;
|
||||
pub const _SC_SYMLOOP_MAX : ::c_int = 73;
|
||||
pub const _SC_V6_ILP32_OFF32 : ::c_int = 74;
|
||||
pub const _SC_V6_ILP32_OFFBIG : ::c_int = 75;
|
||||
pub const _SC_V6_LP64_OFF64 : ::c_int = 76;
|
||||
pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 77;
|
||||
pub const _SC_2_PBS : ::c_int = 80;
|
||||
pub const _SC_2_PBS_ACCOUNTING : ::c_int = 81;
|
||||
pub const _SC_2_PBS_CHECKPOINT : ::c_int = 82;
|
||||
pub const _SC_2_PBS_LOCATE : ::c_int = 83;
|
||||
pub const _SC_2_PBS_MESSAGE : ::c_int = 84;
|
||||
pub const _SC_2_PBS_TRACK : ::c_int = 85;
|
||||
pub const _SC_SPAWN : ::c_int = 86;
|
||||
pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87;
|
||||
pub const _SC_TIMER_MAX : ::c_int = 88;
|
||||
pub const _SC_SEM_NSEMS_MAX : ::c_int = 89;
|
||||
pub const _SC_CPUTIME : ::c_int = 90;
|
||||
pub const _SC_THREAD_CPUTIME : ::c_int = 91;
|
||||
pub const _SC_DELAYTIMER_MAX : ::c_int = 92;
|
||||
// These two variables will be supported in NetBSD 8.0
|
||||
// pub const _SC_SIGQUEUE_MAX : ::c_int = 93;
|
||||
// pub const _SC_REALTIME_SIGNALS : ::c_int = 94;
|
||||
pub const _SC_PHYS_PAGES : ::c_int = 121;
|
||||
pub const _SC_NPROCESSORS_CONF : ::c_int = 1001;
|
||||
pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002;
|
||||
pub const _SC_SCHED_RT_TS : ::c_int = 2001;
|
||||
pub const _SC_SCHED_PRI_MIN : ::c_int = 2002;
|
||||
pub const _SC_SCHED_PRI_MAX : ::c_int = 2003;
|
||||
|
||||
pub const FD_SETSIZE: usize = 0x100;
|
||||
|
||||
pub const ST_NOSUID: ::c_ulong = 8;
|
||||
|
||||
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
|
||||
ptm_magic: 0x33330003,
|
||||
ptm_errorcheck: 0,
|
||||
ptm_interlock: 0,
|
||||
ptm_waiters: 0 as *mut _,
|
||||
ptm_owner: 0,
|
||||
ptm_pad1: [0; 3],
|
||||
ptm_pad2: [0; 3],
|
||||
ptm_recursed: 0,
|
||||
ptm_spare2: 0 as *mut _,
|
||||
};
|
||||
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
|
||||
ptc_magic: 0x55550005,
|
||||
ptc_lock: 0,
|
||||
ptc_waiters_first: 0 as *mut _,
|
||||
ptc_waiters_last: 0 as *mut _,
|
||||
ptc_mutex: 0 as *mut _,
|
||||
ptc_private: 0 as *mut _,
|
||||
};
|
||||
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
|
||||
ptr_magic: 0x99990009,
|
||||
ptr_interlock: 0,
|
||||
ptr_rblocked_first: 0 as *mut _,
|
||||
ptr_rblocked_last: 0 as *mut _,
|
||||
ptr_wblocked_first: 0 as *mut _,
|
||||
ptr_wblocked_last: 0 as *mut _,
|
||||
ptr_nreaders: 0,
|
||||
ptr_owner: 0,
|
||||
ptr_private: 0 as *mut _,
|
||||
};
|
||||
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
|
||||
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
|
||||
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
|
||||
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
|
||||
|
||||
pub const EVFILT_AIO: ::int32_t = 2;
|
||||
pub const EVFILT_PROC: ::int32_t = 4;
|
||||
pub const EVFILT_READ: ::int32_t = 0;
|
||||
pub const EVFILT_SIGNAL: ::int32_t = 5;
|
||||
pub const EVFILT_TIMER: ::int32_t = 6;
|
||||
pub const EVFILT_VNODE: ::int32_t = 3;
|
||||
pub const EVFILT_WRITE: ::int32_t = 1;
|
||||
|
||||
pub const EV_ADD: ::uint32_t = 0x1;
|
||||
pub const EV_DELETE: ::uint32_t = 0x2;
|
||||
pub const EV_ENABLE: ::uint32_t = 0x4;
|
||||
pub const EV_DISABLE: ::uint32_t = 0x8;
|
||||
pub const EV_ONESHOT: ::uint32_t = 0x10;
|
||||
pub const EV_CLEAR: ::uint32_t = 0x20;
|
||||
pub const EV_RECEIPT: ::uint32_t = 0x40;
|
||||
pub const EV_DISPATCH: ::uint32_t = 0x80;
|
||||
pub const EV_FLAG1: ::uint32_t = 0x2000;
|
||||
pub const EV_ERROR: ::uint32_t = 0x4000;
|
||||
pub const EV_EOF: ::uint32_t = 0x8000;
|
||||
pub const EV_SYSFLAGS: ::uint32_t = 0xf000;
|
||||
|
||||
pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_DELETE: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_WRITE: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
|
||||
pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
|
||||
pub const NOTE_LINK: ::uint32_t = 0x00000010;
|
||||
pub const NOTE_RENAME: ::uint32_t = 0x00000020;
|
||||
pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
|
||||
pub const NOTE_EXIT: ::uint32_t = 0x80000000;
|
||||
pub const NOTE_FORK: ::uint32_t = 0x40000000;
|
||||
pub const NOTE_EXEC: ::uint32_t = 0x20000000;
|
||||
pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
|
||||
pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
|
||||
pub const NOTE_TRACK: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
|
||||
|
||||
pub const TMP_MAX : ::c_uint = 308915776;
|
||||
|
||||
pub const NI_MAXHOST: ::socklen_t = 1025;
|
||||
|
||||
pub const RTLD_NOLOAD: ::c_int = 0x2000;
|
||||
pub const RTLD_LOCAL: ::c_int = 0x200;
|
||||
|
||||
pub const CTL_MAXNAME: ::c_int = 12;
|
||||
pub const SYSCTL_NAMELEN: ::c_int = 32;
|
||||
pub const SYSCTL_DEFSIZE: ::c_int = 8;
|
||||
pub const CTLTYPE_NODE: ::c_int = 1;
|
||||
pub const CTLTYPE_INT: ::c_int = 2;
|
||||
pub const CTLTYPE_STRING: ::c_int = 3;
|
||||
pub const CTLTYPE_QUAD: ::c_int = 4;
|
||||
pub const CTLTYPE_STRUCT: ::c_int = 5;
|
||||
pub const CTLTYPE_BOOL: ::c_int = 6;
|
||||
pub const CTLFLAG_READONLY: ::c_int = 0x00000000;
|
||||
pub const CTLFLAG_READWRITE: ::c_int = 0x00000070;
|
||||
pub const CTLFLAG_ANYWRITE: ::c_int = 0x00000080;
|
||||
pub const CTLFLAG_PRIVATE: ::c_int = 0x00000100;
|
||||
pub const CTLFLAG_PERMANENT: ::c_int = 0x00000200;
|
||||
pub const CTLFLAG_OWNDATA: ::c_int = 0x00000400;
|
||||
pub const CTLFLAG_IMMEDIATE: ::c_int = 0x00000800;
|
||||
pub const CTLFLAG_HEX: ::c_int = 0x00001000;
|
||||
pub const CTLFLAG_ROOT: ::c_int = 0x00002000;
|
||||
pub const CTLFLAG_ANYNUMBER: ::c_int = 0x00004000;
|
||||
pub const CTLFLAG_HIDDEN: ::c_int = 0x00008000;
|
||||
pub const CTLFLAG_ALIAS: ::c_int = 0x00010000;
|
||||
pub const CTLFLAG_MMAP: ::c_int = 0x00020000;
|
||||
pub const CTLFLAG_OWNDESC: ::c_int = 0x00040000;
|
||||
pub const CTLFLAG_UNSIGNED: ::c_int = 0x00080000;
|
||||
pub const SYSCTL_VERS_MASK: ::c_int = 0xff000000;
|
||||
pub const SYSCTL_VERS_0: ::c_int = 0x00000000;
|
||||
pub const SYSCTL_VERS_1: ::c_int = 0x01000000;
|
||||
pub const SYSCTL_VERSION: ::c_int = SYSCTL_VERS_1;
|
||||
pub const CTL_EOL: ::c_int = -1;
|
||||
pub const CTL_QUERY: ::c_int = -2;
|
||||
pub const CTL_CREATE: ::c_int = -3;
|
||||
pub const CTL_CREATESYM: ::c_int = -4;
|
||||
pub const CTL_DESTROY: ::c_int = -5;
|
||||
pub const CTL_MMAP: ::c_int = -6;
|
||||
pub const CTL_DESCRIBE: ::c_int = -7;
|
||||
pub const CTL_UNSPEC: ::c_int = 0;
|
||||
pub const CTL_KERN: ::c_int = 1;
|
||||
pub const CTL_VM: ::c_int = 2;
|
||||
pub const CTL_VFS: ::c_int = 3;
|
||||
pub const CTL_NET: ::c_int = 4;
|
||||
pub const CTL_DEBUG: ::c_int = 5;
|
||||
pub const CTL_HW: ::c_int = 6;
|
||||
pub const CTL_MACHDEP: ::c_int = 7;
|
||||
pub const CTL_USER: ::c_int = 8;
|
||||
pub const CTL_DDB: ::c_int = 9;
|
||||
pub const CTL_PROC: ::c_int = 10;
|
||||
pub const CTL_VENDOR: ::c_int = 11;
|
||||
pub const CTL_EMUL: ::c_int = 12;
|
||||
pub const CTL_SECURITY: ::c_int = 13;
|
||||
pub const CTL_MAXID: ::c_int = 14;
|
||||
pub const KERN_OSTYPE: ::c_int = 1;
|
||||
pub const KERN_OSRELEASE: ::c_int = 2;
|
||||
pub const KERN_OSREV: ::c_int = 3;
|
||||
pub const KERN_VERSION: ::c_int = 4;
|
||||
pub const KERN_MAXVNODES: ::c_int = 5;
|
||||
pub const KERN_MAXPROC: ::c_int = 6;
|
||||
pub const KERN_MAXFILES: ::c_int = 7;
|
||||
pub const KERN_ARGMAX: ::c_int = 8;
|
||||
pub const KERN_SECURELVL: ::c_int = 9;
|
||||
pub const KERN_HOSTNAME: ::c_int = 10;
|
||||
pub const KERN_HOSTID: ::c_int = 11;
|
||||
pub const KERN_CLOCKRATE: ::c_int = 12;
|
||||
pub const KERN_VNODE: ::c_int = 13;
|
||||
pub const KERN_PROC: ::c_int = 14;
|
||||
pub const KERN_FILE: ::c_int = 15;
|
||||
pub const KERN_PROF: ::c_int = 16;
|
||||
pub const KERN_POSIX1: ::c_int = 17;
|
||||
pub const KERN_NGROUPS: ::c_int = 18;
|
||||
pub const KERN_JOB_CONTROL: ::c_int = 19;
|
||||
pub const KERN_SAVED_IDS: ::c_int = 20;
|
||||
pub const KERN_OBOOTTIME: ::c_int = 21;
|
||||
pub const KERN_DOMAINNAME: ::c_int = 22;
|
||||
pub const KERN_MAXPARTITIONS: ::c_int = 23;
|
||||
pub const KERN_RAWPARTITION: ::c_int = 24;
|
||||
pub const KERN_NTPTIME: ::c_int = 25;
|
||||
pub const KERN_TIMEX: ::c_int = 26;
|
||||
pub const KERN_AUTONICETIME: ::c_int = 27;
|
||||
pub const KERN_AUTONICEVAL: ::c_int = 28;
|
||||
pub const KERN_RTC_OFFSET: ::c_int = 29;
|
||||
pub const KERN_ROOT_DEVICE: ::c_int = 30;
|
||||
pub const KERN_MSGBUFSIZE: ::c_int = 31;
|
||||
pub const KERN_FSYNC: ::c_int = 32;
|
||||
pub const KERN_OLDSYSVMSG: ::c_int = 33;
|
||||
pub const KERN_OLDSYSVSEM: ::c_int = 34;
|
||||
pub const KERN_OLDSYSVSHM: ::c_int = 35;
|
||||
pub const KERN_OLDSHORTCORENAME: ::c_int = 36;
|
||||
pub const KERN_SYNCHRONIZED_IO: ::c_int = 37;
|
||||
pub const KERN_IOV_MAX: ::c_int = 38;
|
||||
pub const KERN_MBUF: ::c_int = 39;
|
||||
pub const KERN_MAPPED_FILES: ::c_int = 40;
|
||||
pub const KERN_MEMLOCK: ::c_int = 41;
|
||||
pub const KERN_MEMLOCK_RANGE: ::c_int = 42;
|
||||
pub const KERN_MEMORY_PROTECTION: ::c_int = 43;
|
||||
pub const KERN_LOGIN_NAME_MAX: ::c_int = 44;
|
||||
pub const KERN_DEFCORENAME: ::c_int = 45;
|
||||
pub const KERN_LOGSIGEXIT: ::c_int = 46;
|
||||
pub const KERN_PROC2: ::c_int = 47;
|
||||
pub const KERN_PROC_ARGS: ::c_int = 48;
|
||||
pub const KERN_FSCALE: ::c_int = 49;
|
||||
pub const KERN_CCPU: ::c_int = 50;
|
||||
pub const KERN_CP_TIME: ::c_int = 51;
|
||||
pub const KERN_OLDSYSVIPC_INFO: ::c_int = 52;
|
||||
pub const KERN_MSGBUF: ::c_int = 53;
|
||||
pub const KERN_CONSDEV: ::c_int = 54;
|
||||
pub const KERN_MAXPTYS: ::c_int = 55;
|
||||
pub const KERN_PIPE: ::c_int = 56;
|
||||
pub const KERN_MAXPHYS: ::c_int = 57;
|
||||
pub const KERN_SBMAX: ::c_int = 58;
|
||||
pub const KERN_TKSTAT: ::c_int = 59;
|
||||
pub const KERN_MONOTONIC_CLOCK: ::c_int = 60;
|
||||
pub const KERN_URND: ::c_int = 61;
|
||||
pub const KERN_LABELSECTOR: ::c_int = 62;
|
||||
pub const KERN_LABELOFFSET: ::c_int = 63;
|
||||
pub const KERN_LWP: ::c_int = 64;
|
||||
pub const KERN_FORKFSLEEP: ::c_int = 65;
|
||||
pub const KERN_POSIX_THREADS: ::c_int = 66;
|
||||
pub const KERN_POSIX_SEMAPHORES: ::c_int = 67;
|
||||
pub const KERN_POSIX_BARRIERS: ::c_int = 68;
|
||||
pub const KERN_POSIX_TIMERS: ::c_int = 69;
|
||||
pub const KERN_POSIX_SPIN_LOCKS: ::c_int = 70;
|
||||
pub const KERN_POSIX_READER_WRITER_LOCKS: ::c_int = 71;
|
||||
pub const KERN_DUMP_ON_PANIC: ::c_int = 72;
|
||||
pub const KERN_SOMAXKVA: ::c_int = 73;
|
||||
pub const KERN_ROOT_PARTITION: ::c_int = 74;
|
||||
pub const KERN_DRIVERS: ::c_int = 75;
|
||||
pub const KERN_BUF: ::c_int = 76;
|
||||
pub const KERN_FILE2: ::c_int = 77;
|
||||
pub const KERN_VERIEXEC: ::c_int = 78;
|
||||
pub const KERN_CP_ID: ::c_int = 79;
|
||||
pub const KERN_HARDCLOCK_TICKS: ::c_int = 80;
|
||||
pub const KERN_ARND: ::c_int = 81;
|
||||
pub const KERN_SYSVIPC: ::c_int = 82;
|
||||
pub const KERN_BOOTTIME: ::c_int = 83;
|
||||
pub const KERN_EVCNT: ::c_int = 84;
|
||||
pub const KERN_MAXID: ::c_int = 85;
|
||||
pub const KERN_PROC_ALL: ::c_int = 0;
|
||||
pub const KERN_PROC_PID: ::c_int = 1;
|
||||
pub const KERN_PROC_PGRP: ::c_int = 2;
|
||||
pub const KERN_PROC_SESSION: ::c_int = 3;
|
||||
pub const KERN_PROC_TTY: ::c_int = 4;
|
||||
pub const KERN_PROC_UID: ::c_int = 5;
|
||||
pub const KERN_PROC_RUID: ::c_int = 6;
|
||||
pub const KERN_PROC_GID: ::c_int = 7;
|
||||
pub const KERN_PROC_RGID: ::c_int = 8;
|
||||
|
||||
pub const EAI_SYSTEM: ::c_int = 11;
|
||||
|
||||
pub const AIO_CANCELED: ::c_int = 1;
|
||||
pub const AIO_NOTCANCELED: ::c_int = 2;
|
||||
pub const AIO_ALLDONE: ::c_int = 3;
|
||||
pub const LIO_NOP: ::c_int = 0;
|
||||
pub const LIO_WRITE: ::c_int = 1;
|
||||
pub const LIO_READ: ::c_int = 2;
|
||||
pub const LIO_WAIT: ::c_int = 1;
|
||||
pub const LIO_NOWAIT: ::c_int = 0;
|
||||
|
||||
pub const SIGEV_NONE: ::c_int = 0;
|
||||
pub const SIGEV_SIGNAL: ::c_int = 1;
|
||||
pub const SIGEV_THREAD: ::c_int = 2;
|
||||
|
||||
pub const WSTOPPED: ::c_int = 0x00000002; // same as WUNTRACED
|
||||
pub const WCONTINUED: ::c_int = 0x00000010;
|
||||
pub const WEXITED: ::c_int = 0x000000020;
|
||||
pub const WNOWAIT: ::c_int = 0x00010000;
|
||||
|
||||
pub const P_ALL: idtype_t = 0;
|
||||
pub const P_PID: idtype_t = 1;
|
||||
pub const P_PGID: idtype_t = 4;
|
||||
|
||||
pub const B460800: ::speed_t = 460800;
|
||||
pub const B921600: ::speed_t = 921600;
|
||||
|
||||
pub const ONOCR: ::tcflag_t = 0x20;
|
||||
pub const ONLRET: ::tcflag_t = 0x40;
|
||||
pub const CDTRCTS: ::tcflag_t = 0x00020000;
|
||||
pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
|
||||
|
||||
pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
|
||||
pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
|
||||
|
||||
// dirfd() is a macro on netbsd to access
|
||||
// the first field of the struct where dirp points to:
|
||||
// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
|
||||
f! {
|
||||
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
|
||||
unsafe { *(dirp as *const ::c_int) }
|
||||
}
|
||||
|
||||
pub fn WIFCONTINUED(status: ::c_int) -> bool {
|
||||
status == 0xffff
|
||||
}
|
||||
}
|
||||
|
||||
extern {
|
||||
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
|
||||
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
|
||||
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
|
||||
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
|
||||
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
|
||||
#[link_name = "__aio_suspend50"]
|
||||
pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int,
|
||||
timeout: *const ::timespec) -> ::c_int;
|
||||
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
|
||||
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
|
||||
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
|
||||
|
||||
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
|
||||
pub fn getnameinfo(sa: *const ::sockaddr,
|
||||
salen: ::socklen_t,
|
||||
host: *mut ::c_char,
|
||||
hostlen: ::socklen_t,
|
||||
serv: *mut ::c_char,
|
||||
sevlen: ::socklen_t,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
|
||||
-> ::c_int;
|
||||
pub fn sysctl(name: *const ::c_int,
|
||||
namelen: ::c_uint,
|
||||
oldp: *mut ::c_void,
|
||||
oldlenp: *mut ::size_t,
|
||||
newp: *const ::c_void,
|
||||
newlen: ::size_t)
|
||||
-> ::c_int;
|
||||
pub fn sysctlbyname(name: *const ::c_char,
|
||||
oldp: *mut ::c_void,
|
||||
oldlenp: *mut ::size_t,
|
||||
newp: *const ::c_void,
|
||||
newlen: ::size_t)
|
||||
-> ::c_int;
|
||||
#[link_name = "__kevent50"]
|
||||
pub fn kevent(kq: ::c_int,
|
||||
changelist: *const ::kevent,
|
||||
nchanges: ::size_t,
|
||||
eventlist: *mut ::kevent,
|
||||
nevents: ::size_t,
|
||||
timeout: *const ::timespec) -> ::c_int;
|
||||
#[link_name = "__mount50"]
|
||||
pub fn mount(src: *const ::c_char,
|
||||
target: *const ::c_char,
|
||||
flags: ::c_int,
|
||||
data: *mut ::c_void,
|
||||
size: ::size_t) -> ::c_int;
|
||||
pub fn ptrace(request: ::c_int,
|
||||
pid: ::pid_t,
|
||||
addr: *mut ::c_void,
|
||||
data: ::c_int) -> ::c_int;
|
||||
pub fn pthread_setname_np(t: ::pthread_t,
|
||||
name: *const ::c_char,
|
||||
arg: *mut ::c_void) -> ::c_int;
|
||||
pub fn pthread_getattr_np(native: ::pthread_t,
|
||||
attr: *mut ::pthread_attr_t) -> ::c_int;
|
||||
pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
|
||||
guardsize: *mut ::size_t) -> ::c_int;
|
||||
pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
|
||||
stackaddr: *mut *mut ::c_void,
|
||||
stacksize: *mut ::size_t) -> ::c_int;
|
||||
#[link_name = "__sigtimedwait50"]
|
||||
pub fn sigtimedwait(set: *const sigset_t,
|
||||
info: *mut siginfo_t,
|
||||
timeout: *const ::timespec) -> ::c_int;
|
||||
pub fn sigwaitinfo(set: *const sigset_t,
|
||||
info: *mut siginfo_t) -> ::c_int;
|
||||
pub fn duplocale(base: ::locale_t) -> ::locale_t;
|
||||
pub fn freelocale(loc: ::locale_t);
|
||||
pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
|
||||
pub fn newlocale(mask: ::c_int,
|
||||
locale: *const ::c_char,
|
||||
base: ::locale_t) -> ::locale_t;
|
||||
#[link_name = "__settimeofday50"]
|
||||
pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
|
||||
}
|
||||
|
||||
mod other;
|
||||
pub use self::other::*;
|
@ -1,2 +0,0 @@
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
@ -1,2 +0,0 @@
|
||||
pub type c_long = i64;
|
||||
pub type c_ulong = u64;
|
@ -1,14 +0,0 @@
|
||||
cfg_if! {
|
||||
if #[cfg(any(target_arch = "sparc64",
|
||||
target_arch = "x86_64"))] {
|
||||
mod b64;
|
||||
pub use self::b64::*;
|
||||
} else if #[cfg(any(target_arch = "arm",
|
||||
target_arch = "powerpc",
|
||||
target_arch = "x86"))] {
|
||||
mod b32;
|
||||
pub use self::b32::*;
|
||||
} else {
|
||||
// Unknown target_arch
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
s! {
|
||||
pub struct lconv {
|
||||
pub decimal_point: *mut ::c_char,
|
||||
pub thousands_sep: *mut ::c_char,
|
||||
pub grouping: *mut ::c_char,
|
||||
pub int_curr_symbol: *mut ::c_char,
|
||||
pub currency_symbol: *mut ::c_char,
|
||||
pub mon_decimal_point: *mut ::c_char,
|
||||
pub mon_thousands_sep: *mut ::c_char,
|
||||
pub mon_grouping: *mut ::c_char,
|
||||
pub positive_sign: *mut ::c_char,
|
||||
pub negative_sign: *mut ::c_char,
|
||||
pub int_frac_digits: ::c_char,
|
||||
pub frac_digits: ::c_char,
|
||||
pub p_cs_precedes: ::c_char,
|
||||
pub p_sep_by_space: ::c_char,
|
||||
pub n_cs_precedes: ::c_char,
|
||||
pub n_sep_by_space: ::c_char,
|
||||
pub p_sign_posn: ::c_char,
|
||||
pub n_sign_posn: ::c_char,
|
||||
pub int_p_cs_precedes: ::c_char,
|
||||
pub int_n_cs_precedes: ::c_char,
|
||||
pub int_p_sep_by_space: ::c_char,
|
||||
pub int_n_sep_by_space: ::c_char,
|
||||
pub int_p_sign_posn: ::c_char,
|
||||
pub int_n_sign_posn: ::c_char,
|
||||
}
|
||||
}
|
||||
|
||||
pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
|
||||
pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
|
||||
pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
|
||||
pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
|
||||
pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
|
||||
pub const LC_TIME_MASK: ::c_int = (1 << 5);
|
||||
pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
|
||||
| LC_CTYPE_MASK
|
||||
| LC_MESSAGES_MASK
|
||||
| LC_MONETARY_MASK
|
||||
| LC_NUMERIC_MASK
|
||||
| LC_TIME_MASK;
|
||||
|
||||
pub const ERA: ::nl_item = 52;
|
||||
pub const ERA_D_FMT: ::nl_item = 53;
|
||||
pub const ERA_D_T_FMT: ::nl_item = 54;
|
||||
pub const ERA_T_FMT: ::nl_item = 55;
|
||||
pub const ALT_DIGITS: ::nl_item = 56;
|
||||
|
||||
pub const D_MD_ORDER: ::nl_item = 57;
|
||||
|
||||
pub const ALTMON_1: ::nl_item = 58;
|
||||
pub const ALTMON_2: ::nl_item = 59;
|
||||
pub const ALTMON_3: ::nl_item = 60;
|
||||
pub const ALTMON_4: ::nl_item = 61;
|
||||
pub const ALTMON_5: ::nl_item = 62;
|
||||
pub const ALTMON_6: ::nl_item = 63;
|
||||
pub const ALTMON_7: ::nl_item = 64;
|
||||
pub const ALTMON_8: ::nl_item = 65;
|
||||
pub const ALTMON_9: ::nl_item = 66;
|
||||
pub const ALTMON_10: ::nl_item = 67;
|
||||
pub const ALTMON_11: ::nl_item = 68;
|
||||
pub const ALTMON_12: ::nl_item = 69;
|
||||
|
||||
pub const KERN_RND: ::c_int = 31;
|
||||
|
||||
extern {
|
||||
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
|
||||
pub fn duplocale(base: ::locale_t) -> ::locale_t;
|
||||
pub fn freelocale(loc: ::locale_t) -> ::c_int;
|
||||
pub fn newlocale(mask: ::c_int,
|
||||
locale: *const ::c_char,
|
||||
base: ::locale_t) -> ::locale_t;
|
||||
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
|
||||
pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
|
||||
}
|
@ -1,642 +0,0 @@
|
||||
use unix::bsd::O_SYNC;
|
||||
|
||||
pub type clock_t = i64;
|
||||
pub type suseconds_t = ::c_long;
|
||||
pub type dev_t = i32;
|
||||
pub type sigset_t = ::c_uint;
|
||||
pub type blksize_t = ::int32_t;
|
||||
pub type fsblkcnt_t = ::uint64_t;
|
||||
pub type fsfilcnt_t = ::uint64_t;
|
||||
pub type pthread_attr_t = *mut ::c_void;
|
||||
pub type pthread_mutex_t = *mut ::c_void;
|
||||
pub type pthread_mutexattr_t = *mut ::c_void;
|
||||
pub type pthread_cond_t = *mut ::c_void;
|
||||
pub type pthread_condattr_t = *mut ::c_void;
|
||||
pub type pthread_rwlock_t = *mut ::c_void;
|
||||
pub type pthread_rwlockattr_t = *mut ::c_void;
|
||||
|
||||
s! {
|
||||
pub struct dirent {
|
||||
pub d_fileno: ::ino_t,
|
||||
pub d_off: ::off_t,
|
||||
pub d_reclen: u16,
|
||||
pub d_type: u8,
|
||||
pub d_namlen: u8,
|
||||
__d_padding: [u8; 4],
|
||||
pub d_name: [::c_char; 256],
|
||||
}
|
||||
|
||||
pub struct glob_t {
|
||||
pub gl_pathc: ::c_int,
|
||||
pub gl_matchc: ::c_int,
|
||||
pub gl_offs: ::c_int,
|
||||
pub gl_flags: ::c_int,
|
||||
pub gl_pathv: *mut *mut ::c_char,
|
||||
__unused1: *mut ::c_void,
|
||||
__unused2: *mut ::c_void,
|
||||
__unused3: *mut ::c_void,
|
||||
__unused4: *mut ::c_void,
|
||||
__unused5: *mut ::c_void,
|
||||
__unused6: *mut ::c_void,
|
||||
__unused7: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct kevent {
|
||||
pub ident: ::uintptr_t,
|
||||
pub filter: ::c_short,
|
||||
pub flags: ::c_ushort,
|
||||
pub fflags: ::c_uint,
|
||||
pub data: ::int64_t,
|
||||
pub udata: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct stat {
|
||||
pub st_mode: ::mode_t,
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_nlink: ::nlink_t,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
pub st_atime: ::time_t,
|
||||
pub st_atime_nsec: ::c_long,
|
||||
pub st_mtime: ::time_t,
|
||||
pub st_mtime_nsec: ::c_long,
|
||||
pub st_ctime: ::time_t,
|
||||
pub st_ctime_nsec: ::c_long,
|
||||
pub st_size: ::off_t,
|
||||
pub st_blocks: ::blkcnt_t,
|
||||
pub st_blksize: ::blksize_t,
|
||||
pub st_flags: ::uint32_t,
|
||||
pub st_gen: ::uint32_t,
|
||||
pub st_birthtime: ::time_t,
|
||||
pub st_birthtime_nsec: ::c_long,
|
||||
}
|
||||
|
||||
pub struct statvfs {
|
||||
pub f_bsize: ::c_ulong,
|
||||
pub f_frsize: ::c_ulong,
|
||||
pub f_blocks: ::fsblkcnt_t,
|
||||
pub f_bfree: ::fsblkcnt_t,
|
||||
pub f_bavail: ::fsblkcnt_t,
|
||||
pub f_files: ::fsfilcnt_t,
|
||||
pub f_ffree: ::fsfilcnt_t,
|
||||
pub f_favail: ::fsfilcnt_t,
|
||||
pub f_fsid: ::c_ulong,
|
||||
pub f_flag: ::c_ulong,
|
||||
pub f_namemax: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct addrinfo {
|
||||
pub ai_flags: ::c_int,
|
||||
pub ai_family: ::c_int,
|
||||
pub ai_socktype: ::c_int,
|
||||
pub ai_protocol: ::c_int,
|
||||
pub ai_addrlen: ::socklen_t,
|
||||
pub ai_addr: *mut ::sockaddr,
|
||||
pub ai_canonname: *mut ::c_char,
|
||||
pub ai_next: *mut ::addrinfo,
|
||||
}
|
||||
|
||||
pub struct sockaddr_storage {
|
||||
pub ss_len: u8,
|
||||
pub ss_family: ::sa_family_t,
|
||||
__ss_pad1: [u8; 6],
|
||||
__ss_pad2: i64,
|
||||
__ss_pad3: [u8; 240],
|
||||
}
|
||||
|
||||
pub struct siginfo_t {
|
||||
pub si_signo: ::c_int,
|
||||
pub si_code: ::c_int,
|
||||
pub si_errno: ::c_int,
|
||||
pub si_addr: *mut ::c_char,
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
__pad: [u8; 112],
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
__pad: [u8; 108],
|
||||
}
|
||||
|
||||
pub struct Dl_info {
|
||||
pub dli_fname: *const ::c_char,
|
||||
pub dli_fbase: *mut ::c_void,
|
||||
pub dli_sname: *const ::c_char,
|
||||
pub dli_saddr: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct lastlog {
|
||||
ll_time: ::time_t,
|
||||
ll_line: [::c_char; UT_LINESIZE],
|
||||
ll_host: [::c_char; UT_HOSTSIZE],
|
||||
}
|
||||
|
||||
pub struct utmp {
|
||||
pub ut_line: [::c_char; UT_LINESIZE],
|
||||
pub ut_name: [::c_char; UT_NAMESIZE],
|
||||
pub ut_host: [::c_char; UT_HOSTSIZE],
|
||||
pub ut_time: ::time_t,
|
||||
}
|
||||
|
||||
pub struct if_data {
|
||||
pub ifi_type: ::c_uchar,
|
||||
pub ifi_addrlen: ::c_uchar,
|
||||
pub ifi_hdrlen: ::c_uchar,
|
||||
pub ifi_link_state: ::c_uchar,
|
||||
pub ifi_mtu: u32,
|
||||
pub ifi_metric: u32,
|
||||
pub ifi_rdomain: u32,
|
||||
pub ifi_baudrate: u64,
|
||||
pub ifi_ipackets: u64,
|
||||
pub ifi_ierrors: u64,
|
||||
pub ifi_opackets: u64,
|
||||
pub ifi_oerrors: u64,
|
||||
pub ifi_collisions: u64,
|
||||
pub ifi_ibytes: u64,
|
||||
pub ifi_obytes: u64,
|
||||
pub ifi_imcasts: u64,
|
||||
pub ifi_omcasts: u64,
|
||||
pub ifi_iqdrops: u64,
|
||||
pub ifi_oqdrops: u64,
|
||||
pub ifi_noproto: u64,
|
||||
pub ifi_capabilities: u32,
|
||||
pub ifi_lastchange: ::timeval,
|
||||
}
|
||||
|
||||
pub struct if_msghdr {
|
||||
pub ifm_msglen: ::c_ushort,
|
||||
pub ifm_version: ::c_uchar,
|
||||
pub ifm_type: ::c_uchar,
|
||||
pub ifm_hdrlen: ::c_ushort,
|
||||
pub ifm_index: ::c_ushort,
|
||||
pub ifm_tableid: ::c_ushort,
|
||||
pub ifm_pad1: ::c_uchar,
|
||||
pub ifm_pad2: ::c_uchar,
|
||||
pub ifm_addrs: ::c_int,
|
||||
pub ifm_flags: ::c_int,
|
||||
pub ifm_xflags: ::c_int,
|
||||
pub ifm_data: if_data,
|
||||
}
|
||||
}
|
||||
|
||||
pub const UT_NAMESIZE: usize = 32;
|
||||
pub const UT_LINESIZE: usize = 8;
|
||||
pub const UT_HOSTSIZE: usize = 256;
|
||||
|
||||
pub const O_CLOEXEC: ::c_int = 0x10000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x20000;
|
||||
pub const O_RSYNC: ::c_int = O_SYNC;
|
||||
|
||||
pub const MS_SYNC : ::c_int = 0x0002;
|
||||
pub const MS_INVALIDATE : ::c_int = 0x0004;
|
||||
|
||||
pub const PTHREAD_STACK_MIN : ::size_t = 2048;
|
||||
|
||||
pub const POLLNORM: ::c_short = ::POLLRDNORM;
|
||||
|
||||
pub const ENOATTR : ::c_int = 83;
|
||||
pub const EILSEQ : ::c_int = 84;
|
||||
pub const EOVERFLOW : ::c_int = 87;
|
||||
pub const ECANCELED : ::c_int = 88;
|
||||
pub const EIDRM : ::c_int = 89;
|
||||
pub const ENOMSG : ::c_int = 90;
|
||||
pub const ENOTSUP : ::c_int = 91;
|
||||
pub const ELAST : ::c_int = 91;
|
||||
|
||||
pub const F_DUPFD_CLOEXEC : ::c_int = 10;
|
||||
|
||||
pub const AT_FDCWD: ::c_int = -100;
|
||||
pub const AT_EACCESS: ::c_int = 0x01;
|
||||
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x02;
|
||||
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x04;
|
||||
pub const AT_REMOVEDIR: ::c_int = 0x08;
|
||||
|
||||
pub const RLIM_NLIMITS: ::c_int = 9;
|
||||
|
||||
pub const SO_TIMESTAMP: ::c_int = 0x0800;
|
||||
pub const SO_SNDTIMEO: ::c_int = 0x1005;
|
||||
pub const SO_RCVTIMEO: ::c_int = 0x1006;
|
||||
pub const SO_BINDANY: ::c_int = 0x1000;
|
||||
pub const SO_NETPROC: ::c_int = 0x1020;
|
||||
pub const SO_RTABLE: ::c_int = 0x1021;
|
||||
pub const SO_PEERCRED: ::c_int = 0x1022;
|
||||
pub const SO_SPLICE: ::c_int = 0x1023;
|
||||
|
||||
pub const AF_ECMA: ::c_int = 8;
|
||||
pub const AF_ROUTE: ::c_int = 17;
|
||||
pub const AF_ENCAP: ::c_int = 28;
|
||||
pub const AF_SIP: ::c_int = 29;
|
||||
pub const AF_KEY: ::c_int = 30;
|
||||
pub const pseudo_AF_HDRCMPLT: ::c_int = 31;
|
||||
pub const AF_BLUETOOTH: ::c_int = 32;
|
||||
pub const AF_MPLS: ::c_int = 33;
|
||||
pub const pseudo_AF_PFLOW: ::c_int = 34;
|
||||
pub const pseudo_AF_PIPEX: ::c_int = 35;
|
||||
#[doc(hidden)]
|
||||
pub const AF_MAX: ::c_int = 36;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub const NET_MAXID: ::c_int = AF_MAX;
|
||||
pub const NET_RT_DUMP: ::c_int = 1;
|
||||
pub const NET_RT_FLAGS: ::c_int = 2;
|
||||
pub const NET_RT_IFLIST: ::c_int = 3;
|
||||
pub const NET_RT_STATS: ::c_int = 4;
|
||||
pub const NET_RT_TABLE: ::c_int = 5;
|
||||
pub const NET_RT_IFNAMES: ::c_int = 6;
|
||||
#[doc(hidden)]
|
||||
pub const NET_RT_MAXID: ::c_int = 7;
|
||||
|
||||
pub const IPV6_JOIN_GROUP: ::c_int = 12;
|
||||
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
|
||||
|
||||
pub const PF_ROUTE: ::c_int = AF_ROUTE;
|
||||
pub const PF_ECMA: ::c_int = AF_ECMA;
|
||||
pub const PF_ENCAP: ::c_int = AF_ENCAP;
|
||||
pub const PF_SIP: ::c_int = AF_SIP;
|
||||
pub const PF_KEY: ::c_int = AF_KEY;
|
||||
pub const PF_BPF: ::c_int = pseudo_AF_HDRCMPLT;
|
||||
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
|
||||
pub const PF_MPLS: ::c_int = AF_MPLS;
|
||||
pub const PF_PFLOW: ::c_int = pseudo_AF_PFLOW;
|
||||
pub const PF_PIPEX: ::c_int = pseudo_AF_PIPEX;
|
||||
#[doc(hidden)]
|
||||
pub const PF_MAX: ::c_int = AF_MAX;
|
||||
|
||||
pub const SCM_TIMESTAMP: ::c_int = 0x04;
|
||||
|
||||
pub const O_DSYNC : ::c_int = 128;
|
||||
|
||||
pub const MAP_RENAME : ::c_int = 0x0000;
|
||||
pub const MAP_NORESERVE : ::c_int = 0x0000;
|
||||
pub const MAP_HASSEMAPHORE : ::c_int = 0x0000;
|
||||
|
||||
pub const EIPSEC : ::c_int = 82;
|
||||
pub const ENOMEDIUM : ::c_int = 85;
|
||||
pub const EMEDIUMTYPE : ::c_int = 86;
|
||||
|
||||
pub const EAI_SYSTEM: ::c_int = -11;
|
||||
|
||||
pub const RUSAGE_THREAD: ::c_int = 1;
|
||||
|
||||
pub const MAP_COPY : ::c_int = 0x0002;
|
||||
pub const MAP_NOEXTEND : ::c_int = 0x0000;
|
||||
|
||||
pub const _PC_LINK_MAX : ::c_int = 1;
|
||||
pub const _PC_MAX_CANON : ::c_int = 2;
|
||||
pub const _PC_MAX_INPUT : ::c_int = 3;
|
||||
pub const _PC_NAME_MAX : ::c_int = 4;
|
||||
pub const _PC_PATH_MAX : ::c_int = 5;
|
||||
pub const _PC_PIPE_BUF : ::c_int = 6;
|
||||
pub const _PC_CHOWN_RESTRICTED : ::c_int = 7;
|
||||
pub const _PC_NO_TRUNC : ::c_int = 8;
|
||||
pub const _PC_VDISABLE : ::c_int = 9;
|
||||
pub const _PC_2_SYMLINKS : ::c_int = 10;
|
||||
pub const _PC_ALLOC_SIZE_MIN : ::c_int = 11;
|
||||
pub const _PC_ASYNC_IO : ::c_int = 12;
|
||||
pub const _PC_FILESIZEBITS : ::c_int = 13;
|
||||
pub const _PC_PRIO_IO : ::c_int = 14;
|
||||
pub const _PC_REC_INCR_XFER_SIZE : ::c_int = 15;
|
||||
pub const _PC_REC_MAX_XFER_SIZE : ::c_int = 16;
|
||||
pub const _PC_REC_MIN_XFER_SIZE : ::c_int = 17;
|
||||
pub const _PC_REC_XFER_ALIGN : ::c_int = 18;
|
||||
pub const _PC_SYMLINK_MAX : ::c_int = 19;
|
||||
pub const _PC_SYNC_IO : ::c_int = 20;
|
||||
pub const _PC_TIMESTAMP_RESOLUTION : ::c_int = 21;
|
||||
|
||||
pub const _SC_CLK_TCK : ::c_int = 3;
|
||||
pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
|
||||
pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
|
||||
pub const _SC_HOST_NAME_MAX : ::c_int = 33;
|
||||
pub const _SC_MONOTONIC_CLOCK : ::c_int = 34;
|
||||
pub const _SC_2_PBS : ::c_int = 35;
|
||||
pub const _SC_2_PBS_ACCOUNTING : ::c_int = 36;
|
||||
pub const _SC_2_PBS_CHECKPOINT : ::c_int = 37;
|
||||
pub const _SC_2_PBS_LOCATE : ::c_int = 38;
|
||||
pub const _SC_2_PBS_MESSAGE : ::c_int = 39;
|
||||
pub const _SC_2_PBS_TRACK : ::c_int = 40;
|
||||
pub const _SC_ADVISORY_INFO : ::c_int = 41;
|
||||
pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
|
||||
pub const _SC_AIO_MAX : ::c_int = 43;
|
||||
pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
|
||||
pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
|
||||
pub const _SC_ATEXIT_MAX : ::c_int = 46;
|
||||
pub const _SC_BARRIERS : ::c_int = 47;
|
||||
pub const _SC_CLOCK_SELECTION : ::c_int = 48;
|
||||
pub const _SC_CPUTIME : ::c_int = 49;
|
||||
pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
|
||||
pub const _SC_IOV_MAX : ::c_int = 51;
|
||||
pub const _SC_IPV6 : ::c_int = 52;
|
||||
pub const _SC_MAPPED_FILES : ::c_int = 53;
|
||||
pub const _SC_MEMLOCK : ::c_int = 54;
|
||||
pub const _SC_MEMLOCK_RANGE : ::c_int = 55;
|
||||
pub const _SC_MEMORY_PROTECTION : ::c_int = 56;
|
||||
pub const _SC_MESSAGE_PASSING : ::c_int = 57;
|
||||
pub const _SC_MQ_OPEN_MAX : ::c_int = 58;
|
||||
pub const _SC_MQ_PRIO_MAX : ::c_int = 59;
|
||||
pub const _SC_PRIORITIZED_IO : ::c_int = 60;
|
||||
pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61;
|
||||
pub const _SC_RAW_SOCKETS : ::c_int = 62;
|
||||
pub const _SC_READER_WRITER_LOCKS : ::c_int = 63;
|
||||
pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
|
||||
pub const _SC_REGEXP : ::c_int = 65;
|
||||
pub const _SC_RTSIG_MAX : ::c_int = 66;
|
||||
pub const _SC_SEMAPHORES : ::c_int = 67;
|
||||
pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
|
||||
pub const _SC_SHELL : ::c_int = 69;
|
||||
pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
|
||||
pub const _SC_SPAWN : ::c_int = 71;
|
||||
pub const _SC_SPIN_LOCKS : ::c_int = 72;
|
||||
pub const _SC_SPORADIC_SERVER : ::c_int = 73;
|
||||
pub const _SC_SS_REPL_MAX : ::c_int = 74;
|
||||
pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
|
||||
pub const _SC_SYMLOOP_MAX : ::c_int = 76;
|
||||
pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77;
|
||||
pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78;
|
||||
pub const _SC_THREAD_CPUTIME : ::c_int = 79;
|
||||
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80;
|
||||
pub const _SC_THREAD_KEYS_MAX : ::c_int = 81;
|
||||
pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82;
|
||||
pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83;
|
||||
pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84;
|
||||
pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85;
|
||||
pub const _SC_THREAD_ROBUST_PRIO_INHERIT : ::c_int = 86;
|
||||
pub const _SC_THREAD_ROBUST_PRIO_PROTECT : ::c_int = 87;
|
||||
pub const _SC_THREAD_SPORADIC_SERVER : ::c_int = 88;
|
||||
pub const _SC_THREAD_STACK_MIN : ::c_int = 89;
|
||||
pub const _SC_THREAD_THREADS_MAX : ::c_int = 90;
|
||||
pub const _SC_THREADS : ::c_int = 91;
|
||||
pub const _SC_TIMEOUTS : ::c_int = 92;
|
||||
pub const _SC_TIMER_MAX : ::c_int = 93;
|
||||
pub const _SC_TIMERS : ::c_int = 94;
|
||||
pub const _SC_TRACE : ::c_int = 95;
|
||||
pub const _SC_TRACE_EVENT_FILTER : ::c_int = 96;
|
||||
pub const _SC_TRACE_EVENT_NAME_MAX : ::c_int = 97;
|
||||
pub const _SC_TRACE_INHERIT : ::c_int = 98;
|
||||
pub const _SC_TRACE_LOG : ::c_int = 99;
|
||||
pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
|
||||
pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
|
||||
pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
|
||||
pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
|
||||
pub const _SC_TRACE_NAME_MAX : ::c_int = 104;
|
||||
pub const _SC_TRACE_SYS_MAX : ::c_int = 105;
|
||||
pub const _SC_TRACE_USER_EVENT_MAX : ::c_int = 106;
|
||||
pub const _SC_TTY_NAME_MAX : ::c_int = 107;
|
||||
pub const _SC_TYPED_MEMORY_OBJECTS : ::c_int = 108;
|
||||
pub const _SC_V6_ILP32_OFF32 : ::c_int = 109;
|
||||
pub const _SC_V6_ILP32_OFFBIG : ::c_int = 110;
|
||||
pub const _SC_V6_LP64_OFF64 : ::c_int = 111;
|
||||
pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 112;
|
||||
pub const _SC_V7_ILP32_OFF32 : ::c_int = 113;
|
||||
pub const _SC_V7_ILP32_OFFBIG : ::c_int = 114;
|
||||
pub const _SC_V7_LP64_OFF64 : ::c_int = 115;
|
||||
pub const _SC_V7_LPBIG_OFFBIG : ::c_int = 116;
|
||||
pub const _SC_XOPEN_CRYPT : ::c_int = 117;
|
||||
pub const _SC_XOPEN_ENH_I18N : ::c_int = 118;
|
||||
pub const _SC_XOPEN_LEGACY : ::c_int = 119;
|
||||
pub const _SC_XOPEN_REALTIME : ::c_int = 120;
|
||||
pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121;
|
||||
pub const _SC_XOPEN_STREAMS : ::c_int = 122;
|
||||
pub const _SC_XOPEN_UNIX : ::c_int = 123;
|
||||
pub const _SC_XOPEN_UUCP : ::c_int = 124;
|
||||
pub const _SC_XOPEN_VERSION : ::c_int = 125;
|
||||
pub const _SC_PHYS_PAGES : ::c_int = 500;
|
||||
pub const _SC_AVPHYS_PAGES : ::c_int = 501;
|
||||
pub const _SC_NPROCESSORS_CONF : ::c_int = 502;
|
||||
pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
|
||||
|
||||
pub const FD_SETSIZE: usize = 1024;
|
||||
|
||||
pub const ST_NOSUID: ::c_ulong = 2;
|
||||
|
||||
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
|
||||
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
|
||||
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
|
||||
|
||||
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
|
||||
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
|
||||
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
|
||||
pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4;
|
||||
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP;
|
||||
|
||||
pub const EVFILT_AIO: ::int16_t = -3;
|
||||
pub const EVFILT_PROC: ::int16_t = -5;
|
||||
pub const EVFILT_READ: ::int16_t = -1;
|
||||
pub const EVFILT_SIGNAL: ::int16_t = -6;
|
||||
pub const EVFILT_TIMER: ::int16_t = -7;
|
||||
pub const EVFILT_VNODE: ::int16_t = -4;
|
||||
pub const EVFILT_WRITE: ::int16_t = -2;
|
||||
|
||||
pub const EV_ADD: ::uint16_t = 0x1;
|
||||
pub const EV_DELETE: ::uint16_t = 0x2;
|
||||
pub const EV_ENABLE: ::uint16_t = 0x4;
|
||||
pub const EV_DISABLE: ::uint16_t = 0x8;
|
||||
pub const EV_ONESHOT: ::uint16_t = 0x10;
|
||||
pub const EV_CLEAR: ::uint16_t = 0x20;
|
||||
pub const EV_RECEIPT: ::uint16_t = 0x40;
|
||||
pub const EV_DISPATCH: ::uint16_t = 0x80;
|
||||
pub const EV_FLAG1: ::uint16_t = 0x2000;
|
||||
pub const EV_ERROR: ::uint16_t = 0x4000;
|
||||
pub const EV_EOF: ::uint16_t = 0x8000;
|
||||
pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
|
||||
|
||||
pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_EOF: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_DELETE: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_WRITE: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_EXTEND: ::uint32_t = 0x00000004;
|
||||
pub const NOTE_ATTRIB: ::uint32_t = 0x00000008;
|
||||
pub const NOTE_LINK: ::uint32_t = 0x00000010;
|
||||
pub const NOTE_RENAME: ::uint32_t = 0x00000020;
|
||||
pub const NOTE_REVOKE: ::uint32_t = 0x00000040;
|
||||
pub const NOTE_TRUNCATE: ::uint32_t = 0x00000080;
|
||||
pub const NOTE_EXIT: ::uint32_t = 0x80000000;
|
||||
pub const NOTE_FORK: ::uint32_t = 0x40000000;
|
||||
pub const NOTE_EXEC: ::uint32_t = 0x20000000;
|
||||
pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
|
||||
pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
|
||||
pub const NOTE_TRACK: ::uint32_t = 0x00000001;
|
||||
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
|
||||
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
|
||||
|
||||
pub const TMP_MAX : ::c_uint = 0x7fffffff;
|
||||
|
||||
pub const NI_MAXHOST: ::size_t = 256;
|
||||
|
||||
pub const RTLD_LOCAL: ::c_int = 0;
|
||||
pub const CTL_MAXNAME: ::c_int = 12;
|
||||
pub const CTLTYPE_NODE: ::c_int = 1;
|
||||
pub const CTLTYPE_INT: ::c_int = 2;
|
||||
pub const CTLTYPE_STRING: ::c_int = 3;
|
||||
pub const CTLTYPE_QUAD: ::c_int = 4;
|
||||
pub const CTLTYPE_STRUCT: ::c_int = 5;
|
||||
pub const CTL_UNSPEC: ::c_int = 0;
|
||||
pub const CTL_KERN: ::c_int = 1;
|
||||
pub const CTL_VM: ::c_int = 2;
|
||||
pub const CTL_FS: ::c_int = 3;
|
||||
pub const CTL_NET: ::c_int = 4;
|
||||
pub const CTL_DEBUG: ::c_int = 5;
|
||||
pub const CTL_HW: ::c_int = 6;
|
||||
pub const CTL_MACHDEP: ::c_int = 7;
|
||||
pub const CTL_DDB: ::c_int = 9;
|
||||
pub const CTL_VFS: ::c_int = 10;
|
||||
pub const CTL_MAXID: ::c_int = 11;
|
||||
pub const KERN_OSTYPE: ::c_int = 1;
|
||||
pub const KERN_OSRELEASE: ::c_int = 2;
|
||||
pub const KERN_OSREV: ::c_int = 3;
|
||||
pub const KERN_VERSION: ::c_int = 4;
|
||||
pub const KERN_MAXVNODES: ::c_int = 5;
|
||||
pub const KERN_MAXPROC: ::c_int = 6;
|
||||
pub const KERN_MAXFILES: ::c_int = 7;
|
||||
pub const KERN_ARGMAX: ::c_int = 8;
|
||||
pub const KERN_SECURELVL: ::c_int = 9;
|
||||
pub const KERN_HOSTNAME: ::c_int = 10;
|
||||
pub const KERN_HOSTID: ::c_int = 11;
|
||||
pub const KERN_CLOCKRATE: ::c_int = 12;
|
||||
pub const KERN_PROF: ::c_int = 16;
|
||||
pub const KERN_POSIX1: ::c_int = 17;
|
||||
pub const KERN_NGROUPS: ::c_int = 18;
|
||||
pub const KERN_JOB_CONTROL: ::c_int = 19;
|
||||
pub const KERN_SAVED_IDS: ::c_int = 20;
|
||||
pub const KERN_BOOTTIME: ::c_int = 21;
|
||||
pub const KERN_DOMAINNAME: ::c_int = 22;
|
||||
pub const KERN_MAXPARTITIONS: ::c_int = 23;
|
||||
pub const KERN_RAWPARTITION: ::c_int = 24;
|
||||
pub const KERN_MAXTHREAD: ::c_int = 25;
|
||||
pub const KERN_NTHREADS: ::c_int = 26;
|
||||
pub const KERN_OSVERSION: ::c_int = 27;
|
||||
pub const KERN_SOMAXCONN: ::c_int = 28;
|
||||
pub const KERN_SOMINCONN: ::c_int = 29;
|
||||
pub const KERN_USERMOUNT: ::c_int = 30;
|
||||
pub const KERN_NOSUIDCOREDUMP: ::c_int = 32;
|
||||
pub const KERN_FSYNC: ::c_int = 33;
|
||||
pub const KERN_SYSVMSG: ::c_int = 34;
|
||||
pub const KERN_SYSVSEM: ::c_int = 35;
|
||||
pub const KERN_SYSVSHM: ::c_int = 36;
|
||||
pub const KERN_ARND: ::c_int = 37;
|
||||
pub const KERN_MSGBUFSIZE: ::c_int = 38;
|
||||
pub const KERN_MALLOCSTATS: ::c_int = 39;
|
||||
pub const KERN_CPTIME: ::c_int = 40;
|
||||
pub const KERN_NCHSTATS: ::c_int = 41;
|
||||
pub const KERN_FORKSTAT: ::c_int = 42;
|
||||
pub const KERN_NSELCOLL: ::c_int = 43;
|
||||
pub const KERN_TTY: ::c_int = 44;
|
||||
pub const KERN_CCPU: ::c_int = 45;
|
||||
pub const KERN_FSCALE: ::c_int = 46;
|
||||
pub const KERN_NPROCS: ::c_int = 47;
|
||||
pub const KERN_MSGBUF: ::c_int = 48;
|
||||
pub const KERN_POOL: ::c_int = 49;
|
||||
pub const KERN_STACKGAPRANDOM: ::c_int = 50;
|
||||
pub const KERN_SYSVIPC_INFO: ::c_int = 51;
|
||||
pub const KERN_SPLASSERT: ::c_int = 54;
|
||||
pub const KERN_PROC_ARGS: ::c_int = 55;
|
||||
pub const KERN_NFILES: ::c_int = 56;
|
||||
pub const KERN_TTYCOUNT: ::c_int = 57;
|
||||
pub const KERN_NUMVNODES: ::c_int = 58;
|
||||
pub const KERN_MBSTAT: ::c_int = 59;
|
||||
pub const KERN_SEMINFO: ::c_int = 61;
|
||||
pub const KERN_SHMINFO: ::c_int = 62;
|
||||
pub const KERN_INTRCNT: ::c_int = 63;
|
||||
pub const KERN_WATCHDOG: ::c_int = 64;
|
||||
pub const KERN_PROC: ::c_int = 66;
|
||||
pub const KERN_MAXCLUSTERS: ::c_int = 67;
|
||||
pub const KERN_EVCOUNT: ::c_int = 68;
|
||||
pub const KERN_TIMECOUNTER: ::c_int = 69;
|
||||
pub const KERN_MAXLOCKSPERUID: ::c_int = 70;
|
||||
pub const KERN_CPTIME2: ::c_int = 71;
|
||||
pub const KERN_CACHEPCT: ::c_int = 72;
|
||||
pub const KERN_FILE: ::c_int = 73;
|
||||
pub const KERN_CONSDEV: ::c_int = 75;
|
||||
pub const KERN_NETLIVELOCKS: ::c_int = 76;
|
||||
pub const KERN_POOL_DEBUG: ::c_int = 77;
|
||||
pub const KERN_PROC_CWD: ::c_int = 78;
|
||||
pub const KERN_PROC_NOBROADCASTKILL: ::c_int = 79;
|
||||
pub const KERN_PROC_VMMAP: ::c_int = 80;
|
||||
pub const KERN_GLOBAL_PTRACE: ::c_int = 81;
|
||||
pub const KERN_CONSBUFSIZE: ::c_int = 82;
|
||||
pub const KERN_CONSBUF: ::c_int = 83;
|
||||
pub const KERN_MAXID: ::c_int = 84;
|
||||
pub const KERN_PROC_ALL: ::c_int = 0;
|
||||
pub const KERN_PROC_PID: ::c_int = 1;
|
||||
pub const KERN_PROC_PGRP: ::c_int = 2;
|
||||
pub const KERN_PROC_SESSION: ::c_int = 3;
|
||||
pub const KERN_PROC_TTY: ::c_int = 4;
|
||||
pub const KERN_PROC_UID: ::c_int = 5;
|
||||
pub const KERN_PROC_RUID: ::c_int = 6;
|
||||
pub const KERN_PROC_KTHREAD: ::c_int = 7;
|
||||
pub const KERN_PROC_SHOW_THREADS: ::c_int = 0x40000000;
|
||||
pub const KERN_SYSVIPC_MSG_INFO: ::c_int = 1;
|
||||
pub const KERN_SYSVIPC_SEM_INFO: ::c_int = 2;
|
||||
pub const KERN_SYSVIPC_SHM_INFO: ::c_int = 3;
|
||||
pub const KERN_PROC_ARGV: ::c_int = 1;
|
||||
pub const KERN_PROC_NARGV: ::c_int = 2;
|
||||
pub const KERN_PROC_ENV: ::c_int = 3;
|
||||
pub const KERN_PROC_NENV: ::c_int = 4;
|
||||
pub const KI_NGROUPS: ::c_int = 16;
|
||||
pub const KI_MAXCOMLEN: ::c_int = 24;
|
||||
pub const KI_WMESGLEN: ::c_int = 8;
|
||||
pub const KI_MAXLOGNAME: ::c_int = 32;
|
||||
pub const KI_EMULNAMELEN: ::c_int = 8;
|
||||
|
||||
pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS;
|
||||
pub const OLCUC: ::tcflag_t = 0x20;
|
||||
pub const ONOCR: ::tcflag_t = 0x40;
|
||||
pub const ONLRET: ::tcflag_t = 0x80;
|
||||
|
||||
pub const SOCK_CLOEXEC: ::c_int = 0x8000;
|
||||
pub const SOCK_NONBLOCK: ::c_int = 0x4000;
|
||||
pub const SOCK_DNS: ::c_int = 0x1000;
|
||||
|
||||
f! {
|
||||
pub fn WIFCONTINUED(status: ::c_int) -> bool {
|
||||
status & 0o177777 == 0o177777
|
||||
}
|
||||
}
|
||||
|
||||
extern {
|
||||
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
|
||||
pub fn getnameinfo(sa: *const ::sockaddr,
|
||||
salen: ::socklen_t,
|
||||
host: *mut ::c_char,
|
||||
hostlen: ::size_t,
|
||||
serv: *mut ::c_char,
|
||||
servlen: ::size_t,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
pub fn kevent(kq: ::c_int,
|
||||
changelist: *const ::kevent,
|
||||
nchanges: ::c_int,
|
||||
eventlist: *mut ::kevent,
|
||||
nevents: ::c_int,
|
||||
timeout: *const ::timespec) -> ::c_int;
|
||||
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
|
||||
-> ::c_int;
|
||||
pub fn pthread_main_np() -> ::c_int;
|
||||
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
|
||||
pub fn pthread_stackseg_np(thread: ::pthread_t,
|
||||
sinfo: *mut ::stack_t) -> ::c_int;
|
||||
pub fn sysctl(name: *const ::c_int,
|
||||
namelen: ::c_uint,
|
||||
oldp: *mut ::c_void,
|
||||
oldlenp: *mut ::size_t,
|
||||
newp: *mut ::c_void,
|
||||
newlen: ::size_t)
|
||||
-> ::c_int;
|
||||
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
|
||||
pub fn pledge(promises: *const ::c_char,
|
||||
paths: *mut *const ::c_char) -> ::c_int;
|
||||
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
|
||||
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_os = "openbsd")] {
|
||||
mod openbsd;
|
||||
pub use self::openbsd::*;
|
||||
} else if #[cfg(target_os = "bitrig")] {
|
||||
mod bitrig;
|
||||
pub use self::bitrig::*;
|
||||
} else {
|
||||
// Unknown target_os
|
||||
}
|
||||
}
|
||||
|
||||
mod other;
|
||||
pub use self::other::*;
|
@ -1,35 +0,0 @@
|
||||
s! {
|
||||
pub struct lconv {
|
||||
pub decimal_point: *mut ::c_char,
|
||||
pub thousands_sep: *mut ::c_char,
|
||||
pub grouping: *mut ::c_char,
|
||||
pub int_curr_symbol: *mut ::c_char,
|
||||
pub currency_symbol: *mut ::c_char,
|
||||
pub mon_decimal_point: *mut ::c_char,
|
||||
pub mon_thousands_sep: *mut ::c_char,
|
||||
pub mon_grouping: *mut ::c_char,
|
||||
pub positive_sign: *mut ::c_char,
|
||||
pub negative_sign: *mut ::c_char,
|
||||
pub int_frac_digits: ::c_char,
|
||||
pub frac_digits: ::c_char,
|
||||
pub p_cs_precedes: ::c_char,
|
||||
pub p_sep_by_space: ::c_char,
|
||||
pub n_cs_precedes: ::c_char,
|
||||
pub n_sep_by_space: ::c_char,
|
||||
pub p_sign_posn: ::c_char,
|
||||
pub n_sign_posn: ::c_char,
|
||||
pub int_p_cs_precedes: ::c_char,
|
||||
pub int_p_sep_by_space: ::c_char,
|
||||
pub int_n_cs_precedes: ::c_char,
|
||||
pub int_n_sep_by_space: ::c_char,
|
||||
pub int_p_sign_posn: ::c_char,
|
||||
pub int_n_sign_posn: ::c_char,
|
||||
}
|
||||
}
|
||||
|
||||
extern {
|
||||
pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
|
||||
addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
|
||||
pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
|
||||
envp: *const *const ::c_char) -> ::c_int;
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
@ -1,2 +0,0 @@
|
||||
pub type c_long = i64;
|
||||
pub type c_ulong = u64;
|
@ -1,11 +0,0 @@
|
||||
cfg_if! {
|
||||
if #[cfg(target_arch = "x86_64")] {
|
||||
mod b64;
|
||||
pub use self::b64::*;
|
||||
} else if #[cfg(target_arch = "x86")] {
|
||||
mod b32;
|
||||
pub use self::b32::*;
|
||||
} else {
|
||||
// Unknown target_arch
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
@ -1,2 +0,0 @@
|
||||
pub type c_ulong = u64;
|
||||
pub type c_long = i64;
|
936
third_party/rust/libc-0.2.30/src/unix/haiku/mod.rs
vendored
936
third_party/rust/libc-0.2.30/src/unix/haiku/mod.rs
vendored
@ -1,936 +0,0 @@
|
||||
use dox::{mem, Option};
|
||||
|
||||
pub type rlim_t = ::uintptr_t;
|
||||
pub type sa_family_t = u8;
|
||||
pub type pthread_key_t = ::c_int;
|
||||
pub type nfds_t = ::c_long;
|
||||
pub type tcflag_t = ::c_uint;
|
||||
pub type speed_t = ::c_uint;
|
||||
pub type c_char = i8;
|
||||
pub type clock_t = i32;
|
||||
pub type clockid_t = i32;
|
||||
pub type time_t = i32;
|
||||
pub type suseconds_t = i32;
|
||||
pub type wchar_t = i32;
|
||||
pub type off_t = i64;
|
||||
pub type ino_t = i64;
|
||||
pub type blkcnt_t = i64;
|
||||
pub type blksize_t = i32;
|
||||
pub type dev_t = i32;
|
||||
pub type mode_t = u32;
|
||||
pub type nlink_t = i32;
|
||||
pub type useconds_t = u32;
|
||||
pub type socklen_t = u32;
|
||||
pub type pthread_t = ::uintptr_t;
|
||||
pub type pthread_mutexattr_t = ::uintptr_t;
|
||||
pub type pthread_rwlockattr_t = ::uintptr_t;
|
||||
pub type sigset_t = u64;
|
||||
pub type fsblkcnt_t = i64;
|
||||
pub type fsfilcnt_t = i64;
|
||||
pub type pthread_attr_t = *mut ::c_void;
|
||||
pub type nl_item = ::c_int;
|
||||
pub type id_t = i32;
|
||||
pub type idtype_t = ::c_uint;
|
||||
|
||||
pub enum timezone {}
|
||||
|
||||
s! {
|
||||
pub struct sockaddr {
|
||||
pub sa_len: u8,
|
||||
pub sa_family: sa_family_t,
|
||||
pub sa_data: [::c_char; 30],
|
||||
}
|
||||
|
||||
pub struct sockaddr_in {
|
||||
pub sin_len: u8,
|
||||
pub sin_family: sa_family_t,
|
||||
pub sin_port: ::in_port_t,
|
||||
pub sin_addr: ::in_addr,
|
||||
pub sin_zero: [u8; 24],
|
||||
}
|
||||
|
||||
pub struct sockaddr_in6 {
|
||||
pub sin6_len: u8,
|
||||
pub sin6_family: sa_family_t,
|
||||
pub sin6_port: ::in_port_t,
|
||||
pub sin6_flowinfo: u32,
|
||||
pub sin6_addr: ::in6_addr,
|
||||
pub sin6_scope_id: u32,
|
||||
}
|
||||
|
||||
pub struct sockaddr_un {
|
||||
pub sun_len: u8,
|
||||
pub sun_family: sa_family_t,
|
||||
pub sun_path: [::c_char; 126]
|
||||
}
|
||||
|
||||
pub struct sockaddr_storage {
|
||||
pub ss_len: u8,
|
||||
pub ss_family: sa_family_t,
|
||||
__ss_pad1: [u8; 6],
|
||||
__ss_pad2: u64,
|
||||
__ss_pad3: [u8; 112],
|
||||
}
|
||||
|
||||
pub struct addrinfo {
|
||||
pub ai_flags: ::c_int,
|
||||
pub ai_family: ::c_int,
|
||||
pub ai_socktype: ::c_int,
|
||||
pub ai_protocol: ::c_int,
|
||||
pub ai_addrlen: socklen_t,
|
||||
pub ai_canonname: *mut c_char,
|
||||
pub ai_addr: *mut ::sockaddr,
|
||||
pub ai_next: *mut addrinfo,
|
||||
}
|
||||
|
||||
pub struct fd_set {
|
||||
fds_bits: [c_ulong; FD_SETSIZE / ULONG_SIZE],
|
||||
}
|
||||
|
||||
pub struct tm {
|
||||
pub tm_sec: ::c_int,
|
||||
pub tm_min: ::c_int,
|
||||
pub tm_hour: ::c_int,
|
||||
pub tm_mday: ::c_int,
|
||||
pub tm_mon: ::c_int,
|
||||
pub tm_year: ::c_int,
|
||||
pub tm_wday: ::c_int,
|
||||
pub tm_yday: ::c_int,
|
||||
pub tm_isdst: ::c_int,
|
||||
pub tm_gmtoff: ::c_long,
|
||||
pub tm_zone: *const ::c_char,
|
||||
}
|
||||
|
||||
pub struct utsname {
|
||||
pub sysname: [::c_char; 32],
|
||||
pub nodename: [::c_char; 32],
|
||||
pub release: [::c_char; 32],
|
||||
pub version: [::c_char; 32],
|
||||
pub machine: [::c_char; 32],
|
||||
}
|
||||
|
||||
pub struct lconv {
|
||||
pub decimal_point: *mut ::c_char,
|
||||
pub thousands_sep: *mut ::c_char,
|
||||
pub grouping: *mut ::c_char,
|
||||
pub int_curr_symbol: *mut ::c_char,
|
||||
pub currency_symbol: *mut ::c_char,
|
||||
pub mon_decimal_point: *mut ::c_char,
|
||||
pub mon_thousands_sep: *mut ::c_char,
|
||||
pub mon_grouping: *mut ::c_char,
|
||||
pub positive_sign: *mut ::c_char,
|
||||
pub negative_sign: *mut ::c_char,
|
||||
pub int_frac_digits: ::c_char,
|
||||
pub frac_digits: ::c_char,
|
||||
pub p_cs_precedes: ::c_char,
|
||||
pub p_sep_by_space: ::c_char,
|
||||
pub n_cs_precedes: ::c_char,
|
||||
pub n_sep_by_space: ::c_char,
|
||||
pub p_sign_posn: ::c_char,
|
||||
pub n_sign_posn: ::c_char,
|
||||
pub int_p_cs_precedes: ::c_char,
|
||||
pub int_p_sep_by_space: ::c_char,
|
||||
pub int_n_cs_precedes: ::c_char,
|
||||
pub int_n_sep_by_space: ::c_char,
|
||||
pub int_p_sign_posn: ::c_char,
|
||||
pub int_n_sign_posn: ::c_char,
|
||||
}
|
||||
|
||||
pub struct msghdr {
|
||||
pub msg_name: *mut ::c_void,
|
||||
pub msg_namelen: ::socklen_t,
|
||||
pub msg_iov: *mut ::iovec,
|
||||
pub msg_iovlen: ::c_int,
|
||||
pub msg_control: *mut ::c_void,
|
||||
pub msg_controllen: ::socklen_t,
|
||||
pub msg_flags: ::c_int,
|
||||
}
|
||||
|
||||
pub struct cmsghdr {
|
||||
pub cmsg_len: ::size_t,
|
||||
pub cmsg_level: ::c_int,
|
||||
pub cmsg_type: ::c_int,
|
||||
}
|
||||
|
||||
pub struct Dl_info {
|
||||
pub dli_fname: *const ::c_char,
|
||||
pub dli_fbase: *mut ::c_void,
|
||||
pub dli_sname: *const ::c_char,
|
||||
pub dli_saddr: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct termios {
|
||||
pub c_iflag: ::tcflag_t,
|
||||
pub c_oflag: ::tcflag_t,
|
||||
pub c_cflag: ::tcflag_t,
|
||||
pub c_lflag: ::tcflag_t,
|
||||
pub c_line: ::c_char,
|
||||
pub c_ispeed: ::speed_t,
|
||||
pub c_ospeed: ::speed_t,
|
||||
pub c_cc: [::cc_t; ::NCCS],
|
||||
}
|
||||
|
||||
pub struct stat {
|
||||
pub st_dev: dev_t,
|
||||
pub st_ino: ino_t,
|
||||
pub st_mode: mode_t,
|
||||
pub st_nlink: nlink_t,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_size: off_t,
|
||||
pub st_rdev: dev_t,
|
||||
pub st_blksize: blksize_t,
|
||||
pub st_atime: time_t,
|
||||
pub st_atime_nsec: c_long,
|
||||
pub st_mtime: time_t,
|
||||
pub st_mtime_nsec: c_long,
|
||||
pub st_ctime: time_t,
|
||||
pub st_ctime_nsec: c_long,
|
||||
pub st_crtime: time_t,
|
||||
pub st_crtime_nsec: c_long,
|
||||
pub st_type: u32,
|
||||
pub st_blocks: blkcnt_t,
|
||||
}
|
||||
|
||||
pub struct dirent {
|
||||
pub d_dev: dev_t,
|
||||
pub d_pdev: dev_t,
|
||||
pub d_ino: ino_t,
|
||||
pub d_pino: i64,
|
||||
pub d_reclen: ::c_ushort,
|
||||
pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
|
||||
}
|
||||
|
||||
pub struct glob_t {
|
||||
pub gl_pathc: ::size_t,
|
||||
__unused1: ::size_t,
|
||||
pub gl_offs: ::size_t,
|
||||
__unused2: ::size_t,
|
||||
pub gl_pathv: *mut *mut c_char,
|
||||
|
||||
__unused3: *mut ::c_void,
|
||||
__unused4: *mut ::c_void,
|
||||
__unused5: *mut ::c_void,
|
||||
__unused6: *mut ::c_void,
|
||||
__unused7: *mut ::c_void,
|
||||
__unused8: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct pthread_mutex_t {
|
||||
flags: u32,
|
||||
lock: i32,
|
||||
unused: i32,
|
||||
owner: i32,
|
||||
owner_count: i32,
|
||||
}
|
||||
|
||||
pub struct pthread_cond_t {
|
||||
flags: u32,
|
||||
unused: i32,
|
||||
mutex: *mut ::c_void,
|
||||
waiter_count: i32,
|
||||
lock: i32,
|
||||
}
|
||||
|
||||
pub struct pthread_rwlock_t {
|
||||
flags: u32,
|
||||
owner: i32,
|
||||
lock_sem: i32, // this is actually a union
|
||||
lock_count: i32,
|
||||
reader_count: i32,
|
||||
writer_count: i32,
|
||||
waiters: [*mut ::c_void; 2],
|
||||
}
|
||||
|
||||
pub struct passwd {
|
||||
pub pw_name: *mut ::c_char,
|
||||
pub pw_passwd: *mut ::c_char,
|
||||
pub pw_uid: ::uid_t,
|
||||
pub pw_gid: ::gid_t,
|
||||
pub pw_dir: *mut ::c_char,
|
||||
pub pw_shell: *mut ::c_char,
|
||||
pub pw_gecos: *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct statvfs {
|
||||
pub f_bsize: ::c_ulong,
|
||||
pub f_frsize: ::c_ulong,
|
||||
pub f_blocks: ::fsblkcnt_t,
|
||||
pub f_bfree: ::fsblkcnt_t,
|
||||
pub f_bavail: ::fsblkcnt_t,
|
||||
pub f_files: ::fsfilcnt_t,
|
||||
pub f_ffree: ::fsfilcnt_t,
|
||||
pub f_favail: ::fsfilcnt_t,
|
||||
pub f_fsid: ::c_ulong,
|
||||
pub f_flag: ::c_ulong,
|
||||
pub f_namemax: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct stack_t {
|
||||
pub ss_sp: *mut ::c_void,
|
||||
pub ss_size: ::size_t,
|
||||
pub ss_flags: ::c_int,
|
||||
}
|
||||
|
||||
pub struct siginfo_t {
|
||||
pub si_signo: ::c_int,
|
||||
pub si_code: ::c_int,
|
||||
pub si_errno: ::c_int,
|
||||
pub si_pid: ::pid_t,
|
||||
pub si_uid: ::uid_t,
|
||||
pub si_addr: *mut ::c_void,
|
||||
pub si_status: ::c_int,
|
||||
pub si_band: c_long,
|
||||
pub sigval: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct sigaction {
|
||||
pub sa_sigaction: ::sighandler_t,
|
||||
pub sa_mask: ::sigset_t,
|
||||
pub sa_flags: ::c_int,
|
||||
sa_userdata: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct sem_t {
|
||||
pub se_type: i32,
|
||||
pub se_named_id: i32, // this is actually a union
|
||||
pub se_unnamed: i32,
|
||||
pub se_padding: [i32; 4],
|
||||
}
|
||||
|
||||
pub struct pthread_condattr_t {
|
||||
pub process_shared: bool,
|
||||
pub clock_id: i32,
|
||||
}
|
||||
}
|
||||
|
||||
// intentionally not public, only used for fd_set
|
||||
cfg_if! {
|
||||
if #[cfg(target_pointer_width = "32")] {
|
||||
const ULONG_SIZE: usize = 32;
|
||||
} else if #[cfg(target_pointer_width = "64")] {
|
||||
const ULONG_SIZE: usize = 64;
|
||||
} else {
|
||||
// Unknown target_pointer_width
|
||||
}
|
||||
}
|
||||
|
||||
pub const EXIT_FAILURE: ::c_int = 1;
|
||||
pub const EXIT_SUCCESS: ::c_int = 0;
|
||||
pub const RAND_MAX: ::c_int = 2147483647;
|
||||
pub const EOF: ::c_int = -1;
|
||||
pub const SEEK_SET: ::c_int = 0;
|
||||
pub const SEEK_CUR: ::c_int = 1;
|
||||
pub const SEEK_END: ::c_int = 2;
|
||||
pub const _IOFBF: ::c_int = 0;
|
||||
pub const _IONBF: ::c_int = 2;
|
||||
pub const _IOLBF: ::c_int = 1;
|
||||
|
||||
pub const F_DUPFD: ::c_int = 0x0001;
|
||||
pub const F_GETFD: ::c_int = 0x0002;
|
||||
pub const F_SETFD: ::c_int = 0x0004;
|
||||
pub const F_GETFL: ::c_int = 0x0008;
|
||||
pub const F_SETFL: ::c_int = 0x0010;
|
||||
|
||||
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
|
||||
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
|
||||
|
||||
pub const CLOCK_REALTIME: ::c_int = -1;
|
||||
pub const CLOCK_MONOTONIC: ::c_int = 0;
|
||||
|
||||
pub const RLIMIT_CORE: ::c_int = 0;
|
||||
pub const RLIMIT_CPU: ::c_int = 1;
|
||||
pub const RLIMIT_DATA: ::c_int = 2;
|
||||
pub const RLIMIT_FSIZE: ::c_int = 3;
|
||||
pub const RLIMIT_NOFILE: ::c_int = 4;
|
||||
pub const RLIMIT_AS: ::c_int = 6;
|
||||
// Haiku specific
|
||||
pub const RLIMIT_NOVMON: ::c_int = 7;
|
||||
pub const RLIMIT_NLIMITS: ::c_int = 8;
|
||||
|
||||
pub const RUSAGE_SELF: ::c_int = 0;
|
||||
|
||||
pub const NCCS: usize = 11;
|
||||
|
||||
pub const O_RDONLY: ::c_int = 0x0000;
|
||||
pub const O_WRONLY: ::c_int = 0x0001;
|
||||
pub const O_RDWR: ::c_int = 0x0002;
|
||||
pub const O_ACCMODE: ::c_int = 0x0003;
|
||||
|
||||
pub const O_EXCL: ::c_int = 0x0100;
|
||||
pub const O_CREAT: ::c_int = 0x0200;
|
||||
pub const O_TRUNC: ::c_int = 0x0400;
|
||||
pub const O_NOCTTY: ::c_int = 0x1000;
|
||||
pub const O_NOTRAVERSE: ::c_int = 0x2000;
|
||||
|
||||
pub const O_CLOEXEC: ::c_int = 0x00000040;
|
||||
pub const O_NONBLOCK: ::c_int = 0x00000080;
|
||||
pub const O_APPEND: ::c_int = 0x00000800;
|
||||
pub const O_SYNC: ::c_int = 0x00010000;
|
||||
pub const O_RSYNC: ::c_int = 0x00020000;
|
||||
pub const O_DSYNC: ::c_int = 0x00040000;
|
||||
pub const O_NOFOLLOW: ::c_int = 0x00080000;
|
||||
pub const O_NOCACHE: ::c_int = 0x00100000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x00200000;
|
||||
|
||||
pub const S_IFIFO: ::mode_t = 61440;
|
||||
pub const S_IFCHR: ::mode_t = 49152;
|
||||
pub const S_IFBLK: ::mode_t = 24576;
|
||||
pub const S_IFDIR: ::mode_t = 16384;
|
||||
pub const S_IFREG: ::mode_t = 32768;
|
||||
pub const S_IFLNK: ::mode_t = 40960;
|
||||
pub const S_IFSOCK: ::mode_t = 49152;
|
||||
pub const S_IFMT: ::mode_t = 61440;
|
||||
pub const S_IRWXU: ::mode_t = 448;
|
||||
pub const S_IXUSR: ::mode_t = 64;
|
||||
pub const S_IWUSR: ::mode_t = 128;
|
||||
pub const S_IRUSR: ::mode_t = 256;
|
||||
pub const S_IRWXG: ::mode_t = 70;
|
||||
pub const S_IXGRP: ::mode_t = 10;
|
||||
pub const S_IWGRP: ::mode_t = 20;
|
||||
pub const S_IRGRP: ::mode_t = 40;
|
||||
pub const S_IRWXO: ::mode_t = 7;
|
||||
pub const S_IXOTH: ::mode_t = 1;
|
||||
pub const S_IWOTH: ::mode_t = 2;
|
||||
pub const S_IROTH: ::mode_t = 4;
|
||||
pub const F_OK: ::c_int = 0;
|
||||
pub const R_OK: ::c_int = 4;
|
||||
pub const W_OK: ::c_int = 2;
|
||||
pub const X_OK: ::c_int = 1;
|
||||
pub const STDIN_FILENO: ::c_int = 0;
|
||||
pub const STDOUT_FILENO: ::c_int = 1;
|
||||
pub const STDERR_FILENO: ::c_int = 2;
|
||||
|
||||
pub const SIGHUP: ::c_int = 1;
|
||||
pub const SIGINT: ::c_int = 2;
|
||||
pub const SIGQUIT: ::c_int = 3;
|
||||
pub const SIGILL: ::c_int = 4;
|
||||
pub const SIGCHLD: ::c_int = 5;
|
||||
pub const SIGABRT: ::c_int = 6;
|
||||
pub const SIGPIPE: ::c_int = 7;
|
||||
pub const SIGFPE: ::c_int = 8;
|
||||
pub const SIGKILL: ::c_int = 9;
|
||||
pub const SIGSTOP: ::c_int = 10;
|
||||
pub const SIGSEGV: ::c_int = 11;
|
||||
pub const SIGCONT: ::c_int = 12;
|
||||
pub const SIGTSTP: ::c_int = 13;
|
||||
pub const SIGALRM: ::c_int = 14;
|
||||
pub const SIGTERM: ::c_int = 15;
|
||||
pub const SIGTTIN: ::c_int = 16;
|
||||
pub const SIGTTOU: ::c_int = 17;
|
||||
pub const SIGUSR1: ::c_int = 18;
|
||||
pub const SIGUSR2: ::c_int = 19;
|
||||
pub const SIGWINCH: ::c_int = 20;
|
||||
pub const SIGKILLTHR: ::c_int = 21;
|
||||
pub const SIGTRAP: ::c_int = 22;
|
||||
pub const SIGPOLL: ::c_int = 23;
|
||||
pub const SIGPROF: ::c_int = 24;
|
||||
pub const SIGSYS: ::c_int = 25;
|
||||
pub const SIGURG: ::c_int = 26;
|
||||
pub const SIGVTALRM: ::c_int = 27;
|
||||
pub const SIGXCPU: ::c_int = 28;
|
||||
pub const SIGXFSZ: ::c_int = 29;
|
||||
pub const SIGBUS: ::c_int = 30;
|
||||
|
||||
pub const EAI_SYSTEM: ::c_int = 11;
|
||||
|
||||
pub const PROT_NONE: ::c_int = 0;
|
||||
pub const PROT_READ: ::c_int = 1;
|
||||
pub const PROT_WRITE: ::c_int = 2;
|
||||
pub const PROT_EXEC: ::c_int = 4;
|
||||
|
||||
pub const LC_ALL: ::c_int = 0;
|
||||
pub const LC_COLLATE: ::c_int = 1;
|
||||
pub const LC_CTYPE: ::c_int = 2;
|
||||
pub const LC_MONETARY: ::c_int = 3;
|
||||
pub const LC_NUMERIC: ::c_int = 4;
|
||||
pub const LC_TIME: ::c_int = 5;
|
||||
pub const LC_MESSAGES: ::c_int = 6;
|
||||
|
||||
// TODO: Haiku does not have MAP_FILE, but libstd/os.rs requires it
|
||||
pub const MAP_FILE: ::c_int = 0x00;
|
||||
pub const MAP_SHARED: ::c_int = 0x01;
|
||||
pub const MAP_PRIVATE: ::c_int = 0x02;
|
||||
pub const MAP_FIXED: ::c_int = 0x004;
|
||||
|
||||
pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
|
||||
|
||||
pub const MS_ASYNC: ::c_int = 0x01;
|
||||
pub const MS_INVALIDATE: ::c_int = 0x04;
|
||||
pub const MS_SYNC: ::c_int = 0x02;
|
||||
|
||||
pub const EPERM : ::c_int = -2147483633;
|
||||
pub const ENOENT : ::c_int = -2147459069;
|
||||
pub const ESRCH : ::c_int = -2147454963;
|
||||
pub const EINTR : ::c_int = -2147483638;
|
||||
pub const EIO : ::c_int = -2147483647;
|
||||
pub const ENXIO : ::c_int = -2147454965;
|
||||
pub const E2BIG : ::c_int = -2147454975;
|
||||
pub const ENOEXEC : ::c_int = -2147478782;
|
||||
pub const EBADF : ::c_int = -2147459072;
|
||||
pub const ECHILD : ::c_int = -2147454974;
|
||||
pub const EDEADLK : ::c_int = -2147454973;
|
||||
pub const ENOMEM : ::c_int = -2147454976;
|
||||
pub const EACCES : ::c_int = -2147483646;
|
||||
pub const EFAULT : ::c_int = -2147478783;
|
||||
// pub const ENOTBLK : ::c_int = 15;
|
||||
pub const EBUSY : ::c_int = -2147483634;
|
||||
pub const EEXIST : ::c_int = -2147459070;
|
||||
pub const EXDEV : ::c_int = -2147459061;
|
||||
pub const ENODEV : ::c_int = -2147454969;
|
||||
pub const ENOTDIR : ::c_int = -2147459067;
|
||||
pub const EISDIR : ::c_int = -2147459063;
|
||||
pub const EINVAL : ::c_int = -2147483643;
|
||||
pub const ENFILE : ::c_int = -2147454970;
|
||||
pub const EMFILE : ::c_int = -2147459062;
|
||||
pub const ENOTTY : ::c_int = -2147454966;
|
||||
pub const ETXTBSY : ::c_int = -2147454917;
|
||||
pub const EFBIG : ::c_int = -2147454972;
|
||||
pub const ENOSPC : ::c_int = -2147459065;
|
||||
pub const ESPIPE : ::c_int = -2147454964;
|
||||
pub const EROFS : ::c_int = -2147459064;
|
||||
pub const EMLINK : ::c_int = -2147454971;
|
||||
pub const EPIPE : ::c_int = -2147459059;
|
||||
pub const EDOM : ::c_int = -2147454960;
|
||||
pub const ERANGE : ::c_int = -2147454959;
|
||||
pub const EAGAIN : ::c_int = -2147483637;
|
||||
pub const EWOULDBLOCK : ::c_int = -2147483637;
|
||||
|
||||
pub const EINPROGRESS : ::c_int = -2147454940;
|
||||
pub const EALREADY : ::c_int = -2147454939;
|
||||
pub const ENOTSOCK : ::c_int = -2147454932;
|
||||
pub const EDESTADDRREQ : ::c_int = -2147454928;
|
||||
pub const EMSGSIZE : ::c_int = -2147454934;
|
||||
pub const EPROTOTYPE : ::c_int = -2147454958;
|
||||
pub const ENOPROTOOPT : ::c_int = -2147454942;
|
||||
pub const EPROTONOSUPPORT : ::c_int = -2147454957;
|
||||
pub const EOPNOTSUPP : ::c_int = -2147454933;
|
||||
pub const EPFNOSUPPORT : ::c_int = -2147454956;
|
||||
pub const EAFNOSUPPORT : ::c_int = -2147454955;
|
||||
pub const EADDRINUSE : ::c_int = -2147454954;
|
||||
pub const EADDRNOTAVAIL : ::c_int = -2147454953;
|
||||
pub const ENETDOWN : ::c_int = -2147454953;
|
||||
pub const ENETUNREACH : ::c_int = -2147454951;
|
||||
pub const ENETRESET : ::c_int = -2147454950;
|
||||
pub const ECONNABORTED : ::c_int = -2147454949;
|
||||
pub const ECONNRESET : ::c_int = -2147454948;
|
||||
pub const ENOBUFS : ::c_int = -2147454941;
|
||||
pub const EISCONN : ::c_int = -2147454947;
|
||||
pub const ENOTCONN : ::c_int = -2147454946;
|
||||
pub const ESHUTDOWN : ::c_int = -2147454945;
|
||||
pub const ETIMEDOUT : ::c_int = -2147483639;
|
||||
pub const ECONNREFUSED : ::c_int = -2147454944;
|
||||
pub const ELOOP : ::c_int = -2147459060;
|
||||
pub const ENAMETOOLONG : ::c_int = -2147459068;
|
||||
pub const EHOSTDOWN : ::c_int = -2147454931;
|
||||
pub const EHOSTUNREACH : ::c_int = -2147454943;
|
||||
pub const ENOTEMPTY : ::c_int = -2147459066;
|
||||
pub const EDQUOT : ::c_int = -2147454927;
|
||||
pub const ESTALE : ::c_int = -2147454936;
|
||||
pub const ENOLCK : ::c_int = -2147454968;
|
||||
pub const ENOSYS : ::c_int = -2147454967;
|
||||
pub const EIDRM : ::c_int = -2147454926;
|
||||
pub const ENOMSG : ::c_int = -2147454937;
|
||||
pub const EOVERFLOW : ::c_int = -2147454935;
|
||||
pub const ECANCELED : ::c_int = -2147454929;
|
||||
pub const EILSEQ : ::c_int = -2147454938;
|
||||
pub const ENOATTR : ::c_int = -2147454916;
|
||||
pub const EBADMSG : ::c_int = -2147454930;
|
||||
pub const EMULTIHOP : ::c_int = -2147454925;
|
||||
pub const ENOLINK : ::c_int = -2147454923;
|
||||
pub const EPROTO : ::c_int = -2147454919;
|
||||
|
||||
pub const IPPROTO_RAW: ::c_int = 255;
|
||||
|
||||
// These are prefixed with POSIX_ on Haiku
|
||||
pub const MADV_NORMAL: ::c_int = 1;
|
||||
pub const MADV_SEQUENTIAL: ::c_int = 2;
|
||||
pub const MADV_RANDOM: ::c_int = 3;
|
||||
pub const MADV_WILLNEED: ::c_int = 4;
|
||||
pub const MADV_DONTNEED: ::c_int = 5;
|
||||
|
||||
pub const IFF_LOOPBACK: ::c_int = 0x0008;
|
||||
|
||||
pub const AF_UNIX: ::c_int = 9;
|
||||
pub const AF_INET: ::c_int = 1;
|
||||
pub const AF_INET6: ::c_int = 6;
|
||||
pub const SOCK_RAW: ::c_int = 3;
|
||||
pub const IP_MULTICAST_TTL: ::c_int = 10;
|
||||
pub const IP_MULTICAST_LOOP: ::c_int = 11;
|
||||
pub const IP_TTL: ::c_int = 4;
|
||||
pub const IP_HDRINCL: ::c_int = 2;
|
||||
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
|
||||
pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
|
||||
|
||||
pub const TCP_NODELAY: ::c_int = 0x01;
|
||||
pub const TCP_MAXSEG: ::c_int = 0x02;
|
||||
pub const TCP_NOPUSH: ::c_int = 0x04;
|
||||
pub const TCP_NOOPT: ::c_int = 0x08;
|
||||
|
||||
pub const IPV6_MULTICAST_LOOP: ::c_int = 26;
|
||||
pub const IPV6_JOIN_GROUP: ::c_int = 28;
|
||||
pub const IPV6_LEAVE_GROUP: ::c_int = 29;
|
||||
pub const IPV6_V6ONLY: ::c_int = 30;
|
||||
|
||||
pub const SO_DEBUG: ::c_int = 0x00000004;
|
||||
|
||||
pub const MSG_PEEK: ::c_int = 0x2;
|
||||
pub const MSG_NOSIGNAL: ::c_int = 0x0800;
|
||||
|
||||
pub const SHUT_RD: ::c_int = 0;
|
||||
pub const SHUT_WR: ::c_int = 1;
|
||||
pub const SHUT_RDWR: ::c_int = 2;
|
||||
|
||||
pub const LOCK_SH: ::c_int = 0x01;
|
||||
pub const LOCK_EX: ::c_int = 0x02;
|
||||
pub const LOCK_NB: ::c_int = 0x04;
|
||||
pub const LOCK_UN: ::c_int = 0x08;
|
||||
|
||||
pub const SIGSTKSZ: ::size_t = 16384;
|
||||
|
||||
pub const SA_NODEFER: ::c_int = 0x08;
|
||||
pub const SA_RESETHAND: ::c_int = 0x04;
|
||||
pub const SA_RESTART: ::c_int = 0x10;
|
||||
pub const SA_NOCLDSTOP: ::c_int = 0x01;
|
||||
|
||||
pub const FD_SETSIZE: usize = 1024;
|
||||
|
||||
pub const RTLD_NOW: ::c_int = 0x1;
|
||||
pub const RTLD_DEFAULT: *mut ::c_void = 0isize as *mut ::c_void;
|
||||
|
||||
pub const BUFSIZ: ::c_uint = 8192;
|
||||
pub const FILENAME_MAX: ::c_uint = 256;
|
||||
pub const FOPEN_MAX: ::c_uint = 128;
|
||||
pub const L_tmpnam: ::c_uint = 512;
|
||||
pub const TMP_MAX: ::c_uint = 32768;
|
||||
pub const _PC_NAME_MAX: ::c_int = 4;
|
||||
|
||||
pub const FIONBIO: ::c_int = 0xbe000000;
|
||||
|
||||
pub const _SC_IOV_MAX : ::c_int = 32;
|
||||
pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 25;
|
||||
pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 26;
|
||||
pub const _SC_PAGESIZE : ::c_int = 27;
|
||||
pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 48;
|
||||
pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 49;
|
||||
pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 50;
|
||||
pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 46;
|
||||
pub const _SC_THREAD_STACK_MIN : ::c_int = 47;
|
||||
pub const _SC_THREADS : ::c_int = 31;
|
||||
pub const _SC_ATEXIT_MAX : ::c_int = 37;
|
||||
|
||||
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
|
||||
|
||||
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
|
||||
flags: 0,
|
||||
lock: 0,
|
||||
unused: -42,
|
||||
owner: -1,
|
||||
owner_count: 0,
|
||||
};
|
||||
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
|
||||
flags: 0,
|
||||
unused: -42,
|
||||
mutex: 0 as *mut _,
|
||||
waiter_count: 0,
|
||||
lock: 0,
|
||||
};
|
||||
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
|
||||
flags: 0,
|
||||
owner: 0,
|
||||
lock_sem: 0,
|
||||
lock_count: 0,
|
||||
reader_count: 0,
|
||||
writer_count: 0,
|
||||
waiters: [0 as *mut _; 2],
|
||||
};
|
||||
|
||||
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = 0;
|
||||
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1;
|
||||
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
|
||||
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
|
||||
|
||||
pub const FIOCLEX: c_ulong = 0; // TODO: does not exist on Haiku!
|
||||
|
||||
pub const SA_ONSTACK: c_ulong = 0x20;
|
||||
pub const SA_SIGINFO: c_ulong = 0x40;
|
||||
pub const SA_NOCLDWAIT: c_ulong = 0x02;
|
||||
|
||||
pub const SIG_SETMASK: ::c_int = 3;
|
||||
|
||||
pub const RUSAGE_CHILDREN: ::c_int = -1;
|
||||
|
||||
pub const SOCK_STREAM: ::c_int = 1;
|
||||
pub const SOCK_DGRAM: ::c_int = 2;
|
||||
|
||||
pub const SOL_SOCKET: ::c_int = -1;
|
||||
pub const SO_ACCEPTCONN: ::c_int = 0x00000001;
|
||||
pub const SO_BROADCAST: ::c_int = 0x00000002;
|
||||
pub const SO_DONTROUTE: ::c_int = 0x00000008;
|
||||
pub const SO_KEEPALIVE: ::c_int = 0x00000010;
|
||||
pub const SO_OOBINLINE: ::c_int = 0x00000020;
|
||||
pub const SO_REUSEADDR: ::c_int = 0x00000040;
|
||||
pub const SO_REUSEPORT: ::c_int = 0x00000080;
|
||||
pub const SO_USELOOPBACK: ::c_int = 0x00000100;
|
||||
pub const SO_LINGER: ::c_int = 0x00000200;
|
||||
pub const SO_SNDBUF: ::c_int = 0x40000001;
|
||||
pub const SO_SNDLOWAT: ::c_int = 0x40000002;
|
||||
pub const SO_SNDTIMEO: ::c_int = 0x40000003;
|
||||
pub const SO_RCVBUF: ::c_int = 0x40000004;
|
||||
pub const SO_RCVLOWAT: ::c_int = 0x40000005;
|
||||
pub const SO_RCVTIMEO: ::c_int = 0x40000006;
|
||||
pub const SO_ERROR: ::c_int = 0x40000007;
|
||||
pub const SO_TYPE: ::c_int = 0x40000008;
|
||||
pub const SO_NONBLOCK: ::c_int = 0x40000009;
|
||||
pub const SO_BINDTODEVICE: ::c_int = 0x4000000a;
|
||||
pub const SO_PEERCRED: ::c_int = 0x4000000b;
|
||||
|
||||
pub const NI_MAXHOST: ::size_t = 1025;
|
||||
|
||||
pub const WNOHANG: ::c_int = 0x01;
|
||||
pub const WUNTRACED: ::c_int = 0x02;
|
||||
pub const WCONTINUED: ::c_int = 0x04;
|
||||
pub const WEXITED: ::c_int = 0x08;
|
||||
pub const WSTOPPED: ::c_int = 0x10;
|
||||
pub const WNOWAIT: ::c_int = 0x20;
|
||||
|
||||
pub const P_ALL: idtype_t = 0;
|
||||
pub const P_PID: idtype_t = 1;
|
||||
pub const P_PGID: idtype_t = 2;
|
||||
|
||||
pub const VINTR: usize = 0;
|
||||
pub const VQUIT: usize = 1;
|
||||
pub const VERASE: usize = 2;
|
||||
pub const VKILL: usize = 3;
|
||||
pub const VEOF: usize = 4;
|
||||
pub const VEOL: usize = 5;
|
||||
pub const VMIN: usize = 4;
|
||||
pub const VTIME: usize = 5;
|
||||
pub const VEOL2: usize = 6;
|
||||
pub const VSWTCH: usize = 7;
|
||||
pub const VSTART: usize = 8;
|
||||
pub const VSTOP: usize = 9;
|
||||
pub const VSUSP: usize = 10;
|
||||
pub const OLCUC: ::tcflag_t = 0o000002;
|
||||
pub const OCRNL: ::tcflag_t = 0o000010;
|
||||
pub const ONOCR: ::tcflag_t = 0o000020;
|
||||
pub const ONLRET: ::tcflag_t = 0o000040;
|
||||
pub const OFILL: ::tcflag_t = 0o000100;
|
||||
pub const OFDEL: ::tcflag_t = 0o000200;
|
||||
pub const NLDLY: ::tcflag_t = 0o000400;
|
||||
pub const NL0: ::tcflag_t = 0o000000;
|
||||
pub const NL1: ::tcflag_t = 0o000400;
|
||||
pub const CRDLY: ::tcflag_t = 0o003000;
|
||||
pub const CR0: ::tcflag_t = 0o000000;
|
||||
pub const CR1: ::tcflag_t = 0o001000;
|
||||
pub const CR2: ::tcflag_t = 0o002000;
|
||||
pub const CR3: ::tcflag_t = 0o003000;
|
||||
pub const TABDLY: ::tcflag_t = 0o014000;
|
||||
pub const TAB0: ::tcflag_t = 0o000000;
|
||||
pub const TAB1: ::tcflag_t = 0o004000;
|
||||
pub const TAB2: ::tcflag_t = 0o010000;
|
||||
pub const TAB3: ::tcflag_t = 0o014000;
|
||||
pub const BSDLY: ::tcflag_t = 0o020000;
|
||||
pub const BS0: ::tcflag_t = 0o000000;
|
||||
pub const BS1: ::tcflag_t = 0o020000;
|
||||
pub const FFDLY: ::tcflag_t = 0o100000;
|
||||
pub const FF0: ::tcflag_t = 0o000000;
|
||||
pub const FF1: ::tcflag_t = 0o100000;
|
||||
pub const VTDLY: ::tcflag_t = 0o040000;
|
||||
pub const VT0: ::tcflag_t = 0o000000;
|
||||
pub const VT1: ::tcflag_t = 0o040000;
|
||||
|
||||
pub const TCGB_CTS: ::c_int = 0x01;
|
||||
pub const TCGB_DSR: ::c_int = 0x02;
|
||||
pub const TCGB_RI: ::c_int = 0x04;
|
||||
pub const TCGB_DCD: ::c_int = 0x08;
|
||||
pub const TIOCM_CTS: ::c_int = TCGB_CTS;
|
||||
pub const TIOCM_CD: ::c_int = TCGB_DCD;
|
||||
pub const TIOCM_CAR: ::c_int = TIOCM_CD;
|
||||
pub const TIOCM_RI: ::c_int = TCGB_RI;
|
||||
pub const TIOCM_DSR: ::c_int = TCGB_DSR;
|
||||
pub const TIOCM_DTR: ::c_int = 0x10;
|
||||
pub const TIOCM_RTS: ::c_int = 0x20;
|
||||
|
||||
f! {
|
||||
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
|
||||
let fd = fd as usize;
|
||||
let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
(*set).fds_bits[fd / size] &= !(1 << (fd % size));
|
||||
return
|
||||
}
|
||||
|
||||
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
|
||||
let fd = fd as usize;
|
||||
let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
|
||||
}
|
||||
|
||||
pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
|
||||
let fd = fd as usize;
|
||||
let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
(*set).fds_bits[fd / size] |= 1 << (fd % size);
|
||||
return
|
||||
}
|
||||
|
||||
pub fn FD_ZERO(set: *mut fd_set) -> () {
|
||||
for slot in (*set).fds_bits.iter_mut() {
|
||||
*slot = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn WIFEXITED(status: ::c_int) -> bool {
|
||||
(status >> 8) == 0
|
||||
}
|
||||
|
||||
pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
|
||||
(status & 0xff)
|
||||
}
|
||||
|
||||
pub fn WTERMSIG(status: ::c_int) -> ::c_int {
|
||||
(status >> 8) & 0xff
|
||||
}
|
||||
}
|
||||
|
||||
extern {
|
||||
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
|
||||
pub fn clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int;
|
||||
pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
|
||||
guardsize: *mut ::size_t) -> ::c_int;
|
||||
pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
|
||||
stackaddr: *mut *mut ::c_void,
|
||||
stacksize: *mut ::size_t) -> ::c_int;
|
||||
pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
|
||||
clock_id: *mut clockid_t) -> ::c_int;
|
||||
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
|
||||
clock_id: ::clockid_t) -> ::c_int;
|
||||
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
|
||||
pub fn setgroups(ngroups: ::size_t,
|
||||
ptr: *const ::gid_t) -> ::c_int;
|
||||
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
|
||||
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
|
||||
-> ::c_int;
|
||||
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
|
||||
pub fn getnameinfo(sa: *const ::sockaddr,
|
||||
salen: ::socklen_t,
|
||||
host: *mut ::c_char,
|
||||
hostlen: ::size_t,
|
||||
serv: *mut ::c_char,
|
||||
sevlen: ::size_t,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
|
||||
abstime: *const ::timespec) -> ::c_int;
|
||||
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
|
||||
options: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
|
||||
pub fn glob(pattern: *const ::c_char,
|
||||
flags: ::c_int,
|
||||
errfunc: Option<extern fn(epath: *const ::c_char,
|
||||
errno: ::c_int) -> ::c_int>,
|
||||
pglob: *mut ::glob_t) -> ::c_int;
|
||||
pub fn globfree(pglob: *mut ::glob_t);
|
||||
|
||||
pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
|
||||
-> ::c_int;
|
||||
|
||||
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
|
||||
|
||||
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
|
||||
|
||||
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
|
||||
pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
|
||||
-> ::c_int;
|
||||
|
||||
pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
|
||||
flags: ::c_int, addr: *mut ::sockaddr,
|
||||
addrlen: *mut ::socklen_t) -> ::ssize_t;
|
||||
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
|
||||
pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
|
||||
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
|
||||
|
||||
pub fn bind(socket: ::c_int, address: *const ::sockaddr,
|
||||
address_len: ::socklen_t) -> ::c_int;
|
||||
|
||||
pub fn writev(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int) -> ::ssize_t;
|
||||
pub fn readv(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int) -> ::ssize_t;
|
||||
|
||||
pub fn sendmsg(fd: ::c_int,
|
||||
msg: *const ::msghdr,
|
||||
flags: ::c_int) -> ::ssize_t;
|
||||
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
|
||||
-> ::ssize_t;
|
||||
pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
|
||||
environment: *const *const ::c_char) -> ::c_int;
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
|
||||
pub fn getgrgid_r(uid: ::uid_t,
|
||||
grp: *mut ::group,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut ::group) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sigaltstack$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
|
||||
pub fn sigaltstack(ss: *const stack_t,
|
||||
oss: *mut stack_t) -> ::c_int;
|
||||
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
|
||||
pub fn getdtablesize() -> ::c_int;
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
|
||||
pub fn getgrnam_r(name: *const ::c_char,
|
||||
grp: *mut ::group,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut ::group) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_sigmask$UNIX2003")]
|
||||
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
|
||||
oldset: *mut sigset_t) -> ::c_int;
|
||||
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
|
||||
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
|
||||
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
|
||||
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
|
||||
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
|
||||
pub fn getpwnam_r(name: *const ::c_char,
|
||||
pwd: *mut passwd,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut passwd) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
|
||||
pub fn getpwuid_r(uid: ::uid_t,
|
||||
pwd: *mut passwd,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut passwd) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch ="x86"),
|
||||
link_name = "sigwait$UNIX2003")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
|
||||
pub fn sigwait(set: *const sigset_t,
|
||||
sig: *mut ::c_int) -> ::c_int;
|
||||
pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
|
||||
parent: Option<unsafe extern fn()>,
|
||||
child: Option<unsafe extern fn()>) -> ::c_int;
|
||||
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "popen$UNIX2003")]
|
||||
pub fn popen(command: *const c_char,
|
||||
mode: *const c_char) -> *mut ::FILE;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_pointer_width = "64")] {
|
||||
mod b64;
|
||||
pub use self::b64::*;
|
||||
} else {
|
||||
mod b32;
|
||||
pub use self::b32::*;
|
||||
}
|
||||
}
|
899
third_party/rust/libc-0.2.30/src/unix/mod.rs
vendored
899
third_party/rust/libc-0.2.30/src/unix/mod.rs
vendored
@ -1,899 +0,0 @@
|
||||
//! Definitions found commonly among almost all Unix derivatives
|
||||
//!
|
||||
//! More functions and definitions can be found in the more specific modules
|
||||
//! according to the platform in question.
|
||||
|
||||
use dox::Option;
|
||||
|
||||
pub type pid_t = i32;
|
||||
pub type uid_t = u32;
|
||||
pub type gid_t = u32;
|
||||
pub type in_addr_t = u32;
|
||||
pub type in_port_t = u16;
|
||||
pub type sighandler_t = ::size_t;
|
||||
pub type cc_t = ::c_uchar;
|
||||
|
||||
pub enum DIR {}
|
||||
pub enum locale_t {}
|
||||
|
||||
s! {
|
||||
pub struct group {
|
||||
pub gr_name: *mut ::c_char,
|
||||
pub gr_passwd: *mut ::c_char,
|
||||
pub gr_gid: ::gid_t,
|
||||
pub gr_mem: *mut *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct utimbuf {
|
||||
pub actime: time_t,
|
||||
pub modtime: time_t,
|
||||
}
|
||||
|
||||
pub struct timeval {
|
||||
pub tv_sec: time_t,
|
||||
pub tv_usec: suseconds_t,
|
||||
}
|
||||
|
||||
pub struct timespec {
|
||||
pub tv_sec: time_t,
|
||||
pub tv_nsec: c_long,
|
||||
}
|
||||
|
||||
pub struct rlimit {
|
||||
pub rlim_cur: rlim_t,
|
||||
pub rlim_max: rlim_t,
|
||||
}
|
||||
|
||||
pub struct rusage {
|
||||
pub ru_utime: timeval,
|
||||
pub ru_stime: timeval,
|
||||
pub ru_maxrss: c_long,
|
||||
pub ru_ixrss: c_long,
|
||||
pub ru_idrss: c_long,
|
||||
pub ru_isrss: c_long,
|
||||
pub ru_minflt: c_long,
|
||||
pub ru_majflt: c_long,
|
||||
pub ru_nswap: c_long,
|
||||
pub ru_inblock: c_long,
|
||||
pub ru_oublock: c_long,
|
||||
pub ru_msgsnd: c_long,
|
||||
pub ru_msgrcv: c_long,
|
||||
pub ru_nsignals: c_long,
|
||||
pub ru_nvcsw: c_long,
|
||||
pub ru_nivcsw: c_long,
|
||||
|
||||
#[cfg(any(target_env = "musl", target_os = "emscripten"))]
|
||||
__reserved: [c_long; 16],
|
||||
}
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", repr(packed))]
|
||||
pub struct in_addr {
|
||||
pub s_addr: in_addr_t,
|
||||
}
|
||||
|
||||
pub struct in6_addr {
|
||||
pub s6_addr: [u8; 16],
|
||||
__align: [u32; 0],
|
||||
}
|
||||
|
||||
pub struct ip_mreq {
|
||||
pub imr_multiaddr: in_addr,
|
||||
pub imr_interface: in_addr,
|
||||
}
|
||||
|
||||
pub struct ipv6_mreq {
|
||||
pub ipv6mr_multiaddr: in6_addr,
|
||||
#[cfg(target_os = "android")]
|
||||
pub ipv6mr_interface: ::c_int,
|
||||
#[cfg(not(target_os = "android"))]
|
||||
pub ipv6mr_interface: ::c_uint,
|
||||
}
|
||||
|
||||
pub struct hostent {
|
||||
pub h_name: *mut ::c_char,
|
||||
pub h_aliases: *mut *mut ::c_char,
|
||||
pub h_addrtype: ::c_int,
|
||||
pub h_length: ::c_int,
|
||||
pub h_addr_list: *mut *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct iovec {
|
||||
pub iov_base: *mut ::c_void,
|
||||
pub iov_len: ::size_t,
|
||||
}
|
||||
|
||||
pub struct pollfd {
|
||||
pub fd: ::c_int,
|
||||
pub events: ::c_short,
|
||||
pub revents: ::c_short,
|
||||
}
|
||||
|
||||
pub struct winsize {
|
||||
pub ws_row: ::c_ushort,
|
||||
pub ws_col: ::c_ushort,
|
||||
pub ws_xpixel: ::c_ushort,
|
||||
pub ws_ypixel: ::c_ushort,
|
||||
}
|
||||
|
||||
pub struct linger {
|
||||
pub l_onoff: ::c_int,
|
||||
pub l_linger: ::c_int,
|
||||
}
|
||||
|
||||
pub struct sigval {
|
||||
// Actually a union of an int and a void*
|
||||
pub sival_ptr: *mut ::c_void
|
||||
}
|
||||
|
||||
// <sys/time.h>
|
||||
pub struct itimerval {
|
||||
pub it_interval: ::timeval,
|
||||
pub it_value: ::timeval,
|
||||
}
|
||||
|
||||
// <sys/times.h>
|
||||
pub struct tms {
|
||||
pub tms_utime: ::clock_t,
|
||||
pub tms_stime: ::clock_t,
|
||||
pub tms_cutime: ::clock_t,
|
||||
pub tms_cstime: ::clock_t,
|
||||
}
|
||||
}
|
||||
|
||||
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
|
||||
pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
|
||||
pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
|
||||
|
||||
pub const DT_FIFO: u8 = 1;
|
||||
pub const DT_CHR: u8 = 2;
|
||||
pub const DT_DIR: u8 = 4;
|
||||
pub const DT_BLK: u8 = 6;
|
||||
pub const DT_REG: u8 = 8;
|
||||
pub const DT_LNK: u8 = 10;
|
||||
pub const DT_SOCK: u8 = 12;
|
||||
|
||||
pub const FD_CLOEXEC: ::c_int = 0x1;
|
||||
|
||||
pub const USRQUOTA: ::c_int = 0;
|
||||
pub const GRPQUOTA: ::c_int = 1;
|
||||
|
||||
pub const SIGIOT: ::c_int = 6;
|
||||
|
||||
pub const S_ISUID: ::c_int = 0x800;
|
||||
pub const S_ISGID: ::c_int = 0x400;
|
||||
pub const S_ISVTX: ::c_int = 0x200;
|
||||
|
||||
pub const POLLIN: ::c_short = 0x1;
|
||||
pub const POLLPRI: ::c_short = 0x2;
|
||||
pub const POLLOUT: ::c_short = 0x4;
|
||||
pub const POLLERR: ::c_short = 0x8;
|
||||
pub const POLLHUP: ::c_short = 0x10;
|
||||
pub const POLLNVAL: ::c_short = 0x20;
|
||||
|
||||
pub const IF_NAMESIZE: ::size_t = 16;
|
||||
|
||||
pub const RTLD_LAZY: ::c_int = 0x1;
|
||||
|
||||
pub const LOG_EMERG: ::c_int = 0;
|
||||
pub const LOG_ALERT: ::c_int = 1;
|
||||
pub const LOG_CRIT: ::c_int = 2;
|
||||
pub const LOG_ERR: ::c_int = 3;
|
||||
pub const LOG_WARNING: ::c_int = 4;
|
||||
pub const LOG_NOTICE: ::c_int = 5;
|
||||
pub const LOG_INFO: ::c_int = 6;
|
||||
pub const LOG_DEBUG: ::c_int = 7;
|
||||
|
||||
pub const LOG_KERN: ::c_int = 0;
|
||||
pub const LOG_USER: ::c_int = 1 << 3;
|
||||
pub const LOG_MAIL: ::c_int = 2 << 3;
|
||||
pub const LOG_DAEMON: ::c_int = 3 << 3;
|
||||
pub const LOG_AUTH: ::c_int = 4 << 3;
|
||||
pub const LOG_SYSLOG: ::c_int = 5 << 3;
|
||||
pub const LOG_LPR: ::c_int = 6 << 3;
|
||||
pub const LOG_NEWS: ::c_int = 7 << 3;
|
||||
pub const LOG_UUCP: ::c_int = 8 << 3;
|
||||
pub const LOG_LOCAL0: ::c_int = 16 << 3;
|
||||
pub const LOG_LOCAL1: ::c_int = 17 << 3;
|
||||
pub const LOG_LOCAL2: ::c_int = 18 << 3;
|
||||
pub const LOG_LOCAL3: ::c_int = 19 << 3;
|
||||
pub const LOG_LOCAL4: ::c_int = 20 << 3;
|
||||
pub const LOG_LOCAL5: ::c_int = 21 << 3;
|
||||
pub const LOG_LOCAL6: ::c_int = 22 << 3;
|
||||
pub const LOG_LOCAL7: ::c_int = 23 << 3;
|
||||
|
||||
pub const LOG_PID: ::c_int = 0x01;
|
||||
pub const LOG_CONS: ::c_int = 0x02;
|
||||
pub const LOG_ODELAY: ::c_int = 0x04;
|
||||
pub const LOG_NDELAY: ::c_int = 0x08;
|
||||
pub const LOG_NOWAIT: ::c_int = 0x10;
|
||||
|
||||
pub const LOG_PRIMASK: ::c_int = 7;
|
||||
pub const LOG_FACMASK: ::c_int = 0x3f8;
|
||||
|
||||
pub const PRIO_PROCESS: ::c_int = 0;
|
||||
pub const PRIO_PGRP: ::c_int = 1;
|
||||
pub const PRIO_USER: ::c_int = 2;
|
||||
|
||||
pub const PRIO_MIN: ::c_int = -20;
|
||||
pub const PRIO_MAX: ::c_int = 20;
|
||||
|
||||
pub const IPPROTO_ICMP: ::c_int = 1;
|
||||
pub const IPPROTO_ICMPV6: ::c_int = 58;
|
||||
pub const IPPROTO_TCP: ::c_int = 6;
|
||||
pub const IPPROTO_UDP: ::c_int = 17;
|
||||
pub const IPPROTO_IP: ::c_int = 0;
|
||||
pub const IPPROTO_IPV6: ::c_int = 41;
|
||||
|
||||
pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
|
||||
pub const INADDR_ANY: in_addr_t = 0;
|
||||
pub const INADDR_BROADCAST: in_addr_t = 4294967295;
|
||||
pub const INADDR_NONE: in_addr_t = 4294967295;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(dox)] {
|
||||
// on dox builds don't pull in anything
|
||||
} else if #[cfg(target_os = "l4re")] {
|
||||
// required libraries for L4Re are linked externally, ATM
|
||||
} else if #[cfg(all(not(stdbuild), feature = "use_std"))] {
|
||||
// cargo build, don't pull in anything extra as the libstd dep
|
||||
// already pulls in all libs.
|
||||
} else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] {
|
||||
#[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))]
|
||||
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
|
||||
extern {}
|
||||
} else if #[cfg(target_os = "emscripten")] {
|
||||
#[link(name = "c")]
|
||||
extern {}
|
||||
} else if #[cfg(all(target_os = "netbsd", target_vendor = "rumprun"))] {
|
||||
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
|
||||
// in automatically by the linker. We avoid passing it explicitly, as it
|
||||
// causes some versions of binutils to crash with an assertion failure.
|
||||
#[link(name = "m")]
|
||||
extern {}
|
||||
} else if #[cfg(any(target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "android",
|
||||
target_os = "openbsd",
|
||||
target_os = "bitrig"))] {
|
||||
#[link(name = "c")]
|
||||
#[link(name = "m")]
|
||||
extern {}
|
||||
} else if #[cfg(target_os = "haiku")] {
|
||||
#[link(name = "root")]
|
||||
#[link(name = "network")]
|
||||
extern {}
|
||||
} else if #[cfg(target_os = "fuchsia")] {
|
||||
#[link(name = "c")]
|
||||
#[link(name = "mxio")]
|
||||
extern {}
|
||||
} else if #[cfg(target_env = "newlib")] {
|
||||
#[link(name = "c")]
|
||||
#[link(name = "m")]
|
||||
extern {}
|
||||
} else {
|
||||
#[link(name = "c")]
|
||||
#[link(name = "m")]
|
||||
#[link(name = "rt")]
|
||||
#[link(name = "pthread")]
|
||||
extern {}
|
||||
}
|
||||
}
|
||||
|
||||
extern {
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
|
||||
pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
|
||||
pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
|
||||
|
||||
pub fn fprintf(stream: *mut ::FILE,
|
||||
format: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn printf(format: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn snprintf(s: *mut ::c_char, n: ::size_t,
|
||||
format: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn getchar_unlocked() -> ::c_int;
|
||||
pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
|
||||
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "connect$UNIX2003")]
|
||||
pub fn connect(socket: ::c_int, address: *const sockaddr,
|
||||
len: socklen_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "listen$UNIX2003")]
|
||||
pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "accept$UNIX2003")]
|
||||
pub fn accept(socket: ::c_int, address: *mut sockaddr,
|
||||
address_len: *mut socklen_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "getpeername$UNIX2003")]
|
||||
pub fn getpeername(socket: ::c_int, address: *mut sockaddr,
|
||||
address_len: *mut socklen_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "getsockname$UNIX2003")]
|
||||
pub fn getsockname(socket: ::c_int, address: *mut sockaddr,
|
||||
address_len: *mut socklen_t) -> ::c_int;
|
||||
pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int,
|
||||
value: *const ::c_void,
|
||||
option_len: socklen_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "socketpair$UNIX2003")]
|
||||
pub fn socketpair(domain: ::c_int, type_: ::c_int, protocol: ::c_int,
|
||||
socket_vector: *mut ::c_int) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sendto$UNIX2003")]
|
||||
pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
|
||||
flags: ::c_int, addr: *const sockaddr,
|
||||
addrlen: socklen_t) -> ::ssize_t;
|
||||
pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "chmod$UNIX2003")]
|
||||
pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fchmod$UNIX2003")]
|
||||
pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
|
||||
pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
|
||||
|
||||
pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
|
||||
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
|
||||
|
||||
pub fn pclose(stream: *mut ::FILE) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fdopen$UNIX2003")]
|
||||
pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
|
||||
pub fn fileno(stream: *mut ::FILE) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "open$UNIX2003")]
|
||||
pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "creat$UNIX2003")]
|
||||
pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fcntl$UNIX2003")]
|
||||
pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "opendir$INODE64")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "opendir$INODE64$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
|
||||
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
|
||||
#[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
|
||||
pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
|
||||
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_readdir_r")]
|
||||
pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
|
||||
result: *mut *mut ::dirent) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "closedir$UNIX2003")]
|
||||
pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "rewinddir$INODE64")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "rewinddir$INODE64$UNIX2003")]
|
||||
pub fn rewinddir(dirp: *mut ::DIR);
|
||||
|
||||
pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
flags: ::c_int, ...) -> ::c_int;
|
||||
pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
mode: ::mode_t, flags: ::c_int) -> ::c_int;
|
||||
pub fn fchown(fd: ::c_int,
|
||||
owner: ::uid_t,
|
||||
group: ::gid_t) -> ::c_int;
|
||||
pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
owner: ::uid_t, group: ::gid_t,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
|
||||
pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
buf: *mut stat, flags: ::c_int) -> ::c_int;
|
||||
pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
|
||||
newdirfd: ::c_int, newpath: *const ::c_char,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
mode: ::mode_t) -> ::c_int;
|
||||
pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
|
||||
pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
|
||||
newdirfd: ::c_int, newpath: *const ::c_char)
|
||||
-> ::c_int;
|
||||
pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
|
||||
linkpath: *const ::c_char) -> ::c_int;
|
||||
pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
|
||||
pub fn alarm(seconds: ::c_uint) -> ::c_uint;
|
||||
pub fn chdir(dir: *const c_char) -> ::c_int;
|
||||
pub fn fchdir(dirfd: ::c_int) -> ::c_int;
|
||||
pub fn chown(path: *const c_char, uid: uid_t,
|
||||
gid: gid_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "lchown$UNIX2003")]
|
||||
pub fn lchown(path: *const c_char, uid: uid_t,
|
||||
gid: gid_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "close$NOCANCEL$UNIX2003")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "close$NOCANCEL")]
|
||||
pub fn close(fd: ::c_int) -> ::c_int;
|
||||
pub fn dup(fd: ::c_int) -> ::c_int;
|
||||
pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
|
||||
pub fn execl(path: *const c_char,
|
||||
arg0: *const c_char, ...) -> ::c_int;
|
||||
pub fn execle(path: *const ::c_char,
|
||||
arg0: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn execlp(file: *const ::c_char,
|
||||
arg0: *const ::c_char, ...) -> ::c_int;
|
||||
pub fn execv(prog: *const c_char,
|
||||
argv: *const *const c_char) -> ::c_int;
|
||||
pub fn execve(prog: *const c_char, argv: *const *const c_char,
|
||||
envp: *const *const c_char)
|
||||
-> ::c_int;
|
||||
pub fn execvp(c: *const c_char,
|
||||
argv: *const *const c_char) -> ::c_int;
|
||||
pub fn fork() -> pid_t;
|
||||
pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
|
||||
pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
|
||||
pub fn getegid() -> gid_t;
|
||||
pub fn geteuid() -> uid_t;
|
||||
pub fn getgid() -> gid_t;
|
||||
pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t)
|
||||
-> ::c_int;
|
||||
pub fn getlogin() -> *mut c_char;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "getopt$UNIX2003")]
|
||||
pub fn getopt(argc: ::c_int, argv: *const *mut c_char,
|
||||
optstr: *const c_char) -> ::c_int;
|
||||
pub fn getpgid(pid: pid_t) -> pid_t;
|
||||
pub fn getpgrp() -> pid_t;
|
||||
pub fn getpid() -> pid_t;
|
||||
pub fn getppid() -> pid_t;
|
||||
pub fn getuid() -> uid_t;
|
||||
pub fn isatty(fd: ::c_int) -> ::c_int;
|
||||
pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
|
||||
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
|
||||
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pause$UNIX2003")]
|
||||
pub fn pause() -> ::c_int;
|
||||
pub fn pipe(fds: *mut ::c_int) -> ::c_int;
|
||||
pub fn posix_memalign(memptr: *mut *mut ::c_void,
|
||||
align: ::size_t,
|
||||
size: ::size_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "read$UNIX2003")]
|
||||
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
|
||||
-> ::ssize_t;
|
||||
pub fn rmdir(path: *const c_char) -> ::c_int;
|
||||
pub fn seteuid(uid: uid_t) -> ::c_int;
|
||||
pub fn setgid(gid: gid_t) -> ::c_int;
|
||||
pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
|
||||
pub fn setsid() -> pid_t;
|
||||
pub fn setuid(uid: uid_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sleep$UNIX2003")]
|
||||
pub fn sleep(secs: ::c_uint) -> ::c_uint;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "nanosleep$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
|
||||
pub fn nanosleep(rqtp: *const timespec,
|
||||
rmtp: *mut timespec) -> ::c_int;
|
||||
pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
|
||||
pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
|
||||
pub fn ttyname(fd: ::c_int) -> *mut c_char;
|
||||
pub fn unlink(c: *const c_char) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "wait$UNIX2003")]
|
||||
pub fn wait(status: *mut ::c_int) -> pid_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "waitpid$UNIX2003")]
|
||||
pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int)
|
||||
-> pid_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "write$UNIX2003")]
|
||||
pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
|
||||
-> ::ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pread$UNIX2003")]
|
||||
pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
|
||||
offset: off_t) -> ::ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pwrite$UNIX2003")]
|
||||
pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
|
||||
offset: off_t) -> ::ssize_t;
|
||||
pub fn umask(mask: mode_t) -> mode_t;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
|
||||
pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "kill$UNIX2003")]
|
||||
pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
|
||||
pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
|
||||
pub fn mlockall(flags: ::c_int) -> ::c_int;
|
||||
pub fn munlockall() -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "mmap$UNIX2003")]
|
||||
pub fn mmap(addr: *mut ::c_void,
|
||||
len: ::size_t,
|
||||
prot: ::c_int,
|
||||
flags: ::c_int,
|
||||
fd: ::c_int,
|
||||
offset: off_t)
|
||||
-> *mut ::c_void;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "munmap$UNIX2003")]
|
||||
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
|
||||
|
||||
pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
|
||||
pub fn if_indextoname(ifindex: ::c_uint,
|
||||
ifname: *mut ::c_char) -> *mut ::c_char;
|
||||
|
||||
#[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
|
||||
pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fsync$UNIX2003")]
|
||||
pub fn fsync(fd: ::c_int) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "setenv$UNIX2003")]
|
||||
pub fn setenv(name: *const c_char, val: *const c_char,
|
||||
overwrite: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "unsetenv$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
|
||||
pub fn unsetenv(name: *const c_char) -> ::c_int;
|
||||
|
||||
pub fn symlink(path1: *const c_char,
|
||||
path2: *const c_char) -> ::c_int;
|
||||
|
||||
pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
|
||||
|
||||
pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "getrlimit$UNIX2003")]
|
||||
pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "setrlimit$UNIX2003")]
|
||||
pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
|
||||
pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
|
||||
|
||||
#[cfg_attr(any(target_os = "macos", target_os = "ios"),
|
||||
link_name = "realpath$DARWIN_EXTSN")]
|
||||
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char)
|
||||
-> *mut ::c_char;
|
||||
|
||||
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")]
|
||||
pub fn gettimeofday(tp: *mut ::timeval,
|
||||
tz: *mut ::c_void) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
|
||||
pub fn times(buf: *mut ::tms) -> ::clock_t;
|
||||
|
||||
pub fn pthread_self() -> ::pthread_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_join$UNIX2003")]
|
||||
pub fn pthread_join(native: ::pthread_t,
|
||||
value: *mut *mut ::c_void) -> ::c_int;
|
||||
pub fn pthread_exit(value: *mut ::c_void);
|
||||
pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
|
||||
pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
|
||||
pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t,
|
||||
stack_size: ::size_t) -> ::c_int;
|
||||
pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t,
|
||||
state: ::c_int) -> ::c_int;
|
||||
pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
|
||||
pub fn sched_yield() -> ::c_int;
|
||||
pub fn pthread_key_create(key: *mut pthread_key_t,
|
||||
dtor: Option<unsafe extern fn(*mut ::c_void)>)
|
||||
-> ::c_int;
|
||||
pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
|
||||
pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
|
||||
pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void)
|
||||
-> ::c_int;
|
||||
pub fn pthread_mutex_init(lock: *mut pthread_mutex_t,
|
||||
attr: *const pthread_mutexattr_t) -> ::c_int;
|
||||
pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
|
||||
pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
|
||||
pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
|
||||
pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
|
||||
|
||||
pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_mutexattr_destroy$UNIX2003")]
|
||||
pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
|
||||
pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t,
|
||||
_type: ::c_int) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_cond_init$UNIX2003")]
|
||||
pub fn pthread_cond_init(cond: *mut pthread_cond_t,
|
||||
attr: *const pthread_condattr_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_cond_wait$UNIX2003")]
|
||||
pub fn pthread_cond_wait(cond: *mut pthread_cond_t,
|
||||
lock: *mut pthread_mutex_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_cond_timedwait$UNIX2003")]
|
||||
pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t,
|
||||
lock: *mut pthread_mutex_t,
|
||||
abstime: *const ::timespec) -> ::c_int;
|
||||
pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
|
||||
pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
|
||||
pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
|
||||
pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
|
||||
pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_init$UNIX2003")]
|
||||
pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t,
|
||||
attr: *const pthread_rwlockattr_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_destroy$UNIX2003")]
|
||||
pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_rdlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_tryrdlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_wrlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_trywrlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_rwlock_unlock$UNIX2003")]
|
||||
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
|
||||
pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
|
||||
pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t)
|
||||
-> ::c_int;
|
||||
#[cfg_attr(all(target_os = "linux", not(target_env = "musl")),
|
||||
link_name = "__xpg_strerror_r")]
|
||||
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
|
||||
buflen: ::size_t) -> ::c_int;
|
||||
|
||||
pub fn getsockopt(sockfd: ::c_int,
|
||||
level: ::c_int,
|
||||
optname: ::c_int,
|
||||
optval: *mut ::c_void,
|
||||
optlen: *mut ::socklen_t) -> ::c_int;
|
||||
pub fn raise(signum: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
|
||||
pub fn sigaction(signum: ::c_int,
|
||||
act: *const sigaction,
|
||||
oldact: *mut sigaction) -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
|
||||
pub fn utimes(filename: *const ::c_char,
|
||||
times: *const ::timeval) -> ::c_int;
|
||||
pub fn dlopen(filename: *const ::c_char,
|
||||
flag: ::c_int) -> *mut ::c_void;
|
||||
pub fn dlerror() -> *mut ::c_char;
|
||||
pub fn dlsym(handle: *mut ::c_void,
|
||||
symbol: *const ::c_char) -> *mut ::c_void;
|
||||
pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
|
||||
pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
|
||||
|
||||
pub fn getaddrinfo(node: *const c_char,
|
||||
service: *const c_char,
|
||||
hints: *const addrinfo,
|
||||
res: *mut *mut addrinfo) -> ::c_int;
|
||||
pub fn freeaddrinfo(res: *mut addrinfo);
|
||||
pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
|
||||
#[cfg_attr(any(
|
||||
all(target_os = "linux", not(target_env = "musl")),
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly"),
|
||||
link_name = "__res_init")]
|
||||
#[cfg_attr(any(target_os = "macos", target_os = "ios"),
|
||||
link_name = "res_9_init")]
|
||||
pub fn res_init() -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
|
||||
pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
|
||||
pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "mktime$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
|
||||
pub fn mktime(tm: *mut tm) -> time_t;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__time50")]
|
||||
pub fn time(time: *mut time_t) -> time_t;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
|
||||
pub fn gmtime(time_p: *const time_t) -> *mut tm;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
|
||||
pub fn localtime(time_p: *const time_t) -> *mut tm;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
|
||||
pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
|
||||
dev: ::dev_t) -> ::c_int;
|
||||
pub fn uname(buf: *mut ::utsname) -> ::c_int;
|
||||
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
|
||||
pub fn chroot(name: *const ::c_char) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "usleep$UNIX2003")]
|
||||
pub fn usleep(secs: ::c_uint) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "send$UNIX2003")]
|
||||
pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
|
||||
flags: ::c_int) -> ::ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "recv$UNIX2003")]
|
||||
pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
|
||||
flags: ::c_int) -> ::ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "putenv$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
|
||||
pub fn putenv(string: *mut c_char) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "poll$UNIX2003")]
|
||||
pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "select$1050")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "select$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__select50")]
|
||||
pub fn select(nfds: ::c_int,
|
||||
readfs: *mut fd_set,
|
||||
writefds: *mut fd_set,
|
||||
errorfds: *mut fd_set,
|
||||
timeout: *mut timeval) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
|
||||
pub fn setlocale(category: ::c_int,
|
||||
locale: *const ::c_char) -> *mut ::c_char;
|
||||
pub fn localeconv() -> *mut lconv;
|
||||
|
||||
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sem_wait$UNIX2003")]
|
||||
pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
|
||||
pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
|
||||
pub fn sem_post(sem: *mut sem_t) -> ::c_int;
|
||||
pub fn sem_init(sem: *mut sem_t,
|
||||
pshared: ::c_int,
|
||||
value: ::c_uint)
|
||||
-> ::c_int;
|
||||
pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
|
||||
pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
|
||||
|
||||
pub fn readlink(path: *const c_char,
|
||||
buf: *mut c_char,
|
||||
bufsz: ::size_t)
|
||||
-> ::ssize_t;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
|
||||
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
|
||||
pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
|
||||
pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
|
||||
pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
|
||||
pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
|
||||
pub fn sigprocmask(how: ::c_int,
|
||||
set: *const sigset_t,
|
||||
oldset: *mut sigset_t)
|
||||
-> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
|
||||
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
|
||||
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
|
||||
pub fn timegm(tm: *mut ::tm) -> time_t;
|
||||
|
||||
pub fn getsid(pid: pid_t) -> pid_t;
|
||||
|
||||
pub fn sysconf(name: ::c_int) -> ::c_long;
|
||||
|
||||
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "pselect$1050")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pselect$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
|
||||
pub fn pselect(nfds: ::c_int,
|
||||
readfs: *mut fd_set,
|
||||
writefds: *mut fd_set,
|
||||
errorfds: *mut fd_set,
|
||||
timeout: *const timespec,
|
||||
sigmask: *const sigset_t) -> ::c_int;
|
||||
pub fn fseeko(stream: *mut ::FILE,
|
||||
offset: ::off_t,
|
||||
whence: ::c_int) -> ::c_int;
|
||||
pub fn ftello(stream: *mut ::FILE) -> ::off_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "tcdrain$UNIX2003")]
|
||||
pub fn tcdrain(fd: ::c_int) -> ::c_int;
|
||||
pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
|
||||
pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
|
||||
pub fn cfmakeraw(termios: *mut ::termios);
|
||||
pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
|
||||
pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
|
||||
pub fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
|
||||
pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
|
||||
pub fn tcsetattr(fd: ::c_int,
|
||||
optional_actions: ::c_int,
|
||||
termios: *const ::termios) -> ::c_int;
|
||||
pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
|
||||
pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
|
||||
pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
|
||||
pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
|
||||
pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
|
||||
pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
|
||||
|
||||
pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
|
||||
|
||||
pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
|
||||
pub fn closelog();
|
||||
pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
|
||||
pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "nice$UNIX2003")]
|
||||
pub fn nice(incr: ::c_int) -> ::c_int;
|
||||
|
||||
pub fn grantpt(fd: ::c_int) -> ::c_int;
|
||||
pub fn posix_openpt(flags: ::c_int) -> ::c_int;
|
||||
pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
|
||||
pub fn unlockpt(fd: ::c_int) -> ::c_int;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_env = "uclibc")] {
|
||||
mod uclibc;
|
||||
pub use self::uclibc::*;
|
||||
} else if #[cfg(target_env = "newlib")] {
|
||||
mod newlib;
|
||||
pub use self::newlib::*;
|
||||
} else if #[cfg(any(target_os = "linux",
|
||||
target_os = "android",
|
||||
target_os = "emscripten",
|
||||
target_os = "fuchsia"))] {
|
||||
mod notbsd;
|
||||
pub use self::notbsd::*;
|
||||
} else if #[cfg(any(target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "openbsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "bitrig"))] {
|
||||
mod bsd;
|
||||
pub use self::bsd::*;
|
||||
} else if #[cfg(target_os = "solaris")] {
|
||||
mod solaris;
|
||||
pub use self::solaris::*;
|
||||
} else if #[cfg(target_os = "haiku")] {
|
||||
mod haiku;
|
||||
pub use self::haiku::*;
|
||||
} else {
|
||||
// Unknown target_os
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
pub type c_char = u8;
|
||||
pub type wchar_t = u32;
|
||||
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
658
third_party/rust/libc-0.2.30/src/unix/newlib/mod.rs
vendored
658
third_party/rust/libc-0.2.30/src/unix/newlib/mod.rs
vendored
@ -1,658 +0,0 @@
|
||||
use dox::mem;
|
||||
|
||||
pub type blkcnt_t = i32;
|
||||
pub type blksize_t = i32;
|
||||
pub type clock_t = i32;
|
||||
pub type clockid_t = ::c_ulong;
|
||||
pub type dev_t = u32;
|
||||
pub type fsblkcnt_t = u64;
|
||||
pub type fsfilcnt_t = u32;
|
||||
pub type id_t = u32;
|
||||
pub type ino_t = u32;
|
||||
pub type key_t = ::c_int;
|
||||
pub type loff_t = ::c_longlong;
|
||||
pub type mode_t = ::c_uint;
|
||||
pub type nfds_t = u32;
|
||||
pub type nlink_t = ::c_ushort;
|
||||
pub type off_t = i64;
|
||||
pub type pthread_t = ::c_ulong;
|
||||
pub type pthread_key_t = ::c_uint;
|
||||
pub type rlim_t = u32;
|
||||
pub type sa_family_t = u8;
|
||||
pub type socklen_t = u32;
|
||||
pub type speed_t = u32;
|
||||
pub type suseconds_t = i32;
|
||||
pub type tcflag_t = ::c_uint;
|
||||
pub type time_t = i32;
|
||||
pub type useconds_t = u32;
|
||||
|
||||
s! {
|
||||
pub struct sockaddr {
|
||||
pub sa_family: sa_family_t,
|
||||
pub sa_data: [::c_char; 14],
|
||||
}
|
||||
|
||||
pub struct sockaddr_in {
|
||||
pub sin_family: sa_family_t,
|
||||
pub sin_port: ::in_port_t,
|
||||
pub sin_addr: ::in_addr,
|
||||
pub sin_zero: [u8; 8],
|
||||
}
|
||||
|
||||
pub struct sockaddr_in6 { // Unverified
|
||||
pub sin6_family: sa_family_t,
|
||||
pub sin6_port: ::in_port_t,
|
||||
pub sin6_flowinfo: u32,
|
||||
pub sin6_addr: ::in6_addr,
|
||||
pub sin6_scope_id: u32,
|
||||
}
|
||||
|
||||
pub struct sockaddr_storage {
|
||||
pub ss_family: sa_family_t,
|
||||
pub __ss_padding: [u8; 26],
|
||||
}
|
||||
|
||||
pub struct addrinfo {
|
||||
pub ai_flags: ::c_int,
|
||||
pub ai_family: ::c_int,
|
||||
pub ai_socktype: ::c_int,
|
||||
pub ai_protocol: ::c_int,
|
||||
pub ai_addrlen: socklen_t,
|
||||
pub ai_canonname: *mut ::c_char,
|
||||
pub ai_addr: *mut sockaddr,
|
||||
pub ai_next: *mut addrinfo,
|
||||
}
|
||||
|
||||
pub struct ip_mreq {
|
||||
pub imr_multiaddr: in_addr,
|
||||
pub imr_interface: in_addr,
|
||||
}
|
||||
|
||||
pub struct linger {
|
||||
pub l_onoff: ::c_int,
|
||||
pub l_linger: ::c_int,
|
||||
}
|
||||
|
||||
pub struct in_addr {
|
||||
pub s_addr: ::in_addr_t,
|
||||
}
|
||||
|
||||
pub struct hostent {
|
||||
pub h_name: *mut ::c_char,
|
||||
pub h_aliases: *mut *mut ::c_char,
|
||||
pub h_addrtype: ::c_int,
|
||||
pub h_length: ::c_int,
|
||||
pub h_addr_list: *mut *mut ::c_char,
|
||||
pub h_addr: *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct pollfd {
|
||||
pub fd: ::c_int,
|
||||
pub events: ::c_int,
|
||||
pub revents: ::c_int,
|
||||
}
|
||||
|
||||
pub struct lconv {
|
||||
pub decimal_point: *mut ::c_char,
|
||||
pub thousands_sep: *mut ::c_char,
|
||||
pub grouping: *mut ::c_char,
|
||||
pub int_curr_symbol: *mut ::c_char,
|
||||
pub currency_symbol: *mut ::c_char,
|
||||
pub mon_decimal_point: *mut ::c_char,
|
||||
pub mon_thousands_sep: *mut ::c_char,
|
||||
pub mon_grouping: *mut ::c_char,
|
||||
pub positive_sign: *mut ::c_char,
|
||||
pub negative_sign: *mut ::c_char,
|
||||
pub int_frac_digits: ::c_char,
|
||||
pub frac_digits: ::c_char,
|
||||
pub p_cs_precedes: ::c_char,
|
||||
pub p_sep_by_space: ::c_char,
|
||||
pub n_cs_precedes: ::c_char,
|
||||
pub n_sep_by_space: ::c_char,
|
||||
pub p_sign_posn: ::c_char,
|
||||
pub n_sign_posn: ::c_char,
|
||||
pub int_n_cs_precedes: ::c_char,
|
||||
pub int_n_sep_by_space: ::c_char,
|
||||
pub int_n_sign_posn: ::c_char,
|
||||
pub int_p_cs_precedes: ::c_char,
|
||||
pub int_p_sep_by_space: ::c_char,
|
||||
pub int_p_sign_posn: ::c_char,
|
||||
}
|
||||
|
||||
pub struct tm {
|
||||
pub tm_sec: ::c_int,
|
||||
pub tm_min: ::c_int,
|
||||
pub tm_hour: ::c_int,
|
||||
pub tm_mday: ::c_int,
|
||||
pub tm_mon: ::c_int,
|
||||
pub tm_year: ::c_int,
|
||||
pub tm_wday: ::c_int,
|
||||
pub tm_yday: ::c_int,
|
||||
pub tm_isdst: ::c_int,
|
||||
}
|
||||
|
||||
pub struct stat {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_mode: ::mode_t,
|
||||
pub st_nlink: ::nlink_t,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: dev_t,
|
||||
pub st_size: off_t,
|
||||
pub st_atime: time_t,
|
||||
pub st_spare1: ::c_long,
|
||||
pub st_mtime: time_t,
|
||||
pub st_spare2: ::c_long,
|
||||
pub st_ctime: time_t,
|
||||
pub st_spare3: ::c_long,
|
||||
pub st_blksize: blksize_t,
|
||||
pub st_blocks: blkcnt_t,
|
||||
pub st_spare4: [::c_long; 2usize],
|
||||
}
|
||||
|
||||
pub struct statvfs {
|
||||
pub f_bsize: ::c_ulong,
|
||||
pub f_frsize: ::c_ulong,
|
||||
pub f_blocks: fsblkcnt_t,
|
||||
pub f_bfree: fsblkcnt_t,
|
||||
pub f_bavail: fsblkcnt_t,
|
||||
pub f_files: fsfilcnt_t,
|
||||
pub f_ffree: fsfilcnt_t,
|
||||
pub f_favail: fsfilcnt_t,
|
||||
pub f_fsid: ::c_ulong,
|
||||
pub f_flag: ::c_ulong,
|
||||
pub f_namemax: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct sigset_t {
|
||||
__val: [::c_ulong; 16],
|
||||
}
|
||||
|
||||
pub struct sigaction {
|
||||
pub sa_handler: extern fn(arg1: ::c_int),
|
||||
pub sa_mask: sigset_t,
|
||||
pub sa_flags: ::c_int,
|
||||
}
|
||||
|
||||
pub struct dirent {
|
||||
pub d_ino: ino_t,
|
||||
pub d_type: ::c_uchar,
|
||||
pub d_name: [::c_char; 256usize],
|
||||
}
|
||||
|
||||
pub struct stack_t {
|
||||
pub ss_sp: *mut ::c_void,
|
||||
pub ss_flags: ::c_int,
|
||||
pub ss_size: usize,
|
||||
}
|
||||
|
||||
pub struct fd_set { // Unverified
|
||||
fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
|
||||
}
|
||||
|
||||
pub struct passwd { // Unverified
|
||||
pub pw_name: *mut ::c_char,
|
||||
pub pw_passwd: *mut ::c_char,
|
||||
pub pw_uid: ::uid_t,
|
||||
pub pw_gid: ::gid_t,
|
||||
pub pw_gecos: *mut ::c_char,
|
||||
pub pw_dir: *mut ::c_char,
|
||||
pub pw_shell: *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct termios { // Unverified
|
||||
pub c_iflag: ::tcflag_t,
|
||||
pub c_oflag: ::tcflag_t,
|
||||
pub c_cflag: ::tcflag_t,
|
||||
pub c_lflag: ::tcflag_t,
|
||||
pub c_line: ::cc_t,
|
||||
pub c_cc: [::cc_t; ::NCCS],
|
||||
}
|
||||
|
||||
pub struct sem_t { // Unverified
|
||||
__size: [::c_char; 16],
|
||||
}
|
||||
|
||||
pub struct Dl_info { // Unverified
|
||||
pub dli_fname: *const ::c_char,
|
||||
pub dli_fbase: *mut ::c_void,
|
||||
pub dli_sname: *const ::c_char,
|
||||
pub dli_saddr: *mut ::c_void,
|
||||
}
|
||||
|
||||
pub struct utsname { // Unverified
|
||||
pub sysname: [::c_char; 65],
|
||||
pub nodename: [::c_char; 65],
|
||||
pub release: [::c_char; 65],
|
||||
pub version: [::c_char; 65],
|
||||
pub machine: [::c_char; 65],
|
||||
pub domainname: [::c_char; 65]
|
||||
}
|
||||
|
||||
pub struct cpu_set_t { // Unverified
|
||||
bits: [u32; 32],
|
||||
}
|
||||
|
||||
pub struct pthread_attr_t { // Unverified
|
||||
__size: [u64; 7]
|
||||
}
|
||||
|
||||
pub struct pthread_mutex_t { // Unverified
|
||||
#[cfg(any(target_arch = "mips", target_arch = "arm",
|
||||
target_arch = "powerpc"))]
|
||||
__align: [::c_long; 0],
|
||||
#[cfg(not(any(target_arch = "mips", target_arch = "arm",
|
||||
target_arch = "powerpc")))]
|
||||
__align: [::c_longlong; 0],
|
||||
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
|
||||
}
|
||||
|
||||
pub struct pthread_rwlock_t { // Unverified
|
||||
#[cfg(any(target_arch = "mips", target_arch = "arm",
|
||||
target_arch = "powerpc"))]
|
||||
__align: [::c_long; 0],
|
||||
#[cfg(not(any(target_arch = "mips", target_arch = "arm",
|
||||
target_arch = "powerpc")))]
|
||||
__align: [::c_longlong; 0],
|
||||
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
|
||||
}
|
||||
|
||||
pub struct pthread_mutexattr_t { // Unverified
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
|
||||
target_arch = "mips64", target_arch = "s390x",
|
||||
target_arch = "sparc64"))]
|
||||
__align: [::c_int; 0],
|
||||
#[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
|
||||
target_arch = "mips64", target_arch = "s390x",
|
||||
target_arch = "sparc64")))]
|
||||
__align: [::c_long; 0],
|
||||
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
|
||||
}
|
||||
|
||||
pub struct pthread_rwlockattr_t { // Unverified
|
||||
__lockkind: ::c_int,
|
||||
__pshared: ::c_int,
|
||||
}
|
||||
|
||||
pub struct pthread_cond_t { // Unverified
|
||||
__align: [::c_longlong; 0],
|
||||
size: [u8; __SIZEOF_PTHREAD_COND_T],
|
||||
}
|
||||
|
||||
pub struct pthread_condattr_t { // Unverified
|
||||
__align: [::c_int; 0],
|
||||
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// unverified constants
|
||||
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
|
||||
__align: [],
|
||||
size: [0; __SIZEOF_PTHREAD_MUTEX_T],
|
||||
};
|
||||
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
|
||||
__align: [],
|
||||
size: [0; __SIZEOF_PTHREAD_COND_T],
|
||||
};
|
||||
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
|
||||
__align: [],
|
||||
size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
|
||||
};
|
||||
pub const NCCS: usize = 32;
|
||||
pub const __SIZEOF_PTHREAD_ATTR_T: usize = 56;
|
||||
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
|
||||
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
|
||||
pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
|
||||
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
|
||||
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
|
||||
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
|
||||
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
|
||||
pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
|
||||
pub const __PTHREAD_MUTEX_HAVE_PREV: usize = 1;
|
||||
pub const __PTHREAD_RWLOCK_INT_FLAGS_SHARED: usize = 1;
|
||||
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
|
||||
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
|
||||
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
|
||||
pub const FD_SETSIZE: usize = 1024;
|
||||
// intentionally not public, only used for fd_set
|
||||
const ULONG_SIZE: usize = 32;
|
||||
|
||||
// Other constants
|
||||
pub const EPERM: ::c_int = 1;
|
||||
pub const ENOENT: ::c_int = 2;
|
||||
pub const ESRCH: ::c_int = 3;
|
||||
pub const EINTR: ::c_int = 4;
|
||||
pub const EIO: ::c_int = 5;
|
||||
pub const ENXIO: ::c_int = 6;
|
||||
pub const E2BIG: ::c_int = 7;
|
||||
pub const ENOEXEC: ::c_int = 8;
|
||||
pub const EBADF: ::c_int = 9;
|
||||
pub const ECHILD: ::c_int = 10;
|
||||
pub const EAGAIN: ::c_int = 11;
|
||||
pub const ENOMEM: ::c_int = 12;
|
||||
pub const EACCES: ::c_int = 13;
|
||||
pub const EFAULT: ::c_int = 14;
|
||||
pub const EBUSY: ::c_int = 16;
|
||||
pub const EEXIST: ::c_int = 17;
|
||||
pub const EXDEV: ::c_int = 18;
|
||||
pub const ENODEV: ::c_int = 19;
|
||||
pub const ENOTDIR: ::c_int = 20;
|
||||
pub const EISDIR: ::c_int = 21;
|
||||
pub const EINVAL: ::c_int = 22;
|
||||
pub const ENFILE: ::c_int = 23;
|
||||
pub const EMFILE: ::c_int = 24;
|
||||
pub const ENOTTY: ::c_int = 25;
|
||||
pub const ETXTBSY: ::c_int = 26;
|
||||
pub const EFBIG: ::c_int = 27;
|
||||
pub const ENOSPC: ::c_int = 28;
|
||||
pub const ESPIPE: ::c_int = 29;
|
||||
pub const EROFS: ::c_int = 30;
|
||||
pub const EMLINK: ::c_int = 31;
|
||||
pub const EPIPE: ::c_int = 32;
|
||||
pub const EDOM: ::c_int = 33;
|
||||
pub const ERANGE: ::c_int = 34;
|
||||
pub const ENOMSG: ::c_int = 35;
|
||||
pub const EIDRM: ::c_int = 36;
|
||||
pub const EDEADLK: ::c_int = 45;
|
||||
pub const ENOLCK: ::c_int = 46;
|
||||
pub const ENOSTR: ::c_int = 60;
|
||||
pub const ENODATA: ::c_int = 61;
|
||||
pub const ETIME: ::c_int = 62;
|
||||
pub const ENOSR: ::c_int = 63;
|
||||
pub const ENOLINK: ::c_int = 67;
|
||||
pub const EPROTO: ::c_int = 71;
|
||||
pub const EMULTIHOP: ::c_int = 74;
|
||||
pub const EBADMSG: ::c_int = 77;
|
||||
pub const EFTYPE: ::c_int = 79;
|
||||
pub const ENOSYS: ::c_int = 88;
|
||||
pub const ENOTEMPTY: ::c_int = 90;
|
||||
pub const ENAMETOOLONG: ::c_int = 91;
|
||||
pub const ELOOP: ::c_int = 92;
|
||||
pub const EOPNOTSUPP: ::c_int = 95;
|
||||
pub const EPFNOSUPPORT: ::c_int = 96;
|
||||
pub const ECONNRESET: ::c_int = 104;
|
||||
pub const ENOBUFS: ::c_int = 105;
|
||||
pub const EAFNOSUPPORT: ::c_int = 106;
|
||||
pub const EPROTOTYPE: ::c_int = 107;
|
||||
pub const ENOTSOCK: ::c_int = 108;
|
||||
pub const ENOPROTOOPT: ::c_int = 109;
|
||||
pub const ECONNREFUSED: ::c_int = 111;
|
||||
pub const EADDRINUSE: ::c_int = 112;
|
||||
pub const ECONNABORTED: ::c_int = 113;
|
||||
pub const ENETUNREACH: ::c_int = 114;
|
||||
pub const ENETDOWN: ::c_int = 115;
|
||||
pub const ETIMEDOUT: ::c_int = 116;
|
||||
pub const EHOSTDOWN: ::c_int = 117;
|
||||
pub const EHOSTUNREACH: ::c_int = 118;
|
||||
pub const EINPROGRESS: ::c_int = 119;
|
||||
pub const EALREADY: ::c_int = 120;
|
||||
pub const EDESTADDRREQ: ::c_int = 121;
|
||||
pub const EMSGSIZE: ::c_int = 122;
|
||||
pub const EPROTONOSUPPORT: ::c_int = 123;
|
||||
pub const EADDRNOTAVAIL: ::c_int = 125;
|
||||
pub const ENETRESET: ::c_int = 126;
|
||||
pub const EISCONN: ::c_int = 127;
|
||||
pub const ENOTCONN: ::c_int = 128;
|
||||
pub const ETOOMANYREFS: ::c_int = 129;
|
||||
pub const EDQUOT: ::c_int = 132;
|
||||
pub const ESTALE: ::c_int = 133;
|
||||
pub const ENOTSUP: ::c_int = 134;
|
||||
pub const EILSEQ: ::c_int = 138;
|
||||
pub const EOVERFLOW: ::c_int = 139;
|
||||
pub const ECANCELED: ::c_int = 140;
|
||||
pub const ENOTRECOVERABLE: ::c_int = 141;
|
||||
pub const EOWNERDEAD: ::c_int = 142;
|
||||
pub const EWOULDBLOCK: ::c_int = 11;
|
||||
|
||||
pub const F_DUPFD: ::c_int = 0;
|
||||
pub const F_GETFD: ::c_int = 1;
|
||||
pub const F_SETFD: ::c_int = 2;
|
||||
pub const F_GETFL: ::c_int = 3;
|
||||
pub const F_SETFL: ::c_int = 4;
|
||||
pub const F_GETOWN: ::c_int = 5;
|
||||
pub const F_SETOWN: ::c_int = 6;
|
||||
pub const F_GETLK: ::c_int = 7;
|
||||
pub const F_SETLK: ::c_int = 8;
|
||||
pub const F_SETLKW: ::c_int = 9;
|
||||
pub const F_RGETLK: ::c_int = 10;
|
||||
pub const F_RSETLK: ::c_int = 11;
|
||||
pub const F_CNVT: ::c_int = 12;
|
||||
pub const F_RSETLKW: ::c_int = 13;
|
||||
pub const F_DUPFD_CLOEXEC: ::c_int = 14;
|
||||
|
||||
pub const O_RDONLY: ::c_int = 0;
|
||||
pub const O_WRONLY: ::c_int = 1;
|
||||
pub const O_RDWR: ::c_int = 2;
|
||||
pub const O_APPEND: ::c_int = 8;
|
||||
pub const O_CREAT: ::c_int = 512;
|
||||
pub const O_TRUNC: ::c_int = 1024;
|
||||
pub const O_EXCL: ::c_int = 2048;
|
||||
pub const O_SYNC: ::c_int = 8192;
|
||||
pub const O_NONBLOCK: ::c_int = 16384;
|
||||
|
||||
pub const O_ACCMODE: ::c_int = 3;
|
||||
pub const O_CLOEXEC: ::c_int = 0x80000;
|
||||
|
||||
pub const STDIN_FILENO: ::c_int = 0;
|
||||
pub const STDOUT_FILENO: ::c_int = 1;
|
||||
pub const STDERR_FILENO: ::c_int = 2;
|
||||
|
||||
pub const SEEK_SET: ::c_int = 0;
|
||||
pub const SEEK_CUR: ::c_int = 1;
|
||||
pub const SEEK_END: ::c_int = 2;
|
||||
|
||||
pub const FIONBIO: ::c_int = 1;
|
||||
|
||||
pub const S_BLKSIZE: ::mode_t = 1024;
|
||||
pub const S_IREAD: ::mode_t = 256;
|
||||
pub const S_IWRITE: ::mode_t = 128;
|
||||
pub const S_IEXEC: ::mode_t = 64;
|
||||
pub const S_ENFMT: ::mode_t = 1024;
|
||||
pub const S_IFMT: ::mode_t = 61440;
|
||||
pub const S_IFDIR: ::mode_t = 16384;
|
||||
pub const S_IFCHR: ::mode_t = 8192;
|
||||
pub const S_IFBLK: ::mode_t = 24576;
|
||||
pub const S_IFREG: ::mode_t = 32768;
|
||||
pub const S_IFLNK: ::mode_t = 40960;
|
||||
pub const S_IFSOCK: ::mode_t = 49152;
|
||||
pub const S_IFIFO: ::mode_t = 4096;
|
||||
pub const S_IRUSR: ::mode_t = 256;
|
||||
pub const S_IWUSR: ::mode_t = 128;
|
||||
pub const S_IXUSR: ::mode_t = 64;
|
||||
pub const S_IRGRP: ::mode_t = 32;
|
||||
pub const S_IWGRP: ::mode_t = 16;
|
||||
pub const S_IXGRP: ::mode_t = 8;
|
||||
pub const S_IROTH: ::mode_t = 4;
|
||||
pub const S_IWOTH: ::mode_t = 2;
|
||||
pub const S_IXOTH: ::mode_t = 1;
|
||||
|
||||
pub const SOL_SOCKET: ::c_int = 65535;
|
||||
pub const SOL_TCP: ::c_int = 6;
|
||||
|
||||
pub const PF_UNSPEC: ::c_int = 0;
|
||||
pub const PF_INET: ::c_int = 2;
|
||||
pub const PF_INET6: ::c_int = 23;
|
||||
|
||||
pub const AF_UNSPEC: ::c_int = 0;
|
||||
pub const AF_INET: ::c_int = 2;
|
||||
pub const AF_INET6: ::c_int = 23;
|
||||
|
||||
pub const SOCK_STREAM: ::c_int = 1;
|
||||
pub const SOCK_DGRAM: ::c_int = 2;
|
||||
|
||||
pub const MSG_OOB: ::c_int = 1;
|
||||
pub const MSG_PEEK: ::c_int = 2;
|
||||
pub const MSG_DONTWAIT: ::c_int = 4;
|
||||
pub const MSG_DONTROUTE: ::c_int = 0;
|
||||
pub const MSG_WAITALL: ::c_int = 0;
|
||||
pub const MSG_MORE: ::c_int = 0;
|
||||
pub const MSG_NOSIGNAL: ::c_int = 0;
|
||||
|
||||
pub const SHUT_RD: ::c_int = 0;
|
||||
pub const SHUT_WR: ::c_int = 1;
|
||||
pub const SHUT_RDWR: ::c_int = 2;
|
||||
|
||||
pub const SO_REUSEADDR: ::c_int = 4;
|
||||
pub const SO_LINGER: ::c_int = 128;
|
||||
pub const SO_OOBINLINE: ::c_int = 256;
|
||||
pub const SO_SNDBUF: ::c_int = 4097;
|
||||
pub const SO_RCVBUF: ::c_int = 4098;
|
||||
pub const SO_SNDLOWAT: ::c_int = 4099;
|
||||
pub const SO_RCVLOWAT: ::c_int = 4100;
|
||||
pub const SO_TYPE: ::c_int = 4104;
|
||||
pub const SO_ERROR: ::c_int = 4105;
|
||||
|
||||
pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
|
||||
|
||||
pub const INET_ADDRSTRLEN: ::c_int = 16;
|
||||
|
||||
pub const IPPROTO_IP: ::c_int = 0;
|
||||
pub const IPPROTO_UDP: ::c_int = 17;
|
||||
pub const IPPROTO_TCP: ::c_int = 6;
|
||||
|
||||
pub const TCP_NODELAY: ::c_int = 8193;
|
||||
pub const TCP_MAXSEG: ::c_int = 8194;
|
||||
|
||||
pub const IP_TOS: ::c_int = 7;
|
||||
pub const IP_TTL: ::c_int = 8;
|
||||
pub const IP_MULTICAST_LOOP: ::c_int = 9;
|
||||
pub const IP_MULTICAST_TTL: ::c_int = 10;
|
||||
pub const IP_ADD_MEMBERSHIP: ::c_int = 11;
|
||||
pub const IP_DROP_MEMBERSHIP: ::c_int = 12;
|
||||
|
||||
pub const HOST_NOT_FOUND: ::c_int = 1;
|
||||
pub const NO_DATA: ::c_int = 2;
|
||||
pub const NO_ADDRESS: ::c_int = 2;
|
||||
pub const NO_RECOVERY: ::c_int = 3;
|
||||
pub const TRY_AGAIN: ::c_int = 4;
|
||||
|
||||
pub const AI_PASSIVE: ::c_int = 1;
|
||||
pub const AI_CANONNAME: ::c_int = 2;
|
||||
pub const AI_NUMERICHOST: ::c_int = 4;
|
||||
pub const AI_NUMERICSERV: ::c_int = 0;
|
||||
pub const AI_ADDRCONFIG: ::c_int = 0;
|
||||
|
||||
pub const NI_MAXHOST: ::c_int = 1025;
|
||||
pub const NI_MAXSERV: ::c_int = 32;
|
||||
pub const NI_NOFQDN: ::c_int = 1;
|
||||
pub const NI_NUMERICHOST: ::c_int = 2;
|
||||
pub const NI_NAMEREQD: ::c_int = 4;
|
||||
pub const NI_NUMERICSERV: ::c_int = 0;
|
||||
pub const NI_DGRAM: ::c_int = 0;
|
||||
|
||||
pub const EAI_FAMILY: ::c_int = -303;
|
||||
pub const EAI_MEMORY: ::c_int = -304;
|
||||
pub const EAI_NONAME: ::c_int = -305;
|
||||
pub const EAI_SOCKTYPE: ::c_int = -307;
|
||||
|
||||
f! {
|
||||
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
|
||||
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
let fd = fd as usize;
|
||||
(*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
|
||||
return
|
||||
}
|
||||
|
||||
pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
|
||||
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
let fd = fd as usize;
|
||||
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0
|
||||
}
|
||||
|
||||
pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
|
||||
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
|
||||
let fd = fd as usize;
|
||||
(*set).fds_bits[fd / bits] |= 1 << (fd % bits);
|
||||
return
|
||||
}
|
||||
|
||||
pub fn FD_ZERO(set: *mut fd_set) -> () {
|
||||
for slot in (*set).fds_bits.iter_mut() {
|
||||
*slot = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern {
|
||||
pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int;
|
||||
pub fn closesocket(sockfd: ::c_int) -> ::c_int;
|
||||
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
|
||||
pub fn recvfrom(fd: ::c_int, buf: *mut ::c_void, n: usize, flags: ::c_int,
|
||||
addr: *mut sockaddr, addr_len: *mut socklen_t) -> isize;
|
||||
pub fn getnameinfo(sa: *const sockaddr, salen: socklen_t,
|
||||
host: *mut ::c_char, hostlen: socklen_t,
|
||||
serv: *mut ::c_char, servlen: socklen_t,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
|
||||
pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
|
||||
envp: *const *const ::c_char)
|
||||
-> ::c_int;
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
|
||||
pub fn getgrgid_r(uid: ::uid_t,
|
||||
grp: *mut ::group,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut ::group) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sigaltstack$UNIX2003")]
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
|
||||
pub fn sigaltstack(ss: *const stack_t,
|
||||
oss: *mut stack_t) -> ::c_int;
|
||||
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
|
||||
pub fn getdtablesize() -> ::c_int;
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
|
||||
pub fn getgrnam_r(name: *const ::c_char,
|
||||
grp: *mut ::group,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut ::group) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pthread_sigmask$UNIX2003")]
|
||||
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
|
||||
oldset: *mut sigset_t) -> ::c_int;
|
||||
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
|
||||
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
|
||||
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
|
||||
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
|
||||
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
|
||||
pub fn getpwnam_r(name: *const ::c_char,
|
||||
pwd: *mut passwd,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut passwd) -> ::c_int;
|
||||
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
|
||||
pub fn getpwuid_r(uid: ::uid_t,
|
||||
pwd: *mut passwd,
|
||||
buf: *mut ::c_char,
|
||||
buflen: ::size_t,
|
||||
result: *mut *mut passwd) -> ::c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch ="x86"),
|
||||
link_name = "sigwait$UNIX2003")]
|
||||
#[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
|
||||
pub fn sigwait(set: *const sigset_t,
|
||||
sig: *mut ::c_int) -> ::c_int;
|
||||
pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
|
||||
parent: Option<unsafe extern fn()>,
|
||||
child: Option<unsafe extern fn()>) -> ::c_int;
|
||||
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "popen$UNIX2003")]
|
||||
pub fn popen(command: *const c_char,
|
||||
mode: *const c_char) -> *mut ::FILE;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_arch = "arm")] {
|
||||
mod arm;
|
||||
pub use self::arm::*;
|
||||
} else {
|
||||
// Only tested on ARM so far. Other platforms might have different
|
||||
// definitions for types and constants.
|
||||
pub use target_arch_not_implemented;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
pub type c_char = u8;
|
||||
pub type wchar_t = u32;
|
||||
|
||||
pub const O_DIRECT: ::c_int = 0x10000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x4000;
|
||||
pub const O_NOFOLLOW: ::c_int = 0x8000;
|
||||
pub const O_LARGEFILE: ::c_int = 0o400000;
|
||||
|
||||
pub const SYS_pivot_root: ::c_long = 218;
|
||||
pub const SYS_gettid: ::c_long = 224;
|
||||
pub const SYS_perf_event_open: ::c_long = 364;
|
||||
pub const SYS_memfd_create: ::c_long = 385;
|
@ -1,230 +0,0 @@
|
||||
// The following definitions are correct for arm and i686,
|
||||
// but may be wrong for mips
|
||||
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
||||
pub type mode_t = u16;
|
||||
pub type off64_t = ::c_longlong;
|
||||
pub type sigset_t = ::c_ulong;
|
||||
pub type socklen_t = i32;
|
||||
pub type time64_t = i64;
|
||||
|
||||
s! {
|
||||
pub struct sigaction {
|
||||
pub sa_sigaction: ::sighandler_t,
|
||||
pub sa_mask: ::sigset_t,
|
||||
pub sa_flags: ::c_ulong,
|
||||
pub sa_restorer: ::dox::Option<extern fn()>,
|
||||
}
|
||||
|
||||
pub struct rlimit64 {
|
||||
pub rlim_cur: u64,
|
||||
pub rlim_max: u64,
|
||||
}
|
||||
|
||||
pub struct stat {
|
||||
pub st_dev: ::c_ulonglong,
|
||||
__pad0: [::c_uchar; 4],
|
||||
__st_ino: ::ino_t,
|
||||
pub st_mode: ::c_uint,
|
||||
pub st_nlink: ::c_uint,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::c_ulonglong,
|
||||
__pad3: [::c_uchar; 4],
|
||||
pub st_size: ::c_longlong,
|
||||
pub st_blksize: ::blksize_t,
|
||||
pub st_blocks: ::c_ulonglong,
|
||||
pub st_atime: ::c_ulong,
|
||||
pub st_atime_nsec: ::c_ulong,
|
||||
pub st_mtime: ::c_ulong,
|
||||
pub st_mtime_nsec: ::c_ulong,
|
||||
pub st_ctime: ::c_ulong,
|
||||
pub st_ctime_nsec: ::c_ulong,
|
||||
pub st_ino: ::c_ulonglong,
|
||||
}
|
||||
|
||||
pub struct stat64 {
|
||||
pub st_dev: ::c_ulonglong,
|
||||
__pad0: [::c_uchar; 4],
|
||||
__st_ino: ::ino_t,
|
||||
pub st_mode: ::c_uint,
|
||||
pub st_nlink: ::c_uint,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::c_ulonglong,
|
||||
__pad3: [::c_uchar; 4],
|
||||
pub st_size: ::c_longlong,
|
||||
pub st_blksize: ::blksize_t,
|
||||
pub st_blocks: ::c_ulonglong,
|
||||
pub st_atime: ::c_ulong,
|
||||
pub st_atime_nsec: ::c_ulong,
|
||||
pub st_mtime: ::c_ulong,
|
||||
pub st_mtime_nsec: ::c_ulong,
|
||||
pub st_ctime: ::c_ulong,
|
||||
pub st_ctime_nsec: ::c_ulong,
|
||||
pub st_ino: ::c_ulonglong,
|
||||
}
|
||||
|
||||
pub struct statfs64 {
|
||||
pub f_type: u32,
|
||||
pub f_bsize: u32,
|
||||
pub f_blocks: u64,
|
||||
pub f_bfree: u64,
|
||||
pub f_bavail: u64,
|
||||
pub f_files: u64,
|
||||
pub f_ffree: u64,
|
||||
f_fsid: [u32; 2],
|
||||
pub f_namelen: u32,
|
||||
pub f_frsize: u32,
|
||||
pub f_flags: u32,
|
||||
pub f_spare: [u32; 4],
|
||||
}
|
||||
|
||||
pub struct statvfs64 {
|
||||
pub f_bsize: ::c_ulong,
|
||||
pub f_frsize: ::c_ulong,
|
||||
pub f_blocks: ::c_ulong,
|
||||
pub f_bfree: ::c_ulong,
|
||||
pub f_bavail: ::c_ulong,
|
||||
pub f_files: ::c_ulong,
|
||||
pub f_ffree: ::c_ulong,
|
||||
pub f_favail: ::c_ulong,
|
||||
pub f_fsid: ::c_ulong,
|
||||
pub f_flag: ::c_ulong,
|
||||
pub f_namemax: ::c_ulong,
|
||||
}
|
||||
|
||||
pub struct pthread_attr_t {
|
||||
pub flags: ::uint32_t,
|
||||
pub stack_base: *mut ::c_void,
|
||||
pub stack_size: ::size_t,
|
||||
pub guard_size: ::size_t,
|
||||
pub sched_policy: ::int32_t,
|
||||
pub sched_priority: ::int32_t,
|
||||
}
|
||||
|
||||
pub struct pthread_mutex_t { value: ::c_int }
|
||||
|
||||
pub struct pthread_cond_t { value: ::c_int }
|
||||
|
||||
pub struct pthread_rwlock_t {
|
||||
lock: pthread_mutex_t,
|
||||
cond: pthread_cond_t,
|
||||
numLocks: ::c_int,
|
||||
writerThreadId: ::c_int,
|
||||
pendingReaders: ::c_int,
|
||||
pendingWriters: ::c_int,
|
||||
attr: i32,
|
||||
__reserved: [::c_char; 12],
|
||||
}
|
||||
|
||||
pub struct passwd {
|
||||
pub pw_name: *mut ::c_char,
|
||||
pub pw_passwd: *mut ::c_char,
|
||||
pub pw_uid: ::uid_t,
|
||||
pub pw_gid: ::gid_t,
|
||||
pub pw_dir: *mut ::c_char,
|
||||
pub pw_shell: *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::uint32_t,
|
||||
pub f_bsize: ::uint32_t,
|
||||
pub f_blocks: ::uint64_t,
|
||||
pub f_bfree: ::uint64_t,
|
||||
pub f_bavail: ::uint64_t,
|
||||
pub f_files: ::uint64_t,
|
||||
pub f_ffree: ::uint64_t,
|
||||
pub f_fsid: ::__fsid_t,
|
||||
pub f_namelen: ::uint32_t,
|
||||
pub f_frsize: ::uint32_t,
|
||||
pub f_flags: ::uint32_t,
|
||||
pub f_spare: [::uint32_t; 4],
|
||||
}
|
||||
|
||||
pub struct sysinfo {
|
||||
pub uptime: ::c_long,
|
||||
pub loads: [::c_ulong; 3],
|
||||
pub totalram: ::c_ulong,
|
||||
pub freeram: ::c_ulong,
|
||||
pub sharedram: ::c_ulong,
|
||||
pub bufferram: ::c_ulong,
|
||||
pub totalswap: ::c_ulong,
|
||||
pub freeswap: ::c_ulong,
|
||||
pub procs: ::c_ushort,
|
||||
pub pad: ::c_ushort,
|
||||
pub totalhigh: ::c_ulong,
|
||||
pub freehigh: ::c_ulong,
|
||||
pub mem_unit: ::c_uint,
|
||||
pub _f: [::c_char; 8],
|
||||
}
|
||||
}
|
||||
|
||||
pub const RTLD_GLOBAL: ::c_int = 2;
|
||||
pub const RTLD_NOW: ::c_int = 0;
|
||||
pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void;
|
||||
|
||||
pub const PTRACE_GETFPREGS: ::c_int = 14;
|
||||
pub const PTRACE_SETFPREGS: ::c_int = 15;
|
||||
pub const PTRACE_GETREGS: ::c_int = 12;
|
||||
pub const PTRACE_SETREGS: ::c_int = 13;
|
||||
|
||||
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
|
||||
value: 0,
|
||||
};
|
||||
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
|
||||
value: 0,
|
||||
};
|
||||
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
|
||||
lock: PTHREAD_MUTEX_INITIALIZER,
|
||||
cond: PTHREAD_COND_INITIALIZER,
|
||||
numLocks: 0,
|
||||
writerThreadId: 0,
|
||||
pendingReaders: 0,
|
||||
pendingWriters: 0,
|
||||
attr: 0,
|
||||
__reserved: [0; 12],
|
||||
};
|
||||
pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2;
|
||||
pub const CPU_SETSIZE: ::size_t = 32;
|
||||
pub const __CPU_BITS: ::size_t = 32;
|
||||
|
||||
pub const UT_LINESIZE: usize = 8;
|
||||
pub const UT_NAMESIZE: usize = 8;
|
||||
pub const UT_HOSTSIZE: usize = 16;
|
||||
|
||||
pub const SIGSTKSZ: ::size_t = 8192;
|
||||
pub const MINSIGSTKSZ: ::size_t = 2048;
|
||||
|
||||
extern {
|
||||
pub fn bind(socket: ::c_int, address: *const ::sockaddr,
|
||||
address_len: socklen_t) -> ::c_int;
|
||||
|
||||
pub fn writev(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int) -> ::ssize_t;
|
||||
pub fn readv(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int) -> ::ssize_t;
|
||||
|
||||
pub fn sendmsg(fd: ::c_int,
|
||||
msg: *const ::msghdr,
|
||||
flags: ::c_int) -> ::ssize_t;
|
||||
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
|
||||
-> ::ssize_t;
|
||||
|
||||
pub fn timegm64(tm: *const ::tm) -> ::time64_t;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_arch = "x86")] {
|
||||
mod x86;
|
||||
pub use self::x86::*;
|
||||
} else if #[cfg(target_arch = "arm")] {
|
||||
mod arm;
|
||||
pub use self::arm::*;
|
||||
} else {
|
||||
// Unknown target_arch
|
||||
}
|
||||
}
|
@ -1,415 +0,0 @@
|
||||
pub type c_char = i8;
|
||||
pub type wchar_t = i32;
|
||||
|
||||
pub const O_DIRECT: ::c_int = 0x4000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x10000;
|
||||
pub const O_NOFOLLOW: ::c_int = 0x20000;
|
||||
pub const O_LARGEFILE: ::c_int = 0o0100000;
|
||||
|
||||
pub const MAP_32BIT: ::c_int = 0x40;
|
||||
|
||||
// Syscall table
|
||||
pub const SYS_restart_syscall: ::c_long = 0;
|
||||
pub const SYS_exit: ::c_long = 1;
|
||||
pub const SYS_fork: ::c_long = 2;
|
||||
pub const SYS_read: ::c_long = 3;
|
||||
pub const SYS_write: ::c_long = 4;
|
||||
pub const SYS_open: ::c_long = 5;
|
||||
pub const SYS_close: ::c_long = 6;
|
||||
pub const SYS_waitpid: ::c_long = 7;
|
||||
pub const SYS_creat: ::c_long = 8;
|
||||
pub const SYS_link: ::c_long = 9;
|
||||
pub const SYS_unlink: ::c_long = 10;
|
||||
pub const SYS_execve: ::c_long = 11;
|
||||
pub const SYS_chdir: ::c_long = 12;
|
||||
pub const SYS_time: ::c_long = 13;
|
||||
pub const SYS_mknod: ::c_long = 14;
|
||||
pub const SYS_chmod: ::c_long = 15;
|
||||
pub const SYS_lchown: ::c_long = 16;
|
||||
pub const SYS_break: ::c_long = 17;
|
||||
pub const SYS_oldstat: ::c_long = 18;
|
||||
pub const SYS_lseek: ::c_long = 19;
|
||||
pub const SYS_getpid: ::c_long = 20;
|
||||
pub const SYS_mount: ::c_long = 21;
|
||||
pub const SYS_umount: ::c_long = 22;
|
||||
pub const SYS_setuid: ::c_long = 23;
|
||||
pub const SYS_getuid: ::c_long = 24;
|
||||
pub const SYS_stime: ::c_long = 25;
|
||||
pub const SYS_ptrace: ::c_long = 26;
|
||||
pub const SYS_alarm: ::c_long = 27;
|
||||
pub const SYS_oldfstat: ::c_long = 28;
|
||||
pub const SYS_pause: ::c_long = 29;
|
||||
pub const SYS_utime: ::c_long = 30;
|
||||
pub const SYS_stty: ::c_long = 31;
|
||||
pub const SYS_gtty: ::c_long = 32;
|
||||
pub const SYS_access: ::c_long = 33;
|
||||
pub const SYS_nice: ::c_long = 34;
|
||||
pub const SYS_ftime: ::c_long = 35;
|
||||
pub const SYS_sync: ::c_long = 36;
|
||||
pub const SYS_kill: ::c_long = 37;
|
||||
pub const SYS_rename: ::c_long = 38;
|
||||
pub const SYS_mkdir: ::c_long = 39;
|
||||
pub const SYS_rmdir: ::c_long = 40;
|
||||
pub const SYS_dup: ::c_long = 41;
|
||||
pub const SYS_pipe: ::c_long = 42;
|
||||
pub const SYS_times: ::c_long = 43;
|
||||
pub const SYS_prof: ::c_long = 44;
|
||||
pub const SYS_brk: ::c_long = 45;
|
||||
pub const SYS_setgid: ::c_long = 46;
|
||||
pub const SYS_getgid: ::c_long = 47;
|
||||
pub const SYS_signal: ::c_long = 48;
|
||||
pub const SYS_geteuid: ::c_long = 49;
|
||||
pub const SYS_getegid: ::c_long = 50;
|
||||
pub const SYS_acct: ::c_long = 51;
|
||||
pub const SYS_umount2: ::c_long = 52;
|
||||
pub const SYS_lock: ::c_long = 53;
|
||||
pub const SYS_ioctl: ::c_long = 54;
|
||||
pub const SYS_fcntl: ::c_long = 55;
|
||||
pub const SYS_mpx: ::c_long = 56;
|
||||
pub const SYS_setpgid: ::c_long = 57;
|
||||
pub const SYS_ulimit: ::c_long = 58;
|
||||
pub const SYS_oldolduname: ::c_long = 59;
|
||||
pub const SYS_umask: ::c_long = 60;
|
||||
pub const SYS_chroot: ::c_long = 61;
|
||||
pub const SYS_ustat: ::c_long = 62;
|
||||
pub const SYS_dup2: ::c_long = 63;
|
||||
pub const SYS_getppid: ::c_long = 64;
|
||||
pub const SYS_getpgrp: ::c_long = 65;
|
||||
pub const SYS_setsid: ::c_long = 66;
|
||||
pub const SYS_sigaction: ::c_long = 67;
|
||||
pub const SYS_sgetmask: ::c_long = 68;
|
||||
pub const SYS_ssetmask: ::c_long = 69;
|
||||
pub const SYS_setreuid: ::c_long = 70;
|
||||
pub const SYS_setregid: ::c_long = 71;
|
||||
pub const SYS_sigsuspend: ::c_long = 72;
|
||||
pub const SYS_sigpending: ::c_long = 73;
|
||||
pub const SYS_sethostname: ::c_long = 74;
|
||||
pub const SYS_setrlimit: ::c_long = 75;
|
||||
pub const SYS_getrlimit: ::c_long = 76;
|
||||
pub const SYS_getrusage: ::c_long = 77;
|
||||
pub const SYS_gettimeofday: ::c_long = 78;
|
||||
pub const SYS_settimeofday: ::c_long = 79;
|
||||
pub const SYS_getgroups: ::c_long = 80;
|
||||
pub const SYS_setgroups: ::c_long = 81;
|
||||
pub const SYS_select: ::c_long = 82;
|
||||
pub const SYS_symlink: ::c_long = 83;
|
||||
pub const SYS_oldlstat: ::c_long = 84;
|
||||
pub const SYS_readlink: ::c_long = 85;
|
||||
pub const SYS_uselib: ::c_long = 86;
|
||||
pub const SYS_swapon: ::c_long = 87;
|
||||
pub const SYS_reboot: ::c_long = 88;
|
||||
pub const SYS_readdir: ::c_long = 89;
|
||||
pub const SYS_mmap: ::c_long = 90;
|
||||
pub const SYS_munmap: ::c_long = 91;
|
||||
pub const SYS_truncate: ::c_long = 92;
|
||||
pub const SYS_ftruncate: ::c_long = 93;
|
||||
pub const SYS_fchmod: ::c_long = 94;
|
||||
pub const SYS_fchown: ::c_long = 95;
|
||||
pub const SYS_getpriority: ::c_long = 96;
|
||||
pub const SYS_setpriority: ::c_long = 97;
|
||||
pub const SYS_profil: ::c_long = 98;
|
||||
pub const SYS_statfs: ::c_long = 99;
|
||||
pub const SYS_fstatfs: ::c_long = 100;
|
||||
pub const SYS_ioperm: ::c_long = 101;
|
||||
pub const SYS_socketcall: ::c_long = 102;
|
||||
pub const SYS_syslog: ::c_long = 103;
|
||||
pub const SYS_setitimer: ::c_long = 104;
|
||||
pub const SYS_getitimer: ::c_long = 105;
|
||||
pub const SYS_stat: ::c_long = 106;
|
||||
pub const SYS_lstat: ::c_long = 107;
|
||||
pub const SYS_fstat: ::c_long = 108;
|
||||
pub const SYS_olduname: ::c_long = 109;
|
||||
pub const SYS_iopl: ::c_long = 110;
|
||||
pub const SYS_vhangup: ::c_long = 111;
|
||||
pub const SYS_idle: ::c_long = 112;
|
||||
pub const SYS_vm86old: ::c_long = 113;
|
||||
pub const SYS_wait4: ::c_long = 114;
|
||||
pub const SYS_swapoff: ::c_long = 115;
|
||||
pub const SYS_sysinfo: ::c_long = 116;
|
||||
pub const SYS_ipc: ::c_long = 117;
|
||||
pub const SYS_fsync: ::c_long = 118;
|
||||
pub const SYS_sigreturn: ::c_long = 119;
|
||||
pub const SYS_clone: ::c_long = 120;
|
||||
pub const SYS_setdomainname: ::c_long = 121;
|
||||
pub const SYS_uname: ::c_long = 122;
|
||||
pub const SYS_modify_ldt: ::c_long = 123;
|
||||
pub const SYS_adjtimex: ::c_long = 124;
|
||||
pub const SYS_mprotect: ::c_long = 125;
|
||||
pub const SYS_sigprocmask: ::c_long = 126;
|
||||
pub const SYS_create_module: ::c_long = 127;
|
||||
pub const SYS_init_module: ::c_long = 128;
|
||||
pub const SYS_delete_module: ::c_long = 129;
|
||||
pub const SYS_get_kernel_syms: ::c_long = 130;
|
||||
pub const SYS_quotactl: ::c_long = 131;
|
||||
pub const SYS_getpgid: ::c_long = 132;
|
||||
pub const SYS_fchdir: ::c_long = 133;
|
||||
pub const SYS_bdflush: ::c_long = 134;
|
||||
pub const SYS_sysfs: ::c_long = 135;
|
||||
pub const SYS_personality: ::c_long = 136;
|
||||
pub const SYS_afs_syscall: ::c_long = 137;
|
||||
pub const SYS_setfsuid: ::c_long = 138;
|
||||
pub const SYS_setfsgid: ::c_long = 139;
|
||||
// FIXME: SYS__llseek is in the NDK sources but for some reason is
|
||||
// not available in the tests
|
||||
// pub const SYS__llseek: ::c_long = 140;
|
||||
pub const SYS_getdents: ::c_long = 141;
|
||||
// FIXME: SYS__newselect is in the NDK sources but for some reason is
|
||||
// not available in the tests
|
||||
// pub const SYS__newselect: ::c_long = 142;
|
||||
pub const SYS_flock: ::c_long = 143;
|
||||
pub const SYS_msync: ::c_long = 144;
|
||||
pub const SYS_readv: ::c_long = 145;
|
||||
pub const SYS_writev: ::c_long = 146;
|
||||
pub const SYS_getsid: ::c_long = 147;
|
||||
pub const SYS_fdatasync: ::c_long = 148;
|
||||
// FIXME: SYS__llseek is in the NDK sources but for some reason is
|
||||
// not available in the tests
|
||||
// pub const SYS__sysctl: ::c_long = 149;
|
||||
pub const SYS_mlock: ::c_long = 150;
|
||||
pub const SYS_munlock: ::c_long = 151;
|
||||
pub const SYS_mlockall: ::c_long = 152;
|
||||
pub const SYS_munlockall: ::c_long = 153;
|
||||
pub const SYS_sched_setparam: ::c_long = 154;
|
||||
pub const SYS_sched_getparam: ::c_long = 155;
|
||||
pub const SYS_sched_setscheduler: ::c_long = 156;
|
||||
pub const SYS_sched_getscheduler: ::c_long = 157;
|
||||
pub const SYS_sched_yield: ::c_long = 158;
|
||||
pub const SYS_sched_get_priority_max: ::c_long = 159;
|
||||
pub const SYS_sched_get_priority_min: ::c_long = 160;
|
||||
pub const SYS_sched_rr_get_interval: ::c_long = 161;
|
||||
pub const SYS_nanosleep: ::c_long = 162;
|
||||
pub const SYS_mremap: ::c_long = 163;
|
||||
pub const SYS_setresuid: ::c_long = 164;
|
||||
pub const SYS_getresuid: ::c_long = 165;
|
||||
pub const SYS_vm86: ::c_long = 166;
|
||||
pub const SYS_query_module: ::c_long = 167;
|
||||
pub const SYS_poll: ::c_long = 168;
|
||||
pub const SYS_nfsservctl: ::c_long = 169;
|
||||
pub const SYS_setresgid: ::c_long = 170;
|
||||
pub const SYS_getresgid: ::c_long = 171;
|
||||
pub const SYS_prctl: ::c_long = 172;
|
||||
pub const SYS_rt_sigreturn: ::c_long = 173;
|
||||
pub const SYS_rt_sigaction: ::c_long = 174;
|
||||
pub const SYS_rt_sigprocmask: ::c_long = 175;
|
||||
pub const SYS_rt_sigpending: ::c_long = 176;
|
||||
pub const SYS_rt_sigtimedwait: ::c_long = 177;
|
||||
pub const SYS_rt_sigqueueinfo: ::c_long = 178;
|
||||
pub const SYS_rt_sigsuspend: ::c_long = 179;
|
||||
pub const SYS_pread64: ::c_long = 180;
|
||||
pub const SYS_pwrite64: ::c_long = 181;
|
||||
pub const SYS_chown: ::c_long = 182;
|
||||
pub const SYS_getcwd: ::c_long = 183;
|
||||
pub const SYS_capget: ::c_long = 184;
|
||||
pub const SYS_capset: ::c_long = 185;
|
||||
pub const SYS_sigaltstack: ::c_long = 186;
|
||||
pub const SYS_sendfile: ::c_long = 187;
|
||||
pub const SYS_getpmsg: ::c_long = 188;
|
||||
pub const SYS_putpmsg: ::c_long = 189;
|
||||
pub const SYS_vfork: ::c_long = 190;
|
||||
pub const SYS_ugetrlimit: ::c_long = 191;
|
||||
pub const SYS_mmap2: ::c_long = 192;
|
||||
pub const SYS_truncate64: ::c_long = 193;
|
||||
pub const SYS_ftruncate64: ::c_long = 194;
|
||||
pub const SYS_stat64: ::c_long = 195;
|
||||
pub const SYS_lstat64: ::c_long = 196;
|
||||
pub const SYS_fstat64: ::c_long = 197;
|
||||
pub const SYS_lchown32: ::c_long = 198;
|
||||
pub const SYS_getuid32: ::c_long = 199;
|
||||
pub const SYS_getgid32: ::c_long = 200;
|
||||
pub const SYS_geteuid32: ::c_long = 201;
|
||||
pub const SYS_getegid32: ::c_long = 202;
|
||||
pub const SYS_setreuid32: ::c_long = 203;
|
||||
pub const SYS_setregid32: ::c_long = 204;
|
||||
pub const SYS_getgroups32: ::c_long = 205;
|
||||
pub const SYS_setgroups32: ::c_long = 206;
|
||||
pub const SYS_fchown32: ::c_long = 207;
|
||||
pub const SYS_setresuid32: ::c_long = 208;
|
||||
pub const SYS_getresuid32: ::c_long = 209;
|
||||
pub const SYS_setresgid32: ::c_long = 210;
|
||||
pub const SYS_getresgid32: ::c_long = 211;
|
||||
pub const SYS_chown32: ::c_long = 212;
|
||||
pub const SYS_setuid32: ::c_long = 213;
|
||||
pub const SYS_setgid32: ::c_long = 214;
|
||||
pub const SYS_setfsuid32: ::c_long = 215;
|
||||
pub const SYS_setfsgid32: ::c_long = 216;
|
||||
pub const SYS_pivot_root: ::c_long = 217;
|
||||
pub const SYS_mincore: ::c_long = 218;
|
||||
pub const SYS_madvise: ::c_long = 219;
|
||||
pub const SYS_getdents64: ::c_long = 220;
|
||||
pub const SYS_fcntl64: ::c_long = 221;
|
||||
pub const SYS_gettid: ::c_long = 224;
|
||||
pub const SYS_readahead: ::c_long = 225;
|
||||
pub const SYS_setxattr: ::c_long = 226;
|
||||
pub const SYS_lsetxattr: ::c_long = 227;
|
||||
pub const SYS_fsetxattr: ::c_long = 228;
|
||||
pub const SYS_getxattr: ::c_long = 229;
|
||||
pub const SYS_lgetxattr: ::c_long = 230;
|
||||
pub const SYS_fgetxattr: ::c_long = 231;
|
||||
pub const SYS_listxattr: ::c_long = 232;
|
||||
pub const SYS_llistxattr: ::c_long = 233;
|
||||
pub const SYS_flistxattr: ::c_long = 234;
|
||||
pub const SYS_removexattr: ::c_long = 235;
|
||||
pub const SYS_lremovexattr: ::c_long = 236;
|
||||
pub const SYS_fremovexattr: ::c_long = 237;
|
||||
pub const SYS_tkill: ::c_long = 238;
|
||||
pub const SYS_sendfile64: ::c_long = 239;
|
||||
pub const SYS_futex: ::c_long = 240;
|
||||
pub const SYS_sched_setaffinity: ::c_long = 241;
|
||||
pub const SYS_sched_getaffinity: ::c_long = 242;
|
||||
pub const SYS_set_thread_area: ::c_long = 243;
|
||||
pub const SYS_get_thread_area: ::c_long = 244;
|
||||
pub const SYS_io_setup: ::c_long = 245;
|
||||
pub const SYS_io_destroy: ::c_long = 246;
|
||||
pub const SYS_io_getevents: ::c_long = 247;
|
||||
pub const SYS_io_submit: ::c_long = 248;
|
||||
pub const SYS_io_cancel: ::c_long = 249;
|
||||
pub const SYS_fadvise64: ::c_long = 250;
|
||||
pub const SYS_exit_group: ::c_long = 252;
|
||||
pub const SYS_lookup_dcookie: ::c_long = 253;
|
||||
pub const SYS_epoll_create: ::c_long = 254;
|
||||
pub const SYS_epoll_ctl: ::c_long = 255;
|
||||
pub const SYS_epoll_wait: ::c_long = 256;
|
||||
pub const SYS_remap_file_pages: ::c_long = 257;
|
||||
pub const SYS_set_tid_address: ::c_long = 258;
|
||||
pub const SYS_timer_create: ::c_long = 259;
|
||||
pub const SYS_timer_settime: ::c_long = 260;
|
||||
pub const SYS_timer_gettime: ::c_long = 261;
|
||||
pub const SYS_timer_getoverrun: ::c_long = 262;
|
||||
pub const SYS_timer_delete: ::c_long = 263;
|
||||
pub const SYS_clock_settime: ::c_long = 264;
|
||||
pub const SYS_clock_gettime: ::c_long = 265;
|
||||
pub const SYS_clock_getres: ::c_long = 266;
|
||||
pub const SYS_clock_nanosleep: ::c_long = 267;
|
||||
pub const SYS_statfs64: ::c_long = 268;
|
||||
pub const SYS_fstatfs64: ::c_long = 269;
|
||||
pub const SYS_tgkill: ::c_long = 270;
|
||||
pub const SYS_utimes: ::c_long = 271;
|
||||
pub const SYS_fadvise64_64: ::c_long = 272;
|
||||
pub const SYS_vserver: ::c_long = 273;
|
||||
pub const SYS_mbind: ::c_long = 274;
|
||||
pub const SYS_get_mempolicy: ::c_long = 275;
|
||||
pub const SYS_set_mempolicy: ::c_long = 276;
|
||||
pub const SYS_mq_open: ::c_long = 277;
|
||||
pub const SYS_mq_unlink: ::c_long = 278;
|
||||
pub const SYS_mq_timedsend: ::c_long = 279;
|
||||
pub const SYS_mq_timedreceive: ::c_long = 280;
|
||||
pub const SYS_mq_notify: ::c_long = 281;
|
||||
pub const SYS_mq_getsetattr: ::c_long = 282;
|
||||
pub const SYS_kexec_load: ::c_long = 283;
|
||||
pub const SYS_waitid: ::c_long = 284;
|
||||
pub const SYS_add_key: ::c_long = 286;
|
||||
pub const SYS_request_key: ::c_long = 287;
|
||||
pub const SYS_keyctl: ::c_long = 288;
|
||||
pub const SYS_ioprio_set: ::c_long = 289;
|
||||
pub const SYS_ioprio_get: ::c_long = 290;
|
||||
pub const SYS_inotify_init: ::c_long = 291;
|
||||
pub const SYS_inotify_add_watch: ::c_long = 292;
|
||||
pub const SYS_inotify_rm_watch: ::c_long = 293;
|
||||
pub const SYS_migrate_pages: ::c_long = 294;
|
||||
pub const SYS_openat: ::c_long = 295;
|
||||
pub const SYS_mkdirat: ::c_long = 296;
|
||||
pub const SYS_mknodat: ::c_long = 297;
|
||||
pub const SYS_fchownat: ::c_long = 298;
|
||||
pub const SYS_futimesat: ::c_long = 299;
|
||||
pub const SYS_fstatat64: ::c_long = 300;
|
||||
pub const SYS_unlinkat: ::c_long = 301;
|
||||
pub const SYS_renameat: ::c_long = 302;
|
||||
pub const SYS_linkat: ::c_long = 303;
|
||||
pub const SYS_symlinkat: ::c_long = 304;
|
||||
pub const SYS_readlinkat: ::c_long = 305;
|
||||
pub const SYS_fchmodat: ::c_long = 306;
|
||||
pub const SYS_faccessat: ::c_long = 307;
|
||||
pub const SYS_pselect6: ::c_long = 308;
|
||||
pub const SYS_ppoll: ::c_long = 309;
|
||||
pub const SYS_unshare: ::c_long = 310;
|
||||
pub const SYS_set_robust_list: ::c_long = 311;
|
||||
pub const SYS_get_robust_list: ::c_long = 312;
|
||||
pub const SYS_splice: ::c_long = 313;
|
||||
pub const SYS_sync_file_range: ::c_long = 314;
|
||||
pub const SYS_tee: ::c_long = 315;
|
||||
pub const SYS_vmsplice: ::c_long = 316;
|
||||
pub const SYS_move_pages: ::c_long = 317;
|
||||
pub const SYS_getcpu: ::c_long = 318;
|
||||
pub const SYS_epoll_pwait: ::c_long = 319;
|
||||
pub const SYS_utimensat: ::c_long = 320;
|
||||
pub const SYS_signalfd: ::c_long = 321;
|
||||
pub const SYS_timerfd_create: ::c_long = 322;
|
||||
pub const SYS_eventfd: ::c_long = 323;
|
||||
pub const SYS_fallocate: ::c_long = 324;
|
||||
pub const SYS_timerfd_settime: ::c_long = 325;
|
||||
pub const SYS_timerfd_gettime: ::c_long = 326;
|
||||
pub const SYS_signalfd4: ::c_long = 327;
|
||||
pub const SYS_eventfd2: ::c_long = 328;
|
||||
pub const SYS_epoll_create1: ::c_long = 329;
|
||||
pub const SYS_dup3: ::c_long = 330;
|
||||
pub const SYS_pipe2: ::c_long = 331;
|
||||
pub const SYS_inotify_init1: ::c_long = 332;
|
||||
pub const SYS_preadv: ::c_long = 333;
|
||||
pub const SYS_pwritev: ::c_long = 334;
|
||||
pub const SYS_rt_tgsigqueueinfo: ::c_long = 335;
|
||||
pub const SYS_perf_event_open: ::c_long = 336;
|
||||
pub const SYS_recvmmsg: ::c_long = 337;
|
||||
pub const SYS_fanotify_init: ::c_long = 338;
|
||||
pub const SYS_fanotify_mark: ::c_long = 339;
|
||||
pub const SYS_prlimit64: ::c_long = 340;
|
||||
pub const SYS_name_to_handle_at: ::c_long = 341;
|
||||
pub const SYS_open_by_handle_at: ::c_long = 342;
|
||||
pub const SYS_clock_adjtime: ::c_long = 343;
|
||||
pub const SYS_syncfs: ::c_long = 344;
|
||||
pub const SYS_sendmmsg: ::c_long = 345;
|
||||
pub const SYS_setns: ::c_long = 346;
|
||||
pub const SYS_process_vm_readv: ::c_long = 347;
|
||||
pub const SYS_process_vm_writev: ::c_long = 348;
|
||||
pub const SYS_kcmp: ::c_long = 349;
|
||||
pub const SYS_finit_module: ::c_long = 350;
|
||||
pub const SYS_sched_setattr: ::c_long = 351;
|
||||
pub const SYS_sched_getattr: ::c_long = 352;
|
||||
pub const SYS_renameat2: ::c_long = 353;
|
||||
pub const SYS_seccomp: ::c_long = 354;
|
||||
pub const SYS_getrandom: ::c_long = 355;
|
||||
pub const SYS_memfd_create: ::c_long = 356;
|
||||
pub const SYS_bpf: ::c_long = 357;
|
||||
pub const SYS_execveat: ::c_long = 358;
|
||||
pub const SYS_socket: ::c_long = 359;
|
||||
pub const SYS_socketpair: ::c_long = 360;
|
||||
pub const SYS_bind: ::c_long = 361;
|
||||
pub const SYS_connect: ::c_long = 362;
|
||||
pub const SYS_listen: ::c_long = 363;
|
||||
pub const SYS_accept4: ::c_long = 364;
|
||||
pub const SYS_getsockopt: ::c_long = 365;
|
||||
pub const SYS_setsockopt: ::c_long = 366;
|
||||
pub const SYS_getsockname: ::c_long = 367;
|
||||
pub const SYS_getpeername: ::c_long = 368;
|
||||
pub const SYS_sendto: ::c_long = 369;
|
||||
pub const SYS_sendmsg: ::c_long = 370;
|
||||
pub const SYS_recvfrom: ::c_long = 371;
|
||||
pub const SYS_recvmsg: ::c_long = 372;
|
||||
pub const SYS_shutdown: ::c_long = 373;
|
||||
pub const SYS_userfaultfd: ::c_long = 374;
|
||||
pub const SYS_membarrier: ::c_long = 375;
|
||||
pub const SYS_mlock2: ::c_long = 376;
|
||||
pub const SYS_copy_file_range: ::c_long = 377;
|
||||
pub const SYS_preadv2: ::c_long = 378;
|
||||
pub const SYS_pwritev2: ::c_long = 379;
|
||||
pub const SYS_pkey_mprotect: ::c_long = 380;
|
||||
pub const SYS_pkey_alloc: ::c_long = 381;
|
||||
pub const SYS_pkey_free: ::c_long = 382;
|
||||
|
||||
// offsets in user_regs_structs, from sys/reg.h
|
||||
pub const EBX: ::c_int = 0;
|
||||
pub const ECX: ::c_int = 1;
|
||||
pub const EDX: ::c_int = 2;
|
||||
pub const ESI: ::c_int = 3;
|
||||
pub const EDI: ::c_int = 4;
|
||||
pub const EBP: ::c_int = 5;
|
||||
pub const EAX: ::c_int = 6;
|
||||
pub const DS: ::c_int = 7;
|
||||
pub const ES: ::c_int = 8;
|
||||
pub const FS: ::c_int = 9;
|
||||
pub const GS: ::c_int = 10;
|
||||
pub const ORIG_EAX: ::c_int = 11;
|
||||
pub const EIP: ::c_int = 12;
|
||||
pub const CS: ::c_int = 13;
|
||||
pub const EFL: ::c_int = 14;
|
||||
pub const UESP: ::c_int = 15;
|
||||
pub const SS: ::c_int = 16;
|
@ -1,63 +0,0 @@
|
||||
pub type c_char = u8;
|
||||
pub type wchar_t = u32;
|
||||
|
||||
s! {
|
||||
pub struct stat {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_mode: ::c_uint,
|
||||
pub st_nlink: ::c_uint,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
__pad1: ::c_ulong,
|
||||
pub st_size: ::off64_t,
|
||||
pub st_blksize: ::c_int,
|
||||
__pad2: ::c_int,
|
||||
pub st_blocks: ::c_long,
|
||||
pub st_atime: ::time_t,
|
||||
pub st_atime_nsec: ::c_ulong,
|
||||
pub st_mtime: ::time_t,
|
||||
pub st_mtime_nsec: ::c_ulong,
|
||||
pub st_ctime: ::time_t,
|
||||
pub st_ctime_nsec: ::c_ulong,
|
||||
__unused4: ::c_uint,
|
||||
__unused5: ::c_uint,
|
||||
}
|
||||
|
||||
pub struct stat64 {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_mode: ::c_uint,
|
||||
pub st_nlink: ::c_uint,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
__pad1: ::c_ulong,
|
||||
pub st_size: ::off64_t,
|
||||
pub st_blksize: ::c_int,
|
||||
__pad2: ::c_int,
|
||||
pub st_blocks: ::c_long,
|
||||
pub st_atime: ::time_t,
|
||||
pub st_atime_nsec: ::c_ulong,
|
||||
pub st_mtime: ::time_t,
|
||||
pub st_mtime_nsec: ::c_ulong,
|
||||
pub st_ctime: ::time_t,
|
||||
pub st_ctime_nsec: ::c_ulong,
|
||||
__unused4: ::c_uint,
|
||||
__unused5: ::c_uint,
|
||||
}
|
||||
}
|
||||
|
||||
pub const O_DIRECT: ::c_int = 0x10000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x4000;
|
||||
pub const O_NOFOLLOW: ::c_int = 0x8000;
|
||||
pub const O_LARGEFILE: ::c_int = 0o400000;
|
||||
|
||||
pub const SYS_pivot_root: ::c_long = 41;
|
||||
pub const SYS_gettid: ::c_long = 178;
|
||||
pub const SYS_perf_event_open: ::c_long = 241;
|
||||
pub const SYS_memfd_create: ::c_long = 279;
|
||||
|
||||
pub const SIGSTKSZ: ::size_t = 16384;
|
||||
pub const MINSIGSTKSZ: ::size_t = 5120;
|
@ -1,192 +0,0 @@
|
||||
// The following definitions are correct for aarch64 and x86_64,
|
||||
// but may be wrong for mips64
|
||||
|
||||
pub type c_long = i64;
|
||||
pub type c_ulong = u64;
|
||||
pub type mode_t = u32;
|
||||
pub type off64_t = i64;
|
||||
pub type socklen_t = u32;
|
||||
|
||||
s! {
|
||||
pub struct sigset_t {
|
||||
__val: [::c_ulong; 1],
|
||||
}
|
||||
|
||||
pub struct sigaction {
|
||||
pub sa_flags: ::c_uint,
|
||||
pub sa_sigaction: ::sighandler_t,
|
||||
pub sa_mask: ::sigset_t,
|
||||
pub sa_restorer: ::dox::Option<extern fn()>,
|
||||
}
|
||||
|
||||
pub struct rlimit64 {
|
||||
pub rlim_cur: ::c_ulonglong,
|
||||
pub rlim_max: ::c_ulonglong,
|
||||
}
|
||||
|
||||
pub struct pthread_attr_t {
|
||||
pub flags: ::uint32_t,
|
||||
pub stack_base: *mut ::c_void,
|
||||
pub stack_size: ::size_t,
|
||||
pub guard_size: ::size_t,
|
||||
pub sched_policy: ::int32_t,
|
||||
pub sched_priority: ::int32_t,
|
||||
__reserved: [::c_char; 16],
|
||||
}
|
||||
|
||||
pub struct pthread_mutex_t {
|
||||
value: ::c_int,
|
||||
__reserved: [::c_char; 36],
|
||||
}
|
||||
|
||||
pub struct pthread_cond_t {
|
||||
value: ::c_int,
|
||||
__reserved: [::c_char; 44],
|
||||
}
|
||||
|
||||
pub struct pthread_rwlock_t {
|
||||
numLocks: ::c_int,
|
||||
writerThreadId: ::c_int,
|
||||
pendingReaders: ::c_int,
|
||||
pendingWriters: ::c_int,
|
||||
attr: i32,
|
||||
__reserved: [::c_char; 36],
|
||||
}
|
||||
|
||||
pub struct passwd {
|
||||
pub pw_name: *mut ::c_char,
|
||||
pub pw_passwd: *mut ::c_char,
|
||||
pub pw_uid: ::uid_t,
|
||||
pub pw_gid: ::gid_t,
|
||||
pub pw_gecos: *mut ::c_char,
|
||||
pub pw_dir: *mut ::c_char,
|
||||
pub pw_shell: *mut ::c_char,
|
||||
}
|
||||
|
||||
pub struct statfs {
|
||||
pub f_type: ::uint64_t,
|
||||
pub f_bsize: ::uint64_t,
|
||||
pub f_blocks: ::uint64_t,
|
||||
pub f_bfree: ::uint64_t,
|
||||
pub f_bavail: ::uint64_t,
|
||||
pub f_files: ::uint64_t,
|
||||
pub f_ffree: ::uint64_t,
|
||||
pub f_fsid: ::__fsid_t,
|
||||
pub f_namelen: ::uint64_t,
|
||||
pub f_frsize: ::uint64_t,
|
||||
pub f_flags: ::uint64_t,
|
||||
pub f_spare: [::uint64_t; 4],
|
||||
}
|
||||
|
||||
pub struct sysinfo {
|
||||
pub uptime: ::c_long,
|
||||
pub loads: [::c_ulong; 3],
|
||||
pub totalram: ::c_ulong,
|
||||
pub freeram: ::c_ulong,
|
||||
pub sharedram: ::c_ulong,
|
||||
pub bufferram: ::c_ulong,
|
||||
pub totalswap: ::c_ulong,
|
||||
pub freeswap: ::c_ulong,
|
||||
pub procs: ::c_ushort,
|
||||
pub pad: ::c_ushort,
|
||||
pub totalhigh: ::c_ulong,
|
||||
pub freehigh: ::c_ulong,
|
||||
pub mem_unit: ::c_uint,
|
||||
pub _f: [::c_char; 0],
|
||||
}
|
||||
|
||||
pub struct statfs64 {
|
||||
pub f_type: u64,
|
||||
pub f_bsize: u64,
|
||||
pub f_blocks: u64,
|
||||
pub f_bfree: u64,
|
||||
pub f_bavail: u64,
|
||||
pub f_files: u64,
|
||||
pub f_ffree: u64,
|
||||
f_fsid: [u32; 2],
|
||||
pub f_namelen: u64,
|
||||
pub f_frsize: u64,
|
||||
pub f_flags: u64,
|
||||
pub f_spare: [u64; 4],
|
||||
}
|
||||
|
||||
pub struct statvfs64 {
|
||||
pub f_bsize: ::c_ulong,
|
||||
pub f_frsize: ::c_ulong,
|
||||
pub f_blocks: u64,
|
||||
pub f_bfree: u64,
|
||||
pub f_bavail: u64,
|
||||
pub f_files: u64,
|
||||
pub f_ffree: u64,
|
||||
pub f_favail: u64,
|
||||
pub f_fsid: ::c_ulong,
|
||||
pub f_flag: ::c_ulong,
|
||||
pub f_namemax: ::c_ulong,
|
||||
__f_spare: [::c_int; 6],
|
||||
}
|
||||
}
|
||||
|
||||
pub const RTLD_GLOBAL: ::c_int = 0x00100;
|
||||
pub const RTLD_NOW: ::c_int = 2;
|
||||
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
|
||||
|
||||
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
|
||||
value: 0,
|
||||
__reserved: [0; 36],
|
||||
};
|
||||
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
|
||||
value: 0,
|
||||
__reserved: [0; 44],
|
||||
};
|
||||
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
|
||||
numLocks: 0,
|
||||
writerThreadId: 0,
|
||||
pendingReaders: 0,
|
||||
pendingWriters: 0,
|
||||
attr: 0,
|
||||
__reserved: [0; 36],
|
||||
};
|
||||
pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 4;
|
||||
pub const CPU_SETSIZE: ::size_t = 1024;
|
||||
pub const __CPU_BITS: ::size_t = 64;
|
||||
|
||||
pub const UT_LINESIZE: usize = 32;
|
||||
pub const UT_NAMESIZE: usize = 32;
|
||||
pub const UT_HOSTSIZE: usize = 256;
|
||||
|
||||
// Some weirdness in Android
|
||||
extern {
|
||||
// address_len should be socklen_t, but it is c_int!
|
||||
pub fn bind(socket: ::c_int, address: *const ::sockaddr,
|
||||
address_len: ::c_int) -> ::c_int;
|
||||
|
||||
// the return type should be ::ssize_t, but it is c_int!
|
||||
pub fn writev(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int) -> ::c_int;
|
||||
|
||||
// the return type should be ::ssize_t, but it is c_int!
|
||||
pub fn readv(fd: ::c_int,
|
||||
iov: *const ::iovec,
|
||||
iovcnt: ::c_int) -> ::c_int;
|
||||
|
||||
// the return type should be ::ssize_t, but it is c_int!
|
||||
pub fn sendmsg(fd: ::c_int,
|
||||
msg: *const ::msghdr,
|
||||
flags: ::c_int) -> ::c_int;
|
||||
|
||||
// the return type should be ::ssize_t, but it is c_int!
|
||||
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::c_int;
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_arch = "x86_64")] {
|
||||
mod x86_64;
|
||||
pub use self::x86_64::*;
|
||||
} else if #[cfg(target_arch = "aarch64")] {
|
||||
mod aarch64;
|
||||
pub use self::aarch64::*;
|
||||
} else {
|
||||
// Unknown target_arch
|
||||
}
|
||||
}
|
@ -1,420 +0,0 @@
|
||||
pub type c_char = i8;
|
||||
pub type wchar_t = i32;
|
||||
|
||||
s! {
|
||||
pub struct stat {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_nlink: ::c_ulong,
|
||||
pub st_mode: ::c_uint,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
pub st_size: ::off64_t,
|
||||
pub st_blksize: ::c_long,
|
||||
pub st_blocks: ::c_long,
|
||||
pub st_atime: ::c_ulong,
|
||||
pub st_atime_nsec: ::c_ulong,
|
||||
pub st_mtime: ::c_ulong,
|
||||
pub st_mtime_nsec: ::c_ulong,
|
||||
pub st_ctime: ::c_ulong,
|
||||
pub st_ctime_nsec: ::c_ulong,
|
||||
__unused: [::c_long; 3],
|
||||
}
|
||||
|
||||
pub struct stat64 {
|
||||
pub st_dev: ::dev_t,
|
||||
pub st_ino: ::ino_t,
|
||||
pub st_nlink: ::c_ulong,
|
||||
pub st_mode: ::c_uint,
|
||||
pub st_uid: ::uid_t,
|
||||
pub st_gid: ::gid_t,
|
||||
pub st_rdev: ::dev_t,
|
||||
pub st_size: ::off64_t,
|
||||
pub st_blksize: ::c_long,
|
||||
pub st_blocks: ::c_long,
|
||||
pub st_atime: ::c_ulong,
|
||||
pub st_atime_nsec: ::c_ulong,
|
||||
pub st_mtime: ::c_ulong,
|
||||
pub st_mtime_nsec: ::c_ulong,
|
||||
pub st_ctime: ::c_ulong,
|
||||
pub st_ctime_nsec: ::c_ulong,
|
||||
__unused: [::c_long; 3],
|
||||
}
|
||||
}
|
||||
|
||||
pub const O_DIRECT: ::c_int = 0x4000;
|
||||
pub const O_DIRECTORY: ::c_int = 0x10000;
|
||||
pub const O_NOFOLLOW: ::c_int = 0x20000;
|
||||
pub const O_LARGEFILE: ::c_int = 0o0100000;
|
||||
|
||||
pub const SIGSTKSZ: ::size_t = 8192;
|
||||
pub const MINSIGSTKSZ: ::size_t = 2048;
|
||||
|
||||
pub const MAP_32BIT: ::c_int = 0x40;
|
||||
|
||||
// Syscall table
|
||||
|
||||
pub const SYS_read: ::c_long = 0;
|
||||
pub const SYS_write: ::c_long = 1;
|
||||
pub const SYS_open: ::c_long = 2;
|
||||
pub const SYS_close: ::c_long = 3;
|
||||
pub const SYS_stat: ::c_long = 4;
|
||||
pub const SYS_fstat: ::c_long = 5;
|
||||
pub const SYS_lstat: ::c_long = 6;
|
||||
pub const SYS_poll: ::c_long = 7;
|
||||
pub const SYS_lseek: ::c_long = 8;
|
||||
pub const SYS_mmap: ::c_long = 9;
|
||||
pub const SYS_mprotect: ::c_long = 10;
|
||||
pub const SYS_munmap: ::c_long = 11;
|
||||
pub const SYS_brk: ::c_long = 12;
|
||||
pub const SYS_rt_sigaction: ::c_long = 13;
|
||||
pub const SYS_rt_sigprocmask: ::c_long = 14;
|
||||
pub const SYS_rt_sigreturn: ::c_long = 15;
|
||||
pub const SYS_ioctl: ::c_long = 16;
|
||||
pub const SYS_pread64: ::c_long = 17;
|
||||
pub const SYS_pwrite64: ::c_long = 18;
|
||||
pub const SYS_readv: ::c_long = 19;
|
||||
pub const SYS_writev: ::c_long = 20;
|
||||
pub const SYS_access: ::c_long = 21;
|
||||
pub const SYS_pipe: ::c_long = 22;
|
||||
pub const SYS_select: ::c_long = 23;
|
||||
pub const SYS_sched_yield: ::c_long = 24;
|
||||
pub const SYS_mremap: ::c_long = 25;
|
||||
pub const SYS_msync: ::c_long = 26;
|
||||
pub const SYS_mincore: ::c_long = 27;
|
||||
pub const SYS_madvise: ::c_long = 28;
|
||||
pub const SYS_shmget: ::c_long = 29;
|
||||
pub const SYS_shmat: ::c_long = 30;
|
||||
pub const SYS_shmctl: ::c_long = 31;
|
||||
pub const SYS_dup: ::c_long = 32;
|
||||
pub const SYS_dup2: ::c_long = 33;
|
||||
pub const SYS_pause: ::c_long = 34;
|
||||
pub const SYS_nanosleep: ::c_long = 35;
|
||||
pub const SYS_getitimer: ::c_long = 36;
|
||||
pub const SYS_alarm: ::c_long = 37;
|
||||
pub const SYS_setitimer: ::c_long = 38;
|
||||
pub const SYS_getpid: ::c_long = 39;
|
||||
pub const SYS_sendfile: ::c_long = 40;
|
||||
pub const SYS_socket: ::c_long = 41;
|
||||
pub const SYS_connect: ::c_long = 42;
|
||||
pub const SYS_accept: ::c_long = 43;
|
||||
pub const SYS_sendto: ::c_long = 44;
|
||||
pub const SYS_recvfrom: ::c_long = 45;
|
||||
pub const SYS_sendmsg: ::c_long = 46;
|
||||
pub const SYS_recvmsg: ::c_long = 47;
|
||||
pub const SYS_shutdown: ::c_long = 48;
|
||||
pub const SYS_bind: ::c_long = 49;
|
||||
pub const SYS_listen: ::c_long = 50;
|
||||
pub const SYS_getsockname: ::c_long = 51;
|
||||
pub const SYS_getpeername: ::c_long = 52;
|
||||
pub const SYS_socketpair: ::c_long = 53;
|
||||
pub const SYS_setsockopt: ::c_long = 54;
|
||||
pub const SYS_getsockopt: ::c_long = 55;
|
||||
pub const SYS_clone: ::c_long = 56;
|
||||
pub const SYS_fork: ::c_long = 57;
|
||||
pub const SYS_vfork: ::c_long = 58;
|
||||
pub const SYS_execve: ::c_long = 59;
|
||||
pub const SYS_exit: ::c_long = 60;
|
||||
pub const SYS_wait4: ::c_long = 61;
|
||||
pub const SYS_kill: ::c_long = 62;
|
||||
pub const SYS_uname: ::c_long = 63;
|
||||
pub const SYS_semget: ::c_long = 64;
|
||||
pub const SYS_semop: ::c_long = 65;
|
||||
pub const SYS_semctl: ::c_long = 66;
|
||||
pub const SYS_shmdt: ::c_long = 67;
|
||||
pub const SYS_msgget: ::c_long = 68;
|
||||
pub const SYS_msgsnd: ::c_long = 69;
|
||||
pub const SYS_msgrcv: ::c_long = 70;
|
||||
pub const SYS_msgctl: ::c_long = 71;
|
||||
pub const SYS_fcntl: ::c_long = 72;
|
||||
pub const SYS_flock: ::c_long = 73;
|
||||
pub const SYS_fsync: ::c_long = 74;
|
||||
pub const SYS_fdatasync: ::c_long = 75;
|
||||
pub const SYS_truncate: ::c_long = 76;
|
||||
pub const SYS_ftruncate: ::c_long = 77;
|
||||
pub const SYS_getdents: ::c_long = 78;
|
||||
pub const SYS_getcwd: ::c_long = 79;
|
||||
pub const SYS_chdir: ::c_long = 80;
|
||||
pub const SYS_fchdir: ::c_long = 81;
|
||||
pub const SYS_rename: ::c_long = 82;
|
||||
pub const SYS_mkdir: ::c_long = 83;
|
||||
pub const SYS_rmdir: ::c_long = 84;
|
||||
pub const SYS_creat: ::c_long = 85;
|
||||
pub const SYS_link: ::c_long = 86;
|
||||
pub const SYS_unlink: ::c_long = 87;
|
||||
pub const SYS_symlink: ::c_long = 88;
|
||||
pub const SYS_readlink: ::c_long = 89;
|
||||
pub const SYS_chmod: ::c_long = 90;
|
||||
pub const SYS_fchmod: ::c_long = 91;
|
||||
pub const SYS_chown: ::c_long = 92;
|
||||
pub const SYS_fchown: ::c_long = 93;
|
||||
pub const SYS_lchown: ::c_long = 94;
|
||||
pub const SYS_umask: ::c_long = 95;
|
||||
pub const SYS_gettimeofday: ::c_long = 96;
|
||||
pub const SYS_getrlimit: ::c_long = 97;
|
||||
pub const SYS_getrusage: ::c_long = 98;
|
||||
pub const SYS_sysinfo: ::c_long = 99;
|
||||
pub const SYS_times: ::c_long = 100;
|
||||
pub const SYS_ptrace: ::c_long = 101;
|
||||
pub const SYS_getuid: ::c_long = 102;
|
||||
pub const SYS_syslog: ::c_long = 103;
|
||||
pub const SYS_getgid: ::c_long = 104;
|
||||
pub const SYS_setuid: ::c_long = 105;
|
||||
pub const SYS_setgid: ::c_long = 106;
|
||||
pub const SYS_geteuid: ::c_long = 107;
|
||||
pub const SYS_getegid: ::c_long = 108;
|
||||
pub const SYS_setpgid: ::c_long = 109;
|
||||
pub const SYS_getppid: ::c_long = 110;
|
||||
pub const SYS_getpgrp: ::c_long = 111;
|
||||
pub const SYS_setsid: ::c_long = 112;
|
||||
pub const SYS_setreuid: ::c_long = 113;
|
||||
pub const SYS_setregid: ::c_long = 114;
|
||||
pub const SYS_getgroups: ::c_long = 115;
|
||||
pub const SYS_setgroups: ::c_long = 116;
|
||||
pub const SYS_setresuid: ::c_long = 117;
|
||||
pub const SYS_getresuid: ::c_long = 118;
|
||||
pub const SYS_setresgid: ::c_long = 119;
|
||||
pub const SYS_getresgid: ::c_long = 120;
|
||||
pub const SYS_getpgid: ::c_long = 121;
|
||||
pub const SYS_setfsuid: ::c_long = 122;
|
||||
pub const SYS_setfsgid: ::c_long = 123;
|
||||
pub const SYS_getsid: ::c_long = 124;
|
||||
pub const SYS_capget: ::c_long = 125;
|
||||
pub const SYS_capset: ::c_long = 126;
|
||||
pub const SYS_rt_sigpending: ::c_long = 127;
|
||||
pub const SYS_rt_sigtimedwait: ::c_long = 128;
|
||||
pub const SYS_rt_sigqueueinfo: ::c_long = 129;
|
||||
pub const SYS_rt_sigsuspend: ::c_long = 130;
|
||||
pub const SYS_sigaltstack: ::c_long = 131;
|
||||
pub const SYS_utime: ::c_long = 132;
|
||||
pub const SYS_mknod: ::c_long = 133;
|
||||
pub const SYS_uselib: ::c_long = 134;
|
||||
pub const SYS_personality: ::c_long = 135;
|
||||
pub const SYS_ustat: ::c_long = 136;
|
||||
pub const SYS_statfs: ::c_long = 137;
|
||||
pub const SYS_fstatfs: ::c_long = 138;
|
||||
pub const SYS_sysfs: ::c_long = 139;
|
||||
pub const SYS_getpriority: ::c_long = 140;
|
||||
pub const SYS_setpriority: ::c_long = 141;
|
||||
pub const SYS_sched_setparam: ::c_long = 142;
|
||||
pub const SYS_sched_getparam: ::c_long = 143;
|
||||
pub const SYS_sched_setscheduler: ::c_long = 144;
|
||||
pub const SYS_sched_getscheduler: ::c_long = 145;
|
||||
pub const SYS_sched_get_priority_max: ::c_long = 146;
|
||||
pub const SYS_sched_get_priority_min: ::c_long = 147;
|
||||
pub const SYS_sched_rr_get_interval: ::c_long = 148;
|
||||
pub const SYS_mlock: ::c_long = 149;
|
||||
pub const SYS_munlock: ::c_long = 150;
|
||||
pub const SYS_mlockall: ::c_long = 151;
|
||||
pub const SYS_munlockall: ::c_long = 152;
|
||||
pub const SYS_vhangup: ::c_long = 153;
|
||||
pub const SYS_modify_ldt: ::c_long = 154;
|
||||
pub const SYS_pivot_root: ::c_long = 155;
|
||||
// FIXME: SYS__sysctl is in the NDK sources but for some reason is
|
||||
// not available in the tests
|
||||
// pub const SYS__sysctl: ::c_long = 156;
|
||||
pub const SYS_prctl: ::c_long = 157;
|
||||
pub const SYS_arch_prctl: ::c_long = 158;
|
||||
pub const SYS_adjtimex: ::c_long = 159;
|
||||
pub const SYS_setrlimit: ::c_long = 160;
|
||||
pub const SYS_chroot: ::c_long = 161;
|
||||
pub const SYS_sync: ::c_long = 162;
|
||||
pub const SYS_acct: ::c_long = 163;
|
||||
pub const SYS_settimeofday: ::c_long = 164;
|
||||
pub const SYS_mount: ::c_long = 165;
|
||||
pub const SYS_umount2: ::c_long = 166;
|
||||
pub const SYS_swapon: ::c_long = 167;
|
||||
pub const SYS_swapoff: ::c_long = 168;
|
||||
pub const SYS_reboot: ::c_long = 169;
|
||||
pub const SYS_sethostname: ::c_long = 170;
|
||||
pub const SYS_setdomainname: ::c_long = 171;
|
||||
pub const SYS_iopl: ::c_long = 172;
|
||||
pub const SYS_ioperm: ::c_long = 173;
|
||||
pub const SYS_create_module: ::c_long = 174;
|
||||
pub const SYS_init_module: ::c_long = 175;
|
||||
pub const SYS_delete_module: ::c_long = 176;
|
||||
pub const SYS_get_kernel_syms: ::c_long = 177;
|
||||
pub const SYS_query_module: ::c_long = 178;
|
||||
pub const SYS_quotactl: ::c_long = 179;
|
||||
pub const SYS_nfsservctl: ::c_long = 180;
|
||||
pub const SYS_getpmsg: ::c_long = 181;
|
||||
pub const SYS_putpmsg: ::c_long = 182;
|
||||
pub const SYS_afs_syscall: ::c_long = 183;
|
||||
pub const SYS_tuxcall: ::c_long = 184;
|
||||
pub const SYS_security: ::c_long = 185;
|
||||
pub const SYS_gettid: ::c_long = 186;
|
||||
pub const SYS_readahead: ::c_long = 187;
|
||||
pub const SYS_setxattr: ::c_long = 188;
|
||||
pub const SYS_lsetxattr: ::c_long = 189;
|
||||
pub const SYS_fsetxattr: ::c_long = 190;
|
||||
pub const SYS_getxattr: ::c_long = 191;
|
||||
pub const SYS_lgetxattr: ::c_long = 192;
|
||||
pub const SYS_fgetxattr: ::c_long = 193;
|
||||
pub const SYS_listxattr: ::c_long = 194;
|
||||
pub const SYS_llistxattr: ::c_long = 195;
|
||||
pub const SYS_flistxattr: ::c_long = 196;
|
||||
pub const SYS_removexattr: ::c_long = 197;
|
||||
pub const SYS_lremovexattr: ::c_long = 198;
|
||||
pub const SYS_fremovexattr: ::c_long = 199;
|
||||
pub const SYS_tkill: ::c_long = 200;
|
||||
pub const SYS_time: ::c_long = 201;
|
||||
pub const SYS_futex: ::c_long = 202;
|
||||
pub const SYS_sched_setaffinity: ::c_long = 203;
|
||||
pub const SYS_sched_getaffinity: ::c_long = 204;
|
||||
pub const SYS_set_thread_area: ::c_long = 205;
|
||||
pub const SYS_io_setup: ::c_long = 206;
|
||||
pub const SYS_io_destroy: ::c_long = 207;
|
||||
pub const SYS_io_getevents: ::c_long = 208;
|
||||
pub const SYS_io_submit: ::c_long = 209;
|
||||
pub const SYS_io_cancel: ::c_long = 210;
|
||||
pub const SYS_get_thread_area: ::c_long = 211;
|
||||
pub const SYS_lookup_dcookie: ::c_long = 212;
|
||||
pub const SYS_epoll_create: ::c_long = 213;
|
||||
pub const SYS_epoll_ctl_old: ::c_long = 214;
|
||||
pub const SYS_epoll_wait_old: ::c_long = 215;
|
||||
pub const SYS_remap_file_pages: ::c_long = 216;
|
||||
pub const SYS_getdents64: ::c_long = 217;
|
||||
pub const SYS_set_tid_address: ::c_long = 218;
|
||||
pub const SYS_restart_syscall: ::c_long = 219;
|
||||
pub const SYS_semtimedop: ::c_long = 220;
|
||||
pub const SYS_fadvise64: ::c_long = 221;
|
||||
pub const SYS_timer_create: ::c_long = 222;
|
||||
pub const SYS_timer_settime: ::c_long = 223;
|
||||
pub const SYS_timer_gettime: ::c_long = 224;
|
||||
pub const SYS_timer_getoverrun: ::c_long = 225;
|
||||
pub const SYS_timer_delete: ::c_long = 226;
|
||||
pub const SYS_clock_settime: ::c_long = 227;
|
||||
pub const SYS_clock_gettime: ::c_long = 228;
|
||||
pub const SYS_clock_getres: ::c_long = 229;
|
||||
pub const SYS_clock_nanosleep: ::c_long = 230;
|
||||
pub const SYS_exit_group: ::c_long = 231;
|
||||
pub const SYS_epoll_wait: ::c_long = 232;
|
||||
pub const SYS_epoll_ctl: ::c_long = 233;
|
||||
pub const SYS_tgkill: ::c_long = 234;
|
||||
pub const SYS_utimes: ::c_long = 235;
|
||||
pub const SYS_vserver: ::c_long = 236;
|
||||
pub const SYS_mbind: ::c_long = 237;
|
||||
pub const SYS_set_mempolicy: ::c_long = 238;
|
||||
pub const SYS_get_mempolicy: ::c_long = 239;
|
||||
pub const SYS_mq_open: ::c_long = 240;
|
||||
pub const SYS_mq_unlink: ::c_long = 241;
|
||||
pub const SYS_mq_timedsend: ::c_long = 242;
|
||||
pub const SYS_mq_timedreceive: ::c_long = 243;
|
||||
pub const SYS_mq_notify: ::c_long = 244;
|
||||
pub const SYS_mq_getsetattr: ::c_long = 245;
|
||||
pub const SYS_kexec_load: ::c_long = 246;
|
||||
pub const SYS_waitid: ::c_long = 247;
|
||||
pub const SYS_add_key: ::c_long = 248;
|
||||
pub const SYS_request_key: ::c_long = 249;
|
||||
pub const SYS_keyctl: ::c_long = 250;
|
||||
pub const SYS_ioprio_set: ::c_long = 251;
|
||||
pub const SYS_ioprio_get: ::c_long = 252;
|
||||
pub const SYS_inotify_init: ::c_long = 253;
|
||||
pub const SYS_inotify_add_watch: ::c_long = 254;
|
||||
pub const SYS_inotify_rm_watch: ::c_long = 255;
|
||||
pub const SYS_migrate_pages: ::c_long = 256;
|
||||
pub const SYS_openat: ::c_long = 257;
|
||||
pub const SYS_mkdirat: ::c_long = 258;
|
||||
pub const SYS_mknodat: ::c_long = 259;
|
||||
pub const SYS_fchownat: ::c_long = 260;
|
||||
pub const SYS_futimesat: ::c_long = 261;
|
||||
pub const SYS_newfstatat: ::c_long = 262;
|
||||
pub const SYS_unlinkat: ::c_long = 263;
|
||||
pub const SYS_renameat: ::c_long = 264;
|
||||
pub const SYS_linkat: ::c_long = 265;
|
||||
pub const SYS_symlinkat: ::c_long = 266;
|
||||
pub const SYS_readlinkat: ::c_long = 267;
|
||||
pub const SYS_fchmodat: ::c_long = 268;
|
||||
pub const SYS_faccessat: ::c_long = 269;
|
||||
pub const SYS_pselect6: ::c_long = 270;
|
||||
pub const SYS_ppoll: ::c_long = 271;
|
||||
pub const SYS_unshare: ::c_long = 272;
|
||||
pub const SYS_set_robust_list: ::c_long = 273;
|
||||
pub const SYS_get_robust_list: ::c_long = 274;
|
||||
pub const SYS_splice: ::c_long = 275;
|
||||
pub const SYS_tee: ::c_long = 276;
|
||||
pub const SYS_sync_file_range: ::c_long = 277;
|
||||
pub const SYS_vmsplice: ::c_long = 278;
|
||||
pub const SYS_move_pages: ::c_long = 279;
|
||||
pub const SYS_utimensat: ::c_long = 280;
|
||||
pub const SYS_epoll_pwait: ::c_long = 281;
|
||||
pub const SYS_signalfd: ::c_long = 282;
|
||||
pub const SYS_timerfd_create: ::c_long = 283;
|
||||
pub const SYS_eventfd: ::c_long = 284;
|
||||
pub const SYS_fallocate: ::c_long = 285;
|
||||
pub const SYS_timerfd_settime: ::c_long = 286;
|
||||
pub const SYS_timerfd_gettime: ::c_long = 287;
|
||||
pub const SYS_accept4: ::c_long = 288;
|
||||
pub const SYS_signalfd4: ::c_long = 289;
|
||||
pub const SYS_eventfd2: ::c_long = 290;
|
||||
pub const SYS_epoll_create1: ::c_long = 291;
|
||||
pub const SYS_dup3: ::c_long = 292;
|
||||
pub const SYS_pipe2: ::c_long = 293;
|
||||
pub const SYS_inotify_init1: ::c_long = 294;
|
||||
pub const SYS_preadv: ::c_long = 295;
|
||||
pub const SYS_pwritev: ::c_long = 296;
|
||||
pub const SYS_rt_tgsigqueueinfo: ::c_long = 297;
|
||||
pub const SYS_perf_event_open: ::c_long = 298;
|
||||
pub const SYS_recvmmsg: ::c_long = 299;
|
||||
pub const SYS_fanotify_init: ::c_long = 300;
|
||||
pub const SYS_fanotify_mark: ::c_long = 301;
|
||||
pub const SYS_prlimit64: ::c_long = 302;
|
||||
pub const SYS_name_to_handle_at: ::c_long = 303;
|
||||
pub const SYS_open_by_handle_at: ::c_long = 304;
|
||||
pub const SYS_clock_adjtime: ::c_long = 305;
|
||||
pub const SYS_syncfs: ::c_long = 306;
|
||||
pub const SYS_sendmmsg: ::c_long = 307;
|
||||
pub const SYS_setns: ::c_long = 308;
|
||||
pub const SYS_getcpu: ::c_long = 309;
|
||||
pub const SYS_process_vm_readv: ::c_long = 310;
|
||||
pub const SYS_process_vm_writev: ::c_long = 311;
|
||||
pub const SYS_kcmp: ::c_long = 312;
|
||||
pub const SYS_finit_module: ::c_long = 313;
|
||||
pub const SYS_sched_setattr: ::c_long = 314;
|
||||
pub const SYS_sched_getattr: ::c_long = 315;
|
||||
pub const SYS_renameat2: ::c_long = 316;
|
||||
pub const SYS_seccomp: ::c_long = 317;
|
||||
pub const SYS_getrandom: ::c_long = 318;
|
||||
pub const SYS_memfd_create: ::c_long = 319;
|
||||
pub const SYS_kexec_file_load: ::c_long = 320;
|
||||
pub const SYS_bpf: ::c_long = 321;
|
||||
pub const SYS_execveat: ::c_long = 322;
|
||||
pub const SYS_userfaultfd: ::c_long = 323;
|
||||
pub const SYS_membarrier: ::c_long = 324;
|
||||
pub const SYS_mlock2: ::c_long = 325;
|
||||
pub const SYS_copy_file_range: ::c_long = 326;
|
||||
pub const SYS_preadv2: ::c_long = 327;
|
||||
pub const SYS_pwritev2: ::c_long = 328;
|
||||
pub const SYS_pkey_mprotect: ::c_long = 329;
|
||||
pub const SYS_pkey_alloc: ::c_long = 330;
|
||||
pub const SYS_pkey_free: ::c_long = 331;
|
||||
|
||||
// offsets in user_regs_structs, from sys/reg.h
|
||||
pub const R15: ::c_int = 0;
|
||||
pub const R14: ::c_int = 1;
|
||||
pub const R13: ::c_int = 2;
|
||||
pub const R12: ::c_int = 3;
|
||||
pub const RBP: ::c_int = 4;
|
||||
pub const RBX: ::c_int = 5;
|
||||
pub const R11: ::c_int = 6;
|
||||
pub const R10: ::c_int = 7;
|
||||
pub const R9: ::c_int = 8;
|
||||
pub const R8: ::c_int = 9;
|
||||
pub const RAX: ::c_int = 10;
|
||||
pub const RCX: ::c_int = 11;
|
||||
pub const RDX: ::c_int = 12;
|
||||
pub const RSI: ::c_int = 13;
|
||||
pub const RDI: ::c_int = 14;
|
||||
pub const ORIG_RAX: ::c_int = 15;
|
||||
pub const RIP: ::c_int = 16;
|
||||
pub const CS: ::c_int = 17;
|
||||
pub const EFLAGS: ::c_int = 18;
|
||||
pub const RSP: ::c_int = 19;
|
||||
pub const SS: ::c_int = 20;
|
||||
pub const FS_BASE: ::c_int = 21;
|
||||
pub const GS_BASE: ::c_int = 22;
|
||||
pub const DS: ::c_int = 23;
|
||||
pub const ES: ::c_int = 24;
|
||||
pub const FS: ::c_int = 25;
|
||||
pub const GS: ::c_int = 26;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user