]>
Commit | Line | Data |
---|---|---|
f3609f0a MY |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) 2022 Masatake YAMATO <yamato@redhat.com> | |
4 | # | |
5 | # This file is part of util-linux. | |
6 | # | |
7 | # This file is free software; you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation; either version 2 of the License, or | |
10 | # (at your option) any later version. | |
11 | # | |
12 | # This file is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
17 | TS_TOPDIR="${0%/*}/../.." | |
18 | TS_DESC="NAME and KNAME column" | |
19 | ||
7e51ea86 | 20 | . "$TS_TOPDIR"/functions.sh |
f3609f0a MY |
21 | ts_init "$*" |
22 | ||
3de730ad | 23 | . "$TS_SELF/lsfd-functions.bash" |
f3609f0a MY |
24 | ts_check_test_command "$TS_CMD_LSFD" |
25 | ts_check_test_command "$TS_HELPER_MKFDS" | |
26 | ts_check_prog "sed" | |
27 | ||
28 | ts_cd "$TS_OUTDIR" | |
29 | ||
30 | PID= | |
31 | FD=3 | |
32 | EXPR="(FD == 3)" | |
33 | ||
3de730ad MY |
34 | for C in ro-regular-file pidfd socketpair; do |
35 | ts_init_subtest $C | |
36 | { | |
f3609f0a | 37 | coproc MKFDS { |
9d0d3205 | 38 | argv=() |
f3609f0a MY |
39 | case $C in |
40 | socketpair) | |
9d0d3205 MY |
41 | argv[0]="$((FD + 1))" |
42 | argv[1]="socktype=DGRAM" | |
f3609f0a | 43 | esac |
9d0d3205 | 44 | "$TS_HELPER_MKFDS" $C $FD "${argv[@]}" |
f3609f0a | 45 | } |
7e51ea86 | 46 | if read -r -u "${MKFDS[0]}" PID; then |
f3609f0a MY |
47 | ${TS_CMD_LSFD} -n -o ASSOC,KNAME,NAME -p "${PID}" -Q "${EXPR}" | { |
48 | # Replace the unpredictable an inode number for the socket | |
49 | # with "INODENUM". | |
50 | sed -e 's/\[[0-9]\+\]/[INODENUM]/g' | |
51 | } | |
52 | echo "$C"':ASSOC,KNAME,NAME': $? | |
53 | ||
7e51ea86 | 54 | kill -CONT "${PID}" |
f3609f0a | 55 | fi |
3de730ad MY |
56 | } > "$TS_OUTPUT" 2>&1 |
57 | wait "${MKFDS_PID}" | |
58 | if [ "$C-$?" == "pidfd-$ENOSYS" ]; then | |
59 | ts_skip_subtest "pidfd_open(2) is not available" | |
60 | contiue | |
61 | fi | |
62 | ts_finalize_subtest | |
63 | done | |
f3609f0a MY |
64 | |
65 | ts_finalize |