chore: checkpoint before Python removal

This commit is contained in:
2026-03-26 22:33:59 +00:00
parent 683cec9307
commit e568ddf82a
29972 changed files with 11269302 additions and 2 deletions

1
vendor/libc/.cargo-checksum.json vendored Normal file

File diff suppressed because one or more lines are too long

6
vendor/libc/.cargo_vcs_info.json vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"git": {
"sha1": "5660e6fc058d1c6c27788e3ea2bc7d3e79d3c22d"
},
"path_in_vcs": ""
}

7
vendor/libc/.editorconfig vendored Normal file
View File

@@ -0,0 +1,7 @@
[*.sh]
# See https://github.com/mvdan/sh/blob/master/cmd/shfmt/shfmt.1.scd#examples
indent_style = space
indent_size = 4
switch_case_indent = true
space_redirects = true

6
vendor/libc/.git-blame-ignore-revs vendored Normal file
View File

@@ -0,0 +1,6 @@
# Format macro bodies
50f26e08e146b7e9c7d1af9614486eba327d1e31
# Automated changes related to the 2021 edition upgrade
643182f7da26cedb09349b8bb3735c2e58ba24e6
108310db03e7db35ef48a902d9ce9a88ab8f9b77

49
vendor/libc/.release-plz.toml vendored Normal file
View File

@@ -0,0 +1,49 @@
[workspace]
git_release_name = "{{ version }}"
git_tag_name = "{{ version }}"
[changelog]
body = """
## [{{ version | trim_start_matches(pat="v") }}]\
{%- if release_link -%}\
({{ release_link }})\
{% endif %} \
- {{ timestamp | date(format="%Y-%m-%d") }}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.scope -%}{{ commit.scope | upper_first }}: {% endif %}
{%- if commit.breaking %}[**breaking**] {% endif %}
{{- commit.message }}
{%- if commit.links %} ([{{ commit.links.1.text }}]({{ commit.links.1.href }})){% endif -%}
{% endfor %}
{% endfor %}
{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
## New Contributors ❤️
{% endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* @{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor -%}
{%- endif %}
"""
commit_parsers = [
{ message = '(?i)^(\w+: )?feat', group = "added" },
{ message = '(?i)^(\w+: )?add', group = "added" },
{ message = '(?i)^(\w+: )?change', group = "changed" },
{ message = '(?i)^(\w+: )?cleanup', group = "cleanup" },
{ message = '(?i)^(\w+: )?deprecate', group = "deprecated" },
{ message = '(?i)^(\w+: )?remove', group = "removed" },
{ message = '(?i)^(\w+: )?fix', group = "fixed" },
{ message = '(?i)^(\w+: )?fix', group = "fixed" },
{ message = '^.*', group = "other" },
]
link_parsers = [
# Extract backport patterns
{ pattern = '\(backport <.*/(\d+)>\)', text = "#$1", href = "https://github.com/rust-lang/libc/pull/$1"}
]

6
vendor/libc/.rustfmt.toml vendored Normal file
View File

@@ -0,0 +1,6 @@
edition = "2021"
error_on_line_overflow = true
group_imports = "StdExternalCrate"
imports_granularity = "Module"
# This crate gets large lists of reexports. Use vertical to reduce conflicts.
imports_layout = "Vertical"

965
vendor/libc/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,965 @@
# Changelog
## [0.2.183](https://github.com/rust-lang/libc/compare/0.2.182...0.2.183) - 2026-03-08
### Added
- ESP-IDF: Add `SOMAXCONN` ([#4993](https://github.com/rust-lang/libc/pull/4993))
- Linux: Add `name_to_handle_at` and `open_by_handle_at` ([#4988](https://github.com/rust-lang/libc/pull/4988))
- NetBSD: Add `kinfo_file`, `kinfo_pcb`, and related constants ([#4985](https://github.com/rust-lang/libc/pull/4985))
- OpenBSD: Add `kinfo_file` and related constants ([#4991](https://github.com/rust-lang/libc/pull/4991))
- VxWorks: Add additional structs and defines ([#5003](https://github.com/rust-lang/libc/pull/5003))
- Various: Implement `Default` for `timeval` and `timespec` ([#4976](https://github.com/rust-lang/libc/pull/4976))
### Fixed
- Hexagon musl: Enable unstable 64-bit `time_t` support and `musl_v1_2_3` ([#4992](https://github.com/rust-lang/libc/pull/4992))
- Nintendo Switch: Fix target support ([#4982](https://github.com/rust-lang/libc/pull/4982))
- OpenBSD: Wrap an unused field in `Padding` ([#4997](https://github.com/rust-lang/libc/pull/4997))
- Redox: Change `sigaction.sa_flags` to `c_int` ([#4986](https://github.com/rust-lang/libc/pull/4986))
- Redox: Fix `blkcnt_t` type ([#4994](https://github.com/rust-lang/libc/pull/4994))
## [0.2.182](https://github.com/rust-lang/libc/compare/0.2.181...0.2.182) - 2026-02-13
### Added
- Android, Linux: Add `tgkill` ([#4970](https://github.com/rust-lang/libc/pull/4970))
- Redox: Add `RENAME_NOREPLACE` ([#4968](https://github.com/rust-lang/libc/pull/4968))
- Redox: Add `renameat2` ([#4968](https://github.com/rust-lang/libc/pull/4968))
## [0.2.181](https://github.com/rust-lang/libc/compare/0.2.180...0.2.181) - 2026-02-09
### Added
- Apple: Add `MADV_ZERO` ([#4924](https://github.com/rust-lang/libc/pull/4924))
- Redox: Add `makedev`, `major`, and `minor` ([#4928](https://github.com/rust-lang/libc/pull/4928))
- GLibc: Add `PTRACE_SET_SYSCALL_INFO` ([#4933](https://github.com/rust-lang/libc/pull/4933))
- OpenBSD: Add more kqueue related constants for ([#4945](https://github.com/rust-lang/libc/pull/4945))
- Linux: add CAN error types ([#4944](https://github.com/rust-lang/libc/pull/4944))
- OpenBSD: Add siginfo_t::si_status ([#4946](https://github.com/rust-lang/libc/pull/4946))
- QNX NTO: Add `max_align_t` ([#4927](https://github.com/rust-lang/libc/pull/4927))
- Illumos: Add `_CS_PATH` ([#4956](https://github.com/rust-lang/libc/pull/4956))
- OpenBSD: add `ppoll` ([#4957](https://github.com/rust-lang/libc/pull/4957))
### Fixed
- **breaking**: Redox: Fix the type of dev_t ([#4928](https://github.com/rust-lang/libc/pull/4928))
- AIX: Change 'tv_nsec' of 'struct timespec' to type 'c_long' ([#4931](https://github.com/rust-lang/libc/pull/4931))
- AIX: Use 'struct st_timespec' in 'struct stat{,64}' ([#4931](https://github.com/rust-lang/libc/pull/4931))
- Glibc: Link old version of `tc{g,s}etattr` ([#4938](https://github.com/rust-lang/libc/pull/4938))
- Glibc: Link the correct version of `cf{g,s}et{i,o}speed` on mips{32,64}r6 ([#4938](https://github.com/rust-lang/libc/pull/4938))
- OpenBSD: Fix constness of tm.tm_zone ([#4948](https://github.com/rust-lang/libc/pull/4948))
- OpenBSD: Fix the definition of `ptrace_thread_state` ([#4947](https://github.com/rust-lang/libc/pull/4947))
- QuRT: Fix type visibility and defs ([#4932](https://github.com/rust-lang/libc/pull/4932))
- Redox: Fix values for `PTHREAD_MUTEX_{NORMAL, RECURSIVE}` ([#4943](https://github.com/rust-lang/libc/pull/4943))
- Various: Mark additional fields as private padding ([#4922](https://github.com/rust-lang/libc/pull/4922))
### Changed
- Fuchsia: Update `SO_*` constants ([#4937](https://github.com/rust-lang/libc/pull/4937))
- Revert "musl: convert inline timespecs to timespec" (resolves build issues on targets only supported by Musl 1.2.3+ ) ([#4958](https://github.com/rust-lang/libc/pull/4958))
## [0.2.180](https://github.com/rust-lang/libc/compare/0.2.179...0.2.180) - 2026-01-08
### Added
- QNX: Add missing BPF and ifreq structures ([#4769](https://github.com/rust-lang/libc/pull/4769))
### Fixed
- Linux, L4Re: address soundness issues of `CMSG_NXTHDR` ([#4903](https://github.com/rust-lang/libc/pull/4903))
- Linux-like: Handle zero-sized payload differences in `CMSG_NXTHDR` ([#4903](https://github.com/rust-lang/libc/pull/4903))
- Musl: Fix incorrect definitions of struct stat on some 32-bit architectures ([#4914](https://github.com/rust-lang/libc/pull/4914))
- NetBSD: RISC-V 64: Correct `mcontext` type definitions ([#4886](https://github.com/rust-lang/libc/pull/4886))
- uClibc: Re-enable `__SIZEOF_PTHREAD_COND_T` on non-L4Re uclibc ([#4915](https://github.com/rust-lang/libc/pull/4915))
- uClibc: Restructure Linux `netlink` module to resolve build errors ([#4915](https://github.com/rust-lang/libc/pull/4915))
## [0.2.179](https://github.com/rust-lang/libc/compare/0.2.178...0.2.179) - 2025-01-03
With this release, we now have _unstable_ support for 64-bit `time_t` on 32-bit
platforms with both Musl and Glibc. Testing is appreciated!
For now, these can be enabled by setting environment variables during build:
```text
RUST_LIBC_UNSTABLE_MUSL_V1_2_3=1
RUST_LIBC_UNSTABLE_GNU_TIME_BITS=64
```
Note that the exact configuration will change in the future. Setting the
`MUSL_V1_2_3` variable also enables some newer API unrelated to `time_t`.
### Added
- L4Re: Add uclibc aarch64 support ([#4479](https://github.com/rust-lang/libc/pull/4479))
- Linux, Android: Add a generic definition for `XCASE` ([#4847](https://github.com/rust-lang/libc/pull/4847))
- Linux-like: Add `NAME_MAX` ([#4888](https://github.com/rust-lang/libc/pull/4888))
- Linux: Add `AT_EXECVE_CHECK` ([#4422](https://github.com/rust-lang/libc/pull/4422))
- Linux: Add the `SUN_LEN` macro ([#4269](https://github.com/rust-lang/libc/pull/4269))
- Linux: add `getitimer` and `setitimer` ([#4890](https://github.com/rust-lang/libc/pull/4890))
- Linux: add `pthread_tryjoin_n` and `pthread_timedjoin_np` ([#4887](https://github.com/rust-lang/libc/pull/4887))
- Musl: Add unstable support for 64-bit `time_t` on 32-bit platforms ([#4463](https://github.com/rust-lang/libc/pull/4463))
- NetBSD, OpenBSD: Add interface `LINK_STATE_*` definitions from `sys/net/if.h` ([#4751](https://github.com/rust-lang/libc/pull/4751))
- QuRT: Add support for Qualcomm QuRT ([#4845](https://github.com/rust-lang/libc/pull/4845))
- Types: Add Padding<T>::uninit() ([#4862](https://github.com/rust-lang/libc/pull/4862))
### Fixed
- Glibc: Link old version of `cf{g,s}et{i,o}speed` ([#4882](https://github.com/rust-lang/libc/pull/4882))
- L4Re: Fixes for `pthread` ([#4479](https://github.com/rust-lang/libc/pull/4479))
- L4re: Fix a wide variety of incorrect definitions ([#4479](https://github.com/rust-lang/libc/pull/4479))
- Musl: Fix the value of `CPU_SETSIZE` on musl 1.2+ ([#4865](https://github.com/rust-lang/libc/pull/4865))
- Musl: RISC-V: fix public padding fields in `stat/stat64` ([#4463](https://github.com/rust-lang/libc/pull/4463))
- Musl: s390x: Fix definition of `SIGSTKSZ`/`MINSIGSTKSZ` ([#4884](https://github.com/rust-lang/libc/pull/4884))
- NetBSD: Arm: Fix `PT_{GET,SET}FPREGS`, `_REG_TIPDR`, and `_REG_{LR,SP}` ([#4899](https://github.com/rust-lang/libc/pull/4899))
- NetBSD: Fix `if_msghdr` alignment ([#4902](https://github.com/rust-lang/libc/pull/4902))
- NetBSD: Fix `siginfo_t` layout on 32-bit platforms ([#4904](https://github.com/rust-lang/libc/pull/4904))
- NetBSD: change definition of `pthread_spin_t` to allow arch redefinition. ([#4899](https://github.com/rust-lang/libc/pull/4899))
- Newlib: Fix ambiguous glob exports and other warnings for Vita and 3DS ([#4875](https://github.com/rust-lang/libc/pull/4875))
- QNX: Fix build error ([#4879](https://github.com/rust-lang/libc/pull/4879))
### Changed
- CI: Update CI images to FreeBSD 15.0-release ([#4857](https://github.com/rust-lang/libc/pull/4857))
- L4Re: Make `pthread` struct fields private ([#4876](https://github.com/rust-lang/libc/pull/4876))
- Linux, Fuchsia: Mark mq_attr padding area as such ([#4858](https://github.com/rust-lang/libc/pull/4858))
- Types: Wrap a number of private fields in the `Padding` type ([#4862](https://github.com/rust-lang/libc/pull/4862))
### Removed
- Build: Remove `RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64` ([#4865](https://github.com/rust-lang/libc/pull/4865))
- WASI: Remove nonexistent clocks ([#4880](https://github.com/rust-lang/libc/pull/4880))
## [0.2.178](https://github.com/rust-lang/libc/compare/0.2.177...0.2.178) - 2025-12-01
### Added
- BSD: Add `issetugid` ([#4744](https://github.com/rust-lang/libc/pull/4744))
- Cygwin: Add missing utmp/x.h, grp.h, and stdio.h interfaces ([#4827](https://github.com/rust-lang/libc/pull/4827))
- Linux s390x musl: Add `__psw_t`/`fprefset_t`/`*context_t` ([#4726](https://github.com/rust-lang/libc/pull/4726))
- Linux, Android: Add definition for IUCLC ([#4846](https://github.com/rust-lang/libc/pull/4846))
- Linux, FreeBSD: Add `AT_HWCAP{3,4}` ([#4734](https://github.com/rust-lang/libc/pull/4734))
- Linux: Add definitions from linux/can/bcm.h ([#4683](https://github.com/rust-lang/libc/pull/4683))
- Linux: Add syscalls 451-469 for m68k ([#4850](https://github.com/rust-lang/libc/pull/4850))
- Linux: PowerPC: Add 'ucontext.h' definitions ([#4696](https://github.com/rust-lang/libc/pull/4696))
- NetBSD: Define `eventfd` ([#4830](https://github.com/rust-lang/libc/pull/4830))
- Newlib: Add missing constants from `unistd.h` ([#4811](https://github.com/rust-lang/libc/pull/4811))
- QNX NTO: Add `cfmakeraw` ([#4704](https://github.com/rust-lang/libc/pull/4704))
- QNX NTO: Add `cfsetspeed` ([#4704](https://github.com/rust-lang/libc/pull/4704))
- Redox: Add `getresgid` and `getresuid` ([#4752](https://github.com/rust-lang/libc/pull/4752))
- Redox: Add `setresgid` and `setresuid` ([#4752](https://github.com/rust-lang/libc/pull/4752))
- VxWorks: Add definitions from `select.h`, `stat.h`, `poll.h`, `ttycom.h`, `utsname.h`, `resource.h`, `mman.h`, `udp.h`, `in.h`, `in6.h`, `if.h`, `fnmatch.h`, and `sioLibCommon.h` ([#4781](https://github.com/rust-lang/libc/pull/4781))
- VxWorks: Add missing defines/functions needed by rust stdlib ([#4779](https://github.com/rust-lang/libc/pull/4779))
- WASI: Add more definitions for libstd ([#4747](https://github.com/rust-lang/libc/pull/4747))
### Deprecated
- Apple: Deprecate `TIOCREMOTE` ([#4764](https://github.com/rust-lang/libc/pull/4764))
### Fixed
Note that there were a large number of fixes on NetBSD for this `libc` release, some of which include minor breakage.
- AIX: Change errno `EWOULDBLOCK` to make it an alias of `EAGAIN` ([#4790](https://github.com/rust-lang/libc/pull/4790))
- AIX: Resolve function comparison and `unnecessary_transmutes` warnings ([#4780](https://github.com/rust-lang/libc/pull/4780))
- Apple: Correct the value of `SF_SETTABLE` ([#4764](https://github.com/rust-lang/libc/pull/4764))
- DragonflyBSD: Fix the type of `mcontext_t.mc_fpregs` ([#]())
- EspIDF: Fix the duplicate definition of `gethostname` ([#4773](https://github.com/rust-lang/libc/pull/4773))
- L4Re: Update available pthread API ([#4836](https://github.com/rust-lang/libc/pull/4836))
- Linux: Correct the value of `NFT_MSG_MAX` ([#4761](https://github.com/rust-lang/libc/pull/4761))
- Linux: Remove incorrect `repr(align(8))` for `canxl_frame` ([#4760](https://github.com/rust-lang/libc/pull/4760))
- Make `eventfd` argument names match OS docs/headers ([#4830](https://github.com/rust-lang/libc/pull/4830))
- NetBSD: Account for upstream changes to ptrace with LWP ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Correct `ipc_perm`, split from OpenBSD as `ipc.rs` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Correct a number of symbol link names ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Correct the type of `kinfo_vmentry.kve_path` ([#]())
- NetBSD: Fix `uucred.cr_ngroups` from `int` to `short` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Fix the type of `kevent.udata` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Fix the type of `mcontext_t.__fpregs` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Fix the value of `PT_SUSPEND` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Fix the values of FNM_* constants ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Increase the size of `sockaddr_dl.sdl_data` from 12 to 24 ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `if_.rs`, fix the definition of `ifreq` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `time.rs`, fix the values of `CLOCK_*_CPUTIME_ID` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `timex.rs` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `types.rs`, correct the definition of `lwpid_t` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `utmp_.rs`, correct the definition of `lastlog` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Introduce `utmpx_.rs`, correct utmpx definitions ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Make `_cpuset` an extern type ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: RISC-V 64: Fix the `mcontext` types ([#4782](https://github.com/rust-lang/libc/pull/4782))
- Nuttx: Resolve warnings ([#4773](https://github.com/rust-lang/libc/pull/4773))
- OHOS: Don't emit duplicate lfs64 definitions ([#4804](https://github.com/rust-lang/libc/pull/4804))
- Redox: Fix the type of `pid_t` ([#4825](https://github.com/rust-lang/libc/pull/4825))
- WASI: Gate `__wasilibc_register_preopened_fd` ([#4837](https://github.com/rust-lang/libc/pull/4837))
- Wali: Fix unknown config ([#4773](https://github.com/rust-lang/libc/pull/4773))
### Changed
- AIX: Declare field 'tv_nsec' of structure 'timespec' as 'i32' in both 32-bit and 64-bit modes ([#4750](https://github.com/rust-lang/libc/pull/4750))
- DragonFly: Avoid usage of `thread_local` ([#3653](https://github.com/rust-lang/libc/pull/3653))
- Linux: Update the definition for `ucontext_t` and unskip its tests ([#4760](https://github.com/rust-lang/libc/pull/4760))
- MinGW: Set `L_tmpnam` and `TMP_MAX` to the UCRT value ([#4566](https://github.com/rust-lang/libc/pull/4566))
- WASI: More closely align pthread type reprs ([#4747](https://github.com/rust-lang/libc/pull/4747))
- Simplify rustc-check-cfg emission in build.rs ([#4724](https://github.com/rust-lang/libc/pull/4724))
- Transition a number of definitions to the new source structure (internal change)
### Removed
- MIPS Musl: Remove rogue definition of `SIGSTKFLT` ([#4749](https://github.com/rust-lang/libc/pull/4749))
- NetBSD: Make `statvfs.f_spare` non-public ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Remove BPF constants ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Remove `*_MAXID` constants and `AT_SUN_LDPGSIZE` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Remove `IFF_NOTRAILERS` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Remove `vm_size_t` ([#4782](https://github.com/rust-lang/libc/pull/4782))
- NetBSD: Replace REG_ENOSYS with REG_ILLSEQ ([#4782](https://github.com/rust-lang/libc/pull/4782))
## [0.2.177](https://github.com/rust-lang/libc/compare/0.2.176...0.2.177) - 2025-10-09
### Added
- Apple: Add `TIOCGETA`, `TIOCSETA`, `TIOCSETAW`, `TIOCSETAF` constants ([#4736](https://github.com/rust-lang/libc/pull/4736))
- Apple: Add `pthread_cond_timedwait_relative_np` ([#4719](https://github.com/rust-lang/libc/pull/4719))
- BSDs: Add `_CS_PATH` constant ([#4738](https://github.com/rust-lang/libc/pull/4738))
- Linux-like: Add `SIGEMT` for mips* and sparc* architectures ([#4730](https://github.com/rust-lang/libc/pull/4730))
- OpenBSD: Add `elf_aux_info` ([#4729](https://github.com/rust-lang/libc/pull/4729))
- Redox: Add more sysconf constants ([#4728](https://github.com/rust-lang/libc/pull/4728))
- Windows: Add `wcsnlen` ([#4721](https://github.com/rust-lang/libc/pull/4721))
### Changed
- WASIP2: Invert conditional to include p2 APIs ([#4733](https://github.com/rust-lang/libc/pull/4733))
## [0.2.176](https://github.com/rust-lang/libc/compare/0.2.175...0.2.176) - 2025-09-23
### Support
- The default FreeBSD version has been raised from 11 to 12. This matches `rustc` since 1.78. ([#2406](https://github.com/rust-lang/libc/pull/2406))
- `Debug` is now always implemented, rather than being gated behind the `extra_traits` feature. ([#4624](https://github.com/rust-lang/libc/pull/4624))
### Added
- AIX: Restore some non-POSIX functions guarded by the `_KERNEL` macro. ([#4607](https://github.com/rust-lang/libc/pull/4607))
- FreeBSD 14: Add `st_fileref` to `struct stat` ([#4642](https://github.com/rust-lang/libc/pull/4642))
- Haiku: Add the `accept4` POSIX call ([#4586](https://github.com/rust-lang/libc/pull/4586))
- Introduce a wrapper for representing padding ([#4632](https://github.com/rust-lang/libc/pull/4632))
- Linux: Add `EM_RISCV` ([#4659](https://github.com/rust-lang/libc/pull/4659))
- Linux: Add `MS_NOSYMFOLLOW` ([#4389](https://github.com/rust-lang/libc/pull/4389))
- Linux: Add `backtrace_symbols(_fd)` ([#4668](https://github.com/rust-lang/libc/pull/4668))
- Linux: Add missing `SOL_PACKET` optnames ([#4669](https://github.com/rust-lang/libc/pull/4669))
- Musl s390x: Add `SYS_mseal` ([#4549](https://github.com/rust-lang/libc/pull/4549))
- NuttX: Add `__errno` ([#4687](https://github.com/rust-lang/libc/pull/4687))
- Redox: Add `dirfd`, `VDISABLE`, and resource consts ([#4660](https://github.com/rust-lang/libc/pull/4660))
- Redox: Add more `resource.h`, `fcntl.h` constants ([#4666](https://github.com/rust-lang/libc/pull/4666))
- Redox: Enable `strftime` and `mkostemp[s]` ([#4629](https://github.com/rust-lang/libc/pull/4629))
- Unix, Windows: Add `qsort_r` (Unix), and `qsort(_s)` (Windows) ([#4677](https://github.com/rust-lang/libc/pull/4677))
- Unix: Add `dlvsym` for Linux-gnu, FreeBSD, and NetBSD ([#4671](https://github.com/rust-lang/libc/pull/4671))
- Unix: Add `sigqueue` ([#4620](https://github.com/rust-lang/libc/pull/4620))
### Changed
- FreeBSD 15: Mark `kinfo_proc` as non-exhaustive ([#4553](https://github.com/rust-lang/libc/pull/4553))
- FreeBSD: Set the ELF symbol version for `readdir_r` ([#4694](https://github.com/rust-lang/libc/pull/4694))
- Linux: Correct the config for whether or not `epoll_event` is packed ([#4639](https://github.com/rust-lang/libc/pull/4639))
- Tests: Replace the old `ctest` with the much more reliable new implementation ([#4655](https://github.com/rust-lang/libc/pull/4655) and many related PRs)
### Fixed
- AIX: Fix the type of the 4th arguement of `getgrnam_r` ([#4656](https://github.com/rust-lang/libc/pull/4656
- FreeBSD: Limit `P_IDLEPROC` to FreeBSD 15 ([#4640](https://github.com/rust-lang/libc/pull/4640))
- FreeBSD: Limit `mcontext_t::mc_tlsbase` to FreeBSD 15 ([#4640](https://github.com/rust-lang/libc/pull/464))
- FreeBSD: Update gating of `mcontext_t.mc_tlsbase` ([#4703](https://github.com/rust-lang/libc/pull/4703))
- Musl s390x: Correct the definition of `statfs[64]` ([#4549](https://github.com/rust-lang/libc/pull/4549))
- Musl s390x: Make `fpreg_t` a union ([#4549](https://github.com/rust-lang/libc/pull/4549))
- Redox: Fix the types of `gid_t` and `uid_t` ([#4689](https://github.com/rust-lang/libc/pull/4689))
- Redox: Fix the value of `MAP_FIXED` ([#4684](https://github.com/rust-lang/libc/pull/4684))
### Deprecated
- Apple: Correct the `deprecated` attribute for `iconv` ([`a97a0b53`](https://github.com/rust-lang/libc/commit/a97a0b53fb7faf5f99cd720ab12b1b8a5bf9f950))
- FreeBSD: Deprecate `TIOCMGDTRWAIT` and `TIOCMSDTRWAIT` ([#4685](https://github.com/rust-lang/libc/pull/4685))
### Removed
- FreeBSD: Remove `JAIL_{GET,SET}_MASK`, `_MC_FLAG_MASK` ([#4691](https://github.com/rust-lang/libc/pull/4691))
## [0.2.175](https://github.com/rust-lang/libc/compare/0.2.174...0.2.175) - 2025-08-10
### Added
- AIX: Add `getpeereid` ([#4524](https://github.com/rust-lang/libc/pull/4524))
- AIX: Add `struct ld_info` and friends ([#4578](https://github.com/rust-lang/libc/pull/4578))
- AIX: Retore `struct winsize` ([#4577](https://github.com/rust-lang/libc/pull/4577))
- Android: Add UDP socket option constants ([#4619](https://github.com/rust-lang/libc/pull/4619))
- Android: Add `CLONE_CLEAR_SIGHAND` and `CLONE_INTO_CGROUP` ([#4502](https://github.com/rust-lang/libc/pull/4502))
- Android: Add more `prctl` constants ([#4531](https://github.com/rust-lang/libc/pull/4531))
- FreeBSD Add further TCP stack-related constants ([#4196](https://github.com/rust-lang/libc/pull/4196))
- FreeBSD x86-64: Add `mcontext_t.mc_tlsbase ` ([#4503](https://github.com/rust-lang/libc/pull/4503))
- FreeBSD15: Add `kinfo_proc.ki_uerrmsg` ([#4552](https://github.com/rust-lang/libc/pull/4552))
- FreeBSD: Add `in_conninfo` ([#4482](https://github.com/rust-lang/libc/pull/4482))
- FreeBSD: Add `xinpgen` and related types ([#4482](https://github.com/rust-lang/libc/pull/4482))
- FreeBSD: Add `xktls_session` ([#4482](https://github.com/rust-lang/libc/pull/4482))
- Haiku: Add functionality from `libbsd` ([#4221](https://github.com/rust-lang/libc/pull/4221))
- Linux: Add `SECBIT_*` ([#4480](https://github.com/rust-lang/libc/pull/4480))
- NetBSD, OpenBSD: Export `ioctl` request generator macros ([#4460](https://github.com/rust-lang/libc/pull/4460))
- NetBSD: Add `ptsname_r` ([#4608](https://github.com/rust-lang/libc/pull/4608))
- RISCV32: Add time-related syscalls ([#4612](https://github.com/rust-lang/libc/pull/4612))
- Solarish: Add `strftime*` ([#4453](https://github.com/rust-lang/libc/pull/4453))
- linux: Add `EXEC_RESTRICT_*` and `EXEC_DENY_*` ([#4545](https://github.com/rust-lang/libc/pull/4545))
### Changed
- AIX: Add `const` to signatures to be consistent with other platforms ([#4563](https://github.com/rust-lang/libc/pull/4563))
### Fixed
- AIX: Fix the type of `struct statvfs.f_fsid` ([#4576](https://github.com/rust-lang/libc/pull/4576))
- AIX: Fix the type of constants for the `ioctl` `request` argument ([#4582](https://github.com/rust-lang/libc/pull/4582))
- AIX: Fix the types of `stat{,64}.st_*tim` ([#4597](https://github.com/rust-lang/libc/pull/4597))
- AIX: Use unique `errno` values ([#4507](https://github.com/rust-lang/libc/pull/4507))
- Build: Fix an incorrect `target_os` -> `target_arch` check ([#4550](https://github.com/rust-lang/libc/pull/4550))
- FreeBSD: Fix the type of `xktls_session_onedir.ifnet` ([#4552](https://github.com/rust-lang/libc/pull/4552))
- Mips64 musl: Fix the type of `nlink_t` ([#4509](https://github.com/rust-lang/libc/pull/4509))
- Mips64 musl: Use a special MIPS definition of `stack_t` ([#4528](https://github.com/rust-lang/libc/pull/4528))
- Mips64: Fix `SI_TIMER`, `SI_MESGQ` and `SI_ASYNCIO` definitions ([#4529](https://github.com/rust-lang/libc/pull/4529))
- Musl Mips64: Swap the order of `si_errno` and `si_code` in `siginfo_t` ([#4530](https://github.com/rust-lang/libc/pull/4530))
- Musl Mips64: Use a special MIPS definition of `statfs` ([#4527](https://github.com/rust-lang/libc/pull/4527))
- Musl: Fix the definition of `fanotify_event_metadata` ([#4510](https://github.com/rust-lang/libc/pull/4510))
- NetBSD: Correct `enum fae_action` to be `#[repr(C)]` ([#60a8cfd5](https://github.com/rust-lang/libc/commit/60a8cfd564f83164d45b9533ff7a0d7371878f2a))
- PSP: Correct `char` -> `c_char` ([eaab4fc3](https://github.com/rust-lang/libc/commit/eaab4fc3f05dc646a953d4fd5ba46dfa1f8bd6f6))
- PowerPC musl: Fix `termios` definitions ([#4518](https://github.com/rust-lang/libc/pull/4518))
- PowerPC musl: Fix the definition of `EDEADLK` ([#4517](https://github.com/rust-lang/libc/pull/4517))
- PowerPC musl: Fix the definition of `NCCS` ([#4513](https://github.com/rust-lang/libc/pull/4513))
- PowerPC musl: Fix the definitions of `MAP_LOCKED` and `MAP_NORESERVE` ([#4516](https://github.com/rust-lang/libc/pull/4516))
- PowerPC64 musl: Fix the definition of `shmid_ds` ([#4519](https://github.com/rust-lang/libc/pull/4519))
### Deprecated
- Linux: `MAP_32BIT` is only defined on x86 on non-x86 architectures ([#4511](https://github.com/rust-lang/libc/pull/4511))
### Removed
- AIX: Remove duplicate constant definitions `FIND` and `ENTER` ([#4588](https://github.com/rust-lang/libc/pull/4588))
- s390x musl: Remove `O_FSYNC` ([#4515](https://github.com/rust-lang/libc/pull/4515))
- s390x musl: Remove `RTLD_DEEPBIND` ([#4515](https://github.com/rust-lang/libc/pull/4515))
## [0.2.174](https://github.com/rust-lang/libc/compare/0.2.173...0.2.174) - 2025-06-17
### Added
- Linux: Make `pidfd_info` fields pub ([#4487](https://github.com/rust-lang/libc/pull/4487))
### Fixed
- Gnu x32: Add missing `timespec.tv_nsec` ([#4497](https://github.com/rust-lang/libc/pull/4497))
- NuttX: Use `nlink_t` type for `st_nlink` in `struct stat` definition ([#4483](https://github.com/rust-lang/libc/pull/4483))
### Other
- Allow new `unpredictable_function_pointer_comparisons` lints ([#4489](https://github.com/rust-lang/libc/pull/4489))
- OpenBSD: Fix some clippy warnings to use `pointer::cast`. ([#4490](https://github.com/rust-lang/libc/pull/4490))
- Remove unessecary semicolons from definitions of `CMSG_NXTHDR`. ([#4492](https://github.com/rust-lang/libc/pull/4492))
## [0.2.173](https://github.com/rust-lang/libc/compare/0.2.172...0.2.173) - 2025-06-09
### Added
- AIX: Add an AIX triple to Cargo.toml for doc ([#4475](https://github.com/rust-lang/libc/pull/4475))
- FreeBSD: Add the `SO_SPLICE` socket option support for FreeBSD >= 14.2 ([#4451](https://github.com/rust-lang/libc/pull/4451))
- Linux GNU: Prepare for supporting `_TIME_BITS=64` ([#4433](https://github.com/rust-lang/libc/pull/4433))
- Linux: Add constant PACKET_IGNORE_OUTGOING ([#4319](https://github.com/rust-lang/libc/pull/4319))
- Linux: Add constants and types for `nsfs` ioctls ([#4436](https://github.com/rust-lang/libc/pull/4436))
- Linux: Add constants for Memory-Deny-Write-Execute `prctls` ([#4400](https://github.com/rust-lang/libc/pull/4400))
- Linux: Add constants from `linux/cn_proc.h` and `linux/connector.h` ([#4434](https://github.com/rust-lang/libc/pull/4434))
- Linux: Add new flags for `pwritev2` and `preadv2` ([#4452](https://github.com/rust-lang/libc/pull/4452))
- Linux: Add pid_type enum values ([#4403](https://github.com/rust-lang/libc/pull/4403))
- Linux: Update pidfd constants and types (Linux 6.9-6.15) ([#4402](https://github.com/rust-lang/libc/pull/4402))
- Loongarch64 musl: Define the `MADV_SOFT_OFFLINE` constant ([#4448](https://github.com/rust-lang/libc/pull/4448))
- Musl: Add new fields since 1.2.0/1.2.2 to `struct tcp_info` ([#4443](https://github.com/rust-lang/libc/pull/4443))
- Musl: Prepare for supporting v1.2.3 ([#4443](https://github.com/rust-lang/libc/pull/4443))
- NuttX: Add `arc4random` and `arc4random_buf` ([#4464](https://github.com/rust-lang/libc/pull/4464))
- RISC-V Musl: Add `MADV_SOFT_OFFLINE` definition ([#4447](https://github.com/rust-lang/libc/pull/4447))
- Redox: Define SCM_RIGHTS ([#4440](https://github.com/rust-lang/libc/pull/4440))
- VxWorks: Add missing UTIME defines and TASK_RENAME_LENGTH ([#4407](https://github.com/rust-lang/libc/pull/4407))
- Windows: Add more `time.h` functions ([#4427](https://github.com/rust-lang/libc/pull/4427))
### Changed
- Redox: Update `SA_` constants. ([#4426](https://github.com/rust-lang/libc/pull/4426))
- Redox: make `CMSG_ALIGN`, `CMSG_LEN`, and `CMSG_SPACE` const functions ([#4441](https://github.com/rust-lang/libc/pull/4441))
### Fixed
- AIX: Enable libc-test and fix definitions/declarations. ([#4450](https://github.com/rust-lang/libc/pull/4450))
- Emscripten: Fix querying emcc on windows (use emcc.bat) ([#4248](https://github.com/rust-lang/libc/pull/4248))
- Hurd: Fix build from missing `fpos_t` ([#4472](https://github.com/rust-lang/libc/pull/4472))
- Loongarch64 Musl: Fix the `struct ipc_perm` bindings ([#4384](https://github.com/rust-lang/libc/pull/4384))
- Musl: Fix the `O_LARGEFILE` constant value. ([#4443](https://github.com/rust-lang/libc/pull/4443))
## [0.2.172](https://github.com/rust-lang/libc/compare/0.2.171...0.2.172) - 2025-04-14
### Added
- Android: Add `getauxval` for 32-bit targets ([#4338](https://github.com/rust-lang/libc/pull/4338))
- Android: Add `if_tun.h` ioctls ([#4379](https://github.com/rust-lang/libc/pull/4379))
- Android: Define `SO_BINDTOIFINDEX` ([#4391](https://github.com/rust-lang/libc/pull/4391))
- Cygwin: Add `posix_spawn_file_actions_add[f]chdir[_np]` ([#4387](https://github.com/rust-lang/libc/pull/4387))
- Cygwin: Add new socket options ([#4350](https://github.com/rust-lang/libc/pull/4350))
- Cygwin: Add statfs & fcntl ([#4321](https://github.com/rust-lang/libc/pull/4321))
- FreeBSD: Add `filedesc` and `fdescenttbl` ([#4327](https://github.com/rust-lang/libc/pull/4327))
- Glibc: Add unstable support for _FILE_OFFSET_BITS=64 ([#4345](https://github.com/rust-lang/libc/pull/4345))
- Hermit: Add `AF_UNSPEC` ([#4344](https://github.com/rust-lang/libc/pull/4344))
- Hermit: Add `AF_VSOCK` ([#4344](https://github.com/rust-lang/libc/pull/4344))
- Illumos, NetBSD: Add `timerfd` APIs ([#4333](https://github.com/rust-lang/libc/pull/4333))
- Linux: Add `_IO`, `_IOW`, `_IOR`, `_IOWR` to the exported API ([#4325](https://github.com/rust-lang/libc/pull/4325))
- Linux: Add `tcp_info` to uClibc bindings ([#4347](https://github.com/rust-lang/libc/pull/4347))
- Linux: Add further BPF program flags ([#4356](https://github.com/rust-lang/libc/pull/4356))
- Linux: Add missing INPUT_PROP_XXX flags from `input-event-codes.h` ([#4326](https://github.com/rust-lang/libc/pull/4326))
- Linux: Add missing TLS bindings ([#4296](https://github.com/rust-lang/libc/pull/4296))
- Linux: Add more constants from `seccomp.h` ([#4330](https://github.com/rust-lang/libc/pull/4330))
- Linux: Add more glibc `ptrace_sud_config` and related `PTRACE_*ET_SYSCALL_USER_DISPATCH_CONFIG`. ([#4386](https://github.com/rust-lang/libc/pull/4386))
- Linux: Add new netlink flags ([#4288](https://github.com/rust-lang/libc/pull/4288))
- Linux: Define ioctl codes on more architectures ([#4382](https://github.com/rust-lang/libc/pull/4382))
- Linux: Add missing `pthread_attr_setstack` ([#4349](https://github.com/rust-lang/libc/pull/4349))
- Musl: Add missing `utmpx` API ([#4332](https://github.com/rust-lang/libc/pull/4332))
- Musl: Enable `getrandom` on all platforms ([#4346](https://github.com/rust-lang/libc/pull/4346))
- NuttX: Add more signal constants ([#4353](https://github.com/rust-lang/libc/pull/4353))
- QNX: Add QNX 7.1-iosock and 8.0 to list of additional cfgs ([#4169](https://github.com/rust-lang/libc/pull/4169))
- QNX: Add support for alternative Neutrino network stack `io-sock` ([#4169](https://github.com/rust-lang/libc/pull/4169))
- Redox: Add more `sys/socket.h` and `sys/uio.h` definitions ([#4388](https://github.com/rust-lang/libc/pull/4388))
- Solaris: Temporarily define `O_DIRECT` and `SIGINFO` ([#4348](https://github.com/rust-lang/libc/pull/4348))
- Solarish: Add `secure_getenv` ([#4342](https://github.com/rust-lang/libc/pull/4342))
- VxWorks: Add missing `d_type` member to `dirent` ([#4352](https://github.com/rust-lang/libc/pull/4352))
- VxWorks: Add missing signal-related constsants ([#4352](https://github.com/rust-lang/libc/pull/4352))
- VxWorks: Add more error codes ([#4337](https://github.com/rust-lang/libc/pull/4337))
### Deprecated
- FreeBSD: Deprecate `TCP_PCAP_OUT` and `TCP_PCAP_IN` ([#4381](https://github.com/rust-lang/libc/pull/4381))
### Fixed
- Cygwin: Fix member types of `statfs` ([#4324](https://github.com/rust-lang/libc/pull/4324))
- Cygwin: Fix tests ([#4357](https://github.com/rust-lang/libc/pull/4357))
- Hermit: Make `AF_INET = 3` ([#4344](https://github.com/rust-lang/libc/pull/4344))
- Musl: Fix the syscall table on RISC-V-32 ([#4335](https://github.com/rust-lang/libc/pull/4335))
- Musl: Fix the value of `SA_ONSTACK` on RISC-V-32 ([#4335](https://github.com/rust-lang/libc/pull/4335))
- VxWorks: Fix a typo in the `waitpid` parameter name ([#4334](https://github.com/rust-lang/libc/pull/4334))
### Removed
- Musl: Remove `O_FSYNC` on RISC-V-32 (use `O_SYNC` instead) ([#4335](https://github.com/rust-lang/libc/pull/4335))
- Musl: Remove `RTLD_DEEPBIND` on RISC-V-32 ([#4335](https://github.com/rust-lang/libc/pull/4335))
### Other
- CI: Add matrix env variables to the environment ([#4345](https://github.com/rust-lang/libc/pull/4345))
- CI: Always deny warnings ([#4363](https://github.com/rust-lang/libc/pull/4363))
- CI: Always upload successfully created artifacts ([#4345](https://github.com/rust-lang/libc/pull/4345))
- CI: Install musl from source for loongarch64 ([#4320](https://github.com/rust-lang/libc/pull/4320))
- CI: Revert "Also skip `MFD_EXEC` and `MFD_NOEXEC_SEAL` on sparc64" ([#]())
- CI: Use `$PWD` instead of `$(pwd)` in run-docker ([#4345](https://github.com/rust-lang/libc/pull/4345))
- Solarish: Restrict `openpty` and `forkpty` polyfills to Illumos, replace Solaris implementation with bindings ([#4329](https://github.com/rust-lang/libc/pull/4329))
- Testing: Ensure the makedev test does not emit unused errors ([#4363](https://github.com/rust-lang/libc/pull/4363))
## [0.2.171](https://github.com/rust-lang/libc/compare/0.2.170...0.2.171) - 2025-03-11
### Added
- Android: Add `if_nameindex`/`if_freenameindex` support ([#4247](https://github.com/rust-lang/libc/pull/4247))
- Apple: Add missing proc types and constants ([#4310](https://github.com/rust-lang/libc/pull/4310))
- BSD: Add `devname` ([#4285](https://github.com/rust-lang/libc/pull/4285))
- Cygwin: Add PTY and group API ([#4309](https://github.com/rust-lang/libc/pull/4309))
- Cygwin: Add support ([#4279](https://github.com/rust-lang/libc/pull/4279))
- FreeBSD: Make `spawn.h` interfaces available on all FreeBSD-like systems ([#4294](https://github.com/rust-lang/libc/pull/4294))
- Linux: Add `AF_XDP` structs for all Linux environments ([#4163](https://github.com/rust-lang/libc/pull/4163))
- Linux: Add SysV semaphore constants ([#4286](https://github.com/rust-lang/libc/pull/4286))
- Linux: Add `F_SEAL_EXEC` ([#4316](https://github.com/rust-lang/libc/pull/4316))
- Linux: Add `SO_PREFER_BUSY_POLL` and `SO_BUSY_POLL_BUDGET` ([#3917](https://github.com/rust-lang/libc/pull/3917))
- Linux: Add `devmem` structs ([#4299](https://github.com/rust-lang/libc/pull/4299))
- Linux: Add socket constants up to `SO_DEVMEM_DONTNEED` ([#4299](https://github.com/rust-lang/libc/pull/4299))
- NetBSD, OpenBSD, DragonflyBSD: Add `closefrom` ([#4290](https://github.com/rust-lang/libc/pull/4290))
- NuttX: Add `pw_passwd` field to `passwd` ([#4222](https://github.com/rust-lang/libc/pull/4222))
- Solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF` ([#4287](https://github.com/rust-lang/libc/pull/4287))
- Wali: Add bindings for `wasm32-wali-linux-musl` target ([#4244](https://github.com/rust-lang/libc/pull/4244))
### Changed
- AIX: Use `sa_sigaction` instead of a union ([#4250](https://github.com/rust-lang/libc/pull/4250))
- Make `msqid_ds.__msg_cbytes` public ([#4301](https://github.com/rust-lang/libc/pull/4301))
- Unix: Make all `major`, `minor`, `makedev` into `const fn` ([#4208](https://github.com/rust-lang/libc/pull/4208))
### Deprecated
- Linux: Deprecate obsolete packet filter interfaces ([#4267](https://github.com/rust-lang/libc/pull/4267))
### Fixed
- Cygwin: Fix strerror_r ([#4308](https://github.com/rust-lang/libc/pull/4308))
- Cygwin: Fix usage of f! ([#4308](https://github.com/rust-lang/libc/pull/4308))
- Hermit: Make `stat::st_size` signed ([#4298](https://github.com/rust-lang/libc/pull/4298))
- Linux: Correct values for `SI_TIMER`, `SI_MESGQ`, `SI_ASYNCIO` ([#4292](https://github.com/rust-lang/libc/pull/4292))
- NuttX: Update `tm_zone` and `d_name` fields to use `c_char` type ([#4222](https://github.com/rust-lang/libc/pull/4222))
- Xous: Include the prelude to define `c_int` ([#4304](https://github.com/rust-lang/libc/pull/4304))
### Other
- Add labels to FIXMEs ([#4231](https://github.com/rust-lang/libc/pull/4231), [#4232](https://github.com/rust-lang/libc/pull/4232), [#4234](https://github.com/rust-lang/libc/pull/4234), [#4235](https://github.com/rust-lang/libc/pull/4235), [#4236](https://github.com/rust-lang/libc/pull/4236))
- CI: Fix "cannot find libc" error on Sparc64 ([#4317](https://github.com/rust-lang/libc/pull/4317))
- CI: Fix "cannot find libc" error on s390x ([#4317](https://github.com/rust-lang/libc/pull/4317))
- CI: Pass `--no-self-update` to `rustup update` ([#4306](https://github.com/rust-lang/libc/pull/4306))
- CI: Remove tests for the `i586-pc-windows-msvc` target ([#4311](https://github.com/rust-lang/libc/pull/4311))
- CI: Remove the `check_cfg` job ([#4322](https://github.com/rust-lang/libc/pull/4312))
- Change the range syntax that is giving `ctest` problems ([#4311](https://github.com/rust-lang/libc/pull/4311))
- Linux: Split out the stat struct for gnu/b32/mips ([#4276](https://github.com/rust-lang/libc/pull/4276))
### Removed
- NuttX: Remove `pthread_set_name_np` ([#4251](https://github.com/rust-lang/libc/pull/4251))
## [0.2.170](https://github.com/rust-lang/libc/compare/0.2.169...0.2.170) - 2025-02-23
### Added
- Android: Declare `setdomainname` and `getdomainname` <https://github.com/rust-lang/libc/pull/4212>
- FreeBSD: Add `evdev` structures <https://github.com/rust-lang/libc/pull/3756>
- FreeBSD: Add the new `st_filerev` field to `stat32` ([#4254](https://github.com/rust-lang/libc/pull/4254))
- Linux: Add `SI_*`` and `TRAP_*`` signal codes <https://github.com/rust-lang/libc/pull/4225>
- Linux: Add experimental configuration to enable 64-bit time in kernel APIs, set by `RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64`. <https://github.com/rust-lang/libc/pull/4148>
- Linux: Add recent socket timestamping flags <https://github.com/rust-lang/libc/pull/4273>
- Linux: Added new CANFD_FDF flag for the flags field of canfd_frame <https://github.com/rust-lang/libc/pull/4223>
- Musl: add CLONE_NEWTIME <https://github.com/rust-lang/libc/pull/4226>
- Solarish: add the posix_spawn family of functions <https://github.com/rust-lang/libc/pull/4259>
### Deprecated
- Linux: deprecate kernel modules syscalls <https://github.com/rust-lang/libc/pull/4228>
### Changed
- Emscripten: Assume version is at least 3.1.42 <https://github.com/rust-lang/libc/pull/4243>
### Fixed
- BSD: Correct the definition of `WEXITSTATUS` <https://github.com/rust-lang/libc/pull/4213>
- Hurd: Fix CMSG_DATA on 64bit systems ([#4240](https://github.com/rust-lang/libc/pull/424))
- NetBSD: fix `getmntinfo` ([#4265](https://github.com/rust-lang/libc/pull/4265)
- VxWorks: Fix the size of `time_t` <https://github.com/rust-lang/libc/pull/426>
### Other
- Add labels to FIXMEs <https://github.com/rust-lang/libc/pull/4230>, <https://github.com/rust-lang/libc/pull/4229>, <https://github.com/rust-lang/libc/pull/4237>
- CI: Bump FreeBSD CI to 13.4 and 14.2 <https://github.com/rust-lang/libc/pull/4260>
- Copy definitions from core::ffi and centralize them <https://github.com/rust-lang/libc/pull/4256>
- Define c_char at top-level and remove per-target c_char definitions <https://github.com/rust-lang/libc/pull/4202>
- Port style.rs to syn and add tests for the style checker <https://github.com/rust-lang/libc/pull/4220>
## [0.2.169](https://github.com/rust-lang/libc/compare/0.2.168...0.2.169) - 2024-12-18
### Added
- FreeBSD: add more socket TCP stack constants <https://github.com/rust-lang/libc/pull/4193>
- Fuchsia: add a `sockaddr_vm` definition <https://github.com/rust-lang/libc/pull/4194>
### Fixed
**Breaking**: [rust-lang/rust#132975](https://github.com/rust-lang/rust/pull/132975) corrected the signedness of `core::ffi::c_char` on various Tier 2 and Tier 3 platforms (mostly Arm and RISC-V) to match Clang. This release contains the corresponding changes to `libc`, including the following specific pull requests:
- ESP-IDF: Replace arch-conditional `c_char` with a reexport <https://github.com/rust-lang/libc/pull/4195>
- Fix `c_char` on various targets <https://github.com/rust-lang/libc/pull/4199>
- Mirror `c_char` configuration from `rust-lang/rust` <https://github.com/rust-lang/libc/pull/4198>
### Cleanup
- Do not re-export `c_void` in target-specific code <https://github.com/rust-lang/libc/pull/4200>
## [0.2.168](https://github.com/rust-lang/libc/compare/0.2.167...0.2.168) - 2024-12-09
### Added
- Linux: Add new process flags ([#4174](https://github.com/rust-lang/libc/pull/4174))
- Linux: Make `IFA_*` constants available on all Linux targets <https://github.com/rust-lang/libc/pull/4185>
- Linux: add `MAP_DROPPABLE` <https://github.com/rust-lang/libc/pull/4173>
- Solaris, Illumos: add `SIGRTMIN` and `SIGRTMAX` <https://github.com/rust-lang/libc/pull/4171>
- Unix, Linux: adding POSIX `memccpy` and `mempcpy` GNU extension <https://github.com/rust-lang/libc/pull/4186.
### Deprecated
- FreeBSD: Deprecate the CAP_UNUSED* and CAP_ALL* constants ([#4183](https://github.com/rust-lang/libc/pull/4183))
### Fixed
- Make the `Debug` implementation for unions opaque ([#4176](https://github.com/rust-lang/libc/pull/4176))
### Other
- Allow the `unpredictable_function_pointer_comparisons` lint where needed <https://github.com/rust-lang/libc/pull/4177>
- CI: Upload artifacts created by libc-test <https://github.com/rust-lang/libc/pull/4180>
- CI: Use workflow commands to group output by target <https://github.com/rust-lang/libc/pull/4179>
- CI: add caching <https://github.com/rust-lang/libc/pull/4183>
## [0.2.167](https://github.com/rust-lang/libc/compare/0.2.166...0.2.167) - 2024-11-28
### Added
- Solarish: add `st_fstype` to `stat` <https://github.com/rust-lang/libc/pull/4145>
- Trusty: Add `intptr_t` and `uintptr_t` ([#4161](https://github.com/rust-lang/libc/pull/4161))
### Fixed
- Fix the build with `rustc-dep-of-std` <https://github.com/rust-lang/libc/pull/4158>
- Wasi: Add back unsafe block for `clockid_t` static variables ([#4157](https://github.com/rust-lang/libc/pull/4157))
### Cleanup
- Create an internal prelude <https://github.com/rust-lang/libc/pull/4161>
- Fix `unused_qualifications`<https://github.com/rust-lang/libc/pull/4132>
### Other
- CI: Check various FreeBSD versions ([#4159](https://github.com/rust-lang/libc/pull/4159))
- CI: add a timeout for all jobs <https://github.com/rust-lang/libc/pull/4164>
- CI: verify MSRV for `wasm32-wasi` <https://github.com/rust-lang/libc/pull/4157>
- Migrate to the 2021 edition <https://github.com/rust-lang/libc/pull/4132>
### Removed
- Remove one unused import after the edition 2021 bump
## [0.2.166](https://github.com/rust-lang/libc/compare/0.2.165...0.2.166) - 2024-11-26
### Fixed
This release resolves two cases of unintentional breakage from the previous release:
- Revert removal of array size hacks [#4150](https://github.com/rust-lang/libc/pull/4150)
- Ensure `const extern` functions are always enabled [#4151](https://github.com/rust-lang/libc/pull/4151)
## [0.2.165](https://github.com/rust-lang/libc/compare/0.2.164...0.2.165) - 2024-11-25
### Added
- Android: add `mkostemp`, `mkostemps` <https://github.com/rust-lang/libc/pull/3601>
- Android: add a few API 30 calls <https://github.com/rust-lang/libc/pull/3604>
- Android: add missing syscall constants <https://github.com/rust-lang/libc/pull/3558>
- Apple: add `in6_ifreq` <https://github.com/rust-lang/libc/pull/3617>
- Apple: add missing `sysctl` net types <https://github.com/rust-lang/libc/pull/4022> (before release: remove `if_family_id` ([#4137](https://github.com/rust-lang/libc/pulls/4137)))
- Freebsd: add `kcmp` call support <https://github.com/rust-lang/libc/pull/3746>
- Hurd: add `MAP_32BIT` and `MAP_EXCL` <https://github.com/rust-lang/libc/pull/4127>
- Hurd: add `domainname` field to `utsname` ([#4089](https://github.com/rust-lang/libc/pulls/4089))
- Linux GNU: add `f_flags` to struct `statfs` for arm, mips, powerpc and x86 <https://github.com/rust-lang/libc/pull/3663>
- Linux GNU: add `malloc_stats` <https://github.com/rust-lang/libc/pull/3596>
- Linux: add ELF relocation-related structs <https://github.com/rust-lang/libc/pull/3583>
- Linux: add `ptp_*` structs <https://github.com/rust-lang/libc/pull/4113>
- Linux: add `ptp_clock_caps` <https://github.com/rust-lang/libc/pull/4128>
- Linux: add `ptp_pin_function` and most `PTP_` constants <https://github.com/rust-lang/libc/pull/4114>
- Linux: add missing AF_XDP structs & constants <https://github.com/rust-lang/libc/pull/3956>
- Linux: add missing netfilter consts ([#3734](https://github.com/rust-lang/libc/pulls/3734))
- Linux: add struct and constants for the `mount_setattr` syscall <https://github.com/rust-lang/libc/pull/4046>
- Linux: add wireless API <https://github.com/rust-lang/libc/pull/3441>
- Linux: expose the `len8_dlc` field of `can_frame` <https://github.com/rust-lang/libc/pull/3357>
- Musl: add `utmpx` API <https://github.com/rust-lang/libc/pull/3213>
- Musl: add missing syscall constants <https://github.com/rust-lang/libc/pull/4028>
- NetBSD: add `mcontext`-related data for RISCV64 <https://github.com/rust-lang/libc/pull/3468>
- Redox: add new `netinet` constants <https://github.com/rust-lang/libc/pull/3586>)
- Solarish: add `_POSIX_VDISABLE` ([#4103](https://github.com/rust-lang/libc/pulls/4103))
- Tests: Add a test that the `const extern fn` macro works <https://github.com/rust-lang/libc/pull/4134>
- Tests: Add test of primitive types against `std` <https://github.com/rust-lang/libc/pull/3616>
- Unix: Add `htonl`, `htons`, `ntohl`, `ntohs` <https://github.com/rust-lang/libc/pull/3669>
- Unix: add `aligned_alloc` <https://github.com/rust-lang/libc/pull/3843>
- Windows: add `aligned_realloc` <https://github.com/rust-lang/libc/pull/3592>
### Fixed
- **breaking** Hurd: fix `MAP_HASSEMAPHORE` name ([#4127](https://github.com/rust-lang/libc/pulls/4127))
- **breaking** ulibc Mips: fix `SA_*` mismatched types ([#3211](https://github.com/rust-lang/libc/pulls/3211))
- Aix: fix an enum FFI safety warning <https://github.com/rust-lang/libc/pull/3644>
- Haiku: fix some typos ([#3664](https://github.com/rust-lang/libc/pulls/3664))
- Tests: fix `Elf{32,64}_Relr`-related tests <https://github.com/rust-lang/libc/pull/3647>
- Tests: fix libc-tests for `loongarch64-linux-musl`
- Tests: fix some clippy warnings <https://github.com/rust-lang/libc/pull/3855>
- Tests: fix tests on `riscv64gc-unknown-freebsd` <https://github.com/rust-lang/libc/pull/4129>
### Deprecated
- Apple: deprecate `iconv_open` <https://github.com/rust-lang/libc/commit/25e022a22eca3634166ef472b748c297e60fcf7f>
- Apple: deprecate `mach_task_self` <https://github.com/rust-lang/libc/pull/4095>
- Apple: update `mach` deprecation notices for things that were removed in `main` <https://github.com/rust-lang/libc/pull/4097>
### Cleanup
- Adjust the `f!` macro to be more flexible <https://github.com/rust-lang/libc/pull/4107>
- Aix: remove duplicate constants <https://github.com/rust-lang/libc/pull/3643>
- CI: make scripts more uniform <https://github.com/rust-lang/libc/pull/4042>
- Drop the `libc_align` conditional <https://github.com/rust-lang/libc/commit/b5b553d0ee7de0d4781432a9a9a0a6445dd7f34f>
- Drop the `libc_cfg_target_vendor` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_const_size_of` conditional <https://github.com/rust-lang/libc/commit/5a43dd2754366f99b3a83881b30246ce0e51833c>
- Drop the `libc_core_cvoid` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_int128` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_non_exhaustive` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_packedN` conditional <https://github.com/rust-lang/libc/pull/4060>
- Drop the `libc_priv_mod_use` conditional <https://github.com/rust-lang/libc/commit/19c59376d11b015009fb9b04f233a30a1bf50a91>
- Drop the `libc_union` conditional <https://github.com/rust-lang/libc/commit/b9e4d8012f612dfe24147da3e69522763f92b6e3>
- Drop the `long_array` conditional <https://github.com/rust-lang/libc/pull/4096>
- Drop the `ptr_addr_of` conditional <https://github.com/rust-lang/libc/pull/4065>
- Drop warnings about deprecated cargo features <https://github.com/rust-lang/libc/pull/4060>
- Eliminate uses of `struct_formatter` <https://github.com/rust-lang/libc/pull/4074>
- Fix a few other array size hacks <https://github.com/rust-lang/libc/commit/d63be8b69b0736753213f5d933767866a5801ee7>
- Glibc: remove redundant definitions ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: remove redundant definitions ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: unify definitions of `siginfo_t` ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: unify definitions of statfs and statfs64 ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: unify definitions of statvfs and statvfs64 ([#3261](https://github.com/rust-lang/libc/pulls/3261))
- Musl: unify statx definitions ([#3978](https://github.com/rust-lang/libc/pulls/3978))
- Remove array size hacks for Rust < 1.47 <https://github.com/rust-lang/libc/commit/27ee6fe02ca0848b2af3cd747536264e4c7b697d>
- Remove repetitive words <https://github.com/rust-lang/libc/commit/77de375891285e18a81616f7dceda6d52732eed6>
- Use #[derive] for Copy/Clone in s! and friends <https://github.com/rust-lang/libc/pull/4038>
- Use some tricks to format macro bodies <https://github.com/rust-lang/libc/pull/4107>
### Other
- Apply formatting to macro bodies <https://github.com/rust-lang/libc/pull/4107>
- Bump libc-test to Rust 2021 Edition <https://github.com/rust-lang/libc/pull/3905>
- CI: Add a check that semver files don't contain duplicate entries <https://github.com/rust-lang/libc/pull/4087>
- CI: Add `fanotify_event_info_fid` to FAM-exempt types <https://github.com/rust-lang/libc/pull/4038>
- CI: Allow rustfmt to organize imports ([#4136](https://github.com/rust-lang/libc/pulls/4136))
- CI: Always run rustfmt <https://github.com/rust-lang/libc/pull/4120>
- CI: Change 32-bit Docker images to use EOL repos <https://github.com/rust-lang/libc/pull/4120>
- CI: Change 64-bit Docker images to ubuntu:24.10 <https://github.com/rust-lang/libc/pull/4120>
- CI: Disable the check for >1 s! invocation <https://github.com/rust-lang/libc/pull/4107>
- CI: Ensure build channels get run even if FILTER is unset <https://github.com/rust-lang/libc/pull/4125>
- CI: Ensure there is a fallback for no_std <https://github.com/rust-lang/libc/pull/4125>
- CI: Fix cases where unset variables cause errors <https://github.com/rust-lang/libc/pull/4108>
- CI: Naming adjustments and cleanup <https://github.com/rust-lang/libc/pull/4124>
- CI: Only invoke rustup if running in CI <https://github.com/rust-lang/libc/pull/4107>
- CI: Remove the logic to handle old rust versions <https://github.com/rust-lang/libc/pull/4068>
- CI: Set -u (error on unset) in all script files <https://github.com/rust-lang/libc/pull/4108>
- CI: add support for `loongarch64-unknown-linux-musl` <https://github.com/rust-lang/libc/pull/4092>
- CI: make `aarch64-apple-darwin` not a nightly-only target <https://github.com/rust-lang/libc/pull/4068>
- CI: run shellcheck on all scripts <https://github.com/rust-lang/libc/pull/4042>
- CI: update musl headers to Linux 6.6 <https://github.com/rust-lang/libc/pull/3921>
- CI: use qemu-sparc64 to run sparc64 tests <https://github.com/rust-lang/libc/pull/4133>
- Drop the `libc_const_extern_fn` conditional <https://github.com/rust-lang/libc/commit/674cc1f47f605038ef1aa2cce8e8bc9dac128276>
- Drop the `libc_underscore_const_names` conditional <https://github.com/rust-lang/libc/commit/f0febd5e2e50b38e05259d3afad3c9783711bcf0>
- Explicitly set the edition to 2015 <https://github.com/rust-lang/libc/pull/4058>
- Introduce a `git-blame-ignore-revs` file <https://github.com/rust-lang/libc/pull/4107>
- Tests: Ignore fields as required on Ubuntu 24.10 <https://github.com/rust-lang/libc/pull/4120>
- Tests: skip `ATF_*` constants for OpenBSD <https://github.com/rust-lang/libc/pull/4088>
- Triagebot: Add an autolabel for CI <https://github.com/rust-lang/libc/pull/4052>
## [0.2.164](https://github.com/rust-lang/libc/compare/0.2.163...0.2.164) - 2024-11-16
### MSRV
This release increases the MSRV of `libc` to 1.63.
### Other
- CI: remove tests with rust < 1.63 <https://github.com/rust-lang/libc/pull/4051>
- MSRV: document the MSRV of the stable channel to be 1.63 <https://github.com/rust-lang/libc/pull/4040>
- MacOS: move ifconf to s_no_extra_traits <https://github.com/rust-lang/libc/pull/4051>
## [0.2.163](https://github.com/rust-lang/libc/compare/0.2.162...0.2.163) - 2024-11-16
### Added
- Aix: add more `dlopen` flags <https://github.com/rust-lang/libc/pull/4044>
- Android: add group calls <https://github.com/rust-lang/libc/pull/3499>
- FreeBSD: add `TCP_FUNCTION_BLK` and `TCP_FUNCTION_ALIAS` <https://github.com/rust-lang/libc/pull/4047>
- Linux: add `confstr` <https://github.com/rust-lang/libc/pull/3612>
- Solarish: add `aio` <https://github.com/rust-lang/libc/pull/4033>
- Solarish: add `arc4random*` <https://github.com/rust-lang/libc/pull/3944>
### Changed
- Emscripten: upgrade emsdk to 3.1.68 <https://github.com/rust-lang/libc/pull/3962>
- Hurd: use more standard types <https://github.com/rust-lang/libc/pull/3733>
- Hurd: use the standard `ssize_t = isize` <https://github.com/rust-lang/libc/pull/4029>
- Solaris: fix `confstr` and `ucontext_t` <https://github.com/rust-lang/libc/pull/4035>
### Other
- CI: add Solaris <https://github.com/rust-lang/libc/pull/4035>
- CI: add `i686-unknown-freebsd` <https://github.com/rust-lang/libc/pull/3997>
- CI: ensure that calls to `sort` do not depend on locale <https://github.com/rust-lang/libc/pull/4026>
- Specify `rust-version` in `Cargo.toml` <https://github.com/rust-lang/libc/pull/4041>
## [0.2.162](https://github.com/rust-lang/libc/compare/0.2.161...0.2.162) - 2024-11-07
### Added
- Android: fix the alignment of `uc_mcontext` on arm64 <https://github.com/rust-lang/libc/pull/3894>
- Apple: add `host_cpu_load_info` <https://github.com/rust-lang/libc/pull/3916>
- ESP-IDF: add a time flag <https://github.com/rust-lang/libc/pull/3993>
- FreeBSD: add the `CLOSE_RANGE_CLOEXEC` flag<https://github.com/rust-lang/libc/pull/3996>
- FreeBSD: fix test errors regarding `__gregset_t` <https://github.com/rust-lang/libc/pull/3995>
- FreeBSD: fix tests on x86 FreeBSD 15 <https://github.com/rust-lang/libc/pull/3948>
- FreeBSD: make `ucontext_t` and `mcontext_t` available on all architectures <https://github.com/rust-lang/libc/pull/3848>
- Haiku: add `getentropy` <https://github.com/rust-lang/libc/pull/3991>
- Illumos: add `syncfs` <https://github.com/rust-lang/libc/pull/3990>
- Illumos: add some recently-added constants <https://github.com/rust-lang/libc/pull/3999>
- Linux: add `ioctl` flags <https://github.com/rust-lang/libc/pull/3960>
- Linux: add epoll busy polling parameters <https://github.com/rust-lang/libc/pull/3922>
- NuttX: add `pthread_[get/set]name_np` <https://github.com/rust-lang/libc/pull/4003>
- RTEMS: add `arc4random_buf` <https://github.com/rust-lang/libc/pull/3989>
- Trusty OS: add initial support <https://github.com/rust-lang/libc/pull/3942>
- WASIp2: expand socket support <https://github.com/rust-lang/libc/pull/3981>
### Fixed
- Emscripten: don't pass `-lc` <https://github.com/rust-lang/libc/pull/4002>
- Hurd: change `st_fsid` field to `st_dev` <https://github.com/rust-lang/libc/pull/3785>
- Hurd: fix the definition of `utsname` <https://github.com/rust-lang/libc/pull/3992>
- Illumos/Solaris: fix `FNM_CASEFOLD` definition <https://github.com/rust-lang/libc/pull/4004>
- Solaris: fix all tests <https://github.com/rust-lang/libc/pull/3864>
### Other
- CI: Add loongarch64 <https://github.com/rust-lang/libc/pull/4000>
- CI: Check that semver files are sorted <https://github.com/rust-lang/libc/pull/4018>
- CI: Re-enable the FreeBSD 15 job <https://github.com/rust-lang/libc/pull/3988>
- Clean up imports and `extern crate` usage <https://github.com/rust-lang/libc/pull/3897>
- Convert `mode_t` constants to octal <https://github.com/rust-lang/libc/pull/3634>
- Remove the `wasm32-wasi` target that has been deleted upstream <https://github.com/rust-lang/libc/pull/4013>
## [0.2.161](https://github.com/rust-lang/libc/compare/0.2.160...0.2.161) - 2024-10-17
### Fixed
- OpenBSD: fix `FNM_PATHNAME` and `FNM_NOESCAPE` values <https://github.com/rust-lang/libc/pull/3983>
## [0.2.160](https://github.com/rust-lang/libc/compare/0.2.159...0.2.160) - 2024-10-17
### Added
- Android: add `PR_GET_NAME` and `PR_SET_NAME` <https://github.com/rust-lang/libc/pull/3941>
- Apple: add `F_TRANSFEREXTENTS` <https://github.com/rust-lang/libc/pull/3925>
- Apple: add `mach_error_string` <https://github.com/rust-lang/libc/pull/3913>
- Apple: add additional `pthread` APIs <https://github.com/rust-lang/libc/pull/3846>
- Apple: add the `LOCAL_PEERTOKEN` socket option <https://github.com/rust-lang/libc/pull/3929>
- BSD: add `RTF_*`, `RTA_*`, `RTAX_*`, and `RTM_*` definitions <https://github.com/rust-lang/libc/pull/3714>
- Emscripten: add `AT_EACCESS` <https://github.com/rust-lang/libc/pull/3911>
- Emscripten: add `getgrgid`, `getgrnam`, `getgrnam_r` and `getgrgid_r` <https://github.com/rust-lang/libc/pull/3912>
- Emscripten: add `getpwnam_r` and `getpwuid_r` <https://github.com/rust-lang/libc/pull/3906>
- FreeBSD: add `POLLRDHUP` <https://github.com/rust-lang/libc/pull/3936>
- Haiku: add `arc4random` <https://github.com/rust-lang/libc/pull/3945>
- Illumos: add `ptsname_r` <https://github.com/rust-lang/libc/pull/3867>
- Linux: add `fanotify` interfaces <https://github.com/rust-lang/libc/pull/3695>
- Linux: add `tcp_info` <https://github.com/rust-lang/libc/pull/3480>
- Linux: add additional AF_PACKET options <https://github.com/rust-lang/libc/pull/3540>
- Linux: make Elf constants always available <https://github.com/rust-lang/libc/pull/3938>
- Musl x86: add `iopl` and `ioperm` <https://github.com/rust-lang/libc/pull/3720>
- Musl: add `posix_spawn` chdir functions <https://github.com/rust-lang/libc/pull/3949>
- Musl: add `utmpx.h` constants <https://github.com/rust-lang/libc/pull/3908>
- NetBSD: add `sysctlnametomib`, `CLOCK_THREAD_CPUTIME_ID` and `CLOCK_PROCESS_CPUTIME_ID` <https://github.com/rust-lang/libc/pull/3927>
- Nuttx: initial support <https://github.com/rust-lang/libc/pull/3909>
- RTEMS: add `getentropy` <https://github.com/rust-lang/libc/pull/3973>
- RTEMS: initial support <https://github.com/rust-lang/libc/pull/3866>
- Solarish: add `POLLRDHUP`, `POSIX_FADV_*`, `O_RSYNC`, and `posix_fallocate` <https://github.com/rust-lang/libc/pull/3936>
- Unix: add `fnmatch.h` <https://github.com/rust-lang/libc/pull/3937>
- VxWorks: add riscv64 support <https://github.com/rust-lang/libc/pull/3935>
- VxWorks: update constants related to the scheduler <https://github.com/rust-lang/libc/pull/3963>
### Changed
- Redox: change `ino_t` to be `c_ulonglong` <https://github.com/rust-lang/libc/pull/3919>
### Fixed
- ESP-IDF: fix mismatched constants and structs <https://github.com/rust-lang/libc/pull/3920>
- FreeBSD: fix `struct stat` on FreeBSD 12+ <https://github.com/rust-lang/libc/pull/3946>
### Other
- CI: Fix CI for FreeBSD 15 <https://github.com/rust-lang/libc/pull/3950>
- Docs: link to `windows-sys` <https://github.com/rust-lang/libc/pull/3915>
## [0.2.159](https://github.com/rust-lang/libc/compare/0.2.158...0.2.159) - 2024-09-24
### Added
- Android: add more `AT_*` constants in <https://github.com/rust-lang/libc/pull/3779>
- Apple: add missing `NOTE_*` constants in <https://github.com/rust-lang/libc/pull/3883>
- Hermit: add missing error numbers in <https://github.com/rust-lang/libc/pull/3858>
- Hurd: add `__timeval` for 64-bit support in <https://github.com/rust-lang/libc/pull/3786>
- Linux: add `epoll_pwait2` in <https://github.com/rust-lang/libc/pull/3868>
- Linux: add `mq_notify` in <https://github.com/rust-lang/libc/pull/3849>
- Linux: add missing `NFT_CT_*` constants in <https://github.com/rust-lang/libc/pull/3844>
- Linux: add the `fchmodat2` syscall in <https://github.com/rust-lang/libc/pull/3588>
- Linux: add the `mseal` syscall in <https://github.com/rust-lang/libc/pull/3798>
- OpenBSD: add `sendmmsg` and `recvmmsg` in <https://github.com/rust-lang/libc/pull/3831>
- Unix: add `IN6ADDR_ANY_INIT` and `IN6ADDR_LOOPBACK_INIT` in <https://github.com/rust-lang/libc/pull/3693>
- VxWorks: add `S_ISVTX` in <https://github.com/rust-lang/libc/pull/3768>
- VxWorks: add `vxCpuLib` and `taskLib` functions <https://github.com/rust-lang/libc/pull/3861>
- WASIp2: add definitions for `std::net` support in <https://github.com/rust-lang/libc/pull/3892>
### Fixed
- Correctly handle version checks when `clippy-driver` is used <https://github.com/rust-lang/libc/pull/3893>
### Changed
- EspIdf: change signal constants to c_int in <https://github.com/rust-lang/libc/pull/3895>
- HorizonOS: update network definitions in <https://github.com/rust-lang/libc/pull/3863>
- Linux: combine `ioctl` APIs in <https://github.com/rust-lang/libc/pull/3722>
- WASI: enable CI testing in <https://github.com/rust-lang/libc/pull/3869>
- WASIp2: enable CI testing in <https://github.com/rust-lang/libc/pull/3870>
## [0.2.158](https://github.com/rust-lang/libc/compare/0.2.157...0.2.158) - 2024-08-19
### Other
- WASI: fix missing `Iterator` with `rustc-dep-of-std` in <https://github.com/rust-lang/libc/pull/3856#event-13924913068>
## [0.2.157](https://github.com/rust-lang/libc/compare/0.2.156...0.2.157) - 2024-08-17
### Added
- Apple: add `_NSGetArgv`, `_NSGetArgc` and `_NSGetProgname` in <https://github.com/rust-lang/libc/pull/3702>
- Build: add `RUSTC_WRAPPER` support in <https://github.com/rust-lang/libc/pull/3845>
- FreeBSD: add `execvpe` support from 14.1 release in <https://github.com/rust-lang/libc/pull/3745>
- Fuchsia: add `SO_BINDTOIFINDEX`
- Linux: add `klogctl` in <https://github.com/rust-lang/libc/pull/3777>
- MacOS: add `fcntl` OFD commands in <https://github.com/rust-lang/libc/pull/3563>
- NetBSD: add `_lwp_park` in <https://github.com/rust-lang/libc/pull/3721>
- Solaris: add missing networking support in <https://github.com/rust-lang/libc/pull/3717>
- Unix: add `pthread_equal` in <https://github.com/rust-lang/libc/pull/3773>
- WASI: add `select`, `FD_SET`, `FD_ZERO`, `FD_ISSET ` in <https://github.com/rust-lang/libc/pull/3681>
### Fixed
- TEEOS: fix octal notation for `O_*` constants in <https://github.com/rust-lang/libc/pull/3841>
### Changed
- FreeBSD: always use freebsd12 when `rustc_dep_of_std` is set in <https://github.com/rust-lang/libc/pull/3723>
## [0.2.156](https://github.com/rust-lang/libc/compare/v0.2.155...v0.2.156) - 2024-08-15
### Added
- Apple: add `F_ALLOCATEPERSIST` in <https://github.com/rust-lang/libc/pull/3712>
- Apple: add `os_sync_wait_on_address` and related definitions in <https://github.com/rust-lang/libc/pull/3769>
- BSD: generalise `IPV6_DONTFRAG` to all BSD targets in <https://github.com/rust-lang/libc/pull/3716>
- FreeBSD/DragonFly: add `IP_RECVTTL`/`IPV6_RECVHOPLIMIT` in <https://github.com/rust-lang/libc/pull/3751>
- Hurd: add `XATTR_CREATE`, `XATTR_REPLACE` in <https://github.com/rust-lang/libc/pull/3739>
- Linux GNU: `confstr` API and `_CS_*` in <https://github.com/rust-lang/libc/pull/3771>
- Linux musl: add `preadv2` and `pwritev2` (1.2.5 min.) in <https://github.com/rust-lang/libc/pull/3762>
- VxWorks: add the constant `SOMAXCONN` in <https://github.com/rust-lang/libc/pull/3761>
- VxWorks: add a few errnoLib related constants in <https://github.com/rust-lang/libc/pull/3780>
### Fixed
- Solaris/illumos: Change `ifa_flags` type to u64 in <https://github.com/rust-lang/libc/pull/3729>
- QNX 7.0: Disable `libregex` in <https://github.com/rust-lang/libc/pull/3775>
### Changed
- QNX NTO: update platform support in <https://github.com/rust-lang/libc/pull/3815>
- `addr_of!(EXTERN_STATIC)` is now considered safe in <https://github.com/rust-lang/libc/pull/3776>
### Removed
- Apple: remove `rmx_state` in <https://github.com/rust-lang/libc/pull/3776>
### Other
- Update or remove CI tests that have been failing

126
vendor/libc/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,126 @@
# Contributing to `libc`
Welcome! If you are reading this document, it means you are interested in
contributing to the `libc` crate.
## v1.0 Roadmap
`libc` has two active branches: `main` and `libc-0.2`. `main` is for active
development of the upcoming v1.0 release, and should be the target of all pull
requests. `libc-0.2` is for updates to the currently released version.
If a pull request to `main` is a good candidate for inclusion in an `0.2.x`
release, include `@rustbot label stable-nominated` in a comment to propose this.
Good candidates will usually meet the following:
1. The included changes are non-breaking.
2. The change applies cleanly to both branches.
3. There is a usecase that justifies inclusion in a stable release (all
additions should always have a usecase, hopefully).
Once a `stable-nominated` PR targeting `main` has merged, it can be cherry
picked to the `libc-0.2` branch. A maintainer will likely do these cherry picks
in a batch.
Alternatively, you can start this process yourself by creating a new branch
based on `libc-0.2` and running `git cherry-pick -xe commit-sha-on-main`
(`git
cherry-pick -xe start-sha^..end-sha` if a range of commits is needed).
`git` will automatically add the "cherry picked from commit" note, but try to
add a backport note so the original PR gets crosslinked:
```
# ... original commit message ...
(backport <https://github.com/rust-lang/libc/pull/1234>) # add manually
(cherry picked from commit 104b6a4ae31c726814c36318dc718470cc96e167) # added by git
```
Once the cherry-pick is complete, open a PR targeting `libc-0.2`.
See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for
details.
## 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/linux_like/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.
New symbol(s) (i.e. functions, constants etc.) should also be added to the
symbols list(s) found in the `libc-test/semver` directory. These lists keep
track of what symbols are public in the libc crate and ensures they remain
available between changes to the crate. If the new symbol(s) are available on
all supported Unixes it should be added to `unix.txt` list<sup>1</sup>,
otherwise they should be added to the OS specific list(s).
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, including adding new symbol(s) to the semver lists.
3. Send a PR to this repo.
4. Wait for CI to pass, fixing errors.
5. Wait for a merge!
<sup>1</sup>: Note that this list has nothing to do with any Unix or Posix
standard, it's just a list shared among all OSs that declare `#[cfg(unix)]`.
## Test before you commit
We have two automated tests running on
[GitHub Actions](https://github.com/rust-lang/libc/actions):
1. `libc-test`
- `cd libc-test && cargo test`
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
2. Style checker
- [`./ci/style.py`](https://github.com/rust-lang/libc/blob/main/ci/style.py)
## Breaking change policy
Sometimes an upstream adds a breaking change to their API e.g. removing outdated
items, changing the type signature, etc. And we probably should follow that
change to build the `libc` crate successfully. It's annoying to do the
equivalent of semver-major versioning for each such change. Instead, we mark the
item as deprecated and do the actual change after a certain period. The steps
are:
1. Add `#[deprecated(since = "", note="")]` attribute to the item.
- The `since` field should have a next version of `libc` (e.g., if the current
version is `0.2.1`, it should be `0.2.2`).
- The `note` field should have a reason to deprecate and a tracking issue to
call for comments (e.g., "We consider removing this as the upstream removed
it. If you're using it, please comment on #XXX").
2. If we don't see any concerns for a while, do the change actually.
## Supported target policy
When Rust removes a support for a target, the libc crate also may remove the
support at any time.
## Releasing your change to crates.io
This repository uses [release-plz] to handle releases. Once your pull request
has been merged, a maintainer just needs to verify the generated changelog, then
merge the bot's release PR. This will automatically publish to crates.io!
[release-plz]: https://github.com/MarcoIeni/release-plz

16
vendor/libc/Cargo.lock generated vendored Normal file
View File

@@ -0,0 +1,16 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "libc"
version = "0.2.183"
dependencies = [
"rustc-std-workspace-core",
]
[[package]]
name = "rustc-std-workspace-core"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa9c45b374136f52f2d6311062c7146bff20fec063c3f5d46a410bd937746955"

230
vendor/libc/Cargo.toml vendored Normal file
View File

@@ -0,0 +1,230 @@
# 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 are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
rust-version = "1.63"
name = "libc"
version = "0.2.183"
authors = ["The Rust Project Developers"]
build = "build.rs"
exclude = [
"/ci/*",
"/.github/*",
"/.cirrus.yml",
"/triagebot.toml",
"cherry-pick-stable.sh",
]
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Raw FFI bindings to platform libraries like libc."
readme = "README.md"
keywords = [
"libc",
"ffi",
"bindings",
"operating",
"system",
]
categories = [
"external-ffi-bindings",
"no-std",
"os",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/libc"
[package.metadata.docs.rs]
features = ["extra_traits"]
default-target = "x86_64-unknown-linux-gnu"
targets = [
"aarch64-apple-darwin",
"aarch64-pc-windows-msvc",
"aarch64-unknown-linux-gnu",
"i686-pc-windows-msvc",
"i686-unknown-linux-gnu",
"x86_64-pc-windows-gnu",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"aarch64-pc-windows-gnullvm",
"aarch64-unknown-linux-musl",
"aarch64-unknown-linux-ohos",
"arm-unknown-linux-gnueabi",
"arm-unknown-linux-gnueabihf",
"armv7-unknown-linux-gnueabihf",
"armv7-unknown-linux-ohos",
"i686-pc-windows-gnu",
"loongarch64-unknown-linux-gnu",
"loongarch64-unknown-linux-musl",
"powerpc-unknown-linux-gnu",
"powerpc64-unknown-linux-gnu",
"powerpc64le-unknown-linux-gnu",
"powerpc64le-unknown-linux-musl",
"riscv64gc-unknown-linux-gnu",
"s390x-unknown-linux-gnu",
"sparcv9-sun-solaris",
"x86_64-apple-darwin",
"x86_64-pc-solaris",
"x86_64-pc-windows-gnullvm",
"x86_64-unknown-freebsd",
"x86_64-unknown-illumos",
"x86_64-unknown-linux-musl",
"x86_64-unknown-linux-ohos",
"x86_64-unknown-netbsd",
"aarch64-apple-ios",
"aarch64-apple-tvos",
"aarch64-apple-visionos",
"aarch64-apple-watchos",
"aarch64-linux-android",
"aarch64-unknown-fuchsia",
"arm-linux-androideabi",
"arm-unknown-linux-musleabi",
"arm-unknown-linux-musleabihf",
"arm64ec-pc-windows-msvc",
"armv5te-unknown-linux-gnueabi",
"armv5te-unknown-linux-musleabi",
"armv7-linux-androideabi",
"armv7-unknown-linux-musleabihf",
"i586-unknown-linux-gnu",
"i586-unknown-linux-musl",
"i686-linux-android",
"i686-unknown-freebsd",
"i686-unknown-linux-musl",
"nvptx64-nvidia-cuda",
"riscv64gc-unknown-linux-musl",
"sparc64-unknown-linux-gnu",
"thumbv7neon-linux-androideabi",
"thumbv7neon-unknown-linux-gnueabihf",
"wasm32-unknown-emscripten",
"wasm32-unknown-unknown",
"wasm32-wasip1",
"wasm32-wasip2",
"x86_64-fortanix-unknown-sgx",
"x86_64-linux-android",
"x86_64-unknown-fuchsia",
"x86_64-unknown-linux-gnux32",
"x86_64-unknown-redox",
"aarch64-unknown-freebsd",
"aarch64-unknown-hermit",
"aarch64-unknown-illumos",
"aarch64-unknown-netbsd",
"aarch64-unknown-nto-qnx800",
"aarch64-unknown-openbsd",
"aarch64-unknown-redox",
"aarch64-wrs-vxworks",
"aarch64_be-unknown-linux-gnu",
"aarch64_be-unknown-linux-musl",
"armebv7r-none-eabi",
"armebv7r-none-eabihf",
"armv7-linux-androideabi",
"armv7-wrs-vxworks-eabihf",
"armv7r-none-eabi",
"armv7r-none-eabihf",
"hexagon-unknown-linux-musl",
"i686-unknown-haiku",
"i686-unknown-netbsd",
"i686-unknown-openbsd",
"i686-wrs-vxworks",
"mips-unknown-linux-gnu",
"mips-unknown-linux-musl",
"mips64-unknown-linux-gnuabi64",
"mips64-unknown-linux-muslabi64",
"mips64el-unknown-linux-gnuabi64",
"mips64el-unknown-linux-muslabi64",
"mipsel-sony-psp",
"mipsel-unknown-linux-gnu",
"mipsel-unknown-linux-musl",
"powerpc-unknown-linux-gnuspe",
"powerpc-unknown-netbsd",
"powerpc-wrs-vxworks",
"powerpc-wrs-vxworks-spe",
"powerpc64-ibm-aix",
"powerpc64-unknown-freebsd",
"powerpc64-unknown-linux-gnu",
"powerpc64-unknown-linux-musl",
"powerpc64-wrs-vxworks",
"riscv32-wrs-vxworks",
"riscv32gc-unknown-linux-musl",
"riscv32i-unknown-none-elf",
"riscv32imac-unknown-none-elf",
"riscv32imc-unknown-none-elf",
"riscv64-wrs-vxworks",
"riscv64gc-unknown-freebsd",
"riscv64gc-unknown-hermit",
"riscv64gc-unknown-none-elf",
"riscv64imac-unknown-none-elf",
"s390x-unknown-linux-musl",
"sparc-unknown-linux-gnu",
"sparc64-unknown-netbsd",
"thumbv6m-none-eabi",
"thumbv7em-none-eabi",
"thumbv7em-none-eabihf",
"thumbv7m-none-eabi",
"wasm32-wasip3",
"x86_64-apple-ios",
"x86_64-pc-cygwin",
"x86_64-unknown-dragonfly",
"x86_64-unknown-haiku",
"x86_64-unknown-hermit",
"x86_64-unknown-hurd-gnu",
"x86_64-unknown-l4re-uclibc",
"x86_64-unknown-openbsd",
"x86_64-wrs-vxworks",
]
cargo-args = ["-Zbuild-std=core"]
[package.metadata.cargo-semver-checks.lints]
repr_align_removed = "warn"
global_value_marked_deprecated = "warn"
[features]
align = []
const-extern-fn = []
default = ["std"]
extra_traits = []
rustc-dep-of-std = [
"align",
"rustc-std-workspace-core",
]
std = []
use_std = ["std"]
[lib]
name = "libc"
path = "src/lib.rs"
[[test]]
name = "const_fn"
path = "tests/const_fn.rs"
[dependencies.rustc-std-workspace-core]
version = "1.0.1"
optional = true
[lints.clippy]
expl_impl_clone_on_copy = "allow"
explicit_iter_loop = "warn"
identity_op = "allow"
manual_assert = "warn"
map_unwrap_or = "warn"
missing_safety_doc = "allow"
non_minimal_cfg = "allow"
ptr_as_ptr = "warn"
uninlined_format_args = "allow"
unnecessary_cast = "allow"
unnecessary_semicolon = "warn"
used_underscore_binding = "allow"
[lints.rust]
unused_qualifications = "allow"

176
vendor/libc/LICENSE-APACHE vendored Normal file
View File

@@ -0,0 +1,176 @@
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

25
vendor/libc/LICENSE-MIT vendored Normal file
View File

@@ -0,0 +1,25 @@
Copyright (c) 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.

117
vendor/libc/README.md vendored Normal file
View File

@@ -0,0 +1,117 @@
# libc - Raw FFI bindings to platforms' system libraries
[![GHA Status]][GitHub Actions] [![Cirrus CI Status]][Cirrus CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License]
`libc` provides 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 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.
Windows API bindings are not included in this crate. If you are looking for
WinAPI bindings, consider using crates like [windows-sys].
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/HEAD/text/1291-promote-libc.md
[windows-sys]: https://docs.rs/windows-sys
## v1.0 Roadmap
Currently, `libc` has two active branches: `main` for the upcoming v1.0 release,
and `libc-0.2` for the currently published version. By default all pull requests
should target `main`; once reviewed, they can be cherry picked to the `libc-0.2`
branch if needed.
We will stop making new v0.2 releases once v1.0 is released.
See the section in [CONTRIBUTING.md](CONTRIBUTING.md#v10-roadmap) for more
details.
## Usage
Add the following to your `Cargo.toml`:
```toml
[dependencies]
libc = "0.2"
```
## Features
* `std`: by default `libc` links to the standard library. Disable this feature
to remove this dependency and be able to use `libc` in `#![no_std]` crates.
* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`.
This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`.
The following features are deprecated:
* `use_std`: this is equivalent to `std`
* `const-extern-fn`: this is now enabled by default
* `align`: this is now enabled by default
## Rust version support
The minimum supported Rust toolchain version is currently **Rust 1.63**.
Increases to the MSRV are allowed to change without a major (i.e. semver-
breaking) release in order to avoid a ripple effect in the ecosystem. A policy
for when this may change is a work in progress.
`libc` may continue to compile with Rust versions older than the current MSRV
but this is not guaranteed.
## Platform support
You can see the platform(target)-specific docs on [docs.rs], select a platform
you want to see.
See [`ci/verify-build.py`](https://github.com/rust-lang/libc/blob/HEAD/ci/verify-build.py) for
the platforms on which `libc` is guaranteed to build for each Rust toolchain.
The test-matrix at [GitHub Actions] and [Cirrus CI] show the platforms in which
`libc` tests are run.
<div class="platform_docs"></div>
## License
This project is licensed under either of
* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
([LICENSE-APACHE](https://github.com/rust-lang/libc/blob/HEAD/LICENSE-APACHE))
* [MIT License](https://opensource.org/licenses/MIT)
([LICENSE-MIT](https://github.com/rust-lang/libc/blob/HEAD/LICENSE-MIT))
at your option.
## Contributing
We welcome all people who want to contribute. Please see the
[contributing instructions] for more information.
[contributing instructions]: https://github.com/rust-lang/libc/blob/HEAD/CONTRIBUTING.md
Contributions in any form (issues, pull requests, etc.) to this project must
adhere to Rust's [Code of Conduct].
[Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in `libc` by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
[GitHub Actions]: https://github.com/rust-lang/libc/actions
[GHA Status]: https://github.com/rust-lang/libc/workflows/CI/badge.svg
[Cirrus CI]: https://cirrus-ci.com/github/rust-lang/libc
[Cirrus CI Status]: https://api.cirrus-ci.com/github/rust-lang/libc.svg
[crates.io]: https://crates.io/crates/libc
[Latest Version]: https://img.shields.io/crates/v/libc.svg
[Documentation]: https://docs.rs/libc/badge.svg
[docs.rs]: https://docs.rs/libc
[License]: https://img.shields.io/crates/l/libc.svg

338
vendor/libc/build.rs vendored Normal file
View File

@@ -0,0 +1,338 @@
use std::env::VarError;
use std::process::{
Command,
Output,
};
use std::{
env,
str,
};
// List of cfgs this build script is allowed to set. The list is needed to support check-cfg, as we
// need to know all the possible cfgs that this script will set. If you need to set another cfg
// make sure to add it to this list as well.
const ALLOWED_CFGS: &[&str] = &[
"emscripten_old_stat_abi",
"espidf_time32",
"freebsd10",
"freebsd11",
"freebsd12",
"freebsd13",
"freebsd14",
"freebsd15",
// Corresponds to `_FILE_OFFSET_BITS=64` in glibc
"gnu_file_offset_bits64",
// Corresponds to `_TIME_BITS=64` in glibc
"gnu_time_bits64",
"libc_deny_warnings",
// Corresponds to `__USE_TIME_BITS64` in UAPI
"linux_time_bits64",
"musl_v1_2_3",
// Corresponds to `_REDIR_TIME64` in musl
"musl32_time64",
"vxworks_lt_25_09",
];
// Extra values to allow for check-cfg.
const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[
(
"target_os",
&[
"switch", "aix", "ohos", "hurd", "rtems", "visionos", "nuttx", "cygwin", "qurt",
],
),
(
"target_env",
&["illumos", "wasi", "aix", "ohos", "nto71_iosock", "nto80"],
),
(
"target_arch",
&["loongarch64", "mips32r6", "mips64r6", "csky"],
),
];
/// Musl architectures that set `#define _REDIR_TIME64 1`.
const MUSL_REDIR_TIME64_ARCHES: &[&str] = &["arm", "hexagon", "mips", "powerpc", "x86"];
fn main() {
// Avoid unnecessary re-building.
println!("cargo:rerun-if-changed=build.rs");
let (rustc_minor_ver, _is_nightly) = rustc_minor_nightly();
let libc_ci = env_flag("LIBC_CI");
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default();
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
let target_ptr_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap_or_default();
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
// The ABI of libc used by std is backward compatible with FreeBSD 12.
// The ABI of libc from crates.io is backward compatible with FreeBSD 12.
//
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
// running tests to ensure that the ABI is correct.
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_FREEBSD_VERSION");
// Allow overriding the default version for testing
let which_freebsd = if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") {
let vers = version.parse().unwrap();
println!("cargo:warning=setting FreeBSD version to {vers}");
vers
} else if libc_ci {
which_freebsd().unwrap_or(12)
} else {
12
};
match which_freebsd {
x if x < 10 => panic!("FreeBSD older than 10 is not supported"),
10 => set_cfg("freebsd10"),
11 => set_cfg("freebsd11"),
12 => set_cfg("freebsd12"),
13 => set_cfg("freebsd13"),
14 => set_cfg("freebsd14"),
_ => set_cfg("freebsd15"),
}
match emcc_version_code() {
Some(v) if (v < 30142) => set_cfg("emscripten_old_stat_abi"),
// Non-Emscripten or version >= 3.1.42.
_ => (),
}
match vxworks_version_code() {
Some(v) if (v < (25, 9)) => set_cfg("vxworks_lt_25_09"),
// VxWorks version >= 25.09
_ => (),
}
let mut musl_v1_2_3 = env_flag("RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
// OpenHarmony uses a fork of the musl libc
let musl = target_env == "musl" || target_env == "ohos";
// loongarch64, hexagon, and ohos only exist with recent musl
if target_arch == "loongarch64" || target_arch == "hexagon" || target_env == "ohos" {
musl_v1_2_3 = true;
}
if musl && musl_v1_2_3 {
set_cfg("musl_v1_2_3");
if MUSL_REDIR_TIME64_ARCHES.contains(&target_arch.as_str()) {
set_cfg("musl32_time64");
set_cfg("linux_time_bits64");
}
}
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64");
if linux_time_bits64 {
set_cfg("linux_time_bits64");
}
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS");
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_TIME_BITS");
if target_env == "gnu"
&& target_os == "linux"
&& target_ptr_width == "32"
&& target_arch != "riscv32"
&& target_arch != "x86_64"
{
let defaultbits = "32".to_string();
let (timebits, filebits) = match (
env::var("RUST_LIBC_UNSTABLE_GNU_TIME_BITS"),
env::var("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"),
) {
(Ok(_), Ok(_)) => panic!("Do not set both RUST_LIBC_UNSTABLE_GNU_TIME_BITS and RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"),
(Err(_), Err(_)) => (defaultbits.clone(), defaultbits.clone()),
(Ok(tb), Err(_)) if tb == "64" => (tb.clone(), tb.clone()),
(Ok(tb), Err(_)) if tb == "32" => (tb, defaultbits.clone()),
(Ok(_), Err(_)) => panic!("Invalid value for RUST_LIBC_UNSTABLE_GNU_TIME_BITS, must be 32 or 64"),
(Err(_), Ok(fb)) if fb == "32" || fb == "64" => (defaultbits.clone(), fb),
(Err(_), Ok(_)) => panic!("Invalid value for RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS, must be 32 or 64"),
};
let valid_bits = ["32", "64"];
assert!(
valid_bits.contains(&filebits.as_str()) && valid_bits.contains(&timebits.as_str()),
"Invalid value for RUST_LIBC_UNSTABLE_GNU_TIME_BITS or RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS, must be 32, 64 or unset"
);
assert!(
!(filebits == "32" && timebits == "64"),
"RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS must be 64 or unset if RUST_LIBC_UNSTABLE_GNU_TIME_BITS is 64"
);
if timebits == "64" {
set_cfg("linux_time_bits64");
set_cfg("gnu_time_bits64");
}
if filebits == "64" {
set_cfg("gnu_file_offset_bits64");
}
}
// On CI: deny all warnings
if libc_ci {
set_cfg("libc_deny_warnings");
}
// Since Rust 1.80, configuration that isn't recognized by default needs to be provided to
// avoid warnings.
if rustc_minor_ver >= 80 {
for cfg in ALLOWED_CFGS {
println!("cargo:rustc-check-cfg=cfg({cfg})");
}
for &(name, values) in CHECK_CFG_EXTRA {
let values = values.join("\",\"");
println!("cargo:rustc-check-cfg=cfg({name},values(\"{values}\"))");
}
}
}
/// Run `rustc --version` and capture the output, adjusting arguments as needed if `clippy-driver`
/// is used instead.
fn rustc_version_cmd(is_clippy_driver: bool) -> Output {
let rustc = env::var_os("RUSTC").expect("Failed to get rustc version: missing RUSTC env");
let mut cmd = match env::var_os("RUSTC_WRAPPER") {
Some(ref wrapper) if wrapper.is_empty() => Command::new(rustc),
Some(wrapper) => {
let mut cmd = Command::new(wrapper);
cmd.arg(rustc);
if is_clippy_driver {
cmd.arg("--rustc");
}
cmd
}
None => Command::new(rustc),
};
cmd.arg("--version");
let output = cmd.output().expect("Failed to get rustc version");
assert!(
output.status.success(),
"failed to run rustc: {}",
String::from_utf8_lossy(output.stderr.as_slice())
);
output
}
/// Return the minor version of `rustc`, as well as a bool indicating whether or not the version
/// is a nightly.
fn rustc_minor_nightly() -> (u32, bool) {
macro_rules! otry {
($e:expr) => {
match $e {
Some(e) => e,
None => panic!("Failed to get rustc version"),
}
};
}
let mut output = rustc_version_cmd(false);
if otry!(str::from_utf8(&output.stdout).ok()).starts_with("clippy") {
output = rustc_version_cmd(true);
}
let version = otry!(str::from_utf8(&output.stdout).ok());
let mut pieces = version.split('.');
assert_eq!(
pieces.next(),
Some("rustc 1"),
"Failed to get rustc version"
);
let minor = pieces.next();
// If `rustc` was built from a tarball, its version string
// will have neither a git hash nor a commit date
// (e.g. "rustc 1.39.0"). Treat this case as non-nightly,
// since a nightly build should either come from CI
// or a git checkout
let nightly_raw = otry!(pieces.next()).split('-').nth(1);
let nightly = nightly_raw.map_or(false, |raw| {
raw.starts_with("dev") || raw.starts_with("nightly")
});
let minor = otry!(otry!(minor).parse().ok());
(minor, nightly)
}
fn which_freebsd() -> Option<i32> {
let output = Command::new("freebsd-version").output().ok()?;
if !output.status.success() {
return None;
}
let stdout = String::from_utf8(output.stdout).ok()?;
match &stdout {
s if s.starts_with("10") => Some(10),
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
s if s.starts_with("14") => Some(14),
s if s.starts_with("15") => Some(15),
_ => None,
}
}
fn emcc_version_code() -> Option<u64> {
let emcc = if cfg!(target_os = "windows") {
"emcc.bat"
} else {
"emcc"
};
let output = Command::new(emcc).arg("-dumpversion").output().ok()?;
if !output.status.success() {
return None;
}
let version = String::from_utf8(output.stdout).ok()?;
// Some Emscripten versions come with `-git` attached, so split the
// version string also on the `-` char.
let mut pieces = version.trim().split(['.', '-']);
let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
let patch = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
Some(major * 10000 + minor * 100 + patch)
}
/// Retrieve the VxWorks release version from the environment variable set by the VxWorks build
/// environment, in `(minor, patch)` form. Currently the only major version supported by Rust
/// is 7.
fn vxworks_version_code() -> Option<(u32, u32)> {
let version = env::var("WIND_RELEASE_ID").ok()?;
let mut pieces = version.trim().split(['.']);
let major: u32 = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
let minor: u32 = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
Some((major, minor))
}
fn set_cfg(cfg: &str) {
assert!(
ALLOWED_CFGS.contains(&cfg),
"trying to set cfg {cfg}, but it is not in ALLOWED_CFGS",
);
println!("cargo:rustc-cfg={cfg}");
}
/// Return true if the env is set to a value other than `0`.
fn env_flag(key: &str) -> bool {
match env::var(key) {
Ok(x) if x == "0" => false,
Err(VarError::NotPresent) => false,
Err(VarError::NotUnicode(_)) => panic!("non-unicode var for `{key}`"),
Ok(_) => true,
}
}

69
vendor/libc/src/fuchsia/aarch64.rs vendored Normal file
View File

@@ -0,0 +1,69 @@
use crate::off_t;
use crate::prelude::*;
pub type __u64 = c_ulonglong;
pub type wchar_t = u32;
pub type nlink_t = c_ulong;
pub type blksize_t = c_long;
s! {
pub struct stat {
pub st_dev: crate::dev_t,
pub st_ino: crate::ino_t,
pub st_mode: crate::mode_t,
pub st_nlink: crate::nlink_t,
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: crate::dev_t,
__pad0: Padding<c_ulong>,
pub st_size: off_t,
pub st_blksize: crate::blksize_t,
__pad1: Padding<c_int>,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
__unused: Padding<[c_uint; 2]>,
}
pub struct stat64 {
pub st_dev: crate::dev_t,
pub st_ino: crate::ino_t,
pub st_mode: crate::mode_t,
pub st_nlink: crate::nlink_t,
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: crate::dev_t,
__pad0: Padding<c_ulong>,
pub st_size: off_t,
pub st_blksize: crate::blksize_t,
__pad1: Padding<c_int>,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
__unused: Padding<[c_uint; 2]>,
}
pub struct ipc_perm {
pub __ipc_perm_key: crate::key_t,
pub uid: crate::uid_t,
pub gid: crate::gid_t,
pub cuid: crate::uid_t,
pub cgid: crate::gid_t,
pub mode: crate::mode_t,
pub __seq: c_ushort,
__unused1: Padding<c_ulong>,
__unused2: Padding<c_ulong>,
}
}
// From https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/bits/signal.h;l=20-21;drc=0827b18ab9540c46f8037f407d17ea15a79e9ba7
pub const MINSIGSTKSZ: size_t = 6144;
pub const SIGSTKSZ: size_t = 12288;

4026
vendor/libc/src/fuchsia/mod.rs vendored Normal file

File diff suppressed because it is too large Load Diff

46
vendor/libc/src/fuchsia/riscv64.rs vendored Normal file
View File

@@ -0,0 +1,46 @@
use crate::off_t;
use crate::prelude::*;
// From psABI Calling Convention for RV64
pub type __u64 = c_ulonglong;
pub type wchar_t = i32;
pub type nlink_t = c_ulong;
pub type blksize_t = c_long;
pub type stat64 = stat;
s! {
pub struct stat {
pub st_dev: crate::dev_t,
pub st_ino: crate::ino_t,
pub st_nlink: crate::nlink_t,
pub st_mode: crate::mode_t,
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
__pad0: Padding<c_int>,
pub st_rdev: crate::dev_t,
pub st_size: off_t,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
__unused: Padding<[c_long; 3]>,
}
// Not actually used, IPC calls just return ENOSYS
pub struct ipc_perm {
pub __ipc_perm_key: crate::key_t,
pub uid: crate::uid_t,
pub gid: crate::gid_t,
pub cuid: crate::uid_t,
pub cgid: crate::gid_t,
pub mode: crate::mode_t,
pub __seq: c_ushort,
__unused1: Padding<c_ulong>,
__unused2: Padding<c_ulong>,
}
}

110
vendor/libc/src/fuchsia/x86_64.rs vendored Normal file
View File

@@ -0,0 +1,110 @@
use crate::off_t;
use crate::prelude::*;
pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = c_long;
pub type __u64 = c_ulonglong;
s! {
pub struct stat {
pub st_dev: crate::dev_t,
pub st_ino: crate::ino_t,
pub st_nlink: crate::nlink_t,
pub st_mode: crate::mode_t,
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
__pad0: Padding<c_int>,
pub st_rdev: crate::dev_t,
pub st_size: off_t,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
__unused: Padding<[c_long; 3]>,
}
pub struct stat64 {
pub st_dev: crate::dev_t,
pub st_ino: crate::ino64_t,
pub st_nlink: crate::nlink_t,
pub st_mode: crate::mode_t,
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
__pad0: Padding<c_int>,
pub st_rdev: crate::dev_t,
pub st_size: off_t,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt64_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
__reserved: Padding<[c_long; 3]>,
}
pub struct mcontext_t {
__private: [u64; 32],
}
pub struct ipc_perm {
pub __ipc_perm_key: crate::key_t,
pub uid: crate::uid_t,
pub gid: crate::gid_t,
pub cuid: crate::uid_t,
pub cgid: crate::gid_t,
pub mode: crate::mode_t,
pub __seq: c_int,
__unused1: Padding<c_long>,
__unused2: Padding<c_long>,
}
pub struct ucontext_t {
pub uc_flags: c_ulong,
pub uc_link: *mut ucontext_t,
pub uc_stack: crate::stack_t,
pub uc_mcontext: mcontext_t,
pub uc_sigmask: crate::sigset_t,
__private: [u8; 512],
}
}
// 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;
pub const MAP_32BIT: c_int = 0x0040;
pub const SIGSTKSZ: size_t = 8192;
pub const MINSIGSTKSZ: size_t = 2048;

562
vendor/libc/src/hermit.rs vendored Normal file
View File

@@ -0,0 +1,562 @@
//! Hermit C type definitions
use crate::prelude::*;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type size_t = usize;
pub type ssize_t = isize;
pub type ptrdiff_t = isize;
pub type clockid_t = i32;
pub type in_addr_t = u32;
pub type in_port_t = u16;
pub type mode_t = u32;
pub type nfds_t = usize;
pub type pid_t = i32;
pub type sa_family_t = u8;
pub type socklen_t = u32;
pub type time_t = i64;
s! {
pub struct addrinfo {
pub ai_flags: i32,
pub ai_family: i32,
pub ai_socktype: i32,
pub ai_protocol: i32,
pub ai_addrlen: socklen_t,
pub ai_canonname: *mut c_char,
pub ai_addr: *mut sockaddr,
pub ai_next: *mut addrinfo,
}
pub struct dirent64 {
pub d_ino: u64,
pub d_off: i64,
pub d_reclen: u16,
pub d_type: u8,
pub d_name: [c_char; 256],
}
#[repr(align(4))]
pub struct in6_addr {
pub s6_addr: [u8; 16],
}
pub struct in_addr {
pub s_addr: in_addr_t,
}
pub struct iovec {
iov_base: *mut c_void,
iov_len: usize,
}
pub struct pollfd {
pub fd: i32,
pub events: i16,
pub revents: i16,
}
pub struct sockaddr {
pub sa_len: u8,
pub sa_family: sa_family_t,
pub sa_data: [c_char; 14],
}
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: [c_char; 8],
}
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_storage {
pub ss_len: u8,
pub ss_family: sa_family_t,
__ss_pad1: Padding<[u8; 6]>,
__ss_align: i64,
__ss_pad2: Padding<[u8; 112]>,
}
pub struct stat {
pub st_dev: u64,
pub st_ino: u64,
pub st_nlink: u64,
pub st_mode: mode_t,
pub st_uid: u32,
pub st_gid: u32,
pub st_rdev: u64,
pub st_size: i64,
pub st_blksize: i64,
pub st_blocks: i64,
pub st_atim: timespec,
pub st_mtim: timespec,
pub st_ctim: timespec,
}
#[derive(Default)]
pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: i32,
}
}
pub const AF_UNSPEC: i32 = 0;
pub const AF_INET: i32 = 3;
pub const AF_INET6: i32 = 1;
pub const AF_VSOCK: i32 = 2;
pub const CLOCK_REALTIME: clockid_t = 1;
pub const CLOCK_MONOTONIC: clockid_t = 4;
pub const DT_UNKNOWN: u8 = 0;
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 DT_WHT: u8 = 14;
pub const EAI_AGAIN: i32 = 2;
pub const EAI_BADFLAGS: i32 = 3;
pub const EAI_FAIL: i32 = 4;
pub const EAI_FAMILY: i32 = 5;
pub const EAI_MEMORY: i32 = 6;
pub const EAI_NODATA: i32 = 7;
pub const EAI_NONAME: i32 = 8;
pub const EAI_SERVICE: i32 = 9;
pub const EAI_SOCKTYPE: i32 = 10;
pub const EAI_SYSTEM: i32 = 11;
pub const EAI_OVERFLOW: i32 = 14;
pub const EFD_SEMAPHORE: i16 = 0o1;
pub const EFD_NONBLOCK: i16 = 0o4000;
pub const EFD_CLOEXEC: i16 = 0o40000;
pub const F_DUPFD: i32 = 0;
pub const F_GETFD: i32 = 1;
pub const F_SETFD: i32 = 2;
pub const F_GETFL: i32 = 3;
pub const F_SETFL: i32 = 4;
pub const FD_CLOEXEC: i32 = 1;
pub const FIONBIO: i32 = 0x8008667e;
pub const FUTEX_RELATIVE_TIMEOUT: u32 = 1;
pub const IP_TOS: i32 = 1;
pub const IP_TTL: i32 = 2;
pub const IP_ADD_MEMBERSHIP: i32 = 3;
pub const IP_DROP_MEMBERSHIP: i32 = 4;
pub const IP_MULTICAST_TTL: i32 = 5;
pub const IP_MULTICAST_LOOP: i32 = 7;
pub const IPPROTO_IP: i32 = 0;
pub const IPPROTO_TCP: i32 = 6;
pub const IPPROTO_UDP: i32 = 17;
pub const IPPROTO_IPV6: i32 = 41;
pub const IPV6_ADD_MEMBERSHIP: i32 = 12;
pub const IPV6_DROP_MEMBERSHIP: i32 = 13;
pub const IPV6_MULTICAST_LOOP: i32 = 19;
pub const IPV6_V6ONLY: i32 = 27;
pub const MSG_PEEK: i32 = 1;
pub const O_RDONLY: i32 = 0o0;
pub const O_WRONLY: i32 = 0o1;
pub const O_RDWR: i32 = 0o2;
pub const O_CREAT: i32 = 0o100;
pub const O_EXCL: i32 = 0o200;
pub const O_TRUNC: i32 = 0o1000;
pub const O_APPEND: i32 = 0o2000;
pub const O_NONBLOCK: i32 = 0o4000;
pub const O_DIRECTORY: i32 = 0o200000;
pub const POLLIN: i16 = 0x1;
pub const POLLPRI: i16 = 0x2;
pub const POLLOUT: i16 = 0x4;
pub const POLLERR: i16 = 0x8;
pub const POLLHUP: i16 = 0x10;
pub const POLLNVAL: i16 = 0x20;
pub const POLLRDNORM: i16 = 0x040;
pub const POLLRDBAND: i16 = 0x080;
pub const POLLWRNORM: i16 = 0x0100;
pub const POLLWRBAND: i16 = 0x0200;
pub const POLLRDHUP: i16 = 0x2000;
pub const S_IRWXU: mode_t = 0o0700;
pub const S_IRUSR: mode_t = 0o0400;
pub const S_IWUSR: mode_t = 0o0200;
pub const S_IXUSR: mode_t = 0o0100;
pub const S_IRWXG: mode_t = 0o0070;
pub const S_IRGRP: mode_t = 0o0040;
pub const S_IWGRP: mode_t = 0o0020;
pub const S_IXGRP: mode_t = 0o0010;
pub const S_IRWXO: mode_t = 0o0007;
pub const S_IROTH: mode_t = 0o0004;
pub const S_IWOTH: mode_t = 0o0002;
pub const S_IXOTH: mode_t = 0o0001;
pub const S_IFMT: mode_t = 0o17_0000;
pub const S_IFSOCK: mode_t = 0o14_0000;
pub const S_IFLNK: mode_t = 0o12_0000;
pub const S_IFREG: mode_t = 0o10_0000;
pub const S_IFBLK: mode_t = 0o6_0000;
pub const S_IFDIR: mode_t = 0o4_0000;
pub const S_IFCHR: mode_t = 0o2_0000;
pub const S_IFIFO: mode_t = 0o1_0000;
pub const SHUT_RD: i32 = 0;
pub const SHUT_WR: i32 = 1;
pub const SHUT_RDWR: i32 = 2;
pub const SO_REUSEADDR: i32 = 0x0004;
pub const SO_KEEPALIVE: i32 = 0x0008;
pub const SO_BROADCAST: i32 = 0x0020;
pub const SO_LINGER: i32 = 0x0080;
pub const SO_SNDBUF: i32 = 0x1001;
pub const SO_RCVBUF: i32 = 0x1002;
pub const SO_SNDTIMEO: i32 = 0x1005;
pub const SO_RCVTIMEO: i32 = 0x1006;
pub const SO_ERROR: i32 = 0x1007;
pub const SOCK_STREAM: i32 = 1;
pub const SOCK_DGRAM: i32 = 2;
pub const SOCK_NONBLOCK: i32 = 0o4000;
pub const SOCK_CLOEXEC: i32 = 0o40000;
pub const SOL_SOCKET: i32 = 4095;
pub const STDIN_FILENO: c_int = 0;
pub const STDOUT_FILENO: c_int = 1;
pub const STDERR_FILENO: c_int = 2;
pub const TCP_NODELAY: i32 = 1;
pub const EPERM: i32 = 1;
pub const ENOENT: i32 = 2;
pub const ESRCH: i32 = 3;
pub const EINTR: i32 = 4;
pub const EIO: i32 = 5;
pub const ENXIO: i32 = 6;
pub const E2BIG: i32 = 7;
pub const ENOEXEC: i32 = 8;
pub const EBADF: i32 = 9;
pub const ECHILD: i32 = 10;
pub const EAGAIN: i32 = 11;
pub const ENOMEM: i32 = 12;
pub const EACCES: i32 = 13;
pub const EFAULT: i32 = 14;
pub const ENOTBLK: i32 = 15;
pub const EBUSY: i32 = 16;
pub const EEXIST: i32 = 17;
pub const EXDEV: i32 = 18;
pub const ENODEV: i32 = 19;
pub const ENOTDIR: i32 = 20;
pub const EISDIR: i32 = 21;
pub const EINVAL: i32 = 22;
pub const ENFILE: i32 = 23;
pub const EMFILE: i32 = 24;
pub const ENOTTY: i32 = 25;
pub const ETXTBSY: i32 = 26;
pub const EFBIG: i32 = 27;
pub const ENOSPC: i32 = 28;
pub const ESPIPE: i32 = 29;
pub const EROFS: i32 = 30;
pub const EMLINK: i32 = 31;
pub const EPIPE: i32 = 32;
pub const EDOM: i32 = 33;
pub const ERANGE: i32 = 34;
pub const EDEADLK: i32 = 35;
pub const ENAMETOOLONG: i32 = 36;
pub const ENOLCK: i32 = 37;
pub const ENOSYS: i32 = 38;
pub const ENOTEMPTY: i32 = 39;
pub const ELOOP: i32 = 40;
pub const EWOULDBLOCK: i32 = EAGAIN;
pub const ENOMSG: i32 = 42;
pub const EIDRM: i32 = 43;
pub const ECHRNG: i32 = 44;
pub const EL2NSYNC: i32 = 45;
pub const EL3HLT: i32 = 46;
pub const EL3RST: i32 = 47;
pub const ELNRNG: i32 = 48;
pub const EUNATCH: i32 = 49;
pub const ENOCSI: i32 = 50;
pub const EL2HLT: i32 = 51;
pub const EBADE: i32 = 52;
pub const EBADR: i32 = 53;
pub const EXFULL: i32 = 54;
pub const ENOANO: i32 = 55;
pub const EBADRQC: i32 = 56;
pub const EBADSLT: i32 = 57;
pub const EDEADLOCK: i32 = EDEADLK;
pub const EBFONT: i32 = 59;
pub const ENOSTR: i32 = 60;
pub const ENODATA: i32 = 61;
pub const ETIME: i32 = 62;
pub const ENOSR: i32 = 63;
pub const ENONET: i32 = 64;
pub const ENOPKG: i32 = 65;
pub const EREMOTE: i32 = 66;
pub const ENOLINK: i32 = 67;
pub const EADV: i32 = 68;
pub const ESRMNT: i32 = 69;
pub const ECOMM: i32 = 70;
pub const EPROTO: i32 = 71;
pub const EMULTIHOP: i32 = 72;
pub const EDOTDOT: i32 = 73;
pub const EBADMSG: i32 = 74;
pub const EOVERFLOW: i32 = 75;
pub const ENOTUNIQ: i32 = 76;
pub const EBADFD: i32 = 77;
pub const EREMCHG: i32 = 78;
pub const ELIBACC: i32 = 79;
pub const ELIBBAD: i32 = 80;
pub const ELIBSCN: i32 = 81;
pub const ELIBMAX: i32 = 82;
pub const ELIBEXEC: i32 = 83;
pub const EILSEQ: i32 = 84;
pub const ERESTART: i32 = 85;
pub const ESTRPIPE: i32 = 86;
pub const EUSERS: i32 = 87;
pub const ENOTSOCK: i32 = 88;
pub const EDESTADDRREQ: i32 = 89;
pub const EMSGSIZE: i32 = 90;
pub const EPROTOTYPE: i32 = 91;
pub const ENOPROTOOPT: i32 = 92;
pub const EPROTONOSUPPORT: i32 = 93;
pub const ESOCKTNOSUPPORT: i32 = 94;
pub const EOPNOTSUPP: i32 = 95;
pub const EPFNOSUPPORT: i32 = 96;
pub const EAFNOSUPPORT: i32 = 97;
pub const EADDRINUSE: i32 = 98;
pub const EADDRNOTAVAIL: i32 = 99;
pub const ENETDOWN: i32 = 100;
pub const ENETUNREACH: i32 = 101;
pub const ENETRESET: i32 = 102;
pub const ECONNABORTED: i32 = 103;
pub const ECONNRESET: i32 = 104;
pub const ENOBUFS: i32 = 105;
pub const EISCONN: i32 = 106;
pub const ENOTCONN: i32 = 107;
pub const ESHUTDOWN: i32 = 108;
pub const ETOOMANYREFS: i32 = 109;
pub const ETIMEDOUT: i32 = 110;
pub const ECONNREFUSED: i32 = 111;
pub const EHOSTDOWN: i32 = 112;
pub const EHOSTUNREACH: i32 = 113;
pub const EALREADY: i32 = 114;
pub const EINPROGRESS: i32 = 115;
pub const ESTALE: i32 = 116;
pub const EUCLEAN: i32 = 117;
pub const ENOTNAM: i32 = 118;
pub const ENAVAIL: i32 = 119;
pub const EISNAM: i32 = 120;
pub const EREMOTEIO: i32 = 121;
pub const EDQUOT: i32 = 122;
pub const ENOMEDIUM: i32 = 123;
pub const EMEDIUMTYPE: i32 = 124;
pub const ECANCELED: i32 = 125;
pub const ENOKEY: i32 = 126;
pub const EKEYEXPIRED: i32 = 127;
pub const EKEYREVOKED: i32 = 128;
pub const EKEYREJECTED: i32 = 129;
pub const EOWNERDEAD: i32 = 130;
pub const ENOTRECOVERABLE: i32 = 131;
pub const ERFKILL: i32 = 132;
pub const EHWPOISON: i32 = 133;
extern "C" {
#[link_name = "sys_alloc"]
pub fn alloc(size: usize, align: usize) -> *mut u8;
#[link_name = "sys_alloc_zeroed"]
pub fn alloc_zeroed(size: usize, align: usize) -> *mut u8;
#[link_name = "sys_realloc"]
pub fn realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8;
#[link_name = "sys_dealloc"]
pub fn dealloc(ptr: *mut u8, size: usize, align: usize);
#[link_name = "sys_exit"]
pub fn exit(status: i32) -> !;
#[link_name = "sys_abort"]
pub fn abort() -> !;
#[link_name = "sys_errno"]
pub fn errno() -> i32;
#[link_name = "sys_clock_gettime"]
pub fn clock_gettime(clockid: clockid_t, tp: *mut timespec) -> i32;
#[link_name = "sys_nanosleep"]
pub fn nanosleep(req: *const timespec) -> i32;
#[link_name = "sys_available_parallelism"]
pub fn available_parallelism() -> usize;
#[link_name = "sys_futex_wait"]
pub fn futex_wait(
address: *mut u32,
expected: u32,
timeout: *const timespec,
flags: u32,
) -> i32;
#[link_name = "sys_futex_wake"]
pub fn futex_wake(address: *mut u32, count: i32) -> i32;
#[link_name = "sys_stat"]
pub fn stat(path: *const c_char, stat: *mut stat) -> i32;
#[link_name = "sys_fstat"]
pub fn fstat(fd: i32, stat: *mut stat) -> i32;
#[link_name = "sys_lstat"]
pub fn lstat(path: *const c_char, stat: *mut stat) -> i32;
#[link_name = "sys_open"]
pub fn open(path: *const c_char, flags: i32, mode: mode_t) -> i32;
#[link_name = "sys_unlink"]
pub fn unlink(path: *const c_char) -> i32;
#[link_name = "sys_mkdir"]
pub fn mkdir(path: *const c_char, mode: mode_t) -> i32;
#[link_name = "sys_rmdir"]
pub fn rmdir(path: *const c_char) -> i32;
#[link_name = "sys_read"]
pub fn read(fd: i32, buf: *mut u8, len: usize) -> isize;
#[link_name = "sys_write"]
pub fn write(fd: i32, buf: *const u8, len: usize) -> isize;
#[link_name = "sys_readv"]
pub fn readv(fd: i32, iov: *const iovec, iovcnt: usize) -> isize;
#[link_name = "sys_writev"]
pub fn writev(fd: i32, iov: *const iovec, iovcnt: usize) -> isize;
#[link_name = "sys_close"]
pub fn close(fd: i32) -> i32;
#[link_name = "sys_dup"]
pub fn dup(fd: i32) -> i32;
#[link_name = "sys_fcntl"]
pub fn fcntl(fd: i32, cmd: i32, arg: i32) -> i32;
#[link_name = "sys_getdents64"]
pub fn getdents64(fd: i32, dirp: *mut dirent64, count: usize) -> isize;
#[link_name = "sys_getaddrinfo"]
pub fn getaddrinfo(
nodename: *const c_char,
servname: *const c_char,
hints: *const addrinfo,
res: *mut *mut addrinfo,
) -> i32;
#[link_name = "sys_freeaddrinfo"]
pub fn freeaddrinfo(ai: *mut addrinfo);
#[link_name = "sys_socket"]
pub fn socket(domain: i32, ty: i32, protocol: i32) -> i32;
#[link_name = "sys_bind"]
pub fn bind(sockfd: i32, addr: *const sockaddr, addrlen: socklen_t) -> i32;
#[link_name = "sys_listen"]
pub fn listen(sockfd: i32, backlog: i32) -> i32;
#[link_name = "sys_accept"]
pub fn accept(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32;
#[link_name = "sys_connect"]
pub fn connect(sockfd: i32, addr: *const sockaddr, addrlen: socklen_t) -> i32;
#[link_name = "sys_recv"]
pub fn recv(sockfd: i32, buf: *mut u8, len: usize, flags: i32) -> isize;
#[link_name = "sys_recvfrom"]
pub fn recvfrom(
sockfd: i32,
buf: *mut c_void,
len: usize,
flags: i32,
addr: *mut sockaddr,
addrlen: *mut socklen_t,
) -> isize;
#[link_name = "sys_send"]
pub fn send(sockfd: i32, buf: *const c_void, len: usize, flags: i32) -> isize;
#[link_name = "sys_sendto"]
pub fn sendto(
sockfd: i32,
buf: *const c_void,
len: usize,
flags: i32,
to: *const sockaddr,
tolen: socklen_t,
) -> isize;
#[link_name = "sys_getpeername"]
pub fn getpeername(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32;
#[link_name = "sys_getsockname"]
pub fn getsockname(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32;
#[link_name = "sys_getsockopt"]
pub fn getsockopt(
sockfd: i32,
level: i32,
optname: i32,
optval: *mut c_void,
optlen: *mut socklen_t,
) -> i32;
#[link_name = "sys_setsockopt"]
pub fn setsockopt(
sockfd: i32,
level: i32,
optname: i32,
optval: *const c_void,
optlen: socklen_t,
) -> i32;
#[link_name = "sys_ioctl"]
pub fn ioctl(sockfd: i32, cmd: i32, argp: *mut c_void) -> i32;
#[link_name = "sys_shutdown"]
pub fn shutdown(sockfd: i32, how: i32) -> i32;
#[link_name = "sys_eventfd"]
pub fn eventfd(initval: u64, flags: i16) -> i32;
#[link_name = "sys_poll"]
pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: i32) -> i32;
}

167
vendor/libc/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,167 @@
//! libc - Raw FFI bindings to platforms' system libraries
#![crate_name = "libc"]
#![crate_type = "rlib"]
#![allow(
renamed_and_removed_lints, // Keep this order.
unknown_lints, // Keep this order.
nonstandard_style,
overflowing_literals,
unused_macros,
unused_macro_rules,
)]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
safe_packed_borrows
)]
// Prepare for a future upgrade
#![warn(rust_2024_compatibility)]
// Things missing for 2024 that are blocked on MSRV or breakage
#![allow(
missing_unsafe_on_extern,
edition_2024_expr_fragment_specifier,
// Allowed globally, the warning is enabled in individual modules as we work through them
unsafe_op_in_unsafe_fn
)]
#![cfg_attr(libc_deny_warnings, deny(warnings))]
// Attributes needed when building as part of the standard library
#![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))]
#![cfg_attr(feature = "rustc-dep-of-std", allow(internal_features))]
#![cfg_attr(feature = "rustc-dep-of-std", allow(unused_features))]
// DIFF(1.0): The thread local references that raise this lint were removed in 1.0
#![cfg_attr(feature = "rustc-dep-of-std", allow(static_mut_refs))]
#![cfg_attr(not(feature = "rustc-dep-of-std"), no_std)]
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
#[macro_use]
mod macros;
mod new;
cfg_if! {
if #[cfg(feature = "rustc-dep-of-std")] {
extern crate rustc_std_workspace_core as core;
}
}
pub use core::ffi::c_void;
#[allow(unused_imports)] // needed while the module is empty on some platforms
pub use new::*;
cfg_if! {
if #[cfg(windows)] {
mod primitives;
pub use crate::primitives::*;
mod windows;
pub use crate::windows::*;
prelude!();
} else if #[cfg(target_os = "fuchsia")] {
mod primitives;
pub use crate::primitives::*;
mod fuchsia;
pub use crate::fuchsia::*;
prelude!();
} else if #[cfg(target_os = "switch")] {
mod primitives;
pub use primitives::*;
mod switch;
pub use switch::*;
prelude!();
} else if #[cfg(target_os = "psp")] {
mod primitives;
pub use primitives::*;
mod psp;
pub use crate::psp::*;
prelude!();
} else if #[cfg(target_os = "vxworks")] {
mod primitives;
pub use crate::primitives::*;
mod vxworks;
pub use crate::vxworks::*;
prelude!();
} else if #[cfg(target_os = "qurt")] {
mod primitives;
pub use crate::primitives::*;
mod qurt;
pub use crate::qurt::*;
prelude!();
} else if #[cfg(target_os = "solid_asp3")] {
mod primitives;
pub use crate::primitives::*;
mod solid;
pub use crate::solid::*;
prelude!();
} else if #[cfg(unix)] {
mod primitives;
pub use crate::primitives::*;
mod unix;
pub use crate::unix::*;
prelude!();
} else if #[cfg(target_os = "hermit")] {
mod primitives;
pub use crate::primitives::*;
mod hermit;
pub use crate::hermit::*;
prelude!();
} else if #[cfg(target_os = "teeos")] {
mod primitives;
pub use primitives::*;
mod teeos;
pub use teeos::*;
prelude!();
} else if #[cfg(target_os = "trusty")] {
mod primitives;
pub use crate::primitives::*;
mod trusty;
pub use crate::trusty::*;
prelude!();
} else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] {
mod primitives;
pub use crate::primitives::*;
mod sgx;
pub use crate::sgx::*;
prelude!();
} else if #[cfg(any(target_env = "wasi", target_os = "wasi"))] {
mod primitives;
pub use crate::primitives::*;
mod wasi;
pub use crate::wasi::*;
prelude!();
} else if #[cfg(target_os = "xous")] {
mod primitives;
pub use crate::primitives::*;
mod xous;
pub use crate::xous::*;
prelude!();
} else {
// non-supported targets: empty...
}
}

654
vendor/libc/src/macros.rs vendored Normal file
View File

@@ -0,0 +1,654 @@
/// 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 {
// match if/else chains with a final `else`
($(
if #[cfg($($meta:meta),*)] { $($it:item)* }
) else * else {
$($it2:item)*
}) => {
cfg_if! {
@__items
() ;
$( ( ($($meta),*) ($($it)*) ), )*
( () ($($it2)*) ),
}
};
// match if/else chains lacking a final `else`
(
if #[cfg($($i_met:meta),*)] { $($i_it:item)* }
$(
else if #[cfg($($e_met:meta),*)] { $($e_it:item)* }
)*
) => {
cfg_if! {
@__items
() ;
( ($($i_met),*) ($($i_it)*) ),
$( ( ($($e_met),*) ($($e_it)*) ), )*
( () () ),
}
};
// Internal and recursive macro to emit all the items
//
// Collects all the negated `cfg`s in a list at the beginning and after the
// semicolon is all the remaining items
(@__items ($($not:meta,)*) ; ) => {};
(@__items ($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ),
$($rest:tt)*) => {
// Emit all items within one block, applying an appropriate #[cfg]. The
// #[cfg] will require all `$m` matchers specified and must also negate
// all previous matchers.
cfg_if! { @__apply cfg(all($($m,)* not(any($($not),*)))), $($it)* }
// Recurse to emit all other items in `$rest`, and when we do so add all
// our `$m` matchers to the list of `$not` matchers as future emissions
// will have to negate everything we just matched as well.
cfg_if! { @__items ($($not,)* $($m,)*) ; $($rest)* }
};
// Internal macro to Apply a cfg attribute to a list of items
(@__apply $m:meta, $($it:item)*) => {
$(#[$m] $it)*
};
}
/// Create an internal crate prelude with `core` reexports and common types.
macro_rules! prelude {
() => {
mod types;
/// Frequently-used types that are available on all platforms
///
/// We need to reexport the core types so this works with `rust-dep-of-std`.
mod prelude {
// Exports from `core`
#[allow(unused_imports)]
pub(crate) use core::clone::Clone;
#[allow(unused_imports)]
pub(crate) use core::default::Default;
#[allow(unused_imports)]
pub(crate) use core::marker::{
Copy,
Send,
Sync,
};
#[allow(unused_imports)]
pub(crate) use core::option::Option;
#[allow(unused_imports)]
pub(crate) use core::prelude::v1::derive;
#[allow(unused_imports)]
pub(crate) use core::{
cfg,
fmt,
hash,
iter,
mem,
ptr,
};
#[allow(unused_imports)]
pub(crate) use fmt::Debug;
#[allow(unused_imports)]
pub(crate) use mem::{
align_of,
align_of_val,
size_of,
size_of_val,
};
#[allow(unused_imports)]
pub(crate) use crate::types::{
CEnumRepr,
Padding,
};
// Commonly used types defined in this crate
#[allow(unused_imports)]
pub(crate) use crate::{
c_char,
c_double,
c_float,
c_int,
c_long,
c_longlong,
c_short,
c_uchar,
c_uint,
c_ulong,
c_ulonglong,
c_ushort,
c_void,
intptr_t,
size_t,
ssize_t,
uintptr_t,
};
}
};
}
/// Implement `Clone`, `Copy`, and `Debug` for one or more structs, as well as `PartialEq`, `Eq`,
/// and `Hash` if the `extra_traits` feature is enabled.
///
/// Also mark the type with `repr(C)`.
///
/// Use [`s_no_extra_traits`] for structs where the `extra_traits` feature does not
/// make sense, and for unions.
macro_rules! s {
($(
$(#[$attr:meta])*
$pub:vis $t:ident $i:ident { $($field:tt)* }
)*) => ($(
s!(it: $(#[$attr])* $pub $t $i { $($field)* });
)*);
(it: $(#[$attr:meta])* $pub:vis union $i:ident { $($field:tt)* }) => (
compile_error!("unions cannot derive extra traits, use s_no_extra_traits instead");
);
(it: $(#[$attr:meta])* $pub:vis struct $i:ident { $($field:tt)* }) => (
#[repr(C)]
#[::core::prelude::v1::derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
)]
#[cfg_attr(
feature = "extra_traits",
::core::prelude::v1::derive(PartialEq, Eq, Hash)
)]
#[allow(deprecated)]
$(#[$attr])*
$pub struct $i { $($field)* }
);
}
/// Implement `Clone`, `Copy`, and `Debug` for a tuple struct, as well as `PartialEq`, `Eq`,
/// and `Hash` if the `extra_traits` feature is enabled.
///
/// Unlike `s!`, this does *not* mark the type with `repr(C)`. Users should provide their own
/// `repr` attribute via `$attr` as necessary.
macro_rules! s_paren {
($(
$(#[$attr:meta])*
$pub:vis struct $i:ident ( $($field:tt)* );
)*) => ($(
#[::core::prelude::v1::derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
)]
#[cfg_attr(
feature = "extra_traits",
::core::prelude::v1::derive(PartialEq, Eq, Hash)
)]
$(#[$attr])*
$pub struct $i ( $($field)* );
)*);
}
/// Implement `Clone`, `Copy`, and `Debug` for one or more structs/unions, but exclude `PartialEq`,
/// `Eq`, and `Hash`.
///
/// Also mark the type with `repr(C)`.
///
/// Most structs will prefer to use [`s`].
macro_rules! s_no_extra_traits {
($(
$(#[$attr:meta])*
$pub:vis $t:ident $i:ident { $($field:tt)* }
)*) => ($(
s_no_extra_traits!(it: $(#[$attr])* $pub $t $i { $($field)* });
)*);
(it: $(#[$attr:meta])* $pub:vis union $i:ident { $($field:tt)* }) => (
#[repr(C)]
#[::core::prelude::v1::derive(
::core::clone::Clone,
::core::marker::Copy,
)]
$(#[$attr])*
$pub union $i { $($field)* }
impl ::core::fmt::Debug for $i {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct(::core::stringify!($i)).finish_non_exhaustive()
}
}
);
(it: $(#[$attr:meta])* $pub:vis struct $i:ident { $($field:tt)* }) => (
#[repr(C)]
#[::core::prelude::v1::derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
)]
$(#[$attr])*
$pub struct $i { $($field)* }
);
}
/// Create an uninhabited type that can't be constructed. It implements `Debug`, `Clone`,
/// and `Copy`, but these aren't meaningful for extern types so they should eventually
/// be removed.
///
/// Really what we want here is something that also can't be named without indirection (in
/// ADTs or function signatures), but this doesn't exist.
macro_rules! extern_ty {
($(
$(#[$attr:meta])*
pub enum $i:ident {}
)*) => ($(
$(#[$attr])*
// FIXME(1.0): the type is uninhabited so these traits are unreachable and could be
// removed.
#[::core::prelude::v1::derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
)]
pub enum $i { }
)*);
}
/// Implement `Clone` and `Copy` for an enum, as well as `Debug`, `Eq`, `Hash`, and
/// `PartialEq` if the `extra_traits` feature is enabled.
// FIXME(#4419): Replace all uses of `e!` with `c_enum!`
macro_rules! e {
($(
$(#[$attr:meta])*
pub enum $i:ident { $($field:tt)* }
)*) => ($(
#[cfg_attr(
feature = "extra_traits",
::core::prelude::v1::derive(Eq, Hash, PartialEq)
)]
#[::core::prelude::v1::derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
)]
$(#[$attr])*
pub enum $i { $($field)* }
)*);
}
/// Represent a C enum as Rust constants and a type.
///
/// C enums can't soundly be mapped to Rust enums since C enums are allowed to have duplicates or
/// unlisted values, but this is UB in Rust. This enum doesn't implement any traits, its main
/// purpose is to calculate the correct enum values.
///
/// Use the magic name `#anon` if the C enum doesn't create a type.
///
/// See <https://github.com/rust-lang/libc/issues/4419> for more.
macro_rules! c_enum {
// Matcher for multiple enums
($(
$(#[repr($repr:ty)])?
pub enum $($ty_name:ident)? $(#$anon:ident)? {
$($vis:vis $variant:ident $(= $value:expr)?,)+
}
)+) => {
$(c_enum!(@single;
$(#[repr($repr)])?
pub enum $($ty_name)? $(#$anon)? {
$($vis $variant $(= $value)?,)+
}
);)+
};
// Matcher for a single enum
(@single;
$(#[repr($repr:ty)])?
pub enum $ty_name:ident {
$($vis:vis $variant:ident $(= $value:expr)?,)+
}
) => {
pub type $ty_name = c_enum!(@ty $($repr)?);
c_enum! {
@variant;
ty: $ty_name;
default: 0;
variants: [$($vis $variant $(= $value)?,)+]
}
};
// Matcher for a single anonymous enum
(@single;
$(#[repr($repr:ty)])?
pub enum #anon {
$($vis:vis $variant:ident $(= $value:expr)?,)+
}
) => {
c_enum! {
@variant;
ty: c_enum!(@ty $($repr)?);
default: 0;
variants: [$($vis $variant $(= $value)?,)+]
}
};
// Matcher for variants: eats a single variant then recurses with the rest
(@variant; ty: $_ty_name:ty; default: $_idx:expr; variants: []) => { /* end of the chain */ };
(
@variant;
ty: $ty_name:ty;
default: $default_val:expr;
variants: [
$vis:vis $variant:ident $(= $value:expr)?,
$($tail:tt)*
]
) => {
$vis const $variant: $ty_name = {
#[allow(unused_variables)]
let r = $default_val;
$(let r = $value;)?
r
};
// The next value is always one more than the previous value, unless
// set explicitly.
c_enum! {
@variant;
ty: $ty_name;
default: $variant + 1;
variants: [$($tail)*]
}
};
// Use a specific type if provided, otherwise default to `CEnumRepr`
(@ty $repr:ty) => { $repr };
(@ty) => { $crate::prelude::CEnumRepr };
}
/// Define a `unsafe` function.
macro_rules! f {
($(
$(#[$attr:meta])*
// Less than ideal hack to match either `fn` or `const fn`.
pub $(fn $i:ident)? $(const fn $const_i:ident)?
($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty
$body:block
)+) => {$(
#[inline]
$(#[$attr])*
pub $(unsafe extern "C" fn $i)? $(const unsafe extern "C" fn $const_i)?
($($arg: $argty),*) -> $ret
$body
)+};
}
/// Define a safe function.
macro_rules! safe_f {
($(
$(#[$attr:meta])*
// Less than ideal hack to match either `fn` or `const fn`.
pub $(fn $i:ident)? $(const fn $const_i:ident)?
($($arg:ident: $argty:ty),* $(,)*) -> $ret:ty
$body:block
)+) => {$(
#[inline]
$(#[$attr])*
pub $(extern "C" fn $i)? $(const extern "C" fn $const_i)?
($($arg: $argty),*) -> $ret
$body
)+};
}
// This macro is used to deprecate items that should be accessed via the mach2 crate
macro_rules! deprecated_mach {
(pub const $id:ident: $ty:ty = $expr:expr;) => {
#[deprecated(
since = "0.2.55",
note = "Use the `mach2` crate instead",
)]
#[allow(deprecated)]
pub const $id: $ty = $expr;
};
($(pub const $id:ident: $ty:ty = $expr:expr;)*) => {
$(
deprecated_mach!(
pub const $id: $ty = $expr;
);
)*
};
(pub type $id:ident = $ty:ty;) => {
#[deprecated(
since = "0.2.55",
note = "Use the `mach2` crate instead",
)]
#[allow(deprecated)]
pub type $id = $ty;
};
($(pub type $id:ident = $ty:ty;)*) => {
$(
deprecated_mach!(
pub type $id = $ty;
);
)*
}
}
/// Polyfill for std's `offset_of`.
// FIXME(msrv): stabilized in std in 1.77
macro_rules! offset_of {
($Ty:path, $field:ident) => {{
// Taken from bytemuck, avoids accidentally calling on deref
#[allow(clippy::unneeded_field_pattern)]
let $Ty { $field: _, .. };
let data = core::mem::MaybeUninit::<$Ty>::uninit();
let ptr = data.as_ptr();
// nested unsafe, see f!
#[allow(unused_unsafe)]
// SAFETY: computed address is inbounds since we have a stack alloc for T
let fptr = unsafe { core::ptr::addr_of!((*ptr).$field) };
let off = (fptr as usize).checked_sub(ptr as usize).unwrap();
core::assert!(off <= core::mem::size_of::<$Ty>());
off
}};
}
#[cfg(test)]
mod tests {
use core::any::TypeId;
use crate::types::CEnumRepr;
#[test]
fn c_enum_basic() {
// By default, variants get sequential values.
c_enum! {
pub enum e {
VAR0,
VAR1,
VAR2,
}
// Also check enums that don't create a type.
pub enum #anon {
ANON0,
ANON1,
ANON2,
}
}
assert_eq!(TypeId::of::<e>(), TypeId::of::<CEnumRepr>());
assert_eq!(VAR0, 0 as CEnumRepr);
assert_eq!(VAR1, 1 as CEnumRepr);
assert_eq!(VAR2, 2 as CEnumRepr);
assert_eq!(type_id_of_val(&ANON0), TypeId::of::<CEnumRepr>());
assert_eq!(ANON0, 0 as CEnumRepr);
assert_eq!(ANON1, 1 as CEnumRepr);
assert_eq!(ANON2, 2 as CEnumRepr);
}
#[test]
fn c_enum_repr() {
// Check specifying the integer representation
c_enum! {
#[repr(u16)]
pub enum e {
VAR0,
}
#[repr(u16)]
pub enum #anon {
ANON0,
}
}
assert_eq!(TypeId::of::<e>(), TypeId::of::<u16>());
assert_eq!(VAR0, 0_u16);
assert_eq!(type_id_of_val(&ANON0), TypeId::of::<u16>());
assert_eq!(ANON0, 0_u16);
}
#[test]
fn c_enum_set_value() {
// Setting an explicit value resets the count.
c_enum! {
pub enum e {
VAR2 = 2,
VAR3,
VAR4,
}
}
assert_eq!(VAR2, 2 as CEnumRepr);
assert_eq!(VAR3, 3 as CEnumRepr);
assert_eq!(VAR4, 4 as CEnumRepr);
}
#[test]
fn c_enum_multiple_set_value() {
// C enums always take one more than the previous value, unless set to a specific
// value. Duplicates are allowed.
c_enum! {
pub enum e {
VAR0,
VAR2_0 = 2,
VAR3_0,
VAR4_0,
VAR2_1 = 2,
VAR3_1,
VAR4_1,
}
}
assert_eq!(VAR0, 0 as CEnumRepr);
assert_eq!(VAR2_0, 2 as CEnumRepr);
assert_eq!(VAR3_0, 3 as CEnumRepr);
assert_eq!(VAR4_0, 4 as CEnumRepr);
assert_eq!(VAR2_1, 2 as CEnumRepr);
assert_eq!(VAR3_1, 3 as CEnumRepr);
assert_eq!(VAR4_1, 4 as CEnumRepr);
}
#[test]
fn c_enum_vis() {
mod priv1 {
c_enum! {
#[repr(u8)]
pub enum e1 {
PRIV_ON_1 = 10,
// Variant should still be usable within its visibility
pub PUB1 = PRIV_ON_1 * 2,
}
}
}
mod priv2 {
c_enum! {
#[repr(u16)]
pub enum e2 {
pub PRIV_ON_1 = 42,
pub PUB2 = PRIV_ON_1 * 2,
}
}
}
use priv1::*;
use priv2::*;
assert_eq!(TypeId::of::<e1>(), TypeId::of::<u8>());
assert_eq!(TypeId::of::<e2>(), TypeId::of::<u16>());
assert_eq!(PUB1, 10u8 * 2);
assert_eq!(PUB2, 42u16 * 2);
// Verify that the default is private. If `PRIV_ON_1` was actually public in `priv1`, this
// would be an ambiguous import and/or type mismatch error.
assert_eq!(PRIV_ON_1, 42u16);
}
fn type_id_of_val<T: 'static>(_: &T) -> TypeId {
TypeId::of::<T>()
}
#[test]
fn test_offset_of() {
#[repr(C)]
struct Off1 {
a: u8,
b: u32,
c: Off2,
d: u64,
}
#[repr(C)]
#[repr(align(128))]
struct Off2 {}
assert_eq!(core::mem::offset_of!(Off1, a), offset_of!(Off1, a));
assert_eq!(core::mem::offset_of!(Off1, b), offset_of!(Off1, b));
assert_eq!(core::mem::offset_of!(Off1, c), offset_of!(Off1, c));
assert_eq!(core::mem::offset_of!(Off1, d), offset_of!(Off1, d));
}
}
#[cfg(test)]
#[allow(unused)]
mod macro_checks {
s! {
pub struct S1 {
pub a: u32,
b: u32,
}
struct S1Priv {
pub a: u32,
b: u32,
}
}
s_no_extra_traits! {
pub struct S2 {
pub a: u32,
b: u32,
}
struct S2Priv {
pub a: u32,
b: u32,
}
pub union U2 {
pub a: u32,
b: f32,
}
union U2Priv {
pub a: u32,
b: f32,
}
}
}

6
vendor/libc/src/new/aix/mod.rs vendored Normal file
View File

@@ -0,0 +1,6 @@
//! IBM AIX libc.
//!
//! * Headers are not public
//! * Manual pages: <https://www.ibm.com/docs/en/aix> (under "Technical reference" for that version)
pub(crate) mod unistd;

7
vendor/libc/src/new/aix/unistd.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

View File

@@ -0,0 +1,5 @@
//! Header: `signal.h`
//!
//! <https://github.com/apple-oss-distributions/Libc/blob/main/include/signal.h>
pub use crate::sys::signal::*;

View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

View File

@@ -0,0 +1,20 @@
//! Source from libpthread <https://github.com/apple-oss-distributions/libpthread/tree/main>
/// Directory: `pthread/`
///
/// Note that this module has a trailing underscore to avoid conflicting with its child `pthread`
/// module.
///
/// <https://github.com/apple-oss-distributions/libpthread/tree/main/include/pthread>
pub(crate) mod pthread_ {
pub(crate) mod introspection;
pub(crate) mod pthread;
pub(crate) mod pthread_impl;
pub(crate) mod pthread_spis;
pub(crate) mod qos;
pub(crate) mod sched;
pub(crate) mod spawn;
pub(crate) mod stack_np;
}
pub(crate) mod sys;

View File

@@ -0,0 +1,36 @@
//! Header: `pthread/introspection.h`
//!
//! <https://github.com/apple-oss-distributions/libpthread/blob/main/include/pthread/introspection.h>
use crate::prelude::*;
pub use crate::pthread_::pthread::*;
c_enum! {
#[repr(c_uint)]
pub enum #anon {
pub PTHREAD_INTROSPECTION_THREAD_CREATE = 1,
pub PTHREAD_INTROSPECTION_THREAD_START,
pub PTHREAD_INTROSPECTION_THREAD_TERMINATE,
pub PTHREAD_INTROSPECTION_THREAD_DESTROY,
}
}
pub type pthread_introspection_hook_t =
extern "C" fn(event: c_uint, thread: pthread_t, addr: *mut c_void, size: size_t);
extern "C" {
// Available from Big Sur
pub fn pthread_introspection_hook_install(
hook: pthread_introspection_hook_t,
) -> pthread_introspection_hook_t;
pub fn pthread_introspection_setspecific_np(
thread: pthread_t,
key: pthread_key_t,
value: *const c_void,
) -> c_int;
pub fn pthread_introspection_getspecific_np(
thread: pthread_t,
key: pthread_key_t,
) -> *mut c_void;
}

View File

@@ -0,0 +1,76 @@
//! Header: `pthread.h` or `pthread/pthread.h`
//!
//! <https://github.com/apple-oss-distributions/libpthread/blob/main/include/pthread/pthread.h>
use crate::prelude::*;
pub use crate::pthread_::qos::*;
pub use crate::pthread_::sched::*;
// No need to import from the `_pthread_attr_t` and similar modules since `_pthread_types` has
// everything we need.
pub use crate::sys::_pthread::_pthread_types::*;
pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
pub const PTHREAD_CREATE_DETACHED: c_int = 2;
pub const PTHREAD_INHERIT_SCHED: c_int = 1;
pub const PTHREAD_EXPLICIT_SCHED: c_int = 2;
pub const PTHREAD_CANCEL_ENABLE: c_int = 0x01;
pub const PTHREAD_CANCEL_DISABLE: c_int = 0x00;
pub const PTHREAD_CANCEL_DEFERRED: c_int = 0x02;
pub const PTHREAD_CANCEL_ASYNCHRONOUS: c_int = 0x00;
pub const PTHREAD_CANCELED: *mut c_void = 1 as *mut c_void;
pub const PTHREAD_SCOPE_SYSTEM: c_int = 1;
pub const PTHREAD_SCOPE_PROCESS: c_int = 2;
pub const PTHREAD_PROCESS_SHARED: c_int = 1;
pub const PTHREAD_PROCESS_PRIVATE: c_int = 2;
pub const PTHREAD_PRIO_NONE: c_int = 0;
pub const PTHREAD_PRIO_INHERIT: c_int = 1;
pub const PTHREAD_PRIO_PROTECT: c_int = 2;
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 PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
__sig: _PTHREAD_RWLOCK_SIG_init,
__opaque: [0; __PTHREAD_RWLOCK_SIZE__],
};
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
__sig: _PTHREAD_MUTEX_SIG_init,
__opaque: [0; __PTHREAD_MUTEX_SIZE__],
};
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__sig: _PTHREAD_COND_SIG_init,
__opaque: [0; __PTHREAD_COND_SIZE__],
};
pub const PTHREAD_ONCE_INIT: crate::pthread_once_t = crate::pthread_once_t {
__sig: _PTHREAD_ONCE_SIG_INIT,
__opaque: [0; __PTHREAD_ONCE_SIZE__],
};
pub use crate::new::common::posix::pthread::{
pthread_attr_getinheritsched,
pthread_attr_getschedparam,
pthread_attr_getschedpolicy,
pthread_attr_setinheritsched,
pthread_attr_setschedparam,
pthread_attr_setschedpolicy,
pthread_condattr_getpshared,
pthread_condattr_setpshared,
pthread_getschedparam,
pthread_mutexattr_getpshared,
pthread_mutexattr_setpshared,
pthread_once,
pthread_rwlockattr_getpshared,
pthread_rwlockattr_setpshared,
pthread_setschedparam,
};

View File

@@ -0,0 +1,12 @@
use crate::prelude::*;
// FIXME(apple): these should all be `pub(crate)`
pub const _PTHREAD_MUTEX_SIG_init: c_long = 0x32AAABA7;
pub const _PTHREAD_COND_SIG_init: c_long = 0x3CB0B1BB;
pub(crate) const _PTHREAD_ONCE_SIG_INIT: c_long = 0x30B1BCBA;
pub const _PTHREAD_RWLOCK_SIG_init: c_long = 0x2DA8B3B4;
pub const SCHED_OTHER: c_int = 1;
pub const SCHED_FIFO: c_int = 4;
pub const SCHED_RR: c_int = 2;

View File

@@ -0,0 +1,14 @@
//! Header: `pthread/pthread_spis.h`
//!
//! <https://github.com/apple-oss-distributions/libpthread/blob/main/include/pthread/pthread_spis.h>
use crate::prelude::*;
extern "C" {
pub fn pthread_create_from_mach_thread(
thread: *mut crate::pthread_t,
attr: *const crate::pthread_attr_t,
f: extern "C" fn(*mut c_void) -> *mut c_void,
value: *mut c_void,
) -> c_int;
}

View File

@@ -0,0 +1,25 @@
//! Header: `pthread/qos.h`
//!
//! <https://github.com/apple-oss-distributions/libpthread/blob/main/include/pthread/qos.h>
use crate::prelude::*;
pub use crate::sys::qos::*;
extern "C" {
pub fn pthread_attr_set_qos_class_np(
attr: *mut crate::pthread_attr_t,
class: qos_class_t,
priority: c_int,
) -> c_int;
pub fn pthread_attr_get_qos_class_np(
attr: *mut crate::pthread_attr_t,
class: *mut qos_class_t,
priority: *mut c_int,
) -> c_int;
pub fn pthread_set_qos_class_self_np(class: qos_class_t, priority: c_int) -> c_int;
pub fn pthread_get_qos_class_np(
thread: crate::pthread_t,
class: *mut qos_class_t,
priority: *mut c_int,
) -> c_int;
}

View File

@@ -0,0 +1,9 @@
pub use crate::new::pthread_::pthread_impl::*;
use crate::prelude::*;
s! {
pub struct sched_param {
pub sched_priority: c_int,
__opaque: [c_char; 4],
}
}

View File

@@ -0,0 +1,16 @@
//! Header: `pthread/spawn.h`
//!
//! <https://github.com/apple-oss-distributions/libpthread/blob/main/include/pthread/spawn.h>
use crate::prelude::*;
extern "C" {
pub fn posix_spawnattr_set_qos_class_np(
attr: *mut crate::posix_spawnattr_t,
qos_class: crate::qos_class_t,
) -> c_int;
pub fn posix_spawnattr_get_qos_class_np(
attr: *const crate::posix_spawnattr_t,
qos_class: *mut crate::qos_class_t,
) -> c_int;
}

View File

@@ -0,0 +1,12 @@
//! Header: `pthread/stack_np.h`
//!
//! <https://github.com/apple-oss-distributions/libpthread/blob/main/include/pthread/stack_np.h>
use crate::prelude::*;
extern "C" {
pub fn pthread_stack_frame_decode_np(
frame_addr: uintptr_t,
return_addr: *mut uintptr_t,
) -> uintptr_t;
}

View File

@@ -0,0 +1,79 @@
//! Header: `sys/_pthread/_pthread_types.h`
//!
//! <https://github.com/apple-oss-distributions/libpthread/blob/main/include/sys/_pthread/_pthread_types.h>
//!
//! Note that the actual header defines `_opaque_pthread_*` structs which are typedefed to
//! `__darwin_pthread*` structs, and typedefed again in separate `_pthread_*.h` files to their final
//! `pthread_` name. This isn't useful for us so we simplify a bit and just define everything here.
use crate::prelude::*;
cfg_if! {
if #[cfg(target_pointer_width = "64")] {
pub const __PTHREAD_SIZE__: usize = 8176;
pub const __PTHREAD_ATTR_SIZE__: usize = 56;
pub const __PTHREAD_MUTEXATTR_SIZE__: usize = 8;
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
pub const __PTHREAD_COND_SIZE__: usize = 40;
pub const __PTHREAD_ONCE_SIZE__: usize = 8;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
} else {
pub const __PTHREAD_SIZE__: usize = 4088;
pub const __PTHREAD_ATTR_SIZE__: usize = 36;
pub const __PTHREAD_MUTEXATTR_SIZE__: usize = 8;
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
pub const __PTHREAD_COND_SIZE__: usize = 24;
pub const __PTHREAD_ONCE_SIZE__: usize = 4;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12;
}
}
s! {
pub struct pthread_attr_t {
pub(crate) __sig: c_long,
pub(crate) __opaque: [c_char; __PTHREAD_ATTR_SIZE__],
}
pub struct pthread_cond_t {
pub(crate) __sig: c_long,
pub(crate) __opaque: [u8; __PTHREAD_COND_SIZE__],
}
pub struct pthread_condattr_t {
pub(crate) __sig: c_long,
pub(crate) __opaque: [u8; __PTHREAD_CONDATTR_SIZE__],
}
pub struct pthread_mutex_t {
pub(crate) __sig: c_long,
pub(crate) __opaque: [u8; __PTHREAD_MUTEX_SIZE__],
}
pub struct pthread_mutexattr_t {
pub(crate) __sig: c_long,
pub(crate) __opaque: [u8; __PTHREAD_MUTEXATTR_SIZE__],
}
pub struct pthread_once_t {
pub(crate) __sig: c_long,
pub(crate) __opaque: [c_char; __PTHREAD_ONCE_SIZE__],
}
pub struct pthread_rwlock_t {
pub(crate) __sig: c_long,
pub(crate) __opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
}
pub struct pthread_rwlockattr_t {
pub(crate) __sig: c_long,
pub(crate) __opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
}
}
pub type pthread_key_t = c_ulong;
pub use crate::pthread_t;

View File

@@ -0,0 +1,14 @@
//! Directory: `sys/`
//!
//! <https://github.com/apple-oss-distributions/libpthread/tree/main/include/sys/_pthread>
/// Directory: `sys/_pthread/`
///
/// <https://github.com/apple-oss-distributions/libpthread/tree/main/include/sys>
pub(crate) mod _pthread {
// We don't have the `_pthread_attr_t` and similar modules to match `_pthread_attr_t.h`,
// everything is defined in `_pthread_types`.
pub(crate) mod _pthread_types;
}
pub(crate) mod qos;

View File

@@ -0,0 +1,22 @@
//! Header: `sys/qos.h`
//!
//! <https://github.com/apple-oss-distributions/libpthread/blob/main/include/sys/qos.h>
use crate::prelude::*;
#[derive(Debug)]
#[repr(u32)]
pub enum qos_class_t {
QOS_CLASS_USER_INTERACTIVE = 0x21,
QOS_CLASS_USER_INITIATED = 0x19,
QOS_CLASS_DEFAULT = 0x15,
QOS_CLASS_UTILITY = 0x11,
QOS_CLASS_BACKGROUND = 0x09,
QOS_CLASS_UNSPECIFIED = 0x00,
}
impl Copy for qos_class_t {}
impl Clone for qos_class_t {
fn clone(&self) -> qos_class_t {
*self
}
}

20
vendor/libc/src/new/apple/mod.rs vendored Normal file
View File

@@ -0,0 +1,20 @@
//! Apple interfaces.
//!
//! The Xcode SDK includes interfaces that are split across a couple of different libraries. Most
//! of these are available at <https://github.com/apple-oss-distributions>.
/// Entrypoint for Apple headers, usually found as part of the Xcode SDK.
///
/// <https://github.com/apple-oss-distributions/Libc/tree/main/include>
mod libc {
pub(crate) mod signal;
pub(crate) mod unistd;
}
mod libpthread;
mod xnu;
pub(crate) use libc::*;
pub(crate) use libpthread::pthread_;
pub(crate) use pthread_::pthread;
pub(crate) use xnu::*;

View File

@@ -0,0 +1,15 @@
//! Header: `arm/_mcontext.h`
//!
//! <https://github.com/apple-oss-distributions/xnu/blob/main/bsd/arm/_mcontext.h>
pub use crate::mach::machine::_structs::*;
s! {
pub struct __darwin_mcontext64 {
pub __es: __darwin_arm_exception_state64,
pub __ss: __darwin_arm_thread_state64,
pub __ns: __darwin_arm_neon_state64,
}
}
pub type mcontext_t = *mut __darwin_mcontext64;

View File

@@ -0,0 +1,15 @@
//! Header: `i386/_mcontext.h`
//!
//! <https://github.com/apple-oss-distributions/xnu/blob/main/bsd/i386/_mcontext.h>
pub use crate::mach::machine::_structs::*;
s! {
pub struct __darwin_mcontext64 {
pub __es: __darwin_x86_exception_state64,
pub __ss: __darwin_x86_thread_state64,
pub __fs: __darwin_x86_float_state64,
}
}
pub type mcontext_t = *mut __darwin_mcontext64;

View File

@@ -0,0 +1,37 @@
//! Header: `arm/_structs.h`
//!
//! <https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/mach/arm/_structs.h>
#[cfg(target_arch = "arm")]
use crate::prelude::*;
s! {
pub struct __darwin_arm_exception_state64 {
pub __far: u64,
pub __esr: u32,
pub __exception: u32,
}
pub struct __darwin_arm_thread_state64 {
pub __x: [u64; 29],
pub __fp: u64,
pub __lr: u64,
pub __sp: u64,
pub __pc: u64,
pub __cpsr: u32,
pub __pad: u32,
}
#[cfg(target_arch = "aarch64")]
pub struct __darwin_arm_neon_state64 {
pub __v: [crate::__uint128_t; 32],
pub __fpsr: u32,
pub __fpcr: u32,
}
#[cfg(target_arch = "arm")]
#[repr(align(16))]
pub struct __darwin_arm_neon_state64 {
opaque: [c_char; (32 * 16) + (2 * size_of::<u32>())],
}
}

View File

@@ -0,0 +1,92 @@
//! Header: `i386/_structs.h`
//!
//! <https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/mach/i386/_structs.h>
use crate::prelude::*;
s! {
pub struct __darwin_mmst_reg {
pub __mmst_reg: [c_char; 10],
pub __mmst_rsrv: [c_char; 6],
}
pub struct __darwin_xmm_reg {
pub __xmm_reg: [c_char; 16],
}
pub struct __darwin_x86_thread_state64 {
pub __rax: u64,
pub __rbx: u64,
pub __rcx: u64,
pub __rdx: u64,
pub __rdi: u64,
pub __rsi: u64,
pub __rbp: u64,
pub __rsp: u64,
pub __r8: u64,
pub __r9: u64,
pub __r10: u64,
pub __r11: u64,
pub __r12: u64,
pub __r13: u64,
pub __r14: u64,
pub __r15: u64,
pub __rip: u64,
pub __rflags: u64,
pub __cs: u64,
pub __fs: u64,
pub __gs: u64,
}
pub struct __darwin_x86_exception_state64 {
pub __trapno: u16,
pub __cpu: u16,
pub __err: u32,
pub __faultvaddr: u64,
}
pub struct __darwin_x86_float_state64 {
pub __fpu_reserved: [c_int; 2],
__fpu_fcw: c_short,
__fpu_fsw: c_short,
pub __fpu_ftw: u8,
pub __fpu_rsrv1: u8,
pub __fpu_fop: u16,
pub __fpu_ip: u32,
pub __fpu_cs: u16,
pub __fpu_rsrv2: u16,
pub __fpu_dp: u32,
pub __fpu_ds: u16,
pub __fpu_rsrv3: u16,
pub __fpu_mxcsr: u32,
pub __fpu_mxcsrmask: u32,
pub __fpu_stmm0: __darwin_mmst_reg,
pub __fpu_stmm1: __darwin_mmst_reg,
pub __fpu_stmm2: __darwin_mmst_reg,
pub __fpu_stmm3: __darwin_mmst_reg,
pub __fpu_stmm4: __darwin_mmst_reg,
pub __fpu_stmm5: __darwin_mmst_reg,
pub __fpu_stmm6: __darwin_mmst_reg,
pub __fpu_stmm7: __darwin_mmst_reg,
pub __fpu_xmm0: __darwin_xmm_reg,
pub __fpu_xmm1: __darwin_xmm_reg,
pub __fpu_xmm2: __darwin_xmm_reg,
pub __fpu_xmm3: __darwin_xmm_reg,
pub __fpu_xmm4: __darwin_xmm_reg,
pub __fpu_xmm5: __darwin_xmm_reg,
pub __fpu_xmm6: __darwin_xmm_reg,
pub __fpu_xmm7: __darwin_xmm_reg,
pub __fpu_xmm8: __darwin_xmm_reg,
pub __fpu_xmm9: __darwin_xmm_reg,
pub __fpu_xmm10: __darwin_xmm_reg,
pub __fpu_xmm11: __darwin_xmm_reg,
pub __fpu_xmm12: __darwin_xmm_reg,
pub __fpu_xmm13: __darwin_xmm_reg,
pub __fpu_xmm14: __darwin_xmm_reg,
pub __fpu_xmm15: __darwin_xmm_reg,
// FIXME(apple): this field is actually [u8; 96], but defining it with a bigger type allows
// us to auto-implement traits for it since the length of the array is less than 32
__fpu_rsrv4: [u32; 24],
pub __fpu_reserved1: c_int,
}
}

View File

@@ -0,0 +1,13 @@
//! Header: `mach/machine/_structs.h`
//!
//! <https://github.com/apple-oss-distributions/xnu/blob/main/osfmk/mach/machine/_structs.h>
cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
pub use crate::mach::i386::_structs::*;
} else if #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] {
pub use crate::mach::arm::_structs::*;
} else {
// Unsupported arch
}
}

View File

@@ -0,0 +1,20 @@
//! Directory: `mach/`
//!
//! <https://github.com/apple-oss-distributions/xnu/tree/main/osfmk/mach>
/// Directory: `mach/arm`
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
pub(crate) mod arm {
pub(crate) mod _structs;
}
/// Directory: `mach/i386`
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub(crate) mod i386 {
pub(crate) mod _structs;
}
/// Directory: `mach/machine`
pub(crate) mod machine {
pub(crate) mod _structs;
}

View File

@@ -0,0 +1,11 @@
//! Header: `machine/_mcontext.h`
cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
pub use crate::i386::_mcontext::*;
} else if #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] {
pub use crate::arm::_mcontext::*;
} else {
// Unsupported arch
}
}

30
vendor/libc/src/new/apple/xnu/mod.rs vendored Normal file
View File

@@ -0,0 +1,30 @@
//! Source from XNU <https://github.com/apple-oss-distributions/xnu/tree/main>
//!
//! We omit nesting for the `bsd` module since most items of interest are in there.
/// Directory: `arm/`
///
/// https://github.com/apple-oss-distributions/xnu/tree/main/bsd/arm
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
pub(crate) mod arm {
pub(crate) mod _mcontext;
}
/// Directory: `i386/`
///
/// https://github.com/apple-oss-distributions/xnu/tree/main/bsd/i386
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub(crate) mod i386 {
pub(crate) mod _mcontext;
}
pub(crate) mod mach;
/// Directory: `machine/`
///
/// https://github.com/apple-oss-distributions/xnu/tree/main/bsd/machine
pub(crate) mod machine {
pub(crate) mod _mcontext;
}
pub(crate) mod sys;

View File

@@ -0,0 +1,17 @@
//! Header: `sys/_types/_ucontext.h`
pub use crate::machine::_mcontext::*;
use crate::prelude::*;
s! {
pub struct __darwin_ucontext {
pub uc_onstack: c_int,
pub uc_sigmask: crate::sigset_t,
pub uc_stack: crate::stack_t,
pub uc_link: *mut ucontext_t,
pub uc_mcsize: usize,
pub uc_mcontext: mcontext_t,
}
}
pub type ucontext_t = __darwin_ucontext;

View File

@@ -0,0 +1,15 @@
//! Directory: `sys/`
//!
//! <https://github.com/apple-oss-distributions/xnu/tree/main/bsd/sys>
pub(crate) mod signal;
/// Directory: `sys/_types`
///
/// https://github.com/apple-oss-distributions/xnu/tree/main/bsd/sys/_types
pub(crate) mod _types {
pub(crate) mod _ucontext;
}
// Bit of a hack since the directories get merged and we can't have >1 sys module.
pub(crate) use crate::new::apple::libpthread::sys::*;

View File

@@ -0,0 +1,6 @@
//! Header: `sys/signal.h`
//!
//! <https://github.com/apple-oss-distributions/xnu/blob/main/bsd/sys/signal.h>
pub use crate::machine::_mcontext::*;
pub use crate::sys::_types::_ucontext::*;

View File

@@ -0,0 +1,7 @@
//! This directory maps to `bionic/libc/include` in the Android source.
//!
//! <https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/>
pub(crate) mod pthread;
pub(crate) mod sys;
pub(crate) mod unistd;

View File

@@ -0,0 +1,42 @@
//! Header: `unistd.h`
pub use crate::new::common::linux_like::pthread::{
pthread_getattr_np,
pthread_setname_np,
};
pub use crate::new::common::posix::pthread::{
pthread_atfork,
pthread_attr_getguardsize,
pthread_attr_getinheritsched,
pthread_attr_getstack,
pthread_attr_setguardsize,
pthread_attr_setinheritsched,
pthread_attr_setstack,
pthread_barrier_destroy,
pthread_barrier_init,
pthread_barrier_wait,
pthread_barrierattr_destroy,
pthread_barrierattr_getpshared,
pthread_barrierattr_init,
pthread_barrierattr_setpshared,
pthread_condattr_getclock,
pthread_condattr_getpshared,
pthread_condattr_setclock,
pthread_condattr_setpshared,
pthread_create,
pthread_getcpuclockid,
pthread_getschedparam,
pthread_kill,
pthread_mutex_timedlock,
pthread_mutexattr_getpshared,
pthread_mutexattr_setpshared,
pthread_rwlockattr_getpshared,
pthread_rwlockattr_setpshared,
pthread_setschedparam,
pthread_sigmask,
pthread_spin_destroy,
pthread_spin_init,
pthread_spin_lock,
pthread_spin_trylock,
pthread_spin_unlock,
};

View File

@@ -0,0 +1,3 @@
//! Directory: `sys/`
pub(crate) mod socket;

View File

@@ -0,0 +1,51 @@
//! Header: `sys/socket.h`
use crate::prelude::*;
s! {
pub struct msghdr {
pub msg_name: *mut c_void,
pub msg_namelen: crate::socklen_t,
pub msg_iov: *mut crate::iovec,
pub msg_iovlen: size_t,
pub msg_control: *mut c_void,
pub msg_controllen: size_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 ucred {
pub pid: crate::pid_t,
pub uid: crate::uid_t,
pub gid: crate::gid_t,
}
}
extern "C" {
pub fn recvmmsg(
sockfd: c_int,
msgvec: *mut crate::mmsghdr,
vlen: c_uint,
flags: c_int,
timeout: *const crate::timespec,
) -> c_int;
pub fn sendmmsg(
sockfd: c_int,
msgvec: *const crate::mmsghdr,
vlen: c_uint,
flags: c_int,
) -> c_int;
pub fn recvfrom(
socket: c_int,
buf: *mut c_void,
len: size_t,
flags: c_int,
addr: *mut crate::sockaddr,
addrlen: *mut crate::socklen_t,
) -> ssize_t;
}

View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

1
vendor/libc/src/new/common/bsd.rs vendored Normal file
View File

@@ -0,0 +1 @@
//! Interfaces common across the BSD family.

View File

@@ -0,0 +1 @@
//! Interfaces common in FreeBSD-derived operating systems. This includes FreeBSD and DragonFlyBSD.

View File

@@ -0,0 +1,9 @@
//! API that primarily comes from Linux but is also used other platforms (e.g. Android).
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "l4re",
target_os = "linux"
))]
pub(crate) mod pthread;

View File

@@ -0,0 +1,25 @@
use crate::prelude::*;
extern "C" {
#[cfg(any(target_os = "linux", target_os = "l4re"))]
pub fn pthread_getaffinity_np(
thread: crate::pthread_t,
cpusetsize: size_t,
cpuset: *mut crate::cpu_set_t,
) -> c_int;
pub fn pthread_getattr_np(native: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
#[cfg(target_os = "linux")]
pub fn pthread_getname_np(thread: crate::pthread_t, name: *mut c_char, len: size_t) -> c_int;
#[cfg(any(target_os = "linux", target_os = "l4re"))]
pub fn pthread_setaffinity_np(
thread: crate::pthread_t,
cpusetsize: size_t,
cpuset: *const crate::cpu_set_t,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub fn pthread_setname_np(thread: crate::pthread_t, name: *const c_char) -> c_int;
}

39
vendor/libc/src/new/common/mod.rs vendored Normal file
View File

@@ -0,0 +1,39 @@
//! Interfaces that are common across multiple platforms
//!
//! We make these available everywhere but each platform must opt in to reexporting.
//!
//! There shouldn't be any repeated definitions or complex configuration in this module. On
//! platforms that don't use common APIs it is fine to use `#[cfg(not(...))]`, but if a platform
//! needs a custom definition then it should be defined in the platform-specific module.
//!
//! The goal is that platforms need to opt in to the definitions here, so that worst case we have
//! an unused warning on untested platforms (rather than exposing incorrect API).
#[cfg(any(
target_vendor = "apple",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
))]
pub(crate) mod bsd;
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "l4re",
target_os = "linux",
))]
pub(crate) mod linux_like;
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
pub(crate) mod freebsd_like;
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
pub(crate) mod netbsd_like;
#[cfg(any(target_os = "illumos", target_os = "solaris"))]
pub(crate) mod solarish;
#[cfg(target_family = "unix")]
pub(crate) mod posix;

View File

@@ -0,0 +1 @@
//! Interfaces common in NetBSD-derived operating systems. This includes NetBSD and OpenBSD.

15
vendor/libc/src/new/common/posix/mod.rs vendored Normal file
View File

@@ -0,0 +1,15 @@
//! POSIX APIs that are used by a number of platforms
//!
//! These can be found at: <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/contents.html>.
// FIXME(pthread): eventually all platforms should use this module
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "l4re",
target_os = "linux",
target_os = "qurt",
target_vendor = "apple",
))]
pub(crate) mod pthread;
pub(crate) mod unistd;

View File

@@ -0,0 +1,322 @@
//! Header: `pthread.h`
//!
//! <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html>
use crate::prelude::*;
extern "C" {
#[cfg(any(target_os = "android", target_os = "linux"))]
pub fn pthread_atfork(
prepare: Option<unsafe extern "C" fn()>,
parent: Option<unsafe extern "C" fn()>,
child: Option<unsafe extern "C" fn()>,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_attr_getguardsize(
attr: *const crate::pthread_attr_t,
guardsize: *mut size_t,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "l4re",
target_os = "linux",
target_vendor = "apple",
))]
pub fn pthread_attr_getinheritsched(
attr: *const crate::pthread_attr_t,
inheritsched: *mut c_int,
) -> c_int;
#[cfg(any(target_os = "l4re", target_os = "linux", target_vendor = "apple"))]
pub fn pthread_attr_getschedparam(
attr: *const crate::pthread_attr_t,
param: *mut crate::sched_param,
) -> c_int;
#[cfg(any(target_os = "l4re", target_os = "linux", target_vendor = "apple"))]
pub fn pthread_attr_getschedpolicy(
attr: *const crate::pthread_attr_t,
policy: *mut c_int,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "linux",
target_os = "l4re"
))]
pub fn pthread_attr_getstack(
attr: *const crate::pthread_attr_t,
stackaddr: *mut *mut c_void,
stacksize: *mut size_t,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "l4re",
target_os = "linux",
target_vendor = "apple"
))]
pub fn pthread_attr_setinheritsched(
attr: *mut crate::pthread_attr_t,
inheritsched: c_int,
) -> c_int;
#[cfg(any(target_os = "l4re", target_os = "linux", target_vendor = "apple"))]
pub fn pthread_attr_setschedparam(
attr: *mut crate::pthread_attr_t,
param: *const crate::sched_param,
) -> c_int;
#[cfg(any(target_os = "l4re", target_os = "linux", target_vendor = "apple"))]
pub fn pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "linux",
target_os = "l4re"
))]
pub fn pthread_attr_setstack(
attr: *mut crate::pthread_attr_t,
stackaddr: *mut c_void,
stacksize: size_t,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_barrier_destroy(barrier: *mut crate::pthread_barrier_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_barrier_init(
barrier: *mut crate::pthread_barrier_t,
attr: *const crate::pthread_barrierattr_t,
count: c_uint,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_barrier_wait(barrier: *mut crate::pthread_barrier_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_barrierattr_destroy(attr: *mut crate::pthread_barrierattr_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub fn pthread_barrierattr_getpshared(
attr: *const crate::pthread_barrierattr_t,
shared: *mut c_int,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_barrierattr_init(attr: *mut crate::pthread_barrierattr_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_barrierattr_setpshared(
attr: *mut crate::pthread_barrierattr_t,
shared: c_int,
) -> c_int;
#[cfg(any(target_os = "l4re", all(target_os = "linux", not(target_env = "ohos"))))]
pub fn pthread_cancel(thread: crate::pthread_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))]
pub fn pthread_condattr_getclock(
attr: *const crate::pthread_condattr_t,
clock_id: *mut crate::clockid_t,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "l4re",
target_os = "linux",
target_vendor = "apple",
))]
pub fn pthread_condattr_getpshared(
attr: *const crate::pthread_condattr_t,
pshared: *mut c_int,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))]
pub fn pthread_condattr_setclock(
attr: *mut crate::pthread_condattr_t,
clock_id: crate::clockid_t,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "linux",
target_os = "l4re",
target_vendor = "apple",
))]
pub fn pthread_condattr_setpshared(
attr: *mut crate::pthread_condattr_t,
pshared: c_int,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "l4re",
target_os = "linux",
))]
pub fn pthread_create(
native: *mut crate::pthread_t,
attr: *const crate::pthread_attr_t,
f: extern "C" fn(*mut c_void) -> *mut c_void,
value: *mut c_void,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub fn pthread_getcpuclockid(thread: crate::pthread_t, clk_id: *mut crate::clockid_t) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "l4re",
target_os = "linux",
target_vendor = "apple",
))]
pub fn pthread_getschedparam(
native: crate::pthread_t,
policy: *mut c_int,
param: *mut crate::sched_param,
) -> c_int;
// FIXME(reorg): In recent POSIX versions, this is a signal.h function and not required
// in pthread.
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int;
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
pub fn pthread_mutex_consistent(mutex: *mut crate::pthread_mutex_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
#[cfg_attr(gnu_time_bits64, link_name = "__pthread_mutex_timedlock64")]
#[cfg_attr(musl32_time64, link_name = "__pthread_mutex_timedlock_time64")]
pub fn pthread_mutex_timedlock(
lock: *mut crate::pthread_mutex_t,
abstime: *const crate::timespec,
) -> c_int;
#[cfg(target_os = "linux")]
pub fn pthread_mutexattr_getprotocol(
attr: *const crate::pthread_mutexattr_t,
protocol: *mut c_int,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "l4re",
target_os = "linux",
target_vendor = "apple",
))]
pub fn pthread_mutexattr_getpshared(
attr: *const crate::pthread_mutexattr_t,
pshared: *mut c_int,
) -> c_int;
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
pub fn pthread_mutexattr_getrobust(
attr: *const crate::pthread_mutexattr_t,
robustness: *mut c_int,
) -> c_int;
#[cfg(target_os = "linux")]
pub fn pthread_mutexattr_setprotocol(
attr: *mut crate::pthread_mutexattr_t,
protocol: c_int,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "linux",
target_os = "l4re",
target_vendor = "apple",
))]
pub fn pthread_mutexattr_setpshared(
attr: *mut crate::pthread_mutexattr_t,
pshared: c_int,
) -> c_int;
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
pub fn pthread_mutexattr_setrobust(
attr: *mut crate::pthread_mutexattr_t,
robustness: c_int,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "linux",
target_os = "l4re",
target_vendor = "apple",
))]
pub fn pthread_rwlockattr_getpshared(
attr: *const crate::pthread_rwlockattr_t,
val: *mut c_int,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "linux",
target_os = "l4re",
target_vendor = "apple",
))]
pub fn pthread_rwlockattr_setpshared(
attr: *mut crate::pthread_rwlockattr_t,
val: c_int,
) -> c_int;
// FIXME(1.0): These shoul be combined to the version that takes an optional unsafe function.
#[cfg(any(target_os = "l4re", target_os = "linux"))]
pub fn pthread_once(control: *mut crate::pthread_once_t, routine: extern "C" fn()) -> c_int;
#[cfg(target_vendor = "apple")]
pub fn pthread_once(
once_control: *mut crate::pthread_once_t,
init_routine: Option<unsafe extern "C" fn()>,
) -> c_int;
#[cfg(any(
target_os = "android",
target_os = "l4re",
target_os = "linux",
target_vendor = "apple",
))]
pub fn pthread_setschedparam(
native: crate::pthread_t,
policy: c_int,
param: *const crate::sched_param,
) -> c_int;
#[cfg(target_os = "linux")]
pub fn pthread_setschedprio(native: crate::pthread_t, priority: c_int) -> c_int;
// FIXME(reorg): In recent POSIX versions, this is a signal.h function and not required
// in pthread.
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_sigmask(
how: c_int,
set: *const crate::sigset_t,
oldset: *mut crate::sigset_t,
) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_spin_destroy(lock: *mut crate::pthread_spinlock_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_spin_init(lock: *mut crate::pthread_spinlock_t, pshared: c_int) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_spin_lock(lock: *mut crate::pthread_spinlock_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_spin_trylock(lock: *mut crate::pthread_spinlock_t) -> c_int;
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
pub fn pthread_spin_unlock(lock: *mut crate::pthread_spinlock_t) -> c_int;
}

View File

@@ -0,0 +1,9 @@
//! Header: `unistd.h`
//!
//! <https://pubs.opengroup.org/onlinepubs/007904975/basedefs/unistd.h.html>
use crate::prelude::*;
pub const STDIN_FILENO: c_int = 0;
pub const STDOUT_FILENO: c_int = 1;
pub const STDERR_FILENO: c_int = 2;

View File

@@ -0,0 +1 @@
//! Interfaces common in solaris-derived operating systems. This includes Solaris and Illumos.

5
vendor/libc/src/new/cygwin/mod.rs vendored Normal file
View File

@@ -0,0 +1,5 @@
//! Cygwin libc.
//!
//! * Headers: <https://github.com/cygwin/cygwin/tree/main/winsup/cygwin/include>
pub(crate) mod unistd;

7
vendor/libc/src/new/cygwin/unistd.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

6
vendor/libc/src/new/dragonfly/mod.rs vendored Normal file
View File

@@ -0,0 +1,6 @@
//! DragonFly BSD libc.
//!
//! * Headers: <https://github.com/DragonFlyBSD/DragonFlyBSD>
//! * Manual pages: <https://leaf.dragonflybsd.org/cgi/web-man>
pub(crate) mod unistd;

View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

7
vendor/libc/src/new/emscripten/mod.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
//! Emscripten libc.
//!
//! * Headers: <https://github.com/emscripten-core/emscripten/tree/main/system/lib/libc>
pub(crate) mod pthread;
pub(crate) mod sched;
pub(crate) mod unistd;

View File

@@ -0,0 +1,14 @@
//! Header: `pthread.h`
pub use crate::new::common::linux_like::pthread::pthread_getattr_np;
pub use crate::new::common::posix::pthread::{
pthread_attr_getstack,
pthread_attr_setstack,
pthread_condattr_getclock,
pthread_condattr_setclock,
pthread_condattr_setpshared,
pthread_create,
pthread_mutexattr_setpshared,
pthread_rwlockattr_getpshared,
pthread_rwlockattr_setpshared,
};

38
vendor/libc/src/new/emscripten/sched.rs vendored Normal file
View File

@@ -0,0 +1,38 @@
use crate::prelude::*;
cfg_if! {
if #[cfg(musl_v1_2_3)] {
s! {
struct __c_anon_sched_param__reserved2 {
__reserved1: crate::time_t,
__reserved2: c_long,
}
pub struct sched_param {
pub sched_priority: c_int,
__reserved1: Padding<c_int>,
#[cfg(musl32_time64)]
__reserved2: Padding<[c_long; 4]>,
#[cfg(not(musl32_time64))]
__reserved2: Padding<[__c_anon_sched_param__reserved2; 2]>,
__reserved3: Padding<c_int>,
}
}
} else {
s! {
pub struct sched_param {
pub sched_priority: c_int,
#[deprecated(since = "0.2.173", note = "This field has been removed upstream")]
pub sched_ss_low_priority: c_int,
#[deprecated(since = "0.2.173", note = "This field has been removed upstream")]
pub sched_ss_repl_period: crate::timespec,
#[deprecated(since = "0.2.173", note = "This field has been removed upstream")]
pub sched_ss_init_budget: crate::timespec,
#[deprecated(since = "0.2.173", note = "This field has been removed upstream")]
pub sched_ss_max_repl: c_int,
}
}
}
}

View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

2
vendor/libc/src/new/espidf/mod.rs vendored Normal file
View File

@@ -0,0 +1,2 @@
//! Expressif libc.
// FIXME(espidf): link to headers needed.

6
vendor/libc/src/new/freebsd/mod.rs vendored Normal file
View File

@@ -0,0 +1,6 @@
//! FreeBSD libc.
//!
//! * Headers: <https://github.com/freebsd/freebsd-src/blob/main/sys/riscv/include/ucontext.h>
//! * Symbol map: <https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/Symbol.map>
pub(crate) mod unistd;

7
vendor/libc/src/new/freebsd/unistd.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

4
vendor/libc/src/new/fuchsia/mod.rs vendored Normal file
View File

@@ -0,0 +1,4 @@
//! Fuschia libc.
// FIXME(fuchsia): link to headers needed.
pub(crate) mod unistd;

7
vendor/libc/src/new/fuchsia/unistd.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

31
vendor/libc/src/new/glibc/mod.rs vendored Normal file
View File

@@ -0,0 +1,31 @@
//! GNU libc.
//!
//! * Headers: <https://sourceware.org/git/?p=glibc.git> (official)
//! * Headers: <https://github.com/bminor/glibc> (mirror)
//!
//! This module structure is modeled after glibc's source tree. Its build system selects headers
//! from different locations based on the platform, which we mimic here with reexports.
/// Source directory: `posix/`
///
/// <https://github.com/bminor/glibc/tree/master/posix>
mod posix {
pub(crate) mod unistd;
}
/// Source directory: `sysdeps/`
///
/// <https://github.com/bminor/glibc/tree/master/sysdeps>
mod sysdeps {
// FIXME(pthread): eventually all platforms should use this module
#[cfg(target_os = "linux")]
pub(crate) mod nptl;
pub(crate) mod unix;
}
pub(crate) use posix::*;
// FIXME(pthread): eventually all platforms should use this module
#[cfg(target_os = "linux")]
pub(crate) use sysdeps::nptl::*;
#[cfg(target_os = "linux")]
pub(crate) use sysdeps::unix::linux::*;

View File

@@ -0,0 +1,9 @@
//! Header: `unistd.h`
//!
//! <https://github.com/bminor/glibc/blob/master/posix/unistd.h>
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

View File

@@ -0,0 +1,7 @@
//! Source directory: `sysdeps/nptl/`o
//!
//! Native POSIX threading library.
//!
//! <https://github.com/bminor/glibc/tree/master/sysdeps/nptl>
pub(crate) mod pthread;

View File

@@ -0,0 +1,59 @@
//! Source header: `sysdeps/nptl/pthread.h`
//!
//! <https://github.com/bminor/glibc/blob/master/sysdeps/nptl/pthread.h>
pub use crate::new::common::linux_like::pthread::{
pthread_getaffinity_np,
pthread_getattr_np,
pthread_getname_np,
pthread_setaffinity_np,
pthread_setname_np,
};
pub use crate::new::common::posix::pthread::{
pthread_atfork,
pthread_attr_getguardsize,
pthread_attr_getinheritsched,
pthread_attr_getschedparam,
pthread_attr_getschedpolicy,
pthread_attr_getstack,
pthread_attr_setguardsize,
pthread_attr_setinheritsched,
pthread_attr_setschedparam,
pthread_attr_setschedpolicy,
pthread_attr_setstack,
pthread_barrier_destroy,
pthread_barrier_init,
pthread_barrier_wait,
pthread_barrierattr_destroy,
pthread_barrierattr_getpshared,
pthread_barrierattr_init,
pthread_barrierattr_setpshared,
pthread_cancel,
pthread_condattr_getclock,
pthread_condattr_getpshared,
pthread_condattr_setclock,
pthread_condattr_setpshared,
pthread_create,
pthread_getcpuclockid,
pthread_getschedparam,
pthread_kill,
pthread_mutex_consistent,
pthread_mutex_timedlock,
pthread_mutexattr_getprotocol,
pthread_mutexattr_getpshared,
pthread_mutexattr_getrobust,
pthread_mutexattr_setprotocol,
pthread_mutexattr_setpshared,
pthread_mutexattr_setrobust,
pthread_once,
pthread_rwlockattr_getpshared,
pthread_rwlockattr_setpshared,
pthread_setschedparam,
pthread_setschedprio,
pthread_sigmask,
pthread_spin_destroy,
pthread_spin_init,
pthread_spin_lock,
pthread_spin_trylock,
pthread_spin_unlock,
};

View File

@@ -0,0 +1,10 @@
//! Source directory: `sysdeps/unix/sysv/linux` (the `sysv` is flattened).
//!
//! <https://github.com/bminor/glibc/tree/master/sysdeps/unix/sysv/linux>
/// Directory: `net/`
///
/// Source directory: `sysdeps/unix/sysv/linux/net`
pub(crate) mod net {
pub(crate) mod route;
}

View File

@@ -0,0 +1,30 @@
//! Header: `net/route.h`
//!
//! Source header: `sysdeps/unix/sysv/linux/net/route.h`
//! <https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/net/route.h>
use crate::prelude::*;
s! {
pub struct rtentry {
pub rt_pad1: c_ulong,
pub rt_dst: crate::sockaddr,
pub rt_gateway: crate::sockaddr,
pub rt_genmask: crate::sockaddr,
pub rt_flags: c_ushort,
pub rt_pad2: c_short,
pub rt_pad3: c_ulong,
pub rt_tos: c_uchar,
pub rt_class: c_uchar,
// FIXME(1.0): private padding fields
#[cfg(target_pointer_width = "64")]
pub rt_pad4: [c_short; 3usize],
#[cfg(not(target_pointer_width = "64"))]
pub rt_pad4: c_short,
pub rt_metric: c_short,
pub rt_dev: *mut c_char,
pub rt_mtu: c_ulong,
pub rt_window: c_ulong,
pub rt_irtt: c_ushort,
}
}

View File

@@ -0,0 +1,6 @@
//! Source directory: `sysdeps/unix/`
//!
//! <https://github.com/bminor/glibc/tree/master/sysdeps/unix>
#[cfg(target_os = "linux")]
pub(crate) mod linux;

4
vendor/libc/src/new/haiku/mod.rs vendored Normal file
View File

@@ -0,0 +1,4 @@
//! Haiku OS libc.
// FIXME(haiku): link to headers needed.
pub(crate) mod unistd;

7
vendor/libc/src/new/haiku/unistd.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

3
vendor/libc/src/new/hermit_abi/mod.rs vendored Normal file
View File

@@ -0,0 +1,3 @@
//! Hermit kernel libc.
//!
//! * Headers: <https://github.com/hermit-os/hermit-rs/tree/main/hermit-abi>

2
vendor/libc/src/new/horizon/mod.rs vendored Normal file
View File

@@ -0,0 +1,2 @@
//! Switch libc.
// FIXME(horizon): link to headers or manpages needed.

2
vendor/libc/src/new/hurd/mod.rs vendored Normal file
View File

@@ -0,0 +1,2 @@
//! GNU Hurd libc.
// FIXME(hurd): link to headers needed.

4
vendor/libc/src/new/illumos/mod.rs vendored Normal file
View File

@@ -0,0 +1,4 @@
//! Illumos libc.
// FIXME(illumos): link to headers needed.
pub(crate) mod unistd;

7
vendor/libc/src/new/illumos/unistd.rs vendored Normal file
View File

@@ -0,0 +1,7 @@
//! Header: `unistd.h`
pub use crate::new::common::posix::unistd::{
STDERR_FILENO,
STDIN_FILENO,
STDOUT_FILENO,
};

3
vendor/libc/src/new/l4re/mod.rs vendored Normal file
View File

@@ -0,0 +1,3 @@
//! L4re.
//!
//! * Headers: <https://github.com/kernkonzept/l4re-core/tree/master/libc/uclibc-ng>

View File

@@ -0,0 +1,134 @@
//! Header: `uapi/linux/can.h`
pub(crate) mod bcm;
pub(crate) mod error;
pub(crate) mod j1939;
pub(crate) mod raw;
use crate::prelude::*;
pub const CAN_EFF_FLAG: canid_t = 0x80000000;
pub const CAN_RTR_FLAG: canid_t = 0x40000000;
pub const CAN_ERR_FLAG: canid_t = 0x20000000;
pub const CAN_SFF_MASK: canid_t = 0x000007FF;
pub const CAN_EFF_MASK: canid_t = 0x1FFFFFFF;
pub const CAN_ERR_MASK: canid_t = 0x1FFFFFFF;
pub const CANXL_PRIO_MASK: crate::canid_t = CAN_SFF_MASK;
pub type canid_t = u32;
pub const CAN_SFF_ID_BITS: c_int = 11;
pub const CAN_EFF_ID_BITS: c_int = 29;
pub const CANXL_PRIO_BITS: c_int = CAN_SFF_ID_BITS;
pub type can_err_mask_t = u32;
pub const CAN_MAX_DLC: c_int = 8;
pub const CAN_MAX_DLEN: usize = 8;
pub const CANFD_MAX_DLC: c_int = 15;
pub const CANFD_MAX_DLEN: usize = 64;
pub const CANXL_MIN_DLC: c_int = 0;
pub const CANXL_MAX_DLC: c_int = 2047;
pub const CANXL_MAX_DLC_MASK: c_int = 0x07FF;
pub const CANXL_MIN_DLEN: usize = 1;
pub const CANXL_MAX_DLEN: usize = 2048;
s! {
#[repr(align(8))]
pub struct can_frame {
pub can_id: canid_t,
// FIXME(1.0): this field was renamed to `len` in Linux 5.11
pub can_dlc: u8,
__pad: Padding<u8>,
__res0: u8,
pub len8_dlc: u8,
pub data: [u8; CAN_MAX_DLEN],
}
}
pub const CANFD_BRS: c_int = 0x01;
pub const CANFD_ESI: c_int = 0x02;
pub const CANFD_FDF: c_int = 0x04;
s! {
#[repr(align(8))]
pub struct canfd_frame {
pub can_id: canid_t,
pub len: u8,
pub flags: u8,
__res0: u8,
__res1: u8,
pub data: [u8; CANFD_MAX_DLEN],
}
}
pub const CANXL_XLF: c_int = 0x80;
pub const CANXL_SEC: c_int = 0x01;
s! {
pub struct canxl_frame {
pub prio: canid_t,
pub flags: u8,
pub sdt: u8,
pub len: u16,
pub af: u32,
pub data: [u8; CANXL_MAX_DLEN],
}
}
pub const CAN_MTU: usize = size_of::<can_frame>();
pub const CANFD_MTU: usize = size_of::<canfd_frame>();
pub const CANXL_MTU: usize = size_of::<canxl_frame>();
// FIXME(offset_of): use `core::mem::offset_of!` once that is available
// https://github.com/rust-lang/rfcs/pull/3308
// pub const CANXL_HDR_SIZE: usize = core::mem::offset_of!(canxl_frame, data);
pub const CANXL_HDR_SIZE: usize = 12;
pub const CANXL_MIN_MTU: usize = CANXL_HDR_SIZE + 64;
pub const CANXL_MAX_MTU: usize = CANXL_MTU;
pub const CAN_RAW: c_int = 1;
pub const CAN_BCM: c_int = 2;
pub const CAN_TP16: c_int = 3;
pub const CAN_TP20: c_int = 4;
pub const CAN_MCNET: c_int = 5;
pub const CAN_ISOTP: c_int = 6;
pub const CAN_J1939: c_int = 7;
pub const CAN_NPROTO: c_int = 8;
pub const SOL_CAN_BASE: c_int = 100;
s_no_extra_traits! {
pub struct sockaddr_can {
pub can_family: crate::sa_family_t,
pub can_ifindex: c_int,
pub can_addr: __c_anonymous_sockaddr_can_can_addr,
}
pub union __c_anonymous_sockaddr_can_can_addr {
pub tp: __c_anonymous_sockaddr_can_tp,
pub j1939: __c_anonymous_sockaddr_can_j1939,
}
}
s! {
pub struct __c_anonymous_sockaddr_can_tp {
pub rx_id: canid_t,
pub tx_id: canid_t,
}
pub struct __c_anonymous_sockaddr_can_j1939 {
pub name: u64,
pub pgn: u32,
pub addr: u8,
}
pub struct can_filter {
pub can_id: canid_t,
pub can_mask: canid_t,
}
}
pub const CAN_INV_FILTER: canid_t = 0x20000000;

View File

@@ -0,0 +1,52 @@
//! Header: `linux/can/bcm.h`
pub use crate::linux::can::*;
s! {
pub struct bcm_timeval {
pub tv_sec: c_long,
pub tv_usec: c_long,
}
pub struct bcm_msg_head {
pub opcode: u32,
pub flags: u32,
pub count: u32,
pub ival1: bcm_timeval,
pub ival2: bcm_timeval,
pub can_id: canid_t,
pub nframes: u32,
pub frames: [can_frame; 0],
}
}
c_enum! {
#[repr(u32)]
pub enum #anon {
pub TX_SETUP = 1,
pub TX_DELETE,
pub TX_READ,
pub TX_SEND,
pub RX_SETUP,
pub RX_DELETE,
pub RX_READ,
pub TX_STATUS,
pub TX_EXPIRED,
pub RX_STATUS,
pub RX_TIMEOUT,
pub RX_CHANGED,
}
}
pub const SETTIMER: u32 = 0x0001;
pub const STARTTIMER: u32 = 0x0002;
pub const TX_COUNTEVT: u32 = 0x0004;
pub const TX_ANNOUNCE: u32 = 0x0008;
pub const TX_CP_CAN_ID: u32 = 0x0010;
pub const RX_FILTER_ID: u32 = 0x0020;
pub const RX_CHECK_DLC: u32 = 0x0040;
pub const RX_NO_AUTOTIMER: u32 = 0x0080;
pub const RX_ANNOUNCE_RESUME: u32 = 0x0100;
pub const TX_RESET_MULTI_IDX: u32 = 0x0200;
pub const RX_RTR_FRAME: u32 = 0x0400;
pub const CAN_FD_FRAME: u32 = 0x0800;

View File

@@ -0,0 +1,73 @@
//! Header: `linux/can/error.h`
pub use crate::linux::can::*;
pub const CAN_ERR_DLC: c_int = 8;
pub const CAN_ERR_TX_TIMEOUT: c_uint = 0x00000001;
pub const CAN_ERR_LOSTARB: c_uint = 0x00000002;
pub const CAN_ERR_CRTL: c_uint = 0x00000004;
pub const CAN_ERR_PROT: c_uint = 0x00000008;
pub const CAN_ERR_TRX: c_uint = 0x00000010;
pub const CAN_ERR_ACK: c_uint = 0x00000020;
pub const CAN_ERR_BUSOFF: c_uint = 0x00000040;
pub const CAN_ERR_BUSERROR: c_uint = 0x00000080;
pub const CAN_ERR_RESTARTED: c_uint = 0x00000100;
pub const CAN_ERR_CNT: c_uint = 0x00000200;
pub const CAN_ERR_LOSTARB_UNSPEC: c_int = 0x00;
pub const CAN_ERR_CRTL_UNSPEC: c_int = 0x00;
pub const CAN_ERR_CRTL_RX_OVERFLOW: c_int = 0x01;
pub const CAN_ERR_CRTL_TX_OVERFLOW: c_int = 0x02;
pub const CAN_ERR_CRTL_RX_WARNING: c_int = 0x04;
pub const CAN_ERR_CRTL_TX_WARNING: c_int = 0x08;
pub const CAN_ERR_CRTL_RX_PASSIVE: c_int = 0x10;
pub const CAN_ERR_CRTL_TX_PASSIVE: c_int = 0x20;
pub const CAN_ERR_CRTL_ACTIVE: c_int = 0x40;
pub const CAN_ERR_PROT_UNSPEC: c_int = 0x00;
pub const CAN_ERR_PROT_BIT: c_int = 0x01;
pub const CAN_ERR_PROT_FORM: c_int = 0x02;
pub const CAN_ERR_PROT_STUFF: c_int = 0x04;
pub const CAN_ERR_PROT_BIT0: c_int = 0x08;
pub const CAN_ERR_PROT_BIT1: c_int = 0x10;
pub const CAN_ERR_PROT_OVERLOAD: c_int = 0x20;
pub const CAN_ERR_PROT_ACTIVE: c_int = 0x40;
pub const CAN_ERR_PROT_TX: c_int = 0x80;
pub const CAN_ERR_PROT_LOC_UNSPEC: c_int = 0x00;
pub const CAN_ERR_PROT_LOC_SOF: c_int = 0x03;
pub const CAN_ERR_PROT_LOC_ID28_21: c_int = 0x02;
pub const CAN_ERR_PROT_LOC_ID20_18: c_int = 0x06;
pub const CAN_ERR_PROT_LOC_SRTR: c_int = 0x04;
pub const CAN_ERR_PROT_LOC_IDE: c_int = 0x05;
pub const CAN_ERR_PROT_LOC_ID17_13: c_int = 0x07;
pub const CAN_ERR_PROT_LOC_ID12_05: c_int = 0x0F;
pub const CAN_ERR_PROT_LOC_ID04_00: c_int = 0x0E;
pub const CAN_ERR_PROT_LOC_RTR: c_int = 0x0C;
pub const CAN_ERR_PROT_LOC_RES1: c_int = 0x0D;
pub const CAN_ERR_PROT_LOC_RES0: c_int = 0x09;
pub const CAN_ERR_PROT_LOC_DLC: c_int = 0x0B;
pub const CAN_ERR_PROT_LOC_DATA: c_int = 0x0A;
pub const CAN_ERR_PROT_LOC_CRC_SEQ: c_int = 0x08;
pub const CAN_ERR_PROT_LOC_CRC_DEL: c_int = 0x18;
pub const CAN_ERR_PROT_LOC_ACK: c_int = 0x19;
pub const CAN_ERR_PROT_LOC_ACK_DEL: c_int = 0x1B;
pub const CAN_ERR_PROT_LOC_EOF: c_int = 0x1A;
pub const CAN_ERR_PROT_LOC_INTERM: c_int = 0x12;
pub const CAN_ERR_TRX_UNSPEC: c_int = 0x00;
pub const CAN_ERR_TRX_CANH_NO_WIRE: c_int = 0x04;
pub const CAN_ERR_TRX_CANH_SHORT_TO_BAT: c_int = 0x05;
pub const CAN_ERR_TRX_CANH_SHORT_TO_VCC: c_int = 0x06;
pub const CAN_ERR_TRX_CANH_SHORT_TO_GND: c_int = 0x07;
pub const CAN_ERR_TRX_CANL_NO_WIRE: c_int = 0x40;
pub const CAN_ERR_TRX_CANL_SHORT_TO_BAT: c_int = 0x50;
pub const CAN_ERR_TRX_CANL_SHORT_TO_VCC: c_int = 0x60;
pub const CAN_ERR_TRX_CANL_SHORT_TO_GND: c_int = 0x70;
pub const CAN_ERR_TRX_CANL_SHORT_TO_CANH: c_int = 0x80;
pub const CAN_ERROR_WARNING_THRESHOLD: c_int = 96;
pub const CAN_ERROR_PASSIVE_THRESHOLD: c_int = 128;
pub const CAN_BUS_OFF_THRESHOLD: c_int = 256;

View File

@@ -0,0 +1,60 @@
//! `linux/can/j1939.h`
pub use crate::linux::can::*;
pub const J1939_MAX_UNICAST_ADDR: c_uchar = 0xfd;
pub const J1939_IDLE_ADDR: c_uchar = 0xfe;
pub const J1939_NO_ADDR: c_uchar = 0xff;
pub const J1939_NO_NAME: c_ulong = 0;
pub const J1939_PGN_REQUEST: c_uint = 0x0ea00;
pub const J1939_PGN_ADDRESS_CLAIMED: c_uint = 0x0ee00;
pub const J1939_PGN_ADDRESS_COMMANDED: c_uint = 0x0fed8;
pub const J1939_PGN_PDU1_MAX: c_uint = 0x3ff00;
pub const J1939_PGN_MAX: c_uint = 0x3ffff;
pub const J1939_NO_PGN: c_uint = 0x40000;
pub type pgn_t = u32;
pub type priority_t = u8;
pub type name_t = u64;
pub const SOL_CAN_J1939: c_int = SOL_CAN_BASE + CAN_J1939;
// FIXME(cleanup): these could use c_enum if it can accept anonymous enums.
pub const SO_J1939_FILTER: c_int = 1;
pub const SO_J1939_PROMISC: c_int = 2;
pub const SO_J1939_SEND_PRIO: c_int = 3;
pub const SO_J1939_ERRQUEUE: c_int = 4;
pub const SCM_J1939_DEST_ADDR: c_int = 1;
pub const SCM_J1939_DEST_NAME: c_int = 2;
pub const SCM_J1939_PRIO: c_int = 3;
pub const SCM_J1939_ERRQUEUE: c_int = 4;
pub const J1939_NLA_PAD: c_int = 0;
pub const J1939_NLA_BYTES_ACKED: c_int = 1;
pub const J1939_NLA_TOTAL_SIZE: c_int = 2;
pub const J1939_NLA_PGN: c_int = 3;
pub const J1939_NLA_SRC_NAME: c_int = 4;
pub const J1939_NLA_DEST_NAME: c_int = 5;
pub const J1939_NLA_SRC_ADDR: c_int = 6;
pub const J1939_NLA_DEST_ADDR: c_int = 7;
pub const J1939_EE_INFO_NONE: c_int = 0;
pub const J1939_EE_INFO_TX_ABORT: c_int = 1;
pub const J1939_EE_INFO_RX_RTS: c_int = 2;
pub const J1939_EE_INFO_RX_DPO: c_int = 3;
pub const J1939_EE_INFO_RX_ABORT: c_int = 4;
s! {
pub struct j1939_filter {
pub name: name_t,
pub name_mask: name_t,
pub pgn: pgn_t,
pub pgn_mask: pgn_t,
pub addr: u8,
pub addr_mask: u8,
}
}
pub const J1939_FILTER_MAX: c_int = 512;

View File

@@ -0,0 +1,15 @@
//! Header: `linux/can/raw.h`
pub use crate::linux::can::*;
pub const SOL_CAN_RAW: c_int = SOL_CAN_BASE + CAN_RAW;
pub const CAN_RAW_FILTER_MAX: c_int = 512;
// FIXME(cleanup): use `c_enum!`, which needs to be adapted to allow omitting a type.
pub const CAN_RAW_FILTER: c_int = 1;
pub const CAN_RAW_ERR_FILTER: c_int = 2;
pub const CAN_RAW_LOOPBACK: c_int = 3;
pub const CAN_RAW_RECV_OWN_MSGS: c_int = 4;
pub const CAN_RAW_FD_FRAMES: c_int = 5;
pub const CAN_RAW_JOIN_FILTERS: c_int = 6;
pub const CAN_RAW_XL_FRAMES: c_int = 7;

View File

@@ -0,0 +1,69 @@
//! Header: `linux/keyctl.h`
pub const KEY_SPEC_THREAD_KEYRING: i32 = -1;
pub const KEY_SPEC_PROCESS_KEYRING: i32 = -2;
pub const KEY_SPEC_SESSION_KEYRING: i32 = -3;
pub const KEY_SPEC_USER_KEYRING: i32 = -4;
pub const KEY_SPEC_USER_SESSION_KEYRING: i32 = -5;
pub const KEY_SPEC_GROUP_KEYRING: i32 = -6;
pub const KEY_SPEC_REQKEY_AUTH_KEY: i32 = -7;
pub const KEY_SPEC_REQUESTOR_KEYRING: i32 = -8;
pub const KEY_REQKEY_DEFL_NO_CHANGE: i32 = -1;
pub const KEY_REQKEY_DEFL_DEFAULT: i32 = 0;
pub const KEY_REQKEY_DEFL_THREAD_KEYRING: i32 = 1;
pub const KEY_REQKEY_DEFL_PROCESS_KEYRING: i32 = 2;
pub const KEY_REQKEY_DEFL_SESSION_KEYRING: i32 = 3;
pub const KEY_REQKEY_DEFL_USER_KEYRING: i32 = 4;
pub const KEY_REQKEY_DEFL_USER_SESSION_KEYRING: i32 = 5;
pub const KEY_REQKEY_DEFL_GROUP_KEYRING: i32 = 6;
pub const KEY_REQKEY_DEFL_REQUESTOR_KEYRING: i32 = 7;
pub const KEYCTL_GET_KEYRING_ID: u32 = 0;
pub const KEYCTL_JOIN_SESSION_KEYRING: u32 = 1;
pub const KEYCTL_UPDATE: u32 = 2;
pub const KEYCTL_REVOKE: u32 = 3;
pub const KEYCTL_CHOWN: u32 = 4;
pub const KEYCTL_SETPERM: u32 = 5;
pub const KEYCTL_DESCRIBE: u32 = 6;
pub const KEYCTL_CLEAR: u32 = 7;
pub const KEYCTL_LINK: u32 = 8;
pub const KEYCTL_UNLINK: u32 = 9;
pub const KEYCTL_SEARCH: u32 = 10;
pub const KEYCTL_READ: u32 = 11;
pub const KEYCTL_INSTANTIATE: u32 = 12;
pub const KEYCTL_NEGATE: u32 = 13;
pub const KEYCTL_SET_REQKEY_KEYRING: u32 = 14;
pub const KEYCTL_SET_TIMEOUT: u32 = 15;
pub const KEYCTL_ASSUME_AUTHORITY: u32 = 16;
pub const KEYCTL_GET_SECURITY: u32 = 17;
pub const KEYCTL_SESSION_TO_PARENT: u32 = 18;
pub const KEYCTL_REJECT: u32 = 19;
pub const KEYCTL_INSTANTIATE_IOV: u32 = 20;
pub const KEYCTL_INVALIDATE: u32 = 21;
pub const KEYCTL_GET_PERSISTENT: u32 = 22;
pub const KEYCTL_DH_COMPUTE: u32 = 23;
pub const KEYCTL_PKEY_QUERY: u32 = 24;
pub const KEYCTL_PKEY_ENCRYPT: u32 = 25;
pub const KEYCTL_PKEY_DECRYPT: u32 = 26;
pub const KEYCTL_PKEY_SIGN: u32 = 27;
pub const KEYCTL_PKEY_VERIFY: u32 = 28;
pub const KEYCTL_RESTRICT_KEYRING: u32 = 29;
pub const KEYCTL_MOVE: u32 = 30;
pub const KEYCTL_CAPABILITIES: u32 = 31;
pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01;
pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02;
pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04;
pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08;
pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01;
pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02;
pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04;
pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08;
pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10;
pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20;
pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40;
pub const KEYCTL_CAPS0_MOVE: u32 = 0x80;
pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01;
pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02;

View File

@@ -0,0 +1,20 @@
//! Header: `uapi/linux/membarrier.h`
use crate::prelude::*;
c_enum! {
// FIXME(1.0): incorrect repr signedness, this should be removed in a breaking change.
#[repr(c_int)]
pub enum membarrier_cmd {
pub MEMBARRIER_CMD_QUERY = 0,
pub MEMBARRIER_CMD_GLOBAL = 1 << 0,
pub MEMBARRIER_CMD_GLOBAL_EXPEDITED = 1 << 1,
pub MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = 1 << 2,
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED = 1 << 3,
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = 1 << 4,
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = 1 << 5,
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = 1 << 6,
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ = 1 << 7,
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ = 1 << 8,
}
}

View File

@@ -0,0 +1,9 @@
//! Directory: `linux/`
//!
//! <https://github.com/torvalds/linux/tree/master/include/uapi/linux>
pub(crate) mod can;
pub(crate) mod keyctl;
pub(crate) mod membarrier;
pub(crate) mod netlink;
pub(crate) mod pidfd;

Some files were not shown because too many files have changed in this diff Show More