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>
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"
$
```
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.
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.
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.
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.
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`?
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>