Commit graph

6027 commits

Author SHA1 Message Date
Daniil Belov 141a890b76 handle c circular dependence (linux gnu) 2022-11-16 18:26:11 +03:00
bors bbf929d2c8 Auto merge of #3000 - bjorn3:report_rustc_version_errors, r=JohnTitor
Report the actual error when failing to get the rustc version

This should help with pinpointing the issue in rust-lang/crater#663.
2022-11-12 05:44:54 +00:00
bjorn3 40c19428ce Report the actual error when failing to get the rustc version
This should help with pinpointing the issue in rust-lang/crater#663.
2022-11-11 09:55:43 +00:00
bors 8b6bfd7d9f Auto merge of #2992 - devnexen:fbsd_procctl_upd, r=JohnTitor
freebsd procctl flags update
2022-11-10 11:38:33 +00:00
bors 3daacc5579 Auto merge of #2991 - SteveLauC:extattr_list_xx-on-NetBSD, r=JohnTitor
add extattr_list_xxx() on NetBSD

Corresponds to [this](ac36f3f9fe/sys/sys/extattr.h (L98-L103)):
```c
ssize_t	extattr_list_fd(int _fd, int _attrnamespace, void *_data,
	    size_t _nbytes);
ssize_t	extattr_list_file(const char *_path, int _attrnamespace, void *_data,
	    size_t _nbytes);
ssize_t	extattr_list_link(const char *_path, int _attrnamespace, void *_data,
	    size_t _nbytes);
```
2022-11-07 22:58:13 +00:00
David CARLIER f2a18e59d8 freebsd procctl flags update 2022-11-07 21:48:32 +00:00
bors 0acc5c05f9 Auto merge of #2984 - spencercw:android-uinput, r=JohnTitor
Add Android uinput bindings

This is mostly copied from the Linux bindings.
2022-11-07 21:46:31 +00:00
Chris Spencer 6dbe4881a6 Add Android uinput bindings 2022-11-07 10:19:09 +00:00
bors e92b4fb005 Auto merge of #2993 - zhaixiaojuan:LA-add-ucontext-clone_args, r=JohnTitor
Add ucontext and clone_args for loongarch64
2022-11-06 04:05:39 +00:00
zhaixiaojuan 7066c3c407 Add ucontext and clone_args for loongarch64 2022-11-05 18:37:20 +08:00
bors c206b79eb1 Auto merge of #2989 - JohnTitor:older-emulator, r=JohnTitor
Use an old emulator to fix Android CI

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-04 13:25:28 +00:00
Yuki Okushi 8a618d0a24
CI: Revive some Android targets
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-04 19:44:22 +09:00
Yuki Okushi fa96301d30
CI: Use an old nightly for all Android targets
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-04 19:44:22 +09:00
Yuki Okushi d669d3c9ea
Use an older Android emulator
Newer emulator versions fail to create an AVD correctly.
Use an old Android emulator until we figure out why.

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-04 18:46:49 +09:00
Steve Lau 5763a0fd16 add extattr_list_xxx() on NetBSD 2022-11-03 20:30:50 +08:00
bors f7e6930ae8 Auto merge of #2988 - SteveLauC:XATTR-constants-on-NetBSD, r=JohnTitor
add extended attributes constants on NetBSD

Add three EA-related constants on NetBSD:
1. [XATTR_CREATE](ac36f3f9fe/sys/sys/xattr.h (L54))
2. [XATTR_REPLACE](ac36f3f9fe/sys/sys/xattr.h (L55))
3. [EXTATTR_NAMESPACE_EMPTY](ac36f3f9fe/sys/sys/extattr.h (L44))

And include `sys/xattr.h` in the test.
2022-11-03 11:20:42 +00:00
bors 1ca1c4167a Auto merge of #2914 - SteveLauC:Wrong-getpwent_r-definition-on-solarish-os, r=JohnTitor
fix wrong definitions of getpwent_r and getgrent_r on solarish os

Closes #2908

* [man page for `getpwent_r`](https://illumos.org/man/3C/getpwnam)
* [man page for `getgrent_r`](https://illumos.org/man/3C/getgrnam)

You may find the definitions for `getpwnam_r/getpwuid_r/getgrnam_r/getgruid_r` exposed by `libc` are also wrong:
```c
struct passwd *getpwnam_r(const char *name, struct passwd *pwd,
            char *buffer, int buflen);
```
```rust
pub fn getpwnam_r(
    name: *const ::c_char,
    pwd: *mut passwd,
    buf: *mut ::c_cha
    buflen: ::size_t,
    result: *mut *mut passwd,
) -> ::c_int;
```
But actually they are **correct** as there are the POSIX-conforming definitions (see `Standard conforming` section of above man pages):
```
Standard conforming

       cc [ flag...] file... -D_POSIX_PTHREAD_SEMANTICS [ library... ]

       int getpwnam_r(const char *name, struct passwd *pwd, char *buffer,
            size_t bufsize, struct passwd **result);

       int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
            size_t bufsize, struct passwd **result);
```

`getpwent_r/getgrent_r` don't get lucky, they do not have the POSIX-conforming alternatives.

To double check this, I searched its [source code](https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/gen/getpwnam_r.c):
```shell
$ rg "__posix_getpwnam_r"
port/mapfile-vers
1582:   __posix_getpwnam_r;

port/gen/getpwnam_r.c
152:__posix_getpwnam_r(const char *name, struct passwd *pwd, char *buffer,

$ rg "__posix_getpwent_r"

$
```
2022-11-03 09:19:58 +00:00
bors 875f3a69b1 Auto merge of #2990 - JohnTitor:revive-x86_64-android, r=JohnTitor
Revive `x86_64-linux-android` CI with an old nightly

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-03 08:04:02 +00:00
Yuki Okushi eddc5a3fb9
Revive x86_64-linux-android CI with an old nightly
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-03 16:59:06 +09:00
Steve Lau 1422cee067 add extended attributes constants on NetBSD 2022-11-02 17:05:31 +08:00
bors 301790eecd Auto merge of #2986 - dtolnay-contrib:ficlone, r=JohnTitor
Add FICLONE ioctl for linux aarch64

The ioctl number is the same on aarch64 as on x86_64:

- https://github.com/sunfishcode/linux-raw-sys/blob/v0.1.2/src/aarch64/ioctl.rs#L215-L216
- https://github.com/sunfishcode/linux-raw-sys/blob/v0.1.2/src/x86_64/ioctl.rs#L215-L216
2022-11-01 09:26:02 +00:00
bors a2b0b4fea3 Auto merge of #2985 - flba-eb:fix_s_macro_order, r=JohnTitor
Enforce order of any `s_*!` macro calls

Before this change, only the order of `s!` was checked. After, it also checks `s_no_extra_traits!` and `s_paren!`. Only the order is checked, not the number of calls. This is required because multiple calls have to be allowed.
2022-11-01 08:22:25 +00:00
David Tolnay 9857684717
Add FICLONE ioctl for linux aarch64 2022-10-31 15:34:21 -07:00
Florian Bartels 60b655df91 fix: Order of all s_*! macro calls 2022-10-28 10:18:50 +02:00
Florian Bartels 31693b7e87 style: Enforce order of any s_*! macro call
Before this change, only the order of `s!` was checked.
After, it also checks `s_no_extra_traits!` and `s_paren!`.
Only the order is checked, not the number of calls. This is
required because multiple calls have to be allowed.
2022-10-28 10:18:13 +02:00
bors 7d615f03bc Auto merge of #2983 - HarveyHunt:posix-spawn-setsid, r=JohnTitor
linux: Add POSIX_SPAWN_SETSID flag

This flag allows the child process created by POSIX spawn to create a new session and become leader of a new process group. Expose the flag so that Rust code can use it.
2022-10-27 23:39:02 +00:00
bors 7665a001ab Auto merge of #2981 - giraffate:fix_readfs_typo, r=JohnTitor
Fix typo: `readfs` -> `readfds`

Close https://github.com/rust-lang/libc/issues/2976

I ran tests on local machine but got errors below. I don't know why tests fails.
```
bad ucontext_t size: rust: 880 (0x370) != c 56 (0x38)
bad ucontext_t align: rust: 16 (0x10) != c 8 (0x8)
size of ucontext_t is 56 in C and 880 in Rust
thread 'main' panicked at 'some tests failed', /Users/myname/workspace/libc/target/debug/build/libc-test-1b4df5976a273bfc/out/main.rs:12:21
```
```
$ rustc -Vv
rustc 1.66.0-nightly (758f19645 2022-10-24)
binary: rustc
commit-hash: 758f19645b8ebce61ea52d1f6672fd057bc8dbee
commit-date: 2022-10-24
host: aarch64-apple-darwin
release: 1.66.0-nightly
LLVM version: 15.0.2
```
<details>
<summary> stack backtrace </summary>

```
stack backtrace:
   0:        0x102f392b4 - std::backtrace_rs::backtrace::libunwind::trace::hb45dd82402f85371
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:        0x102f392b4 - std::backtrace_rs::backtrace::trace_unsynchronized::hb6314efd15a1cdb0
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x102f392b4 - std::sys_common::backtrace::_print_fmt::hbc3029e9c7f0094c
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/sys_common/backtrace.rs:65:5
   3:        0x102f392b4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h219904be8a0e6c56
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/sys_common/backtrace.rs:44:22
   4:        0x102f4b62c - core::fmt::write::h1711bce7b2e42a37
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/core/src/fmt/mod.rs:1209:17
   5:        0x102f37254 - std::io::Write::write_fmt::h9cf243ceda7034b8
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/io/mod.rs:1682:15
   6:        0x102f390c8 - std::sys_common::backtrace::_print::hcd849925c35ec037
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/sys_common/backtrace.rs:47:5
   7:        0x102f390c8 - std::sys_common::backtrace::print::h9f5af8da6bcbab74
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/sys_common/backtrace.rs:34:9
   8:        0x102f3a71c - std::panicking::default_hook::{{closure}}::h7e38f960005ec69f
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:267:22
   9:        0x102f3a474 - std::panicking::default_hook::h5bc0affc728d538b
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:286:9
  10:        0x102f3ad58 - std::panicking::rust_panic_with_hook::hb7352d7c8f6738ff
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:688:13
  11:        0x102c8336c - std::panicking::begin_panic::{{closure}}::h81e24e4a3543057e
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:608:9
  12:        0x102c85aac - std::sys_common::backtrace::__rust_end_short_backtrace::haeb635e8d195e522
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/sys_common/backtrace.rs:137:18
  13:        0x102f4fb94 - std::panicking::begin_panic::hc63eb31a9240a068
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:607:12
  14:        0x102c86af8 - main::main::h872896812663328d
                               at /Users/tnakata/workspace/libc/target/debug/build/libc-test-1b4df5976a273bfc/out/main.rs:12:21
  15:        0x102c86544 - core::ops::function::FnOnce::call_once::h891dded55cc8b366
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/core/src/ops/function.rs:251:5
  16:        0x102c85ad4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h5d1fda9212741b5d
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/sys_common/backtrace.rs:121:18
  17:        0x102c86a20 - std::rt::lang_start::{{closure}}::h953204f58c88d781
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/rt.rs:166:18
  18:        0x102f349a4 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h06b2755fd27a42e4
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/core/src/ops/function.rs:286:13
  19:        0x102f349a4 - std::panicking::try::do_call::ha3fd55a85d791079
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:483:40
  20:        0x102f349a4 - std::panicking::try::h279ae5c13bad45ff
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:447:19
  21:        0x102f349a4 - std::panic::catch_unwind::hf6bd4d48ebbd456c
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panic.rs:137:14
  22:        0x102f349a4 - std::rt::lang_start_internal::{{closure}}::hf67a01955ae84819
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/rt.rs:148:48
  23:        0x102f349a4 - std::panicking::try::do_call::h8d0cfe012ebca5fa
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:483:40
  24:        0x102f349a4 - std::panicking::try::hd865d4429d157279
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panicking.rs:447:19
  25:        0x102f349a4 - std::panic::catch_unwind::h5c8bd7f9727564fd
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/panic.rs:137:14
  26:        0x102f349a4 - std::rt::lang_start_internal::hdc2636ae7a3e6166
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/rt.rs:148:20
  27:        0x102c869e8 - std::rt::lang_start::h6d1e1203470b3e8d
                               at /rustc/758f19645b8ebce61ea52d1f6672fd057bc8dbee/library/std/src/rt.rs:165:17
  28:        0x102ed6bfc - _main
```

</details>
2022-10-27 22:38:22 +00:00
Harvey Hunt 36aa6ca39c linux: Add POSIX_SPAWN_SETSID flag
This flag allows the child process created by POSIX spawn to create
a new session and become leader of a new process group. Expose the
flag so that Rust code can use it.
2022-10-26 21:22:31 +01:00
bors a90993ec23 Auto merge of #2982 - JohnTitor:release-0.2.137, r=JohnTitor
Prepare 0.2.137 release

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-10-25 21:45:00 +00:00
Yuki Okushi 2cd24f52db
Prepare 0.2.137 releaase
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-10-26 06:44:24 +09:00
bors 7e8f84c2bb Auto merge of #2979 - redox-os:redox-0.2.136, r=JohnTitor
Add MADV constants for Redox

Required for `memmap2` crate
2022-10-25 14:28:06 +00:00
Takayuki Nakata e206853f48 Fix typo: readfs -> readfds 2022-10-25 22:06:27 +09:00
bors a8b7b9c592 Auto merge of #2974 - SteveLauC:dirname-basename, r=JohnTitor
add dirname and basename

This PR adds `dirname(3)` and `basename(3)` on the following platforms:
* Linux with glibc
* Linux with musl
* Android
* FreeBSD
* DragonFlyBSD
* NetBSD
* OpenBSD
* Apple platforms

I tested this PR on my host machine (Linux with glibc), and got the following error:
```
RUNNING ALL TESTS
bad basename function pointer: rust: 140093945892128 (0x7f6a29e14d20) != c 140093945544944 (0x7f6a29dc00f0)
thread 'main' panicked at 'some tests failed', /home/steve/Documents/workspace/libc/target/debug/build/libc-test-592f01d15ee93e7a/out/main.rs:12:21
stack backtrace:
   0: std::panicking::begin_panic
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:616:12
   1: main::main
             at /home/steve/Documents/workspace/libc/target/debug/build/libc-test-592f01d15ee93e7a/out/main.rs:12:21
   2: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: test failed, to rerun pass '--test main'
```
The reason for this error probably is that there are two `basename(3)` on Linux with glibc, the  POSIX version and the GNU version, and they clash with each other. In C, if one `#include <libgen.h>`, then the POSIX version will be available; If one ` #define _GNU_SOURCE` and `#include <string.h>`, then the GNU one will be used.

Can we distinguish them in `libc`?
2022-10-25 10:41:18 +00:00
bors 3cdabffc40 Auto merge of #2978 - devnexen:musl_emscripten_msg_constants, r=JohnTitor
follow-up on #2963, changing MSG* constant types for musl/emscripten.
2022-10-25 09:34:45 +00:00
bors 3ee203bc63 Auto merge of #2980 - JohnTitor:ignore-res-init-macos, r=JohnTitor
Ignore `res_init` test on macOS

This addresses the below failure:

```
 = note: Undefined symbols for architecture x86_64:
            "_res_9_init", referenced from:
                main::fn_res_init::h8e336279ac8061c4 in main-00bd2ff8180a104c.3yxb2bpe56zwhp2u.rcgu.o
                ___test_fn_res_init in libmain.a(main.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-10-25 08:24:59 +00:00
Yuki Okushi 8081c99181
Ignore res_init test on macOS
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-10-25 17:15:16 +09:00
David Carlier 4ba884ac18 follow-up on #2963, changing MSG* constant types for musl/emscripten. 2022-10-25 06:42:47 +01:00
Jeremy Soller f9d1f3ed1d Add MADV constants for Redox 2022-10-24 21:13:41 -06:00
Steve Lau 5ffdbc6847 expose dirname and basename 2022-10-25 08:04:54 +08:00
bors 09ad0b37f3 Auto merge of #2975 - JohnTitor:release-0.2.136, r=JohnTitor
Prepare 0.2.136 release

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-10-24 09:47:29 +00:00
Yuki Okushi 5e3c7089fc
Prepare 0.2.136 release
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-10-24 18:31:31 +09:00
bors 71b864d377 Auto merge of #2969 - pfmooney:illumos-aout, r=JohnTitor
illumos: Remove obsolete (and private) a.out define

This cleans up an obsolete definition which [has been removed](fec0470817 (diff-33b9ac79706b16f65c95e909fde32771b388f896bee74a006d13fefdf877fe91L163)) in upstream illumos, and thus is causing libc-test to fail on up-to-date machines.
2022-10-23 03:34:16 +00:00
bors cc19b6f080 Auto merge of #2973 - asomers:MNT_bsd, r=JohnTitor
Add more MNT_ flags on {Dragonfly,Net,Open}BSD
2022-10-23 02:31:21 +00:00
Alan Somers 8acaac5ddf Add new definitions to libc-test/semver 2022-10-22 19:54:28 -06:00
bors a59c842948 Auto merge of #2963 - devnexen:recvmsg_linux_fix, r=JohnTitor
linux fixes recvmmsg flags type for musl/emscripten.

closes #2945
2022-10-23 00:28:31 +00:00
Alan Somers cfa31165a9 Style fixes, and filter out duplicate definitions 2022-10-22 10:23:26 -06:00
Alan Somers 138202dae5 Add more MNT_ flags on {Dragonfly,Net,Open}BSD 2022-10-22 09:22:05 -06:00
David Carlier 00204b0e20 warns that in the near future the MSG_* constants will have
a type change to fit Musl and Emscripten.

close #2945.
2022-10-22 08:14:24 +01:00
bors 0488a83dc9 Auto merge of #2968 - name1e5s:macos_clocks, r=JohnTitor
add missing clockid_t on macOS

See https://github.com/apple-open-source-mirror/Libc/blob/master/include/time.h#L205
2022-10-18 23:40:30 +00:00
bors e96f3abac8 Auto merge of #2966 - redox-os:redox-0.2.135, r=JohnTitor
Redox updates

Adds some missing constants and functions for Redox
2022-10-18 22:36:41 +00:00