mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-01 01:26:32 +00:00
1) setsid/setpgrp: check child's group process ID Linux [1], FreeBSD [2] and the Open Group [3] manuals for both setsid and setpgrp state that the calling process will be assigned a process group ID that matches its process ID so check that's the case in the test by calling getpgid on the child process ID. on QNX8 (as of GA8.0.2) libc::kill(pgid) appears unable to terminate the child process so skip that check on that target as it's behavior that libstd provides no API for [1]: https://man7.org/linux/man-pages/man2/setsid.2.html [2]: https://man.freebsd.org/cgi/man.cgi?query=setsid&sektion=2 [3]: https://pubs.opengroup.org/onlinepubs/000095399/functions/setsid.html 2) fix handling of sockaddr_un.len on QNX also extend the existing tests to exercise the getsockname(2) and getpeername(2) paths with both named and unnamed Unix sockets 3) Additional fixes library/std after earlier PR renamed some targets 4) Replace more instances of "QNX Neutrino / QNX OS" with "QNX SDP" and fix up some documentation URLs 5) Tests ignored on target_os = "nto" should also be ignored on target_os = "qnx". 6) Simplify nto-qnx.md documentation cc-rs now knows about QNX so the environment isn't required
56 lines
1.6 KiB
Rust
56 lines
1.6 KiB
Rust
//@ compile-flags: -Copt-level=3
|
|
//@ aux-build:thread_local_aux.rs
|
|
//@ ignore-windows FIXME(#134939)
|
|
//@ ignore-wasm globals are used instead of thread locals
|
|
//@ ignore-emscripten globals are used instead of thread locals
|
|
//@ ignore-android does not use #[thread_local]
|
|
//@ ignore-nto does not use #[thread_local]
|
|
//@ ignore-qnx does not use #[thread_local]
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
extern crate thread_local_aux as aux;
|
|
|
|
use std::cell::Cell;
|
|
|
|
thread_local!(static A: Cell<u32> = const { Cell::new(1) });
|
|
|
|
// CHECK: [[TLS_AUX:@.+]] = external thread_local{{.*}} global i64
|
|
// CHECK: [[TLS:@.+]] = internal thread_local{{.*}} global
|
|
|
|
// CHECK-LABEL: @get
|
|
#[no_mangle]
|
|
fn get() -> u32 {
|
|
// CHECK: [[PTR:%.+]] = tail call {{.*}} ptr @llvm.threadlocal.address.p0(ptr [[TLS]])
|
|
// CHECK-NEXT: [[RET_0:%.+]] = load i32, ptr [[PTR]]
|
|
// CHECK-NEXT: ret i32 [[RET_0]]
|
|
A.with(|a| a.get())
|
|
}
|
|
|
|
// CHECK-LABEL: @set
|
|
#[no_mangle]
|
|
fn set(v: u32) {
|
|
// CHECK: [[PTR:%.+]] = tail call {{.*}} ptr @llvm.threadlocal.address.p0(ptr [[TLS]])
|
|
// CHECK-NEXT: store i32 %0, ptr [[PTR]]
|
|
// CHECK-NEXT: ret void
|
|
A.with(|a| a.set(v))
|
|
}
|
|
|
|
// CHECK-LABEL: @get_aux
|
|
#[no_mangle]
|
|
fn get_aux() -> u64 {
|
|
// CHECK: [[PTR:%.+]] = tail call {{.*}} ptr @llvm.threadlocal.address.p0(ptr [[TLS_AUX]])
|
|
// CHECK-NEXT: [[RET_1:%.+]] = load i64, ptr [[PTR]]
|
|
// CHECK-NEXT: ret i64 [[RET_1]]
|
|
aux::A.with(|a| a.get())
|
|
}
|
|
|
|
// CHECK-LABEL: @set_aux
|
|
#[no_mangle]
|
|
fn set_aux(v: u64) {
|
|
// CHECK: [[PTR:%.+]] = tail call {{.*}} ptr @llvm.threadlocal.address.p0(ptr [[TLS_AUX]])
|
|
// CHECK-NEXT: store i64 %0, ptr [[PTR]]
|
|
// CHECK-NEXT: ret void
|
|
aux::A.with(|a| a.set(v))
|
|
}
|