- 3 UNKN pidfd
-pidfd:ASSOC,STTYPE,AINODECLASS: 0
3 UNKN inotify
inotify:ASSOC,STTYPE,AINODECLASS: 0
--- /dev/null
+ 3 UNKN pidfd
+pidfd:ASSOC,STTYPE,AINODECLASS: 0
+++ /dev/null
- 3 /etc/passwd /etc/passwd
-ro-regular-file:ASSOC,KNAME,NAME: 0
- 3 anon_inode:[pidfd] pid=1 comm= nspid=1
-pidfd:ASSOC,KNAME,NAME: 0
- 3 socket:[INODENUM] state=connected type=dgram
-socketpair:ASSOC,KNAME,NAME: 0
--- /dev/null
+ 3 anon_inode:[pidfd] pid=1 comm= nspid=1
+pidfd:ASSOC,KNAME,NAME: 0
--- /dev/null
+ 3 /etc/passwd /etc/passwd
+ro-regular-file:ASSOC,KNAME,NAME: 0
--- /dev/null
+ 3 socket:[INODENUM] state=connected type=dgram
+socketpair:ASSOC,KNAME,NAME: 0
+++ /dev/null
- 3 REG REG
-ro-regular-file:ASSOC,STTYPE,TYPE: 0
- 3 UNKN pidfd
-pidfd:ASSOC,STTYPE,TYPE: 0
- 3 UNKN inotify
-inotify:ASSOC,STTYPE,TYPE: 0
- 3 SOCK UNIX
-socketpair:ASSOC,STTYPE,TYPE: 0
--- /dev/null
+ 3 UNKN inotify
+inotify:ASSOC,STTYPE,TYPE: 0
--- /dev/null
+ 3 UNKN pidfd
+pidfd:ASSOC,STTYPE,TYPE: 0
--- /dev/null
+ 3 REG REG
+ro-regular-file:ASSOC,STTYPE,TYPE: 0
--- /dev/null
+ 3 SOCK UNIX
+socketpair:ASSOC,STTYPE,TYPE: 0
int fd = pidfd_open(pid, 0);
if (fd < 0)
- err(EXIT_FAILURE, "failed in pidfd_open(%d)", (int)pid);
+ err((errno == ENOSYS? EXIT_ENOSYS: EXIT_FAILURE),
+ "failed in pidfd_open(%d)", (int)pid);
free_arg(&target_pid);
if (fd != fdescs[0].fd) {
. "$TS_TOPDIR"/functions.sh
ts_init "$*"
+. "$TS_SELF/lsfd-functions.bash"
ts_check_test_command "$TS_CMD_LSFD"
ts_check_test_command "$TS_HELPER_MKFDS"
-ts_skip_qemu_user
ts_cd "$TS_OUTDIR"
FD=3
EXPR="(FD == 3)"
-{
- for C in pidfd inotify; do
+for C in pidfd inotify; do
+ ts_init_subtest $C
+ {
coproc MKFDS { "$TS_HELPER_MKFDS" $C $FD ; }
if read -r -u "${MKFDS[0]}" PID; then
${TS_CMD_LSFD} -n -o ASSOC,STTYPE,AINODECLASS -p "${PID}" -Q "${EXPR}"
kill -CONT "${PID}"
fi
wait "${MKFDS_PID}"
- done
-} > "$TS_OUTPUT" 2>&1
+ } > "$TS_OUTPUT" 2>&1
+ if [ "$C-$?" == "pidfd-$ENOSYS" ]; then
+ ts_skip_subtest "pidfd_open(2) is not available"
+ continue
+ fi
+ ts_finalize_subtest
+done
ts_finalize
. "$TS_TOPDIR"/functions.sh
ts_init "$*"
+. "$TS_SELF/lsfd-functions.bash"
ts_check_test_command "$TS_CMD_LSFD"
ts_check_test_command "$TS_HELPER_MKFDS"
ts_check_prog "sed"
-ts_skip_qemu_user
ts_cd "$TS_OUTDIR"
FD=3
EXPR="(FD == 3)"
-{
- for C in ro-regular-file pidfd socketpair; do
+for C in ro-regular-file pidfd socketpair; do
+ ts_init_subtest $C
+ {
coproc MKFDS {
argv=()
case $C in
kill -CONT "${PID}"
fi
- wait "${MKFDS_PID}"
- done
-} > "$TS_OUTPUT" 2>&1
+ } > "$TS_OUTPUT" 2>&1
+ wait "${MKFDS_PID}"
+ if [ "$C-$?" == "pidfd-$ENOSYS" ]; then
+ ts_skip_subtest "pidfd_open(2) is not available"
+ contiue
+ fi
+ ts_finalize_subtest
+done
ts_finalize
. "$TS_TOPDIR"/functions.sh
ts_init "$*"
+. "$TS_SELF/lsfd-functions.bash"
ts_check_test_command "$TS_CMD_LSFD"
ts_check_test_command "$TS_HELPER_MKFDS"
-ts_skip_qemu_user
ts_cd "$TS_OUTDIR"
FD=3
EXPR="(FD == 3)"
-{
- for C in ro-regular-file pidfd inotify socketpair; do
+for C in ro-regular-file pidfd inotify socketpair; do
+ ts_init_subtest $C
+ {
coproc MKFDS {
argv=()
case $C in
kill -CONT "${PID}"
fi
wait "${MKFDS_PID}"
- done
-} > "$TS_OUTPUT" 2>&1
+ } > "$TS_OUTPUT" 2>&1
+ if [ "$C-$?" == "pidfd-$ENOSYS" ]; then
+ ts_skip_subtest "pidfd_open(2) is not available"
+ continue
+ fi
+ ts_finalize_subtest
+done
ts_finalize
. "$TS_TOPDIR"/functions.sh
ts_init "$*"
+. "$TS_SELF/lsfd-functions.bash"
ts_check_test_command "$TS_CMD_LSFD"
ts_check_test_command "$TS_HELPER_MKFDS"
ts_check_prog "ps"
fi
wait ${MKFDS_PID}
} > $TS_OUTPUT 2>&1
+if [ "$?" == "$ENOSYS" ]; then
+ ts_skip "pidfd_open(2) is not available"
+fi
ts_finalize
. "$TS_TOPDIR"/functions.sh
ts_init "$*"
ts_skip_nonroot
-ts_skip_qemu_user
ts_check_test_command "$TS_CMD_LSFD"