Files
rust/tests/ui/command/command-setgroups.rs
Jorge Aparicio 49769afe4b QNX SDP 8 fixes.
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
2026-07-07 17:31:05 +01:00

28 lines
755 B
Rust

//@ run-pass
//@ only-unix (this is a unix-specific test)
//@ ignore-musl - returns dummy result for _SC_NGROUPS_MAX
//@ ignore-nto - does not have `/bin/id`, expects groups to be i32 (not u32)
//@ ignore-qnx - does not have `/bin/id`, expects groups to be i32 (not u32)
//@ needs-subprocess
#![feature(rustc_private)]
#![feature(setgroups)]
extern crate libc;
use std::process::Command;
use std::os::unix::process::CommandExt;
fn main() {
#[cfg(unix)]
run()
}
#[cfg(unix)]
fn run() {
let max_ngroups = unsafe { libc::sysconf(libc::_SC_NGROUPS_MAX) };
let max_ngroups = max_ngroups as u32 + 1;
let vec: Vec<u32> = (0..max_ngroups).collect();
let p = Command::new("/bin/id").groups(&vec[..]).spawn();
assert!(p.is_err());
}